@telepath-computer/television 0.1.77 → 0.1.79

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 Ub=Object.defineProperty;var sd=n=>{throw TypeError(n)};var Fb=(n,e,t)=>e in n?Ub(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>Fb(n,typeof e!="symbol"?e+"":e,t),Cl=(n,e,t)=>e.has(n)||sd("Cannot "+t);var l=(n,e,t)=>(Cl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?sd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),E=(n,e,t,r)=>(Cl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),f=(n,e,t)=>(Cl(n,e,"access private method"),t);var od=(n,e,t,r)=>({set _(i){E(n,e,i,t)},get _(){return l(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 Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zb(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 ad=Object.prototype.toString,ng=function(e){var t=ad.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ad.call(e.callee)==="[object Function]"),r},Pl,ld;function Hb(){if(ld)return Pl;ld=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=ng,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(v){var m=v.constructor;return m&&m.prototype===v},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 v in window)try{if(!u["$"+v]&&e.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),p=function(v){if(typeof window>"u"||!h)return c(v);try{return c(v)}catch{return!1}};n=function(m){var x=m!==null&&typeof m=="object",_=t.call(m)==="[object Function]",C=r(m),U=x&&t.call(m)==="[object String]",P=[];if(!x&&!_&&!C)throw new TypeError("Object.keys called on a non-object");var B=o&&_;if(U&&m.length>0&&!e.call(m,0))for(var L=0;L<m.length;++L)P.push(String(L));if(C&&m.length>0)for(var V=0;V<m.length;++V)P.push(String(V));else for(var F in m)!(B&&F==="prototype")&&e.call(m,F)&&P.push(String(F));if(s)for(var he=p(m),de=0;de<a.length;++de)!(he&&a[de]==="constructor")&&e.call(m,a[de])&&P.push(a[de]);return P}}return Pl=n,Pl}var Wb=Array.prototype.slice,Vb=ng,cd=Object.keys,jo=cd?function(e){return cd(e)}:Hb(),ud=Object.keys;jo.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 Vb(r)?ud(Wb.call(r)):ud(r)})}else Object.keys=jo;return Object.keys||jo};var Bb=jo,qo=Object.defineProperty||!1;if(qo)try{qo({},"a",{value:1})}catch{qo=!1}var ro=qo,Qt=SyntaxError,X=TypeError,Gb=Object.getOwnPropertyDescriptor,Yo=Gb;if(Yo)try{Yo([],"length")}catch{Yo=null}var ki=Yo,hd=ro,jb=Qt,Dr=X,dd=ki,rg=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Dr("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Dr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Dr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Dr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Dr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Dr("`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,c=!!dd&&dd(e,t);if(hd)hd(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new jb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ec=ro,ig=function(){return!!Ec};ig.hasArrayLengthDefineBug=function(){if(!Ec)return null;try{return Ec([],"length",{value:1}).length!==1}catch{return!0}};var Ja=ig,qb=Bb,Yb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Xb=Object.prototype.toString,Kb=Array.prototype.concat,pd=rg,Jb=function(n){return typeof n=="function"&&Xb.call(n)==="[object Function]"},sg=Ja(),Qb=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Jb(r)||!r())return}sg?pd(n,e,t,!0):pd(n,e,t)},og=function(n,e){var t=arguments.length>2?arguments[2]:{},r=qb(e);Yb&&(r=Kb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)Qb(n,r[i],e[r[i]],t[r[i]])};og.supportsDescriptors=!!sg;var kr=og,Xo={exports:{}};typeof self<"u"?Xo.exports=self:typeof window<"u"?Xo.exports=window:Xo.exports=Function("return this")();var ag=Xo.exports,ew=ag,lg=function(){return typeof Hn!="object"||!Hn||Hn.Math!==Math||Hn.Array!==Array?ew:Hn},tw=kr,nw=ki,rw=lg,iw=function(){var e=rw();if(tw.supportsDescriptors){var t=nw(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},sw=kr,ow=ag,cg=lg,aw=iw,lw=cg(),ug=function(){return lw};sw(ug,{getPolyfill:cg,implementation:ow,shim:aw});var Tu=ug,en=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},Cu=Object,hg=Error,cw=EvalError,uw=RangeError,Pu=ReferenceError,hw=URIError,dw=Math.abs,pw=Math.floor,fw=Math.max,gw=Math.min,mw=Math.pow,vw=Math.round,Ru=Number.isNaN||function(e){return e!==e},yw=Ru,bw=function(e){return yw(e)||e===0?e:e<0?-1:1},Ei=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},fd=typeof Symbol<"u"&&Symbol,ww=Ei,Du=function(){return typeof fd!="function"||typeof Symbol!="function"||typeof fd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ww()},dg=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,Sw=Cu,pg=Sw.getPrototypeOf||null,_w="Function.prototype.bind called on incompatible ",kw=Object.prototype.toString,Ew=Math.max,xw="[object Function]",gd=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},Aw=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},$w=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},Iw=function(e){var t=this;if(typeof t!="function"||kw.apply(t)!==xw)throw new TypeError(_w+t);for(var r=Aw(arguments,1),i,s=function(){if(this instanceof i){var h=t.apply(this,gd(r,arguments));return Object(h)===h?h:this}return t.apply(e,gd(r,arguments))},o=Ew(0,t.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+$w(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},Tw=Iw,io=Function.prototype.bind||Tw,Lu=Function.prototype.call,zu=Function.prototype.apply,Cw=typeof Reflect<"u"&&Reflect&&Reflect.apply,Pw=io,Rw=zu,Dw=Lu,Lw=Cw,fg=Lw||Pw.call(Dw,Rw),zw=io,Ow=X,Mw=Lu,Nw=fg,Qa=function(e){if(e.length<1||typeof e[0]!="function")throw new Ow("a function is required");return Nw(zw,Mw,e)},Uw=Qa,md=ki,gg;try{gg=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Rl=!!gg&&md&&md(Object.prototype,"__proto__"),mg=Object,vd=mg.getPrototypeOf,Fw=Rl&&typeof Rl.get=="function"?Uw([Rl.get]):typeof vd=="function"?function(e){return vd(e==null?e:mg(e))}:!1,yd=dg,bd=pg,wd=Fw,vg=yd?function(e){return yd(e)}:bd?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return bd(e)}:wd?function(e){return wd(e)}:null,Zw=Function.prototype.call,Hw=Object.prototype.hasOwnProperty,Ww=io,tn=Ww.call(Zw,Hw),Y,Vw=Cu,Bw=hg,Gw=cw,jw=uw,qw=Pu,vi=Qt,Xr=X,Yw=hw,Xw=dw,Kw=pw,Jw=fw,Qw=gw,e0=mw,t0=vw,n0=bw,yg=Function,Dl=function(n){try{return yg('"use strict"; return ('+n+").constructor;")()}catch{}},cs=ki,r0=ro,Ll=function(){throw new Xr},i0=cs?function(){try{return arguments.callee,Ll}catch{try{return cs(arguments,"callee").get}catch{return Ll}}}():Ll,Lr=Du(),xe=vg,s0=pg,o0=dg,bg=zu,so=Lu,Ur={},a0=typeof Uint8Array>"u"||!xe?Y:xe(Uint8Array),mr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Y:ArrayBuffer,"%ArrayIteratorPrototype%":Lr&&xe?xe([][Symbol.iterator]()):Y,"%AsyncFromSyncIteratorPrototype%":Y,"%AsyncFunction%":Ur,"%AsyncGenerator%":Ur,"%AsyncGeneratorFunction%":Ur,"%AsyncIteratorPrototype%":Ur,"%Atomics%":typeof Atomics>"u"?Y:Atomics,"%BigInt%":typeof BigInt>"u"?Y:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Y:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Bw,"%eval%":eval,"%EvalError%":Gw,"%Float16Array%":typeof Float16Array>"u"?Y:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Y:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Y:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Y:FinalizationRegistry,"%Function%":yg,"%GeneratorFunction%":Ur,"%Int8Array%":typeof Int8Array>"u"?Y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Lr&&xe?xe(xe([][Symbol.iterator]())):Y,"%JSON%":typeof JSON=="object"?JSON:Y,"%Map%":typeof Map>"u"?Y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Lr||!xe?Y:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Vw,"%Object.getOwnPropertyDescriptor%":cs,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Y:Promise,"%Proxy%":typeof Proxy>"u"?Y:Proxy,"%RangeError%":jw,"%ReferenceError%":qw,"%Reflect%":typeof Reflect>"u"?Y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Lr||!xe?Y:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Lr&&xe?xe(""[Symbol.iterator]()):Y,"%Symbol%":Lr?Symbol:Y,"%SyntaxError%":vi,"%ThrowTypeError%":i0,"%TypedArray%":a0,"%TypeError%":Xr,"%Uint8Array%":typeof Uint8Array>"u"?Y:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Y:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Y:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Y:Uint32Array,"%URIError%":Yw,"%WeakMap%":typeof WeakMap>"u"?Y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Y:WeakSet,"%Function.prototype.call%":so,"%Function.prototype.apply%":bg,"%Object.defineProperty%":r0,"%Object.getPrototypeOf%":s0,"%Math.abs%":Xw,"%Math.floor%":Kw,"%Math.max%":Jw,"%Math.min%":Qw,"%Math.pow%":e0,"%Math.round%":t0,"%Math.sign%":n0,"%Reflect.getPrototypeOf%":o0};if(xe)try{null.error}catch(n){var l0=xe(xe(n));mr["%Error.prototype%"]=l0}var c0=function n(e){var t;if(e==="%AsyncFunction%")t=Dl("async function () {}");else if(e==="%GeneratorFunction%")t=Dl("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Dl("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&xe&&(t=xe(i.prototype))}return mr[e]=t,t},Sd={__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"]},oo=io,da=tn,u0=oo.call(so,Array.prototype.concat),h0=oo.call(bg,Array.prototype.splice),_d=oo.call(so,String.prototype.replace),pa=oo.call(so,String.prototype.slice),d0=oo.call(so,RegExp.prototype.exec),p0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,f0=/\\(\\)?/g,g0=function(e){var t=pa(e,0,1),r=pa(e,-1);if(t==="%"&&r!=="%")throw new vi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new vi("invalid intrinsic syntax, expected opening `%`");var i=[];return _d(e,p0,function(s,o,a,c){i[i.length]=a?_d(c,f0,"$1"):o||s}),i},m0=function(e,t){var r=e,i;if(da(Sd,r)&&(i=Sd[r],r="%"+i[0]+"%"),da(mr,r)){var s=mr[r];if(s===Ur&&(s=c0(r)),typeof s>"u"&&!t)throw new Xr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new vi("intrinsic "+e+" does not exist!")},ut=function(e,t){if(typeof e!="string"||e.length===0)throw new Xr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Xr('"allowMissing" argument must be a boolean');if(d0(/^%?[^%]*%?$/,e)===null)throw new vi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=g0(e),i=r.length>0?r[0]:"",s=m0("%"+i+"%",t),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],h0(r,u0([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var v=r[h],m=pa(v,0,1),x=pa(v,-1);if((m==='"'||m==="'"||m==="`"||x==='"'||x==="'"||x==="`")&&m!==x)throw new vi("property names with quotes must have matching quotes");if((v==="constructor"||!p)&&(c=!0),i+="."+v,o="%"+i+"%",da(mr,o))a=mr[o];else if(a!=null){if(!(v in a)){if(!t)throw new Xr("base intrinsic for "+e+" exists, but the property is not available.");return}if(cs&&h+1>=r.length){var _=cs(a,v);p=!!_,p&&"get"in _&&!("originalValue"in _.get)?a=_.get:a=a[v]}else p=da(a,v),a=a[v];p&&!c&&(mr[o]=a)}}return a},zl,kd;function Tn(){if(kd)return zl;kd=1;var n=ut,e=Qa,t=e([n("%String.prototype.indexOf%")]);return zl=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},zl}var Ol,Ed;function Ou(){if(Ed)return Ol;Ed=1;var n=ut,e=n("%Array%"),t=!e.isArray&&Tn()("Object.prototype.toString");return Ol=e.isArray||function(i){return t(i)==="[object Array]"},Ol}var v0=Ja,xd=ro,wg=v0.hasArrayLengthDefineBug(),y0=wg&&Ou(),b0=Tn(),w0=b0("Object.prototype.propertyIsEnumerable"),Mu=function(e,t,r,i,s,o){if(!xd){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&w0(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return wg&&s==="length"&&"[[Value]]"in o&&y0(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(xd(i,s,r(o)),!0)},S0=X,Ni=tn,_0={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},xi=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Ni(e,t)&&!_0[t])return!1;var r=Ni(e,"[[Value]]")||Ni(e,"[[Writable]]"),i=Ni(e,"[[Get]]")||Ni(e,"[[Set]]");if(r&&i)throw new S0("Property Descriptors may not be both accessor and data descriptors");return!0},Sg=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},k0=X,E0=xi,x0=Sg,_g=function(e){if(typeof e<"u"&&!E0(e))throw new k0("Assertion failed: `Desc` must be a Property Descriptor");return x0(e)},A0=X,Ad=tn,$0=xi,kg=function(e){if(typeof e>"u")return!1;if(!$0(e))throw new A0("Assertion failed: `Desc` must be a Property Descriptor");return!(!Ad(e,"[[Value]]")&&!Ad(e,"[[Writable]]"))},Ai=function(e){return typeof e=="string"||typeof e=="symbol"},$d=Ru,Eg=function(e,t){return e===t?e===0?1/e===1/t:!0:$d(e)&&$d(t)},Id=X,I0=en,T0=Mu,C0=_g,P0=kg,R0=Ai,D0=Eg,Nu=function(e,t,r){if(!I0(e))throw new Id("Assertion failed: Type(O) is not Object");if(!R0(t))throw new Id("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return T0(P0,D0,C0,e,t,i)},xg=Function.prototype.toString,Gr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,xc,Ko;if(typeof Gr=="function"&&typeof Object.defineProperty=="function")try{xc=Object.defineProperty({},"length",{get:function(){throw Ko}}),Ko={},Gr(function(){throw 42},null,xc)}catch(n){n!==Ko&&(Gr=null)}else Gr=null;var L0=/^\s*class\b/,Ac=function(e){try{var t=xg.call(e);return L0.test(t)}catch{return!1}},Ml=function(e){try{return Ac(e)?!1:(xg.call(e),!0)}catch{return!1}},Jo=Object.prototype.toString,z0="[object Object]",O0="[object Function]",M0="[object GeneratorFunction]",N0="[object HTMLAllCollection]",U0="[object HTML document.all class]",F0="[object HTMLCollection]",Z0=typeof Symbol=="function"&&!!Symbol.toStringTag,H0=!(0 in[,]),$c=function(){return!1};if(typeof document=="object"){var W0=document.all;Jo.call(W0)===Jo.call(document.all)&&($c=function(e){if((H0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Jo.call(e);return(t===N0||t===U0||t===F0||t===z0)&&e("")==null}catch{}return!1})}var Ag=Gr?function(e){if($c(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Gr(e,null,xc)}catch(t){if(t!==Ko)return!1}return!Ac(e)&&Ml(e)}:function(e){if($c(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Z0)return Ml(e);if(Ac(e))return!1;var t=Jo.call(e);return t!==O0&&t!==M0&&!/^\[object HTML/.test(t)?!1:Ml(e)},V0=Ag,B0=function(e){return!!e},kt=tn,Io=X,G0=en,Td=V0,Nl=B0,j0=function(e){if(!G0(e))throw new Io("ToPropertyDescriptor requires an object");var t={};if(kt(e,"enumerable")&&(t["[[Enumerable]]"]=Nl(e.enumerable)),kt(e,"configurable")&&(t["[[Configurable]]"]=Nl(e.configurable)),kt(e,"value")&&(t["[[Value]]"]=e.value),kt(e,"writable")&&(t["[[Writable]]"]=Nl(e.writable)),kt(e,"get")){var r=e.get;if(typeof r<"u"&&!Td(r))throw new Io("getter must be a function");t["[[Get]]"]=r}if(kt(e,"set")){var i=e.set;if(typeof i<"u"&&!Td(i))throw new Io("setter must be a function");t["[[Set]]"]=i}if((kt(t,"[[Get]]")||kt(t,"[[Set]]"))&&(kt(t,"[[Value]]")||kt(t,"[[Writable]]")))throw new Io("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Ul=X,q0=en,Cd=xi,Y0=Mu,X0=_g,K0=kg,J0=Ai,Q0=Eg,eS=j0,tS=function(e,t,r){if(!q0(e))throw new Ul("Assertion failed: Type(O) is not Object");if(!J0(t))throw new Ul("Assertion failed: P is not a Property Key");var i=Cd(r)?r:eS(r);if(!Cd(i))throw new Ul("Assertion failed: Desc is not a valid Property Descriptor");return Y0(K0,Q0,X0,e,t,i)},Pd=X,nS=en,rS=tS,iS=Ai,sS=function(e,t,r){if(!nS(e))throw new Pd("Assertion failed: Type(O) is not Object");if(!iS(t))throw new Pd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return rS(e,t,i)},oS=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,aS=Cu,lS=aS.setPrototypeOf||null,cS=Qa,Rd=ki,uS=X,$g={};try{$g.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var hS=!("toString"in $g),Fl=Rd&&Rd(Object.prototype,"__proto__"),dS=hS&&(!!Fl&&typeof Fl.set=="function"&&cS([Fl.set])||function(e,t){if(e==null)throw new uS("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),Dd=oS,pS=lS,Ld=dS,fS=X,gS=Dd?function(e,t){if(Dd(e,t))return e;throw new fS("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:pS||(Ld?function(e,t){return Ld(e,t),e}:null),zd=X,mS=en,Od=vg,vS=function(e){if(!mS(e))throw new zd("Assertion failed: O must be an Object");if(!Od)throw new zd("This environment does not support fetching prototypes.");return Od(e)},yS=X,bS=gS,wS=en,SS=vS,_S=function(e,t){if(t!==null&&!wS(t))throw new yS("Assertion failed: V must be Object or Null");try{bS(e,t)}catch{return!1}return SS(e)===t},Zl=Nu,Md=sS,Ig=_S,kS=Ja(),Uu=hg;function ao(n,e,t){var r=new Uu(t);return Ig(r,Qo),delete r.constructor,Md(r,"error",n),Md(r,"suppressed",e),r}kS&&Object.defineProperty(ao,"prototype",{writable:!1});var Qo=ao.prototype;if(!Zl(Qo,"constructor",ao)||!Zl(Qo,"message","")||!Zl(Qo,"name","SuppressedError"))throw new Uu("unable to install SuppressedError.prototype properties; please report this!");Ig(ao.prototype,Uu.prototype);var ES=ao,xS=ES,Tg=function(){return typeof SuppressedError=="function"?SuppressedError:xS},AS=kr,Nd=Tu(),$S=Tg,IS=function(){var e=$S();return AS(Nd,{SuppressedError:e},{SuppressedError:function(){return Nd.SuppressedError!==e}}),e};IS();var TS=X,CS=xi,PS=Sg,RS=function(e){if(typeof e<"u"&&!CS(e))throw new TS("Assertion failed: `Desc` must be a Property Descriptor");return PS(e)},DS=X,Ud=tn,LS=xi,zS=function(e){if(typeof e>"u")return!1;if(!LS(e))throw new DS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Ud(e,"[[Value]]")&&!Ud(e,"[[Writable]]"))},Fd=Ru,OS=function(e,t){return e===t?e===0?1/e===1/t:!0:Fd(e)&&Fd(t)},$i=Ag,MS=function(e){return!!e},Et=tn,To=X,NS=en,Zd=$i,Hl=MS,US=function(e){if(!NS(e))throw new To("ToPropertyDescriptor requires an object");var t={};if(Et(e,"enumerable")&&(t["[[Enumerable]]"]=Hl(e.enumerable)),Et(e,"configurable")&&(t["[[Configurable]]"]=Hl(e.configurable)),Et(e,"value")&&(t["[[Value]]"]=e.value),Et(e,"writable")&&(t["[[Writable]]"]=Hl(e.writable)),Et(e,"get")){var r=e.get;if(typeof r<"u"&&!Zd(r))throw new To("getter must be a function");t["[[Get]]"]=r}if(Et(e,"set")){var i=e.set;if(typeof i<"u"&&!Zd(i))throw new To("setter must be a function");t["[[Set]]"]=i}if((Et(t,"[[Get]]")||Et(t,"[[Set]]"))&&(Et(t,"[[Value]]")||Et(t,"[[Writable]]")))throw new To("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Wl=X,FS=en,Hd=xi,ZS=Mu,HS=RS,WS=zS,VS=Ai,BS=OS,GS=US,lo=function(e,t,r){if(!FS(e))throw new Wl("Assertion failed: Type(O) is not Object");if(!VS(t))throw new Wl("Assertion failed: P is not a Property Key");var i=Hd(r)?r:GS(r);if(!Hd(i))throw new Wl("Assertion failed: Desc is not a valid Property Descriptor");return ZS(WS,BS,HS,e,t,i)},jS=Ei(),qS=jS?Symbol.dispose||Symbol("Symbol.dispose"):null,YS=Ei,XS=qS,Fu=function(){return YS()&&Symbol.dispose||XS},KS=Du,JS=lo,QS=Fu,e_=function(){var e=QS();return KS()&&JS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},t_=Ei(),n_=t_?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,r_=Ei,i_=n_,Zu=function(){return r_()&&Symbol.asyncDispose||i_},s_=Du,o_=lo,a_=Zu,l_=function(){var e=a_();return s_()&&o_(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},c_=Ou(),u_=ut,h_=Tn(),d_=X,p_=c_,f_=u_("%Reflect.apply%",!0)||h_("Function.prototype.apply"),el=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!p_(r))throw new d_("Assertion failed: optional `argumentsList`, if provided, must be a List");return f_(e,t,r)};const g_={},m_=Object.freeze(Object.defineProperty({__proto__:null,default:g_},Symbol.toStringTag,{value:"Module"})),v_=Zb(m_);var Hu=typeof Map=="function"&&Map.prototype,Vl=Object.getOwnPropertyDescriptor&&Hu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,fa=Hu&&Vl&&typeof Vl.get=="function"?Vl.get:null,Wd=Hu&&Map.prototype.forEach,Wu=typeof Set=="function"&&Set.prototype,Bl=Object.getOwnPropertyDescriptor&&Wu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ga=Wu&&Bl&&typeof Bl.get=="function"?Bl.get:null,Vd=Wu&&Set.prototype.forEach,y_=typeof WeakMap=="function"&&WeakMap.prototype,is=y_?WeakMap.prototype.has:null,b_=typeof WeakSet=="function"&&WeakSet.prototype,ss=b_?WeakSet.prototype.has:null,w_=typeof WeakRef=="function"&&WeakRef.prototype,Bd=w_?WeakRef.prototype.deref:null,S_=Boolean.prototype.valueOf,__=Object.prototype.toString,k_=Function.prototype.toString,E_=String.prototype.match,Vu=String.prototype.slice,_n=String.prototype.replace,x_=String.prototype.toUpperCase,Gd=String.prototype.toLowerCase,Cg=RegExp.prototype.test,jd=Array.prototype.concat,Dt=Array.prototype.join,A_=Array.prototype.slice,qd=Math.floor,Ic=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Gl=Object.getOwnPropertySymbols,Tc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,yi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",os=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===yi||!0)?Symbol.toStringTag:null,Pg=Object.prototype.propertyIsEnumerable,Yd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Xd(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Cg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-qd(-n):qd(n);if(r!==n){var i=String(r),s=Vu.call(e,i.length+1);return _n.call(i,t,"$&_")+"."+_n.call(_n.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _n.call(e,t,"$&_")}var Cc=v_,Kd=Cc.custom,Jd=Lg(Kd)?Kd:null,Rg={__proto__:null,double:'"',single:"'"},$_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Ii=function n(e,t,r,i){var s=t||{};if(Ht(s,"quoteStyle")&&!Ht(Rg,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 Og(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?Xd(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?Xd(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 Pc(e)?"[Array]":"[Object]";var p=B_(s,r);if(typeof i>"u")i=[];else if(zg(i,e)>=0)return"[Circular]";function v(wt,rn,yl){if(rn&&(i=A_.call(i),i.push(rn)),yl){var bo={depth:s.depth};return Ht(s,"quoteStyle")&&(bo.quoteStyle=s.quoteStyle),n(wt,bo,r+1,i)}return n(wt,s,r+1,i)}if(typeof e=="function"&&!Qd(e)){var m=O_(e),x=Co(e,v);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(x.length>0?" { "+Dt.call(x,", ")+" }":"")}if(Lg(e)){var _=yi?_n.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Tc.call(e);return typeof e=="object"&&!yi?Ui(_):_}if(H_(e)){for(var C="<"+Gd.call(String(e.nodeName)),U=e.attributes||[],P=0;P<U.length;P++)C+=" "+U[P].name+"="+Dg(I_(U[P].value),"double",s);return C+=">",e.childNodes&&e.childNodes.length&&(C+="..."),C+="</"+Gd.call(String(e.nodeName))+">",C}if(Pc(e)){if(e.length===0)return"[]";var B=Co(e,v);return p&&!V_(B)?"["+Rc(B,p)+"]":"[ "+Dt.call(B,", ")+" ]"}if(C_(e)){var L=Co(e,v);return!("cause"in Error.prototype)&&"cause"in e&&!Pg.call(e,"cause")?"{ ["+String(e)+"] "+Dt.call(jd.call("[cause]: "+v(e.cause),L),", ")+" }":L.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dt.call(L,", ")+" }"}if(typeof e=="object"&&o){if(Jd&&typeof e[Jd]=="function"&&Cc)return Cc(e,{depth:h-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(M_(e)){var V=[];return Wd&&Wd.call(e,function(wt,rn){V.push(v(rn,e,!0)+" => "+v(wt,e))}),ep("Map",fa.call(e),V,p)}if(F_(e)){var F=[];return Vd&&Vd.call(e,function(wt){F.push(v(wt,e))}),ep("Set",ga.call(e),F,p)}if(N_(e))return jl("WeakMap");if(Z_(e))return jl("WeakSet");if(U_(e))return jl("WeakRef");if(R_(e))return Ui(v(Number(e)));if(L_(e))return Ui(v(Ic.call(e)));if(D_(e))return Ui(S_.call(e));if(P_(e))return Ui(v(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Hn<"u"&&e===Hn)return"{ [object globalThis] }";if(!T_(e)&&!Qd(e)){var he=Co(e,v),de=Yd?Yd(e)===Object.prototype:e instanceof Object||e.constructor===Object,Dn=e instanceof Object?"":"null prototype",yo=!de&&os&&Object(e)===e&&os in e?Vu.call(Cn(e),8,-1):Dn?"Object":"",$e=de||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Ln=$e+(yo||Dn?"["+Dt.call(jd.call([],yo||[],Dn||[]),": ")+"] ":"");return he.length===0?Ln+"{}":p?Ln+"{"+Rc(he,p)+"}":Ln+"{ "+Dt.call(he,", ")+" }"}return String(e)};function Dg(n,e,t){var r=t.quoteStyle||e,i=Rg[r];return i+n+i}function I_(n){return _n.call(String(n),/"/g,"&quot;")}function Er(n){return!os||!(typeof n=="object"&&(os in n||typeof n[os]<"u"))}function Pc(n){return Cn(n)==="[object Array]"&&Er(n)}function T_(n){return Cn(n)==="[object Date]"&&Er(n)}function Qd(n){return Cn(n)==="[object RegExp]"&&Er(n)}function C_(n){return Cn(n)==="[object Error]"&&Er(n)}function P_(n){return Cn(n)==="[object String]"&&Er(n)}function R_(n){return Cn(n)==="[object Number]"&&Er(n)}function D_(n){return Cn(n)==="[object Boolean]"&&Er(n)}function Lg(n){if(yi)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Tc)return!1;try{return Tc.call(n),!0}catch{}return!1}function L_(n){if(!n||typeof n!="object"||!Ic)return!1;try{return Ic.call(n),!0}catch{}return!1}var z_=Object.prototype.hasOwnProperty||function(n){return n in this};function Ht(n,e){return z_.call(n,e)}function Cn(n){return __.call(n)}function O_(n){if(n.name)return n.name;var e=E_.call(k_.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function zg(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 M_(n){if(!fa||!n||typeof n!="object")return!1;try{fa.call(n);try{ga.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function N_(n){if(!is||!n||typeof n!="object")return!1;try{is.call(n,is);try{ss.call(n,ss)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function U_(n){if(!Bd||!n||typeof n!="object")return!1;try{return Bd.call(n),!0}catch{}return!1}function F_(n){if(!ga||!n||typeof n!="object")return!1;try{ga.call(n);try{fa.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Z_(n){if(!ss||!n||typeof n!="object")return!1;try{ss.call(n,ss);try{is.call(n,is)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function H_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Og(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Og(Vu.call(n,0,e.maxStringLength),e)+r}var i=$_[e.quoteStyle||"single"];i.lastIndex=0;var s=_n.call(_n.call(n,i,"\\$1"),/[\x00-\x1f]/g,W_);return Dg(s,"single",e)}function W_(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":"")+x_.call(e.toString(16))}function Ui(n){return"Object("+n+")"}function jl(n){return n+" { ? }"}function ep(n,e,t,r){var i=r?Rc(t,r):Dt.call(t,", ");return n+" ("+e+") {"+i+"}"}function V_(n){for(var e=0;e<n.length;e++)if(zg(n[e],`
2
- `)>=0)return!1;return!0}function B_(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 Rc(n,e){if(n.length===0)return"";var t=`
1
+ var Zb=Object.defineProperty;var od=n=>{throw TypeError(n)};var Hb=(n,e,t)=>e in n?Zb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>Hb(n,typeof e!="symbol"?e+"":e,t),Pl=(n,e,t)=>e.has(n)||od("Cannot "+t);var l=(n,e,t)=>(Pl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?od("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),E=(n,e,t,r)=>(Pl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),f=(n,e,t)=>(Pl(n,e,"access private method"),t);var ad=(n,e,t,r)=>({set _(i){E(n,e,i,t)},get _(){return l(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 Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wb(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 ld=Object.prototype.toString,rg=function(e){var t=ld.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ld.call(e.callee)==="[object Function]"),r},Rl,cd;function Vb(){if(cd)return Rl;cd=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=rg,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(v){var m=v.constructor;return m&&m.prototype===v},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 v in window)try{if(!u["$"+v]&&e.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),p=function(v){if(typeof window>"u"||!h)return c(v);try{return c(v)}catch{return!1}};n=function(m){var x=m!==null&&typeof m=="object",_=t.call(m)==="[object Function]",C=r(m),U=x&&t.call(m)==="[object String]",P=[];if(!x&&!_&&!C)throw new TypeError("Object.keys called on a non-object");var B=o&&_;if(U&&m.length>0&&!e.call(m,0))for(var L=0;L<m.length;++L)P.push(String(L));if(C&&m.length>0)for(var V=0;V<m.length;++V)P.push(String(V));else for(var F in m)!(B&&F==="prototype")&&e.call(m,F)&&P.push(String(F));if(s)for(var he=p(m),de=0;de<a.length;++de)!(he&&a[de]==="constructor")&&e.call(m,a[de])&&P.push(a[de]);return P}}return Rl=n,Rl}var Bb=Array.prototype.slice,Gb=rg,ud=Object.keys,jo=ud?function(e){return ud(e)}:Vb(),hd=Object.keys;jo.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 Gb(r)?hd(Bb.call(r)):hd(r)})}else Object.keys=jo;return Object.keys||jo};var jb=jo,qo=Object.defineProperty||!1;if(qo)try{qo({},"a",{value:1})}catch{qo=!1}var ro=qo,Qt=SyntaxError,X=TypeError,qb=Object.getOwnPropertyDescriptor,Yo=qb;if(Yo)try{Yo([],"length")}catch{Yo=null}var Ei=Yo,dd=ro,Yb=Qt,Dr=X,pd=Ei,ig=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Dr("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Dr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Dr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Dr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Dr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Dr("`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,c=!!pd&&pd(e,t);if(dd)dd(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new Yb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},xc=ro,sg=function(){return!!xc};sg.hasArrayLengthDefineBug=function(){if(!xc)return null;try{return xc([],"length",{value:1}).length!==1}catch{return!0}};var Qa=sg,Xb=jb,Kb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Jb=Object.prototype.toString,Qb=Array.prototype.concat,fd=ig,ew=function(n){return typeof n=="function"&&Jb.call(n)==="[object Function]"},og=Qa(),tw=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!ew(r)||!r())return}og?fd(n,e,t,!0):fd(n,e,t)},ag=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Xb(e);Kb&&(r=Qb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)tw(n,r[i],e[r[i]],t[r[i]])};ag.supportsDescriptors=!!og;var kr=ag,Xo={exports:{}};typeof self<"u"?Xo.exports=self:typeof window<"u"?Xo.exports=window:Xo.exports=Function("return this")();var lg=Xo.exports,nw=lg,cg=function(){return typeof Hn!="object"||!Hn||Hn.Math!==Math||Hn.Array!==Array?nw:Hn},rw=kr,iw=Ei,sw=cg,ow=function(){var e=sw();if(rw.supportsDescriptors){var t=iw(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},aw=kr,lw=lg,ug=cg,cw=ow,uw=ug(),hg=function(){return uw};aw(hg,{getPolyfill:ug,implementation:lw,shim:cw});var Cu=hg,en=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},Pu=Object,dg=Error,hw=EvalError,dw=RangeError,Ru=ReferenceError,pw=URIError,fw=Math.abs,gw=Math.floor,mw=Math.max,vw=Math.min,yw=Math.pow,bw=Math.round,Du=Number.isNaN||function(e){return e!==e},ww=Du,Sw=function(e){return ww(e)||e===0?e:e<0?-1:1},xi=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},gd=typeof Symbol<"u"&&Symbol,_w=xi,Lu=function(){return typeof gd!="function"||typeof Symbol!="function"||typeof gd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:_w()},pg=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,kw=Pu,fg=kw.getPrototypeOf||null,Ew="Function.prototype.bind called on incompatible ",xw=Object.prototype.toString,Aw=Math.max,$w="[object Function]",md=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},Iw=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},Tw=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},Cw=function(e){var t=this;if(typeof t!="function"||xw.apply(t)!==$w)throw new TypeError(Ew+t);for(var r=Iw(arguments,1),i,s=function(){if(this instanceof i){var h=t.apply(this,md(r,arguments));return Object(h)===h?h:this}return t.apply(e,md(r,arguments))},o=Aw(0,t.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+Tw(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},Pw=Cw,io=Function.prototype.bind||Pw,zu=Function.prototype.call,Ou=Function.prototype.apply,Rw=typeof Reflect<"u"&&Reflect&&Reflect.apply,Dw=io,Lw=Ou,zw=zu,Ow=Rw,gg=Ow||Dw.call(zw,Lw),Mw=io,Nw=X,Uw=zu,Fw=gg,el=function(e){if(e.length<1||typeof e[0]!="function")throw new Nw("a function is required");return Fw(Mw,Uw,e)},Zw=el,vd=Ei,mg;try{mg=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Dl=!!mg&&vd&&vd(Object.prototype,"__proto__"),vg=Object,yd=vg.getPrototypeOf,Hw=Dl&&typeof Dl.get=="function"?Zw([Dl.get]):typeof yd=="function"?function(e){return yd(e==null?e:vg(e))}:!1,bd=pg,wd=fg,Sd=Hw,yg=bd?function(e){return bd(e)}:wd?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return wd(e)}:Sd?function(e){return Sd(e)}:null,Ww=Function.prototype.call,Vw=Object.prototype.hasOwnProperty,Bw=io,tn=Bw.call(Ww,Vw),Y,Gw=Pu,jw=dg,qw=hw,Yw=dw,Xw=Ru,yi=Qt,Kr=X,Kw=pw,Jw=fw,Qw=gw,e0=mw,t0=vw,n0=yw,r0=bw,i0=Sw,bg=Function,Ll=function(n){try{return bg('"use strict"; return ('+n+").constructor;")()}catch{}},cs=Ei,s0=ro,zl=function(){throw new Kr},o0=cs?function(){try{return arguments.callee,zl}catch{try{return cs(arguments,"callee").get}catch{return zl}}}():zl,Lr=Lu(),Ae=yg,a0=fg,l0=pg,wg=Ou,so=zu,Ur={},c0=typeof Uint8Array>"u"||!Ae?Y:Ae(Uint8Array),mr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Y:ArrayBuffer,"%ArrayIteratorPrototype%":Lr&&Ae?Ae([][Symbol.iterator]()):Y,"%AsyncFromSyncIteratorPrototype%":Y,"%AsyncFunction%":Ur,"%AsyncGenerator%":Ur,"%AsyncGeneratorFunction%":Ur,"%AsyncIteratorPrototype%":Ur,"%Atomics%":typeof Atomics>"u"?Y:Atomics,"%BigInt%":typeof BigInt>"u"?Y:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Y:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":jw,"%eval%":eval,"%EvalError%":qw,"%Float16Array%":typeof Float16Array>"u"?Y:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Y:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Y:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Y:FinalizationRegistry,"%Function%":bg,"%GeneratorFunction%":Ur,"%Int8Array%":typeof Int8Array>"u"?Y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Lr&&Ae?Ae(Ae([][Symbol.iterator]())):Y,"%JSON%":typeof JSON=="object"?JSON:Y,"%Map%":typeof Map>"u"?Y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Lr||!Ae?Y:Ae(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Gw,"%Object.getOwnPropertyDescriptor%":cs,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Y:Promise,"%Proxy%":typeof Proxy>"u"?Y:Proxy,"%RangeError%":Yw,"%ReferenceError%":Xw,"%Reflect%":typeof Reflect>"u"?Y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Lr||!Ae?Y:Ae(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Lr&&Ae?Ae(""[Symbol.iterator]()):Y,"%Symbol%":Lr?Symbol:Y,"%SyntaxError%":yi,"%ThrowTypeError%":o0,"%TypedArray%":c0,"%TypeError%":Kr,"%Uint8Array%":typeof Uint8Array>"u"?Y:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Y:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Y:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Y:Uint32Array,"%URIError%":Kw,"%WeakMap%":typeof WeakMap>"u"?Y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Y:WeakSet,"%Function.prototype.call%":so,"%Function.prototype.apply%":wg,"%Object.defineProperty%":s0,"%Object.getPrototypeOf%":a0,"%Math.abs%":Jw,"%Math.floor%":Qw,"%Math.max%":e0,"%Math.min%":t0,"%Math.pow%":n0,"%Math.round%":r0,"%Math.sign%":i0,"%Reflect.getPrototypeOf%":l0};if(Ae)try{null.error}catch(n){var u0=Ae(Ae(n));mr["%Error.prototype%"]=u0}var h0=function n(e){var t;if(e==="%AsyncFunction%")t=Ll("async function () {}");else if(e==="%GeneratorFunction%")t=Ll("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Ll("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Ae&&(t=Ae(i.prototype))}return mr[e]=t,t},_d={__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"]},oo=io,da=tn,d0=oo.call(so,Array.prototype.concat),p0=oo.call(wg,Array.prototype.splice),kd=oo.call(so,String.prototype.replace),pa=oo.call(so,String.prototype.slice),f0=oo.call(so,RegExp.prototype.exec),g0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,m0=/\\(\\)?/g,v0=function(e){var t=pa(e,0,1),r=pa(e,-1);if(t==="%"&&r!=="%")throw new yi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new yi("invalid intrinsic syntax, expected opening `%`");var i=[];return kd(e,g0,function(s,o,a,c){i[i.length]=a?kd(c,m0,"$1"):o||s}),i},y0=function(e,t){var r=e,i;if(da(_d,r)&&(i=_d[r],r="%"+i[0]+"%"),da(mr,r)){var s=mr[r];if(s===Ur&&(s=h0(r)),typeof s>"u"&&!t)throw new Kr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new yi("intrinsic "+e+" does not exist!")},ut=function(e,t){if(typeof e!="string"||e.length===0)throw new Kr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Kr('"allowMissing" argument must be a boolean');if(f0(/^%?[^%]*%?$/,e)===null)throw new yi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=v0(e),i=r.length>0?r[0]:"",s=y0("%"+i+"%",t),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],p0(r,d0([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var v=r[h],m=pa(v,0,1),x=pa(v,-1);if((m==='"'||m==="'"||m==="`"||x==='"'||x==="'"||x==="`")&&m!==x)throw new yi("property names with quotes must have matching quotes");if((v==="constructor"||!p)&&(c=!0),i+="."+v,o="%"+i+"%",da(mr,o))a=mr[o];else if(a!=null){if(!(v in a)){if(!t)throw new Kr("base intrinsic for "+e+" exists, but the property is not available.");return}if(cs&&h+1>=r.length){var _=cs(a,v);p=!!_,p&&"get"in _&&!("originalValue"in _.get)?a=_.get:a=a[v]}else p=da(a,v),a=a[v];p&&!c&&(mr[o]=a)}}return a},Ol,Ed;function Tn(){if(Ed)return Ol;Ed=1;var n=ut,e=el,t=e([n("%String.prototype.indexOf%")]);return Ol=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},Ol}var Ml,xd;function Mu(){if(xd)return Ml;xd=1;var n=ut,e=n("%Array%"),t=!e.isArray&&Tn()("Object.prototype.toString");return Ml=e.isArray||function(i){return t(i)==="[object Array]"},Ml}var b0=Qa,Ad=ro,Sg=b0.hasArrayLengthDefineBug(),w0=Sg&&Mu(),S0=Tn(),_0=S0("Object.prototype.propertyIsEnumerable"),Nu=function(e,t,r,i,s,o){if(!Ad){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&_0(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&&w0(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Ad(i,s,r(o)),!0)},k0=X,Ui=tn,E0={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},Ai=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Ui(e,t)&&!E0[t])return!1;var r=Ui(e,"[[Value]]")||Ui(e,"[[Writable]]"),i=Ui(e,"[[Get]]")||Ui(e,"[[Set]]");if(r&&i)throw new k0("Property Descriptors may not be both accessor and data descriptors");return!0},_g=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},x0=X,A0=Ai,$0=_g,kg=function(e){if(typeof e<"u"&&!A0(e))throw new x0("Assertion failed: `Desc` must be a Property Descriptor");return $0(e)},I0=X,$d=tn,T0=Ai,Eg=function(e){if(typeof e>"u")return!1;if(!T0(e))throw new I0("Assertion failed: `Desc` must be a Property Descriptor");return!(!$d(e,"[[Value]]")&&!$d(e,"[[Writable]]"))},$i=function(e){return typeof e=="string"||typeof e=="symbol"},Id=Du,xg=function(e,t){return e===t?e===0?1/e===1/t:!0:Id(e)&&Id(t)},Td=X,C0=en,P0=Nu,R0=kg,D0=Eg,L0=$i,z0=xg,Uu=function(e,t,r){if(!C0(e))throw new Td("Assertion failed: Type(O) is not Object");if(!L0(t))throw new Td("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return P0(D0,z0,R0,e,t,i)},Ag=Function.prototype.toString,jr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ac,Ko;if(typeof jr=="function"&&typeof Object.defineProperty=="function")try{Ac=Object.defineProperty({},"length",{get:function(){throw Ko}}),Ko={},jr(function(){throw 42},null,Ac)}catch(n){n!==Ko&&(jr=null)}else jr=null;var O0=/^\s*class\b/,$c=function(e){try{var t=Ag.call(e);return O0.test(t)}catch{return!1}},Nl=function(e){try{return $c(e)?!1:(Ag.call(e),!0)}catch{return!1}},Jo=Object.prototype.toString,M0="[object Object]",N0="[object Function]",U0="[object GeneratorFunction]",F0="[object HTMLAllCollection]",Z0="[object HTML document.all class]",H0="[object HTMLCollection]",W0=typeof Symbol=="function"&&!!Symbol.toStringTag,V0=!(0 in[,]),Ic=function(){return!1};if(typeof document=="object"){var B0=document.all;Jo.call(B0)===Jo.call(document.all)&&(Ic=function(e){if((V0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Jo.call(e);return(t===F0||t===Z0||t===H0||t===M0)&&e("")==null}catch{}return!1})}var $g=jr?function(e){if(Ic(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{jr(e,null,Ac)}catch(t){if(t!==Ko)return!1}return!$c(e)&&Nl(e)}:function(e){if(Ic(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(W0)return Nl(e);if($c(e))return!1;var t=Jo.call(e);return t!==N0&&t!==U0&&!/^\[object HTML/.test(t)?!1:Nl(e)},G0=$g,j0=function(e){return!!e},kt=tn,Io=X,q0=en,Cd=G0,Ul=j0,Y0=function(e){if(!q0(e))throw new Io("ToPropertyDescriptor requires an object");var t={};if(kt(e,"enumerable")&&(t["[[Enumerable]]"]=Ul(e.enumerable)),kt(e,"configurable")&&(t["[[Configurable]]"]=Ul(e.configurable)),kt(e,"value")&&(t["[[Value]]"]=e.value),kt(e,"writable")&&(t["[[Writable]]"]=Ul(e.writable)),kt(e,"get")){var r=e.get;if(typeof r<"u"&&!Cd(r))throw new Io("getter must be a function");t["[[Get]]"]=r}if(kt(e,"set")){var i=e.set;if(typeof i<"u"&&!Cd(i))throw new Io("setter must be a function");t["[[Set]]"]=i}if((kt(t,"[[Get]]")||kt(t,"[[Set]]"))&&(kt(t,"[[Value]]")||kt(t,"[[Writable]]")))throw new Io("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Fl=X,X0=en,Pd=Ai,K0=Nu,J0=kg,Q0=Eg,eS=$i,tS=xg,nS=Y0,rS=function(e,t,r){if(!X0(e))throw new Fl("Assertion failed: Type(O) is not Object");if(!eS(t))throw new Fl("Assertion failed: P is not a Property Key");var i=Pd(r)?r:nS(r);if(!Pd(i))throw new Fl("Assertion failed: Desc is not a valid Property Descriptor");return K0(Q0,tS,J0,e,t,i)},Rd=X,iS=en,sS=rS,oS=$i,aS=function(e,t,r){if(!iS(e))throw new Rd("Assertion failed: Type(O) is not Object");if(!oS(t))throw new Rd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return sS(e,t,i)},lS=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,cS=Pu,uS=cS.setPrototypeOf||null,hS=el,Dd=Ei,dS=X,Ig={};try{Ig.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var pS=!("toString"in Ig),Zl=Dd&&Dd(Object.prototype,"__proto__"),fS=pS&&(!!Zl&&typeof Zl.set=="function"&&hS([Zl.set])||function(e,t){if(e==null)throw new dS("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),Ld=lS,gS=uS,zd=fS,mS=X,vS=Ld?function(e,t){if(Ld(e,t))return e;throw new mS("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:gS||(zd?function(e,t){return zd(e,t),e}:null),Od=X,yS=en,Md=yg,bS=function(e){if(!yS(e))throw new Od("Assertion failed: O must be an Object");if(!Md)throw new Od("This environment does not support fetching prototypes.");return Md(e)},wS=X,SS=vS,_S=en,kS=bS,ES=function(e,t){if(t!==null&&!_S(t))throw new wS("Assertion failed: V must be Object or Null");try{SS(e,t)}catch{return!1}return kS(e)===t},Hl=Uu,Nd=aS,Tg=ES,xS=Qa(),Fu=dg;function ao(n,e,t){var r=new Fu(t);return Tg(r,Qo),delete r.constructor,Nd(r,"error",n),Nd(r,"suppressed",e),r}xS&&Object.defineProperty(ao,"prototype",{writable:!1});var Qo=ao.prototype;if(!Hl(Qo,"constructor",ao)||!Hl(Qo,"message","")||!Hl(Qo,"name","SuppressedError"))throw new Fu("unable to install SuppressedError.prototype properties; please report this!");Tg(ao.prototype,Fu.prototype);var AS=ao,$S=AS,Cg=function(){return typeof SuppressedError=="function"?SuppressedError:$S},IS=kr,Ud=Cu(),TS=Cg,CS=function(){var e=TS();return IS(Ud,{SuppressedError:e},{SuppressedError:function(){return Ud.SuppressedError!==e}}),e};CS();var PS=X,RS=Ai,DS=_g,LS=function(e){if(typeof e<"u"&&!RS(e))throw new PS("Assertion failed: `Desc` must be a Property Descriptor");return DS(e)},zS=X,Fd=tn,OS=Ai,MS=function(e){if(typeof e>"u")return!1;if(!OS(e))throw new zS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Fd(e,"[[Value]]")&&!Fd(e,"[[Writable]]"))},Zd=Du,NS=function(e,t){return e===t?e===0?1/e===1/t:!0:Zd(e)&&Zd(t)},Ii=$g,US=function(e){return!!e},Et=tn,To=X,FS=en,Hd=Ii,Wl=US,ZS=function(e){if(!FS(e))throw new To("ToPropertyDescriptor requires an object");var t={};if(Et(e,"enumerable")&&(t["[[Enumerable]]"]=Wl(e.enumerable)),Et(e,"configurable")&&(t["[[Configurable]]"]=Wl(e.configurable)),Et(e,"value")&&(t["[[Value]]"]=e.value),Et(e,"writable")&&(t["[[Writable]]"]=Wl(e.writable)),Et(e,"get")){var r=e.get;if(typeof r<"u"&&!Hd(r))throw new To("getter must be a function");t["[[Get]]"]=r}if(Et(e,"set")){var i=e.set;if(typeof i<"u"&&!Hd(i))throw new To("setter must be a function");t["[[Set]]"]=i}if((Et(t,"[[Get]]")||Et(t,"[[Set]]"))&&(Et(t,"[[Value]]")||Et(t,"[[Writable]]")))throw new To("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Vl=X,HS=en,Wd=Ai,WS=Nu,VS=LS,BS=MS,GS=$i,jS=NS,qS=ZS,lo=function(e,t,r){if(!HS(e))throw new Vl("Assertion failed: Type(O) is not Object");if(!GS(t))throw new Vl("Assertion failed: P is not a Property Key");var i=Wd(r)?r:qS(r);if(!Wd(i))throw new Vl("Assertion failed: Desc is not a valid Property Descriptor");return WS(BS,jS,VS,e,t,i)},YS=xi(),XS=YS?Symbol.dispose||Symbol("Symbol.dispose"):null,KS=xi,JS=XS,Zu=function(){return KS()&&Symbol.dispose||JS},QS=Lu,e_=lo,t_=Zu,n_=function(){var e=t_();return QS()&&e_(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},r_=xi(),i_=r_?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,s_=xi,o_=i_,Hu=function(){return s_()&&Symbol.asyncDispose||o_},a_=Lu,l_=lo,c_=Hu,u_=function(){var e=c_();return a_()&&l_(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},h_=Mu(),d_=ut,p_=Tn(),f_=X,g_=h_,m_=d_("%Reflect.apply%",!0)||p_("Function.prototype.apply"),tl=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!g_(r))throw new f_("Assertion failed: optional `argumentsList`, if provided, must be a List");return m_(e,t,r)};const v_={},y_=Object.freeze(Object.defineProperty({__proto__:null,default:v_},Symbol.toStringTag,{value:"Module"})),b_=Wb(y_);var Wu=typeof Map=="function"&&Map.prototype,Bl=Object.getOwnPropertyDescriptor&&Wu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,fa=Wu&&Bl&&typeof Bl.get=="function"?Bl.get:null,Vd=Wu&&Map.prototype.forEach,Vu=typeof Set=="function"&&Set.prototype,Gl=Object.getOwnPropertyDescriptor&&Vu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ga=Vu&&Gl&&typeof Gl.get=="function"?Gl.get:null,Bd=Vu&&Set.prototype.forEach,w_=typeof WeakMap=="function"&&WeakMap.prototype,is=w_?WeakMap.prototype.has:null,S_=typeof WeakSet=="function"&&WeakSet.prototype,ss=S_?WeakSet.prototype.has:null,__=typeof WeakRef=="function"&&WeakRef.prototype,Gd=__?WeakRef.prototype.deref:null,k_=Boolean.prototype.valueOf,E_=Object.prototype.toString,x_=Function.prototype.toString,A_=String.prototype.match,Bu=String.prototype.slice,_n=String.prototype.replace,$_=String.prototype.toUpperCase,jd=String.prototype.toLowerCase,Pg=RegExp.prototype.test,qd=Array.prototype.concat,Dt=Array.prototype.join,I_=Array.prototype.slice,Yd=Math.floor,Tc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,jl=Object.getOwnPropertySymbols,Cc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,bi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",os=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===bi||!0)?Symbol.toStringTag:null,Rg=Object.prototype.propertyIsEnumerable,Xd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Kd(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Pg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Yd(-n):Yd(n);if(r!==n){var i=String(r),s=Bu.call(e,i.length+1);return _n.call(i,t,"$&_")+"."+_n.call(_n.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _n.call(e,t,"$&_")}var Pc=b_,Jd=Pc.custom,Qd=zg(Jd)?Jd:null,Dg={__proto__:null,double:'"',single:"'"},T_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Ti=function n(e,t,r,i){var s=t||{};if(Ht(s,"quoteStyle")&&!Ht(Dg,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 Mg(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?Kd(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?Kd(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 Rc(e)?"[Array]":"[Object]";var p=j_(s,r);if(typeof i>"u")i=[];else if(Og(i,e)>=0)return"[Circular]";function v(wt,rn,bl){if(rn&&(i=I_.call(i),i.push(rn)),bl){var bo={depth:s.depth};return Ht(s,"quoteStyle")&&(bo.quoteStyle=s.quoteStyle),n(wt,bo,r+1,i)}return n(wt,s,r+1,i)}if(typeof e=="function"&&!ep(e)){var m=N_(e),x=Co(e,v);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(x.length>0?" { "+Dt.call(x,", ")+" }":"")}if(zg(e)){var _=bi?_n.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Cc.call(e);return typeof e=="object"&&!bi?Fi(_):_}if(V_(e)){for(var C="<"+jd.call(String(e.nodeName)),U=e.attributes||[],P=0;P<U.length;P++)C+=" "+U[P].name+"="+Lg(C_(U[P].value),"double",s);return C+=">",e.childNodes&&e.childNodes.length&&(C+="..."),C+="</"+jd.call(String(e.nodeName))+">",C}if(Rc(e)){if(e.length===0)return"[]";var B=Co(e,v);return p&&!G_(B)?"["+Dc(B,p)+"]":"[ "+Dt.call(B,", ")+" ]"}if(R_(e)){var L=Co(e,v);return!("cause"in Error.prototype)&&"cause"in e&&!Rg.call(e,"cause")?"{ ["+String(e)+"] "+Dt.call(qd.call("[cause]: "+v(e.cause),L),", ")+" }":L.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dt.call(L,", ")+" }"}if(typeof e=="object"&&o){if(Qd&&typeof e[Qd]=="function"&&Pc)return Pc(e,{depth:h-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(U_(e)){var V=[];return Vd&&Vd.call(e,function(wt,rn){V.push(v(rn,e,!0)+" => "+v(wt,e))}),tp("Map",fa.call(e),V,p)}if(H_(e)){var F=[];return Bd&&Bd.call(e,function(wt){F.push(v(wt,e))}),tp("Set",ga.call(e),F,p)}if(F_(e))return ql("WeakMap");if(W_(e))return ql("WeakSet");if(Z_(e))return ql("WeakRef");if(L_(e))return Fi(v(Number(e)));if(O_(e))return Fi(v(Tc.call(e)));if(z_(e))return Fi(k_.call(e));if(D_(e))return Fi(v(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Hn<"u"&&e===Hn)return"{ [object globalThis] }";if(!P_(e)&&!ep(e)){var he=Co(e,v),de=Xd?Xd(e)===Object.prototype:e instanceof Object||e.constructor===Object,Dn=e instanceof Object?"":"null prototype",yo=!de&&os&&Object(e)===e&&os in e?Bu.call(Cn(e),8,-1):Dn?"Object":"",Ie=de||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Ln=Ie+(yo||Dn?"["+Dt.call(qd.call([],yo||[],Dn||[]),": ")+"] ":"");return he.length===0?Ln+"{}":p?Ln+"{"+Dc(he,p)+"}":Ln+"{ "+Dt.call(he,", ")+" }"}return String(e)};function Lg(n,e,t){var r=t.quoteStyle||e,i=Dg[r];return i+n+i}function C_(n){return _n.call(String(n),/"/g,"&quot;")}function Er(n){return!os||!(typeof n=="object"&&(os in n||typeof n[os]<"u"))}function Rc(n){return Cn(n)==="[object Array]"&&Er(n)}function P_(n){return Cn(n)==="[object Date]"&&Er(n)}function ep(n){return Cn(n)==="[object RegExp]"&&Er(n)}function R_(n){return Cn(n)==="[object Error]"&&Er(n)}function D_(n){return Cn(n)==="[object String]"&&Er(n)}function L_(n){return Cn(n)==="[object Number]"&&Er(n)}function z_(n){return Cn(n)==="[object Boolean]"&&Er(n)}function zg(n){if(bi)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Cc)return!1;try{return Cc.call(n),!0}catch{}return!1}function O_(n){if(!n||typeof n!="object"||!Tc)return!1;try{return Tc.call(n),!0}catch{}return!1}var M_=Object.prototype.hasOwnProperty||function(n){return n in this};function Ht(n,e){return M_.call(n,e)}function Cn(n){return E_.call(n)}function N_(n){if(n.name)return n.name;var e=A_.call(x_.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function Og(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 U_(n){if(!fa||!n||typeof n!="object")return!1;try{fa.call(n);try{ga.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function F_(n){if(!is||!n||typeof n!="object")return!1;try{is.call(n,is);try{ss.call(n,ss)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function Z_(n){if(!Gd||!n||typeof n!="object")return!1;try{return Gd.call(n),!0}catch{}return!1}function H_(n){if(!ga||!n||typeof n!="object")return!1;try{ga.call(n);try{fa.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function W_(n){if(!ss||!n||typeof n!="object")return!1;try{ss.call(n,ss);try{is.call(n,is)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function V_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Mg(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Mg(Bu.call(n,0,e.maxStringLength),e)+r}var i=T_[e.quoteStyle||"single"];i.lastIndex=0;var s=_n.call(_n.call(n,i,"\\$1"),/[\x00-\x1f]/g,B_);return Lg(s,"single",e)}function B_(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":"")+$_.call(e.toString(16))}function Fi(n){return"Object("+n+")"}function ql(n){return n+" { ? }"}function tp(n,e,t,r){var i=r?Dc(t,r):Dt.call(t,", ");return n+" ("+e+") {"+i+"}"}function G_(n){for(var e=0;e<n.length;e++)if(Og(n[e],`
2
+ `)>=0)return!1;return!0}function j_(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 Dc(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 Co(n,e){var t=Pc(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 Gl=="function"?Gl(n):[],o;if(yi){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)Ht(n,c)&&(t&&String(Number(c))===c&&c<n.length||yi&&o["$"+c]instanceof Symbol||(Cg.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof Gl=="function")for(var u=0;u<s.length;u++)Pg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var G_=Ii,j_=X,tl=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},q_=function(n,e){if(n){var t=tl(n,e);return t&&t.value}},Y_=function(n,e,t){var r=tl(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},X_=function(n,e){return n?!!tl(n,e):!1},K_=function(n,e){if(n)return tl(n,e,!0)},J_=function(){var e,t={assert:function(r){if(!t.has(r))throw new j_("Side channel does not contain "+G_(r))},delete:function(r){var i=e&&e.next,s=K_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return q_(e,r)},has:function(r){return X_(e,r)},set:function(r,i){e||(e={next:void 0}),Y_(e,r,i)}};return t},Q_=ut,co=Tn(),ek=Ii,tk=X,tp=Q_("%Map%",!0),nk=co("Map.prototype.get",!0),rk=co("Map.prototype.set",!0),ik=co("Map.prototype.has",!0),sk=co("Map.prototype.delete",!0),ok=co("Map.prototype.size",!0),Mg=!!tp&&function(){var e,t={assert:function(r){if(!t.has(r))throw new tk("Side channel does not contain "+ek(r))},delete:function(r){if(e){var i=sk(e,r);return ok(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return nk(e,r)},has:function(r){return e?ik(e,r):!1},set:function(r,i){e||(e=new tp),rk(e,r,i)}};return t},ak=ut,nl=Tn(),lk=Ii,Po=Mg,ck=X,zr=ak("%WeakMap%",!0),uk=nl("WeakMap.prototype.get",!0),hk=nl("WeakMap.prototype.set",!0),dk=nl("WeakMap.prototype.has",!0),pk=nl("WeakMap.prototype.delete",!0),fk=zr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new ck("Side channel does not contain "+lk(i))},delete:function(i){if(zr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return pk(e,i)}else if(Po&&t)return t.delete(i);return!1},get:function(i){return zr&&i&&(typeof i=="object"||typeof i=="function")&&e?uk(e,i):t&&t.get(i)},has:function(i){return zr&&i&&(typeof i=="object"||typeof i=="function")&&e?dk(e,i):!!t&&t.has(i)},set:function(i,s){zr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new zr),hk(e,i,s)):Po&&(t||(t=Po()),t.set(i,s))}};return r}:Po,gk=X,mk=Ii,vk=J_,yk=Mg,bk=fk,wk=bk||yk||vk,Sk=function(){var e,t={assert:function(r){if(!t.has(r))throw new gk("Side channel does not contain "+mk(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=wk()),e.set(r,i)}};return t},_k=tn,Fi=Sk(),Ut=X,Bu={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(Fi.assert(n),!Bu.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=Fi.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=Fi.get(n);return!!t&&_k(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=Fi.get(n);r||(r={},Fi.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Bu);var Gu=Bu,Ng=Qt,kn=Gu,uo=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 Ng('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');kn.set(this,"[[Type]]",e),kn.set(this,"[[Value]]",t)};uo.prototype.type=function(){return kn.get(this,"[[Type]]")};uo.prototype.value=function(){return kn.get(this,"[[Value]]")};uo.prototype["?"]=function(){var e=kn.get(this,"[[Type]]"),t=kn.get(this,"[[Value]]");if(e==="throw")throw t;return t};uo.prototype["!"]=function(){var e=kn.get(this,"[[Type]]");if(e!=="normal")throw new Ng('Assertion failed: Completion Record is not of type "normal"');return kn.get(this,"[[Value]]")};var ju=uo,kk=ju,qu=function(e){return new kk("normal",e)},ql,np;function Ek(){if(np)return ql;np=1;var n=Ei;return ql=function(){return n()&&!!Symbol.toStringTag},ql}var xk=ut,rp=xk("%Object.defineProperty%",!0),Ak=Ek()(),$k=tn,Ik=X,Ro=Ak?Symbol.toStringTag:null,Ug=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 Ik("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ro&&(r||!$k(e,Ro))&&(rp?rp(e,Ro,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Ro]=t)},Fg={exports:{}},Tk=ut,ip=rg,Ck=Ja(),sp=ki,op=X,Pk=Tk("%Math.floor%"),Rk=function(e,t){if(typeof e!="function")throw new op("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Pk(t)!==t)throw new op("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&sp){var o=sp(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(Ck?ip(e,"length",t,!0,!0):ip(e,"length",t)),e},Dk=io,Lk=zu,zk=fg,Ok=function(){return zk(Dk,Lk,arguments)};(function(n){var e=Rk,t=ro,r=Qa,i=Ok;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return e(a,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(Fg);var Yu=Fg.exports,Mk=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},Nk=Object,Uk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||Nk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},Fk=tn,Zk=Ou(),Hk=Mk,Wk=Uk,Vk=function(e){return e&&typeof e=="object"&&Fk(e,"[[DisposableResourceStack]]")&&Zk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||Hk(e["[[DisposableResourceStack]]"],Wk))},Bk=en,Gk=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(Bk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},jk=Gk,Xu=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":jk(e)},qk=X,Yk=Ii,Xk=Ai,Kk=function(e,t){if(!Xk(t))throw new qk("Assertion failed: P is not a Property Key, got "+Yk(t));return e[t]},ap=X,Jk=Kk,Qk=$i,eE=Ai,lp=Ii,tE=function(e,t){if(!eE(t))throw new ap("Assertion failed: P is not a Property Key");var r=Jk(e,t);if(r!=null){if(!Qk(r))throw new ap(lp(t)+" is not a function: "+lp(r));return r}},Dc={exports:{}},nE=ut,rE=nE,cp=rE("%Reflect.construct%",!0),ma=lo;try{ma({},"",{"[[Get]]":function(){}})}catch{ma=null}if(ma&&cp){var up={},hp={};ma(hp,"length",{"[[Get]]":function(){throw up},"[[Enumerable]]":!0}),Dc.exports=function(e){try{cp(e,hp)}catch(t){return t===up}}}else Dc.exports=function(e){return typeof e=="function"&&!!e.prototype};var iE=Dc.exports,Yl=X,dp=$i,sE=iE,oE=function(e){if(!sE(e))throw new Yl("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 Yl("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!dp(t["[[Resolve]]"])||!dp(t["[[Reject]]"]))throw new Yl("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},pp=Qt,aE=X,Xl=el,fp=tE,lE=oE,cE=Xu,gp=Fu(),mp=Zu(),uE=function(e,t){if(cE(e)!=="Object")throw new aE("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new pp("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&mp&&(r=fp(e,mp)),!r){if(!gp)throw new pp("`Symbol.dispose` is not supported");if(r=fp(e,gp),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=lE(Promise);try{Xl(r,i),Xl(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Xl(r,i)}}return r},hE=Qt,Kl=X,dE=$i,pE=Xu,fE=uE,gE=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new hE("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"&&pE(e)!=="Object")throw new Kl("`V` must be an Object, or `null` or `undefined`");if(r=fE(e,t),typeof r>"u")throw new Kl("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!dE(r))throw new Kl("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},mE=Qt,Do=X,vE=Vk,vp=gE,yE=Tn(),bE=yE("Array.prototype.push"),Zg=function(e,t,r){if(!vE(e))throw new Do("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new mE("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 Do("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Do("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=vp(t,r)}else{if(typeof t<"u")throw new Do("Assertion failed: `V` must be undefined when `method` is present");s=vp(void 0,r,i)}return bE(e["[[DisposableResourceStack]]"],s),"UNUSED"},Jl,yp;function Ku(){if(yp)return Jl;yp=1;var n=ut,e=Yu,t=Qt,r=n("%Promise.resolve%",!0),i=r&&e(r);return Jl=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},Jl}var Ql,bp;function wE(){if(bp)return Ql;bp=1;var n=ut,e=Qt,t=n("%Promise%",!0),r=el,i=Ku(),s=Xu;return Ql=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="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(c==="ASYNC-DISPOSE")return i(t,h)},Ql}var ec,wp;function SE(){if(wp)return ec;wp=1;var n=ju;return ec=function(t){return new n("throw",t)},ec}var _E=ut,tc=Qt,Sp=X,kE=_E("%Promise%",!0),EE=Tn(),_p=EE("Promise.prototype.then",!0),xE=ju,kp=wE(),AE=qu,$E=Ku(),Ep=SE(),IE=Tg(),Hg=function(e,t){if(!(t instanceof xE))throw new Sp("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new Sp("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 tc("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&$E(kE,t),a=function(v){if(t.type()==="throw"){var m=t.value(),x=new IE(v,m);t=Ep(x)}else t=Ep(v)},c=i==="ASYNC-DISPOSE"&&function(m){return _p(o,function(){var x=kp(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!x)throw new tc("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return _p(x,AE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var h=r[u];try{var p=kp(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new tc("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},Wg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},rl=Pu,Ju=X,TE=el,Ti=Nu,CE=lo,Vg=$i,PE=qu,Ye=Gu,RE=Ug,Bg=kr.supportsDescriptors,DE=Yu,Qu=Zg,LE=Hg,Gg=Wg,xp=Fu(),at=function n(){if(!(this instanceof n)||Ye.has(this,"[[DisposableState]]")||Ye.has(this,"[[DisposeCapability]]"))throw new Ju("can only be used with new");Ye.set(this,"[[DisposableState]]","PENDING"),Ye.set(this,"[[DisposeCapability]]",Gg())},jg=function(){var e=this;return Ye.assert(e,"[[DisposableState]]"),Ye.get(e,"[[DisposableState]]")==="DISPOSED"},ho=DE(jg);Bg?CE(at.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":jg}):at.prototype.disposed=!1;var qg=function(e){Ye.set(e,"[[DisposableState]]","DISPOSED"),Bg||(e.disposed=!0)};Ti(at.prototype,"dispose",function(){var e=this;if(!ho(e))return qg(e),LE(Ye.get(e,"[[DisposeCapability]]"),PE())["?"]()});Ti(at.prototype,"use",function(e){var t=this;if(ho(t))throw new rl("a disposed stack can not use anything new");return Qu(Ye.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});Ti(at.prototype,"adopt",function(e,t){var r=this;if(ho(r))throw new rl("a disposed stack can not use anything new");if(!Vg(t))throw new Ju("`onDispose` must be a function");var i=function(){return TE(t,void 0,[e])};return Qu(Ye.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});Ti(at.prototype,"defer",function(e){var t=this;if(ho(t))throw new rl("a disposed stack can not defer anything new");if(!Vg(e))throw new Ju("`onDispose` must be a function");Qu(Ye.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});Ti(at.prototype,"move",function(){var e=this;if(ho(e))throw new rl("a disposed stack can not use anything new");var t=new at;return Ye.set(t,"[[DisposeCapability]]",Ye.get(e,"[[DisposeCapability]]")),Ye.set(e,"[[DisposeCapability]]",Gg()),qg(e),t});xp&&Ti(at.prototype,xp,at.prototype.dispose);RE(at.prototype,"DisposableStack");var zE=at,OE=zE,ME=function(){return typeof DisposableStack=="function"?DisposableStack:OE},NE=kr,UE=Tu(),FE=ME,ZE=function(){var e=FE();return NE(UE,{DisposableStack:e},{DisposableStack:!0}),e},HE=ut,il=Pu,eh=X,Ap=HE("%Promise%",!0),th=Zg,WE=el,Ci=Nu,VE=lo,BE=Hg,Yg=$i,Xg=Wg,GE=qu,$p=Ku(),Xe=Gu,jE=Ug,Kg=kr.supportsDescriptors,qE=Yu,YE=Tn(),XE=YE("Promise.prototype.then",!0),Ip=Zu(),lt=function n(){if(!(this instanceof n)||Xe.has(this,"[[AsyncDisposableState]]")||Xe.has(this,"[[DisposeCapability]]"))throw new eh("can only be used with new");Xe.set(this,"[[AsyncDisposableState]]","pending"),Xe.set(this,"[[DisposeCapability]]",Xg())},Jg=function(){var e=this;return Xe.assert(e,"[[AsyncDisposableState]]"),Xe.get(e,"[[AsyncDisposableState]]")==="disposed"},po=qE(Jg);Kg?VE(lt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Jg}):lt.prototype.disposed=!1;var Qg=function(e){Xe.set(e,"[[AsyncDisposableState]]","disposed"),Kg||(e.disposed=!0)};Ci(lt.prototype,"disposeAsync",function(){var e=this;return po(e)?$p(Ap):(Qg(e),XE($p(Ap,BE(Xe.get(e,"[[DisposeCapability]]"),GE())),function(t){return t["?"]()}))});Ci(lt.prototype,"use",function(e){var t=this;if(po(t))throw new il("a disposed stack can not use anything new");return th(Xe.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});Ci(lt.prototype,"adopt",function(e,t){var r=this;if(po(r))throw new il("a disposed stack can not use anything new");if(!Yg(t))throw new eh("`onDisposeAsync` must be a function");var i=function(){return WE(t,void 0,[e])};return i.value=e,th(Xe.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});Ci(lt.prototype,"defer",function(e){var t=this;if(po(t))throw new il("a disposed stack can not defer anything new");if(!Yg(e))throw new eh("`onDispose` must be a function");th(Xe.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});Ci(lt.prototype,"move",function(){var e=this;if(po(e))throw new il("a disposed stack can not use anything new");var t=new lt;return Xe.set(t,"[[DisposeCapability]]",Xe.get(e,"[[DisposeCapability]]")),Xe.set(e,"[[DisposeCapability]]",Xg()),Qg(e),t});Ip&&Ci(lt.prototype,Ip,lt.prototype.disposeAsync);jE(lt.prototype,"AsyncDisposableStack");var KE=lt,JE=KE,QE=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:JE},ex=kr,tx=Tu(),nx=QE,rx=function(){var e=nx();return ex(tx,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},ix=e_,sx=l_,ox=ZE,ax=rx,lx=function(){ix(),sx(),ox(),ax()};lx();const Tp=new WeakMap;function cx(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Or(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Cp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function ux(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class hx{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw Cp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw Cp();if(t.constructor.name==="AsyncFunction")throw ux();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=Tp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Or(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(`${Or(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=Tp.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(`${Or(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=>Or(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(cx(r))throw new Error(`Factory for ${Or(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Or(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 Lt=new hx,dx=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function px(n){for(const e of Object.keys(n))if(dx.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function fx(n,e){px(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function rt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:a,...c}=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}),fx(this,c)}}return n}class zt extends globalThis.EventTarget{}function gx(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function fo(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);gx(this,()=>l(this,t),()=>{E(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,t)}}return t=new WeakMap,e}const mx=rt(),vx=rt(),ea=rt(),em="0123456789ABCDEFGHJKMNPQRSTVWXYZ",va=32,yx=16,tm=10,Pp=0xffffffffffff;var Gn;(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"})(Gn||(Gn={}));class Yi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function bx(n){const e=Math.floor(n()*va)%va;return em.charAt(e)}function wx(n){const e=Sx(),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 Yi(Gn.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Sx(){return Ex()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function _x(n,e){let t="";for(;n>0;n--)t=bx(e)+t;return t}function kx(n,e=tm){if(isNaN(n))throw new Yi(Gn.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Pp)throw new Yi(Gn.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Pp}: ${n}`);if(n<0)throw new Yi(Gn.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Yi(Gn.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%va,r=em.charAt(t)+r,n=(n-t)/va;return r}function Ex(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function sl(n,e){const t=wx(),r=Date.now();return kx(r,tm)+_x(yx,t)}const bt=4,nt=6,us=2,Lc=2,nh=8,xx=nt,rh="auto",En="auto",cn=120,Rp=50,ce=16,vr=cn*bt+ce*(bt-1),ya=cn*nt+ce*(nt-1),Ax=vr+ce*2,$x=200,Ix=4,Lo=150,Tx=10,Dp=2,Lp=8,Cx=300,Px=4;function nm(n){return sm(n)}function rm(n,e){return sm(n.flatMap(t=>am(t,e)))}function im(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}lm(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function jr(n){const e=nm(n),t=im(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(zx)}}function sm(n){const e=[];for(const t of n){const r=om(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(Jt));continue}e.push(i)}}return e}function om(n){switch(n.type){case"card":return[Jt(n)];case"row":{const e=n.children.map(Jt);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=om(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(zc));continue}if(i.type==="row"){e.push({...i,children:i.children.map(Jt)});continue}e.push(Jt(i))}}return e.length===0?[]:e.length===1?[zc(e[0])]:[{...n,children:e}]}}}function am(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[Jt(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(Jt);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>am(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[zc(t[0])]:[{...n,children:t}]}}}function lm(n,e,t,r){switch(n.type){case"card":cm(n,e,t,r);return;case"row":Rx(n,e,t,r);return;case"stack":Dx(n,e,t,r);return}}function cm(n,e,t,r){ih(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),Lx(n.width)||t.push(`Card ${n.id} width must be an integer in the range ${us}-${nh}`),um(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=Wn(n.width);e==="row"&&i<us&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function Rx(n,e,t,r){if(ih(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),um(n.height,Px)||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}cm(s,"row",t,r),i+=Wn(s.width)}i!==bt&&t.push(`Row ${n.id} children must sum to 4 columns`)}function Dx(n,e,t,r){if(ih(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(lm(a,"stack",t,r),a.height===En){s+=1;continue}i+=a.height}if(i>nt&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=nt-i;if(o<s*Lc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Lc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function ih(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function Lx(n){return n===rh||Number.isInteger(n)&&n>=us&&n<=nh}function um(n,e=xx){return n===En||Number.isInteger(n)&&n>=Lc&&n<=e}function Wn(n){return n===rh?bt:n}function zx(n){if(n.type==="card")return{id:n.id,type:"card",width:Wn(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:Wn(n.width),height:hm(n.height,nt)}]};const e=Ox(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:Math.min(bt,Wn(s.width)),height:o});else{let a=1;for(const c of s.children)t.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:Wn(c.width),height:o}),a+=Wn(c.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 Ox(n){let e=0,t=0;for(const i of n)i.height===En?t+=1:e+=i.height;const r=t>0?(nt-e)/t:0;return n.map(i=>hm(i.height,r))}function hm(n,e){return n===En?e:n}function Jt(n){return{...n}}function zc(n){return n.type==="card"?Jt(n):{...n,children:n.children.map(Jt)}}function dm(n,e={}){return{id:e.id??sl(),type:"card",artifactID:n,width:e.width??rh,height:e.height??En}}function pm(n,e){return n.some(t=>fm(t,e))}function fm(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=>fm(t,e))}}function zp(n){return n.layout.flatMap(gm)}function gm(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(gm)}}const ne=rt(),mm=rt(),Mr=rt(),Mx=rt();function Nx(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const Ux=Nx("RequestError"),Fx=200,Zx=300;class Hx{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 Wx(i);if(!i.ok||i.status<Fx||i.status>=Zx)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 nc(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await nc(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 nc(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new Ux(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 Wx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function nc(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 Vx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var $t,Ca,vm;class Bx{constructor(e){w(this,Ca);w(this,$t);E(this,$t,e)}list(){return l(this,$t).requestJSON("GET","/screens")}async get(e={}){const t=await f(this,Ca,vm).call(this,e.screenID);return l(this,$t).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),l(this,$t).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return l(this,$t).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return l(this,$t).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}$t=new WeakMap,Ca=new WeakSet,vm=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw l(this,$t).createError(`screenID is required when multiple screens exist. Available screens: ${Vx(t)}`)};var Le;class Gx{constructor(e){w(this,Le);E(this,Le,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.externalURL!==void 0&&(t.externalURL=e.externalURL),e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Le).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 l(this,Le).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return l(this,Le).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),l(this,Le).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return l(this,Le).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return l(this,Le).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return l(this,Le).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return l(this,Le).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return l(this,Le).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return l(this,Le).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Le=new WeakMap;var Yn;class jx{constructor(e){w(this,Yn);E(this,Yn,e)}state(){return l(this,Yn).requestJSON("GET","/viewer/state")}setActive(e){return l(this,Yn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Yn).requestJSON("POST","/viewer/focus",t)}}Yn=new WeakMap;var vs;class qx{constructor(e){w(this,vs);E(this,vs,e)}async list(){const{views:e}=await l(this,vs).requestJSON("GET","/views");return e}}vs=new WeakMap;var Wt;class Yx{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Wt);E(this,Wt,new Hx(e,t)),this.screens=new Bx(l(this,Wt)),this.artifacts=new Gx(l(this,Wt)),this.viewer=new jx(l(this,Wt)),this.views=new qx(l(this,Wt))}health(){return l(this,Wt).requestJSON("GET","/health")}}Wt=new WeakMap;const Xx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Kx=fo(zt);var Xn,Be,Kn,Ne,pt,hn,dn,te,Un,ym,ys,bm,wm,Sm,_m,Oc,Mc,Nc,km;class Jx extends Kx{constructor(t){var i;super();w(this,te);b(this,"id");b(this,"server");w(this,Xn);w(this,Be,new Map);w(this,Kn);w(this,Ne);w(this,pt);w(this,hn);w(this,dn,null);w(this,ys,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&f(this,te,bm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&f(this,te,wm).call(this,r.cardID,r.artifact);break;case"artifact-updated":f(this,te,Sm).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&f(this,te,_m).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new Mx("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,E(this,Xn,t.localStore),E(this,Kn,t.screen.name),E(this,Ne,structuredClone(t.screen.layout)),E(this,pt,t.screen.pinned);const r=((i=l(this,Xn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;E(this,hn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,ys)),f(this,te,ym).call(this)}get name(){return l(this,Kn)}get layout(){return l(this,Ne)}get pinned(){return l(this,pt)}get scrollPosition(){return l(this,hn)}get artifacts(){return l(this,Be)}setScrollPosition(t){f(this,te,Un).call(this);const r=Math.max(0,t);r!==l(this,hn)&&(E(this,hn,r),f(this,te,km).call(this),this.dispatchEvent(new ne("change")))}setLayout(t){f(this,te,Un).call(this);const r=nm(t);if(!im(r).valid)return;const s=f(this,te,Mc).call(this);E(this,Ne,r),E(this,dn,{layout:r,snapshot:s}),this.dispatchEvent(new ne("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,dn))==null?void 0:o.layout)===r&&(E(this,dn,null),f(this,te,Nc).call(this,s),this.dispatchEvent(new ne("change")))})}rename(t){f(this,te,Un).call(this),E(this,Kn,t),this.dispatchEvent(new ne("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setPinned(t){if(f(this,te,Un).call(this),l(this,pt)===t)return;const r=l(this,pt);E(this,pt,t),this.dispatchEvent(new ne("change")),this.server.client.screens.update({screenID:this.id,pinned:t}).catch(()=>{this.disposed||l(this,pt)===t&&(E(this,pt,r),this.dispatchEvent(new ne("change")))})}async remove(){f(this,te,Un).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(f(this,te,Un).call(this),!l(this,Be).has(t))return;const r=f(this,te,Mc).call(this);f(this,te,Oc).call(this,t),this.dispatchEvent(new ne("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(f(this,te,Nc).call(this,r),this.dispatchEvent(new ne("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,ys))}}Xn=new WeakMap,Be=new WeakMap,Kn=new WeakMap,Ne=new WeakMap,pt=new WeakMap,hn=new WeakMap,dn=new WeakMap,te=new WeakSet,Un=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},ym=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new ne("change"))}catch{}},ys=new WeakMap,bm=function(t){l(this,dn)&&E(this,dn,null),E(this,Kn,t.name),E(this,Ne,structuredClone(t.layout)),E(this,pt,t.pinned),this.dispatchEvent(new ne("change"))},wm=function(t,r){pm(l(this,Ne),r.id)||E(this,Ne,[...l(this,Ne),dm(r.id,{id:t})]),l(this,Be).set(r.id,r),this.dispatchEvent(new ne("change"))},Sm=function(t){const r=l(this,Be).get(t.id);r&&(l(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new ne("change")))},_m=function(t){f(this,te,Oc).call(this,t)&&this.dispatchEvent(new ne("change"))},Oc=function(t){const r=l(this,Be).delete(t),i=zp({layout:l(this,Ne)}).length,s=rm(l(this,Ne),t),o=zp({layout:s}).length;return E(this,Ne,s),r||i!==o},Mc=function(){return{layout:structuredClone(l(this,Ne)),artifacts:new Map([...l(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Nc=function(t){E(this,Ne,structuredClone(t.layout)),l(this,Be).clear();for(const[r,i]of t.artifacts)l(this,Be).set(r,structuredClone(i))},km=function(){const t=l(this,Xn).get();l(this,Xn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:l(this,hn)}}})};const Qx=fo(zt);var it,It,ft,bs,ws,Ss,Jr,ta;class e1 extends Qx{constructor(t){super();w(this,Jr);w(this,it);w(this,It);w(this,ft,null);w(this,bs,()=>{this.disposed||f(this,Jr,ta).call(this)});w(this,ws,()=>{this.disposed||f(this,Jr,ta).call(this)});w(this,Ss,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=l(this,ft))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=l(this,It).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});E(this,it,t.localStore),E(this,It,t.serverManager),l(this,it).addEventListener("change",l(this,bs)),l(this,It).addEventListener("change",l(this,ws)),l(this,It).addEventListener("server-event",l(this,Ss)),f(this,Jr,ta).call(this)}get activeScreen(){return l(this,ft)}setActive(t,r){const i=l(this,it).get();i.activeServerURL===t&&i.activeScreenID===r||l(this,it).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=l(this,it).get();t.activeScreenID!==null&&l(this,it).set({...t,activeScreenID:null})}dispose(){var t;l(this,it).removeEventListener("change",l(this,bs)),l(this,It).removeEventListener("change",l(this,ws)),l(this,It).removeEventListener("server-event",l(this,Ss)),(t=l(this,ft))==null||t.dispose(),E(this,ft,null)}}it=new WeakMap,It=new WeakMap,ft=new WeakMap,bs=new WeakMap,ws=new WeakMap,Ss=new WeakMap,Jr=new WeakSet,ta=function(){var c,u,h;const{activeServerURL:t,activeScreenID:r}=l(this,it).get(),i=t?l(this,It).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,ft))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,ft))==null?void 0:u.server)===i||((h=l(this,ft))==null||h.dispose(),E(this,ft,i&&s?new Jx({screen:s,server:i,localStore:l(this,it)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new mx("active-screen-changed")))};const t1="Local",n1="store-";function dt(n){return new URL(n).origin}function r1(n){return{servers:[{url:dt(n),name:t1}],activeServerURL:null,activeScreenID:null,screens:{}}}var Jn,Qn,er;class i1 extends zt{constructor(t,r,i={}){super();w(this,Jn);w(this,Qn);w(this,er);E(this,Jn,`${n1}${t}`),E(this,Qn,i.storage??s1());const s=l(this,Qn).getItem(l(this,Jn));s===null?(E(this,er,r),l(this,Qn).setItem(l(this,Jn),JSON.stringify(r))):E(this,er,JSON.parse(s))}get(){return l(this,er)}set(t){E(this,er,t),l(this,Qn).setItem(l(this,Jn),JSON.stringify(t)),this.dispatchEvent(new ne("change"))}}Jn=new WeakMap,Qn=new WeakMap,er=new WeakMap;function s1(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function A(n,e,t){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),e(a,c);const u=o.prototype,h=Object.keys(u);for(let p=0;p<h.length;p++){const v=h[p];v in a||(a[v]=u[v].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 c;const u=t!=null&&t.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.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 c,u;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class Kr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Em extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const xm={};function xn(n){return xm}function Am(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 Uc(n,e){return typeof e=="bigint"?e.toString():e}function sh(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function oh(n){return n==null}function ah(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function o1(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 c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[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 Op=Symbol("evaluating");function ie(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==Op)return r===void 0&&(r=Op,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function xr(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Pn(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Mp(n){return JSON.stringify(n)}function a1(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const $m="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ba(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const l1=sh(()=>{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 bi(n){if(ba(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(ba(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Im(n){return bi(n)?{...n}:Array.isArray(n)?[...n]:n}const c1=new Set(["string","number","symbol"]);function wi(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rn(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 O(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 u1(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const h1={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 d1(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=Pn(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 xr(this,"shape",o),o},checks:[]});return Rn(n,s)}function p1(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=Pn(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 xr(this,"shape",o),o},checks:[]});return Rn(n,s)}function f1(n,e){if(!bi(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=Pn(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return xr(this,"shape",s),s}});return Rn(n,i)}function g1(n,e){if(!bi(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=Pn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return xr(this,"shape",r),r}});return Rn(n,t)}function m1(n,e){const t=Pn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return xr(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Rn(n,t)}function v1(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=Pn(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return xr(this,"shape",c),c},checks:[]});return Rn(e,o)}function y1(n,e,t){const r=Pn(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 xr(this,"shape",s),s}});return Rn(e,r)}function qr(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 Yr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function zo(n){return typeof n=="string"?n:n==null?void 0:n.message}function An(n,e,t){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=zo((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??zo((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??zo((c=t.customError)==null?void 0:c.call(t,n))??zo((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 lh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function hs(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Tm=(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,Uc,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Cm=A("$ZodError",Tm),Pm=A("$ZodError",Tm,{Parent:Error});function b1(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 w1(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 c=s.path[a];a===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),t}const ch=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 Kr;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>An(c,s,xn())));throw $m(a,i==null?void 0:i.callee),a}return o.value},uh=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(c=>An(c,s,xn())));throw $m(a,i==null?void 0:i.callee),a}return o.value},ol=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 Kr;return s.issues.length?{success:!1,error:new(n??Cm)(s.issues.map(o=>An(o,i,xn())))}:{success:!0,data:s.value}},S1=ol(Pm),al=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=>An(o,i,xn())))}:{success:!0,data:s.value}},_1=al(Pm),k1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ch(n)(e,t,i)},E1=n=>(e,t,r)=>ch(n)(e,t,r),x1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return uh(n)(e,t,i)},A1=n=>async(e,t,r)=>uh(n)(e,t,r),$1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ol(n)(e,t,i)},I1=n=>(e,t,r)=>ol(n)(e,t,r),T1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return al(n)(e,t,i)},C1=n=>async(e,t,r)=>al(n)(e,t,r),P1=/^[cC][^\s-]{8,}$/,R1=/^[0-9a-z]+$/,D1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L1=/^[0-9a-vA-V]{20}$/,z1=/^[A-Za-z0-9]{27}$/,O1=/^[a-zA-Z0-9_-]{21}$/,M1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,N1=/^([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})$/,Np=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)$/,U1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,F1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Z1(){return new RegExp(F1,"u")}const H1=/^(?:(?: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])$/,W1=/^(([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}|:))$/,V1=/^((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])$/,B1=/^(([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])$/,G1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rm=/^[A-Za-z0-9_-]*$/,j1=/^\+[1-9]\d{6,14}$/,Dm="(?:(?:\\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])))",q1=new RegExp(`^${Dm}$`);function Lm(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 Y1(n){return new RegExp(`^${Lm(n)}$`)}function X1(n){const e=Lm({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(`^${Dm}T(?:${r})$`)}const K1=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}$`)},J1=/^-?\d+$/,zm=/^-?\d+(?:\.\d+)?$/,Q1=/^(?:true|false)$/i,eA=/^[^A-Z]*$/,tA=/^[^a-z]*$/,Ke=A("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Om={number:"number",bigint:"bigint",object:"date"},Mm=A("$ZodCheckLessThan",(n,e)=>{Ke.init(n,e);const t=Om[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})}}),Nm=A("$ZodCheckGreaterThan",(n,e)=>{Ke.init(n,e);const t=Om[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})}}),nA=A("$ZodCheckMultipleOf",(n,e)=>{Ke.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):o1(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})}}),rA=A("$ZodCheckNumberFormat",(n,e)=>{var o;Ke.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]=h1[e.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=J1)}),n._zod.check=a=>{const c=a.value;if(t){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,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:c,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}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),iA=A("$ZodCheckMaxLength",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!oh(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=lh(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),sA=A("$ZodCheckMinLength",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!oh(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=lh(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),oA=A("$ZodCheckLengthEquals",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!oh(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=lh(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})}}),ll=A("$ZodCheckStringFormat",(n,e)=>{var t,r;Ke.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=()=>{})}),aA=A("$ZodCheckRegex",(n,e)=>{ll.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})}}),lA=A("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=eA),ll.init(n,e)}),cA=A("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=tA),ll.init(n,e)}),uA=A("$ZodCheckIncludes",(n,e)=>{Ke.init(n,e);const t=wi(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})}}),hA=A("$ZodCheckStartsWith",(n,e)=>{Ke.init(n,e);const t=new RegExp(`^${wi(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})}}),dA=A("$ZodCheckEndsWith",(n,e)=>{Ke.init(n,e);const t=new RegExp(`.*${wi(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})}}),pA=A("$ZodCheckOverwrite",(n,e)=>{Ke.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class fA{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 Co(n,e){var t=Rc(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 jl=="function"?jl(n):[],o;if(bi){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)Ht(n,c)&&(t&&String(Number(c))===c&&c<n.length||bi&&o["$"+c]instanceof Symbol||(Pg.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof jl=="function")for(var u=0;u<s.length;u++)Rg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var q_=Ti,Y_=X,nl=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},X_=function(n,e){if(n){var t=nl(n,e);return t&&t.value}},K_=function(n,e,t){var r=nl(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},J_=function(n,e){return n?!!nl(n,e):!1},Q_=function(n,e){if(n)return nl(n,e,!0)},ek=function(){var e,t={assert:function(r){if(!t.has(r))throw new Y_("Side channel does not contain "+q_(r))},delete:function(r){var i=e&&e.next,s=Q_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return X_(e,r)},has:function(r){return J_(e,r)},set:function(r,i){e||(e={next:void 0}),K_(e,r,i)}};return t},tk=ut,co=Tn(),nk=Ti,rk=X,np=tk("%Map%",!0),ik=co("Map.prototype.get",!0),sk=co("Map.prototype.set",!0),ok=co("Map.prototype.has",!0),ak=co("Map.prototype.delete",!0),lk=co("Map.prototype.size",!0),Ng=!!np&&function(){var e,t={assert:function(r){if(!t.has(r))throw new rk("Side channel does not contain "+nk(r))},delete:function(r){if(e){var i=ak(e,r);return lk(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return ik(e,r)},has:function(r){return e?ok(e,r):!1},set:function(r,i){e||(e=new np),sk(e,r,i)}};return t},ck=ut,rl=Tn(),uk=Ti,Po=Ng,hk=X,zr=ck("%WeakMap%",!0),dk=rl("WeakMap.prototype.get",!0),pk=rl("WeakMap.prototype.set",!0),fk=rl("WeakMap.prototype.has",!0),gk=rl("WeakMap.prototype.delete",!0),mk=zr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new hk("Side channel does not contain "+uk(i))},delete:function(i){if(zr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return gk(e,i)}else if(Po&&t)return t.delete(i);return!1},get:function(i){return zr&&i&&(typeof i=="object"||typeof i=="function")&&e?dk(e,i):t&&t.get(i)},has:function(i){return zr&&i&&(typeof i=="object"||typeof i=="function")&&e?fk(e,i):!!t&&t.has(i)},set:function(i,s){zr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new zr),pk(e,i,s)):Po&&(t||(t=Po()),t.set(i,s))}};return r}:Po,vk=X,yk=Ti,bk=ek,wk=Ng,Sk=mk,_k=Sk||wk||bk,kk=function(){var e,t={assert:function(r){if(!t.has(r))throw new vk("Side channel does not contain "+yk(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=_k()),e.set(r,i)}};return t},Ek=tn,Zi=kk(),Ut=X,Gu={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(Zi.assert(n),!Gu.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=Zi.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=Zi.get(n);return!!t&&Ek(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=Zi.get(n);r||(r={},Zi.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Gu);var ju=Gu,Ug=Qt,kn=ju,uo=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 Ug('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');kn.set(this,"[[Type]]",e),kn.set(this,"[[Value]]",t)};uo.prototype.type=function(){return kn.get(this,"[[Type]]")};uo.prototype.value=function(){return kn.get(this,"[[Value]]")};uo.prototype["?"]=function(){var e=kn.get(this,"[[Type]]"),t=kn.get(this,"[[Value]]");if(e==="throw")throw t;return t};uo.prototype["!"]=function(){var e=kn.get(this,"[[Type]]");if(e!=="normal")throw new Ug('Assertion failed: Completion Record is not of type "normal"');return kn.get(this,"[[Value]]")};var qu=uo,xk=qu,Yu=function(e){return new xk("normal",e)},Yl,rp;function Ak(){if(rp)return Yl;rp=1;var n=xi;return Yl=function(){return n()&&!!Symbol.toStringTag},Yl}var $k=ut,ip=$k("%Object.defineProperty%",!0),Ik=Ak()(),Tk=tn,Ck=X,Ro=Ik?Symbol.toStringTag:null,Fg=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 Ck("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ro&&(r||!Tk(e,Ro))&&(ip?ip(e,Ro,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Ro]=t)},Zg={exports:{}},Pk=ut,sp=ig,Rk=Qa(),op=Ei,ap=X,Dk=Pk("%Math.floor%"),Lk=function(e,t){if(typeof e!="function")throw new ap("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Dk(t)!==t)throw new ap("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&op){var o=op(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(Rk?sp(e,"length",t,!0,!0):sp(e,"length",t)),e},zk=io,Ok=Ou,Mk=gg,Nk=function(){return Mk(zk,Ok,arguments)};(function(n){var e=Lk,t=ro,r=el,i=Nk;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return e(a,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(Zg);var Xu=Zg.exports,Uk=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},Fk=Object,Zk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||Fk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},Hk=tn,Wk=Mu(),Vk=Uk,Bk=Zk,Gk=function(e){return e&&typeof e=="object"&&Hk(e,"[[DisposableResourceStack]]")&&Wk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||Vk(e["[[DisposableResourceStack]]"],Bk))},jk=en,qk=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(jk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},Yk=qk,Ku=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":Yk(e)},Xk=X,Kk=Ti,Jk=$i,Qk=function(e,t){if(!Jk(t))throw new Xk("Assertion failed: P is not a Property Key, got "+Kk(t));return e[t]},lp=X,eE=Qk,tE=Ii,nE=$i,cp=Ti,rE=function(e,t){if(!nE(t))throw new lp("Assertion failed: P is not a Property Key");var r=eE(e,t);if(r!=null){if(!tE(r))throw new lp(cp(t)+" is not a function: "+cp(r));return r}},Lc={exports:{}},iE=ut,sE=iE,up=sE("%Reflect.construct%",!0),ma=lo;try{ma({},"",{"[[Get]]":function(){}})}catch{ma=null}if(ma&&up){var hp={},dp={};ma(dp,"length",{"[[Get]]":function(){throw hp},"[[Enumerable]]":!0}),Lc.exports=function(e){try{up(e,dp)}catch(t){return t===hp}}}else Lc.exports=function(e){return typeof e=="function"&&!!e.prototype};var oE=Lc.exports,Xl=X,pp=Ii,aE=oE,lE=function(e){if(!aE(e))throw new Xl("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 Xl("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!pp(t["[[Resolve]]"])||!pp(t["[[Reject]]"]))throw new Xl("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},fp=Qt,cE=X,Kl=tl,gp=rE,uE=lE,hE=Ku,mp=Zu(),vp=Hu(),dE=function(e,t){if(hE(e)!=="Object")throw new cE("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new fp("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&vp&&(r=gp(e,vp)),!r){if(!mp)throw new fp("`Symbol.dispose` is not supported");if(r=gp(e,mp),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=uE(Promise);try{Kl(r,i),Kl(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Kl(r,i)}}return r},pE=Qt,Jl=X,fE=Ii,gE=Ku,mE=dE,vE=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new pE("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"&&gE(e)!=="Object")throw new Jl("`V` must be an Object, or `null` or `undefined`");if(r=mE(e,t),typeof r>"u")throw new Jl("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!fE(r))throw new Jl("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},yE=Qt,Do=X,bE=Gk,yp=vE,wE=Tn(),SE=wE("Array.prototype.push"),Hg=function(e,t,r){if(!bE(e))throw new Do("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new yE("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 Do("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Do("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=yp(t,r)}else{if(typeof t<"u")throw new Do("Assertion failed: `V` must be undefined when `method` is present");s=yp(void 0,r,i)}return SE(e["[[DisposableResourceStack]]"],s),"UNUSED"},Ql,bp;function Ju(){if(bp)return Ql;bp=1;var n=ut,e=Xu,t=Qt,r=n("%Promise.resolve%",!0),i=r&&e(r);return Ql=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},Ql}var ec,wp;function _E(){if(wp)return ec;wp=1;var n=ut,e=Qt,t=n("%Promise%",!0),r=tl,i=Ju(),s=Ku;return ec=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="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(c==="ASYNC-DISPOSE")return i(t,h)},ec}var tc,Sp;function kE(){if(Sp)return tc;Sp=1;var n=qu;return tc=function(t){return new n("throw",t)},tc}var EE=ut,nc=Qt,_p=X,xE=EE("%Promise%",!0),AE=Tn(),kp=AE("Promise.prototype.then",!0),$E=qu,Ep=_E(),IE=Yu,TE=Ju(),xp=kE(),CE=Cg(),Wg=function(e,t){if(!(t instanceof $E))throw new _p("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new _p("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 nc("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&TE(xE,t),a=function(v){if(t.type()==="throw"){var m=t.value(),x=new CE(v,m);t=xp(x)}else t=xp(v)},c=i==="ASYNC-DISPOSE"&&function(m){return kp(o,function(){var x=Ep(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!x)throw new nc("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return kp(x,IE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var h=r[u];try{var p=Ep(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new nc("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},Vg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},il=Ru,Qu=X,PE=tl,Ci=Uu,RE=lo,Bg=Ii,DE=Yu,Ye=ju,LE=Fg,Gg=kr.supportsDescriptors,zE=Xu,eh=Hg,OE=Wg,jg=Vg,Ap=Zu(),at=function n(){if(!(this instanceof n)||Ye.has(this,"[[DisposableState]]")||Ye.has(this,"[[DisposeCapability]]"))throw new Qu("can only be used with new");Ye.set(this,"[[DisposableState]]","PENDING"),Ye.set(this,"[[DisposeCapability]]",jg())},qg=function(){var e=this;return Ye.assert(e,"[[DisposableState]]"),Ye.get(e,"[[DisposableState]]")==="DISPOSED"},ho=zE(qg);Gg?RE(at.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":qg}):at.prototype.disposed=!1;var Yg=function(e){Ye.set(e,"[[DisposableState]]","DISPOSED"),Gg||(e.disposed=!0)};Ci(at.prototype,"dispose",function(){var e=this;if(!ho(e))return Yg(e),OE(Ye.get(e,"[[DisposeCapability]]"),DE())["?"]()});Ci(at.prototype,"use",function(e){var t=this;if(ho(t))throw new il("a disposed stack can not use anything new");return eh(Ye.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});Ci(at.prototype,"adopt",function(e,t){var r=this;if(ho(r))throw new il("a disposed stack can not use anything new");if(!Bg(t))throw new Qu("`onDispose` must be a function");var i=function(){return PE(t,void 0,[e])};return eh(Ye.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});Ci(at.prototype,"defer",function(e){var t=this;if(ho(t))throw new il("a disposed stack can not defer anything new");if(!Bg(e))throw new Qu("`onDispose` must be a function");eh(Ye.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});Ci(at.prototype,"move",function(){var e=this;if(ho(e))throw new il("a disposed stack can not use anything new");var t=new at;return Ye.set(t,"[[DisposeCapability]]",Ye.get(e,"[[DisposeCapability]]")),Ye.set(e,"[[DisposeCapability]]",jg()),Yg(e),t});Ap&&Ci(at.prototype,Ap,at.prototype.dispose);LE(at.prototype,"DisposableStack");var ME=at,NE=ME,UE=function(){return typeof DisposableStack=="function"?DisposableStack:NE},FE=kr,ZE=Cu(),HE=UE,WE=function(){var e=HE();return FE(ZE,{DisposableStack:e},{DisposableStack:!0}),e},VE=ut,sl=Ru,th=X,$p=VE("%Promise%",!0),nh=Hg,BE=tl,Pi=Uu,GE=lo,jE=Wg,Xg=Ii,Kg=Vg,qE=Yu,Ip=Ju(),Xe=ju,YE=Fg,Jg=kr.supportsDescriptors,XE=Xu,KE=Tn(),JE=KE("Promise.prototype.then",!0),Tp=Hu(),lt=function n(){if(!(this instanceof n)||Xe.has(this,"[[AsyncDisposableState]]")||Xe.has(this,"[[DisposeCapability]]"))throw new th("can only be used with new");Xe.set(this,"[[AsyncDisposableState]]","pending"),Xe.set(this,"[[DisposeCapability]]",Kg())},Qg=function(){var e=this;return Xe.assert(e,"[[AsyncDisposableState]]"),Xe.get(e,"[[AsyncDisposableState]]")==="disposed"},po=XE(Qg);Jg?GE(lt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Qg}):lt.prototype.disposed=!1;var em=function(e){Xe.set(e,"[[AsyncDisposableState]]","disposed"),Jg||(e.disposed=!0)};Pi(lt.prototype,"disposeAsync",function(){var e=this;return po(e)?Ip($p):(em(e),JE(Ip($p,jE(Xe.get(e,"[[DisposeCapability]]"),qE())),function(t){return t["?"]()}))});Pi(lt.prototype,"use",function(e){var t=this;if(po(t))throw new sl("a disposed stack can not use anything new");return nh(Xe.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});Pi(lt.prototype,"adopt",function(e,t){var r=this;if(po(r))throw new sl("a disposed stack can not use anything new");if(!Xg(t))throw new th("`onDisposeAsync` must be a function");var i=function(){return BE(t,void 0,[e])};return i.value=e,nh(Xe.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});Pi(lt.prototype,"defer",function(e){var t=this;if(po(t))throw new sl("a disposed stack can not defer anything new");if(!Xg(e))throw new th("`onDispose` must be a function");nh(Xe.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});Pi(lt.prototype,"move",function(){var e=this;if(po(e))throw new sl("a disposed stack can not use anything new");var t=new lt;return Xe.set(t,"[[DisposeCapability]]",Xe.get(e,"[[DisposeCapability]]")),Xe.set(e,"[[DisposeCapability]]",Kg()),em(e),t});Tp&&Pi(lt.prototype,Tp,lt.prototype.disposeAsync);YE(lt.prototype,"AsyncDisposableStack");var QE=lt,ex=QE,tx=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:ex},nx=kr,rx=Cu(),ix=tx,sx=function(){var e=ix();return nx(rx,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},ox=n_,ax=u_,lx=WE,cx=sx,ux=function(){ox(),ax(),lx(),cx()};ux();const Cp=new WeakMap;function hx(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Or(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Pp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function dx(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class px{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw Pp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw Pp();if(t.constructor.name==="AsyncFunction")throw dx();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=Cp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Or(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(`${Or(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=Cp.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(`${Or(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=>Or(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(hx(r))throw new Error(`Factory for ${Or(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Or(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 Lt=new px,fx=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function gx(n){for(const e of Object.keys(n))if(fx.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function mx(n,e){gx(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function rt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:a,...c}=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}),mx(this,c)}}return n}class zt extends globalThis.EventTarget{}function vx(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function fo(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);vx(this,()=>l(this,t),()=>{E(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,t)}}return t=new WeakMap,e}const yx=rt(),bx=rt(),ea=rt(),tm="0123456789ABCDEFGHJKMNPQRSTVWXYZ",va=32,wx=16,nm=10,Rp=0xffffffffffff;var Gn;(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"})(Gn||(Gn={}));class Xi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function Sx(n){const e=Math.floor(n()*va)%va;return tm.charAt(e)}function _x(n){const e=kx(),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 Xi(Gn.PRNGDetectFailure,"Failed to find a reliable PRNG")}function kx(){return Ax()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function Ex(n,e){let t="";for(;n>0;n--)t=Sx(e)+t;return t}function xx(n,e=nm){if(isNaN(n))throw new Xi(Gn.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Rp)throw new Xi(Gn.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Rp}: ${n}`);if(n<0)throw new Xi(Gn.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Xi(Gn.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%va,r=tm.charAt(t)+r,n=(n-t)/va;return r}function Ax(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function ol(n,e){const t=_x(),r=Date.now();return xx(r,nm)+Ex(wx,t)}const bt=4,nt=6,us=2,zc=2,rh=8,$x=nt,ih="auto",En="auto",cn=120,Dp=50,ce=16,vr=cn*bt+ce*(bt-1),ya=cn*nt+ce*(nt-1),Ix=vr+ce*2,Tx=200,Cx=4,Lo=150,Px=10,Lp=2,zp=8,Rx=300,Dx=4;function rm(n){return om(n)}function im(n,e){return om(n.flatMap(t=>lm(t,e)))}function sm(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}cm(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function qr(n){const e=rm(n),t=sm(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 om(n){const e=[];for(const t of n){const r=am(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(Jt));continue}e.push(i)}}return e}function am(n){switch(n.type){case"card":return[Jt(n)];case"row":{const e=n.children.map(Jt);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=am(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(Oc));continue}if(i.type==="row"){e.push({...i,children:i.children.map(Jt)});continue}e.push(Jt(i))}}return e.length===0?[]:e.length===1?[Oc(e[0])]:[{...n,children:e}]}}}function lm(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[Jt(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(Jt);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>lm(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[Oc(t[0])]:[{...n,children:t}]}}}function cm(n,e,t,r){switch(n.type){case"card":um(n,e,t,r);return;case"row":Lx(n,e,t,r);return;case"stack":zx(n,e,t,r);return}}function um(n,e,t,r){sh(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),Ox(n.width)||t.push(`Card ${n.id} width must be an integer in the range ${us}-${rh}`),hm(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=Wn(n.width);e==="row"&&i<us&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function Lx(n,e,t,r){if(sh(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),hm(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}um(s,"row",t,r),i+=Wn(s.width)}i!==bt&&t.push(`Row ${n.id} children must sum to 4 columns`)}function zx(n,e,t,r){if(sh(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(cm(a,"stack",t,r),a.height===En){s+=1;continue}i+=a.height}if(i>nt&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=nt-i;if(o<s*zc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<zc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function sh(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function Ox(n){return n===ih||Number.isInteger(n)&&n>=us&&n<=rh}function hm(n,e=$x){return n===En||Number.isInteger(n)&&n>=zc&&n<=e}function Wn(n){return n===ih?bt:n}function Mx(n){if(n.type==="card")return{id:n.id,type:"card",width:Wn(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:Wn(n.width),height:dm(n.height,nt)}]};const e=Nx(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:Math.min(bt,Wn(s.width)),height:o});else{let a=1;for(const c of s.children)t.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:Wn(c.width),height:o}),a+=Wn(c.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 Nx(n){let e=0,t=0;for(const i of n)i.height===En?t+=1:e+=i.height;const r=t>0?(nt-e)/t:0;return n.map(i=>dm(i.height,r))}function dm(n,e){return n===En?e:n}function Jt(n){return{...n}}function Oc(n){return n.type==="card"?Jt(n):{...n,children:n.children.map(Jt)}}function pm(n,e={}){return{id:e.id??ol(),type:"card",artifactID:n,width:e.width??ih,height:e.height??En}}function fm(n,e){return n.some(t=>gm(t,e))}function gm(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=>gm(t,e))}}function Op(n){return n.layout.flatMap(mm)}function mm(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(mm)}}const ne=rt(),vm=rt(),Mr=rt(),Ux=rt();function Fx(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const Zx=Fx("RequestError"),Hx=200,Wx=300;class Vx{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 Bx(i);if(!i.ok||i.status<Hx||i.status>=Wx)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 rc(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await rc(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 rc(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new Zx(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 Bx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function rc(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 Gx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var $t,Pa,ym;class jx{constructor(e){w(this,Pa);w(this,$t);E(this,$t,e)}list(){return l(this,$t).requestJSON("GET","/screens")}async get(e={}){const t=await f(this,Pa,ym).call(this,e.screenID);return l(this,$t).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),l(this,$t).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return l(this,$t).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return l(this,$t).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}$t=new WeakMap,Pa=new WeakSet,ym=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw l(this,$t).createError(`screenID is required when multiple screens exist. Available screens: ${Gx(t)}`)};var Le;class qx{constructor(e){w(this,Le);E(this,Le,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.externalURL!==void 0&&(t.externalURL=e.externalURL),e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Le).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 l(this,Le).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return l(this,Le).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),l(this,Le).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return l(this,Le).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return l(this,Le).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return l(this,Le).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return l(this,Le).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return l(this,Le).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return l(this,Le).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return l(this,Le).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Le=new WeakMap;var Yn;class Yx{constructor(e){w(this,Yn);E(this,Yn,e)}state(){return l(this,Yn).requestJSON("GET","/viewer/state")}setActive(e){return l(this,Yn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Yn).requestJSON("POST","/viewer/focus",t)}}Yn=new WeakMap;var vs;class Xx{constructor(e){w(this,vs);E(this,vs,e)}async list(){const{views:e}=await l(this,vs).requestJSON("GET","/views");return e}}vs=new WeakMap;var Wt;class Kx{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Wt);E(this,Wt,new Vx(e,t)),this.screens=new jx(l(this,Wt)),this.artifacts=new qx(l(this,Wt)),this.viewer=new Yx(l(this,Wt)),this.views=new Xx(l(this,Wt))}health(){return l(this,Wt).requestJSON("GET","/health")}}Wt=new WeakMap;const Jx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Qx=fo(zt);var Xn,Be,Kn,Ne,pt,hn,dn,te,Un,bm,ys,wm,Sm,_m,km,Mc,Nc,Uc,Em;class e1 extends Qx{constructor(t){var i;super();w(this,te);b(this,"id");b(this,"server");w(this,Xn);w(this,Be,new Map);w(this,Kn);w(this,Ne);w(this,pt);w(this,hn);w(this,dn,null);w(this,ys,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&f(this,te,wm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&f(this,te,Sm).call(this,r.cardID,r.artifact);break;case"artifact-updated":f(this,te,_m).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&f(this,te,km).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new Ux("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,E(this,Xn,t.localStore),E(this,Kn,t.screen.name),E(this,Ne,structuredClone(t.screen.layout)),E(this,pt,t.screen.pinned);const r=((i=l(this,Xn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;E(this,hn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,ys)),f(this,te,bm).call(this)}get name(){return l(this,Kn)}get layout(){return l(this,Ne)}get pinned(){return l(this,pt)}get scrollPosition(){return l(this,hn)}get artifacts(){return l(this,Be)}setScrollPosition(t){f(this,te,Un).call(this);const r=Math.max(0,t);r!==l(this,hn)&&(E(this,hn,r),f(this,te,Em).call(this),this.dispatchEvent(new ne("change")))}setLayout(t){f(this,te,Un).call(this);const r=rm(t);if(!sm(r).valid)return;const s=f(this,te,Nc).call(this);E(this,Ne,r),E(this,dn,{layout:r,snapshot:s}),this.dispatchEvent(new ne("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,dn))==null?void 0:o.layout)===r&&(E(this,dn,null),f(this,te,Uc).call(this,s),this.dispatchEvent(new ne("change")))})}rename(t){f(this,te,Un).call(this),E(this,Kn,t),this.dispatchEvent(new ne("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setPinned(t){if(f(this,te,Un).call(this),l(this,pt)===t)return;const r=l(this,pt);E(this,pt,t),this.dispatchEvent(new ne("change")),this.server.client.screens.update({screenID:this.id,pinned:t}).catch(()=>{this.disposed||l(this,pt)===t&&(E(this,pt,r),this.dispatchEvent(new ne("change")))})}async remove(){f(this,te,Un).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(f(this,te,Un).call(this),!l(this,Be).has(t))return;const r=f(this,te,Nc).call(this);f(this,te,Mc).call(this,t),this.dispatchEvent(new ne("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(f(this,te,Uc).call(this,r),this.dispatchEvent(new ne("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,ys))}}Xn=new WeakMap,Be=new WeakMap,Kn=new WeakMap,Ne=new WeakMap,pt=new WeakMap,hn=new WeakMap,dn=new WeakMap,te=new WeakSet,Un=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},bm=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new ne("change"))}catch{}},ys=new WeakMap,wm=function(t){l(this,dn)&&E(this,dn,null),E(this,Kn,t.name),E(this,Ne,structuredClone(t.layout)),E(this,pt,t.pinned),this.dispatchEvent(new ne("change"))},Sm=function(t,r){fm(l(this,Ne),r.id)||E(this,Ne,[...l(this,Ne),pm(r.id,{id:t})]),l(this,Be).set(r.id,r),this.dispatchEvent(new ne("change"))},_m=function(t){const r=l(this,Be).get(t.id);r&&(l(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new ne("change")))},km=function(t){f(this,te,Mc).call(this,t)&&this.dispatchEvent(new ne("change"))},Mc=function(t){const r=l(this,Be).delete(t),i=Op({layout:l(this,Ne)}).length,s=im(l(this,Ne),t),o=Op({layout:s}).length;return E(this,Ne,s),r||i!==o},Nc=function(){return{layout:structuredClone(l(this,Ne)),artifacts:new Map([...l(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Uc=function(t){E(this,Ne,structuredClone(t.layout)),l(this,Be).clear();for(const[r,i]of t.artifacts)l(this,Be).set(r,structuredClone(i))},Em=function(){const t=l(this,Xn).get();l(this,Xn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:l(this,hn)}}})};const t1=fo(zt);var it,It,ft,bs,ws,Ss,Qr,ta;class n1 extends t1{constructor(t){super();w(this,Qr);w(this,it);w(this,It);w(this,ft,null);w(this,bs,()=>{this.disposed||f(this,Qr,ta).call(this)});w(this,ws,()=>{this.disposed||f(this,Qr,ta).call(this)});w(this,Ss,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=l(this,ft))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=l(this,It).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});E(this,it,t.localStore),E(this,It,t.serverManager),l(this,it).addEventListener("change",l(this,bs)),l(this,It).addEventListener("change",l(this,ws)),l(this,It).addEventListener("server-event",l(this,Ss)),f(this,Qr,ta).call(this)}get activeScreen(){return l(this,ft)}setActive(t,r){const i=l(this,it).get();i.activeServerURL===t&&i.activeScreenID===r||l(this,it).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=l(this,it).get();t.activeScreenID!==null&&l(this,it).set({...t,activeScreenID:null})}dispose(){var t;l(this,it).removeEventListener("change",l(this,bs)),l(this,It).removeEventListener("change",l(this,ws)),l(this,It).removeEventListener("server-event",l(this,Ss)),(t=l(this,ft))==null||t.dispose(),E(this,ft,null)}}it=new WeakMap,It=new WeakMap,ft=new WeakMap,bs=new WeakMap,ws=new WeakMap,Ss=new WeakMap,Qr=new WeakSet,ta=function(){var c,u,h;const{activeServerURL:t,activeScreenID:r}=l(this,it).get(),i=t?l(this,It).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,ft))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,ft))==null?void 0:u.server)===i||((h=l(this,ft))==null||h.dispose(),E(this,ft,i&&s?new e1({screen:s,server:i,localStore:l(this,it)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new yx("active-screen-changed")))};const r1="Local",i1="store-";function dt(n){return new URL(n).origin}function s1(n){return{servers:[{url:dt(n),name:r1}],activeServerURL:null,activeScreenID:null,screens:{}}}var Jn,Qn,er;class o1 extends zt{constructor(t,r,i={}){super();w(this,Jn);w(this,Qn);w(this,er);E(this,Jn,`${i1}${t}`),E(this,Qn,i.storage??a1());const s=l(this,Qn).getItem(l(this,Jn));s===null?(E(this,er,r),l(this,Qn).setItem(l(this,Jn),JSON.stringify(r))):E(this,er,JSON.parse(s))}get(){return l(this,er)}set(t){E(this,er,t),l(this,Qn).setItem(l(this,Jn),JSON.stringify(t)),this.dispatchEvent(new ne("change"))}}Jn=new WeakMap,Qn=new WeakMap,er=new WeakMap;function a1(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function A(n,e,t){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),e(a,c);const u=o.prototype,h=Object.keys(u);for(let p=0;p<h.length;p++){const v=h[p];v in a||(a[v]=u[v].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 c;const u=t!=null&&t.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.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 c,u;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class Jr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Am={};function xn(n){return Am}function $m(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 Fc(n,e){return typeof e=="bigint"?e.toString():e}function oh(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function ah(n){return n==null}function lh(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function l1(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 c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[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 Mp=Symbol("evaluating");function ie(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==Mp)return r===void 0&&(r=Mp,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function xr(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Pn(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Np(n){return JSON.stringify(n)}function c1(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Im="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ba(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const u1=oh(()=>{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 wi(n){if(ba(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(ba(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Tm(n){return wi(n)?{...n}:Array.isArray(n)?[...n]:n}const h1=new Set(["string","number","symbol"]);function Si(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rn(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 O(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 d1(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const p1={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 f1(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=Pn(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 xr(this,"shape",o),o},checks:[]});return Rn(n,s)}function g1(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=Pn(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 xr(this,"shape",o),o},checks:[]});return Rn(n,s)}function m1(n,e){if(!wi(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=Pn(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return xr(this,"shape",s),s}});return Rn(n,i)}function v1(n,e){if(!wi(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=Pn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return xr(this,"shape",r),r}});return Rn(n,t)}function y1(n,e){const t=Pn(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return xr(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Rn(n,t)}function b1(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=Pn(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return xr(this,"shape",c),c},checks:[]});return Rn(e,o)}function w1(n,e,t){const r=Pn(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 xr(this,"shape",s),s}});return Rn(e,r)}function Yr(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 Xr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function zo(n){return typeof n=="string"?n:n==null?void 0:n.message}function An(n,e,t){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=zo((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??zo((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??zo((c=t.customError)==null?void 0:c.call(t,n))??zo((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 ch(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function hs(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Cm=(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,Fc,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Pm=A("$ZodError",Cm),Rm=A("$ZodError",Cm,{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 _1(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 c=s.path[a];a===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),t}const uh=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 Jr;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>An(c,s,xn())));throw Im(a,i==null?void 0:i.callee),a}return o.value},hh=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(c=>An(c,s,xn())));throw Im(a,i==null?void 0:i.callee),a}return o.value},al=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 Jr;return s.issues.length?{success:!1,error:new(n??Pm)(s.issues.map(o=>An(o,i,xn())))}:{success:!0,data:s.value}},k1=al(Rm),ll=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=>An(o,i,xn())))}:{success:!0,data:s.value}},E1=ll(Rm),x1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return uh(n)(e,t,i)},A1=n=>(e,t,r)=>uh(n)(e,t,r),$1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return hh(n)(e,t,i)},I1=n=>async(e,t,r)=>hh(n)(e,t,r),T1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return al(n)(e,t,i)},C1=n=>(e,t,r)=>al(n)(e,t,r),P1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ll(n)(e,t,i)},R1=n=>async(e,t,r)=>ll(n)(e,t,r),D1=/^[cC][^\s-]{8,}$/,L1=/^[0-9a-z]+$/,z1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O1=/^[0-9a-vA-V]{20}$/,M1=/^[A-Za-z0-9]{27}$/,N1=/^[a-zA-Z0-9_-]{21}$/,U1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,F1=/^([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})$/,Up=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)$/,Z1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,H1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function W1(){return new RegExp(H1,"u")}const V1=/^(?:(?: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])$/,B1=/^(([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}|:))$/,G1=/^((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])$/,j1=/^(([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])$/,q1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Dm=/^[A-Za-z0-9_-]*$/,Y1=/^\+[1-9]\d{6,14}$/,Lm="(?:(?:\\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])))",X1=new RegExp(`^${Lm}$`);function zm(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 K1(n){return new RegExp(`^${zm(n)}$`)}function J1(n){const e=zm({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(`^${Lm}T(?:${r})$`)}const Q1=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}$`)},eA=/^-?\d+$/,Om=/^-?\d+(?:\.\d+)?$/,tA=/^(?:true|false)$/i,nA=/^[^A-Z]*$/,rA=/^[^a-z]*$/,Ke=A("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Mm={number:"number",bigint:"bigint",object:"date"},Nm=A("$ZodCheckLessThan",(n,e)=>{Ke.init(n,e);const t=Mm[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})}}),Um=A("$ZodCheckGreaterThan",(n,e)=>{Ke.init(n,e);const t=Mm[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})}}),iA=A("$ZodCheckMultipleOf",(n,e)=>{Ke.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):l1(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})}}),sA=A("$ZodCheckNumberFormat",(n,e)=>{var o;Ke.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]=p1[e.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=eA)}),n._zod.check=a=>{const c=a.value;if(t){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,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:c,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}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),oA=A("$ZodCheckMaxLength",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!ah(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=ch(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),aA=A("$ZodCheckMinLength",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!ah(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=ch(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),lA=A("$ZodCheckLengthEquals",(n,e)=>{var t;Ke.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!ah(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=ch(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})}}),cl=A("$ZodCheckStringFormat",(n,e)=>{var t,r;Ke.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=()=>{})}),cA=A("$ZodCheckRegex",(n,e)=>{cl.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})}}),uA=A("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=nA),cl.init(n,e)}),hA=A("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=rA),cl.init(n,e)}),dA=A("$ZodCheckIncludes",(n,e)=>{Ke.init(n,e);const t=Si(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})}}),pA=A("$ZodCheckStartsWith",(n,e)=>{Ke.init(n,e);const t=new RegExp(`^${Si(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})}}),fA=A("$ZodCheckEndsWith",(n,e)=>{Ke.init(n,e);const t=new RegExp(`.*${Si(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})}}),gA=A("$ZodCheckOverwrite",(n,e)=>{Ke.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class mA{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 gA={major:4,minor:3,patch:6},fe=A("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=gA;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,c,u)=>{let h=qr(a),p;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,x=v._zod.check(a);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Kr;if(p||x instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await x,a.issues.length!==m&&(h||(h=qr(a,m)))});else{if(a.issues.length===m)continue;h||(h=qr(a,m))}}return p?p.then(()=>a):a},o=(a,c,u)=>{if(qr(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new Kr;return h.then(p=>n._zod.parse(p,u))}return n._zod.parse(h,u)};n._zod.run=(a,c)=>{if(c.skipChecks)return n._zod.parse(a,c);if(c.direction==="backward"){const h=n._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(p=>o(p,a,c)):o(h,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Kr;return u.then(h=>s(h,r,c))}return s(u,r,c)}}ie(n,"~standard",()=>({validate:s=>{var o;try{const a=S1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return _1(n,s).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),hh=A("$ZodString",(n,e)=>{var t;fe.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??K1(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}}),ue=A("$ZodStringFormat",(n,e)=>{ll.init(n,e),hh.init(n,e)}),mA=A("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=N1),ue.init(n,e)}),vA=A("$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=Np(r))}else e.pattern??(e.pattern=Np());ue.init(n,e)}),yA=A("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=U1),ue.init(n,e)}),bA=A("$ZodURL",(n,e)=>{ue.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})}}}),wA=A("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=Z1()),ue.init(n,e)}),SA=A("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=O1),ue.init(n,e)}),_A=A("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=P1),ue.init(n,e)}),kA=A("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=R1),ue.init(n,e)}),EA=A("$ZodULID",(n,e)=>{e.pattern??(e.pattern=D1),ue.init(n,e)}),xA=A("$ZodXID",(n,e)=>{e.pattern??(e.pattern=L1),ue.init(n,e)}),AA=A("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=z1),ue.init(n,e)}),$A=A("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=X1(e)),ue.init(n,e)}),IA=A("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=q1),ue.init(n,e)}),TA=A("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=Y1(e)),ue.init(n,e)}),CA=A("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=M1),ue.init(n,e)}),PA=A("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=H1),ue.init(n,e),n._zod.bag.format="ipv4"}),RA=A("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=W1),ue.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})}}}),DA=A("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=V1),ue.init(n,e)}),LA=A("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=B1),ue.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 Um(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const zA=A("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=G1),ue.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Um(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function OA(n){if(!Rm.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Um(t)}const MA=A("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Rm),ue.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{OA(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),NA=A("$ZodE164",(n,e)=>{e.pattern??(e.pattern=j1),ue.init(n,e)});function UA(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 FA=A("$ZodJWT",(n,e)=>{ue.init(n,e),n._zod.check=t=>{UA(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Fm=A("$ZodNumber",(n,e)=>{fe.init(n,e),n._zod.pattern=n._zod.bag.pattern??zm,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}}),ZA=A("$ZodNumberFormat",(n,e)=>{rA.init(n,e),Fm.init(n,e)}),HA=A("$ZodBoolean",(n,e)=>{fe.init(n,e),n._zod.pattern=Q1,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}}),WA=A("$ZodUnknown",(n,e)=>{fe.init(n,e),n._zod.parse=t=>t}),VA=A("$ZodNever",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Up(n,e,t){n.issues.length&&e.issues.push(...Yr(t,n.issues)),e.value[t]=n.value}const BA=A("$ZodArray",(n,e)=>{fe.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],c=e.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Up(u,t,o))):Up(c,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function wa(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Yr(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function Zm(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=u1(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Hm(n,e,t,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const p in e){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const v=c.run({value:e[p],issues:[]},r);v instanceof Promise?n.push(v.then(m=>wa(m,t,p,e,h))):wa(v,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 GA=A("$ZodObject",(n,e)=>{fe.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=sh(()=>Zm(e));ie(n._zod,"propValues",()=>{const a=e.shape,c={};for(const u in a){const h=a[u]._zod;if(h.values){c[u]??(c[u]=new Set);for(const p of h.values)c[u].add(p)}}return c});const i=ba,s=e.catchall;let o;n._zod.parse=(a,c)=>{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 v of o.keys){const m=p[v],x=m._zod.optout==="optional",_=m._zod.run({value:u[v],issues:[]},c);_ instanceof Promise?h.push(_.then(C=>wa(C,a,v,u,x))):wa(_,a,v,u,x)}return s?Hm(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),jA=A("$ZodObjectJIT",(n,e)=>{GA.init(n,e);const t=n._zod.parse,r=sh(()=>Zm(e)),i=v=>{var B;const m=new fA(["shape","payload","ctx"]),x=r.value,_=L=>{const V=Mp(L);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};m.write("const input = payload.value;");const C=Object.create(null);let U=0;for(const L of x.keys)C[L]=`key_${U++}`;m.write("const newResult = {};");for(const L of x.keys){const V=C[L],F=Mp(L),he=v[L],de=((B=he==null?void 0:he._zod)==null?void 0:B.optout)==="optional";m.write(`const ${V} = ${_(L)};`),de?m.write(`
6
+ `))}}const vA={major:4,minor:3,patch:6},fe=A("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=vA;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,c,u)=>{let h=Yr(a),p;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,x=v._zod.check(a);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Jr;if(p||x instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await x,a.issues.length!==m&&(h||(h=Yr(a,m)))});else{if(a.issues.length===m)continue;h||(h=Yr(a,m))}}return p?p.then(()=>a):a},o=(a,c,u)=>{if(Yr(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new Jr;return h.then(p=>n._zod.parse(p,u))}return n._zod.parse(h,u)};n._zod.run=(a,c)=>{if(c.skipChecks)return n._zod.parse(a,c);if(c.direction==="backward"){const h=n._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return h instanceof Promise?h.then(p=>o(p,a,c)):o(h,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Jr;return u.then(h=>s(h,r,c))}return s(u,r,c)}}ie(n,"~standard",()=>({validate:s=>{var o;try{const a=k1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return E1(n,s).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),dh=A("$ZodString",(n,e)=>{var t;fe.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??Q1(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}}),ue=A("$ZodStringFormat",(n,e)=>{cl.init(n,e),dh.init(n,e)}),yA=A("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=F1),ue.init(n,e)}),bA=A("$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=Up(r))}else e.pattern??(e.pattern=Up());ue.init(n,e)}),wA=A("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=Z1),ue.init(n,e)}),SA=A("$ZodURL",(n,e)=>{ue.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})}}}),_A=A("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=W1()),ue.init(n,e)}),kA=A("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=N1),ue.init(n,e)}),EA=A("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=D1),ue.init(n,e)}),xA=A("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=L1),ue.init(n,e)}),AA=A("$ZodULID",(n,e)=>{e.pattern??(e.pattern=z1),ue.init(n,e)}),$A=A("$ZodXID",(n,e)=>{e.pattern??(e.pattern=O1),ue.init(n,e)}),IA=A("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=M1),ue.init(n,e)}),TA=A("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=J1(e)),ue.init(n,e)}),CA=A("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=X1),ue.init(n,e)}),PA=A("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=K1(e)),ue.init(n,e)}),RA=A("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=U1),ue.init(n,e)}),DA=A("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=V1),ue.init(n,e),n._zod.bag.format="ipv4"}),LA=A("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=B1),ue.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})}}}),zA=A("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=G1),ue.init(n,e)}),OA=A("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=j1),ue.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 Fm(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const MA=A("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=q1),ue.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Fm(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function NA(n){if(!Dm.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Fm(t)}const UA=A("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Dm),ue.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{NA(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),FA=A("$ZodE164",(n,e)=>{e.pattern??(e.pattern=Y1),ue.init(n,e)});function ZA(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 HA=A("$ZodJWT",(n,e)=>{ue.init(n,e),n._zod.check=t=>{ZA(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Zm=A("$ZodNumber",(n,e)=>{fe.init(n,e),n._zod.pattern=n._zod.bag.pattern??Om,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}}),WA=A("$ZodNumberFormat",(n,e)=>{sA.init(n,e),Zm.init(n,e)}),VA=A("$ZodBoolean",(n,e)=>{fe.init(n,e),n._zod.pattern=tA,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}}),BA=A("$ZodUnknown",(n,e)=>{fe.init(n,e),n._zod.parse=t=>t}),GA=A("$ZodNever",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Fp(n,e,t){n.issues.length&&e.issues.push(...Xr(t,n.issues)),e.value[t]=n.value}const jA=A("$ZodArray",(n,e)=>{fe.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],c=e.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Fp(u,t,o))):Fp(c,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function wa(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Xr(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function Hm(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=d1(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Wm(n,e,t,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const p in e){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const v=c.run({value:e[p],issues:[]},r);v instanceof Promise?n.push(v.then(m=>wa(m,t,p,e,h))):wa(v,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 qA=A("$ZodObject",(n,e)=>{fe.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=oh(()=>Hm(e));ie(n._zod,"propValues",()=>{const a=e.shape,c={};for(const u in a){const h=a[u]._zod;if(h.values){c[u]??(c[u]=new Set);for(const p of h.values)c[u].add(p)}}return c});const i=ba,s=e.catchall;let o;n._zod.parse=(a,c)=>{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 v of o.keys){const m=p[v],x=m._zod.optout==="optional",_=m._zod.run({value:u[v],issues:[]},c);_ instanceof Promise?h.push(_.then(C=>wa(C,a,v,u,x))):wa(_,a,v,u,x)}return s?Wm(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),YA=A("$ZodObjectJIT",(n,e)=>{qA.init(n,e);const t=n._zod.parse,r=oh(()=>Hm(e)),i=v=>{var B;const m=new mA(["shape","payload","ctx"]),x=r.value,_=L=>{const V=Np(L);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};m.write("const input = payload.value;");const C=Object.create(null);let U=0;for(const L of x.keys)C[L]=`key_${U++}`;m.write("const newResult = {};");for(const L of x.keys){const V=C[L],F=Np(L),he=v[L],de=((B=he==null?void 0:he._zod)==null?void 0:B.optout)==="optional";m.write(`const ${V} = ${_(L)};`),de?m.write(`
7
7
  if (${V}.issues.length) {
8
8
  if (${F} in input) {
9
9
  payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
@@ -37,47 +37,47 @@ var Ub=Object.defineProperty;var sd=n=>{throw TypeError(n)};var Fb=(n,e,t)=>e in
37
37
  newResult[${F}] = ${V}.value;
38
38
  }
39
39
 
40
- `)}m.write("payload.value = newResult;"),m.write("return payload;");const P=m.compile();return(L,V)=>P(v,L,V)};let s;const o=ba,a=!xm.jitless,u=a&&l1.value,h=e.catchall;let p;n._zod.parse=(v,m)=>{p??(p=r.value);const x=v.value;return o(x)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(e.shape)),v=s(v,m),h?Hm([],x,v,m,p,n):v):t(v,m):(v.issues.push({expected:"object",code:"invalid_type",input:x,inst:n}),v)}});function Fp(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=>!qr(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=>An(o,r,xn())))}),e)}const qA=A("$ZodUnion",(n,e)=>{fe.init(n,e),ie(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ie(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ie(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ie(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=>ah(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 c of e.options){const u=c._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(c=>Fp(c,i,n,s)):Fp(a,i,n,s)}}),YA=A("$ZodIntersection",(n,e)=>{fe.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(([c,u])=>Zp(t,c,u)):Zp(t,s,o)}});function Fc(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(bi(n)&&bi(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=Fc(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=Fc(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 Zp(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 c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).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}),qr(n))return n;const o=Fc(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 XA=A("$ZodRecord",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!bi(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(...Yr(u,p.issues)),t.value[u]=p.value})):(h.issues.length&&t.issues.push(...Yr(u,h.issues)),t.value[u]=h.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&zm.test(a)&&c.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&&(c=p)}if(c.issues.length){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>An(p,r,xn())),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(...Yr(a,p.issues)),t.value[c.value]=p.value})):(h.issues.length&&t.issues.push(...Yr(a,h.issues)),t.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>t):t}}),KA=A("$ZodEnum",(n,e)=>{fe.init(n,e);const t=Am(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>c1.has(typeof i)).map(i=>typeof i=="string"?wi(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}}),JA=A("$ZodLiteral",(n,e)=>{if(fe.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"?wi(r):r?wi(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}}),QA=A("$ZodTransform",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Em(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 Kr;return t.value=i,t}});function Hp(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Wm=A("$ZodOptional",(n,e)=>{fe.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ie(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${ah(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=>Hp(s,t.value)):Hp(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),e$=A("$ZodExactOptional",(n,e)=>{Wm.init(n,e),ie(n._zod,"values",()=>e.innerType._zod.values),ie(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),t$=A("$ZodNullable",(n,e)=>{fe.init(n,e),ie(n._zod,"optin",()=>e.innerType._zod.optin),ie(n._zod,"optout",()=>e.innerType._zod.optout),ie(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${ah(t.source)}|null)$`):void 0}),ie(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)}),n$=A("$ZodDefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",ie(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=>Wp(s,e)):Wp(i,e)}});function Wp(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const r$=A("$ZodPrefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",ie(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))}),i$=A("$ZodNonOptional",(n,e)=>{fe.init(n,e),ie(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=>Vp(s,n)):Vp(i,n)}});function Vp(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 s$=A("$ZodCatch",(n,e)=>{fe.init(n,e),ie(n._zod,"optin",()=>e.innerType._zod.optin),ie(n._zod,"optout",()=>e.innerType._zod.optout),ie(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=>An(o,r,xn()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>An(s,r,xn()))},input:t.value}),t.issues=[]),t)}}),o$=A("$ZodPipe",(n,e)=>{fe.init(n,e),ie(n._zod,"values",()=>e.in._zod.values),ie(n._zod,"optin",()=>e.in._zod.optin),ie(n._zod,"optout",()=>e.out._zod.optout),ie(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=>Oo(o,e.in,r)):Oo(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>Oo(s,e.out,r)):Oo(i,e.out,r)}});function Oo(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const a$=A("$ZodReadonly",(n,e)=>{fe.init(n,e),ie(n._zod,"propValues",()=>e.innerType._zod.propValues),ie(n._zod,"values",()=>e.innerType._zod.values),ie(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ie(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(Bp):Bp(i)}});function Bp(n){return n.value=Object.freeze(n.value),n}const l$=A("$ZodCustom",(n,e)=>{Ke.init(n,e),fe.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=>Gp(s,t,r,n));Gp(i,t,r,n)}});function Gp(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(hs(i))}}var jp;class c${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 u$(){return new c$}(jp=globalThis).__zod_globalRegistry??(jp.__zod_globalRegistry=u$());const Xi=globalThis.__zod_globalRegistry;function h$(n,e){return new n({type:"string",...O(e)})}function d$(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...O(e)})}function qp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...O(e)})}function p$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...O(e)})}function f$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(e)})}function g$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(e)})}function m$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(e)})}function v$(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...O(e)})}function y$(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...O(e)})}function b$(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(e)})}function w$(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...O(e)})}function S$(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(e)})}function _$(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...O(e)})}function k$(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...O(e)})}function E$(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(e)})}function x$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(e)})}function A$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(e)})}function $$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(e)})}function I$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(e)})}function T$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...O(e)})}function C$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...O(e)})}function P$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...O(e)})}function R$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...O(e)})}function D$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(e)})}function L$(n,e){return new n({type:"string",format:"date",check:"string_format",...O(e)})}function z$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...O(e)})}function O$(n,e){return new n({type:"string",format:"duration",check:"string_format",...O(e)})}function M$(n,e){return new n({type:"number",checks:[],...O(e)})}function N$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...O(e)})}function U$(n,e){return new n({type:"boolean",...O(e)})}function F$(n){return new n({type:"unknown"})}function Z$(n,e){return new n({type:"never",...O(e)})}function Yp(n,e){return new Mm({check:"less_than",...O(e),value:n,inclusive:!1})}function rc(n,e){return new Mm({check:"less_than",...O(e),value:n,inclusive:!0})}function Xp(n,e){return new Nm({check:"greater_than",...O(e),value:n,inclusive:!1})}function ic(n,e){return new Nm({check:"greater_than",...O(e),value:n,inclusive:!0})}function Kp(n,e){return new nA({check:"multiple_of",...O(e),value:n})}function Vm(n,e){return new iA({check:"max_length",...O(e),maximum:n})}function Sa(n,e){return new sA({check:"min_length",...O(e),minimum:n})}function Bm(n,e){return new oA({check:"length_equals",...O(e),length:n})}function H$(n,e){return new aA({check:"string_format",format:"regex",...O(e),pattern:n})}function W$(n){return new lA({check:"string_format",format:"lowercase",...O(n)})}function V$(n){return new cA({check:"string_format",format:"uppercase",...O(n)})}function B$(n,e){return new uA({check:"string_format",format:"includes",...O(e),includes:n})}function G$(n,e){return new hA({check:"string_format",format:"starts_with",...O(e),prefix:n})}function j$(n,e){return new dA({check:"string_format",format:"ends_with",...O(e),suffix:n})}function Pi(n){return new pA({check:"overwrite",tx:n})}function q$(n){return Pi(e=>e.normalize(n))}function Y$(){return Pi(n=>n.trim())}function X$(){return Pi(n=>n.toLowerCase())}function K$(){return Pi(n=>n.toUpperCase())}function J$(){return Pi(n=>a1(n))}function Q$(n,e,t){return new n({type:"array",element:e,...O(t)})}function eI(n,e,t){return new n({type:"custom",check:"custom",fn:e,...O(t)})}function tI(n){const e=nI(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(hs(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(hs(i))}},n(t.value,t)));return e}function nI(n,e){const t=new Ke({check:"custom",...O(e)});return t._zod.check=n,t}function Gm(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)??Xi,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 we(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 v={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,v);else{const x=o.schema,_=e.processors[i.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);_(n,e,x,v)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),we(m,e,v),e.seen.get(m).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Me(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 jm(n,e){var o,a,c,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 v=r.get(p);if(v&&v!==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 _;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const C=(_=n.external.registry.get(h[0]))==null?void 0:_.id,U=n.external.uri??(B=>B);if(C)return{ref:U(C)};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}/`,x=h[1].schema.id??`__schema${n.counter++}`;return{defId:x,ref:m+x}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:v,defId:m}=i(h);p.def={...p.schema},m&&(p.defId=m);const x=p.schema;for(const _ in x)delete x[_];x.$ref=v};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(L,V)=>P(v,L,V)};let s;const o=ba,a=!Am.jitless,u=a&&u1.value,h=e.catchall;let p;n._zod.parse=(v,m)=>{p??(p=r.value);const x=v.value;return o(x)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(e.shape)),v=s(v,m),h?Wm([],x,v,m,p,n):v):t(v,m):(v.issues.push({expected:"object",code:"invalid_type",input:x,inst:n}),v)}});function Zp(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=>!Yr(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=>An(o,r,xn())))}),e)}const XA=A("$ZodUnion",(n,e)=>{fe.init(n,e),ie(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ie(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ie(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ie(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=>lh(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 c of e.options){const u=c._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(c=>Zp(c,i,n,s)):Zp(a,i,n,s)}}),KA=A("$ZodIntersection",(n,e)=>{fe.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(([c,u])=>Hp(t,c,u)):Hp(t,s,o)}});function Zc(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(wi(n)&&wi(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=Zc(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=Zc(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 Hp(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 c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).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}),Yr(n))return n;const o=Zc(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 JA=A("$ZodRecord",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!wi(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(...Xr(u,p.issues)),t.value[u]=p.value})):(h.issues.length&&t.issues.push(...Xr(u,h.issues)),t.value[u]=h.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Om.test(a)&&c.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&&(c=p)}if(c.issues.length){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>An(p,r,xn())),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(...Xr(a,p.issues)),t.value[c.value]=p.value})):(h.issues.length&&t.issues.push(...Xr(a,h.issues)),t.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>t):t}}),QA=A("$ZodEnum",(n,e)=>{fe.init(n,e);const t=$m(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>h1.has(typeof i)).map(i=>typeof i=="string"?Si(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}}),e$=A("$ZodLiteral",(n,e)=>{if(fe.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"?Si(r):r?Si(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}}),t$=A("$ZodTransform",(n,e)=>{fe.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new xm(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 Jr;return t.value=i,t}});function Wp(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Vm=A("$ZodOptional",(n,e)=>{fe.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ie(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${lh(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=>Wp(s,t.value)):Wp(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),n$=A("$ZodExactOptional",(n,e)=>{Vm.init(n,e),ie(n._zod,"values",()=>e.innerType._zod.values),ie(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),r$=A("$ZodNullable",(n,e)=>{fe.init(n,e),ie(n._zod,"optin",()=>e.innerType._zod.optin),ie(n._zod,"optout",()=>e.innerType._zod.optout),ie(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${lh(t.source)}|null)$`):void 0}),ie(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)}),i$=A("$ZodDefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",ie(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=>Vp(s,e)):Vp(i,e)}});function Vp(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const s$=A("$ZodPrefault",(n,e)=>{fe.init(n,e),n._zod.optin="optional",ie(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))}),o$=A("$ZodNonOptional",(n,e)=>{fe.init(n,e),ie(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=>Bp(s,n)):Bp(i,n)}});function Bp(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 a$=A("$ZodCatch",(n,e)=>{fe.init(n,e),ie(n._zod,"optin",()=>e.innerType._zod.optin),ie(n._zod,"optout",()=>e.innerType._zod.optout),ie(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=>An(o,r,xn()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>An(s,r,xn()))},input:t.value}),t.issues=[]),t)}}),l$=A("$ZodPipe",(n,e)=>{fe.init(n,e),ie(n._zod,"values",()=>e.in._zod.values),ie(n._zod,"optin",()=>e.in._zod.optin),ie(n._zod,"optout",()=>e.out._zod.optout),ie(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=>Oo(o,e.in,r)):Oo(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>Oo(s,e.out,r)):Oo(i,e.out,r)}});function Oo(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const c$=A("$ZodReadonly",(n,e)=>{fe.init(n,e),ie(n._zod,"propValues",()=>e.innerType._zod.propValues),ie(n._zod,"values",()=>e.innerType._zod.values),ie(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ie(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(Gp):Gp(i)}});function Gp(n){return n.value=Object.freeze(n.value),n}const u$=A("$ZodCustom",(n,e)=>{Ke.init(n,e),fe.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=>jp(s,t,r,n));jp(i,t,r,n)}});function jp(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(hs(i))}}var qp;class h${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 d$(){return new h$}(qp=globalThis).__zod_globalRegistry??(qp.__zod_globalRegistry=d$());const Ki=globalThis.__zod_globalRegistry;function p$(n,e){return new n({type:"string",...O(e)})}function f$(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...O(e)})}function Yp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...O(e)})}function g$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...O(e)})}function m$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(e)})}function v$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(e)})}function y$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(e)})}function b$(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...O(e)})}function w$(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...O(e)})}function S$(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(e)})}function _$(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...O(e)})}function k$(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(e)})}function E$(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...O(e)})}function x$(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...O(e)})}function A$(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(e)})}function $$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(e)})}function I$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(e)})}function T$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(e)})}function C$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(e)})}function P$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...O(e)})}function R$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...O(e)})}function D$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...O(e)})}function L$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...O(e)})}function z$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(e)})}function O$(n,e){return new n({type:"string",format:"date",check:"string_format",...O(e)})}function M$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...O(e)})}function N$(n,e){return new n({type:"string",format:"duration",check:"string_format",...O(e)})}function U$(n,e){return new n({type:"number",checks:[],...O(e)})}function F$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...O(e)})}function Z$(n,e){return new n({type:"boolean",...O(e)})}function H$(n){return new n({type:"unknown"})}function W$(n,e){return new n({type:"never",...O(e)})}function Xp(n,e){return new Nm({check:"less_than",...O(e),value:n,inclusive:!1})}function ic(n,e){return new Nm({check:"less_than",...O(e),value:n,inclusive:!0})}function Kp(n,e){return new Um({check:"greater_than",...O(e),value:n,inclusive:!1})}function sc(n,e){return new Um({check:"greater_than",...O(e),value:n,inclusive:!0})}function Jp(n,e){return new iA({check:"multiple_of",...O(e),value:n})}function Bm(n,e){return new oA({check:"max_length",...O(e),maximum:n})}function Sa(n,e){return new aA({check:"min_length",...O(e),minimum:n})}function Gm(n,e){return new lA({check:"length_equals",...O(e),length:n})}function V$(n,e){return new cA({check:"string_format",format:"regex",...O(e),pattern:n})}function B$(n){return new uA({check:"string_format",format:"lowercase",...O(n)})}function G$(n){return new hA({check:"string_format",format:"uppercase",...O(n)})}function j$(n,e){return new dA({check:"string_format",format:"includes",...O(e),includes:n})}function q$(n,e){return new pA({check:"string_format",format:"starts_with",...O(e),prefix:n})}function Y$(n,e){return new fA({check:"string_format",format:"ends_with",...O(e),suffix:n})}function Ri(n){return new gA({check:"overwrite",tx:n})}function X$(n){return Ri(e=>e.normalize(n))}function K$(){return Ri(n=>n.trim())}function J$(){return Ri(n=>n.toLowerCase())}function Q$(){return Ri(n=>n.toUpperCase())}function eI(){return Ri(n=>c1(n))}function tI(n,e,t){return new n({type:"array",element:e,...O(t)})}function nI(n,e,t){return new n({type:"custom",check:"custom",fn:e,...O(t)})}function rI(n){const e=iI(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(hs(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(hs(i))}},n(t.value,t)));return e}function iI(n,e){const t=new Ke({check:"custom",...O(e)});return t._zod.check=n,t}function jm(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)??Ki,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 Se(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 v={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,v);else{const x=o.schema,_=e.processors[i.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);_(n,e,x,v)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),Se(m,e,v),e.seen.get(m).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Me(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 qm(n,e){var o,a,c,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 v=r.get(p);if(v&&v!==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 _;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const C=(_=n.external.registry.get(h[0]))==null?void 0:_.id,U=n.external.uri??(B=>B);if(C)return{ref:U(C)};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}/`,x=h[1].schema.id??`__schema${n.counter++}`;return{defId:x,ref:m+x}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:v,defId:m}=i(h);p.def={...p.schema},m&&(p.defId=m);const x=p.schema;for(const _ in x)delete x[_];x.$ref=v};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=(c=n.external.registry.get(h[0]))==null?void 0:c.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 qm(n,e){var o,a,c;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,v={...p},m=h.ref;if(h.ref=null,m){r(m);const _=n.seen.get(m),C=_.schema;if(C.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(C)):Object.assign(p,C),Object.assign(p,v),u._zod.parent===m)for(const P in p)P==="$ref"||P==="allOf"||P in v||delete p[P];if(C.$ref&&_.def)for(const P in p)P==="$ref"||P==="allOf"||P in _.def&&JSON.stringify(p[P])===JSON.stringify(_.def[P])&&delete p[P]}const x=u._zod.parent;if(x&&x!==m){r(x);const _=n.seen.get(x);if(_!=null&&_.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const C in p)C==="$ref"||C==="allOf"||C in _.def&&JSON.stringify(p[C])===JSON.stringify(_.def[C])&&delete p[C]}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=((c=n.external)==null?void 0:c.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:_a(e,"input",n.processors),output:_a(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Me(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 Me(r.element,t);if(r.type==="set")return Me(r.valueType,t);if(r.type==="lazy")return Me(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 Me(r.innerType,t);if(r.type==="intersection")return Me(r.left,t)||Me(r.right,t);if(r.type==="record"||r.type==="map")return Me(r.keyType,t)||Me(r.valueType,t);if(r.type==="pipe")return Me(r.in,t)||Me(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Me(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Me(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Me(i,t))return!0;return!!(r.rest&&Me(r.rest,t))}return!1}const rI=(n,e={})=>t=>{const r=Gm({...t,processors:e});return we(n,r),jm(r,n),qm(r,n)},_a=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Gm({...i??{},target:s,io:e,processors:t});return we(n,o),jm(o,n),qm(o,n)},iI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sI=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=iI[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const h=[...c];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}))])}},oI=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:a,multipleOf:c,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 c=="number"&&(i.multipleOf=c)},aI=(n,e,t,r)=>{t.type="boolean"},lI=(n,e,t,r)=>{t.not={}},cI=(n,e,t,r)=>{},uI=(n,e,t,r)=>{const i=n._zod.def,s=Am(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},hI=(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},dI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},pI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},fI=(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=we(s.element,e,{...r,path:[...r.path,"items"]})},gI=(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]=we(o[h],e,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(h=>{const p=s.shape[h]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=we(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},mI=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>we(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},vI=(n,e,t,r)=>{const i=n._zod.def,s=we(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=we(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=c},yI=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=we(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=we(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=we(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)}},bI=(n,e,t,r)=>{const i=n._zod.def,s=we(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"}]},wI=(n,e,t,r)=>{const i=n._zod.def;we(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},SI=(n,e,t,r)=>{const i=n._zod.def;we(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},_I=(n,e,t,r)=>{const i=n._zod.def;we(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)))},kI=(n,e,t,r)=>{const i=n._zod.def;we(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},EI=(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;we(s,e,r);const o=e.seen.get(n);o.ref=s},xI=(n,e,t,r)=>{const i=n._zod.def;we(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Ym=(n,e,t,r)=>{const i=n._zod.def;we(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},AI=A("ZodISODateTime",(n,e)=>{$A.init(n,e),me.init(n,e)});function $I(n){return D$(AI,n)}const II=A("ZodISODate",(n,e)=>{IA.init(n,e),me.init(n,e)});function TI(n){return L$(II,n)}const CI=A("ZodISOTime",(n,e)=>{TA.init(n,e),me.init(n,e)});function PI(n){return z$(CI,n)}const RI=A("ZodISODuration",(n,e)=>{CA.init(n,e),me.init(n,e)});function DI(n){return O$(RI,n)}const Xm=(n,e)=>{Cm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>w1(n,t)},flatten:{value:t=>b1(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Uc,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Uc,2)}},isEmpty:{get(){return n.issues.length===0}}})},Jp=A("ZodError",Xm),ht=A("ZodError",Xm,{Parent:Error}),LI=ch(ht),zI=uh(ht),OI=ol(ht),MI=al(ht),NI=k1(ht),UI=E1(ht),FI=x1(ht),ZI=A1(ht),HI=$1(ht),WI=I1(ht),VI=T1(ht),BI=C1(ht),ge=A("ZodType",(n,e)=>(fe.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:_a(n,"input"),output:_a(n,"output")}}),n.toJSONSchema=rI(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(Pn(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)=>Rn(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>LI(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>OI(n,t,r),n.parseAsync=async(t,r)=>zI(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>MI(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>NI(n,t,r),n.decode=(t,r)=>UI(n,t,r),n.encodeAsync=async(t,r)=>FI(n,t,r),n.decodeAsync=async(t,r)=>ZI(n,t,r),n.safeEncode=(t,r)=>HI(n,t,r),n.safeDecode=(t,r)=>WI(n,t,r),n.safeEncodeAsync=async(t,r)=>VI(n,t,r),n.safeDecodeAsync=async(t,r)=>BI(n,t,r),n.refine=(t,r)=>n.check(OT(t,r)),n.superRefine=t=>n.check(MT(t)),n.overwrite=t=>n.check(Pi(t)),n.optional=()=>tf(n),n.exactOptional=()=>kT(n),n.nullable=()=>nf(n),n.nullish=()=>tf(nf(n)),n.nonoptional=t=>TT(n,t),n.array=()=>D(n),n.or=t=>G([n,t]),n.and=t=>cl(n,t),n.transform=t=>rf(n,ST(t)),n.default=t=>AT(n,t),n.prefault=t=>IT(n,t),n.catch=t=>PT(n,t),n.pipe=t=>rf(n,t),n.readonly=()=>LT(n),n.describe=t=>{const r=n.clone();return Xi.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Xi.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Xi.get(n);const r=n.clone();return Xi.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Km=A("_ZodString",(n,e)=>{hh.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>sI(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(H$(...r)),n.includes=(...r)=>n.check(B$(...r)),n.startsWith=(...r)=>n.check(G$(...r)),n.endsWith=(...r)=>n.check(j$(...r)),n.min=(...r)=>n.check(Sa(...r)),n.max=(...r)=>n.check(Vm(...r)),n.length=(...r)=>n.check(Bm(...r)),n.nonempty=(...r)=>n.check(Sa(1,...r)),n.lowercase=r=>n.check(W$(r)),n.uppercase=r=>n.check(V$(r)),n.trim=()=>n.check(Y$()),n.normalize=(...r)=>n.check(q$(...r)),n.toLowerCase=()=>n.check(X$()),n.toUpperCase=()=>n.check(K$()),n.slugify=()=>n.check(J$())}),GI=A("ZodString",(n,e)=>{hh.init(n,e),Km.init(n,e),n.email=t=>n.check(d$(jI,t)),n.url=t=>n.check(v$(qI,t)),n.jwt=t=>n.check(R$(cT,t)),n.emoji=t=>n.check(y$(YI,t)),n.guid=t=>n.check(qp(Qp,t)),n.uuid=t=>n.check(p$(Mo,t)),n.uuidv4=t=>n.check(f$(Mo,t)),n.uuidv6=t=>n.check(g$(Mo,t)),n.uuidv7=t=>n.check(m$(Mo,t)),n.nanoid=t=>n.check(b$(XI,t)),n.guid=t=>n.check(qp(Qp,t)),n.cuid=t=>n.check(w$(KI,t)),n.cuid2=t=>n.check(S$(JI,t)),n.ulid=t=>n.check(_$(QI,t)),n.base64=t=>n.check(T$(oT,t)),n.base64url=t=>n.check(C$(aT,t)),n.xid=t=>n.check(k$(eT,t)),n.ksuid=t=>n.check(E$(tT,t)),n.ipv4=t=>n.check(x$(nT,t)),n.ipv6=t=>n.check(A$(rT,t)),n.cidrv4=t=>n.check($$(iT,t)),n.cidrv6=t=>n.check(I$(sT,t)),n.e164=t=>n.check(P$(lT,t)),n.datetime=t=>n.check($I(t)),n.date=t=>n.check(TI(t)),n.time=t=>n.check(PI(t)),n.duration=t=>n.check(DI(t))});function d(n){return h$(GI,n)}const me=A("ZodStringFormat",(n,e)=>{ue.init(n,e),Km.init(n,e)}),jI=A("ZodEmail",(n,e)=>{yA.init(n,e),me.init(n,e)}),Qp=A("ZodGUID",(n,e)=>{mA.init(n,e),me.init(n,e)}),Mo=A("ZodUUID",(n,e)=>{vA.init(n,e),me.init(n,e)}),qI=A("ZodURL",(n,e)=>{bA.init(n,e),me.init(n,e)}),YI=A("ZodEmoji",(n,e)=>{wA.init(n,e),me.init(n,e)}),XI=A("ZodNanoID",(n,e)=>{SA.init(n,e),me.init(n,e)}),KI=A("ZodCUID",(n,e)=>{_A.init(n,e),me.init(n,e)}),JI=A("ZodCUID2",(n,e)=>{kA.init(n,e),me.init(n,e)}),QI=A("ZodULID",(n,e)=>{EA.init(n,e),me.init(n,e)}),eT=A("ZodXID",(n,e)=>{xA.init(n,e),me.init(n,e)}),tT=A("ZodKSUID",(n,e)=>{AA.init(n,e),me.init(n,e)}),nT=A("ZodIPv4",(n,e)=>{PA.init(n,e),me.init(n,e)}),rT=A("ZodIPv6",(n,e)=>{RA.init(n,e),me.init(n,e)}),iT=A("ZodCIDRv4",(n,e)=>{DA.init(n,e),me.init(n,e)}),sT=A("ZodCIDRv6",(n,e)=>{LA.init(n,e),me.init(n,e)}),oT=A("ZodBase64",(n,e)=>{zA.init(n,e),me.init(n,e)}),aT=A("ZodBase64URL",(n,e)=>{MA.init(n,e),me.init(n,e)}),lT=A("ZodE164",(n,e)=>{NA.init(n,e),me.init(n,e)}),cT=A("ZodJWT",(n,e)=>{FA.init(n,e),me.init(n,e)}),Jm=A("ZodNumber",(n,e)=>{Fm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>oI(n,r,i),n.gt=(r,i)=>n.check(Xp(r,i)),n.gte=(r,i)=>n.check(ic(r,i)),n.min=(r,i)=>n.check(ic(r,i)),n.lt=(r,i)=>n.check(Yp(r,i)),n.lte=(r,i)=>n.check(rc(r,i)),n.max=(r,i)=>n.check(rc(r,i)),n.int=r=>n.check(ef(r)),n.safe=r=>n.check(ef(r)),n.positive=r=>n.check(Xp(0,r)),n.nonnegative=r=>n.check(ic(0,r)),n.negative=r=>n.check(Yp(0,r)),n.nonpositive=r=>n.check(rc(0,r)),n.multipleOf=(r,i)=>n.check(Kp(r,i)),n.step=(r,i)=>n.check(Kp(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 H(n){return M$(Jm,n)}const uT=A("ZodNumberFormat",(n,e)=>{ZA.init(n,e),Jm.init(n,e)});function ef(n){return N$(uT,n)}const hT=A("ZodBoolean",(n,e)=>{HA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>aI(n,t,r)});function Ae(n){return U$(hT,n)}const dT=A("ZodUnknown",(n,e)=>{WA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>cI()});function S(){return F$(dT)}const pT=A("ZodNever",(n,e)=>{VA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>lI(n,t,r)});function fT(n){return Z$(pT,n)}const gT=A("ZodArray",(n,e)=>{BA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>fI(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(Sa(t,r)),n.nonempty=t=>n.check(Sa(1,t)),n.max=(t,r)=>n.check(Vm(t,r)),n.length=(t,r)=>n.check(Bm(t,r)),n.unwrap=()=>n.element});function D(n,e){return Q$(gT,n,e)}const Qm=A("ZodObject",(n,e)=>{jA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>gI(n,t,r,i),ie(n,"shape",()=>e.shape),n.keyof=()=>ka(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:fT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>f1(n,t),n.safeExtend=t=>g1(n,t),n.merge=t=>m1(n,t),n.pick=t=>d1(n,t),n.omit=t=>p1(n,t),n.partial=(...t)=>v1(tv,n,t[0]),n.required=(...t)=>y1(nv,n,t[0])});function ev(n,e){const t={type:"object",shape:n??{},...O(e)};return new Qm(t)}function g(n,e){return new Qm({type:"object",shape:n,catchall:S(),...O(e)})}const mT=A("ZodUnion",(n,e)=>{qA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>mI(n,t,r,i),n.options=e.options});function G(n,e){return new mT({type:"union",options:n,...O(e)})}const vT=A("ZodIntersection",(n,e)=>{YA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>vI(n,t,r,i)});function cl(n,e){return new vT({type:"intersection",left:n,right:e})}const yT=A("ZodRecord",(n,e)=>{XA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>yI(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function k(n,e,t){return new yT({type:"record",keyType:n,valueType:e,...O(t)})}const Zc=A("ZodEnum",(n,e)=>{KA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>uI(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 Zc({...e,checks:[],...O(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 Zc({...e,checks:[],...O(i),entries:s})}});function ka(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Zc({type:"enum",entries:t,...O(e)})}const bT=A("ZodLiteral",(n,e)=>{JA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>hI(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 bT({type:"literal",values:Array.isArray(n)?n:[n],...O(e)})}const wT=A("ZodTransform",(n,e)=>{QA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>pI(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Em(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(hs(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(hs(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function ST(n){return new wT({type:"transform",transform:n})}const tv=A("ZodOptional",(n,e)=>{Wm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Ym(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function tf(n){return new tv({type:"optional",innerType:n})}const _T=A("ZodExactOptional",(n,e)=>{e$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Ym(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function kT(n){return new _T({type:"optional",innerType:n})}const ET=A("ZodNullable",(n,e)=>{t$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>bI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function nf(n){return new ET({type:"nullable",innerType:n})}const xT=A("ZodDefault",(n,e)=>{n$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>SI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function AT(n,e){return new xT({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Im(e)}})}const $T=A("ZodPrefault",(n,e)=>{r$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>_I(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function IT(n,e){return new $T({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Im(e)}})}const nv=A("ZodNonOptional",(n,e)=>{i$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>wI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function TT(n,e){return new nv({type:"nonoptional",innerType:n,...O(e)})}const CT=A("ZodCatch",(n,e)=>{s$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>kI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function PT(n,e){return new CT({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const RT=A("ZodPipe",(n,e)=>{o$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>EI(n,t,r,i),n.in=e.in,n.out=e.out});function rf(n,e){return new RT({type:"pipe",in:n,out:e})}const DT=A("ZodReadonly",(n,e)=>{a$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>xI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function LT(n){return new DT({type:"readonly",innerType:n})}const zT=A("ZodCustom",(n,e)=>{l$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>dI(n,t)});function OT(n,e={}){return eI(zT,n,e)}function MT(n){return tI(n)}const sc={custom:"custom"},NT=["text/markdown","text/html"],UT=["committed","pending"];function FT(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}ev({id:d().min(1),type:ka(NT),title:d(),status:ka(UT),externalFilePath:d().optional(),externalURL:d().optional()}).superRefine((n,e)=>{n.externalFilePath!==void 0&&n.externalURL!==void 0&&e.addIssue({code:sc.custom,message:"externalFilePath and externalURL are mutually exclusive",path:["externalURL"]}),n.externalURL!==void 0&&(FT(n.externalURL)||e.addIssue({code:sc.custom,message:"externalURL must be an http(s) URL",path:["externalURL"]}),n.status!=="committed"&&e.addIssue({code:sc.custom,message:"URL-backed artifacts must have status committed",path:["status"]}))});ev({name:d().min(1),description:d(),accepts:D(d().min(1)).min(1)});function rv(n){return typeof n=="object"&&n!==null}function ZT(n){return!rv(n)||n.type!=="ready"?!1:!("id"in n)}function HT(n){return!(!rv(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function WT(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 VT(n,e){let t=null;for(const r of n.accepts){const i=WT(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function BT(n,e){let t=-1,r=null;for(const i of e){const s=VT(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const le={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"},GT=1,jT=g({_meta:k(d(),S()).nullish(),terminal:Ae().optional().default(!1)}),qT=g({_meta:k(d(),S()).nullish(),label:d().nullish(),name:d(),optional:Ae().optional().default(!1),secret:Ae().optional().default(!0)}),YT=g({_meta:k(d(),S()).nullish(),description:d().nullish(),id:d(),name:d()}),XT=g({_meta:k(d(),S()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:D(qT)}),KT=g({_meta:k(d(),S()).nullish(),args:D(d()).optional(),description:d().nullish(),env:k(d(),d()).optional(),id:d(),name:d()}),JT=G([XT.and(g({type:$("env_var")})),KT.and(g({type:$("terminal")})),YT]),QT=g({_meta:k(d(),S()).nullish(),methodId:d()}),eC=g({_meta:k(d(),S()).nullish()}),tC=g({_meta:k(d(),S()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),nC=g({default:Ae().nullish(),description:d().nullish(),title:d().nullish()}),rC=g({_meta:k(d(),S()).nullish()}),iC=g({_meta:k(d(),S()).nullish()}),sC=g({amount:H(),currency:d()}),oC=g({_meta:k(d(),S()).nullish(),terminalId:d()}),aC=g({_meta:k(d(),S()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),lC=G([d(),H(),H(),Ae(),D(d())]),cC=g({content:k(d(),lC).nullish()}),uC=G([cC.and(g({action:$("accept")})),g({action:$("decline")}),g({action:$("cancel")})]),hC=g({_meta:k(d(),S()).nullish()}),iv=d(),dC=g({_meta:k(d(),S()).nullish(),elicitationId:iv}),pC=g({_meta:k(d(),S()).nullish(),action:uC}),fC=$("object"),gC=$("string"),mC=g({_meta:k(d(),S()).nullish()}),vC=g({_meta:k(d(),S()).nullish(),form:hC.nullish(),url:mC.nullish()}),yC=g({elicitationId:iv,url:d().url()}),sv=g({const:d(),title:d()}),ov=g({_meta:k(d(),S()).nullish(),name:d(),value:d()}),bC=G([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),av=g({code:bC,data:S().optional(),message:d()}),lv=S(),cv=S(),uv=S(),wC=g({_meta:k(d(),S()).nullish(),readTextFile:Ae().optional().default(!1),writeTextFile:Ae().optional().default(!1)}),hv=g({_meta:k(d(),S()).nullish(),name:d(),value:d()}),dv=g({_meta:k(d(),S()).nullish(),name:d(),title:d().nullish(),version:d()}),SC=g({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),_C=g({_meta:k(d(),S()).nullish()}),kC=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),EC=g({_meta:k(d(),S()).nullish()}),xC=g({_meta:k(d(),S()).nullish(),logout:EC.nullish()}),AC=g({_meta:k(d(),S()).nullish()}),$C=g({_meta:k(d(),S()).nullish()}),IC=g({_meta:k(d(),S()).nullish(),http:Ae().optional().default(!1),sse:Ae().optional().default(!1)}),TC=g({_meta:k(d(),S()).nullish(),headers:D(hv),name:d(),url:d()}),CC=g({_meta:k(d(),S()).nullish(),headers:D(hv),name:d(),url:d()}),PC=g({_meta:k(d(),S()).nullish(),args:D(d()),command:d(),env:D(ov),name:d()}),ul=G([TC.and(g({type:$("http")})),CC.and(g({type:$("sse")})),PC]),dh=d(),RC=g({_meta:k(d(),S()).nullish(),description:d().nullish(),modelId:dh,name:d()}),DC=G([$("error"),$("warning"),$("information"),$("hint")]),LC=g({_meta:k(d(),S()).nullish()}),zC=g({_meta:k(d(),S()).nullish()}),OC=g({_meta:k(d(),S()).nullish()}),MC=g({_meta:k(d(),S()).nullish()}),NC=g({_meta:k(d(),S()).nullish()}),UC=g({_meta:k(d(),S()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),FC=g({diff:d(),uri:d()}),ZC=g({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),HC=g({_meta:k(d(),S()).nullish()}),WC=g({_meta:k(d(),S()).nullish()}),VC=g({languageId:d(),text:d(),uri:d()}),BC=g({_meta:k(d(),S()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),GC=G([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),jC=g({excerpts:D(ZC),uri:d()}),qC=g({_meta:k(d(),S()).nullish()}),YC=g({_meta:k(d(),S()).nullish()}),XC=g({name:d(),owner:d(),remoteUrl:d()}),KC=g({_meta:k(d(),S()).nullish()}),JC=g({_meta:k(d(),S()).nullish(),jump:HC.nullish(),rename:YC.nullish(),searchAndReplace:KC.nullish()}),QC=g({id:d(),isRegex:Ae().nullish(),replace:d(),search:d(),uri:d()}),eP=G([$("automatic"),$("diagnostic"),$("manual")]),tP=g({_meta:k(d(),S()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),nP=g({_meta:k(d(),S()).nullish(),diagnostics:LC.nullish(),editHistory:UC.nullish(),openFiles:WC.nullish(),recentFiles:BC.nullish(),relatedSnippets:qC.nullish(),userActions:tP.nullish()}),rP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(ul)}),iP=g({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),pv=d(),sP=G([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),oP=g({_meta:k(d(),S()).nullish(),kind:sP,name:d(),optionId:pv}),aP=G([$("high"),$("medium"),$("low")]),lP=G([$("pending"),$("in_progress"),$("completed")]),cP=g({_meta:k(d(),S()).nullish(),content:d(),priority:aP,status:lP}),uP=g({_meta:k(d(),S()).nullish(),entries:D(cP)}),$n=g({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),hP=g({id:d(),position:$n,uri:d()}),dP=g({id:d(),newName:d(),position:$n,uri:d()}),pP=g({action:d(),position:$n,timestampMs:H(),uri:d()}),fv=G([$("utf-16"),$("utf-32"),$("utf-8")]),fP=g({_meta:k(d(),S()).nullish(),auth:jT.optional().default({terminal:!1}),elicitation:vC.nullish(),fs:wC.optional().default({readTextFile:!1,writeTextFile:!1}),nes:JC.nullish(),positionEncodings:D(fv).optional(),terminal:Ae().optional().default(!1)}),gP=g({_meta:k(d(),S()).nullish(),audio:Ae().optional().default(!1),embeddedContext:Ae().optional().default(!1),image:Ae().optional().default(!1)}),gv=H().int().gte(0).lte(65535),mP=g({_meta:k(d(),S()).nullish(),clientCapabilities:fP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:dv.nullish(),protocolVersion:gv}),Ri=g({end:$n,start:$n}),vP=g({message:d(),range:Ri,severity:DC,uri:d()}),yP=g({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:Ri.nullish()}),bP=g({_meta:k(d(),S()).nullish(),diagnostics:D(vP).nullish(),editHistory:D(FC).nullish(),openFiles:D(yP).nullish(),recentFiles:D(VC).nullish(),relatedSnippets:D(jC).nullish(),userActions:D(pP).nullish()}),wP=g({newText:d(),range:Ri}),SP=g({cursorPosition:$n.nullish(),edits:D(wP),id:d(),uri:d()}),_P=G([SP.and(g({kind:$("edit")})),hP.and(g({kind:$("jump")})),dP.and(g({kind:$("rename")})),QC.and(g({kind:$("searchAndReplace")}))]),kP=g({_meta:k(d(),S()).nullish(),content:d()}),EP=g({_meta:k(d(),S()).nullish()}),yr=G([H(),d()]).nullable();g({_meta:k(d(),S()).nullish(),requestId:yr});const xP=ka(["assistant","user"]),go=g({_meta:k(d(),S()).nullish(),audience:D(xP).nullish(),lastModified:d().nullish(),priority:H().nullish()}),AP=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),data:d(),mimeType:d()}),$P=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),IP=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),TP=g({_meta:k(d(),S()).nullish(),optionId:pv}),CP=G([g({outcome:$("cancelled")}),TP.and(g({outcome:$("selected")}))]),PP=g({_meta:k(d(),S()).nullish(),outcome:CP}),RP=g({_meta:k(d(),S()).nullish()}),DP=g({_meta:k(d(),S()).nullish()}),LP=g({currentValue:Ae()}),zP=d(),mv=d(),OP=G([$("mode"),$("model"),$("thought_level"),d()]),ph=d(),vv=g({_meta:k(d(),S()).nullish(),description:d().nullish(),name:d(),value:ph}),MP=g({_meta:k(d(),S()).nullish(),group:zP,name:d(),options:D(vv)}),NP=G([D(vv),D(MP)]),UP=g({currentValue:ph,options:NP}),Di=cl(G([UP.and(g({type:$("select")})),LP.and(g({type:$("boolean")}))]),g({_meta:k(d(),S()).nullish(),category:OP.nullish(),description:d().nullish(),id:mv,name:d()})),FP=g({_meta:k(d(),S()).nullish(),configOptions:D(Di)}),ZP=g({_meta:k(d(),S()).nullish()}),Q=d(),HP=g({_meta:k(d(),S()).nullish(),id:d(),sessionId:Q}),WP=g({_meta:k(d(),S()).nullish(),sessionId:Q}),VP=g({_meta:k(d(),S()).nullish(),sessionId:Q}),BP=g({_meta:k(d(),S()).nullish(),sessionId:Q}),yv=g({_meta:k(d(),S()).nullish(),args:D(d()).optional(),command:d(),cwd:d().nullish(),env:D(ov).optional(),outputByteLimit:H().nullish(),sessionId:Q}),GP=g({_meta:k(d(),S()).nullish(),sessionId:Q,uri:d()}),jP=g({_meta:k(d(),S()).nullish(),position:$n,sessionId:Q,uri:d(),version:H(),visibleRange:Ri}),qP=g({_meta:k(d(),S()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),YP=g({_meta:k(d(),S()).nullish(),sessionId:Q,uri:d()}),XP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(ul).optional(),sessionId:Q}),bv=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),KP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(ul),sessionId:Q}),wv=g({_meta:k(d(),S()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:Q}),JP=g({_meta:k(d(),S()).nullish(),id:d(),reason:GC.nullish(),sessionId:Q}),Sv=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),QP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(ul).optional(),sessionId:Q}),eR=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),tR=g({_meta:k(d(),S()).nullish(),nextCursor:d().nullish(),sessions:D(eR)}),nR=g({_meta:k(d(),S()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),rR=g({_meta:k(d(),S()).nullish()}),hl=d(),iR=g({_meta:k(d(),S()).nullish(),currentModeId:hl}),sR=g({_meta:k(d(),S()).nullish(),description:d().nullish(),id:hl,name:d()}),dl=g({_meta:k(d(),S()).nullish(),availableModes:D(sR),currentModeId:hl}),pl=g({_meta:k(d(),S()).nullish(),availableModels:D(RC),currentModelId:dh}),oR=g({_meta:k(d(),S()).nullish(),configOptions:D(Di).nullish(),models:pl.nullish(),modes:dl.nullish(),sessionId:Q}),aR=g({_meta:k(d(),S()).nullish(),configOptions:D(Di).nullish(),models:pl.nullish(),modes:dl.nullish()}),lR=g({_meta:k(d(),S()).nullish(),configOptions:D(Di).nullish(),models:pl.nullish(),modes:dl.nullish(),sessionId:Q}),cR=g({_meta:k(d(),S()).nullish(),configOptions:D(Di).nullish(),models:pl.nullish(),modes:dl.nullish()}),uR=g({_meta:k(d(),S()).nullish()}),hR=g({_meta:k(d(),S()).nullish(),additionalDirectories:RP.nullish(),close:DP.nullish(),fork:ZP.nullish(),list:rR.nullish(),resume:uR.nullish()}),dR=cl(G([g({type:$("boolean"),value:Ae()}),g({value:ph})]),g({_meta:k(d(),S()).nullish(),configId:mv,sessionId:Q})),pR=g({_meta:k(d(),S()).nullish(),configOptions:D(Di)}),fR=g({_meta:k(d(),S()).nullish(),modeId:hl,sessionId:Q}),gR=g({_meta:k(d(),S()).nullish()}),mR=g({_meta:k(d(),S()).nullish(),modelId:dh,sessionId:Q}),vR=g({_meta:k(d(),S()).nullish()}),yR=g({_meta:k(d(),S()).nullish(),sessionId:Q}),bR=G([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),wR=G([$("email"),$("uri"),$("date"),$("date-time")]),SR=g({default:d().nullish(),description:d().nullish(),enum:D(d()).nullish(),format:wR.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(sv).nullish(),pattern:d().nullish(),title:d().nullish()}),_R=g({_meta:k(d(),S()).nullish(),context:bP.nullish(),position:$n,selection:Ri.nullish(),sessionId:Q,triggerKind:eP,uri:d(),version:H()}),kR=g({_meta:k(d(),S()).nullish(),suggestions:D(_P)}),ER=g({_meta:k(d(),S()).nullish(),terminalId:d()}),xR=g({_meta:k(d(),S()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),_v=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),AR=g({_meta:k(d(),S()).nullish(),exitStatus:xR.nullish(),output:d(),truncated:Ae()}),$R=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),text:d()}),IR=g({range:Ri.nullish(),text:d()}),TR=g({_meta:k(d(),S()).nullish(),contentChanges:D(IR),sessionId:Q,uri:d(),version:H()});g({method:d(),params:G([WP,qP,TR,GP,YP,jP,HP,JP,lv]).nullish()});const CR=G([$("full"),$("incremental")]),PR=g({_meta:k(d(),S()).nullish(),syncKind:CR}),RR=g({_meta:k(d(),S()).nullish(),didChange:PR.nullish(),didClose:zC.nullish(),didFocus:OC.nullish(),didOpen:MC.nullish(),didSave:NC.nullish()}),DR=g({_meta:k(d(),S()).nullish(),document:RR.nullish()}),LR=g({_meta:k(d(),S()).nullish(),context:nP.nullish(),events:DR.nullish()}),zR=g({_meta:k(d(),S()).nullish(),auth:xC.optional().default({}),loadSession:Ae().optional().default(!1),mcpCapabilities:IC.optional().default({http:!1,sse:!1}),nes:LR.nullish(),positionEncoding:fv.nullish(),promptCapabilities:gP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:hR.optional().default({})}),OR=g({_meta:k(d(),S()).nullish(),agentCapabilities:zR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:dv.nullish(),authMethods:D(JT).optional().default([]),protocolVersion:gv}),MR=g({_meta:k(d(),S()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),NR=G([MR,tC]),UR=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),resource:NR}),fh=G([$R.and(g({type:$("text")})),$P.and(g({type:$("image")})),AP.and(g({type:$("audio")})),IP.and(g({type:$("resource_link")})),UR.and(g({type:$("resource")}))]),FR=g({_meta:k(d(),S()).nullish(),content:fh}),oc=g({_meta:k(d(),S()).nullish(),content:fh,messageId:d().nullish()}),ZR=g({_meta:k(d(),S()).nullish(),messageId:d().nullish(),prompt:D(fh),sessionId:Q}),HR=g({anyOf:D(sv)}),kv=G([FR.and(g({type:$("content")})),aC.and(g({type:$("diff")})),ER.and(g({type:$("terminal")}))]),Ev=d(),xv=g({_meta:k(d(),S()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),Av=G([$("pending"),$("in_progress"),$("completed"),$("failed")]),$v=G([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),WR=g({_meta:k(d(),S()).nullish(),content:D(kv).optional(),kind:$v.optional(),locations:D(xv).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:Av.optional(),title:d(),toolCallId:Ev}),Iv=g({_meta:k(d(),S()).nullish(),content:D(kv).nullish(),kind:$v.nullish(),locations:D(xv).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:Av.nullish(),title:d().nullish(),toolCallId:Ev}),Tv=g({_meta:k(d(),S()).nullish(),options:D(oP),sessionId:Q,toolCall:Iv}),VR=g({_meta:k(d(),S()).nullish(),hint:d()}),BR=VR,GR=g({_meta:k(d(),S()).nullish(),description:d(),input:BR.nullish(),name:d()}),jR=g({_meta:k(d(),S()).nullish(),availableCommands:D(GR)}),qR=g({enum:D(d()),type:gC}),YR=G([qR,HR]),XR=g({default:D(d()).nullish(),description:d().nullish(),items:YR,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),KR=G([SR.and(g({type:$("string")})),iP.and(g({type:$("number")})),SC.and(g({type:$("integer")})),nC.and(g({type:$("boolean")})),XR.and(g({type:$("array")}))]),JR=g({description:d().nullish(),properties:k(d(),KR).optional().default({}),required:D(d()).nullish(),title:d().nullish(),type:fC.optional().default("object")}),QR=g({requestedSchema:JR}),eD=cl(G([QR.and(g({mode:$("form")})),yC.and(g({mode:$("url")}))]),g({_meta:k(d(),S()).nullish(),message:d(),sessionId:Q})),tD=g({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),nD=g({_meta:k(d(),S()).nullish(),stopReason:bR,usage:tD.nullish(),userMessageId:d().nullish()});G([g({id:yr,result:G([OR,eC,$C,lR,aR,tR,oR,cR,iC,gR,pR,nD,vR,yR,kR,rC,uv])}),g({error:av,id:yr})]);const rD=g({_meta:k(d(),S()).nullish(),cost:sC.nullish(),size:H(),used:H()}),iD=G([oc.and(g({sessionUpdate:$("user_message_chunk")})),oc.and(g({sessionUpdate:$("agent_message_chunk")})),oc.and(g({sessionUpdate:$("agent_thought_chunk")})),WR.and(g({sessionUpdate:$("tool_call")})),Iv.and(g({sessionUpdate:$("tool_call_update")})),uP.and(g({sessionUpdate:$("plan")})),jR.and(g({sessionUpdate:$("available_commands_update")})),iR.and(g({sessionUpdate:$("current_mode_update")})),FP.and(g({sessionUpdate:$("config_option_update")})),nR.and(g({sessionUpdate:$("session_info_update")})),rD.and(g({sessionUpdate:$("usage_update")}))]),Cv=g({_meta:k(d(),S()).nullish(),sessionId:Q,update:iD});g({method:d(),params:G([Cv,dC,lv]).nullish()});const Pv=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),sD=g({_meta:k(d(),S()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),oD=g({name:d(),uri:d()}),aD=g({_meta:k(d(),S()).nullish(),repository:XC.nullish(),workspaceFolders:D(oD).nullish(),workspaceUri:d().nullish()});g({id:yr,method:d(),params:G([mP,QT,AC,rP,KP,kC,XP,QP,BP,fR,dR,ZR,mR,aD,_R,VP,cv]).nullish()});const Rv=g({_meta:k(d(),S()).nullish(),content:d(),path:d(),sessionId:Q});g({id:yr,method:d(),params:G([Rv,wv,Tv,yv,_v,Sv,Pv,bv,eD,cv]).nullish()});const lD=g({_meta:k(d(),S()).nullish()});G([g({id:yr,result:G([lD,kP,PP,oC,AR,EP,sD,_C,pC,uv])}),g({error:av,id:yr})]);var J;class cD{constructor(e,t){w(this,J);const r=e(this),i=async(o,a)=>{var c,u,h,p,v,m,x;switch(o){case Ft.fs_write_text_file:{const _=Rv.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,_)}case Ft.fs_read_text_file:{const _=wv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,_)}case Ft.session_request_permission:{const _=Tv.parse(a);return r.requestPermission(_)}case Ft.terminal_create:{const _=yv.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,_)}case Ft.terminal_output:{const _=_v.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,_)}case Ft.terminal_release:{const _=Sv.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,_))??{}}case Ft.terminal_wait_for_exit:{const _=Pv.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,_)}case Ft.terminal_kill:{const _=bv.parse(a);return await((x=r.killTerminal)==null?void 0:x.call(r,_))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw ke.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Ft.session_update:{const c=Cv.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw ke.methodNotFound(o)}};E(this,J,new uD(i,s,t))}async initialize(e){return await l(this,J).sendRequest(le.initialize,e)}async newSession(e){return await l(this,J).sendRequest(le.session_new,e)}async loadSession(e){return await l(this,J).sendRequest(le.session_load,e)??{}}async unstable_forkSession(e){return await l(this,J).sendRequest(le.session_fork,e)}async listSessions(e){return await l(this,J).sendRequest(le.session_list,e)}async unstable_resumeSession(e){return await l(this,J).sendRequest(le.session_resume,e)}async unstable_closeSession(e){return await l(this,J).sendRequest(le.session_close,e)}async setSessionMode(e){return await l(this,J).sendRequest(le.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await l(this,J).sendRequest(le.session_set_model,e)??{}}async setSessionConfigOption(e){return await l(this,J).sendRequest(le.session_set_config_option,e)}async authenticate(e){return await l(this,J).sendRequest(le.authenticate,e)??{}}async unstable_logout(e){return await l(this,J).sendRequest(le.logout,e)??{}}async prompt(e){return await l(this,J).sendRequest(le.session_prompt,e)}async cancel(e){return await l(this,J).sendNotification(le.session_cancel,e)}async unstable_startNes(e){return await l(this,J).sendRequest(le.nes_start,e)}async unstable_suggestNes(e){return await l(this,J).sendRequest(le.nes_suggest,e)}async unstable_closeNes(e){return await l(this,J).sendRequest(le.nes_close,e)??{}}async unstable_didOpenDocument(e){return await l(this,J).sendNotification(le.document_did_open,e)}async unstable_didChangeDocument(e){return await l(this,J).sendNotification(le.document_did_change,e)}async unstable_didCloseDocument(e){return await l(this,J).sendNotification(le.document_did_close,e)}async unstable_didSaveDocument(e){return await l(this,J).sendNotification(le.document_did_save,e)}async unstable_didFocusDocument(e){return await l(this,J).sendNotification(le.document_did_focus,e)}async unstable_acceptNes(e){return await l(this,J).sendNotification(le.nes_accept,e)}async unstable_rejectNes(e){return await l(this,J).sendNotification(le.nes_reject,e)}async extMethod(e,t){return await l(this,J).sendRequest(e,t)}async extNotification(e,t){return await l(this,J).sendNotification(e,t)}get signal(){return l(this,J).signal}get closed(){return l(this,J).closed}}J=new WeakMap;var pn,Pa,_s,ks,Qr,ei,Tt,Es,pe,Dv,Hc,Lv,zv,Ov,Mv,Wc,Ki;class uD{constructor(e,t,r){w(this,pe);w(this,pn,new Map);w(this,Pa,0);w(this,_s);w(this,ks);w(this,Qr);w(this,ei,Promise.resolve());w(this,Tt,new AbortController);w(this,Es);E(this,_s,e),E(this,ks,t),E(this,Qr,r),E(this,Es,new Promise(i=>{l(this,Tt).signal.addEventListener("abort",()=>i())})),f(this,pe,Dv).call(this)}get signal(){return l(this,Tt).signal}get closed(){return l(this,Es)}async sendRequest(e,t){f(this,pe,Wc).call(this);const r=od(this,Pa)._++,i=new Promise((s,o)=>{l(this,pn).set(r,{resolve:s,reject:o})});return await f(this,pe,Ki).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){f(this,pe,Wc).call(this),await f(this,pe,Ki).call(this,{jsonrpc:"2.0",method:e,params:t})}}pn=new WeakMap,Pa=new WeakMap,_s=new WeakMap,ks=new WeakMap,Qr=new WeakMap,ei=new WeakMap,Tt=new WeakMap,Es=new WeakMap,pe=new WeakSet,Dv=async function(){let e;try{const t=l(this,Qr).readable.getReader();try{for(;!l(this,Tt).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{f(this,pe,Lv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&f(this,pe,Ki).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{f(this,pe,Hc).call(this,e)}},Hc=function(e){if(l(this,Tt).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of l(this,pn).values())r.reject(t);l(this,pn).clear(),l(this,Tt).abort(t)},Lv=async function(e){if("method"in e&&"id"in e){const t=await f(this,pe,zv).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await f(this,pe,Ki).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await f(this,pe,Ov).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?f(this,pe,Mv).call(this,e):console.error("Invalid message",{message:e})},zv=async function(e,t){try{return{result:await l(this,_s).call(this,e,t)??null}}catch(r){if(r instanceof ke)return r.toResult();if(r instanceof Jp)return ke.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 ke.internalError(i?JSON.parse(i):{}).toResult()}catch{return ke.internalError({details:i}).toResult()}}},Ov=async function(e,t){try{return await l(this,ks).call(this,e,t),{result:null}}catch(r){if(r instanceof ke)return r.toResult();if(r instanceof Jp)return ke.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 ke.internalError(i?JSON.parse(i):{}).toResult()}catch{return ke.internalError({details:i}).toResult()}}},Mv=function(e){const t=l(this,pn).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 ke(r,i,s))}l(this,pn).delete(e.id)}else console.error("Got response to unknown request",e.id)},Wc=function(){if(l(this,Tt).signal.aborted)throw l(this,Tt).signal.reason??new Error("ACP connection closed")},Ki=async function(e){return E(this,ei,l(this,ei).then(async()=>{const t=l(this,Qr).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{f(this,pe,Hc).call(this,t)})),l(this,ei)};class ke 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 ke(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new ke(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new ke(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new ke(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new ke(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new ke(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new ke(-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 hD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,dD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,pD=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,fD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,gD="single_session",mD={name:"television-acp-client",version:"0.0.0"},Nv="agent:main:television",vD=fo(zt);var se,Vt,ti,Bt,tr,nr,rr,ir,fn,ni,Ct,Qe,Gt,sr,jt,gn,xs,qt,gt,Ra,Yt,I,Uv,Fv,Zv,Vc,Hv,Wv,Vv,Bv,Gv,jv,qv,Fn,Fr,Zr,Ve,Yv,Hr,Bc,Gc,na,Xv,Kv,As,$s,jc,Wr,Jv,Qv;class yD extends vD{constructor(t){super();w(this,I);w(this,se,wD());w(this,Vt,null);w(this,ti,null);w(this,Bt,null);w(this,tr,null);w(this,nr,null);w(this,rr,null);w(this,ir);w(this,fn,null);w(this,ni,1);w(this,Ct,null);w(this,Qe,null);w(this,Gt,!1);w(this,sr,!1);w(this,jt,null);w(this,gn,new Set);w(this,xs);w(this,qt);w(this,gt);w(this,Ra,t=>{f(this,I,Fv).call(this,t)});w(this,Yt,null);w(this,As,()=>{f(this,I,Wr).call(this,"ACP bridge websocket closed")});w(this,$s,()=>{f(this,I,Wr).call(this,"ACP bridge websocket error")});E(this,qt,t),E(this,gt,t.sessionMode??gD),E(this,ir,t.mappedSessionStore??bD()),E(this,xs,t.createSocket??(r=>new WebSocket(r)))}getState(){return l(this,se)}get messages(){return l(this,se).messageOrder.map(t=>l(this,se).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(l(this,se).lifecycle.status!=="ready"){f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}}),l(this,ti)??E(this,ti,f(this,I,Uv).call(this));try{await l(this,ti),await f(this,I,Vc).call(this)}catch(t){throw f(this,I,Wr).call(this,No(t)),t}}}dispose(){f(this,I,jc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),l(this,se).lifecycle.status!=="ready"||l(this,se).run.status==="running"||l(this,se).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");f(this,I,Fr).call(this,{id:f(this,I,Hr).call(this,"user"),kind:"user",text:r,status:"final"}),f(this,I,Ve).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await f(this,I,na).call(this).prompt({sessionId:f(this,I,Gc).call(this),prompt:[{type:"text",text:f(this,I,Yv).call(this,r)}]});f(this,I,Fn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),f(this,I,Ve).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw f(this,I,Qv).call(this)||(f(this,I,Fn).call(this,"error"),f(this,I,Ve).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:No(i)}})),i}}async cancel(){if(await this.connect(),!l(this,se).run.canCancel||l(this,se).run.status!=="running")throw new Error("No active cancellable run");f(this,I,Ve).call(this,{run:{...l(this,se).run,status:"cancelling"}}),await f(this,I,na).call(this).cancel({sessionId:f(this,I,Gc).call(this)})}setScreenContext(t){var s,o,a;if(t===null){if(l(this,Qe)===null)return;E(this,Qe,null),E(this,Gt,!1);return}const r={screenID:t.screenID,screenName:t.screenName};if(((s=l(this,Qe))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Qe))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Qe))==null?void 0:a.screenID)??null;if(E(this,Qe,r),l(this,gt)==="single_session"){(!l(this,fn)||i!==r.screenID)&&E(this,Gt,!0);return}l(this,fn)!==sf(l(this,gt),r.screenID,l(this,qt).clientGUID??"default-client")&&(E(this,Bt,null),E(this,tr,null),l(this,Vt)&&l(this,se).run.status==="idle"&&f(this,I,Vc).call(this).catch(c=>{f(this,I,Wr).call(this,No(c))}))}}se=new WeakMap,Vt=new WeakMap,ti=new WeakMap,Bt=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,fn=new WeakMap,ni=new WeakMap,Ct=new WeakMap,Qe=new WeakMap,Gt=new WeakMap,sr=new WeakMap,jt=new WeakMap,gn=new WeakMap,xs=new WeakMap,qt=new WeakMap,gt=new WeakMap,Ra=new WeakMap,Yt=new WeakMap,I=new WeakSet,Uv=async function(){try{f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await kD({serverURL:l(this,qt).serverURL,token:l(this,qt).token,createSocket:l(this,xs),onDisconnect:l(this,Ra)});E(this,rr,i),f(this,I,Ve).call(this,{bridge:i}),E(this,Yt,r),r.addEventListener("close",l(this,As)),r.addEventListener("error",l(this,$s)),E(this,Vt,new cD(s=>({connection:s,sessionUpdate:async o=>{await f(this,I,Wv).call(this,o)},requestPermission:async o=>f(this,I,Vv).call(this,o)}),t)),await l(this,Vt).initialize({protocolVersion:GT,clientCapabilities:{},clientInfo:mD})}catch(t){throw t}},Fv=function(t){f(this,I,Wr).call(this,No(t))},Zv=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})`)},Vc=async function(){const t=f(this,I,Kv).call(this);if(l(this,Bt)&&l(this,tr)===t){await l(this,Bt);return}E(this,tr,t),E(this,Bt,f(this,I,Hv).call(this,t)),await l(this,Bt)},Hv=async function(t){var c;const r=f(this,I,na).call(this);f(this,I,Jv).call(this);let i,s=!1,o=null;const a={cwd:f(this,I,Xv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(E(this,sr,!0),E(this,jt,null),((c=l(this,rr))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,ir).getActualSessionId(t);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(SD(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,l(this,ir).setActualSessionId(t,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,ir).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:t}),i=t,s=l(this,se).messageOrder.length>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{E(this,sr,!1),E(this,jt,null),f(this,I,Fn).call(this,"final")}f(this,I,Zv).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),E(this,nr,i),E(this,fn,t),s?(l(this,gn).add(t),l(this,gt)==="single_session"&&E(this,Gt,!1)):(l(this,gn).delete(t),E(this,Gt,l(this,gt)==="single_session")),f(this,I,Ve).call(this,{lifecycle:{status:"ready"}})},Wv=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&f(this,I,qv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&f(this,I,Bv).call(this,r.content.text);return;case"tool_call":f(this,I,Gv).call(this,r);return;case"tool_call_update":f(this,I,jv).call(this,r);return;case"agent_thought_chunk":return;default:return}},Vv=async function(t){return{outcome:{outcome:"cancelled"}}},Bv=function(t){E(this,jt,null);const r=_D(t);if(!r)return;if(!l(this,Ct)){const s={id:f(this,I,Hr).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};E(this,Ct,s.id),f(this,I,Fr).call(this,s);return}const i=l(this,se).messagesById[l(this,Ct)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");f(this,I,Zr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Gv=function(t){f(this,I,Fn).call(this,"final");const r=f(this,I,Bc).call(this,t.toolCallId),i=af("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??f(this,I,Hr).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){f(this,I,Zr).call(this,s);return}f(this,I,Fr).call(this,s)},jv=function(t){const r=f(this,I,Bc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=af(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??f(this,I,Hr).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){f(this,I,Zr).call(this,a);return}f(this,I,Fr).call(this,a)},qv=function(t){if(f(this,I,Fn).call(this,"final"),!t)return;const r=l(this,sr)?l(this,jt):null;if(!r){const s=of(t);if(!s)return;const o={id:f(this,I,Hr).call(this,"user"),kind:"user",text:s,status:"final"};f(this,I,Fr).call(this,o),l(this,sr)&&E(this,jt,o.id);return}const i=l(this,se).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");f(this,I,Zr).call(this,{...i,text:of(`${i.text}${t}`)})},Fn=function(t){if(!l(this,Ct))return;const r=l(this,se).messagesById[l(this,Ct)];(r==null?void 0:r.kind)==="assistant"&&f(this,I,Zr).call(this,{...r,status:t}),E(this,Ct,null)},Fr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,se).messagesById,[t.id]:t},messageOrder:[...l(this,se).messageOrder,t.id]})},Zr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,se).messagesById,[t.id]:t}})},Ve=function(t){const r={...l(this,se),...t};E(this,se,{...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 ne("change"))},Yv=function(t){const r=l(this,fn);return!l(this,Qe)||!r||!(l(this,gt)==="single_session"?l(this,Gt)||!l(this,gn).has(r):!l(this,gn).has(r))?t:(E(this,Gt,!1),l(this,gn).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${l(this,Qe).screenID}`,`screen_name: ${l(this,Qe).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
- `))},Hr=function(t){const r=`${t}-${l(this,ni)}`;return E(this,ni,l(this,ni)+1),r},Bc=function(t){for(const r of l(this,se).messageOrder){const i=l(this,se).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},Gc=function(){if(!l(this,nr))throw new Error("ACP session is not ready");return l(this,nr)},na=function(){if(!l(this,Vt))throw new Error("ACP connection is not ready");return l(this,Vt)},Xv=function(){var r;const t=(r=l(this,rr))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Kv=function(){var r;if(l(this,gt)==="single_session")return`${Nv}-${(l(this,qt).clientGUID??"default-client").toLowerCase()}`;const t=(r=l(this,Qe))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return sf(l(this,gt),t,l(this,qt).clientGUID??"default-client")},As=new WeakMap,$s=new WeakMap,jc=function(){E(this,Vt,null),E(this,ti,null),E(this,Bt,null),E(this,tr,null),E(this,nr,null),E(this,fn,null),E(this,rr,null),l(this,Yt)&&(l(this,Yt).removeEventListener("close",l(this,As)),l(this,Yt).removeEventListener("error",l(this,$s)),l(this,Yt).close(),E(this,Yt,null))},Wr=function(t){this.disposed||l(this,se).lifecycle.status==="disconnected"||(f(this,I,Fn).call(this,"error"),f(this,I,jc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Jv=function(){E(this,Ct,null),E(this,jt,null),E(this,ni,1),f(this,I,Ve).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},Qv=function(){return l(this,se).lifecycle.status==="disconnected"};function bD(){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 wD(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function SD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function sf(n,e,t){return n==="single_session"?`${Nv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function ey(n){return n.replace(/^(?:\s*\n)+/,"")}function of(n){let e=n;return e=e.replace(hD,""),e=e.replace(dD,""),e=e.replace(pD,""),e=ey(e),e}function _D(n){let e=n;return e=e.replace(fD,""),e=ey(e),e}function af(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function kD(n){const e=n.createSocket(AD(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"}))},v=_=>{const C=xD(_);if(!C)return;let U;try{U=JSON.parse(C)}catch(P){const B=P instanceof Error?P:new Error(String(P));i(B),u.error(B);return}switch(U.type){case"acp-bridge-status":if(U.status==="ready"){let P;try{P=ED(U)}catch(B){const L=B instanceof Error?B:new Error(String(B));t||i(L),u.error(L);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 C;if(h)return;h=!0;const _=new Error("ACP bridge websocket closed");t||i(_),(C=n.onDisconnect)==null||C.call(n,_),u.close()},x=()=>{var C;if(h)return;h=!0;const _=new Error("ACP bridge websocket error");t||i(_),(C=n.onDisconnect)==null||C.call(n,_),u.error(_)};e.addEventListener("open",p),e.addEventListener("message",v),e.addEventListener("close",m),e.addEventListener("error",x)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:e,metadata:c}}function ED(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 xD(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 AD(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 No(n){return n instanceof Error?n.message:String(n)}const lf="television.acpClientGUID",cf="television.acpMappedSessions",uf=1;var ri;class $D{constructor(){w(this,ri,new Map)}getActualSessionId(e){return l(this,ri).get(e)??null}setActualSessionId(e,t){l(this,ri).set(e,t)}clearActualSessionId(e){l(this,ri).delete(e)}}ri=new WeakMap;var ii,Is,tt,ra,ia,qc;class ID{constructor(e,t){w(this,tt);w(this,ii);w(this,Is);E(this,ii,e),E(this,Is,t)}getActualSessionId(e){const t=f(this,tt,ia).call(this)[f(this,tt,ra).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=f(this,tt,ia).call(this);r[f(this,tt,ra).call(this,e)]=t,f(this,tt,qc).call(this,r)}clearActualSessionId(e){const t=f(this,tt,ia).call(this);delete t[f(this,tt,ra).call(this,e)],f(this,tt,qc).call(this,t)}}ii=new WeakMap,Is=new WeakMap,tt=new WeakSet,ra=function(e){return JSON.stringify([l(this,Is),e])},ia=function(){const e=l(this,ii).getItem(cf);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!==uf?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},qc=function(e){const t={version:uf,entries:e};l(this,ii).setItem(cf,JSON.stringify(t))};function TD(){return typeof window>"u"?null:window.localStorage}function CD(n){const e=n.getItem(lf);if(e)return e;const t=sl().toLowerCase();return n.setItem(lf,t),t}const PD=4401;class Yc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class ty extends zt{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,"acpClient");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=dt(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.createClient=t.createClient??((i,s)=>new Yx(i,{token:s??void 0})),this.client=this.createClient(this.url,this.token);const r=t.mappedSessionStore??(t.acpStorage?new ID(t.acpStorage,this.url):new $D);this.acpClient=new yD({serverURL:this.url,token:this.token??"",...t.createACPSocket?{createSocket:t.createACPSocket}:t.createSocket?{createSocket:t.createSocket}:{},...t.clientGUID?{clientGUID:t.clientGUID}:{},mappedSessionStore:r})}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 ne("change"));const r=this.createSocket(RD(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new ne("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new ne("change")),o(p))},h=async()=>{try{const[{screens:p},v]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(m=>[m.id,structuredClone(m)])),this.views=v,this.dispatchEvent(new ne("change")),c()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const v=LD(p);v&&(this.applyServerEvent(v),this.dispatchEvent(new mm("server-event",{serverURL:this.url,event:v})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,DD(p)===PD){u(new Yc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new ne("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 ne("change"))}dispose(){this.disconnect(),this.acpClient.dispose()}getViewURL(t){const r=BT(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 ea("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new ea("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new ea("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!pm(r.layout,t.artifact.id)&&(r.layout=[...r.layout,dm(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=rm(r.layout,t.artifactID));break}}}}function RD(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 DD(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function LD(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}}const zD="Local";var Ts,Xc;class OD extends zt{constructor(t){super();w(this,Ts);b(this,"servers",new Map);b(this,"localServerURL");b(this,"clientGUID");b(this,"acpStorage");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 ne("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?dt(t.localServerURL):null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=t.acpStorage===void 0?TD():t.acpStorage;this.acpStorage=r,this.clientGUID=t.clientGUID??(r?CD(r):sl().toLowerCase()),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=dt(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new ne("change"))},o=c=>{this.dispatchEvent(new mm("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new ea("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 ne("change"))}remove(t){const r=dt(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.dispose(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(c=>c.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new ne("change"))}setActive(t){const r=this.localStore.get(),i=t?dt(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=t?dt(t):null;if(i){const a=this.localStore.get();a.servers.some(u=>dt(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:zD}]})}const s=this.localStore.get().servers;for(const a of s){const c=dt(a.url),u=i!==null&&c===i,h=f(this,Ts,Xc).call(this,{url:a.url,name:a.name,token:u?r??null:null});this.add(h),h.connect().catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=dt(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>dt(a.url)!==i),{url:i,name:r}]});const o=f(this,Ts,Xc).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}Ts=new WeakSet,Xc=function(t){return new ty({url:t.url,name:t.name,token:t.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var Cs;class MD extends zt{constructor(){super();w(this,Cs,t=>{const r=ND(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new vx("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,Cs))}dispose(){document.removeEventListener("keydown",l(this,Cs))}}Cs=new WeakMap;function ND(n){for(const[e,t]of Object.entries(Xx))if(UD(n,t.trigger))return e;return null}function UD(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 FD="serverURL",ZD="token",HD="mode",WD="electron";function ny(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(FD);return r?new URL(r).origin:new URL(e).origin}function hf(n=window.location.search){return new URLSearchParams(n).get(ZD)}function gh(n=window.location.search){return new URLSearchParams(n).get(HD)===WD}/**
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=(c=n.external.registry.get(h[0]))==null?void 0:c.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 Ym(n,e){var o,a,c;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,v={...p},m=h.ref;if(h.ref=null,m){r(m);const _=n.seen.get(m),C=_.schema;if(C.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(C)):Object.assign(p,C),Object.assign(p,v),u._zod.parent===m)for(const P in p)P==="$ref"||P==="allOf"||P in v||delete p[P];if(C.$ref&&_.def)for(const P in p)P==="$ref"||P==="allOf"||P in _.def&&JSON.stringify(p[P])===JSON.stringify(_.def[P])&&delete p[P]}const x=u._zod.parent;if(x&&x!==m){r(x);const _=n.seen.get(x);if(_!=null&&_.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const C in p)C==="$ref"||C==="allOf"||C in _.def&&JSON.stringify(p[C])===JSON.stringify(_.def[C])&&delete p[C]}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=((c=n.external)==null?void 0:c.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:_a(e,"input",n.processors),output:_a(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Me(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 Me(r.element,t);if(r.type==="set")return Me(r.valueType,t);if(r.type==="lazy")return Me(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 Me(r.innerType,t);if(r.type==="intersection")return Me(r.left,t)||Me(r.right,t);if(r.type==="record"||r.type==="map")return Me(r.keyType,t)||Me(r.valueType,t);if(r.type==="pipe")return Me(r.in,t)||Me(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Me(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Me(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Me(i,t))return!0;return!!(r.rest&&Me(r.rest,t))}return!1}const sI=(n,e={})=>t=>{const r=jm({...t,processors:e});return Se(n,r),qm(r,n),Ym(r,n)},_a=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=jm({...i??{},target:s,io:e,processors:t});return Se(n,o),qm(o,n),Ym(o,n)},oI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aI=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=oI[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const h=[...c];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}))])}},lI=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:a,multipleOf:c,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 c=="number"&&(i.multipleOf=c)},cI=(n,e,t,r)=>{t.type="boolean"},uI=(n,e,t,r)=>{t.not={}},hI=(n,e,t,r)=>{},dI=(n,e,t,r)=>{const i=n._zod.def,s=$m(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},pI=(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},fI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},gI=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},mI=(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=Se(s.element,e,{...r,path:[...r.path,"items"]})},vI=(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]=Se(o[h],e,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(h=>{const p=s.shape[h]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=Se(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},yI=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>Se(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},bI=(n,e,t,r)=>{const i=n._zod.def,s=Se(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Se(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=c},wI=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const h=Se(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Se(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Se(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)}},SI=(n,e,t,r)=>{const i=n._zod.def,s=Se(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"}]},_I=(n,e,t,r)=>{const i=n._zod.def;Se(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},kI=(n,e,t,r)=>{const i=n._zod.def;Se(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},EI=(n,e,t,r)=>{const i=n._zod.def;Se(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)))},xI=(n,e,t,r)=>{const i=n._zod.def;Se(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},AI=(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;Se(s,e,r);const o=e.seen.get(n);o.ref=s},$I=(n,e,t,r)=>{const i=n._zod.def;Se(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Xm=(n,e,t,r)=>{const i=n._zod.def;Se(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},II=A("ZodISODateTime",(n,e)=>{TA.init(n,e),me.init(n,e)});function TI(n){return z$(II,n)}const CI=A("ZodISODate",(n,e)=>{CA.init(n,e),me.init(n,e)});function PI(n){return O$(CI,n)}const RI=A("ZodISOTime",(n,e)=>{PA.init(n,e),me.init(n,e)});function DI(n){return M$(RI,n)}const LI=A("ZodISODuration",(n,e)=>{RA.init(n,e),me.init(n,e)});function zI(n){return N$(LI,n)}const Km=(n,e)=>{Pm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>_1(n,t)},flatten:{value:t=>S1(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Fc,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Fc,2)}},isEmpty:{get(){return n.issues.length===0}}})},Qp=A("ZodError",Km),ht=A("ZodError",Km,{Parent:Error}),OI=uh(ht),MI=hh(ht),NI=al(ht),UI=ll(ht),FI=x1(ht),ZI=A1(ht),HI=$1(ht),WI=I1(ht),VI=T1(ht),BI=C1(ht),GI=P1(ht),jI=R1(ht),ge=A("ZodType",(n,e)=>(fe.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:_a(n,"input"),output:_a(n,"output")}}),n.toJSONSchema=sI(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(Pn(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)=>Rn(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>OI(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>NI(n,t,r),n.parseAsync=async(t,r)=>MI(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>UI(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>FI(n,t,r),n.decode=(t,r)=>ZI(n,t,r),n.encodeAsync=async(t,r)=>HI(n,t,r),n.decodeAsync=async(t,r)=>WI(n,t,r),n.safeEncode=(t,r)=>VI(n,t,r),n.safeDecode=(t,r)=>BI(n,t,r),n.safeEncodeAsync=async(t,r)=>GI(n,t,r),n.safeDecodeAsync=async(t,r)=>jI(n,t,r),n.refine=(t,r)=>n.check(NT(t,r)),n.superRefine=t=>n.check(UT(t)),n.overwrite=t=>n.check(Ri(t)),n.optional=()=>nf(n),n.exactOptional=()=>xT(n),n.nullable=()=>rf(n),n.nullish=()=>nf(rf(n)),n.nonoptional=t=>PT(n,t),n.array=()=>D(n),n.or=t=>G([n,t]),n.and=t=>ul(n,t),n.transform=t=>sf(n,kT(t)),n.default=t=>IT(n,t),n.prefault=t=>CT(n,t),n.catch=t=>DT(n,t),n.pipe=t=>sf(n,t),n.readonly=()=>OT(n),n.describe=t=>{const r=n.clone();return Ki.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Ki.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Ki.get(n);const r=n.clone();return Ki.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Jm=A("_ZodString",(n,e)=>{dh.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>aI(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(V$(...r)),n.includes=(...r)=>n.check(j$(...r)),n.startsWith=(...r)=>n.check(q$(...r)),n.endsWith=(...r)=>n.check(Y$(...r)),n.min=(...r)=>n.check(Sa(...r)),n.max=(...r)=>n.check(Bm(...r)),n.length=(...r)=>n.check(Gm(...r)),n.nonempty=(...r)=>n.check(Sa(1,...r)),n.lowercase=r=>n.check(B$(r)),n.uppercase=r=>n.check(G$(r)),n.trim=()=>n.check(K$()),n.normalize=(...r)=>n.check(X$(...r)),n.toLowerCase=()=>n.check(J$()),n.toUpperCase=()=>n.check(Q$()),n.slugify=()=>n.check(eI())}),qI=A("ZodString",(n,e)=>{dh.init(n,e),Jm.init(n,e),n.email=t=>n.check(f$(YI,t)),n.url=t=>n.check(b$(XI,t)),n.jwt=t=>n.check(L$(hT,t)),n.emoji=t=>n.check(w$(KI,t)),n.guid=t=>n.check(Yp(ef,t)),n.uuid=t=>n.check(g$(Mo,t)),n.uuidv4=t=>n.check(m$(Mo,t)),n.uuidv6=t=>n.check(v$(Mo,t)),n.uuidv7=t=>n.check(y$(Mo,t)),n.nanoid=t=>n.check(S$(JI,t)),n.guid=t=>n.check(Yp(ef,t)),n.cuid=t=>n.check(_$(QI,t)),n.cuid2=t=>n.check(k$(eT,t)),n.ulid=t=>n.check(E$(tT,t)),n.base64=t=>n.check(P$(lT,t)),n.base64url=t=>n.check(R$(cT,t)),n.xid=t=>n.check(x$(nT,t)),n.ksuid=t=>n.check(A$(rT,t)),n.ipv4=t=>n.check($$(iT,t)),n.ipv6=t=>n.check(I$(sT,t)),n.cidrv4=t=>n.check(T$(oT,t)),n.cidrv6=t=>n.check(C$(aT,t)),n.e164=t=>n.check(D$(uT,t)),n.datetime=t=>n.check(TI(t)),n.date=t=>n.check(PI(t)),n.time=t=>n.check(DI(t)),n.duration=t=>n.check(zI(t))});function d(n){return p$(qI,n)}const me=A("ZodStringFormat",(n,e)=>{ue.init(n,e),Jm.init(n,e)}),YI=A("ZodEmail",(n,e)=>{wA.init(n,e),me.init(n,e)}),ef=A("ZodGUID",(n,e)=>{yA.init(n,e),me.init(n,e)}),Mo=A("ZodUUID",(n,e)=>{bA.init(n,e),me.init(n,e)}),XI=A("ZodURL",(n,e)=>{SA.init(n,e),me.init(n,e)}),KI=A("ZodEmoji",(n,e)=>{_A.init(n,e),me.init(n,e)}),JI=A("ZodNanoID",(n,e)=>{kA.init(n,e),me.init(n,e)}),QI=A("ZodCUID",(n,e)=>{EA.init(n,e),me.init(n,e)}),eT=A("ZodCUID2",(n,e)=>{xA.init(n,e),me.init(n,e)}),tT=A("ZodULID",(n,e)=>{AA.init(n,e),me.init(n,e)}),nT=A("ZodXID",(n,e)=>{$A.init(n,e),me.init(n,e)}),rT=A("ZodKSUID",(n,e)=>{IA.init(n,e),me.init(n,e)}),iT=A("ZodIPv4",(n,e)=>{DA.init(n,e),me.init(n,e)}),sT=A("ZodIPv6",(n,e)=>{LA.init(n,e),me.init(n,e)}),oT=A("ZodCIDRv4",(n,e)=>{zA.init(n,e),me.init(n,e)}),aT=A("ZodCIDRv6",(n,e)=>{OA.init(n,e),me.init(n,e)}),lT=A("ZodBase64",(n,e)=>{MA.init(n,e),me.init(n,e)}),cT=A("ZodBase64URL",(n,e)=>{UA.init(n,e),me.init(n,e)}),uT=A("ZodE164",(n,e)=>{FA.init(n,e),me.init(n,e)}),hT=A("ZodJWT",(n,e)=>{HA.init(n,e),me.init(n,e)}),Qm=A("ZodNumber",(n,e)=>{Zm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>lI(n,r,i),n.gt=(r,i)=>n.check(Kp(r,i)),n.gte=(r,i)=>n.check(sc(r,i)),n.min=(r,i)=>n.check(sc(r,i)),n.lt=(r,i)=>n.check(Xp(r,i)),n.lte=(r,i)=>n.check(ic(r,i)),n.max=(r,i)=>n.check(ic(r,i)),n.int=r=>n.check(tf(r)),n.safe=r=>n.check(tf(r)),n.positive=r=>n.check(Kp(0,r)),n.nonnegative=r=>n.check(sc(0,r)),n.negative=r=>n.check(Xp(0,r)),n.nonpositive=r=>n.check(ic(0,r)),n.multipleOf=(r,i)=>n.check(Jp(r,i)),n.step=(r,i)=>n.check(Jp(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 H(n){return U$(Qm,n)}const dT=A("ZodNumberFormat",(n,e)=>{WA.init(n,e),Qm.init(n,e)});function tf(n){return F$(dT,n)}const pT=A("ZodBoolean",(n,e)=>{VA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>cI(n,t,r)});function $e(n){return Z$(pT,n)}const fT=A("ZodUnknown",(n,e)=>{BA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>hI()});function S(){return H$(fT)}const gT=A("ZodNever",(n,e)=>{GA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>uI(n,t,r)});function mT(n){return W$(gT,n)}const vT=A("ZodArray",(n,e)=>{jA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>mI(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(Sa(t,r)),n.nonempty=t=>n.check(Sa(1,t)),n.max=(t,r)=>n.check(Bm(t,r)),n.length=(t,r)=>n.check(Gm(t,r)),n.unwrap=()=>n.element});function D(n,e){return tI(vT,n,e)}const ev=A("ZodObject",(n,e)=>{YA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>vI(n,t,r,i),ie(n,"shape",()=>e.shape),n.keyof=()=>ka(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:mT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>m1(n,t),n.safeExtend=t=>v1(n,t),n.merge=t=>y1(n,t),n.pick=t=>f1(n,t),n.omit=t=>g1(n,t),n.partial=(...t)=>b1(nv,n,t[0]),n.required=(...t)=>w1(rv,n,t[0])});function tv(n,e){const t={type:"object",shape:n??{},...O(e)};return new ev(t)}function g(n,e){return new ev({type:"object",shape:n,catchall:S(),...O(e)})}const yT=A("ZodUnion",(n,e)=>{XA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>yI(n,t,r,i),n.options=e.options});function G(n,e){return new yT({type:"union",options:n,...O(e)})}const bT=A("ZodIntersection",(n,e)=>{KA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>bI(n,t,r,i)});function ul(n,e){return new bT({type:"intersection",left:n,right:e})}const wT=A("ZodRecord",(n,e)=>{JA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>wI(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function k(n,e,t){return new wT({type:"record",keyType:n,valueType:e,...O(t)})}const Hc=A("ZodEnum",(n,e)=>{QA.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(r,i,s)=>dI(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 Hc({...e,checks:[],...O(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 Hc({...e,checks:[],...O(i),entries:s})}});function ka(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Hc({type:"enum",entries:t,...O(e)})}const ST=A("ZodLiteral",(n,e)=>{e$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>pI(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 ST({type:"literal",values:Array.isArray(n)?n:[n],...O(e)})}const _T=A("ZodTransform",(n,e)=>{t$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>gI(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new xm(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(hs(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(hs(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function kT(n){return new _T({type:"transform",transform:n})}const nv=A("ZodOptional",(n,e)=>{Vm.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Xm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function nf(n){return new nv({type:"optional",innerType:n})}const ET=A("ZodExactOptional",(n,e)=>{n$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Xm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function xT(n){return new ET({type:"optional",innerType:n})}const AT=A("ZodNullable",(n,e)=>{r$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>SI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function rf(n){return new AT({type:"nullable",innerType:n})}const $T=A("ZodDefault",(n,e)=>{i$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>kI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function IT(n,e){return new $T({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Tm(e)}})}const TT=A("ZodPrefault",(n,e)=>{s$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>EI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function CT(n,e){return new TT({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Tm(e)}})}const rv=A("ZodNonOptional",(n,e)=>{o$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>_I(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function PT(n,e){return new rv({type:"nonoptional",innerType:n,...O(e)})}const RT=A("ZodCatch",(n,e)=>{a$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>xI(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function DT(n,e){return new RT({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const LT=A("ZodPipe",(n,e)=>{l$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>AI(n,t,r,i),n.in=e.in,n.out=e.out});function sf(n,e){return new LT({type:"pipe",in:n,out:e})}const zT=A("ZodReadonly",(n,e)=>{c$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>$I(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function OT(n){return new zT({type:"readonly",innerType:n})}const MT=A("ZodCustom",(n,e)=>{u$.init(n,e),ge.init(n,e),n._zod.processJSONSchema=(t,r,i)=>fI(n,t)});function NT(n,e={}){return nI(MT,n,e)}function UT(n){return rI(n)}const oc={custom:"custom"},FT=["text/markdown","text/html"],ZT=["committed","pending"];function HT(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}tv({id:d().min(1),type:ka(FT),title:d(),status:ka(ZT),externalFilePath:d().optional(),externalURL:d().optional()}).superRefine((n,e)=>{n.externalFilePath!==void 0&&n.externalURL!==void 0&&e.addIssue({code:oc.custom,message:"externalFilePath and externalURL are mutually exclusive",path:["externalURL"]}),n.externalURL!==void 0&&(HT(n.externalURL)||e.addIssue({code:oc.custom,message:"externalURL must be an http(s) URL",path:["externalURL"]}),n.status!=="committed"&&e.addIssue({code:oc.custom,message:"URL-backed artifacts must have status committed",path:["status"]}))});tv({name:d().min(1),description:d(),accepts:D(d().min(1)).min(1)});function iv(n){return typeof n=="object"&&n!==null}function WT(n){return!iv(n)||n.type!=="ready"?!1:!("id"in n)}function VT(n){return!(!iv(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function BT(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 GT(n,e){let t=null;for(const r of n.accepts){const i=BT(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function jT(n,e){let t=-1,r=null;for(const i of e){const s=GT(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const le={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"},qT=1,YT=g({_meta:k(d(),S()).nullish(),terminal:$e().optional().default(!1)}),XT=g({_meta:k(d(),S()).nullish(),label:d().nullish(),name:d(),optional:$e().optional().default(!1),secret:$e().optional().default(!0)}),KT=g({_meta:k(d(),S()).nullish(),description:d().nullish(),id:d(),name:d()}),JT=g({_meta:k(d(),S()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:D(XT)}),QT=g({_meta:k(d(),S()).nullish(),args:D(d()).optional(),description:d().nullish(),env:k(d(),d()).optional(),id:d(),name:d()}),eC=G([JT.and(g({type:$("env_var")})),QT.and(g({type:$("terminal")})),KT]),tC=g({_meta:k(d(),S()).nullish(),methodId:d()}),nC=g({_meta:k(d(),S()).nullish()}),rC=g({_meta:k(d(),S()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),iC=g({default:$e().nullish(),description:d().nullish(),title:d().nullish()}),sC=g({_meta:k(d(),S()).nullish()}),oC=g({_meta:k(d(),S()).nullish()}),aC=g({amount:H(),currency:d()}),lC=g({_meta:k(d(),S()).nullish(),terminalId:d()}),cC=g({_meta:k(d(),S()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),uC=G([d(),H(),H(),$e(),D(d())]),hC=g({content:k(d(),uC).nullish()}),dC=G([hC.and(g({action:$("accept")})),g({action:$("decline")}),g({action:$("cancel")})]),pC=g({_meta:k(d(),S()).nullish()}),sv=d(),fC=g({_meta:k(d(),S()).nullish(),elicitationId:sv}),gC=g({_meta:k(d(),S()).nullish(),action:dC}),mC=$("object"),vC=$("string"),yC=g({_meta:k(d(),S()).nullish()}),bC=g({_meta:k(d(),S()).nullish(),form:pC.nullish(),url:yC.nullish()}),wC=g({elicitationId:sv,url:d().url()}),ov=g({const:d(),title:d()}),av=g({_meta:k(d(),S()).nullish(),name:d(),value:d()}),SC=G([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),lv=g({code:SC,data:S().optional(),message:d()}),cv=S(),uv=S(),hv=S(),_C=g({_meta:k(d(),S()).nullish(),readTextFile:$e().optional().default(!1),writeTextFile:$e().optional().default(!1)}),dv=g({_meta:k(d(),S()).nullish(),name:d(),value:d()}),pv=g({_meta:k(d(),S()).nullish(),name:d(),title:d().nullish(),version:d()}),kC=g({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),EC=g({_meta:k(d(),S()).nullish()}),xC=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),AC=g({_meta:k(d(),S()).nullish()}),$C=g({_meta:k(d(),S()).nullish(),logout:AC.nullish()}),IC=g({_meta:k(d(),S()).nullish()}),TC=g({_meta:k(d(),S()).nullish()}),CC=g({_meta:k(d(),S()).nullish(),http:$e().optional().default(!1),sse:$e().optional().default(!1)}),PC=g({_meta:k(d(),S()).nullish(),headers:D(dv),name:d(),url:d()}),RC=g({_meta:k(d(),S()).nullish(),headers:D(dv),name:d(),url:d()}),DC=g({_meta:k(d(),S()).nullish(),args:D(d()),command:d(),env:D(av),name:d()}),hl=G([PC.and(g({type:$("http")})),RC.and(g({type:$("sse")})),DC]),ph=d(),LC=g({_meta:k(d(),S()).nullish(),description:d().nullish(),modelId:ph,name:d()}),zC=G([$("error"),$("warning"),$("information"),$("hint")]),OC=g({_meta:k(d(),S()).nullish()}),MC=g({_meta:k(d(),S()).nullish()}),NC=g({_meta:k(d(),S()).nullish()}),UC=g({_meta:k(d(),S()).nullish()}),FC=g({_meta:k(d(),S()).nullish()}),ZC=g({_meta:k(d(),S()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),HC=g({diff:d(),uri:d()}),WC=g({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),VC=g({_meta:k(d(),S()).nullish()}),BC=g({_meta:k(d(),S()).nullish()}),GC=g({languageId:d(),text:d(),uri:d()}),jC=g({_meta:k(d(),S()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),qC=G([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),YC=g({excerpts:D(WC),uri:d()}),XC=g({_meta:k(d(),S()).nullish()}),KC=g({_meta:k(d(),S()).nullish()}),JC=g({name:d(),owner:d(),remoteUrl:d()}),QC=g({_meta:k(d(),S()).nullish()}),eP=g({_meta:k(d(),S()).nullish(),jump:VC.nullish(),rename:KC.nullish(),searchAndReplace:QC.nullish()}),tP=g({id:d(),isRegex:$e().nullish(),replace:d(),search:d(),uri:d()}),nP=G([$("automatic"),$("diagnostic"),$("manual")]),rP=g({_meta:k(d(),S()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),iP=g({_meta:k(d(),S()).nullish(),diagnostics:OC.nullish(),editHistory:ZC.nullish(),openFiles:BC.nullish(),recentFiles:jC.nullish(),relatedSnippets:XC.nullish(),userActions:rP.nullish()}),sP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(hl)}),oP=g({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),fv=d(),aP=G([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),lP=g({_meta:k(d(),S()).nullish(),kind:aP,name:d(),optionId:fv}),cP=G([$("high"),$("medium"),$("low")]),uP=G([$("pending"),$("in_progress"),$("completed")]),hP=g({_meta:k(d(),S()).nullish(),content:d(),priority:cP,status:uP}),dP=g({_meta:k(d(),S()).nullish(),entries:D(hP)}),$n=g({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),pP=g({id:d(),position:$n,uri:d()}),fP=g({id:d(),newName:d(),position:$n,uri:d()}),gP=g({action:d(),position:$n,timestampMs:H(),uri:d()}),gv=G([$("utf-16"),$("utf-32"),$("utf-8")]),mP=g({_meta:k(d(),S()).nullish(),auth:YT.optional().default({terminal:!1}),elicitation:bC.nullish(),fs:_C.optional().default({readTextFile:!1,writeTextFile:!1}),nes:eP.nullish(),positionEncodings:D(gv).optional(),terminal:$e().optional().default(!1)}),vP=g({_meta:k(d(),S()).nullish(),audio:$e().optional().default(!1),embeddedContext:$e().optional().default(!1),image:$e().optional().default(!1)}),mv=H().int().gte(0).lte(65535),yP=g({_meta:k(d(),S()).nullish(),clientCapabilities:mP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:pv.nullish(),protocolVersion:mv}),Di=g({end:$n,start:$n}),bP=g({message:d(),range:Di,severity:zC,uri:d()}),wP=g({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:Di.nullish()}),SP=g({_meta:k(d(),S()).nullish(),diagnostics:D(bP).nullish(),editHistory:D(HC).nullish(),openFiles:D(wP).nullish(),recentFiles:D(GC).nullish(),relatedSnippets:D(YC).nullish(),userActions:D(gP).nullish()}),_P=g({newText:d(),range:Di}),kP=g({cursorPosition:$n.nullish(),edits:D(_P),id:d(),uri:d()}),EP=G([kP.and(g({kind:$("edit")})),pP.and(g({kind:$("jump")})),fP.and(g({kind:$("rename")})),tP.and(g({kind:$("searchAndReplace")}))]),xP=g({_meta:k(d(),S()).nullish(),content:d()}),AP=g({_meta:k(d(),S()).nullish()}),yr=G([H(),d()]).nullable();g({_meta:k(d(),S()).nullish(),requestId:yr});const $P=ka(["assistant","user"]),go=g({_meta:k(d(),S()).nullish(),audience:D($P).nullish(),lastModified:d().nullish(),priority:H().nullish()}),IP=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),data:d(),mimeType:d()}),TP=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),CP=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),PP=g({_meta:k(d(),S()).nullish(),optionId:fv}),RP=G([g({outcome:$("cancelled")}),PP.and(g({outcome:$("selected")}))]),DP=g({_meta:k(d(),S()).nullish(),outcome:RP}),LP=g({_meta:k(d(),S()).nullish()}),zP=g({_meta:k(d(),S()).nullish()}),OP=g({currentValue:$e()}),MP=d(),vv=d(),NP=G([$("mode"),$("model"),$("thought_level"),d()]),fh=d(),yv=g({_meta:k(d(),S()).nullish(),description:d().nullish(),name:d(),value:fh}),UP=g({_meta:k(d(),S()).nullish(),group:MP,name:d(),options:D(yv)}),FP=G([D(yv),D(UP)]),ZP=g({currentValue:fh,options:FP}),Li=ul(G([ZP.and(g({type:$("select")})),OP.and(g({type:$("boolean")}))]),g({_meta:k(d(),S()).nullish(),category:NP.nullish(),description:d().nullish(),id:vv,name:d()})),HP=g({_meta:k(d(),S()).nullish(),configOptions:D(Li)}),WP=g({_meta:k(d(),S()).nullish()}),Q=d(),VP=g({_meta:k(d(),S()).nullish(),id:d(),sessionId:Q}),BP=g({_meta:k(d(),S()).nullish(),sessionId:Q}),GP=g({_meta:k(d(),S()).nullish(),sessionId:Q}),jP=g({_meta:k(d(),S()).nullish(),sessionId:Q}),bv=g({_meta:k(d(),S()).nullish(),args:D(d()).optional(),command:d(),cwd:d().nullish(),env:D(av).optional(),outputByteLimit:H().nullish(),sessionId:Q}),qP=g({_meta:k(d(),S()).nullish(),sessionId:Q,uri:d()}),YP=g({_meta:k(d(),S()).nullish(),position:$n,sessionId:Q,uri:d(),version:H(),visibleRange:Di}),XP=g({_meta:k(d(),S()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),KP=g({_meta:k(d(),S()).nullish(),sessionId:Q,uri:d()}),JP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(hl).optional(),sessionId:Q}),wv=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),QP=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(hl),sessionId:Q}),Sv=g({_meta:k(d(),S()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:Q}),eR=g({_meta:k(d(),S()).nullish(),id:d(),reason:qC.nullish(),sessionId:Q}),_v=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),tR=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(hl).optional(),sessionId:Q}),nR=g({_meta:k(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),rR=g({_meta:k(d(),S()).nullish(),nextCursor:d().nullish(),sessions:D(nR)}),iR=g({_meta:k(d(),S()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),sR=g({_meta:k(d(),S()).nullish()}),dl=d(),oR=g({_meta:k(d(),S()).nullish(),currentModeId:dl}),aR=g({_meta:k(d(),S()).nullish(),description:d().nullish(),id:dl,name:d()}),pl=g({_meta:k(d(),S()).nullish(),availableModes:D(aR),currentModeId:dl}),fl=g({_meta:k(d(),S()).nullish(),availableModels:D(LC),currentModelId:ph}),lR=g({_meta:k(d(),S()).nullish(),configOptions:D(Li).nullish(),models:fl.nullish(),modes:pl.nullish(),sessionId:Q}),cR=g({_meta:k(d(),S()).nullish(),configOptions:D(Li).nullish(),models:fl.nullish(),modes:pl.nullish()}),uR=g({_meta:k(d(),S()).nullish(),configOptions:D(Li).nullish(),models:fl.nullish(),modes:pl.nullish(),sessionId:Q}),hR=g({_meta:k(d(),S()).nullish(),configOptions:D(Li).nullish(),models:fl.nullish(),modes:pl.nullish()}),dR=g({_meta:k(d(),S()).nullish()}),pR=g({_meta:k(d(),S()).nullish(),additionalDirectories:LP.nullish(),close:zP.nullish(),fork:WP.nullish(),list:sR.nullish(),resume:dR.nullish()}),fR=ul(G([g({type:$("boolean"),value:$e()}),g({value:fh})]),g({_meta:k(d(),S()).nullish(),configId:vv,sessionId:Q})),gR=g({_meta:k(d(),S()).nullish(),configOptions:D(Li)}),mR=g({_meta:k(d(),S()).nullish(),modeId:dl,sessionId:Q}),vR=g({_meta:k(d(),S()).nullish()}),yR=g({_meta:k(d(),S()).nullish(),modelId:ph,sessionId:Q}),bR=g({_meta:k(d(),S()).nullish()}),wR=g({_meta:k(d(),S()).nullish(),sessionId:Q}),SR=G([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),_R=G([$("email"),$("uri"),$("date"),$("date-time")]),kR=g({default:d().nullish(),description:d().nullish(),enum:D(d()).nullish(),format:_R.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(ov).nullish(),pattern:d().nullish(),title:d().nullish()}),ER=g({_meta:k(d(),S()).nullish(),context:SP.nullish(),position:$n,selection:Di.nullish(),sessionId:Q,triggerKind:nP,uri:d(),version:H()}),xR=g({_meta:k(d(),S()).nullish(),suggestions:D(EP)}),AR=g({_meta:k(d(),S()).nullish(),terminalId:d()}),$R=g({_meta:k(d(),S()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),kv=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),IR=g({_meta:k(d(),S()).nullish(),exitStatus:$R.nullish(),output:d(),truncated:$e()}),TR=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),text:d()}),CR=g({range:Di.nullish(),text:d()}),PR=g({_meta:k(d(),S()).nullish(),contentChanges:D(CR),sessionId:Q,uri:d(),version:H()});g({method:d(),params:G([BP,XP,PR,qP,KP,YP,VP,eR,cv]).nullish()});const RR=G([$("full"),$("incremental")]),DR=g({_meta:k(d(),S()).nullish(),syncKind:RR}),LR=g({_meta:k(d(),S()).nullish(),didChange:DR.nullish(),didClose:MC.nullish(),didFocus:NC.nullish(),didOpen:UC.nullish(),didSave:FC.nullish()}),zR=g({_meta:k(d(),S()).nullish(),document:LR.nullish()}),OR=g({_meta:k(d(),S()).nullish(),context:iP.nullish(),events:zR.nullish()}),MR=g({_meta:k(d(),S()).nullish(),auth:$C.optional().default({}),loadSession:$e().optional().default(!1),mcpCapabilities:CC.optional().default({http:!1,sse:!1}),nes:OR.nullish(),positionEncoding:gv.nullish(),promptCapabilities:vP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:pR.optional().default({})}),NR=g({_meta:k(d(),S()).nullish(),agentCapabilities:MR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:pv.nullish(),authMethods:D(eC).optional().default([]),protocolVersion:mv}),UR=g({_meta:k(d(),S()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),FR=G([UR,rC]),ZR=g({_meta:k(d(),S()).nullish(),annotations:go.nullish(),resource:FR}),gh=G([TR.and(g({type:$("text")})),TP.and(g({type:$("image")})),IP.and(g({type:$("audio")})),CP.and(g({type:$("resource_link")})),ZR.and(g({type:$("resource")}))]),HR=g({_meta:k(d(),S()).nullish(),content:gh}),ac=g({_meta:k(d(),S()).nullish(),content:gh,messageId:d().nullish()}),WR=g({_meta:k(d(),S()).nullish(),messageId:d().nullish(),prompt:D(gh),sessionId:Q}),VR=g({anyOf:D(ov)}),Ev=G([HR.and(g({type:$("content")})),cC.and(g({type:$("diff")})),AR.and(g({type:$("terminal")}))]),xv=d(),Av=g({_meta:k(d(),S()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),$v=G([$("pending"),$("in_progress"),$("completed"),$("failed")]),Iv=G([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),BR=g({_meta:k(d(),S()).nullish(),content:D(Ev).optional(),kind:Iv.optional(),locations:D(Av).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:$v.optional(),title:d(),toolCallId:xv}),Tv=g({_meta:k(d(),S()).nullish(),content:D(Ev).nullish(),kind:Iv.nullish(),locations:D(Av).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:$v.nullish(),title:d().nullish(),toolCallId:xv}),Cv=g({_meta:k(d(),S()).nullish(),options:D(lP),sessionId:Q,toolCall:Tv}),GR=g({_meta:k(d(),S()).nullish(),hint:d()}),jR=GR,qR=g({_meta:k(d(),S()).nullish(),description:d(),input:jR.nullish(),name:d()}),YR=g({_meta:k(d(),S()).nullish(),availableCommands:D(qR)}),XR=g({enum:D(d()),type:vC}),KR=G([XR,VR]),JR=g({default:D(d()).nullish(),description:d().nullish(),items:KR,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),QR=G([kR.and(g({type:$("string")})),oP.and(g({type:$("number")})),kC.and(g({type:$("integer")})),iC.and(g({type:$("boolean")})),JR.and(g({type:$("array")}))]),eD=g({description:d().nullish(),properties:k(d(),QR).optional().default({}),required:D(d()).nullish(),title:d().nullish(),type:mC.optional().default("object")}),tD=g({requestedSchema:eD}),nD=ul(G([tD.and(g({mode:$("form")})),wC.and(g({mode:$("url")}))]),g({_meta:k(d(),S()).nullish(),message:d(),sessionId:Q})),rD=g({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),iD=g({_meta:k(d(),S()).nullish(),stopReason:SR,usage:rD.nullish(),userMessageId:d().nullish()});G([g({id:yr,result:G([NR,nC,TC,uR,cR,rR,lR,hR,oC,vR,gR,iD,bR,wR,xR,sC,hv])}),g({error:lv,id:yr})]);const sD=g({_meta:k(d(),S()).nullish(),cost:aC.nullish(),size:H(),used:H()}),oD=G([ac.and(g({sessionUpdate:$("user_message_chunk")})),ac.and(g({sessionUpdate:$("agent_message_chunk")})),ac.and(g({sessionUpdate:$("agent_thought_chunk")})),BR.and(g({sessionUpdate:$("tool_call")})),Tv.and(g({sessionUpdate:$("tool_call_update")})),dP.and(g({sessionUpdate:$("plan")})),YR.and(g({sessionUpdate:$("available_commands_update")})),oR.and(g({sessionUpdate:$("current_mode_update")})),HP.and(g({sessionUpdate:$("config_option_update")})),iR.and(g({sessionUpdate:$("session_info_update")})),sD.and(g({sessionUpdate:$("usage_update")}))]),Pv=g({_meta:k(d(),S()).nullish(),sessionId:Q,update:oD});g({method:d(),params:G([Pv,fC,cv]).nullish()});const Rv=g({_meta:k(d(),S()).nullish(),sessionId:Q,terminalId:d()}),aD=g({_meta:k(d(),S()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),lD=g({name:d(),uri:d()}),cD=g({_meta:k(d(),S()).nullish(),repository:JC.nullish(),workspaceFolders:D(lD).nullish(),workspaceUri:d().nullish()});g({id:yr,method:d(),params:G([yP,tC,IC,sP,QP,xC,JP,tR,jP,mR,fR,WR,yR,cD,ER,GP,uv]).nullish()});const Dv=g({_meta:k(d(),S()).nullish(),content:d(),path:d(),sessionId:Q});g({id:yr,method:d(),params:G([Dv,Sv,Cv,bv,kv,_v,Rv,wv,nD,uv]).nullish()});const uD=g({_meta:k(d(),S()).nullish()});G([g({id:yr,result:G([uD,xP,DP,lC,IR,AP,aD,EC,gC,hv])}),g({error:lv,id:yr})]);var J;class hD{constructor(e,t){w(this,J);const r=e(this),i=async(o,a)=>{var c,u,h,p,v,m,x;switch(o){case Ft.fs_write_text_file:{const _=Dv.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,_)}case Ft.fs_read_text_file:{const _=Sv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,_)}case Ft.session_request_permission:{const _=Cv.parse(a);return r.requestPermission(_)}case Ft.terminal_create:{const _=bv.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,_)}case Ft.terminal_output:{const _=kv.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,_)}case Ft.terminal_release:{const _=_v.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,_))??{}}case Ft.terminal_wait_for_exit:{const _=Rv.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,_)}case Ft.terminal_kill:{const _=wv.parse(a);return await((x=r.killTerminal)==null?void 0:x.call(r,_))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ee.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Ft.session_update:{const c=Pv.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ee.methodNotFound(o)}};E(this,J,new dD(i,s,t))}async initialize(e){return await l(this,J).sendRequest(le.initialize,e)}async newSession(e){return await l(this,J).sendRequest(le.session_new,e)}async loadSession(e){return await l(this,J).sendRequest(le.session_load,e)??{}}async unstable_forkSession(e){return await l(this,J).sendRequest(le.session_fork,e)}async listSessions(e){return await l(this,J).sendRequest(le.session_list,e)}async unstable_resumeSession(e){return await l(this,J).sendRequest(le.session_resume,e)}async unstable_closeSession(e){return await l(this,J).sendRequest(le.session_close,e)}async setSessionMode(e){return await l(this,J).sendRequest(le.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await l(this,J).sendRequest(le.session_set_model,e)??{}}async setSessionConfigOption(e){return await l(this,J).sendRequest(le.session_set_config_option,e)}async authenticate(e){return await l(this,J).sendRequest(le.authenticate,e)??{}}async unstable_logout(e){return await l(this,J).sendRequest(le.logout,e)??{}}async prompt(e){return await l(this,J).sendRequest(le.session_prompt,e)}async cancel(e){return await l(this,J).sendNotification(le.session_cancel,e)}async unstable_startNes(e){return await l(this,J).sendRequest(le.nes_start,e)}async unstable_suggestNes(e){return await l(this,J).sendRequest(le.nes_suggest,e)}async unstable_closeNes(e){return await l(this,J).sendRequest(le.nes_close,e)??{}}async unstable_didOpenDocument(e){return await l(this,J).sendNotification(le.document_did_open,e)}async unstable_didChangeDocument(e){return await l(this,J).sendNotification(le.document_did_change,e)}async unstable_didCloseDocument(e){return await l(this,J).sendNotification(le.document_did_close,e)}async unstable_didSaveDocument(e){return await l(this,J).sendNotification(le.document_did_save,e)}async unstable_didFocusDocument(e){return await l(this,J).sendNotification(le.document_did_focus,e)}async unstable_acceptNes(e){return await l(this,J).sendNotification(le.nes_accept,e)}async unstable_rejectNes(e){return await l(this,J).sendNotification(le.nes_reject,e)}async extMethod(e,t){return await l(this,J).sendRequest(e,t)}async extNotification(e,t){return await l(this,J).sendNotification(e,t)}get signal(){return l(this,J).signal}get closed(){return l(this,J).closed}}J=new WeakMap;var pn,Ra,_s,ks,ei,ti,Tt,Es,pe,Lv,Wc,zv,Ov,Mv,Nv,Vc,Ji;class dD{constructor(e,t,r){w(this,pe);w(this,pn,new Map);w(this,Ra,0);w(this,_s);w(this,ks);w(this,ei);w(this,ti,Promise.resolve());w(this,Tt,new AbortController);w(this,Es);E(this,_s,e),E(this,ks,t),E(this,ei,r),E(this,Es,new Promise(i=>{l(this,Tt).signal.addEventListener("abort",()=>i())})),f(this,pe,Lv).call(this)}get signal(){return l(this,Tt).signal}get closed(){return l(this,Es)}async sendRequest(e,t){f(this,pe,Vc).call(this);const r=ad(this,Ra)._++,i=new Promise((s,o)=>{l(this,pn).set(r,{resolve:s,reject:o})});return await f(this,pe,Ji).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){f(this,pe,Vc).call(this),await f(this,pe,Ji).call(this,{jsonrpc:"2.0",method:e,params:t})}}pn=new WeakMap,Ra=new WeakMap,_s=new WeakMap,ks=new WeakMap,ei=new WeakMap,ti=new WeakMap,Tt=new WeakMap,Es=new WeakMap,pe=new WeakSet,Lv=async function(){let e;try{const t=l(this,ei).readable.getReader();try{for(;!l(this,Tt).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{f(this,pe,zv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&f(this,pe,Ji).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{f(this,pe,Wc).call(this,e)}},Wc=function(e){if(l(this,Tt).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of l(this,pn).values())r.reject(t);l(this,pn).clear(),l(this,Tt).abort(t)},zv=async function(e){if("method"in e&&"id"in e){const t=await f(this,pe,Ov).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await f(this,pe,Ji).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await f(this,pe,Mv).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?f(this,pe,Nv).call(this,e):console.error("Invalid message",{message:e})},Ov=async function(e,t){try{return{result:await l(this,_s).call(this,e,t)??null}}catch(r){if(r instanceof Ee)return r.toResult();if(r instanceof Qp)return Ee.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 Ee.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ee.internalError({details:i}).toResult()}}},Mv=async function(e,t){try{return await l(this,ks).call(this,e,t),{result:null}}catch(r){if(r instanceof Ee)return r.toResult();if(r instanceof Qp)return Ee.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 Ee.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ee.internalError({details:i}).toResult()}}},Nv=function(e){const t=l(this,pn).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 Ee(r,i,s))}l(this,pn).delete(e.id)}else console.error("Got response to unknown request",e.id)},Vc=function(){if(l(this,Tt).signal.aborted)throw l(this,Tt).signal.reason??new Error("ACP connection closed")},Ji=async function(e){return E(this,ti,l(this,ti).then(async()=>{const t=l(this,ei).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{f(this,pe,Wc).call(this,t)})),l(this,ti)};class Ee 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 Ee(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Ee(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Ee(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Ee(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Ee(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Ee(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Ee(-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 pD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,fD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,gD=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,mD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,vD="single_session",yD={name:"television-acp-client",version:"0.0.0"},Uv="agent:main:television",bD=fo(zt);var se,Vt,ni,Bt,tr,nr,rr,ir,fn,ri,Ct,Qe,Gt,sr,jt,gn,xs,qt,gt,Da,Yt,I,Fv,Zv,Hv,Bc,Wv,Vv,Bv,Gv,jv,qv,Yv,Fn,Fr,Zr,Ve,Xv,Hr,Gc,jc,na,Kv,Jv,As,$s,qc,Wr,Qv,ey;class wD extends bD{constructor(t){super();w(this,I);w(this,se,_D());w(this,Vt,null);w(this,ni,null);w(this,Bt,null);w(this,tr,null);w(this,nr,null);w(this,rr,null);w(this,ir);w(this,fn,null);w(this,ri,1);w(this,Ct,null);w(this,Qe,null);w(this,Gt,!1);w(this,sr,!1);w(this,jt,null);w(this,gn,new Set);w(this,xs);w(this,qt);w(this,gt);w(this,Da,t=>{f(this,I,Zv).call(this,t)});w(this,Yt,null);w(this,As,()=>{f(this,I,Wr).call(this,"ACP bridge websocket closed")});w(this,$s,()=>{f(this,I,Wr).call(this,"ACP bridge websocket error")});E(this,qt,t),E(this,gt,t.sessionMode??vD),E(this,ir,t.mappedSessionStore??SD()),E(this,xs,t.createSocket??(r=>new WebSocket(r)))}getState(){return l(this,se)}get messages(){return l(this,se).messageOrder.map(t=>l(this,se).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(l(this,se).lifecycle.status!=="ready"){f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}}),l(this,ni)??E(this,ni,f(this,I,Fv).call(this));try{await l(this,ni),await f(this,I,Bc).call(this)}catch(t){throw f(this,I,Wr).call(this,No(t)),t}}}dispose(){f(this,I,qc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),l(this,se).lifecycle.status!=="ready"||l(this,se).run.status==="running"||l(this,se).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");f(this,I,Fr).call(this,{id:f(this,I,Hr).call(this,"user"),kind:"user",text:r,status:"final"}),f(this,I,Ve).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await f(this,I,na).call(this).prompt({sessionId:f(this,I,jc).call(this),prompt:[{type:"text",text:f(this,I,Xv).call(this,r)}]});f(this,I,Fn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),f(this,I,Ve).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw f(this,I,ey).call(this)||(f(this,I,Fn).call(this,"error"),f(this,I,Ve).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:No(i)}})),i}}async cancel(){if(await this.connect(),!l(this,se).run.canCancel||l(this,se).run.status!=="running")throw new Error("No active cancellable run");f(this,I,Ve).call(this,{run:{...l(this,se).run,status:"cancelling"}}),await f(this,I,na).call(this).cancel({sessionId:f(this,I,jc).call(this)})}setScreenContext(t){var s,o,a;if(t===null){if(l(this,Qe)===null)return;E(this,Qe,null),E(this,Gt,!1);return}const r={screenID:t.screenID,screenName:t.screenName};if(((s=l(this,Qe))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Qe))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Qe))==null?void 0:a.screenID)??null;if(E(this,Qe,r),l(this,gt)==="single_session"){(!l(this,fn)||i!==r.screenID)&&E(this,Gt,!0);return}l(this,fn)!==of(l(this,gt),r.screenID,l(this,qt).clientGUID??"default-client")&&(E(this,Bt,null),E(this,tr,null),l(this,Vt)&&l(this,se).run.status==="idle"&&f(this,I,Bc).call(this).catch(c=>{f(this,I,Wr).call(this,No(c))}))}}se=new WeakMap,Vt=new WeakMap,ni=new WeakMap,Bt=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,fn=new WeakMap,ri=new WeakMap,Ct=new WeakMap,Qe=new WeakMap,Gt=new WeakMap,sr=new WeakMap,jt=new WeakMap,gn=new WeakMap,xs=new WeakMap,qt=new WeakMap,gt=new WeakMap,Da=new WeakMap,Yt=new WeakMap,I=new WeakSet,Fv=async function(){try{f(this,I,Ve).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await xD({serverURL:l(this,qt).serverURL,token:l(this,qt).token,createSocket:l(this,xs),onDisconnect:l(this,Da)});E(this,rr,i),f(this,I,Ve).call(this,{bridge:i}),E(this,Yt,r),r.addEventListener("close",l(this,As)),r.addEventListener("error",l(this,$s)),E(this,Vt,new hD(s=>({connection:s,sessionUpdate:async o=>{await f(this,I,Vv).call(this,o)},requestPermission:async o=>f(this,I,Bv).call(this,o)}),t)),await l(this,Vt).initialize({protocolVersion:qT,clientCapabilities:{},clientInfo:yD})}catch(t){throw t}},Zv=function(t){f(this,I,Wr).call(this,No(t))},Hv=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})`)},Bc=async function(){const t=f(this,I,Jv).call(this);if(l(this,Bt)&&l(this,tr)===t){await l(this,Bt);return}E(this,tr,t),E(this,Bt,f(this,I,Wv).call(this,t)),await l(this,Bt)},Wv=async function(t){var c;const r=f(this,I,na).call(this);f(this,I,Qv).call(this);let i,s=!1,o=null;const a={cwd:f(this,I,Kv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(E(this,sr,!0),E(this,jt,null),((c=l(this,rr))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,ir).getActualSessionId(t);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(kD(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,l(this,ir).setActualSessionId(t,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,ir).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:t}),i=t,s=l(this,se).messageOrder.length>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{E(this,sr,!1),E(this,jt,null),f(this,I,Fn).call(this,"final")}f(this,I,Hv).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),E(this,nr,i),E(this,fn,t),s?(l(this,gn).add(t),l(this,gt)==="single_session"&&E(this,Gt,!1)):(l(this,gn).delete(t),E(this,Gt,l(this,gt)==="single_session")),f(this,I,Ve).call(this,{lifecycle:{status:"ready"}})},Vv=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&f(this,I,Yv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&f(this,I,Gv).call(this,r.content.text);return;case"tool_call":f(this,I,jv).call(this,r);return;case"tool_call_update":f(this,I,qv).call(this,r);return;case"agent_thought_chunk":return;default:return}},Bv=async function(t){return{outcome:{outcome:"cancelled"}}},Gv=function(t){E(this,jt,null);const r=ED(t);if(!r)return;if(!l(this,Ct)){const s={id:f(this,I,Hr).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};E(this,Ct,s.id),f(this,I,Fr).call(this,s);return}const i=l(this,se).messagesById[l(this,Ct)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");f(this,I,Zr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},jv=function(t){f(this,I,Fn).call(this,"final");const r=f(this,I,Gc).call(this,t.toolCallId),i=lf("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??f(this,I,Hr).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){f(this,I,Zr).call(this,s);return}f(this,I,Fr).call(this,s)},qv=function(t){const r=f(this,I,Gc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=lf(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??f(this,I,Hr).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){f(this,I,Zr).call(this,a);return}f(this,I,Fr).call(this,a)},Yv=function(t){if(f(this,I,Fn).call(this,"final"),!t)return;const r=l(this,sr)?l(this,jt):null;if(!r){const s=af(t);if(!s)return;const o={id:f(this,I,Hr).call(this,"user"),kind:"user",text:s,status:"final"};f(this,I,Fr).call(this,o),l(this,sr)&&E(this,jt,o.id);return}const i=l(this,se).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");f(this,I,Zr).call(this,{...i,text:af(`${i.text}${t}`)})},Fn=function(t){if(!l(this,Ct))return;const r=l(this,se).messagesById[l(this,Ct)];(r==null?void 0:r.kind)==="assistant"&&f(this,I,Zr).call(this,{...r,status:t}),E(this,Ct,null)},Fr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,se).messagesById,[t.id]:t},messageOrder:[...l(this,se).messageOrder,t.id]})},Zr=function(t){f(this,I,Ve).call(this,{messagesById:{...l(this,se).messagesById,[t.id]:t}})},Ve=function(t){const r={...l(this,se),...t};E(this,se,{...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 ne("change"))},Xv=function(t){const r=l(this,fn);return!l(this,Qe)||!r||!(l(this,gt)==="single_session"?l(this,Gt)||!l(this,gn).has(r):!l(this,gn).has(r))?t:(E(this,Gt,!1),l(this,gn).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${l(this,Qe).screenID}`,`screen_name: ${l(this,Qe).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
+ `))},Hr=function(t){const r=`${t}-${l(this,ri)}`;return E(this,ri,l(this,ri)+1),r},Gc=function(t){for(const r of l(this,se).messageOrder){const i=l(this,se).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},jc=function(){if(!l(this,nr))throw new Error("ACP session is not ready");return l(this,nr)},na=function(){if(!l(this,Vt))throw new Error("ACP connection is not ready");return l(this,Vt)},Kv=function(){var r;const t=(r=l(this,rr))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Jv=function(){var r;if(l(this,gt)==="single_session")return`${Uv}-${(l(this,qt).clientGUID??"default-client").toLowerCase()}`;const t=(r=l(this,Qe))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return of(l(this,gt),t,l(this,qt).clientGUID??"default-client")},As=new WeakMap,$s=new WeakMap,qc=function(){E(this,Vt,null),E(this,ni,null),E(this,Bt,null),E(this,tr,null),E(this,nr,null),E(this,fn,null),E(this,rr,null),l(this,Yt)&&(l(this,Yt).removeEventListener("close",l(this,As)),l(this,Yt).removeEventListener("error",l(this,$s)),l(this,Yt).close(),E(this,Yt,null))},Wr=function(t){this.disposed||l(this,se).lifecycle.status==="disconnected"||(f(this,I,Fn).call(this,"error"),f(this,I,qc).call(this),f(this,I,Ve).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Qv=function(){E(this,Ct,null),E(this,jt,null),E(this,ri,1),f(this,I,Ve).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},ey=function(){return l(this,se).lifecycle.status==="disconnected"};function SD(){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 _D(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function kD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function of(n,e,t){return n==="single_session"?`${Uv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function ty(n){return n.replace(/^(?:\s*\n)+/,"")}function af(n){let e=n;return e=e.replace(pD,""),e=e.replace(fD,""),e=e.replace(gD,""),e=ty(e),e}function ED(n){let e=n;return e=e.replace(mD,""),e=ty(e),e}function lf(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function xD(n){const e=n.createSocket(ID(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"}))},v=_=>{const C=$D(_);if(!C)return;let U;try{U=JSON.parse(C)}catch(P){const B=P instanceof Error?P:new Error(String(P));i(B),u.error(B);return}switch(U.type){case"acp-bridge-status":if(U.status==="ready"){let P;try{P=AD(U)}catch(B){const L=B instanceof Error?B:new Error(String(B));t||i(L),u.error(L);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 C;if(h)return;h=!0;const _=new Error("ACP bridge websocket closed");t||i(_),(C=n.onDisconnect)==null||C.call(n,_),u.close()},x=()=>{var C;if(h)return;h=!0;const _=new Error("ACP bridge websocket error");t||i(_),(C=n.onDisconnect)==null||C.call(n,_),u.error(_)};e.addEventListener("open",p),e.addEventListener("message",v),e.addEventListener("close",m),e.addEventListener("error",x)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:e,metadata:c}}function AD(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 $D(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 ID(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 No(n){return n instanceof Error?n.message:String(n)}const cf="television.acpClientGUID",uf="television.acpMappedSessions",hf=1;var ii;class TD{constructor(){w(this,ii,new Map)}getActualSessionId(e){return l(this,ii).get(e)??null}setActualSessionId(e,t){l(this,ii).set(e,t)}clearActualSessionId(e){l(this,ii).delete(e)}}ii=new WeakMap;var si,Is,tt,ra,ia,Yc;class CD{constructor(e,t){w(this,tt);w(this,si);w(this,Is);E(this,si,e),E(this,Is,t)}getActualSessionId(e){const t=f(this,tt,ia).call(this)[f(this,tt,ra).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=f(this,tt,ia).call(this);r[f(this,tt,ra).call(this,e)]=t,f(this,tt,Yc).call(this,r)}clearActualSessionId(e){const t=f(this,tt,ia).call(this);delete t[f(this,tt,ra).call(this,e)],f(this,tt,Yc).call(this,t)}}si=new WeakMap,Is=new WeakMap,tt=new WeakSet,ra=function(e){return JSON.stringify([l(this,Is),e])},ia=function(){const e=l(this,si).getItem(uf);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!==hf?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Yc=function(e){const t={version:hf,entries:e};l(this,si).setItem(uf,JSON.stringify(t))};function PD(){return typeof window>"u"?null:window.localStorage}function RD(n){const e=n.getItem(cf);if(e)return e;const t=ol().toLowerCase();return n.setItem(cf,t),t}const DD=4401;class Xc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class ny extends zt{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,"acpClient");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=dt(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.createClient=t.createClient??((i,s)=>new Kx(i,{token:s??void 0})),this.client=this.createClient(this.url,this.token);const r=t.mappedSessionStore??(t.acpStorage?new CD(t.acpStorage,this.url):new TD);this.acpClient=new wD({serverURL:this.url,token:this.token??"",...t.createACPSocket?{createSocket:t.createACPSocket}:t.createSocket?{createSocket:t.createSocket}:{},...t.clientGUID?{clientGUID:t.clientGUID}:{},mappedSessionStore:r})}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 ne("change"));const r=this.createSocket(LD(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new ne("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new ne("change")),o(p))},h=async()=>{try{const[{screens:p},v]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(m=>[m.id,structuredClone(m)])),this.views=v,this.dispatchEvent(new ne("change")),c()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const v=OD(p);v&&(this.applyServerEvent(v),this.dispatchEvent(new vm("server-event",{serverURL:this.url,event:v})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,zD(p)===DD){u(new Xc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new ne("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 ne("change"))}dispose(){this.disconnect(),this.acpClient.dispose()}getViewURL(t){const r=jT(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 ea("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new ea("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new ea("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!fm(r.layout,t.artifact.id)&&(r.layout=[...r.layout,pm(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=im(r.layout,t.artifactID));break}}}}function LD(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 zD(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function OD(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}}const MD="Local";var Ts,Kc;class ND extends zt{constructor(t){super();w(this,Ts);b(this,"servers",new Map);b(this,"localServerURL");b(this,"clientGUID");b(this,"acpStorage");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 ne("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?dt(t.localServerURL):null,this.createSocket=t.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=t.acpStorage===void 0?PD():t.acpStorage;this.acpStorage=r,this.clientGUID=t.clientGUID??(r?RD(r):ol().toLowerCase()),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=dt(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new ne("change"))},o=c=>{this.dispatchEvent(new vm("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new ea("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 ne("change"))}remove(t){const r=dt(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.dispose(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(c=>c.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new ne("change"))}setActive(t){const r=this.localStore.get(),i=t?dt(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=t?dt(t):null;if(i){const a=this.localStore.get();a.servers.some(u=>dt(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:MD}]})}const s=this.localStore.get().servers;for(const a of s){const c=dt(a.url),u=i!==null&&c===i,h=f(this,Ts,Kc).call(this,{url:a.url,name:a.name,token:u?r??null:null});this.add(h),h.connect().catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=dt(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>dt(a.url)!==i),{url:i,name:r}]});const o=f(this,Ts,Kc).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}Ts=new WeakSet,Kc=function(t){return new ny({url:t.url,name:t.name,token:t.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var Cs;class UD extends zt{constructor(){super();w(this,Cs,t=>{const r=FD(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new bx("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,Cs))}dispose(){document.removeEventListener("keydown",l(this,Cs))}}Cs=new WeakMap;function FD(n){for(const[e,t]of Object.entries(Jx))if(ZD(n,t.trigger))return e;return null}function ZD(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 HD="serverURL",WD="token",VD="mode",BD="electron";function ry(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(HD);return r?new URL(r).origin:new URL(e).origin}function df(n=window.location.search){return new URLSearchParams(n).get(WD)}function mh(n=window.location.search){return new URLSearchParams(n).get(VD)===BD}/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const as=globalThis,df=n=>n,Ea=as.trustedTypes,pf=Ea?Ea.createPolicy("lit-html",{createHTML:n=>n}):void 0,ry="$lit$",un=`lit$${Math.random().toFixed(9).slice(2)}$`,iy="?"+un,VD=`<${iy}>`,br=document,ds=()=>br.createComment(""),ps=n=>n===null||typeof n!="object"&&typeof n!="function",mh=Array.isArray,BD=n=>mh(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",ac=`[
48
- \f\r]`,Zi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ff=/-->/g,gf=/>/g,Mn=RegExp(`>|${ac}(?:([^\\s"'>=/]+)(${ac}*=${ac}*(?:[^
49
- \f\r"'\`<>=]|("|')|))|$)`,"g"),mf=/'/g,vf=/"/g,sy=/^(?:script|style|textarea|title)$/i,GD=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=GD(1),Si=Symbol.for("lit-noChange"),ee=Symbol.for("lit-nothing"),yf=new WeakMap,jn=br.createTreeWalker(br,129);function oy(n,e){if(!mh(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return pf!==void 0?pf.createHTML(e):e}const jD=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Zi;for(let a=0;a<t;a++){const c=n[a];let u,h,p=-1,v=0;for(;v<c.length&&(o.lastIndex=v,h=o.exec(c),h!==null);)v=o.lastIndex,o===Zi?h[1]==="!--"?o=ff:h[1]!==void 0?o=gf:h[2]!==void 0?(sy.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Mn):h[3]!==void 0&&(o=Mn):o===Mn?h[0]===">"?(o=i??Zi,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Mn:h[3]==='"'?vf:mf):o===vf||o===mf?o=Mn:o===ff||o===gf?o=Zi:(o=Mn,i=void 0);const m=o===Mn&&n[a+1].startsWith("/>")?" ":"";s+=o===Zi?c+VD:p>=0?(r.push(u),c.slice(0,p)+ry+c.slice(p)+un+m):c+un+(p===-2?a:m)}return[oy(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class fs{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,h]=jD(e,t);if(this.el=fs.createElement(u,r),jn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=jn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(ry)){const v=h[o++],m=i.getAttribute(p).split(un),x=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:x[2],strings:m,ctor:x[1]==="."?YD:x[1]==="?"?XD:x[1]==="@"?KD:fl}),i.removeAttribute(p)}else p.startsWith(un)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(sy.test(i.tagName)){const p=i.textContent.split(un),v=p.length-1;if(v>0){i.textContent=Ea?Ea.emptyScript:"";for(let m=0;m<v;m++)i.append(p[m],ds()),jn.nextNode(),c.push({type:2,index:++s});i.append(p[v],ds())}}}else if(i.nodeType===8)if(i.data===iy)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(un,p+1))!==-1;)c.push({type:7,index:s}),p+=un.length-1}s++}}static createElement(e,t){const r=br.createElement("template");return r.innerHTML=e,r}}function _i(n,e,t=n,r){var o,a;if(e===Si)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=ps(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=_i(n,i._$AS(n,e.values),i,r)),e}class qD{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)??br).importNode(t,!0);jn.currentNode=i;let s=jn.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new vh(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new JD(s,this,e)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=jn.nextNode(),o++)}return jn.currentNode=br,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 vh=class ay{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=ee,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=_i(this,e,t),ps(e)?e===ee||e==null||e===""?(this._$AH!==ee&&this._$AR(),this._$AH=ee):e!==this._$AH&&e!==Si&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):BD(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!==ee&&ps(this._$AH)?this._$AA.nextSibling.data=e:this.T(br.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=fs.createElement(oy(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 qD(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=yf.get(e.strings);return t===void 0&&yf.set(e.strings,t=new fs(e)),t}k(e){mh(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 ay(this.O(ds()),this.O(ds()),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=df(e).nextSibling;df(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},fl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=ee,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=ee}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=_i(this,e,t,0),o=!ps(e)||e!==this._$AH&&e!==Si,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=_i(this,a[r+c],t,c),u===Si&&(u=this._$AH[c]),o||(o=!ps(u)||u!==this._$AH[c]),u===ee?e=ee:e!==ee&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},YD=class extends fl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ee?void 0:e}},XD=class extends fl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ee)}},KD=class extends fl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=_i(this,e,t,0)??ee)===Si)return;const r=this._$AH,i=e===ee&&r!==ee||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==ee&&(r===ee||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 JD{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){_i(this,e)}}const lc=as.litHtmlPolyfillSupport;lc==null||lc(fs,vh),(as.litHtmlVersions??(as.litHtmlVersions=[])).push("3.3.2");const Fe=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new vh(e.insertBefore(ds(),null),null,void 0,{})),i._$AI(n),i},QD=.5,bf=.1,wf=8,e2=4,ly=3,cy=3,t2=4,qn=255,uy=.2126,hy=.7152,dy=.0722;async function py(n){const e=n2(n);if(!e)return"light";try{return await s2(n,e)>=QD?"light":"dark"}catch{return"light"}}function n2(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(r2(o))return s}return null}function r2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:i2(n.backgroundColor)>0}function i2(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===t2?parseFloat(t[ly]):t.length===cy?1:0}async function s2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Uo((t.left-r.left)/r.width),y:Uo((t.top-r.top)/r.height),width:Uo(t.width/r.width),height:Uo(t.height/r.height)},s=window.getComputedStyle(e),o=o2(s.backgroundImage);return o?l2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):c2(s.backgroundColor)}function o2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const Sf=new Map;function a2(n){let e=Sf.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}),Sf.set(n,e),e)}async function l2(n){const e=await a2(n.url),t=Math.max(wf,Math.ceil(n.surfaceWidth*bf)),r=Math.max(wf,Math.ceil(n.surfaceHeight*bf)),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 c,u;a>o?(u=r,c=r*a):(c=t,u=t/a);const h=(t-c)/2,p=(r-u)/2;s.drawImage(e,h,p,c,u);const v=Math.max(0,Math.floor(n.region.x*t)),m=Math.max(0,Math.floor(n.region.y*r)),x=Math.max(1,Math.min(t-v,Math.floor(n.region.width*t))),_=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),C=s.getImageData(v,m,x,_).data;let U=0,P=0;for(let B=0;B<C.length;B+=e2){const L=C[B]/qn,V=C[B+1]/qn,F=C[B+2]/qn,he=C[B+ly]/qn;U+=he*(uy*L+hy*V+dy*F),P+=1}return P>0?U/P:1}function c2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<cy)return 1;const r=t[0]/qn,i=t[1]/qn,s=t[2]/qn;return uy*r+hy*i+dy*s}function Uo(n){return n<0?0:n>1?1:n}const u2=["ghost","glass"],gs=u2.flatMap(n=>[`button[variant="${n}"]`,`segmented-control[variant="${n}"]`]).join(", "),Fo=new WeakSet,_f=new WeakSet;function fy(n){if(_f.has(n))return;_f.add(n);for(const t of n.querySelectorAll(gs))cc(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)h2(i,cc);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(gs)&&cc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function h2(n,e){if(n instanceof Element){n instanceof HTMLElement&&n.matches(gs)&&e(n);for(const t of n.querySelectorAll(gs))e(t)}}async function cc(n){if(Fo.has(n)||n.hasAttribute("tone"))return;Fo.add(n);const e=await py(n);if(!n.matches(gs)){Fo.delete(n);return}if(n.hasAttribute("tone")){Fo.delete(n);return}n.setAttribute("tone",e)}const d2="*,*: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;--control-height-sm: 24px;--control-height-md: 28px;--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{border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;box-sizing:border-box;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}input{height:var(--control-height-md);padding:0 10px}textarea{padding:6px 10px;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);box-sizing:border-box;height:var(--control-height-md);padding:0 14px 2px;font:inherit;cursor:default}button,segmented-control{background:var(--color-surface);border:.5px solid var(--tint-200);border-radius:var(--radius-12);box-shadow:var(--shadow-control);color:inherit}button:not([material]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:not([material]):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[variant=glass],segmented-control[variant=glass]{background:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5);box-shadow:none}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[tone=dark] button[variant=glass],[tone=dark] segmented-control[variant=glass]{border-color:var(--tint-400)}button[material],segmented-control[material]{color:inherit;box-shadow:none}button[material]:hover:not(:disabled){background-image:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[material]:active:not(:disabled){background-image:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[tone=dark] button[material],[tone=dark] segmented-control[material]{border-color:var(--tint-400)}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}:where([tone=dark]) button:not([variant]):not([material]):not(:disabled),:where([tone=dark]) button[variant=default]:not([material]):not(:disabled),:where([tone=dark]) segmented-control:not([variant]):not([material]),:where([tone=dark]) segmented-control[variant=default]:not([material]){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}:where([tone=dark]) button:not([variant]):hover:not(:disabled),:where([tone=dark]) button[variant=default]:hover:not(:disabled){background:var(--tint-300)}:where([tone=dark]) button:not([variant]):active:not(:disabled),:where([tone=dark]) button[variant=default]:active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}:where([tone=light]) button:not([variant]):not([material]):not(:disabled),:where([tone=light]) button[variant=default]:not([material]):not(:disabled),:where([tone=light]) segmented-control:not([variant]):not([material]),:where([tone=light]) segmented-control[variant=default]:not([material]){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}:where([tone=light]) button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}:where([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],segmented-control[size=sm]{height:var(--control-height-sm)}button[size=sm][icon-only]{width:var(--control-height-sm)}button[icon-only]{width:var(--control-height-md);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:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}[material=glass-frosted]{background:color-mix(in srgb,var(--white) var(--alpha-800),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(--white) var(--alpha-300), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass-frosted]{background:color-mix(in srgb,var(--black) 70%,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-200), 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}ui-popover.dropdown-popover::part(panel){min-width:192px;padding:var(--space-4)}.dropdown-list{display:flex;flex-direction:column;gap:2px}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,dropdown-item[action]: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;inset:0 auto auto 0;margin:0;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-12);outline:none;z-index:2000}segmented-control{display:inline-flex;align-items:stretch;box-sizing:border-box;height:var(--control-height-md)}segmented-control>button{height:auto}segmented-control[variant=ghost]{background:transparent;box-shadow:none}[tone=dark] segmented-control[variant=ghost]{border-color:var(--tint-400)}segmented-control>button{position:relative}segmented-control>button[icon-only]{width:auto;height:auto;padding:0 var(--space-6)}segmented-control>button:not([variant]):not(:disabled),[tone] segmented-control>button:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>button:not([variant]):hover:not(:disabled),[tone] segmented-control>button:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>button:not([variant]):active:not(:disabled),[tone] segmented-control>button:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>button:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>button:not(:last-child):after{background:var(--tint-400)}segmented-control>dropdown-menu{display:inline-flex;align-items:stretch;height:auto}segmented-control>dropdown-menu>[slot=trigger]{height:auto;position:relative}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>dropdown-menu:first-child>[slot=trigger]{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>dropdown-menu:last-child>[slot=trigger]{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>dropdown-menu:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>dropdown-menu:not(:last-child):after{background:var(--tint-400)}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)}',yh=new CSSStyleSheet;yh.replaceSync(d2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,yh]}catch{}fy(document);function gy(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,yh]}catch{}fy(n)}/**
47
+ */const as=globalThis,pf=n=>n,Ea=as.trustedTypes,ff=Ea?Ea.createPolicy("lit-html",{createHTML:n=>n}):void 0,iy="$lit$",un=`lit$${Math.random().toFixed(9).slice(2)}$`,sy="?"+un,GD=`<${sy}>`,br=document,ds=()=>br.createComment(""),ps=n=>n===null||typeof n!="object"&&typeof n!="function",vh=Array.isArray,jD=n=>vh(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",lc=`[
48
+ \f\r]`,Hi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gf=/-->/g,mf=/>/g,Mn=RegExp(`>|${lc}(?:([^\\s"'>=/]+)(${lc}*=${lc}*(?:[^
49
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),vf=/'/g,yf=/"/g,oy=/^(?:script|style|textarea|title)$/i,qD=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=qD(1),_i=Symbol.for("lit-noChange"),ee=Symbol.for("lit-nothing"),bf=new WeakMap,jn=br.createTreeWalker(br,129);function ay(n,e){if(!vh(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ff!==void 0?ff.createHTML(e):e}const YD=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Hi;for(let a=0;a<t;a++){const c=n[a];let u,h,p=-1,v=0;for(;v<c.length&&(o.lastIndex=v,h=o.exec(c),h!==null);)v=o.lastIndex,o===Hi?h[1]==="!--"?o=gf:h[1]!==void 0?o=mf:h[2]!==void 0?(oy.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Mn):h[3]!==void 0&&(o=Mn):o===Mn?h[0]===">"?(o=i??Hi,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Mn:h[3]==='"'?yf:vf):o===yf||o===vf?o=Mn:o===gf||o===mf?o=Hi:(o=Mn,i=void 0);const m=o===Mn&&n[a+1].startsWith("/>")?" ":"";s+=o===Hi?c+GD:p>=0?(r.push(u),c.slice(0,p)+iy+c.slice(p)+un+m):c+un+(p===-2?a:m)}return[ay(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class fs{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,h]=YD(e,t);if(this.el=fs.createElement(u,r),jn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=jn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(iy)){const v=h[o++],m=i.getAttribute(p).split(un),x=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:x[2],strings:m,ctor:x[1]==="."?KD:x[1]==="?"?JD:x[1]==="@"?QD:gl}),i.removeAttribute(p)}else p.startsWith(un)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(oy.test(i.tagName)){const p=i.textContent.split(un),v=p.length-1;if(v>0){i.textContent=Ea?Ea.emptyScript:"";for(let m=0;m<v;m++)i.append(p[m],ds()),jn.nextNode(),c.push({type:2,index:++s});i.append(p[v],ds())}}}else if(i.nodeType===8)if(i.data===sy)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(un,p+1))!==-1;)c.push({type:7,index:s}),p+=un.length-1}s++}}static createElement(e,t){const r=br.createElement("template");return r.innerHTML=e,r}}function ki(n,e,t=n,r){var o,a;if(e===_i)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=ps(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=ki(n,i._$AS(n,e.values),i,r)),e}class XD{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)??br).importNode(t,!0);jn.currentNode=i;let s=jn.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new yh(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new e2(s,this,e)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=jn.nextNode(),o++)}return jn.currentNode=br,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 yh=class ly{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=ee,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=ki(this,e,t),ps(e)?e===ee||e==null||e===""?(this._$AH!==ee&&this._$AR(),this._$AH=ee):e!==this._$AH&&e!==_i&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):jD(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!==ee&&ps(this._$AH)?this._$AA.nextSibling.data=e:this.T(br.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=fs.createElement(ay(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 XD(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=bf.get(e.strings);return t===void 0&&bf.set(e.strings,t=new fs(e)),t}k(e){vh(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 ly(this.O(ds()),this.O(ds()),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=pf(e).nextSibling;pf(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},gl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=ee,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=ee}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=ki(this,e,t,0),o=!ps(e)||e!==this._$AH&&e!==_i,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=ki(this,a[r+c],t,c),u===_i&&(u=this._$AH[c]),o||(o=!ps(u)||u!==this._$AH[c]),u===ee?e=ee:e!==ee&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},KD=class extends gl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ee?void 0:e}},JD=class extends gl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ee)}},QD=class extends gl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=ki(this,e,t,0)??ee)===_i)return;const r=this._$AH,i=e===ee&&r!==ee||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==ee&&(r===ee||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 e2{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){ki(this,e)}}const cc=as.litHtmlPolyfillSupport;cc==null||cc(fs,yh),(as.litHtmlVersions??(as.litHtmlVersions=[])).push("3.3.2");const Fe=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new yh(e.insertBefore(ds(),null),null,void 0,{})),i._$AI(n),i},t2=.5,wf=.1,Sf=8,n2=4,cy=3,uy=3,r2=4,qn=255,hy=.2126,dy=.7152,py=.0722;async function fy(n){const e=i2(n);if(!e)return"light";try{return await a2(n,e)>=t2?"light":"dark"}catch{return"light"}}function i2(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(s2(o))return s}return null}function s2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:o2(n.backgroundColor)>0}function o2(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===r2?parseFloat(t[cy]):t.length===uy?1:0}async function a2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Uo((t.left-r.left)/r.width),y:Uo((t.top-r.top)/r.height),width:Uo(t.width/r.width),height:Uo(t.height/r.height)},s=window.getComputedStyle(e),o=l2(s.backgroundImage);return o?u2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):h2(s.backgroundColor)}function l2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const _f=new Map;function c2(n){let e=_f.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}),_f.set(n,e),e)}async function u2(n){const e=await c2(n.url),t=Math.max(Sf,Math.ceil(n.surfaceWidth*wf)),r=Math.max(Sf,Math.ceil(n.surfaceHeight*wf)),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 c,u;a>o?(u=r,c=r*a):(c=t,u=t/a);const h=(t-c)/2,p=(r-u)/2;s.drawImage(e,h,p,c,u);const v=Math.max(0,Math.floor(n.region.x*t)),m=Math.max(0,Math.floor(n.region.y*r)),x=Math.max(1,Math.min(t-v,Math.floor(n.region.width*t))),_=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),C=s.getImageData(v,m,x,_).data;let U=0,P=0;for(let B=0;B<C.length;B+=n2){const L=C[B]/qn,V=C[B+1]/qn,F=C[B+2]/qn,he=C[B+cy]/qn;U+=he*(hy*L+dy*V+py*F),P+=1}return P>0?U/P:1}function h2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<uy)return 1;const r=t[0]/qn,i=t[1]/qn,s=t[2]/qn;return hy*r+dy*i+py*s}function Uo(n){return n<0?0:n>1?1:n}const d2=["ghost","glass"],gs=d2.flatMap(n=>[`button[variant="${n}"]`,`segmented-control[variant="${n}"]`]).join(", "),Fo=new WeakSet,kf=new WeakSet;function gy(n){if(kf.has(n))return;kf.add(n);for(const t of n.querySelectorAll(gs))uc(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)p2(i,uc);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(gs)&&uc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function p2(n,e){if(n instanceof Element){n instanceof HTMLElement&&n.matches(gs)&&e(n);for(const t of n.querySelectorAll(gs))e(t)}}async function uc(n){if(Fo.has(n)||n.hasAttribute("tone"))return;Fo.add(n);const e=await fy(n);if(!n.matches(gs)){Fo.delete(n);return}if(n.hasAttribute("tone")){Fo.delete(n);return}n.setAttribute("tone",e)}const f2="*,*: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;--control-height-sm: 24px;--control-height-md: 28px;--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{border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;box-sizing:border-box;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}input{height:var(--control-height-md);padding:0 10px}textarea{padding:6px 10px;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);box-sizing:border-box;height:var(--control-height-md);padding:0 14px 2px;font:inherit;cursor:default}button,segmented-control{background:var(--color-surface);border:.5px solid var(--tint-200);border-radius:var(--radius-12);box-shadow:var(--shadow-control);color:inherit}button:not([material]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:not([material]):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[variant=glass],segmented-control[variant=glass]{background:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5);box-shadow:none}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[tone=dark] button[variant=glass],[tone=dark] segmented-control[variant=glass]{border-color:var(--tint-400)}button[material],segmented-control[material]{color:inherit;box-shadow:none}button[material]:hover:not(:disabled){background-image:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover))}button[material]:active:not(:disabled){background-image:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}[tone=dark] button[material],[tone=dark] segmented-control[material]{border-color:var(--tint-400)}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}:where([tone=dark]) button:not([variant]):not([material]):not(:disabled),:where([tone=dark]) button[variant=default]:not([material]):not(:disabled),:where([tone=dark]) segmented-control:not([variant]):not([material]),:where([tone=dark]) segmented-control[variant=default]:not([material]){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}:where([tone=dark]) button:not([variant]):hover:not(:disabled),:where([tone=dark]) button[variant=default]:hover:not(:disabled){background:var(--tint-300)}:where([tone=dark]) button:not([variant]):active:not(:disabled),:where([tone=dark]) button[variant=default]:active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}:where([tone=light]) button:not([variant]):not([material]):not(:disabled),:where([tone=light]) button[variant=default]:not([material]):not(:disabled),:where([tone=light]) segmented-control:not([variant]):not([material]),:where([tone=light]) segmented-control[variant=default]:not([material]){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}:where([tone=light]) button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}:where([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],segmented-control[size=sm]{height:var(--control-height-sm)}button[size=sm][icon-only]{width:var(--control-height-sm)}button[icon-only]{width:var(--control-height-md);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:transparent;border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}[material=glass-frosted]{background:color-mix(in srgb,var(--white) var(--alpha-800),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(--white) var(--alpha-300), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass-frosted]{background:color-mix(in srgb,var(--black) 70%,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-200), 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}ui-popover.dropdown-popover::part(panel){min-width:192px;padding:var(--space-4)}.dropdown-list{display:flex;flex-direction:column;gap:2px}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,dropdown-item[action]: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;inset:0 auto auto 0;margin:0;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-12);outline:none;z-index:2000}segmented-control{display:inline-flex;align-items:stretch;box-sizing:border-box;height:var(--control-height-md)}segmented-control>button{height:auto}segmented-control[variant=ghost]{background:transparent;box-shadow:none}[tone=dark] segmented-control[variant=ghost]{border-color:var(--tint-400)}segmented-control>button{position:relative}segmented-control>button[icon-only]{width:auto;height:auto;padding:0 var(--space-6)}segmented-control>button:not([variant]):not(:disabled),[tone] segmented-control>button:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>button:not([variant]):hover:not(:disabled),[tone] segmented-control>button:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>button:not([variant]):active:not(:disabled),[tone] segmented-control>button:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>button:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>button:not(:last-child):after{background:var(--tint-400)}segmented-control>dropdown-menu{display:inline-flex;align-items:stretch;height:auto}segmented-control>dropdown-menu>[slot=trigger]{height:auto;position:relative}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):not(:disabled){background:transparent;border:0;box-shadow:none}segmented-control>dropdown-menu:first-child>[slot=trigger]{border-top-right-radius:0;border-bottom-right-radius:0}segmented-control>dropdown-menu:last-child>[slot=trigger]{border-top-left-radius:0;border-bottom-left-radius:0}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):hover:not(:disabled){background:var(--color-overlay-hover)}segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant]):active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}segmented-control>dropdown-menu:not(:last-child):after{content:"";position:absolute;top:0;bottom:0;right:0;width:.5px;background:var(--tint-200);pointer-events:none}[tone=dark] segmented-control>dropdown-menu:not(:last-child):after{background:var(--tint-400)}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)}',bh=new CSSStyleSheet;bh.replaceSync(f2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,bh]}catch{}gy(document);function my(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,bh]}catch{}gy(n)}/**
50
50
  * @license
51
51
  * Copyright 2017 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */const my={CHILD:2},bh=n=>(...e)=>({_$litDirective$:n,values:e});class vy{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 vy={CHILD:2},wh=n=>(...e)=>({_$litDirective$:n,values:e});class yy{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 xa=class extends vy{constructor(e){if(super(e),this.it=ee,e.type!==my.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ee||e==null)return this._t=void 0,this.it=e;if(e===Si)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:[]}}};xa.directiveName="unsafeHTML",xa.resultType=1;const p2=bh(xa);/**
57
+ */let xa=class extends yy{constructor(e){if(super(e),this.it=ee,e.type!==vy.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ee||e==null)return this._t=void 0,this.it=e;if(e===_i)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:[]}}};xa.directiveName="unsafeHTML",xa.resultType=1;const g2=wh(xa);/**
58
58
  * @license
59
59
  * Copyright 2017 Google LLC
60
60
  * SPDX-License-Identifier: BSD-3-Clause
61
- */class Kc extends xa{}Kc.directiveName="unsafeSVG",Kc.resultType=2;const f2=bh(Kc),g2={size:16,color:"currentColor",weight:"regular"};function m2(n){return typeof n=="string"?{regular:n}:n}function nn(n,e="0 0 256 256"){const t=m2(n);return r=>{const{size:i,color:s,weight:o}={...g2,...r},a=t[o]??t.regular;return N`<svg
61
+ */class Jc extends xa{}Jc.directiveName="unsafeSVG",Jc.resultType=2;const m2=wh(Jc),v2={size:16,color:"currentColor",weight:"regular"};function y2(n){return typeof n=="string"?{regular:n}:n}function nn(n,e="0 0 256 256"){const t=y2(n);return r=>{const{size:i,color:s,weight:o}={...v2,...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
- >${f2(a)}</svg>`}}/**
68
+ >${m2(a)}</svg>`}}/**
69
69
  * @license
70
70
  * Copyright 2020 Google LLC
71
71
  * SPDX-License-Identifier: BSD-3-Clause
72
- */const v2=n=>n.strings===void 0;/**
72
+ */const b2=n=>n.strings===void 0;/**
73
73
  * @license
74
74
  * Copyright 2017 Google LLC
75
75
  * SPDX-License-Identifier: BSD-3-Clause
76
- */const ls=(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),ls(i,e);return!0},Aa=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)},yy=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),w2(e)}};function y2(n){this._$AN!==void 0?(Aa(this),this._$AM=n,yy(this)):this._$AM=n}function b2(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++)ls(r[s],!1),Aa(r[s]);else r!=null&&(ls(r,!1),Aa(r));else ls(this,n)}const w2=n=>{n.type==my.CHILD&&(n._$AP??(n._$AP=b2),n._$AQ??(n._$AQ=y2))};class S2 extends vy{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),yy(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&&(ls(this,e),Aa(this))}setValue(e){if(v2(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(){}}/**
76
+ */const ls=(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),ls(i,e);return!0},Aa=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),_2(e)}};function w2(n){this._$AN!==void 0?(Aa(this),this._$AM=n,by(this)):this._$AM=n}function S2(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++)ls(r[s],!1),Aa(r[s]);else r!=null&&(ls(r,!1),Aa(r));else ls(this,n)}const _2=n=>{n.type==vy.CHILD&&(n._$AP??(n._$AP=S2),n._$AQ??(n._$AQ=w2))};class k2 extends yy{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&&(ls(this,e),Aa(this))}setValue(e){if(b2(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(){}}/**
77
77
  * @license
78
78
  * Copyright 2020 Google LLC
79
79
  * SPDX-License-Identifier: BSD-3-Clause
80
- */const on=()=>new _2;class _2{}const uc=new WeakMap,an=bh(class extends S2{render(n){return ee}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)),ee}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=uc.get(e);t===void 0&&(t=new WeakMap,uc.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=uc.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)}}),k2=nn('<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"/>'),by=nn('<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"/>'),wy=nn('<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"/>'),E2=nn({regular:'<path d="M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z"/>',bold:'<path d="M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z"/>'}),x2=nn('<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"/>'),A2=nn({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"/>'}),$2=nn({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"/>'}),I2=nn({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"/>'}),T2=nn({regular:'<path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/>',bold:'<path d="M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"/>',fill:'<path d="M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"/>'});class C2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const kf='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',hc=4;var ze,Xt,or,Ge,Ps,si,oi,q,Jc,_y,sa,ky,Qc,eu,Rs,Ds,ar,Ey,tu,xy,Ay,oa,Vr;class Sy extends HTMLElement{constructor(){super();w(this,q);w(this,ze,!1);w(this,Xt,null);w(this,or);w(this,Ge,null);w(this,Ps,"bottom-start");w(this,si,!1);w(this,oi,!1);w(this,Rs,t=>{l(this,ze)&&(l(this,si)||t.composedPath().includes(this)||(this.open=!1))});w(this,Ds,t=>{if(l(this,ze)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&f(this,q,Ey).call(this,t)}});w(this,ar,()=>{l(this,ze)&&f(this,q,oa).call(this)});E(this,or,this.attachShadow({mode:"open"})),gy(l(this,or)),f(this,q,Jc).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),f(this,q,Jc).call(this,"open"),f(this,q,Vr).call(this),l(this,ze)&&(f(this,q,Qc).call(this),f(this,q,sa).call(this))}disconnectedCallback(){f(this,q,eu).call(this)}attributeChangedCallback(t){t==="open"?f(this,q,_y).call(this,this.hasAttribute("open")):t==="material"&&l(this,ze)&&(f(this,q,Vr).call(this),f(this,q,sa).call(this))}get open(){return l(this,ze)}set open(t){this.toggleAttribute("open",t)}get anchor(){return l(this,Xt)}set anchor(t){l(this,Xt)!==t&&(E(this,Xt,t),l(this,ze)&&f(this,q,oa).call(this))}}ze=new WeakMap,Xt=new WeakMap,or=new WeakMap,Ge=new WeakMap,Ps=new WeakMap,si=new WeakMap,oi=new WeakMap,q=new WeakSet,Jc=function(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const r=this,i=r[t];delete r[t],r[t]=i},_y=function(t){var r,i,s;if(l(this,ze)!==t){if(E(this,ze,t),!this.isConnected){f(this,q,Vr).call(this);return}t?(E(this,si,!0),setTimeout(()=>{E(this,si,!1)},0),f(this,q,Vr).call(this),f(this,q,Qc).call(this),f(this,q,sa).call(this)):(f(this,q,eu).call(this),(i=(r=l(this,Ge))==null?void 0:r.hidePopover)==null||i.call(r),f(this,q,Vr).call(this),(s=l(this,Xt))==null||s.focus(),this.dispatchEvent(new C2))}},sa=function(){l(this,oi)||(E(this,oi,!0),queueMicrotask(()=>{E(this,oi,!1),!(!l(this,ze)||!this.isConnected)&&(f(this,q,ky).call(this),f(this,q,Ay).call(this))}))},ky=function(){var t,r;if(l(this,Ge)){try{(r=(t=l(this,Ge)).showPopover)==null||r.call(t)}catch{}f(this,q,oa).call(this)}},Qc=function(){document.addEventListener("click",l(this,Rs)),document.addEventListener("keydown",l(this,Ds),!0),window.addEventListener("resize",l(this,ar)),window.addEventListener("scroll",l(this,ar),!0)},eu=function(){document.removeEventListener("click",l(this,Rs)),document.removeEventListener("keydown",l(this,Ds),!0),window.removeEventListener("resize",l(this,ar)),window.removeEventListener("scroll",l(this,ar),!0)},Rs=new WeakMap,Ds=new WeakMap,ar=new WeakMap,Ey=function(t){const r=f(this,q,tu).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=f(this,q,xy).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())},tu=function(){if(!l(this,Ge))return[];const t=l(this,Ge).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(kf)&&r.push(i);for(const s of i.querySelectorAll(kf))r.push(s)}return r},xy=function(){var r;let t=document.activeElement;for(;t&&((r=t.shadowRoot)!=null&&r.activeElement);)t=t.shadowRoot.activeElement;return t},Ay=function(){var r;const t=f(this,q,tu).call(this);t.length>0?t[0].focus():(r=l(this,Ge))==null||r.focus()},oa=function(){if(!l(this,ze)||!l(this,Xt)||!l(this,Ge))return;const t=l(this,Xt).getBoundingClientRect(),r=l(this,Ge).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+hc,a=s<o&&t.top>o?"top-start":"bottom-start";E(this,Ps,a);const c=a==="bottom-start"?t.bottom+hc:t.top-r.height-hc,u=t.left;l(this,Ge).style.transform=`translate(${u}px, ${c}px)`,l(this,Ge).setAttribute("data-placement",a)},Vr=function(){this.toggleAttribute("open",l(this,ze));const t=this.getAttribute("material")??"paper";Fe(l(this,ze)?N`<div
80
+ */const on=()=>new E2;class E2{}const hc=new WeakMap,an=wh(class extends k2{render(n){return ee}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)),ee}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)}}),x2=nn('<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"/>'),wy=nn('<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"/>'),Sy=nn('<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"/>'),A2=nn({regular:'<path d="M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z"/>',bold:'<path d="M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z"/>'}),$2=nn('<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"/>'),I2=nn({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"/>'}),T2=nn({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"/>'}),C2=nn({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"/>'}),P2=nn({regular:'<path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/>',bold:'<path d="M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"/>',fill:'<path d="M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"/>'});class R2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const Ef='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',dc=4;var ze,Xt,or,Ge,Ps,oi,ai,q,Qc,ky,sa,Ey,eu,tu,Rs,Ds,ar,xy,nu,Ay,$y,oa,Vr;class _y extends HTMLElement{constructor(){super();w(this,q);w(this,ze,!1);w(this,Xt,null);w(this,or);w(this,Ge,null);w(this,Ps,"bottom-start");w(this,oi,!1);w(this,ai,!1);w(this,Rs,t=>{l(this,ze)&&(l(this,oi)||t.composedPath().includes(this)||(this.open=!1))});w(this,Ds,t=>{if(l(this,ze)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&f(this,q,xy).call(this,t)}});w(this,ar,()=>{l(this,ze)&&f(this,q,oa).call(this)});E(this,or,this.attachShadow({mode:"open"})),my(l(this,or)),f(this,q,Qc).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),f(this,q,Qc).call(this,"open"),f(this,q,Vr).call(this),l(this,ze)&&(f(this,q,eu).call(this),f(this,q,sa).call(this))}disconnectedCallback(){f(this,q,tu).call(this)}attributeChangedCallback(t){t==="open"?f(this,q,ky).call(this,this.hasAttribute("open")):t==="material"&&l(this,ze)&&(f(this,q,Vr).call(this),f(this,q,sa).call(this))}get open(){return l(this,ze)}set open(t){this.toggleAttribute("open",t)}get anchor(){return l(this,Xt)}set anchor(t){l(this,Xt)!==t&&(E(this,Xt,t),l(this,ze)&&f(this,q,oa).call(this))}}ze=new WeakMap,Xt=new WeakMap,or=new WeakMap,Ge=new WeakMap,Ps=new WeakMap,oi=new WeakMap,ai=new WeakMap,q=new WeakSet,Qc=function(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const r=this,i=r[t];delete r[t],r[t]=i},ky=function(t){var r,i,s;if(l(this,ze)!==t){if(E(this,ze,t),!this.isConnected){f(this,q,Vr).call(this);return}t?(E(this,oi,!0),setTimeout(()=>{E(this,oi,!1)},0),f(this,q,Vr).call(this),f(this,q,eu).call(this),f(this,q,sa).call(this)):(f(this,q,tu).call(this),(i=(r=l(this,Ge))==null?void 0:r.hidePopover)==null||i.call(r),f(this,q,Vr).call(this),(s=l(this,Xt))==null||s.focus(),this.dispatchEvent(new R2))}},sa=function(){l(this,ai)||(E(this,ai,!0),queueMicrotask(()=>{E(this,ai,!1),!(!l(this,ze)||!this.isConnected)&&(f(this,q,Ey).call(this),f(this,q,$y).call(this))}))},Ey=function(){var t,r;if(l(this,Ge)){try{(r=(t=l(this,Ge)).showPopover)==null||r.call(t)}catch{}f(this,q,oa).call(this)}},eu=function(){document.addEventListener("click",l(this,Rs)),document.addEventListener("keydown",l(this,Ds),!0),window.addEventListener("resize",l(this,ar)),window.addEventListener("scroll",l(this,ar),!0)},tu=function(){document.removeEventListener("click",l(this,Rs)),document.removeEventListener("keydown",l(this,Ds),!0),window.removeEventListener("resize",l(this,ar)),window.removeEventListener("scroll",l(this,ar),!0)},Rs=new WeakMap,Ds=new WeakMap,ar=new WeakMap,xy=function(t){const r=f(this,q,nu).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=f(this,q,Ay).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(!l(this,Ge))return[];const t=l(this,Ge).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(Ef)&&r.push(i);for(const s of i.querySelectorAll(Ef))r.push(s)}return r},Ay=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=f(this,q,nu).call(this);t.length>0?t[0].focus():(r=l(this,Ge))==null||r.focus()},oa=function(){if(!l(this,ze)||!l(this,Xt)||!l(this,Ge))return;const t=l(this,Xt).getBoundingClientRect(),r=l(this,Ge).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+dc,a=s<o&&t.top>o?"top-start":"bottom-start";E(this,Ps,a);const c=a==="bottom-start"?t.bottom+dc:t.top-r.height-dc,u=t.left;l(this,Ge).style.transform=`translate(${u}px, ${c}px)`,l(this,Ge).setAttribute("data-placement",a)},Vr=function(){this.toggleAttribute("open",l(this,ze));const t=this.getAttribute("material")??"paper";Fe(l(this,ze)?N`<div
81
81
  class="panel"
82
82
  part="panel"
83
83
  popover="manual"
@@ -88,8 +88,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
88
88
  level="1"
89
89
  >
90
90
  <slot></slot>
91
- </div>`:ee,l(this,or)),E(this,Ge,l(this,or).querySelector(".panel"))},b(Sy,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",Sy);class $y extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class P2 extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var je,mt,mn,vn,oe,Ls,zs,z,Ty,Ji,Cy,Py,nu,Ry,Qi,Zn,lr,Os,Da,Ms,La,Dy,Ly,ru,es,iu,su,Zt;class Iy extends HTMLElement{constructor(){super();w(this,z);w(this,je,!1);w(this,mt,null);w(this,mn,null);w(this,vn);w(this,oe,null);w(this,Ls,on());w(this,zs,new MutationObserver(t=>f(this,z,Dy).call(this,t)));w(this,lr,()=>{f(this,z,Qi).call(this,!l(this,je))});w(this,Os,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),l(this,lr).call(this))});w(this,Da,()=>{l(this,je)&&f(this,z,Qi).call(this,!1)});w(this,Ms,t=>{t instanceof $y&&(t.stopPropagation(),E(this,je,!1),f(this,z,Ji).call(this,t.value),f(this,z,Zt).call(this),this.dispatchEvent(new P2(t.value)))});w(this,La,()=>{f(this,z,ru).call(this)});E(this,vn,this.attachShadow({mode:"open"})),gy(l(this,vn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Ms)),f(this,z,Ty).call(this),l(this,zs).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),f(this,z,Zt).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Ms)),l(this,zs).disconnect(),f(this,z,su).call(this)}attributeChangedCallback(t){if(t==="open"){f(this,z,Qi).call(this,this.hasAttribute("open"));return}f(this,z,Zt).call(this)}get open(){return l(this,je)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get value(){return l(this,mt)}set value(t){t===null?(f(this,z,Zn).call(this,null,null),f(this,z,Cy).call(this)):f(this,z,Ji).call(this,t),f(this,z,Zt).call(this)}close(){f(this,z,Qi).call(this,!1)}}je=new WeakMap,mt=new WeakMap,mn=new WeakMap,vn=new WeakMap,oe=new WeakMap,Ls=new WeakMap,zs=new WeakMap,z=new WeakSet,Ty=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&f(this,z,Zn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},Ji=function(t){var r;for(const i of l(this,z,nu))i.value===t?(f(this,z,Zn).call(this,t,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},Cy=function(){const t=this.querySelectorAll("dropdown-item[selected]");for(const r of t)r.removeAttribute("selected")},Py=function(t){for(const r of l(this,z,nu))if(r.value===t)return r;return null},nu=function(){return this.querySelectorAll("dropdown-item")},Ry=function(){return l(this,mn)??this.title},Qi=function(t){l(this,je)!==t&&(E(this,je,t),f(this,z,Zt).call(this))},Zn=function(t,r){E(this,mt,t),E(this,mn,r)},lr=new WeakMap,Os=new WeakMap,Da=new WeakMap,Ms=new WeakMap,La=new WeakMap,Dy=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||f(this,z,Ly).call(this)},Ly=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=l(this,mt)!==s||l(this,mn)!==o;f(this,z,Zn).call(this,s,o),f(this,z,Ji).call(this,s),a?f(this,z,Zt).call(this):f(this,z,es).call(this);return}if(l(this,mt)!==null){const s=f(this,z,Py).call(this,l(this,mt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,mn)!==o;f(this,z,Zn).call(this,l(this,mt),o),f(this,z,Ji).call(this,l(this,mt)),a?f(this,z,Zt).call(this):f(this,z,es).call(this);return}}if(l(this,mt)!==null||l(this,mn)!==null){f(this,z,Zn).call(this,null,null),f(this,z,Zt).call(this);return}f(this,z,es).call(this)},ru=function(){const t=l(this,vn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;l(this,oe)!==r&&(f(this,z,su).call(this),E(this,oe,r),l(this,oe)&&(l(this,oe).addEventListener("click",l(this,lr)),l(this,oe)instanceof HTMLButtonElement?l(this,oe).hasAttribute("type")||(l(this,oe).type="button"):(l(this,oe).hasAttribute("role")||l(this,oe).setAttribute("role","button"),l(this,oe).hasAttribute("tabindex")||(l(this,oe).tabIndex=0),l(this,oe).addEventListener("keydown",l(this,Os))))),f(this,z,es).call(this),f(this,z,iu).call(this)},es=function(){l(this,oe)&&(l(this,oe).setAttribute("data-dropdown-trigger",""),l(this,oe).setAttribute("aria-haspopup","listbox"),l(this,oe).setAttribute("aria-expanded",l(this,je)?"true":"false"))},iu=function(){const t=l(this,Ls).value;if(!t)return;const r=l(this,vn).querySelector("button.fallback-trigger");t.anchor=l(this,oe)??r??null},su=function(){l(this,oe)&&(l(this,oe).removeEventListener("click",l(this,lr)),l(this,oe).removeEventListener("keydown",l(this,Os)),l(this,oe).removeAttribute("data-dropdown-trigger"),l(this,oe).removeAttribute("aria-haspopup"),l(this,oe).removeAttribute("aria-expanded"),E(this,oe,null))},Zt=function(){this.toggleAttribute("open",l(this,je)),Fe(N`
92
- <slot name="trigger" @slotchange=${l(this,La)}>
91
+ </div>`:ee,l(this,or)),E(this,Ge,l(this,or).querySelector(".panel"))},b(_y,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",_y);class Iy extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class D2 extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var je,mt,mn,vn,oe,Ls,zs,z,Cy,Qi,Py,Ry,ru,Dy,es,Zn,lr,Os,La,Ms,za,Ly,zy,iu,ts,su,ou,Zt;class Ty extends HTMLElement{constructor(){super();w(this,z);w(this,je,!1);w(this,mt,null);w(this,mn,null);w(this,vn);w(this,oe,null);w(this,Ls,on());w(this,zs,new MutationObserver(t=>f(this,z,Ly).call(this,t)));w(this,lr,()=>{f(this,z,es).call(this,!l(this,je))});w(this,Os,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),l(this,lr).call(this))});w(this,La,()=>{l(this,je)&&f(this,z,es).call(this,!1)});w(this,Ms,t=>{t instanceof Iy&&(t.stopPropagation(),E(this,je,!1),f(this,z,Qi).call(this,t.value),f(this,z,Zt).call(this),this.dispatchEvent(new D2(t.value)))});w(this,za,()=>{f(this,z,iu).call(this)});E(this,vn,this.attachShadow({mode:"open"})),my(l(this,vn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Ms)),f(this,z,Cy).call(this),l(this,zs).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),f(this,z,Zt).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Ms)),l(this,zs).disconnect(),f(this,z,ou).call(this)}attributeChangedCallback(t){if(t==="open"){f(this,z,es).call(this,this.hasAttribute("open"));return}f(this,z,Zt).call(this)}get open(){return l(this,je)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get value(){return l(this,mt)}set value(t){t===null?(f(this,z,Zn).call(this,null,null),f(this,z,Py).call(this)):f(this,z,Qi).call(this,t),f(this,z,Zt).call(this)}close(){f(this,z,es).call(this,!1)}}je=new WeakMap,mt=new WeakMap,mn=new WeakMap,vn=new WeakMap,oe=new WeakMap,Ls=new WeakMap,zs=new WeakMap,z=new WeakSet,Cy=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&f(this,z,Zn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},Qi=function(t){var r;for(const i of l(this,z,ru))i.value===t?(f(this,z,Zn).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")},Ry=function(t){for(const r of l(this,z,ru))if(r.value===t)return r;return null},ru=function(){return this.querySelectorAll("dropdown-item")},Dy=function(){return l(this,mn)??this.title},es=function(t){l(this,je)!==t&&(E(this,je,t),f(this,z,Zt).call(this))},Zn=function(t,r){E(this,mt,t),E(this,mn,r)},lr=new WeakMap,Os=new WeakMap,La=new WeakMap,Ms=new WeakMap,za=new WeakMap,Ly=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||f(this,z,zy).call(this)},zy=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=l(this,mt)!==s||l(this,mn)!==o;f(this,z,Zn).call(this,s,o),f(this,z,Qi).call(this,s),a?f(this,z,Zt).call(this):f(this,z,ts).call(this);return}if(l(this,mt)!==null){const s=f(this,z,Ry).call(this,l(this,mt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,mn)!==o;f(this,z,Zn).call(this,l(this,mt),o),f(this,z,Qi).call(this,l(this,mt)),a?f(this,z,Zt).call(this):f(this,z,ts).call(this);return}}if(l(this,mt)!==null||l(this,mn)!==null){f(this,z,Zn).call(this,null,null),f(this,z,Zt).call(this);return}f(this,z,ts).call(this)},iu=function(){const t=l(this,vn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;l(this,oe)!==r&&(f(this,z,ou).call(this),E(this,oe,r),l(this,oe)&&(l(this,oe).addEventListener("click",l(this,lr)),l(this,oe)instanceof HTMLButtonElement?l(this,oe).hasAttribute("type")||(l(this,oe).type="button"):(l(this,oe).hasAttribute("role")||l(this,oe).setAttribute("role","button"),l(this,oe).hasAttribute("tabindex")||(l(this,oe).tabIndex=0),l(this,oe).addEventListener("keydown",l(this,Os))))),f(this,z,ts).call(this),f(this,z,su).call(this)},ts=function(){l(this,oe)&&(l(this,oe).setAttribute("data-dropdown-trigger",""),l(this,oe).setAttribute("aria-haspopup","listbox"),l(this,oe).setAttribute("aria-expanded",l(this,je)?"true":"false"))},su=function(){const t=l(this,Ls).value;if(!t)return;const r=l(this,vn).querySelector("button.fallback-trigger");t.anchor=l(this,oe)??r??null},ou=function(){l(this,oe)&&(l(this,oe).removeEventListener("click",l(this,lr)),l(this,oe).removeEventListener("keydown",l(this,Os)),l(this,oe).removeAttribute("data-dropdown-trigger"),l(this,oe).removeAttribute("aria-haspopup"),l(this,oe).removeAttribute("aria-expanded"),E(this,oe,null))},Zt=function(){this.toggleAttribute("open",l(this,je)),Fe(N`
92
+ <slot name="trigger" @slotchange=${l(this,za)}>
93
93
  <button
94
94
  class="fallback-trigger"
95
95
  part="trigger"
@@ -98,9 +98,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
98
98
  aria-expanded=${l(this,je)?"true":"false"}
99
99
  @click=${l(this,lr)}
100
100
  >
101
- <span class="trigger-label" part="trigger-label">${l(this,z,Ry)}</span>
101
+ <span class="trigger-label" part="trigger-label">${l(this,z,Dy)}</span>
102
102
  <span class="trigger-icon" part="trigger-icon" aria-hidden="true">
103
- ${wy({size:16})}
103
+ ${Sy({size:16})}
104
104
  </span>
105
105
  </button>
106
106
  </slot>
@@ -108,20 +108,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
108
108
  class="dropdown-popover"
109
109
  material="glass-frosted"
110
110
  ?open=${l(this,je)}
111
- @close=${l(this,Da)}
111
+ @close=${l(this,La)}
112
112
  ${an(l(this,Ls))}
113
113
  >
114
114
  ${l(this,je)?N`<div class="dropdown-list" part="list" role="listbox">
115
115
  <slot></slot>
116
116
  </div>`:ee}
117
117
  </ui-popover>
118
- `,l(this,vn)),f(this,z,iu).call(this),queueMicrotask(()=>f(this,z,ru).call(this))},b(Iy,"observedAttributes",["title","open"]);class R2 extends HTMLElement{}class D2 extends HTMLElement{}class L2 extends HTMLElement{}var _r,ou,Oy,Ns,Us;class zy extends HTMLElement{constructor(){super(...arguments);w(this,_r);w(this,Ns,()=>{this.action||f(this,_r,Oy).call(this)});w(this,Us,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",l(this,Ns)),this.addEventListener("keydown",l(this,Us)),f(this,_r,ou).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Ns)),this.removeEventListener("keydown",l(this,Us))}attributeChangedCallback(){f(this,_r,ou).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}_r=new WeakSet,ou=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")},Oy=function(){this.dispatchEvent(new $y(this.value))},Ns=new WeakMap,Us=new WeakMap,b(zy,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",Iy);customElements.get("dropdown-group")||customElements.define("dropdown-group",R2);customElements.get("dropdown-label")||customElements.define("dropdown-label",D2);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",L2);customElements.get("dropdown-item")||customElements.define("dropdown-item",zy);class z2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Fs,In,au,za,Zs,lu;class My extends HTMLElement{constructor(){super();w(this,In);w(this,Fs);w(this,za,t=>{t.target===t.currentTarget&&f(this,In,au).call(this)});w(this,Zs,t=>{this.open&&t.key==="Escape"&&f(this,In,au).call(this)});E(this,Fs,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Zs)),f(this,In,lu).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Zs))}attributeChangedCallback(){f(this,In,lu).call(this)}get open(){return this.hasAttribute("open")}}Fs=new WeakMap,In=new WeakSet,au=function(){this.dispatchEvent(new z2)},za=new WeakMap,Zs=new WeakMap,lu=function(){Fe(N`
118
+ `,l(this,vn)),f(this,z,su).call(this),queueMicrotask(()=>f(this,z,iu).call(this))},b(Ty,"observedAttributes",["title","open"]);class L2 extends HTMLElement{}class z2 extends HTMLElement{}class O2 extends HTMLElement{}var _r,au,My,Ns,Us;class Oy extends HTMLElement{constructor(){super(...arguments);w(this,_r);w(this,Ns,()=>{this.action||f(this,_r,My).call(this)});w(this,Us,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",l(this,Ns)),this.addEventListener("keydown",l(this,Us)),f(this,_r,au).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Ns)),this.removeEventListener("keydown",l(this,Us))}attributeChangedCallback(){f(this,_r,au).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}_r=new WeakSet,au=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")},My=function(){this.dispatchEvent(new Iy(this.value))},Ns=new WeakMap,Us=new WeakMap,b(Oy,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",Ty);customElements.get("dropdown-group")||customElements.define("dropdown-group",L2);customElements.get("dropdown-label")||customElements.define("dropdown-label",z2);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",O2);customElements.get("dropdown-item")||customElements.define("dropdown-item",Oy);class M2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Fs,In,lu,Oa,Zs,cu;class Ny extends HTMLElement{constructor(){super();w(this,In);w(this,Fs);w(this,Oa,t=>{t.target===t.currentTarget&&f(this,In,lu).call(this)});w(this,Zs,t=>{this.open&&t.key==="Escape"&&f(this,In,lu).call(this)});E(this,Fs,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Zs)),f(this,In,cu).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Zs))}attributeChangedCallback(){f(this,In,cu).call(this)}get open(){return this.hasAttribute("open")}}Fs=new WeakMap,In=new WeakSet,lu=function(){this.dispatchEvent(new M2)},Oa=new WeakMap,Zs=new WeakMap,cu=function(){Fe(N`
119
119
  ${this.open?N`
120
- <div class="backdrop" part="backdrop" @click=${l(this,za)}>
120
+ <div class="backdrop" part="backdrop" @click=${l(this,Oa)}>
121
121
  <slot></slot>
122
122
  </div>
123
123
  `:null}
124
- `,l(this,Fs))},b(My,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",My);class O2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class M2 extends HTMLElement{}var Hs,Ws,cu;class Ny extends HTMLElement{constructor(){super();w(this,Ws);w(this,Hs);E(this,Hs,this.attachShadow({mode:"open"}))}connectedCallback(){f(this,Ws,cu).call(this)}attributeChangedCallback(){f(this,Ws,cu).call(this)}get closable(){return this.hasAttribute("closable")}}Hs=new WeakMap,Ws=new WeakSet,cu=function(){const t=this.querySelector("panel-page");Fe(N`
124
+ `,l(this,Fs))},b(Ny,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Ny);class N2 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class U2 extends HTMLElement{}var Hs,Ws,uu;class Uy extends HTMLElement{constructor(){super();w(this,Ws);w(this,Hs);E(this,Hs,this.attachShadow({mode:"open"}))}connectedCallback(){f(this,Ws,uu).call(this)}attributeChangedCallback(){f(this,Ws,uu).call(this)}get closable(){return this.hasAttribute("closable")}}Hs=new WeakMap,Ws=new WeakSet,uu=function(){const t=this.querySelector("panel-page");Fe(N`
125
125
  <section class="panel" part="panel">
126
126
  <header class="title-bar" part="header">
127
127
  <h2 class="title" part="title">${(t==null?void 0:t.getAttribute("title"))??""}</h2>
@@ -131,16 +131,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
131
131
  class="title-button"
132
132
  part="button close-button"
133
133
  aria-label="Close"
134
- @click=${()=>this.dispatchEvent(new O2)}
134
+ @click=${()=>this.dispatchEvent(new N2)}
135
135
  >
136
- <span class="close-icon" part="icon close-icon">${by({size:16})}</span>
136
+ <span class="close-icon" part="icon close-icon">${wy({size:16})}</span>
137
137
  </button>
138
138
  `:null}
139
139
  </header>
140
140
  <slot></slot>
141
141
  </section>
142
- `,l(this,Hs))},b(Ny,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Ny);customElements.get("panel-page")||customElements.define("panel-page",M2);function gl(n){return typeof n=="object"&&n!==null}function N2(n){return!gl(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function U2(n){return!gl(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function F2(n){return!gl(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function Uy(n){return!gl(n)||n.type!=="open-artifact"||typeof n.artifactID!="string"?!1:!("id"in n)}function Z2(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",u=>{const h=u;e=h.clientX,t=h.clientY,n.parent.postMessage({type:"wheel",deltaX:h.deltaX,deltaY:h.deltaY,shiftKey:h.shiftKey},"*"),h.preventDefault()},{passive:!1});const r=8,i=100,s=1e3,o=new Map;n.addEventListener("pointerdown",u=>{const h=u;h.pointerType==="touch"&&o.set(h.pointerId,{startX:h.clientX,startY:h.clientY,lastX:h.clientX,offset:0,active:!1,discarded:!1,samples:[{time:h.timeStamp,offset:0}]})},{passive:!0}),n.addEventListener("pointermove",u=>{const h=u,p=o.get(h.pointerId);if(!p||p.discarded)return;if(!p.active){const _=h.clientX-p.startX,C=h.clientY-p.startY,U=Math.abs(_),P=Math.abs(C);if(U<r&&P<r)return;if(P>=U){p.discarded=!0;return}p.active=!0}const v=h.clientX-p.lastX;p.lastX=h.clientX,p.offset+=v,p.samples.push({time:h.timeStamp,offset:p.offset});const m=h.timeStamp-i;let x=0;for(let _=0;_<p.samples.length;_+=1){if(p.samples[_].time>=m){x=_;break}x=_+1}if(x>0){const _=Math.max(0,x-1);p.samples.splice(0,_)}n.parent.postMessage({type:"swipe-move",deltaX:v},"*"),h.preventDefault()},{passive:!1}),n.addEventListener("pointerup",u=>{const h=u,p=o.get(h.pointerId);if(!p||(o.delete(h.pointerId),!p.active))return;let v=0;if(p.samples.length>=2){const m=p.samples[0],x=p.samples[p.samples.length-1],_=x.time-m.time;_>0&&(v=(x.offset-m.offset)/_*s)}n.parent.postMessage({type:"swipe-end",velocityX:v},"*")}),n.addEventListener("pointercancel",u=>{const h=u,p=o.get(h.pointerId);p&&(o.delete(h.pointerId),p.active&&n.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),n.addEventListener("message",u=>{var _,C;const h=u.data;if(h===null||typeof h!="object"||h.type!=="scroll")return;const p=h,v=typeof p.deltaX=="number"?p.deltaX:0,m=typeof p.deltaY=="number"?p.deltaY:0;let x=((C=(_=n.document).elementFromPoint)==null?void 0:C.call(_,e,t))??null;for(;x!==null;){const U=n.getComputedStyle(x);if(m!==0){const P=(U.overflowY==="auto"||U.overflowY==="scroll")&&x.scrollHeight>x.clientHeight,B=m>0?x.scrollTop+x.clientHeight<x.scrollHeight:x.scrollTop>0;if(P&&B){x.scrollBy(v,m);return}}if(v!==0){const P=(U.overflowX==="auto"||U.overflowX==="scroll")&&x.scrollWidth>x.clientWidth,B=v>0?x.scrollLeft+x.clientWidth<x.scrollWidth:x.scrollLeft>0;if(P&&B){x.scrollBy(v,m);return}}x=x.parentElement}n.scrollBy(v,m)});function a(u){if(typeof u!="string")return!1;let h;try{h=new URL(u)}catch{return!1}if(h.protocol!=="artifact:")return!1;const p=h.hostname||h.pathname.replace(/^\/+/,"");return p===""?!1:(n.parent.postMessage({type:"open-artifact",artifactID:p},"*"),!0)}n.document.addEventListener("click",u=>{const h=u,p=typeof h.composedPath=="function"?h.composedPath():[];let v=null;for(const _ of p)if(_ instanceof HTMLAnchorElement||_&&_.tagName==="A"){v=_;break}if(v===null)return;const m=v.getAttribute("href");if(m===null)return;let x;try{x=new URL(m,n.document.baseURI).toString()}catch{return}a(x)&&u.preventDefault()},!0);const c=n.navigation;c&&c.addEventListener("navigate",u=>{var p;a((p=u.destination)==null?void 0:p.url)&&u.preventDefault()})}function H2(){return`(${Z2.toString()})(window);`}const W2=rt(),V2=rt(),B2="No handler registered for update-content",G2="handleUpdateContent: handler already registered";function j2(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const q2=fo(zt);var ai,li,ci,cr,ur,Vs,Pe,uu,Fy,Zy,ts,hu,tg;let Y2=(tg=class extends q2{constructor(t){super();w(this,Pe);w(this,ai);w(this,li);w(this,ci);w(this,cr,null);w(this,ur,null);w(this,Vs,!1);E(this,ai,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");E(this,li,r),E(this,ci,i=>f(this,Pe,Fy).call(this,i)),l(this,li).addEventListener("message",l(this,ci))}get content(){return l(this,ur)}set content(t){f(this,Pe,hu).call(this),E(this,ur,t),l(this,Vs)&&f(this,Pe,uu).call(this,t)}handleUpdateContent(t){if(f(this,Pe,hu).call(this),l(this,cr)!==null)throw new Error(G2);E(this,cr,t)}dispose(){l(this,li).removeEventListener("message",l(this,ci)),E(this,cr,null)}},ai=new WeakMap,li=new WeakMap,ci=new WeakMap,cr=new WeakMap,ur=new WeakMap,Vs=new WeakMap,Pe=new WeakSet,uu=function(t){const r={type:"content-updated",content:t};f(this,Pe,ts).call(this,r)},Fy=function(t){if(this.disposed||t.source!==l(this,ai).contentWindow)return;const r=t.data;if(ZT(r)){E(this,Vs,!0),this.dispatchEvent(new W2("ready")),l(this,ur)!==null&&f(this,Pe,uu).call(this,l(this,ur));return}if(HT(r)){f(this,Pe,Zy).call(this,r);return}if(Uy(r)){this.dispatchEvent(new V2("open-artifact",{artifactID:r.artifactID}));return}},Zy=async function(t){const r=l(this,cr);if(r===null){f(this,Pe,ts).call(this,{type:"response",id:t.id,error:{message:B2}});return}try{await r(t.content)}catch(i){if(this.disposed)return;f(this,Pe,ts).call(this,{type:"response",id:t.id,error:{message:j2(i)}});return}this.disposed||f(this,Pe,ts).call(this,{type:"response",id:t.id,result:{}})},ts=function(t){const r=l(this,ai).contentWindow;r&&r.postMessage(t,"*")},hu=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},tg);async function X2(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=H2(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
143
- ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const Ef="television-artifact-bridge",Hy=rt(),K2=rt();class J2 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,"_subscribedWebview",null);b(this,"_directRenderMessageListener",null);b(this,"handleScreenContentChanged",t=>{!this._artifact||t.artifactID!==this._artifact.id||this._activeView!==null&&this.refetchContent()});b(this,"handleOpenArtifact",t=>{this.requestFocus(t.artifactID)});b(this,"handleIframeMessage",t=>{const r=this.querySelector("iframe.artifact-frame");!r||r.contentWindow!==t.source||N2(t.data)&&this.dispatchArtifactWheel({deltaX:t.data.deltaX,deltaY:t.data.deltaY,shiftKey:t.data.shiftKey},i=>{var o;const s={type:"scroll",deltaX:0,deltaY:i};(o=r.contentWindow)==null||o.postMessage(s,this.iframeTargetOrigin(r))})});b(this,"handleWebviewIpcMessage",t=>{var o;const r=t.detail??t;if(!r||r.channel!==Ef)return;const i=(o=r.args)==null?void 0:o[0];if(!i||i.type!=="wheel")return;const s=this._subscribedWebview;s&&this.dispatchArtifactWheel({deltaX:i.deltaX??0,deltaY:i.deltaY??0,shiftKey:i.shiftKey??!1},a=>{var c;(c=s.send)==null||c.call(s,Ef,{type:"scroll",deltaX:0,deltaY:a})})})}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(),window.addEventListener("message",this.handleIframeMessage)}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen(),window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview()}handleClose(){this._artifact&&this.dispatchEvent(new Hy("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){var t,r;if(this.isConnected){if((t=this._artifact)!=null&&t.externalURL){this.teardownView(),this._contentState={kind:"ready"},this.render();return}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 i=this.querySelector("iframe.artifact-frame");if(!i){this._contentState={kind:"error"},this.render();return}this._activeView=new Y2(i),this._activeView.handleUpdateContent(async s=>{await this.saveContent(s)}),this._activeView.addEventListener("open-artifact",this.handleOpenArtifact),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(),this.installDirectRenderMessageListener(),((r=this._artifact)==null?void 0:r.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 X2(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.removeEventListener("open-artifact",this.handleOpenArtifact),this._activeView.dispose(),this._activeView=null),this.removeDirectRenderMessageListener(),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}installDirectRenderMessageListener(){if(this._directRenderMessageListener!==null)return;const t=r=>{const i=this.querySelector("iframe.artifact-frame");i&&r.source===i.contentWindow&&Uy(r.data)&&this.requestFocus(r.data.artifactID)};this._directRenderMessageListener=t,window.addEventListener("message",t)}removeDirectRenderMessageListener(){this._directRenderMessageListener!==null&&(window.removeEventListener("message",this._directRenderMessageListener),this._directRenderMessageListener=null)}requestFocus(t){const r=this._screen;r&&r.server.client.viewer.focus({artifactID:t}).catch(i=>{console.warn("artifact-view: viewer.focus failed",i)})}contentTemplate(){var t;if((t=this._artifact)!=null&&t.externalURL){const r=this._artifact.externalURL;return gh()?N`
142
+ `,l(this,Hs))},b(Uy,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Uy);customElements.get("panel-page")||customElements.define("panel-page",U2);function ml(n){return typeof n=="object"&&n!==null}function F2(n){return!ml(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function Z2(n){return!ml(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function H2(n){return!ml(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function Fy(n){return!ml(n)||n.type!=="open-artifact"||typeof n.artifactID!="string"?!1:!("id"in n)}function W2(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",u=>{const h=u;e=h.clientX,t=h.clientY,n.parent.postMessage({type:"wheel",deltaX:h.deltaX,deltaY:h.deltaY,shiftKey:h.shiftKey},"*"),h.preventDefault()},{passive:!1});const r=8,i=100,s=1e3,o=new Map;n.addEventListener("pointerdown",u=>{const h=u;h.pointerType==="touch"&&o.set(h.pointerId,{startX:h.clientX,startY:h.clientY,lastX:h.clientX,offset:0,active:!1,discarded:!1,samples:[{time:h.timeStamp,offset:0}]})},{passive:!0}),n.addEventListener("pointermove",u=>{const h=u,p=o.get(h.pointerId);if(!p||p.discarded)return;if(!p.active){const _=h.clientX-p.startX,C=h.clientY-p.startY,U=Math.abs(_),P=Math.abs(C);if(U<r&&P<r)return;if(P>=U){p.discarded=!0;return}p.active=!0}const v=h.clientX-p.lastX;p.lastX=h.clientX,p.offset+=v,p.samples.push({time:h.timeStamp,offset:p.offset});const m=h.timeStamp-i;let x=0;for(let _=0;_<p.samples.length;_+=1){if(p.samples[_].time>=m){x=_;break}x=_+1}if(x>0){const _=Math.max(0,x-1);p.samples.splice(0,_)}n.parent.postMessage({type:"swipe-move",deltaX:v},"*"),h.preventDefault()},{passive:!1}),n.addEventListener("pointerup",u=>{const h=u,p=o.get(h.pointerId);if(!p||(o.delete(h.pointerId),!p.active))return;let v=0;if(p.samples.length>=2){const m=p.samples[0],x=p.samples[p.samples.length-1],_=x.time-m.time;_>0&&(v=(x.offset-m.offset)/_*s)}n.parent.postMessage({type:"swipe-end",velocityX:v},"*")}),n.addEventListener("pointercancel",u=>{const h=u,p=o.get(h.pointerId);p&&(o.delete(h.pointerId),p.active&&n.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),n.addEventListener("message",u=>{var _,C;const h=u.data;if(h===null||typeof h!="object"||h.type!=="scroll")return;const p=h,v=typeof p.deltaX=="number"?p.deltaX:0,m=typeof p.deltaY=="number"?p.deltaY:0;let x=((C=(_=n.document).elementFromPoint)==null?void 0:C.call(_,e,t))??null;for(;x!==null;){const U=n.getComputedStyle(x);if(m!==0){const P=(U.overflowY==="auto"||U.overflowY==="scroll")&&x.scrollHeight>x.clientHeight,B=m>0?x.scrollTop+x.clientHeight<x.scrollHeight:x.scrollTop>0;if(P&&B){x.scrollBy(v,m);return}}if(v!==0){const P=(U.overflowX==="auto"||U.overflowX==="scroll")&&x.scrollWidth>x.clientWidth,B=v>0?x.scrollLeft+x.clientWidth<x.scrollWidth:x.scrollLeft>0;if(P&&B){x.scrollBy(v,m);return}}x=x.parentElement}n.scrollBy(v,m)});function a(u){if(typeof u!="string")return!1;let h;try{h=new URL(u)}catch{return!1}if(h.protocol!=="artifact:")return!1;const p=h.hostname||h.pathname.replace(/^\/+/,"");return p===""?!1:(n.parent.postMessage({type:"open-artifact",artifactID:p},"*"),!0)}n.document.addEventListener("click",u=>{const h=u,p=typeof h.composedPath=="function"?h.composedPath():[];let v=null;for(const _ of p)if(_ instanceof HTMLAnchorElement||_&&_.tagName==="A"){v=_;break}if(v===null)return;const m=v.getAttribute("href");if(m===null)return;let x;try{x=new URL(m,n.document.baseURI).toString()}catch{return}a(x)&&u.preventDefault()},!0);const c=n.navigation;c&&c.addEventListener("navigate",u=>{var p;a((p=u.destination)==null?void 0:p.url)&&u.preventDefault()})}function V2(){return`(${W2.toString()})(window);`}const B2=rt(),G2=rt(),j2="No handler registered for update-content",q2="handleUpdateContent: handler already registered";function Y2(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const X2=fo(zt);var li,ci,ui,cr,ur,Vs,Re,hu,Zy,Hy,ns,du,ng;let K2=(ng=class extends X2{constructor(t){super();w(this,Re);w(this,li);w(this,ci);w(this,ui);w(this,cr,null);w(this,ur,null);w(this,Vs,!1);E(this,li,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");E(this,ci,r),E(this,ui,i=>f(this,Re,Zy).call(this,i)),l(this,ci).addEventListener("message",l(this,ui))}get content(){return l(this,ur)}set content(t){f(this,Re,du).call(this),E(this,ur,t),l(this,Vs)&&f(this,Re,hu).call(this,t)}handleUpdateContent(t){if(f(this,Re,du).call(this),l(this,cr)!==null)throw new Error(q2);E(this,cr,t)}dispose(){l(this,ci).removeEventListener("message",l(this,ui)),E(this,cr,null)}},li=new WeakMap,ci=new WeakMap,ui=new WeakMap,cr=new WeakMap,ur=new WeakMap,Vs=new WeakMap,Re=new WeakSet,hu=function(t){const r={type:"content-updated",content:t};f(this,Re,ns).call(this,r)},Zy=function(t){if(this.disposed||t.source!==l(this,li).contentWindow)return;const r=t.data;if(WT(r)){E(this,Vs,!0),this.dispatchEvent(new B2("ready")),l(this,ur)!==null&&f(this,Re,hu).call(this,l(this,ur));return}if(VT(r)){f(this,Re,Hy).call(this,r);return}if(Fy(r)){this.dispatchEvent(new G2("open-artifact",{artifactID:r.artifactID}));return}},Hy=async function(t){const r=l(this,cr);if(r===null){f(this,Re,ns).call(this,{type:"response",id:t.id,error:{message:j2}});return}try{await r(t.content)}catch(i){if(this.disposed)return;f(this,Re,ns).call(this,{type:"response",id:t.id,error:{message:Y2(i)}});return}this.disposed||f(this,Re,ns).call(this,{type:"response",id:t.id,result:{}})},ns=function(t){const r=l(this,li).contentWindow;r&&r.postMessage(t,"*")},du=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},ng);async function J2(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=V2(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
143
+ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const xf="television-artifact-bridge",Wy=rt(),Q2=rt();class eL 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,"_subscribedWebview",null);b(this,"_directRenderMessageListener",null);b(this,"handleScreenContentChanged",t=>{!this._artifact||t.artifactID!==this._artifact.id||this._activeView!==null&&this.refetchContent()});b(this,"handleOpenArtifact",t=>{this.requestFocus(t.artifactID)});b(this,"handleIframeMessage",t=>{const r=this.querySelector("iframe.artifact-frame");!r||r.contentWindow!==t.source||F2(t.data)&&this.dispatchArtifactWheel({deltaX:t.data.deltaX,deltaY:t.data.deltaY,shiftKey:t.data.shiftKey},i=>{var o;const s={type:"scroll",deltaX:0,deltaY:i};(o=r.contentWindow)==null||o.postMessage(s,this.iframeTargetOrigin(r))})});b(this,"handleWebviewIpcMessage",t=>{var o;const r=t.detail??t;if(!r||r.channel!==xf)return;const i=(o=r.args)==null?void 0:o[0];if(!i||i.type!=="wheel")return;const s=this._subscribedWebview;s&&this.dispatchArtifactWheel({deltaX:i.deltaX??0,deltaY:i.deltaY??0,shiftKey:i.shiftKey??!1},a=>{var c;(c=s.send)==null||c.call(s,xf,{type:"scroll",deltaX:0,deltaY:a})})})}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(),window.addEventListener("message",this.handleIframeMessage)}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen(),window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview()}handleClose(){this._artifact&&this.dispatchEvent(new Wy("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){var t,r;if(this.isConnected){if((t=this._artifact)!=null&&t.externalURL){this.teardownView(),this._contentState={kind:"ready"},this.render();return}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 i=this.querySelector("iframe.artifact-frame");if(!i){this._contentState={kind:"error"},this.render();return}this._activeView=new K2(i),this._activeView.handleUpdateContent(async s=>{await this.saveContent(s)}),this._activeView.addEventListener("open-artifact",this.handleOpenArtifact),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(),this.installDirectRenderMessageListener(),((r=this._artifact)==null?void 0:r.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 J2(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.removeEventListener("open-artifact",this.handleOpenArtifact),this._activeView.dispose(),this._activeView=null),this.removeDirectRenderMessageListener(),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}installDirectRenderMessageListener(){if(this._directRenderMessageListener!==null)return;const t=r=>{const i=this.querySelector("iframe.artifact-frame");i&&r.source===i.contentWindow&&Fy(r.data)&&this.requestFocus(r.data.artifactID)};this._directRenderMessageListener=t,window.addEventListener("message",t)}removeDirectRenderMessageListener(){this._directRenderMessageListener!==null&&(window.removeEventListener("message",this._directRenderMessageListener),this._directRenderMessageListener=null)}requestFocus(t){const r=this._screen;r&&r.server.client.viewer.focus({artifactID:t}).catch(i=>{console.warn("artifact-view: viewer.focus failed",i)})}contentTemplate(){var t;if((t=this._artifact)!=null&&t.externalURL){const r=this._artifact.externalURL;return mh()?N`
144
144
  <webview
145
145
  class="artifact-frame artifact-content"
146
146
  src=${r}
@@ -170,7 +170,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
170
170
  ${this.contentTemplate()}
171
171
  <footer class="artifact-title-bar" drag-handle material="glass-frosted">
172
172
  <div class="artifact-title-group">
173
- <span class="artifact-title-icon">${k2({size:16})}</span>
173
+ <span class="artifact-title-icon">${x2({size:16})}</span>
174
174
  <span class="artifact-title">${t.title}</span>
175
175
  </div>
176
176
  <button
@@ -180,10 +180,10 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
180
180
  @click=${()=>this.handleClose()}
181
181
  aria-label="Close"
182
182
  >
183
- ${by({size:16})}
183
+ ${wy({size:16})}
184
184
  </button>
185
185
  </footer>
186
- `}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Fe(this.template(),this),this.syncWebviewSubscription())}dispatchArtifactWheel(t,r){this.dispatchEvent(new K2("artifact-wheel",{bubbles:!0,composed:!0,deltaX:t.deltaX,deltaY:t.deltaY,shiftKey:t.shiftKey,scrollNative:r}))}syncWebviewSubscription(){const t=this.querySelector("webview");t!==this._subscribedWebview&&(this.unsubscribeFromWebview(),t&&(t.addEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=t))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=null)}iframeTargetOrigin(t){const r=t.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=t.getAttribute("src")??t.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}}customElements.define("artifact-view",J2);const _e=n=>({type:"px",...n}),Ce=n=>({type:"unit",...n}),Zo=2;class Q2{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??_e({x:ce,y:ce});const t=this._viewport.x??vr,r=this._viewport.y??ya,i=this._gap.x??ce,s=this._gap.y??ce,o=t<=Ax,a=o?t-i*Zo:Math.min(vr,t-i*Zo),c=o?r-s*Zo:Math.min(ya,r-s*Zo),u=(a-i*(bt-1))/bt,h=(c-s*(nt-1))/nt,p=this.basis.x??0,v=this.basis.y??0,m=this.min.x??0,x=this.min.y??0;this._unit=_e(o?{x:Math.max(m,u),y:Math.max(x,h)}:{x:Math.max(m,Math.min(p,u)),y:Math.max(x,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return Ce({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??ce,s=this._gap.y??ce,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 _e({x:o,y:a})}}const wr=1e-4,et=1e-6,eL=40,tL=24;function Wy(n,e){return Math.max(0,n-e*2)}function Vy(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function By(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+ce)}return e}function Gy(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+ce+o;if(a>t+wr)break;r=a,i+=1}return Math.max(1,i)}function nL(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+ce+o;if(a>t+wr)break;r=a,i+=1}return Math.max(1,i)}function rL(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+ce+s;if(o>e+wr)break;t=o,r+=1}return Math.max(1,r)}function wh(n,e){if(n.length===0)return 0;const t=rL(n,e);return Math.max(0,n.length-t)}function xf(n,e,t){if(n.length===0)return 0;const r=Gy(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)*ce}function du(n,e,t){const r=n[e]??0;return t-r}function Br(n,e,t,r,i){if(n.length===0)return 0;const s=wh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let c=0;for(let V=0;V<s;V+=1){const F=e[V]??0,he=e[V+1]??F;if(a>=F&&a<=he+wr){c=V;break}c=V+1}const u=Math.min(c+1,s),h=e[c]??0,p=e[u]??h,v=Math.max(p-h,wr),m=u===c?0:(a-h)/v,x=By(n),_=xf(n,c,i),C=xf(n,u,i),U=(r-_)/2,P=(r-C)/2,B=du(x,c,U),L=du(x,u,P);return B+(L-B)*m}function Af(n,e,t,r,i){const s=wh(n,r),o=e[s]??0;let a=0,c=o;for(let u=0;u<eL;u+=1){const h=(a+c)/2;Br(n,e,h,t,r)>i?a=h:c=h}return(a+c)/2}function $f(n,e,t){const r=By(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ce,c=(t-a)/2;return du(r,i,c)}function iL(n,e,t){const r=Gy(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function sL(n,e,t){const r=nL(n,e,t);return[Math.max(0,e-r+1),e]}function oL(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)<=et||(e.add(i),t.push(r))}return t}function aL(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??ce,s=Wy(r,i),o=Vy(e),a=wh(t,s),c=o[a]??0,u=[];for(let h=0;h<=a;h+=1){const p=iL(t,h,s),v=$f(t,p,r),m=Af(t,o,r,s,v);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,m))})}for(let h=t.length-1;h>=0;h-=1){const p=sL(t,h,s),v=`${p[0]}:${p[1]}`;if(u.some(_=>`${_.nodeRange[0]}:${_.nodeRange[1]}`===v))continue;const m=$f(t,p,r),x=Af(t,o,r,s,m);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,x))})}return u.sort((h,p)=>Math.abs(h.anchor-p.anchor)>et?h.anchor-p.anchor:h.nodeRange[0]!==p.nodeRange[0]?h.nodeRange[0]-p.nodeRange[0]:h.nodeRange[1]-p.nodeRange[1]),{viewspans:oL(u),minScroll:0,maxScroll:c}}function dc(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+et<r){r=o,t=s;continue}Math.abs(o-r)<=et&&s<t&&(t=s)}return t}function lL(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function Nr(n,e,t){return Math.max(e,Math.min(t,n))}function cL(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)<=et)return r;return-1}function uL(n,e,t){var i,s,o,a;if(n.length===0)return e;const r=cL(n,e);if(r>=0){const c=n[r];if(!c)return e;if(t>0){const v=c.nodeRange[0]+1,m=n.filter(_=>_.nodeRange[0]===v);if(m.length===0)return((i=n[n.length-1])==null?void 0:i.anchor)??e;let x=m[0];for(const _ of m)_.nodeRange[1]>x.nodeRange[1]&&(x=_);return x.anchor}const u=c.nodeRange[1]-1,h=n.filter(v=>v.nodeRange[1]===u);if(h.length===0)return((s=n[0])==null?void 0:s.anchor)??e;let p=h[0];for(const v of h)v.nodeRange[0]<p.nodeRange[0]&&(p=v);return p.anchor}if(t>0){for(const c of n)if(c.anchor>e+et)return c.anchor;return((o=n[n.length-1])==null?void 0:o.anchor)??e}for(let c=n.length-1;c>=0;c-=1){const u=n[c];if(u&&u.anchor<e-et)return u.anchor}return((a=n[0])==null?void 0:a.anchor)??e}class hL extends zt{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 Ce({x:this._scroll})}get translate(){return _e({x:Br(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx)})}set scroll(t){const r=Nr(t.x??this._scroll,this.minScroll,this.maxScroll);Math.abs(r-this._scroll)<=et||(this._scroll=r,this.activeViewspanIndex=null,this.dispatchEvent(new Mr("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(Ce({x:u})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??ce,a=aL({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this.nodeWidthsPx=i,this.boundaryCols=Vy(r),this.viewportWidthPx=s,this.framedViewportWidthPx=Wy(s,o),this.viewspans=a.viewspans,this.minScroll=a.minScroll,this.maxScroll=a.maxScroll,this.activeViewspanIndex=null;const c=Nr(this._scroll,this.minScroll,this.maxScroll);Math.abs(c-this._scroll)>et&&(this._scroll=c,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}step(t){var a;if(this.viewspans.length===0)return;const r=this.activeViewspanIndex??dc(this.viewspans,this._scroll),i=lL(r,t,this.viewspans.length),s=((a=this.viewspans[i])==null?void 0:a.anchor)??this._scroll,o=Nr(s,this.minScroll,this.maxScroll);this.activeViewspanIndex=i,!(Math.abs(o-this._scroll)<=et)&&(this._scroll=o,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}snap(t){var s;if(this.viewspans.length===0)return;const r=t===void 0?((s=this.viewspans[dc(this.viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:uL(this.viewspans,this._scroll,t),i=Nr(r,this.minScroll,this.maxScroll);this.activeViewspanIndex=dc(this.viewspans,i),!(Math.abs(i-this._scroll)<=et)&&(this._scroll=i,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=Nr(this._scroll+(t.x??0),this.minScroll,this.maxScroll);this.activeViewspanIndex=null,!(Math.abs(r-this._scroll)<=et)&&(this._scroll=r,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=wr)return;this.activeViewspanIndex=null;const i=Br(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx),s=i-r,o=Br(this.nodeWidthsPx,this.boundaryCols,this.maxScroll,this.viewportWidthPx,this.framedViewportWidthPx),a=Br(this.nodeWidthsPx,this.boundaryCols,this.minScroll,this.viewportWidthPx,this.framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=wr)return;let u=this.minScroll,h=this.maxScroll;for(let v=0;v<tL;v+=1){const m=(u+h)/2;Br(this.nodeWidthsPx,this.boundaryCols,m,this.viewportWidthPx,this.framedViewportWidthPx)>c?u=m:h=m}const p=Nr((u+h)/2,this.minScroll,this.maxScroll);Math.abs(p-this._scroll)<=et||(this._scroll=p,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}}const pc={"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}},dL=["stack-above","stack-below","reorder-before","reorder-after"];function fc(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 Nn(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function pu(n){return Number.isFinite(n)?Math.max(us,Math.min(nh,Math.round(n))):us}function pL(n,e,t){const r=n.findIndex(a=>a.type==="card"&&a.id===e);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=pu(t);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function Sh(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 fu(n){return n.height===nt||n.height===En?{...n,height:En}:n}function gu(n){return n.height===En?{...n,height:nt}:n}function fL(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 c=[...n];if(a.length===1){const[h]=a;c[i]=h.type==="card"?gu(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,gu(o)),c}const gL=rt(),mL=rt(),vL=50;function yL(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 mo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function If(n){return n.map(wL)}function bL(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function wL(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(bL)}:n}function jy(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function Tf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function SL(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 _L(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&v.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=jy(r,e.nodeId);if(!a)return null;const c=fu(a),u=fu(o),h=mo(c),p=t.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function gc(n,e){return n.parentStackId?EL(n,e):kL(n,e)}function kL(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,mo(r)),i}if(t.type==="stack"){const r=SL(n,e);return r?_L(r,n,t,e)??[...e]:[...e]}return[...e]}function EL(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return xL(n,e,t.position);case"stack-child-extract":return AL(n,e,t.toIndex);case"stack-child-noop":return $L(n,e);default:return[...e]}}function xL(n,e,t){const r=e.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(v=>v.type==="card"))return[...e];const s=i.children,o=s.findIndex(v=>v.id===n.nodeId);if(o===-1)return[...e];const a=s[o],c=s.filter(v=>v.id!==n.nodeId),u=mo(a),h=t==="above"?[u,...c]:[...c,u],p=[...e];return p[r]={...i,children:h},p}function AL(n,e,t){if(!n.parentStackId)return[...e];const r=fL(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]=mo(s),o}function $L(n,e){const t=e.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(c=>c.type==="card"&&c.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]=mo(s),o[t]={...r,children:a},o}function IL(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:sl()}function TL(n,e,t){if(n.type==="drop-target"){const r=Sh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return fu(r)}return n}function CL(n,e,t){const r=n.children.map(s=>TL(s,e,t));return{id:IL(n,e),type:"stack",children:r}}function PL(n,e,t){if(n.type==="drop-target"){const r=Sh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return jy(e,t)!==null?r:gu(r)}return n.type==="card"||n.type==="row"?n:CL(n,e,t)}function RL(n,e,t){return n.map(r=>PL(r,e,t))}function DL(n,e){return JSON.stringify(n)===JSON.stringify(e)}const LL=fo(zt);class zL extends LL{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)>=Ix&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ne("change")));return}if(!this.active)return;const o=gc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&yL(this.active.hitTarget,a)&&this.active.lastReorderIndex===c||(this.active={...this.active,pointerX:r,pointerY:i,hitTarget:a,lastReorderIndex:c},this.emitDrag(),this.dispatchEvent(new ne("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=gc(this.active,t),s=RL(i,t,this.active.nodeId);DL(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new mL("drop",{layout:r})),this.dispatchEvent(new ne("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ne("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=gc(this.active,this.active.baseLayout);this.dispatchEvent(new gL("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:_e({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:_e({x:this.active.pointerX,y:this.active.pointerY}),size:_e({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&&Nn(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&&Nn(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=Tf(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.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 c;return a.id===((c=this.active)==null?void 0:c.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=Tf(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=t.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var m,x,_;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 c=(i.effectiveVelocity??0)<=vL;for(const C of o){const U=C.rect;if(!Nn(t,r,U))continue;const P=this.resolveTopLevelTargetForCard(t,r,C,C.logicalIndex,c);if(P)return P;if(!c&&((x=this.active)!=null&&x.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((_=this.active)==null?void 0:_.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,c);if(p)return p;const v=u.rect.left+u.rect.width/2;return{type:"reorder",index:t<v?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(!Nn(t,r,p.rect))continue;const v=fc(p.rect,pc["reorder-before"]);if(Nn(t,r,v))return p.logicalIndex;const m=fc(p.rect,pc["reorder-after"]);if(Nn(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 c=a.rect.left+a.rect.width/2;return t<c?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 c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:c.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(t,r,i,s,o){const a=i.rect;for(const c of dL){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=pc[c],h=fc(a,u);if(Nn(t,r,h))return c==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:c==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:c==="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,c=o.rect.left+o.rect.width,u=t<a?a-t:t>c?t-c: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 Cf=60,OL=80,Pf=.5,Rf=10;class ML{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>=Cf&&(this.activeGestureType="none");const c=r&&s!==0,u=c?s:i,h=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?h>=Pf&&h>=p*Rf?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=h*Rf?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):h<Pf?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):c||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)+OL;return this.awaitingFreshWheelGesture&&r<Cf&&!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 NL=100,UL=1e3;class FL{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(_e({x:-t})))}end(){if(this._status!=="active")return;const e=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(e)<Cx?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-NL;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*UL}}const ZL=2,Df=1e3,Ho=1e-4;function HL(n){return n.replace(/["\\]/g,"\\$&")}function Lf(n,e,t){if(n===0)return 0;const r=e.toPixels(Ce({y:nt})).y??0;return(t-r)/ZL}function mc(n){const e=n.clientWidth>0?n.clientWidth:vr,t=n.clientHeight>0?n.clientHeight:ya;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 WL extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class qy extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class VL extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new hL(Ce({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new ML);b(this,"swipeGesture",new FL(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 zL);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,"resizeState",null);b(this,"resizeListenersAttached",!1);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=If(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)<Ho||(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=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(r&&this.isTrustedArtifactFrameMessage(t,r)){if(U2(t.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,t.data.deltaX);return}if(F2(t.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});b(this,"handleArtifactWheel",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:!0});if(r.type==="scroll-horizontal"){this.applyHorizontalWheel(r.horizontalDelta);return}r.type==="scroll-native"&&t.scrollNative(t.deltaY)});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=t.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(t,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(t.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(t);return}if(!s||o)return;const a=r.closest(".card-slot");if(!a)return;const c=a.getAttribute("data-layout-node-id");if(!c)return;const u=GL(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:_e({x:t.clientX,y:t.clientY}),grabOffset:_e({x:t.clientX-h.left,y:t.clientY-h.top}),size:_e({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleResizePointerMove",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??cn)+ce;if(s<=0)return;const o=t.clientX-r.startClientX,a=pu(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});b(this,"handleResizePointerUp",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(t.pointerId),i!==s?this.commitLayout(pL(this._layout,o,i)):this.scheduleRender()});b(this,"handleResizePointerCancel",t=>{!this.resizeState||t.pointerId!==this.resizeState.pointerId||(this.endResize(t.pointerId),this.scheduleRender())});b(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});b(this,"handleResizeKeyDown",t=>{this.resizeState&&t.key==="Escape"&&(t.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});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<Lp&&a<Lp)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)/Df;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>Ho?Math.abs(o)/r:0,Math.abs(o)>Ho&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(_e({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.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Ce({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)<Ho||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Ce({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=jr(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="${HL(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),this.addEventListener("artifact-wheel",this.handleArtifactWheel),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),this.removeEventListener("artifact-wheel",this.handleArtifactWheel),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(),this.resizeState&&this.endResize(this.resizeState.pointerId)}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(t,r){return new Q2({basis:_e({x:cn,y:cn}),min:_e({x:Rp,y:Rp}),viewport:_e({x:t,y:r}),gap:_e({x:ce,y:ce})})}syncScrollModel(){const t=mc(this),i=jr(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=>Ce({x:o}))}))}emitScrollPositionChanged(t){this.dispatchEvent(new WL(t))}emitLayoutChanged(){this.dispatchEvent(new qy([...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(_e({x:t}));this.layoutScroll.wheel(Ce({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}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}}beginResize(t,r){const i=r.getAttribute("data-resize-handle");if(!i)return;const s=this._layout.find(a=>a.type==="card"&&a.id===i);if(!s)return;const o=pu(typeof s.width=="number"?s.width:bt);this.resizeState={cardId:i,pointerId:t.pointerId,startClientX:t.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault(),t.stopPropagation()}attachResizeListeners(){this.resizeListenersAttached||(window.addEventListener("pointermove",this.handleResizePointerMove),window.addEventListener("pointerup",this.handleResizePointerUp),window.addEventListener("pointercancel",this.handleResizePointerCancel),window.addEventListener("blur",this.handleResizeWindowBlur),this.addEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!0)}detachResizeListeners(){this.resizeListenersAttached&&(window.removeEventListener("pointermove",this.handleResizePointerMove),window.removeEventListener("pointerup",this.handleResizePointerUp),window.removeEventListener("pointercancel",this.handleResizePointerCancel),window.removeEventListener("blur",this.handleResizeWindowBlur),this.removeEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!1)}endResize(t){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}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.applyResizeOverride(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:If(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}applyResizeOverride(t){const r=this.resizeState;if(!r)return t;const i=t.findIndex(a=>a.type==="card"&&a.id===r.cardId);if(i===-1)return t;const s=t[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return t;const o=[...t];return o[i]={...s,width:r.currentWidth},o}render(){const t=mc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=jr(s),c=a.nodes.map(L=>L.width),u=`${t.width}x${t.height}:${c.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:c.map(L=>Ce({x:L}))}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const h=BL(s),p=r.unit.x??cn,v=r.unit.y??cn,m=o?this.dragTrackOffsetXPx:0,x=(this.layoutScroll.translate.x??0)+m,_=Lf(a.nodes.length,r,t.height),C=this.animateNextRender&&!o,U=[`transform: translate(${x}px, ${_}px);`,`transition-duration: ${C?$x: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",`${v}px`),this.style.setProperty("--layout-gap",`${ce}px`);const P=this.dragState,B={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0};Fe(N`
186
+ `}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Fe(this.template(),this),this.syncWebviewSubscription())}dispatchArtifactWheel(t,r){this.dispatchEvent(new Q2("artifact-wheel",{bubbles:!0,composed:!0,deltaX:t.deltaX,deltaY:t.deltaY,shiftKey:t.shiftKey,scrollNative:r}))}syncWebviewSubscription(){const t=this.querySelector("webview");t!==this._subscribedWebview&&(this.unsubscribeFromWebview(),t&&(t.addEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=t))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview=null)}iframeTargetOrigin(t){const r=t.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=t.getAttribute("src")??t.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}}customElements.define("artifact-view",eL);const ke=n=>({type:"px",...n}),Pe=n=>({type:"unit",...n}),Zo=2;class tL{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??ke({x:ce,y:ce});const t=this._viewport.x??vr,r=this._viewport.y??ya,i=this._gap.x??ce,s=this._gap.y??ce,o=t<=Ix,a=o?t-i*Zo:Math.min(vr,t-i*Zo),c=o?r-s*Zo:Math.min(ya,r-s*Zo),u=(a-i*(bt-1))/bt,h=(c-s*(nt-1))/nt,p=this.basis.x??0,v=this.basis.y??0,m=this.min.x??0,x=this.min.y??0;this._unit=ke(o?{x:Math.max(m,u),y:Math.max(x,h)}:{x:Math.max(m,Math.min(p,u)),y:Math.max(x,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return Pe({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??ce,s=this._gap.y??ce,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 ke({x:o,y:a})}}const wr=1e-4,et=1e-6,nL=40,rL=24;function Vy(n,e){return Math.max(0,n-e*2)}function By(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function Gy(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+ce)}return e}function jy(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+ce+o;if(a>t+wr)break;r=a,i+=1}return Math.max(1,i)}function iL(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+ce+o;if(a>t+wr)break;r=a,i+=1}return Math.max(1,i)}function sL(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+ce+s;if(o>e+wr)break;t=o,r+=1}return Math.max(1,r)}function Sh(n,e){if(n.length===0)return 0;const t=sL(n,e);return Math.max(0,n.length-t)}function Af(n,e,t){if(n.length===0)return 0;const r=jy(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)*ce}function pu(n,e,t){const r=n[e]??0;return t-r}function Br(n,e,t,r,i){if(n.length===0)return 0;const s=Sh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let c=0;for(let V=0;V<s;V+=1){const F=e[V]??0,he=e[V+1]??F;if(a>=F&&a<=he+wr){c=V;break}c=V+1}const u=Math.min(c+1,s),h=e[c]??0,p=e[u]??h,v=Math.max(p-h,wr),m=u===c?0:(a-h)/v,x=Gy(n),_=Af(n,c,i),C=Af(n,u,i),U=(r-_)/2,P=(r-C)/2,B=pu(x,c,U),L=pu(x,u,P);return B+(L-B)*m}function $f(n,e,t,r,i){const s=Sh(n,r),o=e[s]??0;let a=0,c=o;for(let u=0;u<nL;u+=1){const h=(a+c)/2;Br(n,e,h,t,r)>i?a=h:c=h}return(a+c)/2}function If(n,e,t){const r=Gy(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ce,c=(t-a)/2;return pu(r,i,c)}function oL(n,e,t){const r=jy(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function aL(n,e,t){const r=iL(n,e,t);return[Math.max(0,e-r+1),e]}function lL(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)<=et||(e.add(i),t.push(r))}return t}function cL(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??ce,s=Vy(r,i),o=By(e),a=Sh(t,s),c=o[a]??0,u=[];for(let h=0;h<=a;h+=1){const p=oL(t,h,s),v=If(t,p,r),m=$f(t,o,r,s,v);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,m))})}for(let h=t.length-1;h>=0;h-=1){const p=aL(t,h,s),v=`${p[0]}:${p[1]}`;if(u.some(_=>`${_.nodeRange[0]}:${_.nodeRange[1]}`===v))continue;const m=If(t,p,r),x=$f(t,o,r,s,m);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,x))})}return u.sort((h,p)=>Math.abs(h.anchor-p.anchor)>et?h.anchor-p.anchor:h.nodeRange[0]!==p.nodeRange[0]?h.nodeRange[0]-p.nodeRange[0]:h.nodeRange[1]-p.nodeRange[1]),{viewspans:lL(u),minScroll:0,maxScroll:c}}function pc(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+et<r){r=o,t=s;continue}Math.abs(o-r)<=et&&s<t&&(t=s)}return t}function uL(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function Nr(n,e,t){return Math.max(e,Math.min(t,n))}function hL(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)<=et)return r;return-1}function dL(n,e,t){var i,s,o,a;if(n.length===0)return e;const r=hL(n,e);if(r>=0){const c=n[r];if(!c)return e;if(t>0){const v=c.nodeRange[0]+1,m=n.filter(_=>_.nodeRange[0]===v);if(m.length===0)return((i=n[n.length-1])==null?void 0:i.anchor)??e;let x=m[0];for(const _ of m)_.nodeRange[1]>x.nodeRange[1]&&(x=_);return x.anchor}const u=c.nodeRange[1]-1,h=n.filter(v=>v.nodeRange[1]===u);if(h.length===0)return((s=n[0])==null?void 0:s.anchor)??e;let p=h[0];for(const v of h)v.nodeRange[0]<p.nodeRange[0]&&(p=v);return p.anchor}if(t>0){for(const c of n)if(c.anchor>e+et)return c.anchor;return((o=n[n.length-1])==null?void 0:o.anchor)??e}for(let c=n.length-1;c>=0;c-=1){const u=n[c];if(u&&u.anchor<e-et)return u.anchor}return((a=n[0])==null?void 0:a.anchor)??e}class pL extends zt{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 Pe({x:this._scroll})}get translate(){return ke({x:Br(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx)})}set scroll(t){const r=Nr(t.x??this._scroll,this.minScroll,this.maxScroll);Math.abs(r-this._scroll)<=et||(this._scroll=r,this.activeViewspanIndex=null,this.dispatchEvent(new Mr("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(Pe({x:u})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??ce,a=cL({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this.nodeWidthsPx=i,this.boundaryCols=By(r),this.viewportWidthPx=s,this.framedViewportWidthPx=Vy(s,o),this.viewspans=a.viewspans,this.minScroll=a.minScroll,this.maxScroll=a.maxScroll,this.activeViewspanIndex=null;const c=Nr(this._scroll,this.minScroll,this.maxScroll);Math.abs(c-this._scroll)>et&&(this._scroll=c,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}step(t){var a;if(this.viewspans.length===0)return;const r=this.activeViewspanIndex??pc(this.viewspans,this._scroll),i=uL(r,t,this.viewspans.length),s=((a=this.viewspans[i])==null?void 0:a.anchor)??this._scroll,o=Nr(s,this.minScroll,this.maxScroll);this.activeViewspanIndex=i,!(Math.abs(o-this._scroll)<=et)&&(this._scroll=o,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}snap(t){var s;if(this.viewspans.length===0)return;const r=t===void 0?((s=this.viewspans[pc(this.viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:dL(this.viewspans,this._scroll,t),i=Nr(r,this.minScroll,this.maxScroll);this.activeViewspanIndex=pc(this.viewspans,i),!(Math.abs(i-this._scroll)<=et)&&(this._scroll=i,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=Nr(this._scroll+(t.x??0),this.minScroll,this.maxScroll);this.activeViewspanIndex=null,!(Math.abs(r-this._scroll)<=et)&&(this._scroll=r,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=wr)return;this.activeViewspanIndex=null;const i=Br(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx),s=i-r,o=Br(this.nodeWidthsPx,this.boundaryCols,this.maxScroll,this.viewportWidthPx,this.framedViewportWidthPx),a=Br(this.nodeWidthsPx,this.boundaryCols,this.minScroll,this.viewportWidthPx,this.framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=wr)return;let u=this.minScroll,h=this.maxScroll;for(let v=0;v<rL;v+=1){const m=(u+h)/2;Br(this.nodeWidthsPx,this.boundaryCols,m,this.viewportWidthPx,this.framedViewportWidthPx)>c?u=m:h=m}const p=Nr((u+h)/2,this.minScroll,this.maxScroll);Math.abs(p-this._scroll)<=et||(this._scroll=p,this.dispatchEvent(new Mr("layout-scroll",{scroll:this.scroll})))}}const fc={"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}},fL=["stack-above","stack-below","reorder-before","reorder-after"];function gc(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 Nn(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function fu(n){return Number.isFinite(n)?Math.max(us,Math.min(rh,Math.round(n))):us}function gL(n,e,t){const r=n.findIndex(a=>a.type==="card"&&a.id===e);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=fu(t);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function _h(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 gu(n){return n.height===nt||n.height===En?{...n,height:En}:n}function mu(n){return n.height===En?{...n,height:nt}:n}function mL(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 c=[...n];if(a.length===1){const[h]=a;c[i]=h.type==="card"?mu(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,mu(o)),c}const vL=rt(),yL=rt(),bL=50;function wL(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 mo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function Tf(n){return n.map(_L)}function SL(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function _L(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(SL)}:n}function qy(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function Cf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function kL(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 EL(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&v.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=qy(r,e.nodeId);if(!a)return null;const c=gu(a),u=gu(o),h=mo(c),p=t.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function mc(n,e){return n.parentStackId?AL(n,e):xL(n,e)}function xL(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,mo(r)),i}if(t.type==="stack"){const r=kL(n,e);return r?EL(r,n,t,e)??[...e]:[...e]}return[...e]}function AL(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return $L(n,e,t.position);case"stack-child-extract":return IL(n,e,t.toIndex);case"stack-child-noop":return TL(n,e);default:return[...e]}}function $L(n,e,t){const r=e.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(v=>v.type==="card"))return[...e];const s=i.children,o=s.findIndex(v=>v.id===n.nodeId);if(o===-1)return[...e];const a=s[o],c=s.filter(v=>v.id!==n.nodeId),u=mo(a),h=t==="above"?[u,...c]:[...c,u],p=[...e];return p[r]={...i,children:h},p}function IL(n,e,t){if(!n.parentStackId)return[...e];const r=mL(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]=mo(s),o}function TL(n,e){const t=e.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(c=>c.type==="card"&&c.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]=mo(s),o[t]={...r,children:a},o}function CL(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:ol()}function PL(n,e,t){if(n.type==="drop-target"){const r=_h(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return gu(r)}return n}function RL(n,e,t){const r=n.children.map(s=>PL(s,e,t));return{id:CL(n,e),type:"stack",children:r}}function DL(n,e,t){if(n.type==="drop-target"){const r=_h(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return qy(e,t)!==null?r:mu(r)}return n.type==="card"||n.type==="row"?n:RL(n,e,t)}function LL(n,e,t){return n.map(r=>DL(r,e,t))}function zL(n,e){return JSON.stringify(n)===JSON.stringify(e)}const OL=fo(zt);class ML extends OL{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 ne("change")));return}if(!this.active)return;const o=mc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&wL(this.active.hitTarget,a)&&this.active.lastReorderIndex===c||(this.active={...this.active,pointerX:r,pointerY:i,hitTarget:a,lastReorderIndex:c},this.emitDrag(),this.dispatchEvent(new ne("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=mc(this.active,t),s=LL(i,t,this.active.nodeId);zL(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new yL("drop",{layout:r})),this.dispatchEvent(new ne("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ne("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=mc(this.active,this.active.baseLayout);this.dispatchEvent(new vL("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:ke({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:ke({x:this.active.pointerX,y:this.active.pointerY}),size:ke({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&&Nn(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&&Nn(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=Cf(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.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 c;return a.id===((c=this.active)==null?void 0:c.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=Cf(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=t.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var m,x,_;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 c=(i.effectiveVelocity??0)<=bL;for(const C of o){const U=C.rect;if(!Nn(t,r,U))continue;const P=this.resolveTopLevelTargetForCard(t,r,C,C.logicalIndex,c);if(P)return P;if(!c&&((x=this.active)!=null&&x.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((_=this.active)==null?void 0:_.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,c);if(p)return p;const v=u.rect.left+u.rect.width/2;return{type:"reorder",index:t<v?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(!Nn(t,r,p.rect))continue;const v=gc(p.rect,fc["reorder-before"]);if(Nn(t,r,v))return p.logicalIndex;const m=gc(p.rect,fc["reorder-after"]);if(Nn(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 c=a.rect.left+a.rect.width/2;return t<c?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 c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:c.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(t,r,i,s,o){const a=i.rect;for(const c of fL){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=fc[c],h=gc(a,u);if(Nn(t,r,h))return c==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:c==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:c==="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,c=o.rect.left+o.rect.width,u=t<a?a-t:t>c?t-c: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 Pf=60,NL=80,Rf=.5,Df=10;class UL{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>=Pf&&(this.activeGestureType="none");const c=r&&s!==0,u=c?s:i,h=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?h>=Rf&&h>=p*Df?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=h*Df?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):h<Rf?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):c||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)+NL;return this.awaitingFreshWheelGesture&&r<Pf&&!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 FL=100,ZL=1e3;class HL{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(ke({x:-t})))}end(){if(this._status!=="active")return;const e=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(e)<Rx?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-FL;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*ZL}}const WL=2,Lf=1e3,Ho=1e-4;function VL(n){return n.replace(/["\\]/g,"\\$&")}function zf(n,e,t){if(n===0)return 0;const r=e.toPixels(Pe({y:nt})).y??0;return(t-r)/WL}function vc(n){const e=n.clientWidth>0?n.clientWidth:vr,t=n.clientHeight>0?n.clientHeight:ya;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 BL extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class Yy extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class GL extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new pL(Pe({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new UL);b(this,"swipeGesture",new HL(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 ML);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,"resizeState",null);b(this,"resizeListenersAttached",!1);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=Tf(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)<Ho||(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=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(r&&this.isTrustedArtifactFrameMessage(t,r)){if(Z2(t.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,t.data.deltaX);return}if(H2(t.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});b(this,"handleArtifactWheel",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:!0});if(r.type==="scroll-horizontal"){this.applyHorizontalWheel(r.horizontalDelta);return}r.type==="scroll-native"&&t.scrollNative(t.deltaY)});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=t.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(t,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(t.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(t);return}if(!s||o)return;const a=r.closest(".card-slot");if(!a)return;const c=a.getAttribute("data-layout-node-id");if(!c)return;const u=qL(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:ke({x:t.clientX,y:t.clientY}),grabOffset:ke({x:t.clientX-h.left,y:t.clientY-h.top}),size:ke({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleResizePointerMove",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??cn)+ce;if(s<=0)return;const o=t.clientX-r.startClientX,a=fu(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});b(this,"handleResizePointerUp",t=>{const r=this.resizeState;if(!r||t.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(t.pointerId),i!==s?this.commitLayout(gL(this._layout,o,i)):this.scheduleRender()});b(this,"handleResizePointerCancel",t=>{!this.resizeState||t.pointerId!==this.resizeState.pointerId||(this.endResize(t.pointerId),this.scheduleRender())});b(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});b(this,"handleResizeKeyDown",t=>{this.resizeState&&t.key==="Escape"&&(t.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});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<zp&&a<zp)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)/Lf;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>Ho?Math.abs(o)/r:0,Math.abs(o)>Ho&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(ke({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.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Pe({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)<Ho||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Pe({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=qr(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="${VL(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),this.addEventListener("artifact-wheel",this.handleArtifactWheel),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),this.removeEventListener("artifact-wheel",this.handleArtifactWheel),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(),this.resizeState&&this.endResize(this.resizeState.pointerId)}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(t,r){return new tL({basis:ke({x:cn,y:cn}),min:ke({x:Dp,y:Dp}),viewport:ke({x:t,y:r}),gap:ke({x:ce,y:ce})})}syncScrollModel(){const t=vc(this),i=qr(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=>Pe({x:o}))}))}emitScrollPositionChanged(t){this.dispatchEvent(new BL(t))}emitLayoutChanged(){this.dispatchEvent(new Yy([...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(ke({x:t}));this.layoutScroll.wheel(Pe({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}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}}beginResize(t,r){const i=r.getAttribute("data-resize-handle");if(!i)return;const s=this._layout.find(a=>a.type==="card"&&a.id===i);if(!s)return;const o=fu(typeof s.width=="number"?s.width:bt);this.resizeState={cardId:i,pointerId:t.pointerId,startClientX:t.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault(),t.stopPropagation()}attachResizeListeners(){this.resizeListenersAttached||(window.addEventListener("pointermove",this.handleResizePointerMove),window.addEventListener("pointerup",this.handleResizePointerUp),window.addEventListener("pointercancel",this.handleResizePointerCancel),window.addEventListener("blur",this.handleResizeWindowBlur),this.addEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!0)}detachResizeListeners(){this.resizeListenersAttached&&(window.removeEventListener("pointermove",this.handleResizePointerMove),window.removeEventListener("pointerup",this.handleResizePointerUp),window.removeEventListener("pointercancel",this.handleResizePointerCancel),window.removeEventListener("blur",this.handleResizeWindowBlur),this.removeEventListener("keydown",this.handleResizeKeyDown),this.resizeListenersAttached=!1)}endResize(t){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}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.applyResizeOverride(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:Tf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}applyResizeOverride(t){const r=this.resizeState;if(!r)return t;const i=t.findIndex(a=>a.type==="card"&&a.id===r.cardId);if(i===-1)return t;const s=t[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return t;const o=[...t];return o[i]={...s,width:r.currentWidth},o}render(){const t=vc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=qr(s),c=a.nodes.map(L=>L.width),u=`${t.width}x${t.height}:${c.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:c.map(L=>Pe({x:L}))}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const h=jL(s),p=r.unit.x??cn,v=r.unit.y??cn,m=o?this.dragTrackOffsetXPx:0,x=(this.layoutScroll.translate.x??0)+m,_=zf(a.nodes.length,r,t.height),C=this.animateNextRender&&!o,U=[`transform: translate(${x}px, ${_}px);`,`transition-duration: ${C?Tx: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",`${v}px`),this.style.setProperty("--layout-gap",`${ce}px`);const P=this.dragState,B={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0};Fe(N`
187
187
  <div class="track" style=${U}>
188
188
  ${a.nodes.map((L,V)=>N`
189
189
  <div
@@ -192,7 +192,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
192
192
  data-layout-node-id=${L.id}
193
193
  data-layout-placeholder=${String(i.activePlaceholderId===L.id)}
194
194
  layout-node-cols=${String(L.width)}
195
- style=${`grid-template-columns: repeat(${L.width}, var(--layout-unit-x)); width: ${r.toPixels(Ce({x:L.width})).x}px;`}
195
+ style=${`grid-template-columns: repeat(${L.width}, var(--layout-unit-x)); width: ${r.toPixels(Pe({x:L.width})).x}px;`}
196
196
  >
197
197
  ${L.cards.map(F=>{const he=i.placeholdersById.get(F.id);if(P&&he)return N`
198
198
  <div
@@ -231,7 +231,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
231
231
  ${this.renderDraggedPreview(P.nodeId)}
232
232
  </div>
233
233
  `})():null}
234
- `,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,c=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:_e({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:c,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*Df,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+Lo,o=r.left+r.width-Lo,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??cn,c=Tx*a;if(t<s){const h=Math.max(0,Math.min(1,(s-t)/Lo));return-(c*h**Dp)*i}if(t>o){const h=Math.max(0,Math.min(1,(t-o)/Lo));return c*h**Dp*i}return 0}measureLayoutGeometry(t,r,i=0){const s=this.layoutGrid;if(!s)return[];const o=jr(t),a=new Map(o.nodes.map(_=>[_.id,_.width])),c=s.toPixels(Ce({y:nt})).y??ya,u=mc(this),h=(this.layoutScroll.translate.x??0)+i,p=Lf(o.nodes.length,s,u.height),v=u.offsetY+p,m=[];let x=h;for(const _ of t){const C=a.get(_.id)??bt,U=s.toPixels(Ce({x:C})).x??vr,P={left:x,top:v,width:U,height:c};m.push({id:_.id,rect:P}),x+=U+ce}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(Ce({x:a.width})).x??s.width,height:i.toPixels(Ce({y:a.height})).y??s.height};return s}renderDraggedPreview(t){const r=Sh(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 c=s?o??this.getStableAnchorCardId(t,r,i):this.getStableAnchorNodeId(t,r,i);if(!c)return a;const u=s?Of(t,c,this.layoutGrid):Mf(t,c,this.layoutGrid),h=s?Of(r,c,this.layoutGrid):Mf(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(t,r,i){const s=zf(t),o=new Set(zf(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 BL(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 GL(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 zf(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 Of(n,e,t){if(!t)return null;const r=jr(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)??bt,c=t.toPixels(Ce({x:a})).x??vr;s+=c+ce}return null}function Mf(n,e,t){if(!t)return null;const r=jr(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)??bt,c=t.toPixels(Ce({x:a})).x??vr;s+=c+ce}return null}customElements.get("layout-view")||customElements.define("layout-view",VL);class jL extends HTMLElement{constructor(){super(...arguments);b(this,"screenManager",Lt.resolve("ScreenManager"));b(this,"boundModel",null);b(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});b(this,"handleModelChange",()=>{this.render()});b(this,"handleCloseArtifact",t=>{t instanceof Hy&&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 qy&&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){Fe(N`<p data-testid="empty-screen" class="empty">
234
+ `,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,c=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:ke({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:c,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*Lf,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+Lo,o=r.left+r.width-Lo,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??cn,c=Px*a;if(t<s){const h=Math.max(0,Math.min(1,(s-t)/Lo));return-(c*h**Lp)*i}if(t>o){const h=Math.max(0,Math.min(1,(t-o)/Lo));return c*h**Lp*i}return 0}measureLayoutGeometry(t,r,i=0){const s=this.layoutGrid;if(!s)return[];const o=qr(t),a=new Map(o.nodes.map(_=>[_.id,_.width])),c=s.toPixels(Pe({y:nt})).y??ya,u=vc(this),h=(this.layoutScroll.translate.x??0)+i,p=zf(o.nodes.length,s,u.height),v=u.offsetY+p,m=[];let x=h;for(const _ of t){const C=a.get(_.id)??bt,U=s.toPixels(Pe({x:C})).x??vr,P={left:x,top:v,width:U,height:c};m.push({id:_.id,rect:P}),x+=U+ce}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(Pe({x:a.width})).x??s.width,height:i.toPixels(Pe({y:a.height})).y??s.height};return s}renderDraggedPreview(t){const r=_h(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 c=s?o??this.getStableAnchorCardId(t,r,i):this.getStableAnchorNodeId(t,r,i);if(!c)return a;const u=s?Mf(t,c,this.layoutGrid):Nf(t,c,this.layoutGrid),h=s?Mf(r,c,this.layoutGrid):Nf(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(t,r,i){const s=Of(t),o=new Set(Of(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 jL(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 qL(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 Of(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 Mf(n,e,t){if(!t)return null;const r=qr(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)??bt,c=t.toPixels(Pe({x:a})).x??vr;s+=c+ce}return null}function Nf(n,e,t){if(!t)return null;const r=qr(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)??bt,c=t.toPixels(Pe({x:a})).x??vr;s+=c+ce}return null}customElements.get("layout-view")||customElements.define("layout-view",GL);class YL extends HTMLElement{constructor(){super(...arguments);b(this,"screenManager",Lt.resolve("ScreenManager"));b(this,"boundModel",null);b(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});b(this,"handleModelChange",()=>{this.render()});b(this,"handleCloseArtifact",t=>{t instanceof Wy&&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 Yy&&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){Fe(N`<p data-testid="empty-screen" class="empty">
235
235
  No artifacts yet. Create one by asking for something.
236
236
  </p>`,this);return}Fe(N`
237
237
  <layout-view
@@ -248,42 +248,42 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
248
248
  @layout-change=${this.handleLayoutChanged}
249
249
  @close-artifact=${this.handleCloseArtifact}
250
250
  ></layout-view>
251
- `,this)}}customElements.define("screen-view",jL);class qL extends HTMLElement{connectedCallback(){}}customElements.get("home-screen")||customElements.define("home-screen",qL);const vc=new WeakMap,Nf=Object.prototype.hasOwnProperty,YL=(()=>{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 XL(n,e){if(n===Boolean)return e!==null;if(e!==null)return n===Number?Number(e):e}var Bs,mu,hr,st,Pt,ui,dr,hi,Re,ns,Yy,Xy,Ky,aa;const Bn=class Bn extends HTMLElement{constructor(){var i;super();w(this,Re);w(this,hr,new Map);w(this,st,new Map);w(this,Pt,new Map);w(this,ui,!1);w(this,dr,!1);w(this,hi,!1);const t=f(i=Bn,Bs,mu).call(i,this.constructor),r=this;for(const s of t.properties)Nf.call(r,s)&&(l(this,Pt).set(s,r[s]),delete r[s])}static get observedAttributes(){var t;return f(t=Bn,Bs,mu).call(t,this).observedAttributes}connected(){}disconnected(){}changed(t){}connectedCallback(){if(f(this,Re,Ky).call(this),!l(this,dr))for(const t of f(this,Re,ns).call(this).properties)l(this,st).has(t)||l(this,st).set(t,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),f(this,Re,aa).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(t,r,i){if(r===i)return;const s=f(this,Re,ns).call(this).byAttr.get(t);s&&(l(this,Pt).has(s.property)||(this[s.property]=XL(s.type,i)))}};Bs=new WeakSet,mu=function(t){const r=vc.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(YL.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 v={attribute:u,property:p,type:h.type};o.set(u,v),a.set(p,v)}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 l(this,hr).get(u)},set(p){f(this,Re,Yy).call(this,u,p)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return vc.set(t,c),c},hr=new WeakMap,st=new WeakMap,Pt=new WeakMap,ui=new WeakMap,dr=new WeakMap,hi=new WeakMap,Re=new WeakSet,ns=function(){return vc.get(this.constructor)},Yy=function(t,r){if(!l(this,hi)&&l(this,Pt).has(t))return;const i=l(this,hr).get(t);Object.is(i,r)||(l(this,st).has(t)||l(this,st).set(t,i),l(this,hr).set(t,r),l(this,Pt).delete(t),f(this,Re,Xy).call(this,t,r),this.isConnected&&f(this,Re,aa).call(this))},Xy=function(t,r){const i=f(this,Re,ns).call(this).byProp.get(t);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const c=this.hasAttribute(s);r&&!c?this.setAttribute(s,""):!r&&c&&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)},Ky=function(){const t=this,r=f(this,Re,ns).call(this);for(const i of r.properties){if(!Nf.call(t,i))continue;const s=t[i];delete t[i],!(l(this,Pt).has(i)||l(this,hr).has(i))&&(t[i]=s)}E(this,hi,!0);try{for(const[i,s]of l(this,Pt))t[i]=s;l(this,Pt).clear()}finally{E(this,hi,!1)}},aa=function(){l(this,ui)||!this.isConnected||l(this,dr)&&l(this,st).size===0||(E(this,ui,!0),queueMicrotask(()=>{if(E(this,ui,!1),!this.isConnected||l(this,dr)&&l(this,st).size===0)return;const t=new Map(l(this,st));l(this,st).clear(),E(this,dr,!0);try{this.changed(t)}catch(r){console.error(r)}this.isConnected&&l(this,st).size>0&&f(this,Re,aa).call(this)}))},w(Bn,Bs),b(Bn,"properties"),b(Bn,"attributes");let ms=Bn;var be,pr,yn,di,fr,Gs,pi,bn,wn,Sn,js,W,fi,Rt,Z,Jy,qs,Ys,vu,yu,Oa,Ma,Na,Ua,Fa,Za,Ha,Xs,gi,Wa,Va,Ba,Ga,bu,Qy,la,ja,eb,ln,tb,nb,rb,ib,sb,ob,ab,lb,cb,qe;class KL extends ms{constructor(){super(...arguments);w(this,Z);w(this,be,Lt.resolve("ScreenManager"));w(this,pr,Lt.resolve("ServerManager"));w(this,yn,null);w(this,di,new DisposableStack);w(this,fr,on());w(this,Gs,on());w(this,pi,on());w(this,bn,on());w(this,wn,on());w(this,Sn,on());w(this,js,on());w(this,W,{kind:"none"});w(this,fi,!1);w(this,Rt,[]);w(this,qs,()=>{f(this,Z,vu).call(this),E(this,W,{kind:"none"}),l(this,qe).call(this)});w(this,Ys,()=>{l(this,qe).call(this)});w(this,Oa,t=>{l(this,W).kind==="none"||l(this,W).kind==="picker"||(t.stopImmediatePropagation(),f(this,Z,ln).call(this))});w(this,Ma,()=>{var r;const t=l(this,be).activeScreen;t&&((r=l(this,fr).value)==null||r.close(),t.setPinned(!t.pinned))});w(this,Na,()=>{var r;const t=l(this,be).activeScreen;t&&((r=l(this,fr).value)==null||r.close(),E(this,W,{kind:"rename",draft:t.name}),l(this,qe).call(this))});w(this,Ua,()=>{var t;l(this,be).activeScreen&&((t=l(this,fr).value)==null||t.close(),E(this,W,{kind:"delete",error:null}),l(this,qe).call(this))});w(this,Fa,t=>{if(l(this,W).kind!=="rename")return;const r=t.target;r instanceof HTMLInputElement&&E(this,W,{kind:"rename",draft:r.value})});w(this,Za,t=>{if(t.preventDefault(),l(this,W).kind!=="rename")return;const r=l(this,be).activeScreen;if(!r)return;const i=l(this,W).draft.trim();i.length>0&&i!==r.name&&r.rename(i),f(this,Z,ln).call(this)});w(this,Ha,async()=>{if(l(this,W).kind!=="delete")return;const t=l(this,be).activeScreen;if(t){E(this,W,{kind:"delete",error:null});try{await t.remove(),l(this,be).clearActive(),f(this,Z,ln).call(this)}catch(r){E(this,W,{kind:"delete",error:r instanceof Error?r.message:"Failed to delete screen."}),l(this,qe).call(this)}}});w(this,Xs,()=>{f(this,Z,ln).call(this)});w(this,gi,t=>{const r=t.target;(l(this,W).kind==="rename"&&r===l(this,bn).value||l(this,W).kind==="delete"&&r===l(this,wn).value||l(this,W).kind==="picker"&&r===l(this,Sn).value)&&(E(this,W,{kind:"none"}),l(this,qe).call(this))});w(this,Wa,()=>{var i,s;if(l(this,W).kind==="picker"){f(this,Z,ln).call(this);return}E(this,Rt,f(this,Z,Qy).call(this));const t=((i=l(this,be).activeScreen)==null?void 0:i.id)??null,r=t&&l(this,Rt).some(o=>o.screenID===t)?t:((s=l(this,Rt)[0])==null?void 0:s.screenID)??null;E(this,W,{kind:"picker",filter:"",highlightedID:r}),l(this,qe).call(this),queueMicrotask(()=>{var o;(o=l(this,js).value)==null||o.focus()})});w(this,Va,t=>{var u;const r=l(this,W);if(r.kind!=="picker")return;const i=t.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=f(this,Z,la).call(this,l(this,Rt),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;E(this,W,{kind:"picker",filter:s,highlightedID:c}),l(this,qe).call(this)});w(this,Ba,t=>{var s;const r=l(this,W);if(r.kind!=="picker")return;if(t.key==="Escape"){t.preventDefault(),f(this,Z,ln).call(this),(s=l(this,pi).value)==null||s.focus();return}const i=f(this,Z,la).call(this,l(this,Rt),r.filter);if(t.key==="ArrowDown"||t.key==="ArrowUp"){if(t.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=t.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));E(this,W,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,qe).call(this);return}if(t.key==="Enter"){t.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&f(this,Z,bu).call(this,o)}});w(this,Ga,t=>{f(this,Z,bu).call(this,t)});w(this,ja,async()=>{if(l(this,fi))return;const t=f(this,Z,eb).call(this);if(t){E(this,fi,!0);try{const r=await t.createScreen(JL(new Date));l(this,be).setActive(t.url,r.id)}catch{}finally{E(this,fi,!1)}}});w(this,qe,()=>{var s;const t=l(this,be).activeScreen,r=f(this,Z,ib).call(this);Fe(N`
252
- ${f(this,Z,tb).call(this)}
251
+ `,this)}}customElements.define("screen-view",YL);class XL extends HTMLElement{connectedCallback(){}}customElements.get("home-screen")||customElements.define("home-screen",XL);function $a(n){return typeof n=="object"&&n!==null}const yc=new WeakMap,Uf=Object.prototype.hasOwnProperty,KL=(()=>{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 JL(n,e){if($a(n))return e===null?void 0:n.parse(e);if(n===Boolean)return e!==null;if(e!==null)return n===Number?Number(e):e}function QL(n,e){return $a(n)?e==null?null:n.serialize(e):n===Boolean?e?"":null:e==null?null:String(e)}var Bs,vu,hr,st,Pt,hi,dr,di,we,Gr,Xy,Ky,Jy,Qy,aa;const Bn=class Bn extends HTMLElement{constructor(){var i;super();w(this,we);w(this,hr,new Map);w(this,st,new Map);w(this,Pt,new Map);w(this,hi,!1);w(this,dr,!1);w(this,di,!1);const t=f(i=Bn,Bs,vu).call(i,this.constructor),r=this;for(const s of t.properties)Uf.call(r,s)&&(l(this,Pt).set(s,r[s]),delete r[s])}static get observedAttributes(){var t;return f(t=Bn,Bs,vu).call(t,this).observedAttributes}connected(){}disconnected(){}changed(t){}connectedCallback(){if(f(this,we,Qy).call(this),!l(this,dr))for(const t of f(this,we,Gr).call(this).properties)l(this,st).has(t)||l(this,st).set(t,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),f(this,we,aa).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(t,r,i){if(r===i)return;const s=f(this,we,Gr).call(this).byAttr.get(t);s&&(l(this,Pt).has(s.property)||(this[s.property]=JL(s.type,i)))}};Bs=new WeakSet,vu=function(t){const r=yc.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(KL.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.`);if($a(h.type)){if(typeof h.type.parse!="function")throw new Error(`Attribute "${u}" custom coercer is missing a \`parse\` function.`);if(typeof h.type.serialize!="function")throw new Error(`Attribute "${u}" custom coercer is missing a \`serialize\` function.`)}const v={attribute:u,property:p,type:h.type};o.set(u,v),a.set(p,v)}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 l(this,hr).get(u)},set(p){f(this,we,Xy).call(this,u,p)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return yc.set(t,c),c},hr=new WeakMap,st=new WeakMap,Pt=new WeakMap,hi=new WeakMap,dr=new WeakMap,di=new WeakMap,we=new WeakSet,Gr=function(){return yc.get(this.constructor)},Xy=function(t,r){if(!l(this,di)&&l(this,Pt).has(t))return;const i=l(this,hr).get(t);f(this,we,Ky).call(this,t,i,r)||(l(this,st).has(t)||l(this,st).set(t,i),l(this,hr).set(t,r),l(this,Pt).delete(t),f(this,we,Jy).call(this,t,r),this.isConnected&&f(this,we,aa).call(this))},Ky=function(t,r,i){if(Object.is(r,i))return!0;const s=f(this,we,Gr).call(this).byProp.get(t);if(!s||!$a(s.type))return!1;const o=r==null,a=i==null;if(o||a)return o&&a;try{return s.type.serialize(r)===s.type.serialize(i)}catch{return!1}},Jy=function(t,r){const i=f(this,we,Gr).call(this).byProp.get(t);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const c=this.hasAttribute(s);r&&!c?this.setAttribute(s,""):!r&&c&&this.removeAttribute(s);return}const a=QL(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},Qy=function(){const t=this,r=f(this,we,Gr).call(this);for(const i of r.properties){if(!Uf.call(t,i))continue;const s=t[i];delete t[i],!(l(this,Pt).has(i)||l(this,hr).has(i))&&(t[i]=s)}E(this,di,!0);try{for(const[i,s]of l(this,Pt))t[i]=s;l(this,Pt).clear()}finally{E(this,di,!1)}},aa=function(){l(this,hi)||!this.isConnected||l(this,dr)&&l(this,st).size===0||(E(this,hi,!0),queueMicrotask(()=>{if(E(this,hi,!1),!this.isConnected||l(this,dr)&&l(this,st).size===0)return;const t=new Map(l(this,st));l(this,st).clear(),E(this,dr,!0);try{this.changed(t)}catch(r){console.error(r)}this.isConnected&&l(this,st).size>0&&f(this,we,aa).call(this)}))},w(Bn,Bs),b(Bn,"properties"),b(Bn,"attributes");let ms=Bn;var be,pr,yn,pi,fr,Gs,fi,bn,wn,Sn,js,W,gi,Rt,Z,eb,qs,Ys,yu,bu,Ma,Na,Ua,Fa,Za,Ha,Wa,Xs,mi,Va,Ba,Ga,ja,wu,tb,la,qa,nb,ln,rb,ib,sb,ob,ab,lb,cb,ub,hb,qe;class ez extends ms{constructor(){super(...arguments);w(this,Z);w(this,be,Lt.resolve("ScreenManager"));w(this,pr,Lt.resolve("ServerManager"));w(this,yn,null);w(this,pi,new DisposableStack);w(this,fr,on());w(this,Gs,on());w(this,fi,on());w(this,bn,on());w(this,wn,on());w(this,Sn,on());w(this,js,on());w(this,W,{kind:"none"});w(this,gi,!1);w(this,Rt,[]);w(this,qs,()=>{f(this,Z,yu).call(this),E(this,W,{kind:"none"}),l(this,qe).call(this)});w(this,Ys,()=>{l(this,qe).call(this)});w(this,Ma,t=>{l(this,W).kind==="none"||l(this,W).kind==="picker"||(t.stopImmediatePropagation(),f(this,Z,ln).call(this))});w(this,Na,()=>{var r;const t=l(this,be).activeScreen;t&&((r=l(this,fr).value)==null||r.close(),t.setPinned(!t.pinned))});w(this,Ua,()=>{var r;const t=l(this,be).activeScreen;t&&((r=l(this,fr).value)==null||r.close(),E(this,W,{kind:"rename",draft:t.name}),l(this,qe).call(this))});w(this,Fa,()=>{var t;l(this,be).activeScreen&&((t=l(this,fr).value)==null||t.close(),E(this,W,{kind:"delete",error:null}),l(this,qe).call(this))});w(this,Za,t=>{if(l(this,W).kind!=="rename")return;const r=t.target;r instanceof HTMLInputElement&&E(this,W,{kind:"rename",draft:r.value})});w(this,Ha,t=>{if(t.preventDefault(),l(this,W).kind!=="rename")return;const r=l(this,be).activeScreen;if(!r)return;const i=l(this,W).draft.trim();i.length>0&&i!==r.name&&r.rename(i),f(this,Z,ln).call(this)});w(this,Wa,async()=>{if(l(this,W).kind!=="delete")return;const t=l(this,be).activeScreen;if(t){E(this,W,{kind:"delete",error:null});try{await t.remove(),l(this,be).clearActive(),f(this,Z,ln).call(this)}catch(r){E(this,W,{kind:"delete",error:r instanceof Error?r.message:"Failed to delete screen."}),l(this,qe).call(this)}}});w(this,Xs,()=>{f(this,Z,ln).call(this)});w(this,mi,t=>{const r=t.target;(l(this,W).kind==="rename"&&r===l(this,bn).value||l(this,W).kind==="delete"&&r===l(this,wn).value||l(this,W).kind==="picker"&&r===l(this,Sn).value)&&(E(this,W,{kind:"none"}),l(this,qe).call(this))});w(this,Va,()=>{var i,s;if(l(this,W).kind==="picker"){f(this,Z,ln).call(this);return}E(this,Rt,f(this,Z,tb).call(this));const t=((i=l(this,be).activeScreen)==null?void 0:i.id)??null,r=t&&l(this,Rt).some(o=>o.screenID===t)?t:((s=l(this,Rt)[0])==null?void 0:s.screenID)??null;E(this,W,{kind:"picker",filter:"",highlightedID:r}),l(this,qe).call(this),queueMicrotask(()=>{var o;(o=l(this,js).value)==null||o.focus()})});w(this,Ba,t=>{var u;const r=l(this,W);if(r.kind!=="picker")return;const i=t.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=f(this,Z,la).call(this,l(this,Rt),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;E(this,W,{kind:"picker",filter:s,highlightedID:c}),l(this,qe).call(this)});w(this,Ga,t=>{var s;const r=l(this,W);if(r.kind!=="picker")return;if(t.key==="Escape"){t.preventDefault(),f(this,Z,ln).call(this),(s=l(this,fi).value)==null||s.focus();return}const i=f(this,Z,la).call(this,l(this,Rt),r.filter);if(t.key==="ArrowDown"||t.key==="ArrowUp"){if(t.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=t.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));E(this,W,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,qe).call(this);return}if(t.key==="Enter"){t.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&f(this,Z,wu).call(this,o)}});w(this,ja,t=>{f(this,Z,wu).call(this,t)});w(this,qa,async()=>{if(l(this,gi))return;const t=f(this,Z,nb).call(this);if(t){E(this,gi,!0);try{const r=await t.createScreen(tz(new Date));l(this,be).setActive(t.url,r.id)}catch{}finally{E(this,gi,!1)}}});w(this,qe,()=>{var s;const t=l(this,be).activeScreen,r=f(this,Z,ob).call(this);Fe(N`
252
+ ${f(this,Z,rb).call(this)}
253
253
  <div class="pills">
254
- ${r.map(o=>o.isActive&&t?f(this,Z,ob).call(this,t):f(this,Z,ab).call(this,o.serverURL,o.screenID,o.name))}
254
+ ${r.map(o=>o.isActive&&t?f(this,Z,lb).call(this,t):f(this,Z,cb).call(this,o.serverURL,o.screenID,o.name))}
255
255
  </div>
256
- ${f(this,Z,nb).call(this)}
257
- ${t?f(this,Z,lb).call(this):ee}
258
- ${t?f(this,Z,cb).call(this,t):ee}
259
- `,this);const i=l(this,Gs).value??null;l(this,bn).value&&(l(this,bn).value.anchor=i),l(this,wn).value&&(l(this,wn).value.anchor=i),l(this,Sn).value&&(l(this,Sn).value.anchor=l(this,pi).value??null),(s=i==null?void 0:i.scrollIntoView)==null||s.call(i,{block:"nearest",inline:"nearest"})})}connected(){l(this,be).addEventListener("active-screen-changed",l(this,qs)),f(this,Z,vu).call(this),l(this,qe).call(this),f(this,Z,Jy).call(this),l(this,di).defer(()=>{l(this,be).removeEventListener("active-screen-changed",l(this,qs)),f(this,Z,yu).call(this)})}disconnected(){l(this,di).dispose(),E(this,di,new DisposableStack)}}be=new WeakMap,pr=new WeakMap,yn=new WeakMap,di=new WeakMap,fr=new WeakMap,Gs=new WeakMap,pi=new WeakMap,bn=new WeakMap,wn=new WeakMap,Sn=new WeakMap,js=new WeakMap,W=new WeakMap,fi=new WeakMap,Rt=new WeakMap,Z=new WeakSet,Jy=async function(){const t=await py(this);this.setAttribute("tone",t)},qs=new WeakMap,Ys=new WeakMap,vu=function(){var r;const t=l(this,be).activeScreen;l(this,yn)!==t&&(f(this,Z,yu).call(this),E(this,yn,t),(r=l(this,yn))==null||r.addEventListener("change",l(this,Ys)))},yu=function(){var t;(t=l(this,yn))==null||t.removeEventListener("change",l(this,Ys)),E(this,yn,null)},Oa=new WeakMap,Ma=new WeakMap,Na=new WeakMap,Ua=new WeakMap,Fa=new WeakMap,Za=new WeakMap,Ha=new WeakMap,Xs=new WeakMap,gi=new WeakMap,Wa=new WeakMap,Va=new WeakMap,Ba=new WeakMap,Ga=new WeakMap,bu=function(t){l(this,be).setActive(t.serverURL,t.screenID),f(this,Z,ln).call(this)},Qy=function(){const t=[];for(const r of l(this,pr).servers.values())for(const i of r.screens.values())t.push({serverURL:r.url,screenID:i.id,name:i.name,pinned:i.pinned});return t.sort((r,i)=>r.pinned!==i.pinned?r.pinned?-1:1:r.name.localeCompare(i.name,void 0,{sensitivity:"base"}))},la=function(t,r){const i=r.trim().toLowerCase();return i.length===0?t:t.filter(s=>s.name.toLowerCase().includes(i))},ja=new WeakMap,eb=function(){for(const t of l(this,pr).servers.values())return t;return null},ln=function(){let t;l(this,W).kind==="rename"?t=l(this,bn).value:l(this,W).kind==="delete"?t=l(this,wn).value:l(this,W).kind==="picker"&&(t=l(this,Sn).value),t&&(t.open=!1),E(this,W,{kind:"none"}),l(this,qe).call(this)},tb=function(){return N`
256
+ ${f(this,Z,ib).call(this)}
257
+ ${t?f(this,Z,ub).call(this):ee}
258
+ ${t?f(this,Z,hb).call(this,t):ee}
259
+ `,this);const i=l(this,Gs).value??null;l(this,bn).value&&(l(this,bn).value.anchor=i),l(this,wn).value&&(l(this,wn).value.anchor=i),l(this,Sn).value&&(l(this,Sn).value.anchor=l(this,fi).value??null),(s=i==null?void 0:i.scrollIntoView)==null||s.call(i,{block:"nearest",inline:"nearest"})})}connected(){l(this,be).addEventListener("active-screen-changed",l(this,qs)),f(this,Z,yu).call(this),l(this,qe).call(this),f(this,Z,eb).call(this),l(this,pi).defer(()=>{l(this,be).removeEventListener("active-screen-changed",l(this,qs)),f(this,Z,bu).call(this)})}disconnected(){l(this,pi).dispose(),E(this,pi,new DisposableStack)}}be=new WeakMap,pr=new WeakMap,yn=new WeakMap,pi=new WeakMap,fr=new WeakMap,Gs=new WeakMap,fi=new WeakMap,bn=new WeakMap,wn=new WeakMap,Sn=new WeakMap,js=new WeakMap,W=new WeakMap,gi=new WeakMap,Rt=new WeakMap,Z=new WeakSet,eb=async function(){const t=await fy(this);this.setAttribute("tone",t)},qs=new WeakMap,Ys=new WeakMap,yu=function(){var r;const t=l(this,be).activeScreen;l(this,yn)!==t&&(f(this,Z,bu).call(this),E(this,yn,t),(r=l(this,yn))==null||r.addEventListener("change",l(this,Ys)))},bu=function(){var t;(t=l(this,yn))==null||t.removeEventListener("change",l(this,Ys)),E(this,yn,null)},Ma=new WeakMap,Na=new WeakMap,Ua=new WeakMap,Fa=new WeakMap,Za=new WeakMap,Ha=new WeakMap,Wa=new WeakMap,Xs=new WeakMap,mi=new WeakMap,Va=new WeakMap,Ba=new WeakMap,Ga=new WeakMap,ja=new WeakMap,wu=function(t){l(this,be).setActive(t.serverURL,t.screenID),f(this,Z,ln).call(this)},tb=function(){const t=[];for(const r of l(this,pr).servers.values())for(const i of r.screens.values())t.push({serverURL:r.url,screenID:i.id,name:i.name,pinned:i.pinned});return t.sort((r,i)=>r.pinned!==i.pinned?r.pinned?-1:1:r.name.localeCompare(i.name,void 0,{sensitivity:"base"}))},la=function(t,r){const i=r.trim().toLowerCase();return i.length===0?t:t.filter(s=>s.name.toLowerCase().includes(i))},qa=new WeakMap,nb=function(){for(const t of l(this,pr).servers.values())return t;return null},ln=function(){let t;l(this,W).kind==="rename"?t=l(this,bn).value:l(this,W).kind==="delete"?t=l(this,wn).value:l(this,W).kind==="picker"&&(t=l(this,Sn).value),t&&(t.open=!1),E(this,W,{kind:"none"}),l(this,qe).call(this)},rb=function(){return N`
260
260
  <segmented-control variant="glass" role="group" aria-label="Screens">
261
261
  <button
262
262
  type="button"
263
263
  ?icon-only=${!0}
264
264
  aria-label="Choose screen"
265
265
  ?data-active=${l(this,W).kind==="picker"}
266
- @click=${l(this,Wa)}
267
- ${an(l(this,pi))}
266
+ @click=${l(this,Va)}
267
+ ${an(l(this,fi))}
268
268
  >
269
- ${E2({size:16,weight:"regular"})}
269
+ ${A2({size:16,weight:"regular"})}
270
270
  </button>
271
271
  <button
272
272
  type="button"
273
273
  ?icon-only=${!0}
274
274
  aria-label="New screen"
275
- @click=${l(this,ja)}
275
+ @click=${l(this,qa)}
276
276
  >
277
- ${x2({size:16,weight:"regular"})}
277
+ ${$2({size:16,weight:"regular"})}
278
278
  </button>
279
279
  </segmented-control>
280
- `},nb=function(){var o;const t=l(this,W).kind==="picker"?l(this,W).filter:"",r=l(this,W).kind==="picker"?l(this,W).highlightedID:null,i=((o=l(this,be).activeScreen)==null?void 0:o.id)??null,s=f(this,Z,la).call(this,l(this,Rt),t);return N`
280
+ `},ib=function(){var o;const t=l(this,W).kind==="picker"?l(this,W).filter:"",r=l(this,W).kind==="picker"?l(this,W).highlightedID:null,i=((o=l(this,be).activeScreen)==null?void 0:o.id)??null,s=f(this,Z,la).call(this,l(this,Rt),t);return N`
281
281
  <ui-popover
282
282
  class="picker-popover"
283
283
  material="glass-frosted"
284
284
  ?open=${l(this,W).kind==="picker"}
285
- @close=${l(this,gi)}
286
- @keydown=${l(this,Ba)}
285
+ @close=${l(this,mi)}
286
+ @keydown=${l(this,Ga)}
287
287
  ${an(l(this,Sn))}
288
288
  >
289
289
  <div class="picker">
@@ -293,15 +293,15 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
293
293
  placeholder="Filter screens"
294
294
  aria-label="Filter screens"
295
295
  .value=${t}
296
- @input=${l(this,Va)}
296
+ @input=${l(this,Ba)}
297
297
  ${an(l(this,js))}
298
298
  />
299
299
  ${s.length===0?N`<p class="picker-empty">
300
300
  ${l(this,Rt).length===0?"No other screens":"No matches"}
301
- </p>`:f(this,Z,rb).call(this,s,r,i)}
301
+ </p>`:f(this,Z,sb).call(this,s,r,i)}
302
302
  </div>
303
303
  </ui-popover>
304
- `},rb=function(t,r,i){const s=t.filter(c=>c.pinned),o=t.filter(c=>!c.pinned),a=c=>{const u=c.screenID===i;return N`
304
+ `},sb=function(t,r,i){const s=t.filter(c=>c.pinned),o=t.filter(c=>!c.pinned),a=c=>{const u=c.screenID===i;return N`
305
305
  <li
306
306
  class="picker-row"
307
307
  role="option"
@@ -309,7 +309,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
309
309
  aria-current=${u?"true":ee}
310
310
  ?data-highlighted=${c.screenID===r}
311
311
  ?data-active=${u}
312
- @click=${()=>l(this,Ga).call(this,c)}
312
+ @click=${()=>l(this,ja).call(this,c)}
313
313
  >
314
314
  <span class="picker-name">${c.name}</span>
315
315
  </li>
@@ -324,7 +324,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
324
324
  ${o.map(a)}
325
325
  `:ee}
326
326
  </ul>
327
- `},ib=function(){var o;const t=((o=l(this,be).activeScreen)==null?void 0:o.id)??null,r=[];let i=!1;for(const a of l(this,pr).servers.values())for(const c of a.screens.values()){if(!c.pinned)continue;const u=c.id===t;u&&(i=!0),r.push({serverURL:a.url,screenID:c.id,name:c.name,isActive:u})}const s=l(this,be).activeScreen;if(s&&!i){let a=null;for(const c of l(this,pr).servers.values())if(c.screens.has(s.id)){a=c.url;break}a!==null&&r.push({serverURL:a,screenID:s.id,name:s.name,isActive:!0})}return r},sb=function(t,r){l(this,be).setActive(t,r)},ob=function(t){return N`
327
+ `},ob=function(){var o;const t=((o=l(this,be).activeScreen)==null?void 0:o.id)??null,r=[];let i=!1;for(const a of l(this,pr).servers.values())for(const c of a.screens.values()){if(!c.pinned)continue;const u=c.id===t;u&&(i=!0),r.push({serverURL:a.url,screenID:c.id,name:c.name,isActive:u})}const s=l(this,be).activeScreen;if(s&&!i){let a=null;for(const c of l(this,pr).servers.values())if(c.screens.has(s.id)){a=c.url;break}a!==null&&r.push({serverURL:a,screenID:s.id,name:s.name,isActive:!0})}return r},ab=function(t,r){l(this,be).setActive(t,r)},lb=function(t){return N`
328
328
  <dropdown-menu ${an(l(this,fr))}>
329
329
  <button
330
330
  slot="trigger"
@@ -334,47 +334,47 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
334
334
  aria-current="page"
335
335
  aria-label=${`Screen actions for ${t.name}`}
336
336
  ?data-active=${l(this,W).kind==="rename"||l(this,W).kind==="delete"}
337
- @click=${l(this,Oa)}
337
+ @click=${l(this,Ma)}
338
338
  ${an(l(this,Gs))}
339
339
  >
340
340
  ${t.name}
341
341
  </button>
342
342
  <dropdown-group>
343
- <dropdown-item action @click=${l(this,Ma)}>
344
- ${T2()} ${t.pinned?"Unpin screen":"Pin screen"}
345
- </dropdown-item>
346
343
  <dropdown-item action @click=${l(this,Na)}>
347
- ${$2()} Rename
344
+ ${P2()} ${t.pinned?"Unpin screen":"Pin screen"}
345
+ </dropdown-item>
346
+ <dropdown-item action @click=${l(this,Ua)}>
347
+ ${T2()} Rename
348
348
  </dropdown-item>
349
- <dropdown-item action danger @click=${l(this,Ua)}>
350
- ${I2()} Delete
349
+ <dropdown-item action danger @click=${l(this,Fa)}>
350
+ ${C2()} Delete
351
351
  </dropdown-item>
352
352
  </dropdown-group>
353
353
  </dropdown-menu>
354
- `},ab=function(t,r,i){return N`
354
+ `},cb=function(t,r,i){return N`
355
355
  <button
356
356
  type="button"
357
357
  variant="glass"
358
358
  class="screen-name"
359
359
  aria-label=${`Switch to ${i}`}
360
- @click=${()=>f(this,Z,sb).call(this,t,r)}
360
+ @click=${()=>f(this,Z,ab).call(this,t,r)}
361
361
  >
362
362
  ${i}
363
363
  </button>
364
- `},lb=function(){const t=l(this,W).kind==="rename"?l(this,W).draft:"";return N`
364
+ `},ub=function(){const t=l(this,W).kind==="rename"?l(this,W).draft:"";return N`
365
365
  <ui-popover
366
366
  class="rename-popover"
367
367
  ?open=${l(this,W).kind==="rename"}
368
- @close=${l(this,gi)}
368
+ @close=${l(this,mi)}
369
369
  ${an(l(this,bn))}
370
370
  >
371
- <form class="screen-form" @submit=${l(this,Za)}>
371
+ <form class="screen-form" @submit=${l(this,Ha)}>
372
372
  <label class="field">
373
373
  <span>Screen name</span>
374
374
  <input
375
375
  type="text"
376
376
  .value=${t}
377
- @input=${l(this,Fa)}
377
+ @input=${l(this,Za)}
378
378
  />
379
379
  </label>
380
380
  <div class="actions">
@@ -383,11 +383,11 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
383
383
  </div>
384
384
  </form>
385
385
  </ui-popover>
386
- `},cb=function(t){const r=l(this,W).kind==="delete"?l(this,W).error:null;return N`
386
+ `},hb=function(t){const r=l(this,W).kind==="delete"?l(this,W).error:null;return N`
387
387
  <ui-popover
388
388
  class="delete-popover"
389
389
  ?open=${l(this,W).kind==="delete"}
390
- @close=${l(this,gi)}
390
+ @close=${l(this,mi)}
391
391
  ${an(l(this,wn))}
392
392
  >
393
393
  <div class="screen-form">
@@ -398,20 +398,20 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
398
398
  <button
399
399
  type="button"
400
400
  variant="danger"
401
- @click=${l(this,Ha)}
401
+ @click=${l(this,Wa)}
402
402
  >
403
403
  Delete
404
404
  </button>
405
405
  </div>
406
406
  </div>
407
407
  </ui-popover>
408
- `},qe=new WeakMap;customElements.define("screen-select",KL);function JL(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}`}function QL(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{var a;const o=((a=n.activeServer)==null?void 0:a.acpClient)??null;o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(c=>{console.error("ACPClient.connect() failed",c)})),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:ub,setPrototypeOf:Uf,isFrozen:ez,getPrototypeOf:tz,getOwnPropertyDescriptor:nz}=Object;let{freeze:Ze,seal:ct,create:ca}=Object,{apply:wu,construct:Su}=typeof Reflect<"u"&&Reflect;Ze||(Ze=function(e){return e});ct||(ct=function(e){return e});wu||(wu=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)});Su||(Su=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 Wo=He(Array.prototype.forEach),rz=He(Array.prototype.lastIndexOf),Ff=He(Array.prototype.pop),Hi=He(Array.prototype.push),iz=He(Array.prototype.splice),ua=He(String.prototype.toLowerCase),yc=He(String.prototype.toString),bc=He(String.prototype.match),Wi=He(String.prototype.replace),sz=He(String.prototype.indexOf),oz=He(String.prototype.trim),Je=He(Object.prototype.hasOwnProperty),Oe=He(RegExp.prototype.test),Vi=az(TypeError);function He(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 wu(n,e,r)}}function az(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Su(n,t)}}function j(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ua;Uf&&Uf(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(ez(e)||(e[r]=s),i=s)}n[i]=!0}return n}function lz(n){for(let e=0;e<n.length;e++)Je(n,e)||(n[e]=null);return n}function xt(n){const e=ca(null);for(const[t,r]of ub(n))Je(n,t)&&(Array.isArray(r)?e[t]=lz(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=xt(r):e[t]=r);return e}function Bi(n,e){for(;n!==null;){const r=nz(n,e);if(r){if(r.get)return He(r.get);if(typeof r.value=="function")return He(r.value)}n=tz(n)}function t(){return null}return t}const Zf=Ze(["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"]),wc=Ze(["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"]),Sc=Ze(["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"]),cz=Ze(["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"]),_c=Ze(["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"]),uz=Ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hf=Ze(["#text"]),Wf=Ze(["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"]),kc=Ze(["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"]),Vf=Ze(["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"]),Vo=Ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),hz=ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),dz=ct(/<%[\w\W]*|[\w\W]*%>/gm),pz=ct(/\$\{[\w\W]*/gm),fz=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),gz=ct(/^aria-[\-\w]+$/),hb=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mz=ct(/^(?:\w+script|data):/i),vz=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),db=ct(/^html$/i),yz=ct(/^[a-z][.\w]*(-[.\w]+)+$/i);var Bf=Object.freeze({__proto__:null,ARIA_ATTR:gz,ATTR_WHITESPACE:vz,CUSTOM_ELEMENT:yz,DATA_ATTR:fz,DOCTYPE_NAME:db,ERB_EXPR:dz,IS_ALLOWED_URI:hb,IS_SCRIPT_OR_DATA:mz,MUSTACHE_EXPR:hz,TMPLIT_EXPR:pz});const Gi={element:1,text:3,progressingInstruction:7,comment:8,document:9},bz=function(){return typeof window>"u"?null:window},wz=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}},Gf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function pb(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bz();const e=M=>pb(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Gi.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:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:v,trustedTypes:m}=n,x=c.prototype,_=Bi(x,"cloneNode"),C=Bi(x,"remove"),U=Bi(x,"nextSibling"),P=Bi(x,"childNodes"),B=Bi(x,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let L,V="";const{implementation:F,createNodeIterator:he,createDocumentFragment:de,getElementsByTagName:Dn}=t,{importNode:yo}=r;let $e=Gf();e.isSupported=typeof ub=="function"&&typeof B=="function"&&F&&F.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ln,ERB_EXPR:wt,TMPLIT_EXPR:rn,DATA_ATTR:yl,ARIA_ATTR:bo,IS_SCRIPT_OR_DATA:Tb,ATTR_WHITESPACE:zh,CUSTOM_ELEMENT:Cb}=Bf;let{IS_ALLOWED_URI:Oh}=Bf,Ee=null;const Mh=j({},[...Zf,...wc,...Sc,..._c,...Hf]);let Ie=null;const Nh=j({},[...Wf,...kc,...Vf,...Vo]);let ve=Object.seal(ca(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}})),zi=null,wo=null;const sn=Object.seal(ca(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Uh=!0,bl=!0,Fh=!1,Zh=!0,$r=!1,So=!0,zn=!1,wl=!1,Sl=!1,Ir=!1,_o=!1,ko=!1,Hh=!0,Wh=!1;const Pb="user-content-";let _l=!0,Oi=!1,Tr={},St=null;const kl=j({},["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 Vh=null;const Bh=j({},["audio","video","img","source","image","track"]);let El=null;const Gh=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Eo="http://www.w3.org/1998/Math/MathML",xo="http://www.w3.org/2000/svg",Ot="http://www.w3.org/1999/xhtml";let Cr=Ot,xl=!1,Al=null;const Rb=j({},[Eo,xo,Ot],yc);let Ao=j({},["mi","mo","mn","ms","mtext"]),$o=j({},["annotation-xml"]);const Db=j({},["title","style","font","a","script"]);let Mi=null;const Lb=["application/xhtml+xml","text/html"],zb="text/html";let Se=null,Pr=null;const Ob=t.createElement("form"),jh=function(y){return y instanceof RegExp||y instanceof Function},$l=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Pr&&Pr===y)){if((!y||typeof y!="object")&&(y={}),y=xt(y),Mi=Lb.indexOf(y.PARSER_MEDIA_TYPE)===-1?zb:y.PARSER_MEDIA_TYPE,Se=Mi==="application/xhtml+xml"?yc:ua,Ee=Je(y,"ALLOWED_TAGS")?j({},y.ALLOWED_TAGS,Se):Mh,Ie=Je(y,"ALLOWED_ATTR")?j({},y.ALLOWED_ATTR,Se):Nh,Al=Je(y,"ALLOWED_NAMESPACES")?j({},y.ALLOWED_NAMESPACES,yc):Rb,El=Je(y,"ADD_URI_SAFE_ATTR")?j(xt(Gh),y.ADD_URI_SAFE_ATTR,Se):Gh,Vh=Je(y,"ADD_DATA_URI_TAGS")?j(xt(Bh),y.ADD_DATA_URI_TAGS,Se):Bh,St=Je(y,"FORBID_CONTENTS")?j({},y.FORBID_CONTENTS,Se):kl,zi=Je(y,"FORBID_TAGS")?j({},y.FORBID_TAGS,Se):xt({}),wo=Je(y,"FORBID_ATTR")?j({},y.FORBID_ATTR,Se):xt({}),Tr=Je(y,"USE_PROFILES")?y.USE_PROFILES:!1,Uh=y.ALLOW_ARIA_ATTR!==!1,bl=y.ALLOW_DATA_ATTR!==!1,Fh=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Zh=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$r=y.SAFE_FOR_TEMPLATES||!1,So=y.SAFE_FOR_XML!==!1,zn=y.WHOLE_DOCUMENT||!1,Ir=y.RETURN_DOM||!1,_o=y.RETURN_DOM_FRAGMENT||!1,ko=y.RETURN_TRUSTED_TYPE||!1,Sl=y.FORCE_BODY||!1,Hh=y.SANITIZE_DOM!==!1,Wh=y.SANITIZE_NAMED_PROPS||!1,_l=y.KEEP_CONTENT!==!1,Oi=y.IN_PLACE||!1,Oh=y.ALLOWED_URI_REGEXP||hb,Cr=y.NAMESPACE||Ot,Ao=y.MATHML_TEXT_INTEGRATION_POINTS||Ao,$o=y.HTML_INTEGRATION_POINTS||$o,ve=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&jh(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ve.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&jh(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ve.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$r&&(bl=!1),_o&&(Ir=!0),Tr&&(Ee=j({},Hf),Ie=ca(null),Tr.html===!0&&(j(Ee,Zf),j(Ie,Wf)),Tr.svg===!0&&(j(Ee,wc),j(Ie,kc),j(Ie,Vo)),Tr.svgFilters===!0&&(j(Ee,Sc),j(Ie,kc),j(Ie,Vo)),Tr.mathMl===!0&&(j(Ee,_c),j(Ie,Vf),j(Ie,Vo))),Je(y,"ADD_TAGS")||(sn.tagCheck=null),Je(y,"ADD_ATTR")||(sn.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?sn.tagCheck=y.ADD_TAGS:(Ee===Mh&&(Ee=xt(Ee)),j(Ee,y.ADD_TAGS,Se))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?sn.attributeCheck=y.ADD_ATTR:(Ie===Nh&&(Ie=xt(Ie)),j(Ie,y.ADD_ATTR,Se))),y.ADD_URI_SAFE_ATTR&&j(El,y.ADD_URI_SAFE_ATTR,Se),y.FORBID_CONTENTS&&(St===kl&&(St=xt(St)),j(St,y.FORBID_CONTENTS,Se)),y.ADD_FORBID_CONTENTS&&(St===kl&&(St=xt(St)),j(St,y.ADD_FORBID_CONTENTS,Se)),_l&&(Ee["#text"]=!0),zn&&j(Ee,["html","head","body"]),Ee.table&&(j(Ee,["tbody"]),delete zi.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=y.TRUSTED_TYPES_POLICY,V=L.createHTML("")}else L===void 0&&(L=wz(m,i)),L!==null&&typeof V=="string"&&(V=L.createHTML(""));Ze&&Ze(y),Pr=y}},qh=j({},[...wc,...Sc,...cz]),Yh=j({},[..._c,...uz]),Mb=function(y){let T=B(y);(!T||!T.tagName)&&(T={namespaceURI:Cr,tagName:"template"});const R=ua(y.tagName),ae=ua(T.tagName);return Al[y.namespaceURI]?y.namespaceURI===xo?T.namespaceURI===Ot?R==="svg":T.namespaceURI===Eo?R==="svg"&&(ae==="annotation-xml"||Ao[ae]):!!qh[R]:y.namespaceURI===Eo?T.namespaceURI===Ot?R==="math":T.namespaceURI===xo?R==="math"&&$o[ae]:!!Yh[R]:y.namespaceURI===Ot?T.namespaceURI===xo&&!$o[ae]||T.namespaceURI===Eo&&!Ao[ae]?!1:!Yh[R]&&(Db[R]||!qh[R]):!!(Mi==="application/xhtml+xml"&&Al[y.namespaceURI]):!1},_t=function(y){Hi(e.removed,{element:y});try{B(y).removeChild(y)}catch{C(y)}},On=function(y,T){try{Hi(e.removed,{attribute:T.getAttributeNode(y),from:T})}catch{Hi(e.removed,{attribute:null,from:T})}if(T.removeAttribute(y),y==="is")if(Ir||_o)try{_t(T)}catch{}else try{T.setAttribute(y,"")}catch{}},Xh=function(y){let T=null,R=null;if(Sl)y="<remove></remove>"+y;else{const ye=bc(y,/^[\r\n\t ]+/);R=ye&&ye[0]}Mi==="application/xhtml+xml"&&Cr===Ot&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const ae=L?L.createHTML(y):y;if(Cr===Ot)try{T=new v().parseFromString(ae,Mi)}catch{}if(!T||!T.documentElement){T=F.createDocument(Cr,"template",null);try{T.documentElement.innerHTML=xl?V:ae}catch{}}const De=T.body||T.documentElement;return y&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Cr===Ot?Dn.call(T,zn?"html":"body")[0]:zn?T.documentElement:De},Kh=function(y){return he.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Il=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")},Jh=function(y){return typeof a=="function"&&y instanceof a};function Mt(M,y,T){Wo(M,R=>{R.call(e,y,T,Pr)})}const Qh=function(y){let T=null;if(Mt($e.beforeSanitizeElements,y,null),Il(y))return _t(y),!0;const R=Se(y.nodeName);if(Mt($e.uponSanitizeElement,y,{tagName:R,allowedTags:Ee}),So&&y.hasChildNodes()&&!Jh(y.firstElementChild)&&Oe(/<[/\w!]/g,y.innerHTML)&&Oe(/<[/\w!]/g,y.textContent)||y.nodeType===Gi.progressingInstruction||So&&y.nodeType===Gi.comment&&Oe(/<[/\w]/g,y.data))return _t(y),!0;if(!(sn.tagCheck instanceof Function&&sn.tagCheck(R))&&(!Ee[R]||zi[R])){if(!zi[R]&&td(R)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R)))return!1;if(_l&&!St[R]){const ae=B(y)||y.parentNode,De=P(y)||y.childNodes;if(De&&ae){const ye=De.length;for(let We=ye-1;We>=0;--We){const Nt=_(De[We],!0);Nt.__removalCount=(y.__removalCount||0)+1,ae.insertBefore(Nt,U(y))}}}return _t(y),!0}return y instanceof c&&!Mb(y)||(R==="noscript"||R==="noembed"||R==="noframes")&&Oe(/<\/no(script|embed|frames)/i,y.innerHTML)?(_t(y),!0):($r&&y.nodeType===Gi.text&&(T=y.textContent,Wo([Ln,wt,rn],ae=>{T=Wi(T,ae," ")}),y.textContent!==T&&(Hi(e.removed,{element:y.cloneNode()}),y.textContent=T)),Mt($e.afterSanitizeElements,y,null),!1)},ed=function(y,T,R){if(wo[T]||Hh&&(T==="id"||T==="name")&&(R in t||R in Ob))return!1;if(!(bl&&!wo[T]&&Oe(yl,T))){if(!(Uh&&Oe(bo,T))){if(!(sn.attributeCheck instanceof Function&&sn.attributeCheck(T,y))){if(!Ie[T]||wo[T]){if(!(td(y)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,y)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(y))&&(ve.attributeNameCheck instanceof RegExp&&Oe(ve.attributeNameCheck,T)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(T,y))||T==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R))))return!1}else if(!El[T]){if(!Oe(Oh,Wi(R,zh,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&y!=="script"&&sz(R,"data:")===0&&Vh[y])){if(!(Fh&&!Oe(Tb,Wi(R,zh,"")))){if(R)return!1}}}}}}}return!0},td=function(y){return y!=="annotation-xml"&&bc(y,Cb)},nd=function(y){Mt($e.beforeSanitizeAttributes,y,null);const{attributes:T}=y;if(!T||Il(y))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0};let ae=T.length;for(;ae--;){const De=T[ae],{name:ye,namespaceURI:We,value:Nt}=De,Rr=Se(ye),Tl=Nt;let Te=ye==="value"?Tl:oz(Tl);if(R.attrName=Rr,R.attrValue=Te,R.keepAttr=!0,R.forceKeepAttr=void 0,Mt($e.uponSanitizeAttribute,y,R),Te=R.attrValue,Wh&&(Rr==="id"||Rr==="name")&&(On(ye,y),Te=Pb+Te),So&&Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Te)){On(ye,y);continue}if(Rr==="attributename"&&bc(Te,"href")){On(ye,y);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){On(ye,y);continue}if(!Zh&&Oe(/\/>/i,Te)){On(ye,y);continue}$r&&Wo([Ln,wt,rn],id=>{Te=Wi(Te,id," ")});const rd=Se(y.nodeName);if(!ed(rd,Rr,Te)){On(ye,y);continue}if(L&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!We)switch(m.getAttributeType(rd,Rr)){case"TrustedHTML":{Te=L.createHTML(Te);break}case"TrustedScriptURL":{Te=L.createScriptURL(Te);break}}if(Te!==Tl)try{We?y.setAttributeNS(We,ye,Te):y.setAttribute(ye,Te),Il(y)?_t(y):Ff(e.removed)}catch{On(ye,y)}}Mt($e.afterSanitizeAttributes,y,null)},Nb=function M(y){let T=null;const R=Kh(y);for(Mt($e.beforeSanitizeShadowDOM,y,null);T=R.nextNode();)Mt($e.uponSanitizeShadowNode,T,null),Qh(T),nd(T),T.content instanceof s&&M(T.content);Mt($e.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(M){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,R=null,ae=null,De=null;if(xl=!M,xl&&(M="<!-->"),typeof M!="string"&&!Jh(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Vi("dirty is not a string, aborting")}else throw Vi("toString is not a function");if(!e.isSupported)return M;if(wl||$l(y),e.removed=[],typeof M=="string"&&(Oi=!1),Oi){if(M.nodeName){const Nt=Se(M.nodeName);if(!Ee[Nt]||zi[Nt])throw Vi("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)T=Xh("<!---->"),R=T.ownerDocument.importNode(M,!0),R.nodeType===Gi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?T=R:T.appendChild(R);else{if(!Ir&&!$r&&!zn&&M.indexOf("<")===-1)return L&&ko?L.createHTML(M):M;if(T=Xh(M),!T)return Ir?null:ko?V:""}T&&Sl&&_t(T.firstChild);const ye=Kh(Oi?M:T);for(;ae=ye.nextNode();)Qh(ae),nd(ae),ae.content instanceof s&&Nb(ae.content);if(Oi)return M;if(Ir){if(_o)for(De=de.call(T.ownerDocument);T.firstChild;)De.appendChild(T.firstChild);else De=T;return(Ie.shadowroot||Ie.shadowrootmode)&&(De=yo.call(r,De,!0)),De}let We=zn?T.outerHTML:T.innerHTML;return zn&&Ee["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Oe(db,T.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
409
- `+We),$r&&Wo([Ln,wt,rn],Nt=>{We=Wi(We,Nt," ")}),L&&ko?L.createHTML(We):We},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$l(M),wl=!0},e.clearConfig=function(){Pr=null,wl=!1},e.isValidAttribute=function(M,y,T){Pr||$l({});const R=Se(M),ae=Se(y);return ed(R,ae,T)},e.addHook=function(M,y){typeof y=="function"&&Hi($e[M],y)},e.removeHook=function(M,y){if(y!==void 0){const T=rz($e[M],y);return T===-1?void 0:iz($e[M],T,1)[0]}return Ff($e[M])},e.removeHooks=function(M){$e[M]=[]},e.removeAllHooks=function(){$e=Gf()},e}var fb=pb();function _h(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ar=_h();function gb(n){Ar=n}var Vn={exec:()=>null};function K(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(Ue.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var Sz=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ue={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)}}>`)},_z=/^(?:[ \t]*(?:\n|$))+/,kz=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ez=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xz=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,mb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vb=K(mb).replace(/bull/g,kh).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(),Az=K(mb).replace(/bull/g,kh).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(),Eh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$z=/^[^\n]+/,xh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Iz=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Tz=K(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kh).getRegex(),ml="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",Ah=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Cz=K("^ {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",Ah).replace("tag",ml).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yb=K(Eh).replace("hr",vo).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",ml).getRegex(),Pz=K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",yb).getRegex(),$h={blockquote:Pz,code:kz,def:Iz,fences:Ez,heading:xz,hr:vo,html:Cz,lheading:vb,list:Tz,newline:_z,paragraph:yb,table:Vn,text:$z},jf=K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vo).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",ml).getRegex(),Rz={...$h,lheading:Az,table:jf,paragraph:K(Eh).replace("hr",vo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jf).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",ml).getRegex()},Dz={...$h,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ah).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:Vn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(Eh).replace("hr",vo).replace("heading",` *#{1,6} *[^
410
- ]`).replace("lheading",vb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Lz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bb=/^( {2,}|\\)\n(?!\s*$)/,Oz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Li=/[\p{P}\p{S}]/u,vl=/[\s\p{P}\p{S}]/u,Ih=/[^\s\p{P}\p{S}]/u,Mz=K(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,vl).getRegex(),wb=/(?!~)[\p{P}\p{S}]/u,Nz=/(?!~)[\s\p{P}\p{S}]/u,Uz=/(?:[^\s\p{P}\p{S}]|~)/u,Fz=K(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Sz?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Sb=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Zz=K(Sb,"u").replace(/punct/g,Li).getRegex(),Hz=K(Sb,"u").replace(/punct/g,wb).getRegex(),_b="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Wz=K(_b,"gu").replace(/notPunctSpace/g,Ih).replace(/punctSpace/g,vl).replace(/punct/g,Li).getRegex(),Vz=K(_b,"gu").replace(/notPunctSpace/g,Uz).replace(/punctSpace/g,Nz).replace(/punct/g,wb).getRegex(),Bz=K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ih).replace(/punctSpace/g,vl).replace(/punct/g,Li).getRegex(),Gz=K(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Li).getRegex(),jz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",qz=K(jz,"gu").replace(/notPunctSpace/g,Ih).replace(/punctSpace/g,vl).replace(/punct/g,Li).getRegex(),Yz=K(/\\(punct)/,"gu").replace(/punct/g,Li).getRegex(),Xz=K(/^<(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(),Kz=K(Ah).replace("(?:-->|$)","-->").getRegex(),Jz=K("^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",Kz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$a=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Qz=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",$a).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kb=K(/^!?\[(label)\]\[(ref)\]/).replace("label",$a).replace("ref",xh).getRegex(),Eb=K(/^!?\[(ref)\](?:\[\])?/).replace("ref",xh).getRegex(),eO=K("reflink|nolink(?!\\()","g").replace("reflink",kb).replace("nolink",Eb).getRegex(),qf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Th={_backpedal:Vn,anyPunctuation:Yz,autolink:Xz,blockSkip:Fz,br:bb,code:zz,del:Vn,delLDelim:Vn,delRDelim:Vn,emStrongLDelim:Zz,emStrongRDelimAst:Wz,emStrongRDelimUnd:Bz,escape:Lz,link:Qz,nolink:Eb,punctuation:Mz,reflink:kb,reflinkSearch:eO,tag:Jz,text:Oz,url:Vn},tO={...Th,link:K(/^!?\[(label)\]\((.*?)\)/).replace("label",$a).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$a).getRegex()},_u={...Th,emStrongRDelimAst:Vz,emStrongLDelim:Hz,delLDelim:Gz,delRDelim:qz,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",qf).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:K(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",qf).getRegex()},nO={..._u,br:K(bb).replace("{2,}","*").getRegex(),text:K(_u.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Bo={normal:$h,gfm:Rz,pedantic:Dz},ji={normal:Th,gfm:_u,breaks:nO,pedantic:tO},rO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yf=n=>rO[n];function At(n,e){if(e){if(Ue.escapeTest.test(n))return n.replace(Ue.escapeReplace,Yf)}else if(Ue.escapeTestNoEncode.test(n))return n.replace(Ue.escapeReplaceNoEncode,Yf);return n}function Xf(n){try{n=encodeURI(n).replace(Ue.percentDecode,"%")}catch{return null}return n}function Kf(n,e){var s;let t=n.replace(Ue.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Ue.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(Ue.slashPipe,"|");return r}function qi(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 iO(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 sO(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 Jf(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 c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function oO(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
408
+ `},qe=new WeakMap;customElements.define("screen-select",ez);function tz(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}`}function nz(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{var a;const o=((a=n.activeServer)==null?void 0:a.acpClient)??null;o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(c=>{console.error("ACPClient.connect() failed",c)})),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:db,setPrototypeOf:Ff,isFrozen:rz,getPrototypeOf:iz,getOwnPropertyDescriptor:sz}=Object;let{freeze:Ze,seal:ct,create:ca}=Object,{apply:Su,construct:_u}=typeof Reflect<"u"&&Reflect;Ze||(Ze=function(e){return e});ct||(ct=function(e){return e});Su||(Su=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)});_u||(_u=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 Wo=He(Array.prototype.forEach),oz=He(Array.prototype.lastIndexOf),Zf=He(Array.prototype.pop),Wi=He(Array.prototype.push),az=He(Array.prototype.splice),ua=He(String.prototype.toLowerCase),bc=He(String.prototype.toString),wc=He(String.prototype.match),Vi=He(String.prototype.replace),lz=He(String.prototype.indexOf),cz=He(String.prototype.trim),Je=He(Object.prototype.hasOwnProperty),Oe=He(RegExp.prototype.test),Bi=uz(TypeError);function He(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 Su(n,e,r)}}function uz(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return _u(n,t)}}function j(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ua;Ff&&Ff(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(rz(e)||(e[r]=s),i=s)}n[i]=!0}return n}function hz(n){for(let e=0;e<n.length;e++)Je(n,e)||(n[e]=null);return n}function xt(n){const e=ca(null);for(const[t,r]of db(n))Je(n,t)&&(Array.isArray(r)?e[t]=hz(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=xt(r):e[t]=r);return e}function Gi(n,e){for(;n!==null;){const r=sz(n,e);if(r){if(r.get)return He(r.get);if(typeof r.value=="function")return He(r.value)}n=iz(n)}function t(){return null}return t}const Hf=Ze(["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"]),Sc=Ze(["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"]),_c=Ze(["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"]),dz=Ze(["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"]),kc=Ze(["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"]),pz=Ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Wf=Ze(["#text"]),Vf=Ze(["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"]),Ec=Ze(["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"]),Bf=Ze(["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"]),Vo=Ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fz=ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),gz=ct(/<%[\w\W]*|[\w\W]*%>/gm),mz=ct(/\$\{[\w\W]*/gm),vz=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),yz=ct(/^aria-[\-\w]+$/),pb=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bz=ct(/^(?:\w+script|data):/i),wz=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fb=ct(/^html$/i),Sz=ct(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gf=Object.freeze({__proto__:null,ARIA_ATTR:yz,ATTR_WHITESPACE:wz,CUSTOM_ELEMENT:Sz,DATA_ATTR:vz,DOCTYPE_NAME:fb,ERB_EXPR:gz,IS_ALLOWED_URI:pb,IS_SCRIPT_OR_DATA:bz,MUSTACHE_EXPR:fz,TMPLIT_EXPR:mz});const ji={element:1,text:3,progressingInstruction:7,comment:8,document:9},_z=function(){return typeof window>"u"?null:window},kz=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}},jf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function gb(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_z();const e=M=>gb(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==ji.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:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:v,trustedTypes:m}=n,x=c.prototype,_=Gi(x,"cloneNode"),C=Gi(x,"remove"),U=Gi(x,"nextSibling"),P=Gi(x,"childNodes"),B=Gi(x,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let L,V="";const{implementation:F,createNodeIterator:he,createDocumentFragment:de,getElementsByTagName:Dn}=t,{importNode:yo}=r;let Ie=jf();e.isSupported=typeof db=="function"&&typeof B=="function"&&F&&F.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ln,ERB_EXPR:wt,TMPLIT_EXPR:rn,DATA_ATTR:bl,ARIA_ATTR:bo,IS_SCRIPT_OR_DATA:Pb,ATTR_WHITESPACE:Oh,CUSTOM_ELEMENT:Rb}=Gf;let{IS_ALLOWED_URI:Mh}=Gf,xe=null;const Nh=j({},[...Hf,...Sc,..._c,...kc,...Wf]);let Te=null;const Uh=j({},[...Vf,...Ec,...Bf,...Vo]);let ve=Object.seal(ca(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}})),Oi=null,wo=null;const sn=Object.seal(ca(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fh=!0,wl=!0,Zh=!1,Hh=!0,$r=!1,So=!0,zn=!1,Sl=!1,_l=!1,Ir=!1,_o=!1,ko=!1,Wh=!0,Vh=!1;const Db="user-content-";let kl=!0,Mi=!1,Tr={},St=null;const El=j({},["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 Bh=null;const Gh=j({},["audio","video","img","source","image","track"]);let xl=null;const jh=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Eo="http://www.w3.org/1998/Math/MathML",xo="http://www.w3.org/2000/svg",Ot="http://www.w3.org/1999/xhtml";let Cr=Ot,Al=!1,$l=null;const Lb=j({},[Eo,xo,Ot],bc);let Ao=j({},["mi","mo","mn","ms","mtext"]),$o=j({},["annotation-xml"]);const zb=j({},["title","style","font","a","script"]);let Ni=null;const Ob=["application/xhtml+xml","text/html"],Mb="text/html";let _e=null,Pr=null;const Nb=t.createElement("form"),qh=function(y){return y instanceof RegExp||y instanceof Function},Il=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Pr&&Pr===y)){if((!y||typeof y!="object")&&(y={}),y=xt(y),Ni=Ob.indexOf(y.PARSER_MEDIA_TYPE)===-1?Mb:y.PARSER_MEDIA_TYPE,_e=Ni==="application/xhtml+xml"?bc:ua,xe=Je(y,"ALLOWED_TAGS")?j({},y.ALLOWED_TAGS,_e):Nh,Te=Je(y,"ALLOWED_ATTR")?j({},y.ALLOWED_ATTR,_e):Uh,$l=Je(y,"ALLOWED_NAMESPACES")?j({},y.ALLOWED_NAMESPACES,bc):Lb,xl=Je(y,"ADD_URI_SAFE_ATTR")?j(xt(jh),y.ADD_URI_SAFE_ATTR,_e):jh,Bh=Je(y,"ADD_DATA_URI_TAGS")?j(xt(Gh),y.ADD_DATA_URI_TAGS,_e):Gh,St=Je(y,"FORBID_CONTENTS")?j({},y.FORBID_CONTENTS,_e):El,Oi=Je(y,"FORBID_TAGS")?j({},y.FORBID_TAGS,_e):xt({}),wo=Je(y,"FORBID_ATTR")?j({},y.FORBID_ATTR,_e):xt({}),Tr=Je(y,"USE_PROFILES")?y.USE_PROFILES:!1,Fh=y.ALLOW_ARIA_ATTR!==!1,wl=y.ALLOW_DATA_ATTR!==!1,Zh=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Hh=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$r=y.SAFE_FOR_TEMPLATES||!1,So=y.SAFE_FOR_XML!==!1,zn=y.WHOLE_DOCUMENT||!1,Ir=y.RETURN_DOM||!1,_o=y.RETURN_DOM_FRAGMENT||!1,ko=y.RETURN_TRUSTED_TYPE||!1,_l=y.FORCE_BODY||!1,Wh=y.SANITIZE_DOM!==!1,Vh=y.SANITIZE_NAMED_PROPS||!1,kl=y.KEEP_CONTENT!==!1,Mi=y.IN_PLACE||!1,Mh=y.ALLOWED_URI_REGEXP||pb,Cr=y.NAMESPACE||Ot,Ao=y.MATHML_TEXT_INTEGRATION_POINTS||Ao,$o=y.HTML_INTEGRATION_POINTS||$o,ve=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&qh(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ve.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&qh(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ve.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ve.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$r&&(wl=!1),_o&&(Ir=!0),Tr&&(xe=j({},Wf),Te=ca(null),Tr.html===!0&&(j(xe,Hf),j(Te,Vf)),Tr.svg===!0&&(j(xe,Sc),j(Te,Ec),j(Te,Vo)),Tr.svgFilters===!0&&(j(xe,_c),j(Te,Ec),j(Te,Vo)),Tr.mathMl===!0&&(j(xe,kc),j(Te,Bf),j(Te,Vo))),Je(y,"ADD_TAGS")||(sn.tagCheck=null),Je(y,"ADD_ATTR")||(sn.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?sn.tagCheck=y.ADD_TAGS:(xe===Nh&&(xe=xt(xe)),j(xe,y.ADD_TAGS,_e))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?sn.attributeCheck=y.ADD_ATTR:(Te===Uh&&(Te=xt(Te)),j(Te,y.ADD_ATTR,_e))),y.ADD_URI_SAFE_ATTR&&j(xl,y.ADD_URI_SAFE_ATTR,_e),y.FORBID_CONTENTS&&(St===El&&(St=xt(St)),j(St,y.FORBID_CONTENTS,_e)),y.ADD_FORBID_CONTENTS&&(St===El&&(St=xt(St)),j(St,y.ADD_FORBID_CONTENTS,_e)),kl&&(xe["#text"]=!0),zn&&j(xe,["html","head","body"]),xe.table&&(j(xe,["tbody"]),delete Oi.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=y.TRUSTED_TYPES_POLICY,V=L.createHTML("")}else L===void 0&&(L=kz(m,i)),L!==null&&typeof V=="string"&&(V=L.createHTML(""));Ze&&Ze(y),Pr=y}},Yh=j({},[...Sc,..._c,...dz]),Xh=j({},[...kc,...pz]),Ub=function(y){let T=B(y);(!T||!T.tagName)&&(T={namespaceURI:Cr,tagName:"template"});const R=ua(y.tagName),ae=ua(T.tagName);return $l[y.namespaceURI]?y.namespaceURI===xo?T.namespaceURI===Ot?R==="svg":T.namespaceURI===Eo?R==="svg"&&(ae==="annotation-xml"||Ao[ae]):!!Yh[R]:y.namespaceURI===Eo?T.namespaceURI===Ot?R==="math":T.namespaceURI===xo?R==="math"&&$o[ae]:!!Xh[R]:y.namespaceURI===Ot?T.namespaceURI===xo&&!$o[ae]||T.namespaceURI===Eo&&!Ao[ae]?!1:!Xh[R]&&(zb[R]||!Yh[R]):!!(Ni==="application/xhtml+xml"&&$l[y.namespaceURI]):!1},_t=function(y){Wi(e.removed,{element:y});try{B(y).removeChild(y)}catch{C(y)}},On=function(y,T){try{Wi(e.removed,{attribute:T.getAttributeNode(y),from:T})}catch{Wi(e.removed,{attribute:null,from:T})}if(T.removeAttribute(y),y==="is")if(Ir||_o)try{_t(T)}catch{}else try{T.setAttribute(y,"")}catch{}},Kh=function(y){let T=null,R=null;if(_l)y="<remove></remove>"+y;else{const ye=wc(y,/^[\r\n\t ]+/);R=ye&&ye[0]}Ni==="application/xhtml+xml"&&Cr===Ot&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const ae=L?L.createHTML(y):y;if(Cr===Ot)try{T=new v().parseFromString(ae,Ni)}catch{}if(!T||!T.documentElement){T=F.createDocument(Cr,"template",null);try{T.documentElement.innerHTML=Al?V:ae}catch{}}const De=T.body||T.documentElement;return y&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Cr===Ot?Dn.call(T,zn?"html":"body")[0]:zn?T.documentElement:De},Jh=function(y){return he.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Tl=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")},Qh=function(y){return typeof a=="function"&&y instanceof a};function Mt(M,y,T){Wo(M,R=>{R.call(e,y,T,Pr)})}const ed=function(y){let T=null;if(Mt(Ie.beforeSanitizeElements,y,null),Tl(y))return _t(y),!0;const R=_e(y.nodeName);if(Mt(Ie.uponSanitizeElement,y,{tagName:R,allowedTags:xe}),So&&y.hasChildNodes()&&!Qh(y.firstElementChild)&&Oe(/<[/\w!]/g,y.innerHTML)&&Oe(/<[/\w!]/g,y.textContent)||y.nodeType===ji.progressingInstruction||So&&y.nodeType===ji.comment&&Oe(/<[/\w]/g,y.data))return _t(y),!0;if(!(sn.tagCheck instanceof Function&&sn.tagCheck(R))&&(!xe[R]||Oi[R])){if(!Oi[R]&&nd(R)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R)))return!1;if(kl&&!St[R]){const ae=B(y)||y.parentNode,De=P(y)||y.childNodes;if(De&&ae){const ye=De.length;for(let We=ye-1;We>=0;--We){const Nt=_(De[We],!0);Nt.__removalCount=(y.__removalCount||0)+1,ae.insertBefore(Nt,U(y))}}}return _t(y),!0}return y instanceof c&&!Ub(y)||(R==="noscript"||R==="noembed"||R==="noframes")&&Oe(/<\/no(script|embed|frames)/i,y.innerHTML)?(_t(y),!0):($r&&y.nodeType===ji.text&&(T=y.textContent,Wo([Ln,wt,rn],ae=>{T=Vi(T,ae," ")}),y.textContent!==T&&(Wi(e.removed,{element:y.cloneNode()}),y.textContent=T)),Mt(Ie.afterSanitizeElements,y,null),!1)},td=function(y,T,R){if(wo[T]||Wh&&(T==="id"||T==="name")&&(R in t||R in Nb))return!1;if(!(wl&&!wo[T]&&Oe(bl,T))){if(!(Fh&&Oe(bo,T))){if(!(sn.attributeCheck instanceof Function&&sn.attributeCheck(T,y))){if(!Te[T]||wo[T]){if(!(nd(y)&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,y)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(y))&&(ve.attributeNameCheck instanceof RegExp&&Oe(ve.attributeNameCheck,T)||ve.attributeNameCheck instanceof Function&&ve.attributeNameCheck(T,y))||T==="is"&&ve.allowCustomizedBuiltInElements&&(ve.tagNameCheck instanceof RegExp&&Oe(ve.tagNameCheck,R)||ve.tagNameCheck instanceof Function&&ve.tagNameCheck(R))))return!1}else if(!xl[T]){if(!Oe(Mh,Vi(R,Oh,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&y!=="script"&&lz(R,"data:")===0&&Bh[y])){if(!(Zh&&!Oe(Pb,Vi(R,Oh,"")))){if(R)return!1}}}}}}}return!0},nd=function(y){return y!=="annotation-xml"&&wc(y,Rb)},rd=function(y){Mt(Ie.beforeSanitizeAttributes,y,null);const{attributes:T}=y;if(!T||Tl(y))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0};let ae=T.length;for(;ae--;){const De=T[ae],{name:ye,namespaceURI:We,value:Nt}=De,Rr=_e(ye),Cl=Nt;let Ce=ye==="value"?Cl:cz(Cl);if(R.attrName=Rr,R.attrValue=Ce,R.keepAttr=!0,R.forceKeepAttr=void 0,Mt(Ie.uponSanitizeAttribute,y,R),Ce=R.attrValue,Vh&&(Rr==="id"||Rr==="name")&&(On(ye,y),Ce=Db+Ce),So&&Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ce)){On(ye,y);continue}if(Rr==="attributename"&&wc(Ce,"href")){On(ye,y);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){On(ye,y);continue}if(!Hh&&Oe(/\/>/i,Ce)){On(ye,y);continue}$r&&Wo([Ln,wt,rn],sd=>{Ce=Vi(Ce,sd," ")});const id=_e(y.nodeName);if(!td(id,Rr,Ce)){On(ye,y);continue}if(L&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!We)switch(m.getAttributeType(id,Rr)){case"TrustedHTML":{Ce=L.createHTML(Ce);break}case"TrustedScriptURL":{Ce=L.createScriptURL(Ce);break}}if(Ce!==Cl)try{We?y.setAttributeNS(We,ye,Ce):y.setAttribute(ye,Ce),Tl(y)?_t(y):Zf(e.removed)}catch{On(ye,y)}}Mt(Ie.afterSanitizeAttributes,y,null)},Fb=function M(y){let T=null;const R=Jh(y);for(Mt(Ie.beforeSanitizeShadowDOM,y,null);T=R.nextNode();)Mt(Ie.uponSanitizeShadowNode,T,null),ed(T),rd(T),T.content instanceof s&&M(T.content);Mt(Ie.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(M){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,R=null,ae=null,De=null;if(Al=!M,Al&&(M="<!-->"),typeof M!="string"&&!Qh(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Bi("dirty is not a string, aborting")}else throw Bi("toString is not a function");if(!e.isSupported)return M;if(Sl||Il(y),e.removed=[],typeof M=="string"&&(Mi=!1),Mi){if(M.nodeName){const Nt=_e(M.nodeName);if(!xe[Nt]||Oi[Nt])throw Bi("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)T=Kh("<!---->"),R=T.ownerDocument.importNode(M,!0),R.nodeType===ji.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?T=R:T.appendChild(R);else{if(!Ir&&!$r&&!zn&&M.indexOf("<")===-1)return L&&ko?L.createHTML(M):M;if(T=Kh(M),!T)return Ir?null:ko?V:""}T&&_l&&_t(T.firstChild);const ye=Jh(Mi?M:T);for(;ae=ye.nextNode();)ed(ae),rd(ae),ae.content instanceof s&&Fb(ae.content);if(Mi)return M;if(Ir){if(_o)for(De=de.call(T.ownerDocument);T.firstChild;)De.appendChild(T.firstChild);else De=T;return(Te.shadowroot||Te.shadowrootmode)&&(De=yo.call(r,De,!0)),De}let We=zn?T.outerHTML:T.innerHTML;return zn&&xe["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Oe(fb,T.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
409
+ `+We),$r&&Wo([Ln,wt,rn],Nt=>{We=Vi(We,Nt," ")}),L&&ko?L.createHTML(We):We},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Il(M),Sl=!0},e.clearConfig=function(){Pr=null,Sl=!1},e.isValidAttribute=function(M,y,T){Pr||Il({});const R=_e(M),ae=_e(y);return td(R,ae,T)},e.addHook=function(M,y){typeof y=="function"&&Wi(Ie[M],y)},e.removeHook=function(M,y){if(y!==void 0){const T=oz(Ie[M],y);return T===-1?void 0:az(Ie[M],T,1)[0]}return Zf(Ie[M])},e.removeHooks=function(M){Ie[M]=[]},e.removeAllHooks=function(){Ie=jf()},e}var mb=gb();function kh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ar=kh();function vb(n){Ar=n}var Vn={exec:()=>null};function K(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(Ue.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var Ez=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ue={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)}}>`)},xz=/^(?:[ \t]*(?:\n|$))+/,Az=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$z=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Iz=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Eh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,yb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bb=K(yb).replace(/bull/g,Eh).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(),Tz=K(yb).replace(/bull/g,Eh).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(),xh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Cz=/^[^\n]+/,Ah=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Pz=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ah).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Rz=K(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Eh).getRegex(),vl="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",$h=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Dz=K("^ {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",$h).replace("tag",vl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wb=K(xh).replace("hr",vo).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",vl).getRegex(),Lz=K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wb).getRegex(),Ih={blockquote:Lz,code:Az,def:Pz,fences:$z,heading:Iz,hr:vo,html:Dz,lheading:bb,list:Rz,newline:xz,paragraph:wb,table:Vn,text:Cz},qf=K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vo).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",vl).getRegex(),zz={...Ih,lheading:Tz,table:qf,paragraph:K(xh).replace("hr",vo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",qf).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",vl).getRegex()},Oz={...Ih,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$h).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:Vn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(xh).replace("hr",vo).replace("heading",` *#{1,6} *[^
410
+ ]`).replace("lheading",bb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Mz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Nz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sb=/^( {2,}|\\)\n(?!\s*$)/,Uz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zi=/[\p{P}\p{S}]/u,yl=/[\s\p{P}\p{S}]/u,Th=/[^\s\p{P}\p{S}]/u,Fz=K(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,yl).getRegex(),_b=/(?!~)[\p{P}\p{S}]/u,Zz=/(?!~)[\s\p{P}\p{S}]/u,Hz=/(?:[^\s\p{P}\p{S}]|~)/u,Wz=K(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ez?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),kb=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Vz=K(kb,"u").replace(/punct/g,zi).getRegex(),Bz=K(kb,"u").replace(/punct/g,_b).getRegex(),Eb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Gz=K(Eb,"gu").replace(/notPunctSpace/g,Th).replace(/punctSpace/g,yl).replace(/punct/g,zi).getRegex(),jz=K(Eb,"gu").replace(/notPunctSpace/g,Hz).replace(/punctSpace/g,Zz).replace(/punct/g,_b).getRegex(),qz=K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Th).replace(/punctSpace/g,yl).replace(/punct/g,zi).getRegex(),Yz=K(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,zi).getRegex(),Xz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Kz=K(Xz,"gu").replace(/notPunctSpace/g,Th).replace(/punctSpace/g,yl).replace(/punct/g,zi).getRegex(),Jz=K(/\\(punct)/,"gu").replace(/punct/g,zi).getRegex(),Qz=K(/^<(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(),eO=K($h).replace("(?:-->|$)","-->").getRegex(),tO=K("^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",eO).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ia=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,nO=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Ia).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xb=K(/^!?\[(label)\]\[(ref)\]/).replace("label",Ia).replace("ref",Ah).getRegex(),Ab=K(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ah).getRegex(),rO=K("reflink|nolink(?!\\()","g").replace("reflink",xb).replace("nolink",Ab).getRegex(),Yf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ch={_backpedal:Vn,anyPunctuation:Jz,autolink:Qz,blockSkip:Wz,br:Sb,code:Nz,del:Vn,delLDelim:Vn,delRDelim:Vn,emStrongLDelim:Vz,emStrongRDelimAst:Gz,emStrongRDelimUnd:qz,escape:Mz,link:nO,nolink:Ab,punctuation:Fz,reflink:xb,reflinkSearch:rO,tag:tO,text:Uz,url:Vn},iO={...Ch,link:K(/^!?\[(label)\]\((.*?)\)/).replace("label",Ia).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ia).getRegex()},ku={...Ch,emStrongRDelimAst:jz,emStrongLDelim:Bz,delLDelim:Yz,delRDelim:Kz,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Yf).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:K(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Yf).getRegex()},sO={...ku,br:K(Sb).replace("{2,}","*").getRegex(),text:K(ku.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Bo={normal:Ih,gfm:zz,pedantic:Oz},qi={normal:Ch,gfm:ku,breaks:sO,pedantic:iO},oO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xf=n=>oO[n];function At(n,e){if(e){if(Ue.escapeTest.test(n))return n.replace(Ue.escapeReplace,Xf)}else if(Ue.escapeTestNoEncode.test(n))return n.replace(Ue.escapeReplaceNoEncode,Xf);return n}function Kf(n){try{n=encodeURI(n).replace(Ue.percentDecode,"%")}catch{return null}return n}function Jf(n,e){var s;let t=n.replace(Ue.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Ue.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(Ue.slashPipe,"|");return r}function Yi(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 aO(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 lO(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 Qf(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 c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function cO(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
411
411
  `).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(`
412
- `)}var Ia=class{constructor(n){b(this,"options");b(this,"rules");b(this,"lexer");this.options=n||Ar}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:qi(t,`
413
- `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=oO(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=qi(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:qi(e[0],`
414
- `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=qi(e[0],`
412
+ `)}var Ta=class{constructor(n){b(this,"options");b(this,"rules");b(this,"lexer");this.options=n||Ar}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:Yi(t,`
413
+ `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=cO(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=Yi(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:Yi(e[0],`
414
+ `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Yi(e[0],`
415
415
  `).split(`
416
416
  `),r="",i="",s=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let u=a.join(`
417
417
  `),h=u.replace(this.rules.other.blockquoteSetextReplace,`
@@ -422,16 +422,16 @@ ${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
422
422
  `),_=this.blockquote(x);s[s.length-1]=_,r=r.substring(0,r.length-m.raw.length)+_.raw,i=i.substring(0,i.length-m.text.length)+_.text;break}else if((v==null?void 0:v.type)==="list"){let m=v,x=m.raw+`
423
423
  `+t.join(`
424
424
  `),_=this.list(x);s[s.length-1]=_,r=r.substring(0,r.length-v.raw.length)+_.raw,i=i.substring(0,i.length-m.raw.length)+_.raw,t=x.substring(s.at(-1).raw.length).split(`
425
- `);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),c=!1;for(;n;){let h=!1,p="",v="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let m=sO(e[2].split(`
425
+ `);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),c=!1;for(;n;){let h=!1,p="",v="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let m=lO(e[2].split(`
426
426
  `,1)[0],e[1].length),x=n.split(`
427
427
  `,1)[0],_=!m.trim(),C=0;if(this.options.pedantic?(C=2,v=m.trimStart()):_?C=e[1].length+1:(C=m.search(this.rules.other.nonSpaceChar),C=C>4?1:C,v=m.slice(C),C+=e[1].length),_&&this.rules.other.blankLine.test(x)&&(p+=x+`
428
428
  `,n=n.substring(x.length+1),h=!0),!h){let U=this.rules.other.nextBulletRegex(C),P=this.rules.other.hrRegex(C),B=this.rules.other.fencesBeginRegex(C),L=this.rules.other.headingBeginRegex(C),V=this.rules.other.htmlBeginRegex(C),F=this.rules.other.blockquoteBeginRegex(C);for(;n;){let he=n.split(`
429
429
  `,1)[0],de;if(x=he,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),de=x):de=x.replace(this.rules.other.tabCharGlobal," "),B.test(x)||L.test(x)||V.test(x)||F.test(x)||U.test(x)||P.test(x))break;if(de.search(this.rules.other.nonSpaceChar)>=C||!x.trim())v+=`
430
430
  `+de.slice(C);else{if(_||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||B.test(m)||L.test(m)||P.test(m))break;v+=`
431
431
  `+x}_=!x.trim(),p+=he+`
432
- `,n=n.substring(he.length+1),m=de.slice(C)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,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 v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(h.raw);if(p){let v={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};h.checked=v.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=v.raw+h.tokens[0].raw,h.tokens[0].text=v.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(v)):h.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):h.tokens.unshift(v)}}if(!o.loose){let p=h.tokens.filter(m=>m.type==="space"),v=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=v}}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=Kf(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(`
433
- `):[],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(Kf(a,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),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)===`
434
- `?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=qi(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=iO(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)),Jf(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 Jf(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,c=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)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);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 v=p.slice(2,-2);return{type:"strong",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}}}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,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.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}}}},vt=class ku{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||Ar,this.options.tokenizer=this.options.tokenizer||new Ia,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:Ue,block:Bo.normal,inline:ji.normal};this.options.pedantic?(t.block=Bo.pedantic,t.inline=ji.pedantic):this.options.gfm&&(t.block=Bo.gfm,this.options.breaks?t.inline=ji.breaks:t.inline=ji.gfm),this.tokenizer.rules=t}static get rules(){return{block:Bo,inline:ji}}static lex(e,t){return new ku(t).lex(e)}static lexInline(e,t){return new ku(t).inlineTokens(e)}lex(e){e=e.replace(Ue.carriageReturn,`
432
+ `,n=n.substring(he.length+1),m=de.slice(C)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,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 v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(h.raw);if(p){let v={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};h.checked=v.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=v.raw+h.tokens[0].raw,h.tokens[0].text=v.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(v)):h.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):h.tokens.unshift(v)}}if(!o.loose){let p=h.tokens.filter(m=>m.type==="space"),v=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=v}}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=Jf(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(`
433
+ `):[],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(Jf(a,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),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)===`
434
+ `?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=Yi(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=aO(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)),Qf(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 Qf(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,c=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)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);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 v=p.slice(2,-2);return{type:"strong",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}}}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,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.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}}}},vt=class Eu{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||Ar,this.options.tokenizer=this.options.tokenizer||new Ta,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:Ue,block:Bo.normal,inline:qi.normal};this.options.pedantic?(t.block=Bo.pedantic,t.inline=qi.pedantic):this.options.gfm&&(t.block=Bo.gfm,this.options.breaks?t.inline=qi.breaks:t.inline=qi.gfm),this.tokenizer.rules=t}static get rules(){return{block:Bo,inline:qi}}static lex(e,t){return new Eu(t).lex(e)}static lexInline(e,t){return new Eu(t).inlineTokens(e)}lex(e){e=e.replace(Ue.carriageReturn,`
435
435
  `),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(Ue.tabCharGlobal," ").replace(Ue.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+=`
436
436
  `: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(`
437
437
  `)?"":`
@@ -445,7 +445,7 @@ ${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
445
445
  `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a),r=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
446
446
  `)?"":`
447
447
  `)+a.raw,u.text+=`
448
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,h,p,v;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let m=Object.keys(this.tokens.links);if(m.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)m.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(_=>(m=_.call({lexer:this},e,t))?(e=e.substring(m.raw.length),t.push(m),!0):!1))continue;if(m=this.tokenizer.escape(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.tag(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.link(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(m.raw.length);let _=t.at(-1);m.type==="text"&&(_==null?void 0:_.type)==="text"?(_.raw+=m.raw,_.text+=m.text):t.push(m);continue}if(m=this.tokenizer.emStrong(e,r,a)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.codespan(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.br(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.del(e,r,a)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.autolink(e)){e=e.substring(m.raw.length),t.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(e))){e=e.substring(m.raw.length),t.push(m);continue}let x=e;if((v=this.options.extensions)!=null&&v.startInline){let _=1/0,C=e.slice(1),U;this.options.extensions.startInline.forEach(P=>{U=P.call({lexer:this},C),typeof U=="number"&&U>=0&&(_=Math.min(_,U))}),_<1/0&&_>=0&&(x=e.substring(0,_+1))}if(m=this.tokenizer.inlineText(x)){e=e.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(a=m.raw.slice(-1)),o=!0;let _=t.at(-1);(_==null?void 0:_.type)==="text"?(_.raw+=m.raw,_.text+=m.text):t.push(m);continue}if(e){let _="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return t}},Ta=class{constructor(n){b(this,"options");b(this,"parser");this.options=n||Ar}space(n){return""}code({text:n,lang:e,escaped:t}){var s;let r=(s=(e||"").match(Ue.notSpaceStart))==null?void 0:s[0],i=n.replace(Ue.endingNewline,"")+`
448
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,h,p,v;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let m=Object.keys(this.tokens.links);if(m.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)m.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(_=>(m=_.call({lexer:this},e,t))?(e=e.substring(m.raw.length),t.push(m),!0):!1))continue;if(m=this.tokenizer.escape(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.tag(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.link(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(m.raw.length);let _=t.at(-1);m.type==="text"&&(_==null?void 0:_.type)==="text"?(_.raw+=m.raw,_.text+=m.text):t.push(m);continue}if(m=this.tokenizer.emStrong(e,r,a)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.codespan(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.br(e)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.del(e,r,a)){e=e.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.autolink(e)){e=e.substring(m.raw.length),t.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(e))){e=e.substring(m.raw.length),t.push(m);continue}let x=e;if((v=this.options.extensions)!=null&&v.startInline){let _=1/0,C=e.slice(1),U;this.options.extensions.startInline.forEach(P=>{U=P.call({lexer:this},C),typeof U=="number"&&U>=0&&(_=Math.min(_,U))}),_<1/0&&_>=0&&(x=e.substring(0,_+1))}if(m=this.tokenizer.inlineText(x)){e=e.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(a=m.raw.slice(-1)),o=!0;let _=t.at(-1);(_==null?void 0:_.type)==="text"?(_.raw+=m.raw,_.text+=m.text):t.push(m);continue}if(e){let _="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return t}},Ca=class{constructor(n){b(this,"options");b(this,"parser");this.options=n||Ar}space(n){return""}code({text:n,lang:e,escaped:t}){var s;let r=(s=(e||"").match(Ue.notSpaceStart))==null?void 0:s[0],i=n.replace(Ue.endingNewline,"")+`
449
449
  `;return r?'<pre><code class="language-'+At(r)+'">'+(t?i:At(i,!0))+`</code></pre>
450
450
  `:"<pre><code>"+(t?i:At(i,!0))+`</code></pre>
451
451
  `}blockquote({tokens:n}){return`<blockquote>
@@ -463,16 +463,16 @@ ${this.parser.parse(n)}</blockquote>
463
463
  `}tablerow({text:n}){return`<tr>
464
464
  ${n}</tr>
465
465
  `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
466
- `}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=Xf(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=Xf(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)}},Ch=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}},yt=class Eu{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||Ar,this.options.renderer=this.options.renderer||new Ta,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ch}static parse(e,t){return new Eu(t).parse(e)}static parseInline(e,t){return new Eu(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 c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.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 c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}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 c=a;switch(c.type){case"escape":{r+=t.text(c);break}case"html":{r+=t.html(c);break}case"link":{r+=t.link(c);break}case"image":{r+=t.image(c);break}case"checkbox":{r+=t.checkbox(c);break}case"strong":{r+=t.strong(c);break}case"em":{r+=t.em(c);break}case"codespan":{r+=t.codespan(c);break}case"br":{r+=t.br(c);break}case"del":{r+=t.del(c);break}case"text":{r+=t.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Go,rs=(Go=class{constructor(n){b(this,"options");b(this,"block");this.options=n||Ar}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?vt.lex:vt.lexInline}provideParser(){return this.block?yt.parse:yt.parseInline}},b(Go,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(Go,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Go),aO=class{constructor(...n){b(this,"defaults",_h());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",yt);b(this,"Renderer",Ta);b(this,"TextRenderer",Ch);b(this,"Lexer",vt);b(this,"Tokenizer",Ia);b(this,"Hooks",rs);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 c of a)t=t.concat(this.walkTokens(c.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 c=o[a].flat(1/0);t=t.concat(this.walkTokens(c,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 Ta(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],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new Ia(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],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new rs;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],c=i[o];rs.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&rs.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return c.call(i,p)})();let h=a.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let h=a.apply(i,u);return h===!1&&(h=c.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 vt.lex(n,e??this.defaults)}parser(n,e){return yt.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?vt.lex:vt.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?yt.parse:yt.parseInline)(c,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?vt.lex:vt.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?yt.parse:yt.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+=`
467
- 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}}},Sr=new aO;function re(n,e){return Sr.parse(n,e)}re.options=re.setOptions=function(n){return Sr.setOptions(n),re.defaults=Sr.defaults,gb(re.defaults),re};re.getDefaults=_h;re.defaults=Ar;re.use=function(...n){return Sr.use(...n),re.defaults=Sr.defaults,gb(re.defaults),re};re.walkTokens=function(n,e){return Sr.walkTokens(n,e)};re.parseInline=Sr.parseInline;re.Parser=yt;re.parser=yt.parse;re.Renderer=Ta;re.TextRenderer=Ch;re.Lexer=vt;re.lexer=vt.lex;re.Tokenizer=Ia;re.Hooks=rs;re.parse=re;re.options;re.setOptions;re.use;re.walkTokens;re.parseInline;yt.parse;vt.lex;fb.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function lO(n){const e=re.parse(n,{async:!1});return fb.sanitize(e,{USE_PROFILES:{html:!0}})}const cO=8,Qf=new WeakMap;function uO(n){const e=Qf.get(n);if(e&&e.text===n.text)return e.html;const t=lO(n.text);return Qf.set(n,{text:n.text,html:t}),t}function hO(n){return n.replace(/_/g," ")}function dO(n){return N`
466
+ `}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=Kf(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=Kf(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)}},Ph=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}},yt=class xu{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||Ar,this.options.renderer=this.options.renderer||new Ca,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ph}static parse(e,t){return new xu(t).parse(e)}static parseInline(e,t){return new xu(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 c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.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 c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}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 c=a;switch(c.type){case"escape":{r+=t.text(c);break}case"html":{r+=t.html(c);break}case"link":{r+=t.link(c);break}case"image":{r+=t.image(c);break}case"checkbox":{r+=t.checkbox(c);break}case"strong":{r+=t.strong(c);break}case"em":{r+=t.em(c);break}case"codespan":{r+=t.codespan(c);break}case"br":{r+=t.br(c);break}case"del":{r+=t.del(c);break}case"text":{r+=t.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Go,rs=(Go=class{constructor(n){b(this,"options");b(this,"block");this.options=n||Ar}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?vt.lex:vt.lexInline}provideParser(){return this.block?yt.parse:yt.parseInline}},b(Go,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(Go,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Go),uO=class{constructor(...n){b(this,"defaults",kh());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",yt);b(this,"Renderer",Ca);b(this,"TextRenderer",Ph);b(this,"Lexer",vt);b(this,"Tokenizer",Ta);b(this,"Hooks",rs);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 c of a)t=t.concat(this.walkTokens(c.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 c=o[a].flat(1/0);t=t.concat(this.walkTokens(c,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 Ca(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],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new Ta(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],c=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new rs;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],c=i[o];rs.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&rs.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return c.call(i,p)})();let h=a.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let h=a.apply(i,u);return h===!1&&(h=c.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 vt.lex(n,e??this.defaults)}parser(n,e){return yt.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?vt.lex:vt.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?yt.parse:yt.parseInline)(c,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?vt.lex:vt.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?yt.parse:yt.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+=`
467
+ 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}}},Sr=new uO;function re(n,e){return Sr.parse(n,e)}re.options=re.setOptions=function(n){return Sr.setOptions(n),re.defaults=Sr.defaults,vb(re.defaults),re};re.getDefaults=kh;re.defaults=Ar;re.use=function(...n){return Sr.use(...n),re.defaults=Sr.defaults,vb(re.defaults),re};re.walkTokens=function(n,e){return Sr.walkTokens(n,e)};re.parseInline=Sr.parseInline;re.Parser=yt;re.parser=yt.parse;re.Renderer=Ca;re.TextRenderer=Ph;re.Lexer=vt;re.lexer=vt.lex;re.Tokenizer=Ta;re.Hooks=rs;re.parse=re;re.options;re.setOptions;re.use;re.walkTokens;re.parseInline;yt.parse;vt.lex;mb.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function hO(n){const e=re.parse(n,{async:!1});return mb.sanitize(e,{USE_PROFILES:{html:!0}})}const dO=8,eg=new WeakMap;function pO(n){const e=eg.get(n);if(e&&e.text===n.text)return e.html;const t=hO(n.text);return eg.set(n,{text:n.text,html:t}),t}function fO(n){return n.replace(/_/g," ")}function gO(n){return N`
468
468
  <div class="tool-call-header">
469
469
  <span class="tool-call-title">${n.title}</span>
470
- <span class="tool-call-meta">${n.toolKind} · ${hO(n.status)}</span>
470
+ <span class="tool-call-meta">${n.toolKind} · ${fO(n.status)}</span>
471
471
  </div>
472
472
  ${n.text?N`<pre class="tool-call-text">${n.text}</pre>`:null}
473
- `}function eg(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 Kt,gr,qa,Ya,Ks,xu;class xb extends ms{constructor(){super(...arguments);w(this,Ks);b(this,"messages",[]);w(this,Kt,!0);w(this,gr,null);w(this,qa,()=>{const t=l(this,gr);if(!t)return;const i=t.scrollHeight-t.clientHeight-t.scrollTop<=cO;i!==l(this,Kt)&&(E(this,Kt,i),this.toggleAttribute("data-pinned",i))});w(this,Ya,()=>{E(this,Kt,!0),this.toggleAttribute("data-pinned",!0),f(this,Ks,xu).call(this,!0)})}changed(t){let r=!1;if(t.has("messages")){const i=t.get("messages")??[],s=eg(this.messages);r=s!==null&&s!==eg(i),r&&E(this,Kt,!0)}Fe(this.template(),this),l(this,gr)||E(this,gr,this.querySelector(".history-scroll")),this.toggleAttribute("data-pinned",l(this,Kt)),f(this,Ks,xu).call(this,r)}template(){return N`
474
- <div class="history-scroll" @scroll=${l(this,qa)}>
475
- ${this.messages.map(t=>{const r=t.kind==="assistant"?p2(uO(t)):t.kind==="tool_call"?dO(t):t.text;return N`<div
473
+ `}function tg(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 Kt,gr,Ya,Xa,Ks,Au;class $b extends ms{constructor(){super(...arguments);w(this,Ks);b(this,"messages",[]);w(this,Kt,!0);w(this,gr,null);w(this,Ya,()=>{const t=l(this,gr);if(!t)return;const i=t.scrollHeight-t.clientHeight-t.scrollTop<=dO;i!==l(this,Kt)&&(E(this,Kt,i),this.toggleAttribute("data-pinned",i))});w(this,Xa,()=>{E(this,Kt,!0),this.toggleAttribute("data-pinned",!0),f(this,Ks,Au).call(this,!0)})}changed(t){let r=!1;if(t.has("messages")){const i=t.get("messages")??[],s=tg(this.messages);r=s!==null&&s!==tg(i),r&&E(this,Kt,!0)}Fe(this.template(),this),l(this,gr)||E(this,gr,this.querySelector(".history-scroll")),this.toggleAttribute("data-pinned",l(this,Kt)),f(this,Ks,Au).call(this,r)}template(){return N`
474
+ <div class="history-scroll" @scroll=${l(this,Ya)}>
475
+ ${this.messages.map(t=>{const r=t.kind==="assistant"?g2(pO(t)):t.kind==="tool_call"?gO(t):t.text;return N`<div
476
476
  class="message message-${t.kind}"
477
477
  data-message-id=${t.id}
478
478
  >${r}</div>`})}
@@ -481,11 +481,11 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
481
481
  type="button"
482
482
  class="history-jump"
483
483
  aria-label="Jump to latest message"
484
- @click=${l(this,Ya)}
484
+ @click=${l(this,Xa)}
485
485
  >
486
- ${wy({size:16})}
486
+ ${Sy({size:16})}
487
487
  </button>
488
- `}}Kt=new WeakMap,gr=new WeakMap,qa=new WeakMap,Ya=new WeakMap,Ks=new WeakSet,xu=function(t){requestAnimationFrame(()=>{const r=l(this,gr);r&&(!l(this,Kt)&&!t||(r.scrollTop=r.scrollHeight-r.clientHeight))})},b(xb,"properties",["messages"]);customElements.define("message-history",xb);var Js,Qs,mi,Xa,Ka,ot,ha,eo,$u,Iu,to,no;class Au extends ms{constructor(){super(...arguments);w(this,ot);b(this,"placeholder","What do you want to do?");b(this,"open",!1);b(this,"messages",[]);w(this,Js,Lt.resolve("ServerManager"));w(this,Qs,Lt.resolve("ShortcutService"));w(this,mi,null);b(this,"handleTriggerActivate",()=>{this.open=!0});b(this,"handleKeydown",t=>{var o;if(t.key!=="Enter"||t.shiftKey)return;const r=t.currentTarget,i=r.value.trim();if(t.preventDefault(),!i)return;r.value="",f(this,ot,ha).call(this,r);const s=(o=l(this,Js).activeServer)==null?void 0:o.acpClient;s&&s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})});w(this,Xa,t=>{f(this,ot,ha).call(this,t.currentTarget)});w(this,Ka,t=>{if(t.target instanceof HTMLTextAreaElement)return;const r=t.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,eo,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,to,t=>{t.target instanceof Node&&(this.contains(t.target)||(this.open=!1))});w(this,no,t=>{t.key==="Escape"&&(this.open=!1)})}connected(){const t=new DisposableStack;E(this,mi,t);const r=QL(l(this,Js),i=>{this.messages=i});t.defer(()=>r.dispose()),l(this,Qs).addEventListener("shortcut-triggered",l(this,eo)),t.defer(()=>l(this,Qs).removeEventListener("shortcut-triggered",l(this,eo))),this.open&&f(this,ot,$u).call(this)}disconnected(){var t;(t=l(this,mi))==null||t.dispose(),E(this,mi,null),f(this,ot,Iu).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")),Fe(this.template(),this),t.has("open"))if(this.open){f(this,ot,$u).call(this);const r=this.querySelector("textarea");r&&(f(this,ot,ha).call(this,r),r.focus())}else f(this,ot,Iu).call(this)}template(){return this.open?N`
488
+ `}}Kt=new WeakMap,gr=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,Ks=new WeakSet,Au=function(t){requestAnimationFrame(()=>{const r=l(this,gr);r&&(!l(this,Kt)&&!t||(r.scrollTop=r.scrollHeight-r.clientHeight))})},b($b,"properties",["messages"]);customElements.define("message-history",$b);var Js,Qs,vi,Ka,Ja,ot,ha,eo,Iu,Tu,to,no;class $u extends ms{constructor(){super(...arguments);w(this,ot);b(this,"placeholder","What do you want to do?");b(this,"open",!1);b(this,"messages",[]);w(this,Js,Lt.resolve("ServerManager"));w(this,Qs,Lt.resolve("ShortcutService"));w(this,vi,null);b(this,"handleTriggerActivate",()=>{this.open=!0});b(this,"handleKeydown",t=>{var o;if(t.key!=="Enter"||t.shiftKey)return;const r=t.currentTarget,i=r.value.trim();if(t.preventDefault(),!i)return;r.value="",f(this,ot,ha).call(this,r);const s=(o=l(this,Js).activeServer)==null?void 0:o.acpClient;s&&s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})});w(this,Ka,t=>{f(this,ot,ha).call(this,t.currentTarget)});w(this,Ja,t=>{if(t.target instanceof HTMLTextAreaElement)return;const r=t.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,eo,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,to,t=>{t.target instanceof Node&&(this.contains(t.target)||(this.open=!1))});w(this,no,t=>{t.key==="Escape"&&(this.open=!1)})}connected(){const t=new DisposableStack;E(this,vi,t);const r=nz(l(this,Js),i=>{this.messages=i});t.defer(()=>r.dispose()),l(this,Qs).addEventListener("shortcut-triggered",l(this,eo)),t.defer(()=>l(this,Qs).removeEventListener("shortcut-triggered",l(this,eo))),this.open&&f(this,ot,Iu).call(this)}disconnected(){var t;(t=l(this,vi))==null||t.dispose(),E(this,vi,null),f(this,ot,Tu).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")),Fe(this.template(),this),t.has("open"))if(this.open){f(this,ot,Iu).call(this);const r=this.querySelector("textarea");r&&(f(this,ot,ha).call(this,r),r.focus())}else f(this,ot,Tu).call(this)}template(){return this.open?N`
489
489
  ${this.messages.length>0?N`
490
490
  <div
491
491
  class="chat"
@@ -501,13 +501,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
501
501
  material="paper"
502
502
  tone="dark"
503
503
  level="overlay"
504
- @click=${l(this,Ka)}
504
+ @click=${l(this,Ja)}
505
505
  >
506
506
  <textarea
507
507
  class="textarea"
508
508
  rows="1"
509
509
  @keydown=${this.handleKeydown}
510
- @input=${l(this,Xa)}
510
+ @input=${l(this,Ka)}
511
511
  ></textarea>
512
512
  </div>
513
513
  `:N`
@@ -521,7 +521,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
521
521
  <span class="label">${this.placeholder}</span>
522
522
  <span class="kbd" aria-hidden="true">⌘K</span>
523
523
  </div>
524
- `}}Js=new WeakMap,Qs=new WeakMap,mi=new WeakMap,Xa=new WeakMap,Ka=new WeakMap,ot=new WeakSet,ha=function(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`},eo=new WeakMap,$u=function(){document.addEventListener("mousedown",l(this,to)),document.addEventListener("keydown",l(this,no))},Iu=function(){document.removeEventListener("mousedown",l(this,to)),document.removeEventListener("keydown",l(this,no))},to=new WeakMap,no=new WeakMap,b(Au,"properties",["placeholder","open","messages"]),b(Au,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",Au);class Ab extends Event{constructor(t){super("auth-submit",{bubbles:!0,composed:!0});b(this,"token");this.token=t}}class pO 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 Ab(r))}render(){Fe(N`
524
+ `}}Js=new WeakMap,Qs=new WeakMap,vi=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,ot=new WeakSet,ha=function(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`},eo=new WeakMap,Iu=function(){document.addEventListener("mousedown",l(this,to)),document.addEventListener("keydown",l(this,no))},Tu=function(){document.removeEventListener("mousedown",l(this,to)),document.removeEventListener("keydown",l(this,no))},to=new WeakMap,no=new WeakMap,b($u,"properties",["placeholder","open","messages"]),b($u,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",$u);class Ib extends Event{constructor(t){super("auth-submit",{bubbles:!0,composed:!0});b(this,"token");this.token=t}}class mO 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 Ib(r))}render(){Fe(N`
525
525
  <modal-overlay open>
526
526
  <section class="auth-modal">
527
527
  <form class="auth-form" @submit=${t=>this.handleSubmit(t)}>
@@ -542,7 +542,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
542
542
  </form>
543
543
  </section>
544
544
  </modal-overlay>
545
- `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",pO);class fO extends HTMLElement{constructor(){super(...arguments);b(this,"runtimeServerURL",ny());b(this,"electronMode",gh());b(this,"serverManager",Lt.resolve("ServerManager"));b(this,"screenManager",Lt.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 Ab?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,hf());return}if(this.serverManager.activeServer)return;const t=new ty({url:this.runtimeServerURL,name:"Server",token:hf()});this.serverManager.add(t),this.serverManager.setActive(t);try{await t.connect(),this.connectError=null}catch(r){this.connectError=r instanceof Error&&!(r instanceof Yc)?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 Yc||(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"){Fe(N`
545
+ `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",mO);class vO extends HTMLElement{constructor(){super(...arguments);b(this,"runtimeServerURL",ry());b(this,"electronMode",mh());b(this,"serverManager",Lt.resolve("ServerManager"));b(this,"screenManager",Lt.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 Ib?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,df());return}if(this.serverManager.activeServer)return;const t=new ny({url:this.runtimeServerURL,name:"Server",token:df()});this.serverManager.add(t),this.serverManager.setActive(t);try{await t.connect(),this.connectError=null}catch(r){this.connectError=r instanceof Error&&!(r instanceof Xc)?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 Xc||(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"){Fe(N`
546
546
  <main class="auth-gate"><p>Connecting...</p></main>
547
547
  `,this);return}if(r==="disconnected"){const o=t;if(!o)return;Fe(N`
548
548
  <main class="auth-gate">
@@ -565,7 +565,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
565
565
  aria-label="Home"
566
566
  @click=${()=>this.screenManager.clearActive()}
567
567
  >
568
- ${A2({size:16,weight:"regular"})}
568
+ ${I2({size:16,weight:"regular"})}
569
569
  </button>
570
570
  <screen-select></screen-select>
571
571
  </div>
@@ -574,4 +574,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
574
574
  `:null}
575
575
  `}
576
576
  </main>
577
- `,this)}}customElements.get("television-app")||customElements.define("television-app",fO);const Ph=gh(),Rh=ny(),$b=new i1(Ph?"television-electron":"television-browser",r1(Rh)),Dh=new OD({localStore:$b,localServerURL:Rh}),Ib=new e1({localStore:$b,serverManager:Dh}),gO=new MD;Lt.register("ServerManager",()=>Dh);Lt.register("ScreenManager",()=>Ib);Lt.register("ShortcutService",()=>gO);globalThis.__telepath={screenManager:Ib,serverManager:Dh};const Lh=document.createElement("television-app");Lh.runtimeServerURL=Rh;Lh.electronMode=Ph;Ph&&document.body.classList.add("electron");document.body.appendChild(Lh);
577
+ `,this)}}customElements.get("television-app")||customElements.define("television-app",vO);const Rh=mh(),Dh=ry(),Tb=new o1(Rh?"television-electron":"television-browser",s1(Dh)),Lh=new ND({localStore:Tb,localServerURL:Dh}),Cb=new n1({localStore:Tb,serverManager:Lh}),yO=new UD;Lt.register("ServerManager",()=>Lh);Lt.register("ScreenManager",()=>Cb);Lt.register("ShortcutService",()=>yO);globalThis.__telepath={screenManager:Cb,serverManager:Lh};const zh=document.createElement("television-app");zh.runtimeServerURL=Dh;zh.electronMode=Rh;Rh&&document.body.classList.add("electron");document.body.appendChild(zh);