@telepath-computer/television 0.1.184 → 0.1.186

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 ek=Object.defineProperty;var og=n=>{throw TypeError(n)};var tk=(n,t,e)=>t in n?ek(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>tk(n,typeof t!="symbol"?t+"":t,e),Zu=(n,t,e)=>t.has(n)||og("Cannot "+e);var l=(n,t,e)=>(Zu(n,t,"read from private field"),e?e.call(n):t.get(n)),b=(n,t,e)=>t.has(n)?og("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),m=(n,t,e,r)=>(Zu(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),d=(n,t,e)=>(Zu(n,t,"access private method"),e);var Bu=(n,t,e,r)=>({set _(i){m(n,t,i,e)},get _(){return l(n,t,r)}});import{i as ag,a as Wu,b as lg,c as cg,d as ug,e as nk,U as rk,f as hg,g as dg,A as ik,h as sk,j as ok}from"./artifact-bridge-BhiFDvPj.js";import{m as ak,a as lk,b as ck}from"./missing-artifact-page-DVzJ41AE.js";var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function uk(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var pg=Object.prototype.toString,xy=function(t){var e=pg.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&pg.call(t.callee)==="[object Function]"),r},ju,fg;function hk(){if(fg)return ju;fg=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=xy,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 y=v.constructor;return y&&y.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]&&t.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),f=function(v){if(typeof window>"u"||!h)return c(v);try{return c(v)}catch{return!1}};n=function(y){var E=y!==null&&typeof y=="object",x=e.call(y)==="[object Function]",C=r(y),L=E&&e.call(y)==="[object String]",R=[];if(!E&&!x&&!C)throw new TypeError("Object.keys called on a non-object");var W=o&&x;if(L&&y.length>0&&!t.call(y,0))for(var N=0;N<y.length;++N)R.push(String(N));if(C&&y.length>0)for(var V=0;V<y.length;++V)R.push(String(V));else for(var K in y)!(W&&K==="prototype")&&t.call(y,K)&&R.push(String(K));if(s)for(var G=f(y),he=0;he<a.length;++he)!(G&&a[he]==="constructor")&&t.call(y,a[he])&&R.push(a[he]);return R}}return ju=n,ju}var dk=Array.prototype.slice,pk=xy,gg=Object.keys,Gl=gg?function(t){return gg(t)}:hk(),mg=Object.keys;Gl.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(r){return pk(r)?mg(dk.call(r)):mg(r)})}else Object.keys=Gl;return Object.keys||Gl};var fk=Gl,ql=Object.defineProperty||!1;if(ql)try{ql({},"a",{value:1})}catch{ql=!1}var sl=ql,Hn=SyntaxError,J=TypeError,gk=Object.getOwnPropertyDescriptor,Yl=gk;if(Yl)try{Yl([],"length")}catch{Yl=null}var js=Yl,vg=sl,mk=Hn,Oi=J,yg=js,Ay=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Oi("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Oi("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Oi("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Oi("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Oi("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Oi("`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=!!yg&&yg(t,e);if(vg)vg(t,e,{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)t[e]=r;else throw new mk("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Bh=sl,Ty=function(){return!!Bh};Ty.hasArrayLengthDefineBug=function(){if(!Bh)return null;try{return Bh([],"length",{value:1}).length!==1}catch{return!0}};var au=Ty,vk=fk,yk=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",bk=Object.prototype.toString,wk=Array.prototype.concat,bg=Ay,Sk=function(n){return typeof n=="function"&&bk.call(n)==="[object Function]"},$y=au(),_k=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!Sk(r)||!r())return}$y?bg(n,t,e,!0):bg(n,t,e)},Cy=function(n,t){var e=arguments.length>2?arguments[2]:{},r=vk(t);yk&&(r=wk.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)_k(n,r[i],t[r[i]],e[r[i]])};Cy.supportsDescriptors=!!$y;var Ti=Cy,Kl={exports:{}};typeof self<"u"?Kl.exports=self:typeof window<"u"?Kl.exports=window:Kl.exports=Function("return this")();var Iy=Kl.exports,kk=Iy,Ry=function(){return typeof Dr!="object"||!Dr||Dr.Math!==Math||Dr.Array!==Array?kk:Dr},Ek=Ti,xk=js,Ak=Ry,Tk=function(){var t=Ak();if(Ek.supportsDescriptors){var e=xk(t,"globalThis");(!e||e.configurable&&(e.enumerable||!e.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t},$k=Ti,Ck=Iy,Py=Ry,Ik=Tk,Rk=Py(),Ly=function(){return Rk};$k(Ly,{getPolyfill:Py,implementation:Ck,shim:Ik});var Tp=Ly,Vn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},$p=Object,Dy=Error,Pk=EvalError,Lk=RangeError,Cp=ReferenceError,Dk=URIError,Mk=Math.abs,zk=Math.floor,Ok=Math.max,Nk=Math.min,Uk=Math.pow,Fk=Math.round,Ip=Number.isNaN||function(t){return t!==t},Hk=Ip,Vk=function(t){return Hk(t)||t===0?t:t<0?-1:1},Gs=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==i||a.enumerable!==!0)return!1}return!0},wg=typeof Symbol<"u"&&Symbol,Zk=Gs,Rp=function(){return typeof wg!="function"||typeof Symbol!="function"||typeof wg("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Zk()},My=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,Bk=$p,zy=Bk.getPrototypeOf||null,Wk="Function.prototype.bind called on incompatible ",jk=Object.prototype.toString,Gk=Math.max,qk="[object Function]",Sg=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var s=0;s<e.length;s+=1)r[s+t.length]=e[s];return r},Yk=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},Kk=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},Jk=function(t){var e=this;if(typeof e!="function"||jk.apply(e)!==qk)throw new TypeError(Wk+e);for(var r=Yk(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,Sg(r,arguments));return Object(h)===h?h:this}return e.apply(t,Sg(r,arguments))},o=Gk(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+Kk(a,",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var u=function(){};u.prototype=e.prototype,i.prototype=new u,u.prototype=null}return i},Xk=Jk,ol=Function.prototype.bind||Xk,Pp=Function.prototype.call,Gu,_g;function Lp(){return _g||(_g=1,Gu=Function.prototype.apply),Gu}var Qk=typeof Reflect<"u"&&Reflect&&Reflect.apply,e1=ol,t1=Lp(),n1=Pp,r1=Qk,Oy=r1||e1.call(n1,t1),i1=ol,s1=J,o1=Pp,a1=Oy,lu=function(t){if(t.length<1||typeof t[0]!="function")throw new s1("a function is required");return a1(i1,o1,t)},l1=lu,kg=js,Ny;try{Ny=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var qu=!!Ny&&kg&&kg(Object.prototype,"__proto__"),Uy=Object,Eg=Uy.getPrototypeOf,c1=qu&&typeof qu.get=="function"?l1([qu.get]):typeof Eg=="function"?function(t){return Eg(t==null?t:Uy(t))}:!1,xg=My,Ag=zy,Tg=c1,Fy=xg?function(t){return xg(t)}:Ag?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Ag(t)}:Tg?function(t){return Tg(t)}:null,u1=Function.prototype.call,h1=Object.prototype.hasOwnProperty,d1=ol,Zn=d1.call(u1,h1),Y,p1=$p,f1=Dy,g1=Pk,m1=Lk,v1=Cp,Us=Hn,is=J,y1=Dk,b1=Mk,w1=zk,S1=Ok,_1=Nk,k1=Uk,E1=Fk,x1=Vk,Hy=Function,Yu=function(n){try{return Hy('"use strict"; return ('+n+").constructor;")()}catch{}},Fo=js,A1=sl,Ku=function(){throw new is},T1=Fo?function(){try{return arguments.callee,Ku}catch{try{return Fo(arguments,"callee").get}catch{return Ku}}}():Ku,Ni=Rp(),Oe=Fy,$1=zy,C1=My,Vy=Lp(),al=Pp,Bi={},I1=typeof Uint8Array>"u"||!Oe?Y:Oe(Uint8Array),vi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Y:ArrayBuffer,"%ArrayIteratorPrototype%":Ni&&Oe?Oe([][Symbol.iterator]()):Y,"%AsyncFromSyncIteratorPrototype%":Y,"%AsyncFunction%":Bi,"%AsyncGenerator%":Bi,"%AsyncGeneratorFunction%":Bi,"%AsyncIteratorPrototype%":Bi,"%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%":f1,"%eval%":eval,"%EvalError%":g1,"%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%":Hy,"%GeneratorFunction%":Bi,"%Int8Array%":typeof Int8Array>"u"?Y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ni&&Oe?Oe(Oe([][Symbol.iterator]())):Y,"%JSON%":typeof JSON=="object"?JSON:Y,"%Map%":typeof Map>"u"?Y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ni||!Oe?Y:Oe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":p1,"%Object.getOwnPropertyDescriptor%":Fo,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Y:Promise,"%Proxy%":typeof Proxy>"u"?Y:Proxy,"%RangeError%":m1,"%ReferenceError%":v1,"%Reflect%":typeof Reflect>"u"?Y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ni||!Oe?Y:Oe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ni&&Oe?Oe(""[Symbol.iterator]()):Y,"%Symbol%":Ni?Symbol:Y,"%SyntaxError%":Us,"%ThrowTypeError%":T1,"%TypedArray%":I1,"%TypeError%":is,"%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%":y1,"%WeakMap%":typeof WeakMap>"u"?Y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Y:WeakSet,"%Function.prototype.call%":al,"%Function.prototype.apply%":Vy,"%Object.defineProperty%":A1,"%Object.getPrototypeOf%":$1,"%Math.abs%":b1,"%Math.floor%":w1,"%Math.max%":S1,"%Math.min%":_1,"%Math.pow%":k1,"%Math.round%":E1,"%Math.sign%":x1,"%Reflect.getPrototypeOf%":C1};if(Oe)try{null.error}catch(n){var R1=Oe(Oe(n));vi["%Error.prototype%"]=R1}var P1=function n(t){var e;if(t==="%AsyncFunction%")e=Yu("async function () {}");else if(t==="%GeneratorFunction%")e=Yu("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Yu("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Oe&&(e=Oe(i.prototype))}return vi[t]=e,e},$g={__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"]},ll=ol,vc=Zn,L1=ll.call(al,Array.prototype.concat),D1=ll.call(Vy,Array.prototype.splice),Cg=ll.call(al,String.prototype.replace),yc=ll.call(al,String.prototype.slice),M1=ll.call(al,RegExp.prototype.exec),z1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,O1=/\\(\\)?/g,N1=function(t){var e=yc(t,0,1),r=yc(t,-1);if(e==="%"&&r!=="%")throw new Us("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Us("invalid intrinsic syntax, expected opening `%`");var i=[];return Cg(t,z1,function(s,o,a,c){i[i.length]=a?Cg(c,O1,"$1"):o||s}),i},U1=function(t,e){var r=t,i;if(vc($g,r)&&(i=$g[r],r="%"+i[0]+"%"),vc(vi,r)){var s=vi[r];if(s===Bi&&(s=P1(r)),typeof s>"u"&&!e)throw new is("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Us("intrinsic "+t+" does not exist!")},Ct=function(t,e){if(typeof t!="string"||t.length===0)throw new is("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new is('"allowMissing" argument must be a boolean');if(M1(/^%?[^%]*%?$/,t)===null)throw new Us("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=N1(t),i=r.length>0?r[0]:"",s=U1("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],D1(r,L1([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var v=r[h],y=yc(v,0,1),E=yc(v,-1);if((y==='"'||y==="'"||y==="`"||E==='"'||E==="'"||E==="`")&&y!==E)throw new Us("property names with quotes must have matching quotes");if((v==="constructor"||!f)&&(c=!0),i+="."+v,o="%"+i+"%",vc(vi,o))a=vi[o];else if(a!=null){if(!(v in a)){if(!e)throw new is("base intrinsic for "+t+" exists, but the property is not available.");return}if(Fo&&h+1>=r.length){var x=Fo(a,v);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[v]}else f=vc(a,v),a=a[v];f&&!c&&(vi[o]=a)}}return a},Ju,Ig;function yr(){if(Ig)return Ju;Ig=1;var n=Ct,t=lu,e=t([n("%String.prototype.indexOf%")]);return Ju=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},Ju}var Xu,Rg;function Dp(){if(Rg)return Xu;Rg=1;var n=Ct,t=n("%Array%"),e=!t.isArray&&yr()("Object.prototype.toString");return Xu=t.isArray||function(i){return e(i)==="[object Array]"},Xu}var F1=au,Pg=sl,Zy=F1.hasArrayLengthDefineBug(),H1=Zy&&Dp(),V1=yr(),Z1=V1("Object.prototype.propertyIsEnumerable"),Mp=function(t,e,r,i,s,o){if(!Pg){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&Z1(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return Zy&&s==="length"&&"[[Value]]"in o&&H1(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Pg(i,s,r(o)),!0)},B1=J,ao=Zn,W1={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},qs=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(ao(t,e)&&!W1[e])return!1;var r=ao(t,"[[Value]]")||ao(t,"[[Writable]]"),i=ao(t,"[[Get]]")||ao(t,"[[Set]]");if(r&&i)throw new B1("Property Descriptors may not be both accessor and data descriptors");return!0},By=function(t){if(typeof t>"u")return t;var e={};return"[[Value]]"in t&&(e.value=t["[[Value]]"]),"[[Writable]]"in t&&(e.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(e.get=t["[[Get]]"]),"[[Set]]"in t&&(e.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(e.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(e.configurable=!!t["[[Configurable]]"]),e},j1=J,G1=qs,q1=By,Wy=function(t){if(typeof t<"u"&&!G1(t))throw new j1("Assertion failed: `Desc` must be a Property Descriptor");return q1(t)},Y1=J,Lg=Zn,K1=qs,jy=function(t){if(typeof t>"u")return!1;if(!K1(t))throw new Y1("Assertion failed: `Desc` must be a Property Descriptor");return!(!Lg(t,"[[Value]]")&&!Lg(t,"[[Writable]]"))},Ys=function(t){return typeof t=="string"||typeof t=="symbol"},Dg=Ip,Gy=function(t,e){return t===e?t===0?1/t===1/e:!0:Dg(t)&&Dg(e)},Mg=J,J1=Vn,X1=Mp,Q1=Wy,eE=jy,tE=Ys,nE=Gy,zp=function(t,e,r){if(!J1(t))throw new Mg("Assertion failed: Type(O) is not Object");if(!tE(e))throw new Mg("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return X1(eE,nE,Q1,t,e,i)},qy=Function.prototype.toString,Qi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Wh,Jl;if(typeof Qi=="function"&&typeof Object.defineProperty=="function")try{Wh=Object.defineProperty({},"length",{get:function(){throw Jl}}),Jl={},Qi(function(){throw 42},null,Wh)}catch(n){n!==Jl&&(Qi=null)}else Qi=null;var rE=/^\s*class\b/,jh=function(t){try{var e=qy.call(t);return rE.test(e)}catch{return!1}},Qu=function(t){try{return jh(t)?!1:(qy.call(t),!0)}catch{return!1}},Xl=Object.prototype.toString,iE="[object Object]",sE="[object Function]",oE="[object GeneratorFunction]",aE="[object HTMLAllCollection]",lE="[object HTML document.all class]",cE="[object HTMLCollection]",uE=typeof Symbol=="function"&&!!Symbol.toStringTag,hE=!(0 in[,]),Gh=function(){return!1};if(typeof document=="object"){var dE=document.all;Xl.call(dE)===Xl.call(document.all)&&(Gh=function(t){if((hE||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Xl.call(t);return(e===aE||e===lE||e===cE||e===iE)&&t("")==null}catch{}return!1})}var Yy=Qi?function(t){if(Gh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Qi(t,null,Wh)}catch(e){if(e!==Jl)return!1}return!jh(t)&&Qu(t)}:function(t){if(Gh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(uE)return Qu(t);if(jh(t))return!1;var e=Xl.call(t);return e!==sE&&e!==oE&&!/^\[object HTML/.test(e)?!1:Qu(t)},pE=Yy,fE=function(t){return!!t},Kt=Zn,$l=J,gE=Vn,zg=pE,eh=fE,mE=function(t){if(!gE(t))throw new $l("ToPropertyDescriptor requires an object");var e={};if(Kt(t,"enumerable")&&(e["[[Enumerable]]"]=eh(t.enumerable)),Kt(t,"configurable")&&(e["[[Configurable]]"]=eh(t.configurable)),Kt(t,"value")&&(e["[[Value]]"]=t.value),Kt(t,"writable")&&(e["[[Writable]]"]=eh(t.writable)),Kt(t,"get")){var r=t.get;if(typeof r<"u"&&!zg(r))throw new $l("getter must be a function");e["[[Get]]"]=r}if(Kt(t,"set")){var i=t.set;if(typeof i<"u"&&!zg(i))throw new $l("setter must be a function");e["[[Set]]"]=i}if((Kt(e,"[[Get]]")||Kt(e,"[[Set]]"))&&(Kt(e,"[[Value]]")||Kt(e,"[[Writable]]")))throw new $l("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},th=J,vE=Vn,Og=qs,yE=Mp,bE=Wy,wE=jy,SE=Ys,_E=Gy,kE=mE,EE=function(t,e,r){if(!vE(t))throw new th("Assertion failed: Type(O) is not Object");if(!SE(e))throw new th("Assertion failed: P is not a Property Key");var i=Og(r)?r:kE(r);if(!Og(i))throw new th("Assertion failed: Desc is not a valid Property Descriptor");return yE(wE,_E,bE,t,e,i)},Ng=J,xE=Vn,AE=EE,TE=Ys,$E=function(t,e,r){if(!xE(t))throw new Ng("Assertion failed: Type(O) is not Object");if(!TE(e))throw new Ng("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return AE(t,e,i)},CE=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,IE=$p,RE=IE.setPrototypeOf||null,PE=lu,Ug=js,LE=J,Ky={};try{Ky.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var DE=!("toString"in Ky),nh=Ug&&Ug(Object.prototype,"__proto__"),ME=DE&&(!!nh&&typeof nh.set=="function"&&PE([nh.set])||function(t,e){if(t==null)throw new LE("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),Fg=CE,zE=RE,Hg=ME,OE=J,NE=Fg?function(t,e){if(Fg(t,e))return t;throw new OE("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:zE||(Hg?function(t,e){return Hg(t,e),t}:null),Vg=J,UE=Vn,Zg=Fy,FE=function(t){if(!UE(t))throw new Vg("Assertion failed: O must be an Object");if(!Zg)throw new Vg("This environment does not support fetching prototypes.");return Zg(t)},HE=J,VE=NE,ZE=Vn,BE=FE,WE=function(t,e){if(e!==null&&!ZE(e))throw new HE("Assertion failed: V must be Object or Null");try{VE(t,e)}catch{return!1}return BE(t)===e},rh=zp,Bg=$E,Jy=WE,jE=au(),Op=Dy;function cl(n,t,e){var r=new Op(e);return Jy(r,Ql),delete r.constructor,Bg(r,"error",n),Bg(r,"suppressed",t),r}jE&&Object.defineProperty(cl,"prototype",{writable:!1});var Ql=cl.prototype;if(!rh(Ql,"constructor",cl)||!rh(Ql,"message","")||!rh(Ql,"name","SuppressedError"))throw new Op("unable to install SuppressedError.prototype properties; please report this!");Jy(cl.prototype,Op.prototype);var GE=cl,qE=GE,Xy=function(){return typeof SuppressedError=="function"?SuppressedError:qE},YE=Ti,Wg=Tp(),KE=Xy,JE=function(){var t=KE();return YE(Wg,{SuppressedError:t},{SuppressedError:function(){return Wg.SuppressedError!==t}}),t};JE();var XE=J,QE=qs,ex=By,tx=function(t){if(typeof t<"u"&&!QE(t))throw new XE("Assertion failed: `Desc` must be a Property Descriptor");return ex(t)},nx=J,jg=Zn,rx=qs,ix=function(t){if(typeof t>"u")return!1;if(!rx(t))throw new nx("Assertion failed: `Desc` must be a Property Descriptor");return!(!jg(t,"[[Value]]")&&!jg(t,"[[Writable]]"))},Gg=Ip,sx=function(t,e){return t===e?t===0?1/t===1/e:!0:Gg(t)&&Gg(e)},Ks=Yy,ox=function(t){return!!t},Jt=Zn,Cl=J,ax=Vn,qg=Ks,ih=ox,lx=function(t){if(!ax(t))throw new Cl("ToPropertyDescriptor requires an object");var e={};if(Jt(t,"enumerable")&&(e["[[Enumerable]]"]=ih(t.enumerable)),Jt(t,"configurable")&&(e["[[Configurable]]"]=ih(t.configurable)),Jt(t,"value")&&(e["[[Value]]"]=t.value),Jt(t,"writable")&&(e["[[Writable]]"]=ih(t.writable)),Jt(t,"get")){var r=t.get;if(typeof r<"u"&&!qg(r))throw new Cl("getter must be a function");e["[[Get]]"]=r}if(Jt(t,"set")){var i=t.set;if(typeof i<"u"&&!qg(i))throw new Cl("setter must be a function");e["[[Set]]"]=i}if((Jt(e,"[[Get]]")||Jt(e,"[[Set]]"))&&(Jt(e,"[[Value]]")||Jt(e,"[[Writable]]")))throw new Cl("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},sh=J,cx=Vn,Yg=qs,ux=Mp,hx=tx,dx=ix,px=Ys,fx=sx,gx=lx,ul=function(t,e,r){if(!cx(t))throw new sh("Assertion failed: Type(O) is not Object");if(!px(e))throw new sh("Assertion failed: P is not a Property Key");var i=Yg(r)?r:gx(r);if(!Yg(i))throw new sh("Assertion failed: Desc is not a valid Property Descriptor");return ux(dx,fx,hx,t,e,i)},mx=Gs(),vx=mx?Symbol.dispose||Symbol("Symbol.dispose"):null,yx=Gs,bx=vx,Np=function(){return yx()&&Symbol.dispose||bx},wx=Rp,Sx=ul,_x=Np,kx=function(){var t=_x();return wx()&&Sx(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},Ex=Gs(),xx=Ex?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,Ax=Gs,Tx=xx,Up=function(){return Ax()&&Symbol.asyncDispose||Tx},$x=Rp,Cx=ul,Ix=Up,Rx=function(){var t=Ix();return $x()&&Cx(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},Px=Dp(),Lx=Ct,Dx=yr(),Mx=J,zx=Px,Ox=Lx("%Reflect.apply%",!0)||Dx("Function.prototype.apply"),cu=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!zx(r))throw new Mx("Assertion failed: optional `argumentsList`, if provided, must be a List");return Ox(t,e,r)};const Nx={},Ux=Object.freeze(Object.defineProperty({__proto__:null,default:Nx},Symbol.toStringTag,{value:"Module"})),Fx=uk(Ux);var Fp=typeof Map=="function"&&Map.prototype,oh=Object.getOwnPropertyDescriptor&&Fp?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,bc=Fp&&oh&&typeof oh.get=="function"?oh.get:null,Kg=Fp&&Map.prototype.forEach,Hp=typeof Set=="function"&&Set.prototype,ah=Object.getOwnPropertyDescriptor&&Hp?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wc=Hp&&ah&&typeof ah.get=="function"?ah.get:null,Jg=Hp&&Set.prototype.forEach,Hx=typeof WeakMap=="function"&&WeakMap.prototype,Do=Hx?WeakMap.prototype.has:null,Vx=typeof WeakSet=="function"&&WeakSet.prototype,Mo=Vx?WeakSet.prototype.has:null,Zx=typeof WeakRef=="function"&&WeakRef.prototype,Xg=Zx?WeakRef.prototype.deref:null,Bx=Boolean.prototype.valueOf,Wx=Object.prototype.toString,jx=Function.prototype.toString,Gx=String.prototype.match,Vp=String.prototype.slice,cr=String.prototype.replace,qx=String.prototype.toUpperCase,Qg=String.prototype.toLowerCase,Qy=RegExp.prototype.test,em=Array.prototype.concat,yn=Array.prototype.join,Yx=Array.prototype.slice,tm=Math.floor,qh=typeof BigInt=="function"?BigInt.prototype.valueOf:null,lh=Object.getOwnPropertySymbols,Yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fs||!0)?Symbol.toStringTag:null,eb=Object.prototype.propertyIsEnumerable,nm=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function rm(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Qy.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-tm(-n):tm(n);if(r!==n){var i=String(r),s=Vp.call(t,i.length+1);return cr.call(i,e,"$&_")+"."+cr.call(cr.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return cr.call(t,e,"$&_")}var Kh=Fx,im=Kh.custom,sm=rb(im)?im:null,tb={__proto__:null,double:'"',single:"'"},Kx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Js=function n(t,e,r,i){var s=e||{};if($n(s,"quoteStyle")&&!$n(tb,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if($n(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=$n(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($n(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($n(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return sb(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?rm(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?rm(t,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof t=="object")return Jh(t)?"[Array]":"[Object]";var f=fA(s,r);if(typeof i>"u")i=[];else if(ib(i,t)>=0)return"[Circular]";function v(Gt,Bn,Ru){if(Bn&&(i=Yx.call(i),i.push(Bn)),Ru){var bl={depth:s.depth};return $n(s,"quoteStyle")&&(bl.quoteStyle=s.quoteStyle),n(Gt,bl,r+1,i)}return n(Gt,s,r+1,i)}if(typeof t=="function"&&!om(t)){var y=sA(t),E=Il(t,v);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(E.length>0?" { "+yn.call(E,", ")+" }":"")}if(rb(t)){var x=Fs?cr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yh.call(t);return typeof t=="object"&&!Fs?lo(x):x}if(hA(t)){for(var C="<"+Qg.call(String(t.nodeName)),L=t.attributes||[],R=0;R<L.length;R++)C+=" "+L[R].name+"="+nb(Jx(L[R].value),"double",s);return C+=">",t.childNodes&&t.childNodes.length&&(C+="..."),C+="</"+Qg.call(String(t.nodeName))+">",C}if(Jh(t)){if(t.length===0)return"[]";var W=Il(t,v);return f&&!pA(W)?"["+Xh(W,f)+"]":"[ "+yn.call(W,", ")+" ]"}if(Qx(t)){var N=Il(t,v);return!("cause"in Error.prototype)&&"cause"in t&&!eb.call(t,"cause")?"{ ["+String(t)+"] "+yn.call(em.call("[cause]: "+v(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+yn.call(N,", ")+" }"}if(typeof t=="object"&&o){if(sm&&typeof t[sm]=="function"&&Kh)return Kh(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(oA(t)){var V=[];return Kg&&Kg.call(t,function(Gt,Bn){V.push(v(Bn,t,!0)+" => "+v(Gt,t))}),am("Map",bc.call(t),V,f)}if(cA(t)){var K=[];return Jg&&Jg.call(t,function(Gt){K.push(v(Gt,t))}),am("Set",wc.call(t),K,f)}if(aA(t))return ch("WeakMap");if(uA(t))return ch("WeakSet");if(lA(t))return ch("WeakRef");if(tA(t))return lo(v(Number(t)));if(rA(t))return lo(v(qh.call(t)));if(nA(t))return lo(Bx.call(t));if(eA(t))return lo(v(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Dr<"u"&&t===Dr)return"{ [object globalThis] }";if(!Xx(t)&&!om(t)){var G=Il(t,v),he=nm?nm(t)===Object.prototype:t instanceof Object||t.constructor===Object,Lt=t instanceof Object?"":"null prototype",_r=!he&&zo&&Object(t)===t&&zo in t?Vp.call(br(t),8,-1):Lt?"Object":"",He=he||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",kr=He+(_r||Lt?"["+yn.call(em.call([],_r||[],Lt||[]),": ")+"] ":"");return G.length===0?kr+"{}":f?kr+"{"+Xh(G,f)+"}":kr+"{ "+yn.call(G,", ")+" }"}return String(t)};function nb(n,t,e){var r=e.quoteStyle||t,i=tb[r];return i+n+i}function Jx(n){return cr.call(String(n),/"/g,"&quot;")}function $i(n){return!zo||!(typeof n=="object"&&(zo in n||typeof n[zo]<"u"))}function Jh(n){return br(n)==="[object Array]"&&$i(n)}function Xx(n){return br(n)==="[object Date]"&&$i(n)}function om(n){return br(n)==="[object RegExp]"&&$i(n)}function Qx(n){return br(n)==="[object Error]"&&$i(n)}function eA(n){return br(n)==="[object String]"&&$i(n)}function tA(n){return br(n)==="[object Number]"&&$i(n)}function nA(n){return br(n)==="[object Boolean]"&&$i(n)}function rb(n){if(Fs)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Yh)return!1;try{return Yh.call(n),!0}catch{}return!1}function rA(n){if(!n||typeof n!="object"||!qh)return!1;try{return qh.call(n),!0}catch{}return!1}var iA=Object.prototype.hasOwnProperty||function(n){return n in this};function $n(n,t){return iA.call(n,t)}function br(n){return Wx.call(n)}function sA(n){if(n.name)return n.name;var t=Gx.call(jx.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function ib(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function oA(n){if(!bc||!n||typeof n!="object")return!1;try{bc.call(n);try{wc.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function aA(n){if(!Do||!n||typeof n!="object")return!1;try{Do.call(n,Do);try{Mo.call(n,Mo)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function lA(n){if(!Xg||!n||typeof n!="object")return!1;try{return Xg.call(n),!0}catch{}return!1}function cA(n){if(!wc||!n||typeof n!="object")return!1;try{wc.call(n);try{bc.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function uA(n){if(!Mo||!n||typeof n!="object")return!1;try{Mo.call(n,Mo);try{Do.call(n,Do)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function hA(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function sb(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return sb(Vp.call(n,0,t.maxStringLength),t)+r}var i=Kx[t.quoteStyle||"single"];i.lastIndex=0;var s=cr.call(cr.call(n,i,"\\$1"),/[\x00-\x1f]/g,dA);return nb(s,"single",t)}function dA(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+qx.call(t.toString(16))}function lo(n){return"Object("+n+")"}function ch(n){return n+" { ? }"}function am(n,t,e,r){var i=r?Xh(e,r):yn.call(e,", ");return n+" ("+t+") {"+i+"}"}function pA(n){for(var t=0;t<n.length;t++)if(ib(n[t],`
2
- `)>=0)return!1;return!0}function fA(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=yn.call(Array(n.indent+1)," ");else return null;return{base:e,prev:yn.call(Array(t+1),e)}}function Xh(n,t){if(n.length===0)return"";var e=`
1
+ var X_=Object.defineProperty;var sg=n=>{throw TypeError(n)};var Q_=(n,t,e)=>t in n?X_(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>Q_(n,typeof t!="symbol"?t+"":t,e),Zu=(n,t,e)=>t.has(n)||sg("Cannot "+e);var l=(n,t,e)=>(Zu(n,t,"read from private field"),e?e.call(n):t.get(n)),b=(n,t,e)=>t.has(n)?sg("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),m=(n,t,e,r)=>(Zu(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),d=(n,t,e)=>(Zu(n,t,"access private method"),e);var Bu=(n,t,e,r)=>({set _(i){m(n,t,i,e)},get _(){return l(n,t,r)}});import{i as og,a as Wu,b as ag,c as lg,d as cg,e as ek,U as tk,f as ug,g as hg,A as nk,h as rk,j as ik}from"./artifact-bridge-BhiFDvPj.js";import{m as sk,a as ok,b as ak}from"./missing-artifact-page-DVzJ41AE.js";var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lk(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var dg=Object.prototype.toString,ky=function(t){var e=dg.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&dg.call(t.callee)==="[object Function]"),r},ju,pg;function ck(){if(pg)return ju;pg=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=ky,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 y=v.constructor;return y&&y.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]&&t.call(window,v)&&window[v]!==null&&typeof window[v]=="object")try{c(window[v])}catch{return!0}}catch{return!0}return!1}(),f=function(v){if(typeof window>"u"||!h)return c(v);try{return c(v)}catch{return!1}};n=function(y){var E=y!==null&&typeof y=="object",x=e.call(y)==="[object Function]",C=r(y),L=E&&e.call(y)==="[object String]",R=[];if(!E&&!x&&!C)throw new TypeError("Object.keys called on a non-object");var W=o&&x;if(L&&y.length>0&&!t.call(y,0))for(var N=0;N<y.length;++N)R.push(String(N));if(C&&y.length>0)for(var V=0;V<y.length;++V)R.push(String(V));else for(var K in y)!(W&&K==="prototype")&&t.call(y,K)&&R.push(String(K));if(s)for(var G=f(y),he=0;he<a.length;++he)!(G&&a[he]==="constructor")&&t.call(y,a[he])&&R.push(a[he]);return R}}return ju=n,ju}var uk=Array.prototype.slice,hk=ky,fg=Object.keys,Gl=fg?function(t){return fg(t)}:ck(),gg=Object.keys;Gl.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(r){return hk(r)?gg(uk.call(r)):gg(r)})}else Object.keys=Gl;return Object.keys||Gl};var dk=Gl,ql=Object.defineProperty||!1;if(ql)try{ql({},"a",{value:1})}catch{ql=!1}var sl=ql,Hn=SyntaxError,J=TypeError,pk=Object.getOwnPropertyDescriptor,Yl=pk;if(Yl)try{Yl([],"length")}catch{Yl=null}var js=Yl,mg=sl,fk=Hn,Oi=J,vg=js,Ey=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Oi("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Oi("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Oi("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Oi("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Oi("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Oi("`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=!!vg&&vg(t,e);if(mg)mg(t,e,{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)t[e]=r;else throw new fk("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Zh=sl,xy=function(){return!!Zh};xy.hasArrayLengthDefineBug=function(){if(!Zh)return null;try{return Zh([],"length",{value:1}).length!==1}catch{return!0}};var au=xy,gk=dk,mk=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",vk=Object.prototype.toString,yk=Array.prototype.concat,yg=Ey,bk=function(n){return typeof n=="function"&&vk.call(n)==="[object Function]"},Ay=au(),wk=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!bk(r)||!r())return}Ay?yg(n,t,e,!0):yg(n,t,e)},Ty=function(n,t){var e=arguments.length>2?arguments[2]:{},r=gk(t);mk&&(r=yk.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)wk(n,r[i],t[r[i]],e[r[i]])};Ty.supportsDescriptors=!!Ay;var Ti=Ty,Kl={exports:{}};typeof self<"u"?Kl.exports=self:typeof window<"u"?Kl.exports=window:Kl.exports=Function("return this")();var $y=Kl.exports,Sk=$y,Cy=function(){return typeof Dr!="object"||!Dr||Dr.Math!==Math||Dr.Array!==Array?Sk:Dr},_k=Ti,kk=js,Ek=Cy,xk=function(){var t=Ek();if(_k.supportsDescriptors){var e=kk(t,"globalThis");(!e||e.configurable&&(e.enumerable||!e.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t},Ak=Ti,Tk=$y,Iy=Cy,$k=xk,Ck=Iy(),Ry=function(){return Ck};Ak(Ry,{getPolyfill:Iy,implementation:Tk,shim:$k});var Ap=Ry,Vn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},Tp=Object,Py=Error,Ik=EvalError,Rk=RangeError,$p=ReferenceError,Pk=URIError,Lk=Math.abs,Dk=Math.floor,Mk=Math.max,zk=Math.min,Ok=Math.pow,Nk=Math.round,Cp=Number.isNaN||function(t){return t!==t},Uk=Cp,Fk=function(t){return Uk(t)||t===0?t:t<0?-1:1},Gs=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==i||a.enumerable!==!0)return!1}return!0},bg=typeof Symbol<"u"&&Symbol,Hk=Gs,Ip=function(){return typeof bg!="function"||typeof Symbol!="function"||typeof bg("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Hk()},Ly=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,Vk=Tp,Dy=Vk.getPrototypeOf||null,Zk="Function.prototype.bind called on incompatible ",Bk=Object.prototype.toString,Wk=Math.max,jk="[object Function]",wg=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var s=0;s<e.length;s+=1)r[s+t.length]=e[s];return r},Gk=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},qk=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},Yk=function(t){var e=this;if(typeof e!="function"||Bk.apply(e)!==jk)throw new TypeError(Zk+e);for(var r=Gk(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,wg(r,arguments));return Object(h)===h?h:this}return e.apply(t,wg(r,arguments))},o=Wk(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+qk(a,",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var u=function(){};u.prototype=e.prototype,i.prototype=new u,u.prototype=null}return i},Kk=Yk,ol=Function.prototype.bind||Kk,Rp=Function.prototype.call,Pp=Function.prototype.apply,Jk=typeof Reflect<"u"&&Reflect&&Reflect.apply,Xk=ol,Qk=Pp,e1=Rp,t1=Jk,My=t1||Xk.call(e1,Qk),n1=ol,r1=J,i1=Rp,s1=My,lu=function(t){if(t.length<1||typeof t[0]!="function")throw new r1("a function is required");return s1(n1,i1,t)},o1=lu,Sg=js,zy;try{zy=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Gu=!!zy&&Sg&&Sg(Object.prototype,"__proto__"),Oy=Object,_g=Oy.getPrototypeOf,a1=Gu&&typeof Gu.get=="function"?o1([Gu.get]):typeof _g=="function"?function(t){return _g(t==null?t:Oy(t))}:!1,kg=Ly,Eg=Dy,xg=a1,Ny=kg?function(t){return kg(t)}:Eg?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Eg(t)}:xg?function(t){return xg(t)}:null,l1=Function.prototype.call,c1=Object.prototype.hasOwnProperty,u1=ol,Zn=u1.call(l1,c1),Y,h1=Tp,d1=Py,p1=Ik,f1=Rk,g1=$p,Us=Hn,is=J,m1=Pk,v1=Lk,y1=Dk,b1=Mk,w1=zk,S1=Ok,_1=Nk,k1=Fk,Uy=Function,qu=function(n){try{return Uy('"use strict"; return ('+n+").constructor;")()}catch{}},Fo=js,E1=sl,Yu=function(){throw new is},x1=Fo?function(){try{return arguments.callee,Yu}catch{try{return Fo(arguments,"callee").get}catch{return Yu}}}():Yu,Ni=Ip(),Oe=Ny,A1=Dy,T1=Ly,Fy=Pp,al=Rp,Bi={},$1=typeof Uint8Array>"u"||!Oe?Y:Oe(Uint8Array),vi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Y:ArrayBuffer,"%ArrayIteratorPrototype%":Ni&&Oe?Oe([][Symbol.iterator]()):Y,"%AsyncFromSyncIteratorPrototype%":Y,"%AsyncFunction%":Bi,"%AsyncGenerator%":Bi,"%AsyncGeneratorFunction%":Bi,"%AsyncIteratorPrototype%":Bi,"%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%":d1,"%eval%":eval,"%EvalError%":p1,"%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%":Uy,"%GeneratorFunction%":Bi,"%Int8Array%":typeof Int8Array>"u"?Y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ni&&Oe?Oe(Oe([][Symbol.iterator]())):Y,"%JSON%":typeof JSON=="object"?JSON:Y,"%Map%":typeof Map>"u"?Y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ni||!Oe?Y:Oe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":h1,"%Object.getOwnPropertyDescriptor%":Fo,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Y:Promise,"%Proxy%":typeof Proxy>"u"?Y:Proxy,"%RangeError%":f1,"%ReferenceError%":g1,"%Reflect%":typeof Reflect>"u"?Y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ni||!Oe?Y:Oe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ni&&Oe?Oe(""[Symbol.iterator]()):Y,"%Symbol%":Ni?Symbol:Y,"%SyntaxError%":Us,"%ThrowTypeError%":x1,"%TypedArray%":$1,"%TypeError%":is,"%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%":m1,"%WeakMap%":typeof WeakMap>"u"?Y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Y:WeakSet,"%Function.prototype.call%":al,"%Function.prototype.apply%":Fy,"%Object.defineProperty%":E1,"%Object.getPrototypeOf%":A1,"%Math.abs%":v1,"%Math.floor%":y1,"%Math.max%":b1,"%Math.min%":w1,"%Math.pow%":S1,"%Math.round%":_1,"%Math.sign%":k1,"%Reflect.getPrototypeOf%":T1};if(Oe)try{null.error}catch(n){var C1=Oe(Oe(n));vi["%Error.prototype%"]=C1}var I1=function n(t){var e;if(t==="%AsyncFunction%")e=qu("async function () {}");else if(t==="%GeneratorFunction%")e=qu("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=qu("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Oe&&(e=Oe(i.prototype))}return vi[t]=e,e},Ag={__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"]},ll=ol,vc=Zn,R1=ll.call(al,Array.prototype.concat),P1=ll.call(Fy,Array.prototype.splice),Tg=ll.call(al,String.prototype.replace),yc=ll.call(al,String.prototype.slice),L1=ll.call(al,RegExp.prototype.exec),D1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,M1=/\\(\\)?/g,z1=function(t){var e=yc(t,0,1),r=yc(t,-1);if(e==="%"&&r!=="%")throw new Us("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Us("invalid intrinsic syntax, expected opening `%`");var i=[];return Tg(t,D1,function(s,o,a,c){i[i.length]=a?Tg(c,M1,"$1"):o||s}),i},O1=function(t,e){var r=t,i;if(vc(Ag,r)&&(i=Ag[r],r="%"+i[0]+"%"),vc(vi,r)){var s=vi[r];if(s===Bi&&(s=I1(r)),typeof s>"u"&&!e)throw new is("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Us("intrinsic "+t+" does not exist!")},Ct=function(t,e){if(typeof t!="string"||t.length===0)throw new is("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new is('"allowMissing" argument must be a boolean');if(L1(/^%?[^%]*%?$/,t)===null)throw new Us("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=z1(t),i=r.length>0?r[0]:"",s=O1("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],P1(r,R1([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var v=r[h],y=yc(v,0,1),E=yc(v,-1);if((y==='"'||y==="'"||y==="`"||E==='"'||E==="'"||E==="`")&&y!==E)throw new Us("property names with quotes must have matching quotes");if((v==="constructor"||!f)&&(c=!0),i+="."+v,o="%"+i+"%",vc(vi,o))a=vi[o];else if(a!=null){if(!(v in a)){if(!e)throw new is("base intrinsic for "+t+" exists, but the property is not available.");return}if(Fo&&h+1>=r.length){var x=Fo(a,v);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[v]}else f=vc(a,v),a=a[v];f&&!c&&(vi[o]=a)}}return a},Ku,$g;function yr(){if($g)return Ku;$g=1;var n=Ct,t=lu,e=t([n("%String.prototype.indexOf%")]);return Ku=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},Ku}var Ju,Cg;function Lp(){if(Cg)return Ju;Cg=1;var n=Ct,t=n("%Array%"),e=!t.isArray&&yr()("Object.prototype.toString");return Ju=t.isArray||function(i){return e(i)==="[object Array]"},Ju}var N1=au,Ig=sl,Hy=N1.hasArrayLengthDefineBug(),U1=Hy&&Lp(),F1=yr(),H1=F1("Object.prototype.propertyIsEnumerable"),Dp=function(t,e,r,i,s,o){if(!Ig){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&H1(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return Hy&&s==="length"&&"[[Value]]"in o&&U1(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Ig(i,s,r(o)),!0)},V1=J,ao=Zn,Z1={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},qs=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(ao(t,e)&&!Z1[e])return!1;var r=ao(t,"[[Value]]")||ao(t,"[[Writable]]"),i=ao(t,"[[Get]]")||ao(t,"[[Set]]");if(r&&i)throw new V1("Property Descriptors may not be both accessor and data descriptors");return!0},Vy=function(t){if(typeof t>"u")return t;var e={};return"[[Value]]"in t&&(e.value=t["[[Value]]"]),"[[Writable]]"in t&&(e.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(e.get=t["[[Get]]"]),"[[Set]]"in t&&(e.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(e.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(e.configurable=!!t["[[Configurable]]"]),e},B1=J,W1=qs,j1=Vy,Zy=function(t){if(typeof t<"u"&&!W1(t))throw new B1("Assertion failed: `Desc` must be a Property Descriptor");return j1(t)},G1=J,Rg=Zn,q1=qs,By=function(t){if(typeof t>"u")return!1;if(!q1(t))throw new G1("Assertion failed: `Desc` must be a Property Descriptor");return!(!Rg(t,"[[Value]]")&&!Rg(t,"[[Writable]]"))},Ys=function(t){return typeof t=="string"||typeof t=="symbol"},Pg=Cp,Wy=function(t,e){return t===e?t===0?1/t===1/e:!0:Pg(t)&&Pg(e)},Lg=J,Y1=Vn,K1=Dp,J1=Zy,X1=By,Q1=Ys,eE=Wy,Mp=function(t,e,r){if(!Y1(t))throw new Lg("Assertion failed: Type(O) is not Object");if(!Q1(e))throw new Lg("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return K1(X1,eE,J1,t,e,i)},jy=Function.prototype.toString,Qi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Bh,Jl;if(typeof Qi=="function"&&typeof Object.defineProperty=="function")try{Bh=Object.defineProperty({},"length",{get:function(){throw Jl}}),Jl={},Qi(function(){throw 42},null,Bh)}catch(n){n!==Jl&&(Qi=null)}else Qi=null;var tE=/^\s*class\b/,Wh=function(t){try{var e=jy.call(t);return tE.test(e)}catch{return!1}},Xu=function(t){try{return Wh(t)?!1:(jy.call(t),!0)}catch{return!1}},Xl=Object.prototype.toString,nE="[object Object]",rE="[object Function]",iE="[object GeneratorFunction]",sE="[object HTMLAllCollection]",oE="[object HTML document.all class]",aE="[object HTMLCollection]",lE=typeof Symbol=="function"&&!!Symbol.toStringTag,cE=!(0 in[,]),jh=function(){return!1};if(typeof document=="object"){var uE=document.all;Xl.call(uE)===Xl.call(document.all)&&(jh=function(t){if((cE||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Xl.call(t);return(e===sE||e===oE||e===aE||e===nE)&&t("")==null}catch{}return!1})}var Gy=Qi?function(t){if(jh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Qi(t,null,Bh)}catch(e){if(e!==Jl)return!1}return!Wh(t)&&Xu(t)}:function(t){if(jh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(lE)return Xu(t);if(Wh(t))return!1;var e=Xl.call(t);return e!==rE&&e!==iE&&!/^\[object HTML/.test(e)?!1:Xu(t)},hE=Gy,dE=function(t){return!!t},Kt=Zn,$l=J,pE=Vn,Dg=hE,Qu=dE,fE=function(t){if(!pE(t))throw new $l("ToPropertyDescriptor requires an object");var e={};if(Kt(t,"enumerable")&&(e["[[Enumerable]]"]=Qu(t.enumerable)),Kt(t,"configurable")&&(e["[[Configurable]]"]=Qu(t.configurable)),Kt(t,"value")&&(e["[[Value]]"]=t.value),Kt(t,"writable")&&(e["[[Writable]]"]=Qu(t.writable)),Kt(t,"get")){var r=t.get;if(typeof r<"u"&&!Dg(r))throw new $l("getter must be a function");e["[[Get]]"]=r}if(Kt(t,"set")){var i=t.set;if(typeof i<"u"&&!Dg(i))throw new $l("setter must be a function");e["[[Set]]"]=i}if((Kt(e,"[[Get]]")||Kt(e,"[[Set]]"))&&(Kt(e,"[[Value]]")||Kt(e,"[[Writable]]")))throw new $l("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},eh=J,gE=Vn,Mg=qs,mE=Dp,vE=Zy,yE=By,bE=Ys,wE=Wy,SE=fE,_E=function(t,e,r){if(!gE(t))throw new eh("Assertion failed: Type(O) is not Object");if(!bE(e))throw new eh("Assertion failed: P is not a Property Key");var i=Mg(r)?r:SE(r);if(!Mg(i))throw new eh("Assertion failed: Desc is not a valid Property Descriptor");return mE(yE,wE,vE,t,e,i)},zg=J,kE=Vn,EE=_E,xE=Ys,AE=function(t,e,r){if(!kE(t))throw new zg("Assertion failed: Type(O) is not Object");if(!xE(e))throw new zg("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return EE(t,e,i)},TE=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,$E=Tp,CE=$E.setPrototypeOf||null,IE=lu,Og=js,RE=J,qy={};try{qy.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var PE=!("toString"in qy),th=Og&&Og(Object.prototype,"__proto__"),LE=PE&&(!!th&&typeof th.set=="function"&&IE([th.set])||function(t,e){if(t==null)throw new RE("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),Ng=TE,DE=CE,Ug=LE,ME=J,zE=Ng?function(t,e){if(Ng(t,e))return t;throw new ME("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:DE||(Ug?function(t,e){return Ug(t,e),t}:null),Fg=J,OE=Vn,Hg=Ny,NE=function(t){if(!OE(t))throw new Fg("Assertion failed: O must be an Object");if(!Hg)throw new Fg("This environment does not support fetching prototypes.");return Hg(t)},UE=J,FE=zE,HE=Vn,VE=NE,ZE=function(t,e){if(e!==null&&!HE(e))throw new UE("Assertion failed: V must be Object or Null");try{FE(t,e)}catch{return!1}return VE(t)===e},nh=Mp,Vg=AE,Yy=ZE,BE=au(),zp=Py;function cl(n,t,e){var r=new zp(e);return Yy(r,Ql),delete r.constructor,Vg(r,"error",n),Vg(r,"suppressed",t),r}BE&&Object.defineProperty(cl,"prototype",{writable:!1});var Ql=cl.prototype;if(!nh(Ql,"constructor",cl)||!nh(Ql,"message","")||!nh(Ql,"name","SuppressedError"))throw new zp("unable to install SuppressedError.prototype properties; please report this!");Yy(cl.prototype,zp.prototype);var WE=cl,jE=WE,Ky=function(){return typeof SuppressedError=="function"?SuppressedError:jE},GE=Ti,Zg=Ap(),qE=Ky,YE=function(){var t=qE();return GE(Zg,{SuppressedError:t},{SuppressedError:function(){return Zg.SuppressedError!==t}}),t};YE();var KE=J,JE=qs,XE=Vy,QE=function(t){if(typeof t<"u"&&!JE(t))throw new KE("Assertion failed: `Desc` must be a Property Descriptor");return XE(t)},ex=J,Bg=Zn,tx=qs,nx=function(t){if(typeof t>"u")return!1;if(!tx(t))throw new ex("Assertion failed: `Desc` must be a Property Descriptor");return!(!Bg(t,"[[Value]]")&&!Bg(t,"[[Writable]]"))},Wg=Cp,rx=function(t,e){return t===e?t===0?1/t===1/e:!0:Wg(t)&&Wg(e)},Ks=Gy,ix=function(t){return!!t},Jt=Zn,Cl=J,sx=Vn,jg=Ks,rh=ix,ox=function(t){if(!sx(t))throw new Cl("ToPropertyDescriptor requires an object");var e={};if(Jt(t,"enumerable")&&(e["[[Enumerable]]"]=rh(t.enumerable)),Jt(t,"configurable")&&(e["[[Configurable]]"]=rh(t.configurable)),Jt(t,"value")&&(e["[[Value]]"]=t.value),Jt(t,"writable")&&(e["[[Writable]]"]=rh(t.writable)),Jt(t,"get")){var r=t.get;if(typeof r<"u"&&!jg(r))throw new Cl("getter must be a function");e["[[Get]]"]=r}if(Jt(t,"set")){var i=t.set;if(typeof i<"u"&&!jg(i))throw new Cl("setter must be a function");e["[[Set]]"]=i}if((Jt(e,"[[Get]]")||Jt(e,"[[Set]]"))&&(Jt(e,"[[Value]]")||Jt(e,"[[Writable]]")))throw new Cl("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},ih=J,ax=Vn,Gg=qs,lx=Dp,cx=QE,ux=nx,hx=Ys,dx=rx,px=ox,ul=function(t,e,r){if(!ax(t))throw new ih("Assertion failed: Type(O) is not Object");if(!hx(e))throw new ih("Assertion failed: P is not a Property Key");var i=Gg(r)?r:px(r);if(!Gg(i))throw new ih("Assertion failed: Desc is not a valid Property Descriptor");return lx(ux,dx,cx,t,e,i)},fx=Gs(),gx=fx?Symbol.dispose||Symbol("Symbol.dispose"):null,mx=Gs,vx=gx,Op=function(){return mx()&&Symbol.dispose||vx},yx=Ip,bx=ul,wx=Op,Sx=function(){var t=wx();return yx()&&bx(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},_x=Gs(),kx=_x?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,Ex=Gs,xx=kx,Np=function(){return Ex()&&Symbol.asyncDispose||xx},Ax=Ip,Tx=ul,$x=Np,Cx=function(){var t=$x();return Ax()&&Tx(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},Ix=Lp(),Rx=Ct,Px=yr(),Lx=J,Dx=Ix,Mx=Rx("%Reflect.apply%",!0)||Px("Function.prototype.apply"),cu=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!Dx(r))throw new Lx("Assertion failed: optional `argumentsList`, if provided, must be a List");return Mx(t,e,r)};const zx={},Ox=Object.freeze(Object.defineProperty({__proto__:null,default:zx},Symbol.toStringTag,{value:"Module"})),Nx=lk(Ox);var Up=typeof Map=="function"&&Map.prototype,sh=Object.getOwnPropertyDescriptor&&Up?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,bc=Up&&sh&&typeof sh.get=="function"?sh.get:null,qg=Up&&Map.prototype.forEach,Fp=typeof Set=="function"&&Set.prototype,oh=Object.getOwnPropertyDescriptor&&Fp?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wc=Fp&&oh&&typeof oh.get=="function"?oh.get:null,Yg=Fp&&Set.prototype.forEach,Ux=typeof WeakMap=="function"&&WeakMap.prototype,Do=Ux?WeakMap.prototype.has:null,Fx=typeof WeakSet=="function"&&WeakSet.prototype,Mo=Fx?WeakSet.prototype.has:null,Hx=typeof WeakRef=="function"&&WeakRef.prototype,Kg=Hx?WeakRef.prototype.deref:null,Vx=Boolean.prototype.valueOf,Zx=Object.prototype.toString,Bx=Function.prototype.toString,Wx=String.prototype.match,Hp=String.prototype.slice,cr=String.prototype.replace,jx=String.prototype.toUpperCase,Jg=String.prototype.toLowerCase,Jy=RegExp.prototype.test,Xg=Array.prototype.concat,yn=Array.prototype.join,Gx=Array.prototype.slice,Qg=Math.floor,Gh=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ah=Object.getOwnPropertySymbols,qh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fs||!0)?Symbol.toStringTag:null,Xy=Object.prototype.propertyIsEnumerable,em=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function tm(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Jy.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Qg(-n):Qg(n);if(r!==n){var i=String(r),s=Hp.call(t,i.length+1);return cr.call(i,e,"$&_")+"."+cr.call(cr.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return cr.call(t,e,"$&_")}var Yh=Nx,nm=Yh.custom,rm=tb(nm)?nm:null,Qy={__proto__:null,double:'"',single:"'"},qx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Js=function n(t,e,r,i){var s=e||{};if($n(s,"quoteStyle")&&!$n(Qy,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if($n(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=$n(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($n(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($n(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return rb(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?tm(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?tm(t,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof t=="object")return Kh(t)?"[Array]":"[Object]";var f=dA(s,r);if(typeof i>"u")i=[];else if(nb(i,t)>=0)return"[Circular]";function v(Gt,Bn,Ru){if(Bn&&(i=Gx.call(i),i.push(Bn)),Ru){var bl={depth:s.depth};return $n(s,"quoteStyle")&&(bl.quoteStyle=s.quoteStyle),n(Gt,bl,r+1,i)}return n(Gt,s,r+1,i)}if(typeof t=="function"&&!im(t)){var y=rA(t),E=Il(t,v);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(E.length>0?" { "+yn.call(E,", ")+" }":"")}if(tb(t)){var x=Fs?cr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):qh.call(t);return typeof t=="object"&&!Fs?lo(x):x}if(cA(t)){for(var C="<"+Jg.call(String(t.nodeName)),L=t.attributes||[],R=0;R<L.length;R++)C+=" "+L[R].name+"="+eb(Yx(L[R].value),"double",s);return C+=">",t.childNodes&&t.childNodes.length&&(C+="..."),C+="</"+Jg.call(String(t.nodeName))+">",C}if(Kh(t)){if(t.length===0)return"[]";var W=Il(t,v);return f&&!hA(W)?"["+Jh(W,f)+"]":"[ "+yn.call(W,", ")+" ]"}if(Jx(t)){var N=Il(t,v);return!("cause"in Error.prototype)&&"cause"in t&&!Xy.call(t,"cause")?"{ ["+String(t)+"] "+yn.call(Xg.call("[cause]: "+v(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+yn.call(N,", ")+" }"}if(typeof t=="object"&&o){if(rm&&typeof t[rm]=="function"&&Yh)return Yh(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(iA(t)){var V=[];return qg&&qg.call(t,function(Gt,Bn){V.push(v(Bn,t,!0)+" => "+v(Gt,t))}),sm("Map",bc.call(t),V,f)}if(aA(t)){var K=[];return Yg&&Yg.call(t,function(Gt){K.push(v(Gt,t))}),sm("Set",wc.call(t),K,f)}if(sA(t))return lh("WeakMap");if(lA(t))return lh("WeakSet");if(oA(t))return lh("WeakRef");if(Qx(t))return lo(v(Number(t)));if(tA(t))return lo(v(Gh.call(t)));if(eA(t))return lo(Vx.call(t));if(Xx(t))return lo(v(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Dr<"u"&&t===Dr)return"{ [object globalThis] }";if(!Kx(t)&&!im(t)){var G=Il(t,v),he=em?em(t)===Object.prototype:t instanceof Object||t.constructor===Object,Lt=t instanceof Object?"":"null prototype",_r=!he&&zo&&Object(t)===t&&zo in t?Hp.call(br(t),8,-1):Lt?"Object":"",He=he||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",kr=He+(_r||Lt?"["+yn.call(Xg.call([],_r||[],Lt||[]),": ")+"] ":"");return G.length===0?kr+"{}":f?kr+"{"+Jh(G,f)+"}":kr+"{ "+yn.call(G,", ")+" }"}return String(t)};function eb(n,t,e){var r=e.quoteStyle||t,i=Qy[r];return i+n+i}function Yx(n){return cr.call(String(n),/"/g,"&quot;")}function $i(n){return!zo||!(typeof n=="object"&&(zo in n||typeof n[zo]<"u"))}function Kh(n){return br(n)==="[object Array]"&&$i(n)}function Kx(n){return br(n)==="[object Date]"&&$i(n)}function im(n){return br(n)==="[object RegExp]"&&$i(n)}function Jx(n){return br(n)==="[object Error]"&&$i(n)}function Xx(n){return br(n)==="[object String]"&&$i(n)}function Qx(n){return br(n)==="[object Number]"&&$i(n)}function eA(n){return br(n)==="[object Boolean]"&&$i(n)}function tb(n){if(Fs)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!qh)return!1;try{return qh.call(n),!0}catch{}return!1}function tA(n){if(!n||typeof n!="object"||!Gh)return!1;try{return Gh.call(n),!0}catch{}return!1}var nA=Object.prototype.hasOwnProperty||function(n){return n in this};function $n(n,t){return nA.call(n,t)}function br(n){return Zx.call(n)}function rA(n){if(n.name)return n.name;var t=Wx.call(Bx.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function nb(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function iA(n){if(!bc||!n||typeof n!="object")return!1;try{bc.call(n);try{wc.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function sA(n){if(!Do||!n||typeof n!="object")return!1;try{Do.call(n,Do);try{Mo.call(n,Mo)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function oA(n){if(!Kg||!n||typeof n!="object")return!1;try{return Kg.call(n),!0}catch{}return!1}function aA(n){if(!wc||!n||typeof n!="object")return!1;try{wc.call(n);try{bc.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function lA(n){if(!Mo||!n||typeof n!="object")return!1;try{Mo.call(n,Mo);try{Do.call(n,Do)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function cA(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function rb(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return rb(Hp.call(n,0,t.maxStringLength),t)+r}var i=qx[t.quoteStyle||"single"];i.lastIndex=0;var s=cr.call(cr.call(n,i,"\\$1"),/[\x00-\x1f]/g,uA);return eb(s,"single",t)}function uA(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+jx.call(t.toString(16))}function lo(n){return"Object("+n+")"}function lh(n){return n+" { ? }"}function sm(n,t,e,r){var i=r?Jh(e,r):yn.call(e,", ");return n+" ("+t+") {"+i+"}"}function hA(n){for(var t=0;t<n.length;t++)if(nb(n[t],`
2
+ `)>=0)return!1;return!0}function dA(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=yn.call(Array(n.indent+1)," ");else return null;return{base:e,prev:yn.call(Array(t+1),e)}}function Jh(n,t){if(n.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+yn.call(n,","+e)+`
4
- `+t.prev}function Il(n,t){var e=Jh(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=$n(n,i)?t(n[i],n):""}var s=typeof lh=="function"?lh(n):[],o;if(Fs){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)$n(n,c)&&(e&&String(Number(c))===c&&c<n.length||Fs&&o["$"+c]instanceof Symbol||(Qy.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof lh=="function")for(var u=0;u<s.length;u++)eb.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var gA=Js,mA=J,uu=function(n,t,e){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,e||(i.next=n.next,n.next=i),i},vA=function(n,t){if(n){var e=uu(n,t);return e&&e.value}},yA=function(n,t,e){var r=uu(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},bA=function(n,t){return n?!!uu(n,t):!1},wA=function(n,t){if(n)return uu(n,t,!0)},SA=function(){var t,e={assert:function(r){if(!e.has(r))throw new mA("Side channel does not contain "+gA(r))},delete:function(r){var i=t&&t.next,s=wA(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return vA(t,r)},has:function(r){return bA(t,r)},set:function(r,i){t||(t={next:void 0}),yA(t,r,i)}};return e},_A=Ct,hl=yr(),kA=Js,EA=J,lm=_A("%Map%",!0),xA=hl("Map.prototype.get",!0),AA=hl("Map.prototype.set",!0),TA=hl("Map.prototype.has",!0),$A=hl("Map.prototype.delete",!0),CA=hl("Map.prototype.size",!0),ob=!!lm&&function(){var t,e={assert:function(r){if(!e.has(r))throw new EA("Side channel does not contain "+kA(r))},delete:function(r){if(t){var i=$A(t,r);return CA(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return xA(t,r)},has:function(r){return t?TA(t,r):!1},set:function(r,i){t||(t=new lm),AA(t,r,i)}};return e},IA=Ct,hu=yr(),RA=Js,Rl=ob,PA=J,Ui=IA("%WeakMap%",!0),LA=hu("WeakMap.prototype.get",!0),DA=hu("WeakMap.prototype.set",!0),MA=hu("WeakMap.prototype.has",!0),zA=hu("WeakMap.prototype.delete",!0),OA=Ui?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new PA("Side channel does not contain "+RA(i))},delete:function(i){if(Ui&&i&&(typeof i=="object"||typeof i=="function")){if(t)return zA(t,i)}else if(Rl&&e)return e.delete(i);return!1},get:function(i){return Ui&&i&&(typeof i=="object"||typeof i=="function")&&t?LA(t,i):e&&e.get(i)},has:function(i){return Ui&&i&&(typeof i=="object"||typeof i=="function")&&t?MA(t,i):!!e&&e.has(i)},set:function(i,s){Ui&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new Ui),DA(t,i,s)):Rl&&(e||(e=Rl()),e.set(i,s))}};return r}:Rl,NA=J,UA=Js,FA=SA,HA=ob,VA=OA,ZA=VA||HA||FA,BA=function(){var t,e={assert:function(r){if(!e.has(r))throw new NA("Side channel does not contain "+UA(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,i){t||(t=ZA()),t.set(r,i)}};return e},WA=Zn,co=BA(),kn=J,Zp={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");if(co.assert(n),!Zp.has(n,t))throw new kn("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");var e=co.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");var e=co.get(n);return!!e&&WA(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");var r=co.get(n);r||(r={},co.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(Zp);var Bp=Zp,ab=Hn,hr=Bp,dl=function n(t,e){if(!(this instanceof n))return new n(t,e);if(t!=="normal"&&t!=="break"&&t!=="continue"&&t!=="return"&&t!=="throw")throw new ab('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');hr.set(this,"[[Type]]",t),hr.set(this,"[[Value]]",e)};dl.prototype.type=function(){return hr.get(this,"[[Type]]")};dl.prototype.value=function(){return hr.get(this,"[[Value]]")};dl.prototype["?"]=function(){var t=hr.get(this,"[[Type]]"),e=hr.get(this,"[[Value]]");if(t==="throw")throw e;return e};dl.prototype["!"]=function(){var t=hr.get(this,"[[Type]]");if(t!=="normal")throw new ab('Assertion failed: Completion Record is not of type "normal"');return hr.get(this,"[[Value]]")};var Wp=dl,jA=Wp,jp=function(t){return new jA("normal",t)},uh,cm;function GA(){if(cm)return uh;cm=1;var n=Gs;return uh=function(){return n()&&!!Symbol.toStringTag},uh}var qA=Ct,um=qA("%Object.defineProperty%",!0),YA=GA()(),KA=Zn,JA=J,Pl=YA?Symbol.toStringTag:null,lb=function(t,e){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 JA("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Pl&&(r||!KA(t,Pl))&&(um?um(t,Pl,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Pl]=e)},cb={exports:{}},XA=Ct,hm=Ay,QA=au(),dm=js,pm=J,eT=XA("%Math.floor%"),tT=function(t,e){if(typeof t!="function")throw new pm("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||eT(e)!==e)throw new pm("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&dm){var o=dm(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(QA?hm(t,"length",e,!0,!0):hm(t,"length",e)),t},nT=ol,rT=Lp(),iT=Oy,sT=function(){return iT(nT,rT,arguments)};(function(n){var t=tT,e=sl,r=lu,i=sT;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return t(a,c>0?c:0,!0)},e?e(n.exports,"apply",{value:i}):n.exports.apply=i})(cb);var Gp=cb.exports,oT=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},aT=Object,lT=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||aT(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},cT=Zn,uT=Dp(),hT=oT,dT=lT,pT=function(t){return t&&typeof t=="object"&&cT(t,"[[DisposableResourceStack]]")&&uT(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||hT(t["[[DisposableResourceStack]]"],dT))},fT=Vn,gT=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(fT(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},mT=gT,qp=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":mT(t)},vT=J,yT=Js,bT=Ys,wT=function(t,e){if(!bT(e))throw new vT("Assertion failed: P is not a Property Key, got "+yT(e));return t[e]},fm=J,ST=wT,_T=Ks,kT=Ys,gm=Js,ET=function(t,e){if(!kT(e))throw new fm("Assertion failed: P is not a Property Key");var r=ST(t,e);if(r!=null){if(!_T(r))throw new fm(gm(e)+" is not a function: "+gm(r));return r}},Qh={exports:{}},xT=Ct,AT=xT,mm=AT("%Reflect.construct%",!0),Sc=ul;try{Sc({},"",{"[[Get]]":function(){}})}catch{Sc=null}if(Sc&&mm){var vm={},ym={};Sc(ym,"length",{"[[Get]]":function(){throw vm},"[[Enumerable]]":!0}),Qh.exports=function(t){try{mm(t,ym)}catch(e){return e===vm}}}else Qh.exports=function(t){return typeof t=="function"&&!!t.prototype};var TT=Qh.exports,hh=J,bm=Ks,$T=TT,CT=function(t){if(!$T(t))throw new hh("C must be a constructor");var e={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new t(function(i,s){if(typeof e["[[Resolve]]"]<"u"||typeof e["[[Reject]]"]<"u")throw new hh("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!bm(e["[[Resolve]]"])||!bm(e["[[Reject]]"]))throw new hh("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},wm=Hn,IT=J,dh=cu,Sm=ET,RT=CT,PT=qp,_m=Np(),km=Up(),LT=function(t,e){if(PT(t)!=="Object")throw new IT("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new wm("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&km&&(r=Sm(t,km)),!r){if(!_m)throw new wm("`Symbol.dispose` is not supported");if(r=Sm(t,_m),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=RT(Promise);try{dh(r,i),dh(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}dh(r,i)}}return r},DT=Hn,ph=J,MT=Ks,zT=qp,OT=LT,NT=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new DT("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(t==null)t=void 0,r=void 0;else{if(typeof t<"u"&&zT(t)!=="Object")throw new ph("`V` must be an Object, or `null` or `undefined`");if(r=OT(t,e),typeof r>"u")throw new ph("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!MT(r))throw new ph("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},UT=Hn,Ll=J,FT=pT,Em=NT,HT=yr(),VT=HT("Array.prototype.push"),ub=function(t,e,r){if(!FT(t))throw new Ll("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new UT("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 Ll("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new Ll("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=Em(e,r)}else{if(typeof e<"u")throw new Ll("Assertion failed: `V` must be undefined when `method` is present");s=Em(void 0,r,i)}return VT(t["[[DisposableResourceStack]]"],s),"UNUSED"},fh,xm;function Yp(){if(xm)return fh;xm=1;var n=Ct,t=Gp,e=Hn,r=n("%Promise.resolve%",!0),i=r&&t(r);return fh=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},fh}var gh,Am;function ZT(){if(Am)return gh;Am=1;var n=Ct,t=Hn,e=n("%Promise%",!0),r=cu,i=Yp(),s=qp;return gh=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new t("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new t("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new t("Assertion failed: `method` must be `undefined` or a function");var h=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(e,h)},gh}var mh,Tm;function BT(){if(Tm)return mh;Tm=1;var n=Wp;return mh=function(e){return new n("throw",e)},mh}var WT=Ct,vh=Hn,$m=J,jT=WT("%Promise%",!0),GT=yr(),Cm=GT("Promise.prototype.then",!0),qT=Wp,Im=ZT(),YT=jp,KT=Yp(),Rm=BT(),JT=Xy(),hb=function(t,e){if(!(e instanceof qT))throw new $m("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new $m("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 vh("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&KT(jT,e),a=function(v){if(e.type()==="throw"){var y=e.value(),E=new JT(v,y);e=Rm(E)}else e=Rm(v)},c=i==="ASYNC-DISPOSE"&&function(y){return Cm(o,function(){var E=Im(y["[[ResourceValue]]"],y["[[Hint]]"],y["[[DisposeMethod]]"]);if(!E)throw new vh("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return Cm(E,YT)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var h=r[u];try{var f=Im(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(f)throw new vh("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},db=function(){var t=[];return{"[[DisposableResourceStack]]":t}},du=Cp,Kp=J,XT=cu,Xs=zp,QT=ul,pb=Ks,e$=jp,ct=Bp,t$=lb,fb=Ti.supportsDescriptors,n$=Gp,Jp=ub,r$=hb,gb=db,Pm=Np(),xt=function n(){if(!(this instanceof n)||ct.has(this,"[[DisposableState]]")||ct.has(this,"[[DisposeCapability]]"))throw new Kp("can only be used with new");ct.set(this,"[[DisposableState]]","PENDING"),ct.set(this,"[[DisposeCapability]]",gb())},mb=function(){var t=this;return ct.assert(t,"[[DisposableState]]"),ct.get(t,"[[DisposableState]]")==="DISPOSED"},pl=n$(mb);fb?QT(xt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":mb}):xt.prototype.disposed=!1;var vb=function(t){ct.set(t,"[[DisposableState]]","DISPOSED"),fb||(t.disposed=!0)};Xs(xt.prototype,"dispose",function(){var t=this;if(!pl(t))return vb(t),r$(ct.get(t,"[[DisposeCapability]]"),e$())["?"]()});Xs(xt.prototype,"use",function(t){var e=this;if(pl(e))throw new du("a disposed stack can not use anything new");return Jp(ct.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});Xs(xt.prototype,"adopt",function(t,e){var r=this;if(pl(r))throw new du("a disposed stack can not use anything new");if(!pb(e))throw new Kp("`onDispose` must be a function");var i=function(){return XT(e,void 0,[t])};return Jp(ct.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});Xs(xt.prototype,"defer",function(t){var e=this;if(pl(e))throw new du("a disposed stack can not defer anything new");if(!pb(t))throw new Kp("`onDispose` must be a function");Jp(ct.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});Xs(xt.prototype,"move",function(){var t=this;if(pl(t))throw new du("a disposed stack can not use anything new");var e=new xt;return ct.set(e,"[[DisposeCapability]]",ct.get(t,"[[DisposeCapability]]")),ct.set(t,"[[DisposeCapability]]",gb()),vb(t),e});Pm&&Xs(xt.prototype,Pm,xt.prototype.dispose);t$(xt.prototype,"DisposableStack");var i$=xt,s$=i$,o$=function(){return typeof DisposableStack=="function"?DisposableStack:s$},a$=Ti,l$=Tp(),c$=o$,u$=function(){var t=c$();return a$(l$,{DisposableStack:t},{DisposableStack:!0}),t},h$=Ct,pu=Cp,Xp=J,Lm=h$("%Promise%",!0),Qp=ub,d$=cu,Qs=zp,p$=ul,f$=hb,yb=Ks,bb=db,g$=jp,Dm=Yp(),ut=Bp,m$=lb,wb=Ti.supportsDescriptors,v$=Gp,y$=yr(),b$=y$("Promise.prototype.then",!0),Mm=Up(),At=function n(){if(!(this instanceof n)||ut.has(this,"[[AsyncDisposableState]]")||ut.has(this,"[[DisposeCapability]]"))throw new Xp("can only be used with new");ut.set(this,"[[AsyncDisposableState]]","pending"),ut.set(this,"[[DisposeCapability]]",bb())},Sb=function(){var t=this;return ut.assert(t,"[[AsyncDisposableState]]"),ut.get(t,"[[AsyncDisposableState]]")==="disposed"},fl=v$(Sb);wb?p$(At.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Sb}):At.prototype.disposed=!1;var _b=function(t){ut.set(t,"[[AsyncDisposableState]]","disposed"),wb||(t.disposed=!0)};Qs(At.prototype,"disposeAsync",function(){var t=this;return fl(t)?Dm(Lm):(_b(t),b$(Dm(Lm,f$(ut.get(t,"[[DisposeCapability]]"),g$())),function(e){return e["?"]()}))});Qs(At.prototype,"use",function(t){var e=this;if(fl(e))throw new pu("a disposed stack can not use anything new");return Qp(ut.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});Qs(At.prototype,"adopt",function(t,e){var r=this;if(fl(r))throw new pu("a disposed stack can not use anything new");if(!yb(e))throw new Xp("`onDisposeAsync` must be a function");var i=function(){return d$(e,void 0,[t])};return i.value=t,Qp(ut.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});Qs(At.prototype,"defer",function(t){var e=this;if(fl(e))throw new pu("a disposed stack can not defer anything new");if(!yb(t))throw new Xp("`onDispose` must be a function");Qp(ut.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});Qs(At.prototype,"move",function(){var t=this;if(fl(t))throw new pu("a disposed stack can not use anything new");var e=new At;return ut.set(e,"[[DisposeCapability]]",ut.get(t,"[[DisposeCapability]]")),ut.set(t,"[[DisposeCapability]]",bb()),_b(t),e});Mm&&Qs(At.prototype,Mm,At.prototype.disposeAsync);m$(At.prototype,"AsyncDisposableStack");var w$=At,S$=w$,_$=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:S$},k$=Ti,E$=Tp(),x$=_$,A$=function(){var t=x$();return k$(E$,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},T$=kx,$$=Rx,C$=u$,I$=A$,R$=function(){T$(),$$(),C$(),I$()};R$();const zm=new WeakMap;function P$(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Fi(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Om(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function L$(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class D${constructor(){g(this,"entries",new Map);g(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw Om();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw Om();if(e.constructor.name==="AsyncFunction")throw L$();this.storeFactory(t,e)}has(t){var e;return((e=this.entries.get(t))==null?void 0:e.factory)!==void 0}resolve(t){return this.resolveAny(t)}storeFactory(t,e){const r=this.getOrCreateEntry(t);r.factory=e,r.instance=void 0,r.error=void 0}validateClassRegistration(t){const e=zm.get(t);if(e){if(t.length!==e.length)throw new Error(`${Fi(t)} cannot be registered with register(Class). @injectable(...) declared ${e.length} dependencies but constructor arity is ${t.length}. Use register(Key, () => value) instead.`);return}if(t.length!==0)throw new Error(`${Fi(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=zm.get(t);if(!e)return new t;const r=e.map(i=>this.resolveAny(i));return new t(...r)}resolveAny(t){return this.getOrCreateEntry(t).proxy}getOrCreateEntry(t){let e=this.entries.get(t);return e||(e={key:t},e.proxy=this.createProxy(e),this.entries.set(t,e),e)}createProxy(t){return new Proxy({},{get:(e,r)=>{if(r==="then")return;const i=this.getInstance(t),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(e,r,i)=>{const s=this.getInstance(t);return Reflect.set(s,r,i,s)},has:(e,r)=>{const i=this.getInstance(t);return r in i}})}getInstance(t){if(t.instance)return t.instance;if(t.error)throw t.error;if(!t.factory)throw new Error(`${Fi(t.key)} was resolved but never registered`);const e=this.constructionStack.indexOf(t.key);if(e!==-1){const r=[...this.constructionStack.slice(e),t.key].map(i=>Fi(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(P$(r))throw new Error(`Factory for ${Fi(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Fi(t.key)} returned a non-object value. Wrap primitives in an object.`);return t.instance=r,r}catch(r){throw t.error=r,r}finally{this.constructionStack.pop()}}}const bn=new D$,M$=.5,Nm=.1,Um=8,z$=4,kb=3,Eb=3,O$=4,Or=255,xb=.2126,Ab=.7152,Tb=.0722;async function $b(n){const t=N$(n);if(!t)return"light";try{return await H$(n,t)>=M$?"light":"dark"}catch{return"light"}}function N$(n){if(typeof document.elementsFromPoint!="function")return null;const t=n.getBoundingClientRect(),e=t.left+t.width/2,r=t.top+t.height/2,i=document.elementsFromPoint(e,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(U$(o))return s}return null}function U$(n){return Cb(n.backgroundImage)?!0:F$(n.backgroundColor)>0}function F$(n){if(!n)return 0;const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 0;const e=t[1].split(/[\s,/]+/).filter(Boolean);return e.length===O$?parseFloat(e[kb]):e.length===Eb?1:0}async function H$(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:Dl((e.left-r.left)/r.width),y:Dl((e.top-r.top)/r.height),width:Dl(e.width/r.width),height:Dl(e.height/r.height)},s=window.getComputedStyle(t),o=Cb(s.backgroundImage);return o?Z$({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):B$(s.backgroundColor)}function Cb(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const Fm=new Map;function V$(n){let t=Fm.get(n);return t||(t=new Promise((e,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>e(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),Fm.set(n,t),t)}async function Z$(n){const t=await V$(n.url),e=Math.max(Um,Math.ceil(n.surfaceWidth*Nm)),r=Math.max(Um,Math.ceil(n.surfaceHeight*Nm)),i=document.createElement("canvas");i.width=e,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=t.naturalWidth/t.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=e,u=e/a);const h=(e-c)/2,f=(r-u)/2;s.drawImage(t,h,f,c,u);const v=Math.max(0,Math.floor(n.region.x*e)),y=Math.max(0,Math.floor(n.region.y*r)),E=Math.max(1,Math.min(e-v,Math.floor(n.region.width*e))),x=Math.max(1,Math.min(r-y,Math.floor(n.region.height*r))),C=s.getImageData(v,y,E,x).data;let L=0,R=0;for(let W=0;W<C.length;W+=z$){const N=C[W]/Or,V=C[W+1]/Or,K=C[W+2]/Or,G=C[W+kb]/Or;L+=G*(xb*N+Ab*V+Tb*K),R+=1}return R>0?L/R:1}function B$(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<Eb)return 1;const r=e[0]/Or,i=e[1]/Or,s=e[2]/Or;return xb*r+Ab*i+Tb*s}function Dl(n){return n<0?0:n>1?1:n}const W$=["ghost","glass"],Ho=[...W$.map(n=>`[variant="${n}"]`),'[material="glass"]'].join(", "),Ml=new WeakSet,Hm=new WeakSet;function Ib(n){if(Hm.has(n))return;Hm.add(n);for(const e of n.querySelectorAll(Ho))yh(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)j$(i,yh);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(Ho)&&yh(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function j$(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(Ho)&&t(n);for(const e of n.querySelectorAll(Ho))t(e)}}async function yh(n){var e,r;if(Ml.has(n)||n.hasAttribute("tone")||(e=n.parentElement)!=null&&e.closest("[tone]"))return;Ml.add(n);const t=await $b(n);if(!n.matches(Ho)){Ml.delete(n);return}if(n.hasAttribute("tone")||(r=n.parentElement)!=null&&r.closest("[tone]")){Ml.delete(n);return}n.setAttribute("tone",t)}const G$="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0}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-xs: 18px;--control-height-sm: 24px;--control-height-md: 28px;--control-height-lg: 32px;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-10: 10px;--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;--layer-chrome: 100;--layer-panel: 500;--layer-overlay: 2000;--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-150: 11%;--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-150: color-mix(in srgb, currentColor var(--alpha-150), 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-lg);padding:0 12px}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(--tint-150);backdrop-filter:saturate(1.2);-webkit-backdrop-filter:saturate(1.2)}button[variant=ghost]:active:not(:disabled){background:var(--tint-300);backdrop-filter:saturate(1.4);-webkit-backdrop-filter:saturate(1.4);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-pressed=true]:not(:disabled),button[variant=ghost][aria-pressed=true]: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);backdrop-filter:saturate(1.3);-webkit-backdrop-filter:saturate(1.3);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);box-shadow:none}button[variant=glass]{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover));backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}button[variant=glass][aria-pressed=true]:not(:disabled),button[variant=glass][aria-pressed=true]:hover:not(:disabled),button[variant=glass][aria-expanded=true]:not(:disabled),button[variant=glass][aria-expanded=true]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}[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}button[variant=ghost]:disabled{background:transparent}: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[size=xs]{height:var(--control-height-xs);padding:0 var(--space-6) 1px;border-radius:var(--radius-8)}button[size=xs][icon-only]{width:var(--control-height-xs);padding:0}button[icon-only]{width:var(--control-height-md);padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}[selectable],[selectable] *{user-select:text;-webkit-user-select:text}[unselectable],[unselectable] *{user-select:none;-webkit-user-select:none}.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-100), transparent);--color-overlay-active: color-mix(in srgb, var(--white) var(--alpha-200), transparent);--color-bg-muted: color-mix(in srgb, var(--white) var(--alpha-100), transparent)}[tone=dark][material=paper]{background:var(--neutral-900)}[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-50), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-bg-muted: var(--neutral-100)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}action-row{display:flex;justify-content:flex-end;gap:var(--space-8);margin-top:var(--space-12)}copy-button{display:contents}copy-button button{position:relative}copy-button .copy-button-idle,copy-button .copy-button-done{display:inline-flex;align-items:center;gap:var(--space-6)}copy-button .copy-button-done{display:none}copy-button[copied] .copy-button-idle{visibility:hidden}copy-button[copied] .copy-button-done{display:flex;position:absolute;top:0;right:0;bottom:0;left:0;align-items:center;justify-content:center}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)}editable-text{display:inline-block;max-width:100%;vertical-align:top}editable-text>.editable-text-span{display:inline-block;max-width:100%;outline:none;overflow:hidden;white-space:nowrap;cursor:inherit;vertical-align:top}editable-text:not([data-editing])>.editable-text-span{text-overflow:ellipsis}editable-text[data-editing]>.editable-text-span{cursor:text}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:linear-gradient(to bottom,color-mix(in srgb,var(--black) var(--alpha-50),transparent),color-mix(in srgb,var(--black) var(--alpha-400),transparent));backdrop-filter:blur(1px);-webkit-backdrop-filter:blur(1px)}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(:first-child):not(:last-child){border-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([variant])[aria-pressed=true]:not(:disabled),segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}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:not(:first-child):not(:last-child)>[slot=trigger]{border-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>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}segmented-control[variant=glass]>button,segmented-control[variant=glass]>dropdown-menu{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}segmented-control[variant=glass]>button:not(:disabled):hover,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):hover){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled):active,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):active){backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}segmented-control[variant=glass]>button:not(:disabled)[aria-pressed=true],segmented-control[variant=glass]>button:not(:disabled)[aria-current]:not([aria-current=false]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-pressed=true]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-current]:not([aria-current=false])){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled)[aria-expanded=true],segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-expanded=true]){backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}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-spinner{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}ui-spinner .spin,.spin{display:inline-flex;animation:ui-spinner-spin 1s steps(8,end) infinite}@keyframes ui-spinner-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spin{animation:none}}system-modal[size=lg]{width:min(560px,100%)}system-modal{display:flex;flex-direction:column;width:min(400px,100%);box-sizing:border-box;padding:var(--space-32) var(--space-24);border-radius:var(--radius-12)}system-modal header{display:flex;flex-direction:column;align-items:center;gap:var(--space-16);text-align:center}system-modal header>hgroup{display:flex;flex-direction:column;align-items:center;gap:var(--space-4);max-width:100%}system-modal header h2{margin:0;font-size:var(--text-lg);font-weight:600;letter-spacing:.01em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}system-modal header p{margin:0;font-size:var(--text-base);opacity:.7;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}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)}',ef=new CSSStyleSheet;ef.replaceSync(G$);const tf=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,ef,tf]}catch{}Ib(document);function Rb(n){tf.replaceSync(n)}function _c(){Rb("")}function nf(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,ef,tf]}catch{}Ib(n)}const q$=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function Y$(n){for(const t of Object.keys(n))if(q$.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function K$(n,t){Y$(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function Fe(){class n extends Event{constructor(e,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(e,{bubbles:s,cancelable:o,composed:a}),K$(this,c)}}return n}class It extends globalThis.EventTarget{}function J$(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function gl(n){var e;class t extends n{constructor(...s){super(...s);b(this,e,!1);J$(this,()=>l(this,e),()=>{m(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const X$=Fe(),Vm=Fe(),Q$=Fe(),So=Fe(),Pb=Fe(),Lb=Fe(),eC=Fe(),bh=Fe(),Je=4,vt=6,Vo=2,ed=2,rf=8,tC=vt,sf="auto",dr="auto",Yn=128,Zm=50,ce=16,yi=Yn*Je+ce*(Je-1),Zo=Yn*vt+ce*(vt-1),nC=yi+ce*2,rC=200,iC=4,zl=150,sC=10,Bm=2,Wm=8,oC=300,aC=4;function Db(n){return Ob(n)}function Mb(n,t){return Ob(n.flatMap(e=>Ub(e,t)))}function zb(n){const t=[],e=new Set;for(const r of n){if(r.type==="row"){t.push(`Top-level rows are invalid: ${r.id}`);continue}Fb(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function Nr(n){const t=Db(n),e=zb(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(hC)}}function Ob(n){const t=[];for(const e of n){const r=Nb(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(Un));continue}t.push(i)}}return t}function Nb(n){switch(n.type){case"card":return[Un(n)];case"row":{const t=n.children.map(Un);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=Nb(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(td));continue}if(i.type==="row"){t.push({...i,children:i.children.map(Un)});continue}t.push(Un(i))}}return t.length===0?[]:t.length===1?[td(t[0])]:[{...n,children:t}]}}}function Ub(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[Un(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(Un);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>Ub(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[td(e[0])]:[{...n,children:e}]}}}function Fb(n,t,e,r){switch(n.type){case"card":Hb(n,t,e,r);return;case"row":lC(n,t,e,r);return;case"stack":cC(n,t,e,r);return}}function Hb(n,t,e,r){"id"in n&&e.push(`Card ${uo(n)} must not include id`),typeof n.artifactID!="string"||n.artifactID.length===0?e.push("Card is missing artifactID"):r.has(n.artifactID)?e.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),uC(n.width)||e.push(`Card ${uo(n)} width must be an integer in the range ${Vo}-${rf}`),Zb(n.height)||e.push(`Card ${uo(n)} height must be an integer in the range 2-6 or "auto"`);const i=es(n.width);t==="stack"&&i!==Je&&e.push(`Stack child ${uo(n)} width must be ${Je}`),t==="row"&&i<Vo&&e.push(`Row child ${uo(n)} must be at least 2 columns wide`)}function uo(n){return typeof n.artifactID=="string"&&n.artifactID.length>0?n.artifactID:"<missing artifactID>"}function lC(n,t,e,r){if(Vb(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),Zb(n.height,aC)||e.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){e.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){e.push(`Row ${n.id} must contain only card nodes`);continue}Hb(s,"row",e,r),i+=es(s.width)}i!==Je&&e.push(`Row ${n.id} children must sum to 4 columns`)}function cC(n,t,e,r){if(Vb(n.id,e),t!=="strip"&&e.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){e.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"){e.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(Fb(a,"stack",e,r),a.height===dr){s+=1;continue}i+=a.height}if(i>vt&&e.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=vt-i;if(o<s*ed||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<ed&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Vb(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function uC(n){return n===sf||Number.isInteger(n)&&n>=Vo&&n<=rf}function Zb(n,t=tC){return n===dr||Number.isInteger(n)&&n>=ed&&n<=t}function es(n){return n===sf?Je:n}function hC(n){if(n.type==="card")return{id:n.artifactID,type:"card",width:es(n.width),cards:[{id:n.artifactID,artifactID:n.artifactID,col:1,row:1,width:es(n.width),height:Bb(n.height,vt)}]};const t=dC(n.children),e=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=t[i];if(s.type==="card")e.push({id:s.artifactID,artifactID:s.artifactID,col:1,row:r,width:Je,height:o});else{let a=1;for(const c of s.children)e.push({id:c.artifactID,artifactID:c.artifactID,col:a,row:r,width:es(c.width),height:o}),a+=es(c.width)}r+=o}return{id:n.id,type:"stack",width:e.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:e}}function dC(n){let t=0,e=0;for(const i of n)i.height===dr?e+=1:t+=i.height;const r=e>0?(vt-t)/e:0;return n.map(i=>Bb(i.height,r))}function Bb(n,t){return n===dr?t:n}function Un(n){return{...n}}function td(n){return n.type==="card"?Un(n):{...n,children:n.children.map(Un)}}const pC="X-Television-Client-Meta",fC="telemetry-activity",gC="telemetry-signal";function Wb(n,t={}){return{type:"card",artifactID:n,width:t.width??sf,height:t.height??dr}}function ec(n){return n.layout.flatMap(jb)}function jb(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(jb)}}const ie=Fe(),nd=Fe(),Hi=Fe(),jm=Fe();function mC(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const of=mC("RequestError"),vC=200,yC=300,Ol=401;class bC{constructor(t,e){g(this,"serverURL");g(this,"token");g(this,"onUnauthorized");g(this,"telemetryMeta");this.serverURL=t.replace(/\/$/,""),this.token=e.token,this.onUnauthorized=e.onUnauthorized,this.telemetryMeta=e.telemetryMeta}async requestJSON(t,e,r){var o;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await wC(i);if(!i.ok||i.status<vC||i.status>=yC)throw i.status===Ol&&((o=this.onUnauthorized)==null||o.call(this)),this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){var s;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0);if(!i.ok)throw i.status===Ol&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await wh(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===Ol&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await wh(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){var s;const i=await this.request(t,e,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw i.status===Ol&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await wh(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new of(t,r)}async request(t,e,r,i){const s=`${this.serverURL}${e}`;try{return await fetch(s,{method:t,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(t){const e={...t??{}};return this.token&&(e.Authorization=`Bearer ${this.token}`),this.telemetryMeta&&(e[pC]=JSON.stringify(this.telemetryMeta)),Object.keys(e).length>0?e:void 0}}async function wC(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function wh(n,t){try{const e=await n.json();if(typeof e.error=="string")return e.error;if(typeof e.message=="string")return e.message}catch{}return t}function SC(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var en,zc,Gb;class _C{constructor(t){b(this,zc);b(this,en);m(this,en,t)}list(){return l(this,en).requestJSON("GET","/screens")}async get(t={}){const e=await d(this,zc,Gb).call(this,t.screenID);return l(this,en).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,en).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,en).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,en).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}en=new WeakMap,zc=new WeakSet,Gb=async function(t){if(t!==void 0)return t;const{screens:e}=await this.list();if(e.length===1)return e[0].id;throw l(this,en).createError(`screenID is required when multiple screens exist. Available screens: ${SC(e)}`)};var Cn;class kC{constructor(t){b(this,Cn);m(this,Cn,t)}create(t){const e={kind:t.kind,title:t.title};switch(t.kind){case"path":e.path=t.path;break;case"url":e.url=t.url;break}return e.screenID=t.screenID,l(this,Cn).requestJSON("POST","/artifacts",e)}list(t={}){const e=new URLSearchParams;t.screenID!==void 0&&e.set("screenID",t.screenID);const r=e.toString();return l(this,Cn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,Cn).requestJSON("GET",`/artifacts/${encodeURIComponent(t.artifactID)}`)}update(t){const e={};return t.title!==void 0&&(e.title=t.title),t.path!==void 0&&(e.path=t.path),t.url!==void 0&&(e.url=t.url),l(this,Cn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return l(this,Cn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}Cn=new WeakMap;var ls;class EC{constructor(t){b(this,ls);m(this,ls,t)}get(t){return l(this,ls).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return l(this,ls).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}ls=new WeakMap;var Zr;class xC{constructor(t){b(this,Zr);m(this,Zr,t)}status(){return l(this,Zr).requestJSON("GET","/telemetry")}enable(){return l(this,Zr).requestJSON("POST","/telemetry/enable")}disable(){return l(this,Zr).requestJSON("POST","/telemetry/disable")}}Zr=new WeakMap;var Br;class AC{constructor(t){b(this,Br);m(this,Br,t)}get(){return l(this,Br).requestJSON("GET","/display")}patch(t){const e={};return t.activeScreenID!==void 0&&(e.activeScreenID=t.activeScreenID),t.activeThemeName!==void 0&&(e.activeThemeName=t.activeThemeName),l(this,Br).requestVoid("PATCH","/display",e)}focus(t){return l(this,Br).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}Br=new WeakMap;var tn;class TC{constructor(t,e={}){g(this,"screens");g(this,"artifacts");g(this,"display");g(this,"markdown");g(this,"telemetry");b(this,tn);m(this,tn,new bC(t,e)),this.screens=new _C(l(this,tn)),this.artifacts=new kC(l(this,tn)),this.display=new AC(l(this,tn)),this.markdown=new EC(l(this,tn)),this.telemetry=new xC(l(this,tn))}health(){return l(this,tn).requestJSON("GET","/health")}}tn=new WeakMap;const $C={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},rd="0.0.0",CC=/^\d+\.\d+\.\d+$/,IC=3;function af(n){return CC.test(n)}function qb(n,t){const e=n.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<IC;i++)if(e[i]!==r[i])return e[i]>r[i];return!1}function RC(n,t){return n===rd||t===rd?!1:n!==t}const PC="Local",LC="store-";function ee(n){return new URL(n).origin}function DC(n){return{servers:[{url:ee(n),name:PC}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{},authTokens:{},promotedOnboardingScreens:{}}}function MC(n,t){return[...n.promotedOnboardingScreens[ee(t)]??[]]}function zC(n,t,e){const r=ee(t),i=n.promotedOnboardingScreens[r]??[];return i.includes(e)?n:{...n,promotedOnboardingScreens:{...n.promotedOnboardingScreens,[r]:[...i,e]}}}function OC(n,t){return[...n.tabs[ee(t)]??[]]}function Gm(n,t,e){const r=ee(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function NC(n,t,e){const r=ee(t),i=n.tabs[r]??[],s=i.filter(a=>a!==e);if(s.length===i.length)return n;const o={...n.tabs};return s.length===0?delete o[r]:o[r]=s,{...n,tabs:o}}function UC(n,t,e=Date.now()){const r=n.screens[t]??{scrollPosition:0};return{...n,screens:{...n.screens,[t]:{...r,lastActivatedAt:e}}}}var Wr,jr,Gr;class FC extends It{constructor(e,r,i={}){super();b(this,Wr);b(this,jr);b(this,Gr);m(this,Wr,`${LC}${e}`),m(this,jr,i.storage??ZC());const s=l(this,jr).getItem(l(this,Wr));s===null?(m(this,Gr,r),l(this,jr).setItem(l(this,Wr),JSON.stringify(r))):m(this,Gr,BC(JSON.parse(s),r))}get(){return l(this,Gr)}set(e){m(this,Gr,e),l(this,jr).setItem(l(this,Wr),JSON.stringify(e)),this.dispatchEvent(new ie("change"))}}Wr=new WeakMap,jr=new WeakMap,Gr=new WeakMap;function Sh(n,t){return n.authTokens[ee(t)]??null}function HC(n,t,e){return{...n,authTokens:{...n.authTokens,[ee(t)]:e}}}function VC(n,t){const e=ee(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{...n,authTokens:r}}function ZC(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function BC(n,t){return{servers:Array.isArray(n.servers)?n.servers:t.servers,activeServerURL:typeof n.activeServerURL=="string"||n.activeServerURL===null?n.activeServerURL:t.activeServerURL,activeScreenID:typeof n.activeScreenID=="string"||n.activeScreenID===null?n.activeScreenID:t.activeScreenID,tabs:n.tabs&&typeof n.tabs=="object"?n.tabs:t.tabs,screens:n.screens&&typeof n.screens=="object"?n.screens:t.screens,authTokens:n.authTokens&&typeof n.authTokens=="object"?n.authTokens:t.authTokens,promotedOnboardingScreens:n.promotedOnboardingScreens&&typeof n.promotedOnboardingScreens=="object"?n.promotedOnboardingScreens:{}}}class WC extends Event{constructor(){super("theme-changed")}}const jC=gl(It);var qr,Be,Jn,Ye,Xn,In,Ko,ne,Ir,Yb,Jo,Kb,Jb,Xb,Qb,id,sd,od,e0;class GC extends jC{constructor(e){var i;super();b(this,ne);g(this,"id");g(this,"server");b(this,qr);b(this,Be,new Map);b(this,Jn);b(this,Ye);b(this,Xn);b(this,In,null);b(this,Ko,0);b(this,Jo,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&d(this,ne,Kb).call(this,r.screen);break;case"artifact-created":r.screenID===this.id&&d(this,ne,Jb).call(this,r.artifact);break;case"artifact-updated":d(this,ne,Xb).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&d(this,ne,Qb).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new jm("artifact-content-changed",{artifactID:r.artifactID}));break;case"theme-changed":this.dispatchEvent(new WC);break}});this.id=e.screen.id,this.server=e.server,m(this,qr,e.localStore),m(this,Jn,e.screen.name),m(this,Ye,structuredClone(e.screen.layout));const r=((i=l(this,qr).get().screens[this.id])==null?void 0:i.scrollPosition)??0;m(this,Xn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,Jo)),d(this,ne,Yb).call(this)}get name(){return l(this,Jn)}get layout(){return l(this,Ye)}get scrollPosition(){return l(this,Xn)}get artifacts(){return l(this,Be)}setScrollPosition(e){d(this,ne,Ir).call(this);const r=Math.max(0,e);r!==l(this,Xn)&&(m(this,Xn,r),d(this,ne,e0).call(this),this.dispatchEvent(new ie("change")))}setLayout(e){d(this,ne,Ir).call(this);const r=Db(e);if(!zb(r).valid)return;const s=d(this,ne,sd).call(this);m(this,Ye,r),m(this,In,{layout:r,snapshot:s}),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,In))==null?void 0:o.layout)===r&&(m(this,In,null),d(this,ne,od).call(this,s),this.dispatchEvent(new ie("change")))})}rename(e){d(this,ne,Ir).call(this),m(this,Jn,e),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){d(this,ne,Ir).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(d(this,ne,Ir).call(this),!l(this,Be).has(e))return;const r=d(this,ne,sd).call(this);d(this,ne,id).call(this,e),this.dispatchEvent(new ie("change")),this.server.client.artifacts.delete({artifactID:e}).catch(()=>{this.disposed||(d(this,ne,od).call(this,r),this.dispatchEvent(new ie("change")))})}async refreshFromServer(){d(this,ne,Ir).call(this);const e=++Bu(this,Ko)._;let r;try{r=await this.server.client.screens.get({screenID:this.id})}catch{return}if(this.disposed||e!==l(this,Ko))return;const i=new Set([...l(this,Be).values()].filter(s=>s.kind==="path").map(s=>s.id));m(this,In,null),m(this,Jn,r.screen.name),m(this,Ye,structuredClone(r.screen.layout)),l(this,Be).clear();for(const s of r.artifacts)l(this,Be).set(s.id,s);this.dispatchEvent(new ie("change"));for(const s of r.artifacts)s.kind==="path"&&i.has(s.id)&&this.dispatchEvent(new jm("artifact-content-changed",{artifactID:s.id}))}dispose(){this.server.removeEventListener("server-event",l(this,Jo))}}qr=new WeakMap,Be=new WeakMap,Jn=new WeakMap,Ye=new WeakMap,Xn=new WeakMap,In=new WeakMap,Ko=new WeakMap,ne=new WeakSet,Ir=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},Yb=async function(){try{const e=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of e.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new ie("change"))}catch{}},Jo=new WeakMap,Kb=function(e){l(this,In)&&m(this,In,null),m(this,Jn,e.name),m(this,Ye,structuredClone(e.layout)),this.dispatchEvent(new ie("change"))},Jb=function(e){ec({layout:l(this,Ye)}).includes(e.id)||m(this,Ye,[...l(this,Ye),Wb(e.id)]),l(this,Be).set(e.id,e),this.dispatchEvent(new ie("change"))},Xb=function(e){const r=l(this,Be).get(e.id);r&&(l(this,Be).set(e.id,{...r,...e}),this.dispatchEvent(new ie("change")))},Qb=function(e){d(this,ne,id).call(this,e)&&this.dispatchEvent(new ie("change"))},id=function(e){const r=l(this,Be).delete(e),i=ec({layout:l(this,Ye)}).length,s=Mb(l(this,Ye),e),o=ec({layout:s}).length;return m(this,Ye,s),r||i!==o},sd=function(){return{layout:structuredClone(l(this,Ye)),artifacts:new Map([...l(this,Be).entries()].map(([e,r])=>[e,structuredClone(r)]))}},od=function(e){m(this,Ye,structuredClone(e.layout)),l(this,Be).clear();for(const[r,i]of e.artifacts)l(this,Be).set(r,structuredClone(i))},e0=function(){const e=l(this,qr).get();l(this,qr).set({...e,screens:{...e.screens,[this.id]:{...e.screens[this.id],scrollPosition:l(this,Xn)}}})};const qC=gl(It);var Ee,xe,Dt,Xo,Qo,ea,ta,na,De,tc,nc,ad,Wi;class YC extends qC{constructor(e){super();b(this,De);b(this,Ee);b(this,xe);b(this,Dt,null);b(this,Xo,()=>{this.disposed||d(this,De,tc).call(this)});b(this,Qo,()=>{this.disposed||(d(this,De,tc).call(this),d(this,De,nc).call(this))});b(this,ea,()=>{this.disposed||d(this,De,nc).call(this)});b(this,ta,e=>{if(this.disposed)return;const r=e.event;if(r.type==="screen-removed"){this.removeTab(e.serverURL,r.screenID);const i=l(this,Ee).get();i.activeServerURL===ee(e.serverURL)&&i.activeScreenID===r.screenID&&d(this,De,Wi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){d(this,De,Wi).call(this,e.serverURL,null);return}const i=l(this,xe).servers.get(ee(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),d(this,De,Wi).call(this,e.serverURL,r.screenID)}});b(this,na,e=>{if(this.disposed)return;const r=l(this,Dt);r&&ee(e.serverURL)===ee(r.server.url)&&r.refreshFromServer()});m(this,Ee,e.localStore),m(this,xe,e.serverManager),l(this,Ee).addEventListener("change",l(this,Xo)),l(this,xe).addEventListener("change",l(this,Qo)),l(this,xe).addEventListener("screens-changed",l(this,ea)),l(this,xe).addEventListener("server-event",l(this,ta)),l(this,xe).addEventListener("server-reconnected",l(this,na)),d(this,De,tc).call(this),d(this,De,nc).call(this)}get activeScreen(){return l(this,Dt)}get screens(){const e=l(this,Ee).get().screens,r=[];let i=0;for(const s of l(this,xe).servers.values())for(const o of s.screens.values())r.push({server:s,screen:o,local:e[o.id]??{scrollPosition:0},index:i}),i+=1;return r.sort((s,o)=>{const a=(o.local.lastActivatedAt??0)-(s.local.lastActivatedAt??0);return a===0?s.index-o.index:a}).map(({index:s,...o})=>o)}getTabs(e){const r=ee(e),i=OC(l(this,Ee).get(),r),s=l(this,xe).servers.get(r);return s?i.filter(o=>s.screens.has(o)):i}hasTab(e,r){return this.getTabs(e).includes(r)}addTab(e,r){const i=ee(e),s=l(this,xe).servers.get(i);s&&!s.screens.has(r)||d(this,De,ad).call(this,Gm(l(this,Ee).get(),i,r))}removeTab(e,r){d(this,De,ad).call(this,NC(l(this,Ee).get(),e,r))}setActive(e,r){const i=ee(e),s=l(this,xe).servers.get(i);!s||!s.screens.has(r)||d(this,De,Wi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Ee).get().activeServerURL;if(!e||!d(this,De,Wi).call(this,e,null))return;const r=l(this,xe).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Ee).removeEventListener("change",l(this,Xo)),l(this,xe).removeEventListener("change",l(this,Qo)),l(this,xe).removeEventListener("screens-changed",l(this,ea)),l(this,xe).removeEventListener("server-event",l(this,ta)),l(this,xe).removeEventListener("server-reconnected",l(this,na)),(e=l(this,Dt))==null||e.dispose(),m(this,Dt,null)}}Ee=new WeakMap,xe=new WeakMap,Dt=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,ea=new WeakMap,ta=new WeakMap,na=new WeakMap,De=new WeakSet,tc=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Ee).get(),i=e?l(this,xe).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,Dt))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,Dt))==null?void 0:u.server)===i||((h=l(this,Dt))==null||h.dispose(),m(this,Dt,i&&s?new GC({screen:s,server:i,localStore:l(this,Ee)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new X$("active-screen-changed")))},nc=function(){const e=l(this,Ee).get();let r=e;for(const[i,s]of l(this,xe).servers){const o=[...s.screens.values()].filter(c=>c.onboarding!==void 0).sort((c,u)=>c.onboarding.order-u.onboarding.order);if(o.length===0)continue;const a=new Set(MC(r,i));for(const c of o)a.has(c.onboarding.slug)||(r=zC(Gm(r,i,c.id),i,c.onboarding.slug))}r!==e&&(l(this,Ee).set(r),this.dispatchEvent(new Vm("tabs-changed")))},ad=function(e){e!==l(this,Ee).get()&&(l(this,Ee).set(e),this.dispatchEvent(new Vm("tabs-changed")))},Wi=function(e,r){const i=ee(e),s=l(this,Ee).get();if(s.activeServerURL===i&&s.activeScreenID===r)return!1;const o=r===null?{...s,activeServerURL:i,activeScreenID:r}:UC({...s,activeServerURL:i,activeScreenID:r},r);return l(this,Ee).set(o),!0};const t0="0123456789ABCDEFGHJKMNPQRSTVWXYZ",kc=32,KC=16,n0=10,qm=0xffffffffffff;var Ur;(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"})(Ur||(Ur={}));class _o extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function JC(n){const t=Math.floor(n()*kc)%kc;return t0.charAt(t)}function XC(n){const t=QC(),e=t&&(t.crypto||t.msCrypto)||null;if(typeof(e==null?void 0:e.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]/256};if(typeof(e==null?void 0:e.randomBytes)=="function")return()=>e.randomBytes(1).readUInt8()/256;throw new _o(Ur.PRNGDetectFailure,"Failed to find a reliable PRNG")}function QC(){return nI()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function eI(n,t){let e="";for(;n>0;n--)e=JC(t)+e;return e}function tI(n,t=n0){if(isNaN(n))throw new _o(Ur.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>qm)throw new _o(Ur.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${qm}: ${n}`);if(n<0)throw new _o(Ur.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new _o(Ur.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%kc,r=t0.charAt(e)+r,n=(n-e)/kc;return r}function nI(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function fu(n,t){const e=XC(),r=Date.now();return tI(r,n0)+eI(KC,e)}function A(n,t,e){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),t(a,c);const u=o.prototype,h=Object.keys(u);for(let f=0;f<h.length;f++){const v=h[f];v in a||(a[v]=u[v].bind(a))}}const i=(e==null?void 0:e.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=e!=null&&e.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 e!=null&&e.Parent&&a instanceof e.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 ss extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class r0 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const i0={};function pr(n){return i0}function s0(n){const t=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function ld(n,t){return typeof t=="bigint"?t.toString():t}function gu(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function lf(n){return n==null}function cf(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function rI(n,t){const e=(n.toString().split(".")[1]||"").length,r=t.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=e>i?e:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return o%a/10**s}const Ym=Symbol("evaluating");function re(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==Ym)return r===void 0&&(r=Ym,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Ci(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function wr(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function Km(n){return JSON.stringify(n)}function iI(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const o0="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Bo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const sI=gu(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Hs(n){if(Bo(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(Bo(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function a0(n){return Hs(n)?{...n}:Array.isArray(n)?[...n]:n}const oI=new Set(["string","number","symbol"]);function Vs(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sr(n,t,e){const r=new n._zod.constr(t??n._zod.def);return(!t||e!=null&&e.parent)&&(r._zod.parent=n),r}function z(n){const t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function aI(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const lI={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 cI(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=wr(n._zod.def,{get shape(){const o={};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=e.shape[a])}return Ci(this,"shape",o),o},checks:[]});return Sr(n,s)}function uI(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=wr(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return Ci(this,"shape",o),o},checks:[]});return Sr(n,s)}function hI(n,t){if(!Hs(t))throw new Error("Invalid input to extend: expected a plain object");const e=n._zod.def.checks;if(e&&e.length>0){const s=n._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=wr(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Ci(this,"shape",s),s}});return Sr(n,i)}function dI(n,t){if(!Hs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=wr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Ci(this,"shape",r),r}});return Sr(n,e)}function pI(n,t){const e=wr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Ci(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Sr(n,e)}function fI(n,t,e){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=wr(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(e)for(const u in e){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);e[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 Ci(this,"shape",c),c},checks:[]});return Sr(t,o)}function gI(n,t,e){const r=wr(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(e)for(const o in e){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);e[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 Ci(this,"shape",s),s}});return Sr(t,r)}function ts(n,t=0){var e;if(n.aborted===!0)return!0;for(let r=t;r<n.issues.length;r++)if(((e=n.issues[r])==null?void 0:e.continue)!==!0)return!0;return!1}function ns(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Nl(n){return typeof n=="string"?n:n==null?void 0:n.message}function fr(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Nl((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Nl((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??Nl((c=e.customError)==null?void 0:c.call(e,n))??Nl((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function uf(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Wo(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const l0=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),n.message=JSON.stringify(t,ld,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},c0=A("$ZodError",l0),u0=A("$ZodError",l0,{Parent:Error});function mI(n,t=e=>e.message){const e={},r=[];for(const i of n.issues)i.path.length>0?(e[i.path[0]]=e[i.path[0]]||[],e[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:e}}function vI(n,t=e=>e.message){const e={_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)e._errors.push(t(s));else{let o=e,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(t(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),e}const hf=n=>(t,e,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:e,issues:[]},s);if(o instanceof Promise)throw new ss;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>fr(c,s,pr())));throw o0(a,i==null?void 0:i.callee),a}return o.value},df=n=>async(t,e,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:e,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=>fr(c,s,pr())));throw o0(a,i==null?void 0:i.callee),a}return o.value},mu=n=>(t,e,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:e,issues:[]},i);if(s instanceof Promise)throw new ss;return s.issues.length?{success:!1,error:new(n??c0)(s.issues.map(o=>fr(o,i,pr())))}:{success:!0,data:s.value}},yI=mu(u0),vu=n=>async(t,e,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:e,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>fr(o,i,pr())))}:{success:!0,data:s.value}},bI=vu(u0),wI=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return hf(n)(t,e,i)},SI=n=>(t,e,r)=>hf(n)(t,e,r),_I=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return df(n)(t,e,i)},kI=n=>async(t,e,r)=>df(n)(t,e,r),EI=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return mu(n)(t,e,i)},xI=n=>(t,e,r)=>mu(n)(t,e,r),AI=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vu(n)(t,e,i)},TI=n=>async(t,e,r)=>vu(n)(t,e,r),$I=/^[cC][^\s-]{8,}$/,CI=/^[0-9a-z]+$/,II=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,RI=/^[0-9a-vA-V]{20}$/,PI=/^[A-Za-z0-9]{27}$/,LI=/^[a-zA-Z0-9_-]{21}$/,DI=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MI=/^([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})$/,Jm=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)$/,zI=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,OI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function NI(){return new RegExp(OI,"u")}const UI=/^(?:(?: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])$/,FI=/^(([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}|:))$/,HI=/^((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])$/,VI=/^(([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])$/,ZI=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,h0=/^[A-Za-z0-9_-]*$/,BI=/^\+[1-9]\d{6,14}$/,d0="(?:(?:\\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])))",WI=new RegExp(`^${d0}$`);function p0(n){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jI(n){return new RegExp(`^${p0(n)}$`)}function GI(n){const t=p0({precision:n.precision}),e=["Z"];n.local&&e.push(""),n.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${e.join("|")})`;return new RegExp(`^${d0}T(?:${r})$`)}const qI=n=>{const t=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},YI=/^-?\d+$/,f0=/^-?\d+(?:\.\d+)?$/,KI=/^(?:true|false)$/i,JI=/^[^A-Z]*$/,XI=/^[^a-z]*$/,ht=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),g0={number:"number",bigint:"bigint",object:"date"},m0=A("$ZodCheckLessThan",(n,t)=>{ht.init(n,t);const e=g0[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:e,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),v0=A("$ZodCheckGreaterThan",(n,t)=>{ht.init(n,t);const e=g0[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:e,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),QI=A("$ZodCheckMultipleOf",(n,t)=>{ht.init(n,t),n._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),n._zod.check=e=>{if(typeof e.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof e.value=="bigint"?e.value%t.value===BigInt(0):rI(e.value,t.value)===0)||e.issues.push({origin:typeof e.value,code:"not_multiple_of",divisor:t.value,input:e.value,inst:n,continue:!t.abort})}}),eR=A("$ZodCheckNumberFormat",(n,t)=>{var o;ht.init(n,t),t.format=t.format||"float64";const e=(o=t.format)==null?void 0:o.includes("int"),r=e?"int":"number",[i,s]=lI[t.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,e&&(c.pattern=YI)}),n._zod.check=a=>{const c=a.value;if(e){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.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:!t.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:!t.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!t.abort})}}),tR=A("$ZodCheckMaxLength",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!lf(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const o=uf(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),nR=A("$ZodCheckMinLength",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!lf(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const o=uf(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),rR=A("$ZodCheckLengthEquals",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!lf(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===t.length)return;const o=uf(i),a=s>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!t.abort})}}),yu=A("$ZodCheckStringFormat",(n,t)=>{var e,r;ht.init(n,t),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(e=n._zod).check??(e.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(r=n._zod).check??(r.check=()=>{})}),iR=A("$ZodCheckRegex",(n,t)=>{yu.init(n,t),n._zod.check=e=>{t.pattern.lastIndex=0,!t.pattern.test(e.value)&&e.issues.push({origin:"string",code:"invalid_format",format:"regex",input:e.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),sR=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=JI),yu.init(n,t)}),oR=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=XI),yu.init(n,t)}),aR=A("$ZodCheckIncludes",(n,t)=>{ht.init(n,t);const e=Vs(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${e}`:e);t.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(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),lR=A("$ZodCheckStartsWith",(n,t)=>{ht.init(n,t);const e=new RegExp(`^${Vs(t.prefix)}.*`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:n,continue:!t.abort})}}),cR=A("$ZodCheckEndsWith",(n,t)=>{ht.init(n,t);const e=new RegExp(`.*${Vs(t.suffix)}$`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:n,continue:!t.abort})}}),uR=A("$ZodCheckOverwrite",(n,t)=>{ht.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class hR{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
4
+ `+t.prev}function Il(n,t){var e=Kh(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=$n(n,i)?t(n[i],n):""}var s=typeof ah=="function"?ah(n):[],o;if(Fs){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)$n(n,c)&&(e&&String(Number(c))===c&&c<n.length||Fs&&o["$"+c]instanceof Symbol||(Jy.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof ah=="function")for(var u=0;u<s.length;u++)Xy.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var pA=Js,fA=J,uu=function(n,t,e){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,e||(i.next=n.next,n.next=i),i},gA=function(n,t){if(n){var e=uu(n,t);return e&&e.value}},mA=function(n,t,e){var r=uu(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},vA=function(n,t){return n?!!uu(n,t):!1},yA=function(n,t){if(n)return uu(n,t,!0)},bA=function(){var t,e={assert:function(r){if(!e.has(r))throw new fA("Side channel does not contain "+pA(r))},delete:function(r){var i=t&&t.next,s=yA(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return gA(t,r)},has:function(r){return vA(t,r)},set:function(r,i){t||(t={next:void 0}),mA(t,r,i)}};return e},wA=Ct,hl=yr(),SA=Js,_A=J,om=wA("%Map%",!0),kA=hl("Map.prototype.get",!0),EA=hl("Map.prototype.set",!0),xA=hl("Map.prototype.has",!0),AA=hl("Map.prototype.delete",!0),TA=hl("Map.prototype.size",!0),ib=!!om&&function(){var t,e={assert:function(r){if(!e.has(r))throw new _A("Side channel does not contain "+SA(r))},delete:function(r){if(t){var i=AA(t,r);return TA(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return kA(t,r)},has:function(r){return t?xA(t,r):!1},set:function(r,i){t||(t=new om),EA(t,r,i)}};return e},$A=Ct,hu=yr(),CA=Js,Rl=ib,IA=J,Ui=$A("%WeakMap%",!0),RA=hu("WeakMap.prototype.get",!0),PA=hu("WeakMap.prototype.set",!0),LA=hu("WeakMap.prototype.has",!0),DA=hu("WeakMap.prototype.delete",!0),MA=Ui?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new IA("Side channel does not contain "+CA(i))},delete:function(i){if(Ui&&i&&(typeof i=="object"||typeof i=="function")){if(t)return DA(t,i)}else if(Rl&&e)return e.delete(i);return!1},get:function(i){return Ui&&i&&(typeof i=="object"||typeof i=="function")&&t?RA(t,i):e&&e.get(i)},has:function(i){return Ui&&i&&(typeof i=="object"||typeof i=="function")&&t?LA(t,i):!!e&&e.has(i)},set:function(i,s){Ui&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new Ui),PA(t,i,s)):Rl&&(e||(e=Rl()),e.set(i,s))}};return r}:Rl,zA=J,OA=Js,NA=bA,UA=ib,FA=MA,HA=FA||UA||NA,VA=function(){var t,e={assert:function(r){if(!e.has(r))throw new zA("Side channel does not contain "+OA(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,i){t||(t=HA()),t.set(r,i)}};return e},ZA=Zn,co=VA(),kn=J,Vp={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");if(co.assert(n),!Vp.has(n,t))throw new kn("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");var e=co.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");var e=co.get(n);return!!e&&ZA(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new kn("`O` is not an object");if(typeof t!="string")throw new kn("`slot` must be a string");var r=co.get(n);r||(r={},co.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(Vp);var Zp=Vp,sb=Hn,hr=Zp,dl=function n(t,e){if(!(this instanceof n))return new n(t,e);if(t!=="normal"&&t!=="break"&&t!=="continue"&&t!=="return"&&t!=="throw")throw new sb('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');hr.set(this,"[[Type]]",t),hr.set(this,"[[Value]]",e)};dl.prototype.type=function(){return hr.get(this,"[[Type]]")};dl.prototype.value=function(){return hr.get(this,"[[Value]]")};dl.prototype["?"]=function(){var t=hr.get(this,"[[Type]]"),e=hr.get(this,"[[Value]]");if(t==="throw")throw e;return e};dl.prototype["!"]=function(){var t=hr.get(this,"[[Type]]");if(t!=="normal")throw new sb('Assertion failed: Completion Record is not of type "normal"');return hr.get(this,"[[Value]]")};var Bp=dl,BA=Bp,Wp=function(t){return new BA("normal",t)},ch,am;function WA(){if(am)return ch;am=1;var n=Gs;return ch=function(){return n()&&!!Symbol.toStringTag},ch}var jA=Ct,lm=jA("%Object.defineProperty%",!0),GA=WA()(),qA=Zn,YA=J,Pl=GA?Symbol.toStringTag:null,ob=function(t,e){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 YA("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Pl&&(r||!qA(t,Pl))&&(lm?lm(t,Pl,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Pl]=e)},ab={exports:{}},KA=Ct,cm=Ey,JA=au(),um=js,hm=J,XA=KA("%Math.floor%"),QA=function(t,e){if(typeof t!="function")throw new hm("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||XA(e)!==e)throw new hm("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&um){var o=um(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(JA?cm(t,"length",e,!0,!0):cm(t,"length",e)),t},eT=ol,tT=Pp,nT=My,rT=function(){return nT(eT,tT,arguments)};(function(n){var t=QA,e=sl,r=lu,i=rT;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return t(a,c>0?c:0,!0)},e?e(n.exports,"apply",{value:i}):n.exports.apply=i})(ab);var jp=ab.exports,iT=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},sT=Object,oT=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||sT(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},aT=Zn,lT=Lp(),cT=iT,uT=oT,hT=function(t){return t&&typeof t=="object"&&aT(t,"[[DisposableResourceStack]]")&&lT(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||cT(t["[[DisposableResourceStack]]"],uT))},dT=Vn,pT=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(dT(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},fT=pT,Gp=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":fT(t)},gT=J,mT=Js,vT=Ys,yT=function(t,e){if(!vT(e))throw new gT("Assertion failed: P is not a Property Key, got "+mT(e));return t[e]},dm=J,bT=yT,wT=Ks,ST=Ys,pm=Js,_T=function(t,e){if(!ST(e))throw new dm("Assertion failed: P is not a Property Key");var r=bT(t,e);if(r!=null){if(!wT(r))throw new dm(pm(e)+" is not a function: "+pm(r));return r}},Xh={exports:{}},kT=Ct,ET=kT,fm=ET("%Reflect.construct%",!0),Sc=ul;try{Sc({},"",{"[[Get]]":function(){}})}catch{Sc=null}if(Sc&&fm){var gm={},mm={};Sc(mm,"length",{"[[Get]]":function(){throw gm},"[[Enumerable]]":!0}),Xh.exports=function(t){try{fm(t,mm)}catch(e){return e===gm}}}else Xh.exports=function(t){return typeof t=="function"&&!!t.prototype};var xT=Xh.exports,uh=J,vm=Ks,AT=xT,TT=function(t){if(!AT(t))throw new uh("C must be a constructor");var e={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new t(function(i,s){if(typeof e["[[Resolve]]"]<"u"||typeof e["[[Reject]]"]<"u")throw new uh("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!vm(e["[[Resolve]]"])||!vm(e["[[Reject]]"]))throw new uh("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},ym=Hn,$T=J,hh=cu,bm=_T,CT=TT,IT=Gp,wm=Op(),Sm=Np(),RT=function(t,e){if(IT(t)!=="Object")throw new $T("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new ym("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&Sm&&(r=bm(t,Sm)),!r){if(!wm)throw new ym("`Symbol.dispose` is not supported");if(r=bm(t,wm),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=CT(Promise);try{hh(r,i),hh(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}hh(r,i)}}return r},PT=Hn,dh=J,LT=Ks,DT=Gp,MT=RT,zT=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new PT("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(t==null)t=void 0,r=void 0;else{if(typeof t<"u"&&DT(t)!=="Object")throw new dh("`V` must be an Object, or `null` or `undefined`");if(r=MT(t,e),typeof r>"u")throw new dh("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!LT(r))throw new dh("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},OT=Hn,Ll=J,NT=hT,_m=zT,UT=yr(),FT=UT("Array.prototype.push"),lb=function(t,e,r){if(!NT(t))throw new Ll("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new OT("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 Ll("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new Ll("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=_m(e,r)}else{if(typeof e<"u")throw new Ll("Assertion failed: `V` must be undefined when `method` is present");s=_m(void 0,r,i)}return FT(t["[[DisposableResourceStack]]"],s),"UNUSED"},ph,km;function qp(){if(km)return ph;km=1;var n=Ct,t=jp,e=Hn,r=n("%Promise.resolve%",!0),i=r&&t(r);return ph=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},ph}var fh,Em;function HT(){if(Em)return fh;Em=1;var n=Ct,t=Hn,e=n("%Promise%",!0),r=cu,i=qp(),s=Gp;return fh=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new t("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new t("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new t("Assertion failed: `method` must be `undefined` or a function");var h=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(e,h)},fh}var gh,xm;function VT(){if(xm)return gh;xm=1;var n=Bp;return gh=function(e){return new n("throw",e)},gh}var ZT=Ct,mh=Hn,Am=J,BT=ZT("%Promise%",!0),WT=yr(),Tm=WT("Promise.prototype.then",!0),jT=Bp,$m=HT(),GT=Wp,qT=qp(),Cm=VT(),YT=Ky(),cb=function(t,e){if(!(e instanceof jT))throw new Am("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new Am("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 mh("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&qT(BT,e),a=function(v){if(e.type()==="throw"){var y=e.value(),E=new YT(v,y);e=Cm(E)}else e=Cm(v)},c=i==="ASYNC-DISPOSE"&&function(y){return Tm(o,function(){var E=$m(y["[[ResourceValue]]"],y["[[Hint]]"],y["[[DisposeMethod]]"]);if(!E)throw new mh("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return Tm(E,GT)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var h=r[u];try{var f=$m(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(f)throw new mh("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(v){a(v)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},ub=function(){var t=[];return{"[[DisposableResourceStack]]":t}},du=$p,Yp=J,KT=cu,Xs=Mp,JT=ul,hb=Ks,XT=Wp,ct=Zp,QT=ob,db=Ti.supportsDescriptors,e$=jp,Kp=lb,t$=cb,pb=ub,Im=Op(),xt=function n(){if(!(this instanceof n)||ct.has(this,"[[DisposableState]]")||ct.has(this,"[[DisposeCapability]]"))throw new Yp("can only be used with new");ct.set(this,"[[DisposableState]]","PENDING"),ct.set(this,"[[DisposeCapability]]",pb())},fb=function(){var t=this;return ct.assert(t,"[[DisposableState]]"),ct.get(t,"[[DisposableState]]")==="DISPOSED"},pl=e$(fb);db?JT(xt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":fb}):xt.prototype.disposed=!1;var gb=function(t){ct.set(t,"[[DisposableState]]","DISPOSED"),db||(t.disposed=!0)};Xs(xt.prototype,"dispose",function(){var t=this;if(!pl(t))return gb(t),t$(ct.get(t,"[[DisposeCapability]]"),XT())["?"]()});Xs(xt.prototype,"use",function(t){var e=this;if(pl(e))throw new du("a disposed stack can not use anything new");return Kp(ct.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});Xs(xt.prototype,"adopt",function(t,e){var r=this;if(pl(r))throw new du("a disposed stack can not use anything new");if(!hb(e))throw new Yp("`onDispose` must be a function");var i=function(){return KT(e,void 0,[t])};return Kp(ct.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});Xs(xt.prototype,"defer",function(t){var e=this;if(pl(e))throw new du("a disposed stack can not defer anything new");if(!hb(t))throw new Yp("`onDispose` must be a function");Kp(ct.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});Xs(xt.prototype,"move",function(){var t=this;if(pl(t))throw new du("a disposed stack can not use anything new");var e=new xt;return ct.set(e,"[[DisposeCapability]]",ct.get(t,"[[DisposeCapability]]")),ct.set(t,"[[DisposeCapability]]",pb()),gb(t),e});Im&&Xs(xt.prototype,Im,xt.prototype.dispose);QT(xt.prototype,"DisposableStack");var n$=xt,r$=n$,i$=function(){return typeof DisposableStack=="function"?DisposableStack:r$},s$=Ti,o$=Ap(),a$=i$,l$=function(){var t=a$();return s$(o$,{DisposableStack:t},{DisposableStack:!0}),t},c$=Ct,pu=$p,Jp=J,Rm=c$("%Promise%",!0),Xp=lb,u$=cu,Qs=Mp,h$=ul,d$=cb,mb=Ks,vb=ub,p$=Wp,Pm=qp(),ut=Zp,f$=ob,yb=Ti.supportsDescriptors,g$=jp,m$=yr(),v$=m$("Promise.prototype.then",!0),Lm=Np(),At=function n(){if(!(this instanceof n)||ut.has(this,"[[AsyncDisposableState]]")||ut.has(this,"[[DisposeCapability]]"))throw new Jp("can only be used with new");ut.set(this,"[[AsyncDisposableState]]","pending"),ut.set(this,"[[DisposeCapability]]",vb())},bb=function(){var t=this;return ut.assert(t,"[[AsyncDisposableState]]"),ut.get(t,"[[AsyncDisposableState]]")==="disposed"},fl=g$(bb);yb?h$(At.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":bb}):At.prototype.disposed=!1;var wb=function(t){ut.set(t,"[[AsyncDisposableState]]","disposed"),yb||(t.disposed=!0)};Qs(At.prototype,"disposeAsync",function(){var t=this;return fl(t)?Pm(Rm):(wb(t),v$(Pm(Rm,d$(ut.get(t,"[[DisposeCapability]]"),p$())),function(e){return e["?"]()}))});Qs(At.prototype,"use",function(t){var e=this;if(fl(e))throw new pu("a disposed stack can not use anything new");return Xp(ut.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});Qs(At.prototype,"adopt",function(t,e){var r=this;if(fl(r))throw new pu("a disposed stack can not use anything new");if(!mb(e))throw new Jp("`onDisposeAsync` must be a function");var i=function(){return u$(e,void 0,[t])};return i.value=t,Xp(ut.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});Qs(At.prototype,"defer",function(t){var e=this;if(fl(e))throw new pu("a disposed stack can not defer anything new");if(!mb(t))throw new Jp("`onDispose` must be a function");Xp(ut.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});Qs(At.prototype,"move",function(){var t=this;if(fl(t))throw new pu("a disposed stack can not use anything new");var e=new At;return ut.set(e,"[[DisposeCapability]]",ut.get(t,"[[DisposeCapability]]")),ut.set(t,"[[DisposeCapability]]",vb()),wb(t),e});Lm&&Qs(At.prototype,Lm,At.prototype.disposeAsync);f$(At.prototype,"AsyncDisposableStack");var y$=At,b$=y$,w$=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:b$},S$=Ti,_$=Ap(),k$=w$,E$=function(){var t=k$();return S$(_$,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},x$=Sx,A$=Cx,T$=l$,$$=E$,C$=function(){x$(),A$(),T$(),$$()};C$();const Dm=new WeakMap;function I$(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Fi(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function Mm(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function R$(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class P${constructor(){g(this,"entries",new Map);g(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw Mm();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw Mm();if(e.constructor.name==="AsyncFunction")throw R$();this.storeFactory(t,e)}has(t){var e;return((e=this.entries.get(t))==null?void 0:e.factory)!==void 0}resolve(t){return this.resolveAny(t)}storeFactory(t,e){const r=this.getOrCreateEntry(t);r.factory=e,r.instance=void 0,r.error=void 0}validateClassRegistration(t){const e=Dm.get(t);if(e){if(t.length!==e.length)throw new Error(`${Fi(t)} cannot be registered with register(Class). @injectable(...) declared ${e.length} dependencies but constructor arity is ${t.length}. Use register(Key, () => value) instead.`);return}if(t.length!==0)throw new Error(`${Fi(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=Dm.get(t);if(!e)return new t;const r=e.map(i=>this.resolveAny(i));return new t(...r)}resolveAny(t){return this.getOrCreateEntry(t).proxy}getOrCreateEntry(t){let e=this.entries.get(t);return e||(e={key:t},e.proxy=this.createProxy(e),this.entries.set(t,e),e)}createProxy(t){return new Proxy({},{get:(e,r)=>{if(r==="then")return;const i=this.getInstance(t),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(e,r,i)=>{const s=this.getInstance(t);return Reflect.set(s,r,i,s)},has:(e,r)=>{const i=this.getInstance(t);return r in i}})}getInstance(t){if(t.instance)return t.instance;if(t.error)throw t.error;if(!t.factory)throw new Error(`${Fi(t.key)} was resolved but never registered`);const e=this.constructionStack.indexOf(t.key);if(e!==-1){const r=[...this.constructionStack.slice(e),t.key].map(i=>Fi(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(I$(r))throw new Error(`Factory for ${Fi(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Fi(t.key)} returned a non-object value. Wrap primitives in an object.`);return t.instance=r,r}catch(r){throw t.error=r,r}finally{this.constructionStack.pop()}}}const bn=new P$,L$=.5,zm=.1,Om=8,D$=4,Sb=3,_b=3,M$=4,Or=255,kb=.2126,Eb=.7152,xb=.0722;async function Ab(n){const t=z$(n);if(!t)return"light";try{return await U$(n,t)>=L$?"light":"dark"}catch{return"light"}}function z$(n){if(typeof document.elementsFromPoint!="function")return null;const t=n.getBoundingClientRect(),e=t.left+t.width/2,r=t.top+t.height/2,i=document.elementsFromPoint(e,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(O$(o))return s}return null}function O$(n){return Tb(n.backgroundImage)?!0:N$(n.backgroundColor)>0}function N$(n){if(!n)return 0;const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 0;const e=t[1].split(/[\s,/]+/).filter(Boolean);return e.length===M$?parseFloat(e[Sb]):e.length===_b?1:0}async function U$(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:Dl((e.left-r.left)/r.width),y:Dl((e.top-r.top)/r.height),width:Dl(e.width/r.width),height:Dl(e.height/r.height)},s=window.getComputedStyle(t),o=Tb(s.backgroundImage);return o?H$({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):V$(s.backgroundColor)}function Tb(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const Nm=new Map;function F$(n){let t=Nm.get(n);return t||(t=new Promise((e,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>e(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),Nm.set(n,t),t)}async function H$(n){const t=await F$(n.url),e=Math.max(Om,Math.ceil(n.surfaceWidth*zm)),r=Math.max(Om,Math.ceil(n.surfaceHeight*zm)),i=document.createElement("canvas");i.width=e,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=t.naturalWidth/t.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=e,u=e/a);const h=(e-c)/2,f=(r-u)/2;s.drawImage(t,h,f,c,u);const v=Math.max(0,Math.floor(n.region.x*e)),y=Math.max(0,Math.floor(n.region.y*r)),E=Math.max(1,Math.min(e-v,Math.floor(n.region.width*e))),x=Math.max(1,Math.min(r-y,Math.floor(n.region.height*r))),C=s.getImageData(v,y,E,x).data;let L=0,R=0;for(let W=0;W<C.length;W+=D$){const N=C[W]/Or,V=C[W+1]/Or,K=C[W+2]/Or,G=C[W+Sb]/Or;L+=G*(kb*N+Eb*V+xb*K),R+=1}return R>0?L/R:1}function V$(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<_b)return 1;const r=e[0]/Or,i=e[1]/Or,s=e[2]/Or;return kb*r+Eb*i+xb*s}function Dl(n){return n<0?0:n>1?1:n}const Z$=["ghost","glass"],Ho=[...Z$.map(n=>`[variant="${n}"]`),'[material="glass"]'].join(", "),Ml=new WeakSet,Um=new WeakSet;function $b(n){if(Um.has(n))return;Um.add(n);for(const e of n.querySelectorAll(Ho))vh(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)B$(i,vh);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(Ho)&&vh(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function B$(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(Ho)&&t(n);for(const e of n.querySelectorAll(Ho))t(e)}}async function vh(n){var e,r;if(Ml.has(n)||n.hasAttribute("tone")||(e=n.parentElement)!=null&&e.closest("[tone]"))return;Ml.add(n);const t=await Ab(n);if(!n.matches(Ho)){Ml.delete(n);return}if(n.hasAttribute("tone")||(r=n.parentElement)!=null&&r.closest("[tone]")){Ml.delete(n);return}n.setAttribute("tone",t)}const W$="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0}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-xs: 18px;--control-height-sm: 24px;--control-height-md: 28px;--control-height-lg: 32px;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-10: 10px;--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;--layer-chrome: 100;--layer-panel: 500;--layer-overlay: 2000;--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-150: 11%;--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-150: color-mix(in srgb, currentColor var(--alpha-150), 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-lg);padding:0 12px}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(--tint-150);backdrop-filter:saturate(1.2);-webkit-backdrop-filter:saturate(1.2)}button[variant=ghost]:active:not(:disabled){background:var(--tint-300);backdrop-filter:saturate(1.4);-webkit-backdrop-filter:saturate(1.4);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-pressed=true]:not(:disabled),button[variant=ghost][aria-pressed=true]: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);backdrop-filter:saturate(1.3);-webkit-backdrop-filter:saturate(1.3);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);box-shadow:none}button[variant=glass]{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}button[variant=glass]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover));backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}button[variant=glass]:active:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}button[variant=glass][aria-pressed=true]:not(:disabled),button[variant=glass][aria-pressed=true]:hover:not(:disabled),button[variant=glass][aria-expanded=true]:not(:disabled),button[variant=glass][aria-expanded=true]:hover:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active));backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}[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}button[variant=ghost]:disabled{background:transparent}: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[size=xs]{height:var(--control-height-xs);padding:0 var(--space-6) 1px;border-radius:var(--radius-8)}button[size=xs][icon-only]{width:var(--control-height-xs);padding:0}button[icon-only]{width:var(--control-height-md);padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}[selectable],[selectable] *{user-select:text;-webkit-user-select:text}[unselectable],[unselectable] *{user-select:none;-webkit-user-select:none}.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-100), transparent);--color-overlay-active: color-mix(in srgb, var(--white) var(--alpha-200), transparent);--color-bg-muted: color-mix(in srgb, var(--white) var(--alpha-100), transparent)}[tone=dark][material=paper]{background:var(--neutral-900)}[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-50), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-bg-muted: var(--neutral-100)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}action-row{display:flex;justify-content:flex-end;gap:var(--space-8);margin-top:var(--space-12)}copy-button{display:contents}copy-button button{position:relative}copy-button .copy-button-idle,copy-button .copy-button-done{display:inline-flex;align-items:center;gap:var(--space-6)}copy-button .copy-button-done{display:none}copy-button[copied] .copy-button-idle{visibility:hidden}copy-button[copied] .copy-button-done{display:flex;position:absolute;top:0;right:0;bottom:0;left:0;align-items:center;justify-content:center}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)}editable-text{display:inline-block;max-width:100%;vertical-align:top}editable-text>.editable-text-span{display:inline-block;max-width:100%;outline:none;overflow:hidden;white-space:nowrap;cursor:inherit;vertical-align:top}editable-text:not([data-editing])>.editable-text-span{text-overflow:ellipsis}editable-text[data-editing]>.editable-text-span{cursor:text}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:linear-gradient(to bottom,color-mix(in srgb,var(--black) var(--alpha-50),transparent),color-mix(in srgb,var(--black) var(--alpha-400),transparent));backdrop-filter:blur(1px);-webkit-backdrop-filter:blur(1px)}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(:first-child):not(:last-child){border-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([variant])[aria-pressed=true]:not(:disabled),segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>button:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>button:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}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:not(:first-child):not(:last-child)>[slot=trigger]{border-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>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-pressed=true]:not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-current]:not([aria-current=false]):not(:disabled),[tone] segmented-control>dropdown-menu>[slot=trigger]:not([variant])[aria-expanded=true]:not(:disabled){background:linear-gradient(var(--color-overlay-active),var(--color-overlay-active))}segmented-control[variant=glass]>button,segmented-control[variant=glass]>dropdown-menu{backdrop-filter:blur(20px) brightness(.95) saturate(1.5);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.5)}segmented-control[variant=glass]>button:not(:disabled):hover,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):hover){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled):active,segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled):active){backdrop-filter:blur(20px) brightness(.95) saturate(2.2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2.2)}segmented-control[variant=glass]>button:not(:disabled)[aria-pressed=true],segmented-control[variant=glass]>button:not(:disabled)[aria-current]:not([aria-current=false]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-pressed=true]),segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-current]:not([aria-current=false])){backdrop-filter:blur(20px) brightness(.95) saturate(1.8);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(1.8)}segmented-control[variant=glass]>button:not(:disabled)[aria-expanded=true],segmented-control[variant=glass]>dropdown-menu:has(>[slot=trigger]:not(:disabled)[aria-expanded=true]){backdrop-filter:blur(20px) brightness(.95) saturate(2);-webkit-backdrop-filter:blur(20px) brightness(.95) saturate(2)}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-spinner{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}ui-spinner .spin,.spin{display:inline-flex;animation:ui-spinner-spin 1s steps(8,end) infinite}@keyframes ui-spinner-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spin{animation:none}}system-modal[size=lg]{width:min(560px,100%)}system-modal{display:flex;flex-direction:column;width:min(400px,100%);box-sizing:border-box;padding:var(--space-32) var(--space-24);border-radius:var(--radius-12)}system-modal header{display:flex;flex-direction:column;align-items:center;gap:var(--space-16);text-align:center}system-modal header>hgroup{display:flex;flex-direction:column;align-items:center;gap:var(--space-4);max-width:100%}system-modal header h2{margin:0;font-size:var(--text-lg);font-weight:600;letter-spacing:.01em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}system-modal header p{margin:0;font-size:var(--text-base);opacity:.7;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}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)}',Qp=new CSSStyleSheet;Qp.replaceSync(W$);const ef=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,Qp,ef]}catch{}$b(document);function Cb(n){ef.replaceSync(n)}function _c(){Cb("")}function tf(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,Qp,ef]}catch{}$b(n)}const j$=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function G$(n){for(const t of Object.keys(n))if(j$.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function q$(n,t){G$(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function Fe(){class n extends Event{constructor(e,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(e,{bubbles:s,cancelable:o,composed:a}),q$(this,c)}}return n}class It extends globalThis.EventTarget{}function Y$(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function gl(n){var e;class t extends n{constructor(...s){super(...s);b(this,e,!1);Y$(this,()=>l(this,e),()=>{m(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const K$=Fe(),Fm=Fe(),J$=Fe(),So=Fe(),Ib=Fe(),Rb=Fe(),X$=Fe(),yh=Fe(),Je=4,vt=6,Vo=2,Qh=2,nf=8,Q$=vt,rf="auto",dr="auto",Yn=128,Hm=50,ce=16,yi=Yn*Je+ce*(Je-1),Zo=Yn*vt+ce*(vt-1),eC=yi+ce*2,tC=200,nC=4,zl=150,rC=10,Vm=2,Zm=8,iC=300,sC=4;function Pb(n){return Mb(n)}function Lb(n,t){return Mb(n.flatMap(e=>Ob(e,t)))}function Db(n){const t=[],e=new Set;for(const r of n){if(r.type==="row"){t.push(`Top-level rows are invalid: ${r.id}`);continue}Nb(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function Nr(n){const t=Pb(n),e=Db(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(cC)}}function Mb(n){const t=[];for(const e of n){const r=zb(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(Un));continue}t.push(i)}}return t}function zb(n){switch(n.type){case"card":return[Un(n)];case"row":{const t=n.children.map(Un);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=zb(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(ed));continue}if(i.type==="row"){t.push({...i,children:i.children.map(Un)});continue}t.push(Un(i))}}return t.length===0?[]:t.length===1?[ed(t[0])]:[{...n,children:t}]}}}function Ob(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[Un(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(Un);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>Ob(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[ed(e[0])]:[{...n,children:e}]}}}function Nb(n,t,e,r){switch(n.type){case"card":Ub(n,t,e,r);return;case"row":oC(n,t,e,r);return;case"stack":aC(n,t,e,r);return}}function Ub(n,t,e,r){"id"in n&&e.push(`Card ${uo(n)} must not include id`),typeof n.artifactID!="string"||n.artifactID.length===0?e.push("Card is missing artifactID"):r.has(n.artifactID)?e.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),lC(n.width)||e.push(`Card ${uo(n)} width must be an integer in the range ${Vo}-${nf}`),Hb(n.height)||e.push(`Card ${uo(n)} height must be an integer in the range 2-6 or "auto"`);const i=es(n.width);t==="stack"&&i!==Je&&e.push(`Stack child ${uo(n)} width must be ${Je}`),t==="row"&&i<Vo&&e.push(`Row child ${uo(n)} must be at least 2 columns wide`)}function uo(n){return typeof n.artifactID=="string"&&n.artifactID.length>0?n.artifactID:"<missing artifactID>"}function oC(n,t,e,r){if(Fb(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),Hb(n.height,sC)||e.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){e.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){e.push(`Row ${n.id} must contain only card nodes`);continue}Ub(s,"row",e,r),i+=es(s.width)}i!==Je&&e.push(`Row ${n.id} children must sum to 4 columns`)}function aC(n,t,e,r){if(Fb(n.id,e),t!=="strip"&&e.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){e.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"){e.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(Nb(a,"stack",e,r),a.height===dr){s+=1;continue}i+=a.height}if(i>vt&&e.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=vt-i;if(o<s*Qh||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Qh&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Fb(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function lC(n){return n===rf||Number.isInteger(n)&&n>=Vo&&n<=nf}function Hb(n,t=Q$){return n===dr||Number.isInteger(n)&&n>=Qh&&n<=t}function es(n){return n===rf?Je:n}function cC(n){if(n.type==="card")return{id:n.artifactID,type:"card",width:es(n.width),cards:[{id:n.artifactID,artifactID:n.artifactID,col:1,row:1,width:es(n.width),height:Vb(n.height,vt)}]};const t=uC(n.children),e=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=t[i];if(s.type==="card")e.push({id:s.artifactID,artifactID:s.artifactID,col:1,row:r,width:Je,height:o});else{let a=1;for(const c of s.children)e.push({id:c.artifactID,artifactID:c.artifactID,col:a,row:r,width:es(c.width),height:o}),a+=es(c.width)}r+=o}return{id:n.id,type:"stack",width:e.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:e}}function uC(n){let t=0,e=0;for(const i of n)i.height===dr?e+=1:t+=i.height;const r=e>0?(vt-t)/e:0;return n.map(i=>Vb(i.height,r))}function Vb(n,t){return n===dr?t:n}function Un(n){return{...n}}function ed(n){return n.type==="card"?Un(n):{...n,children:n.children.map(Un)}}const hC="X-Television-Client-Meta",dC="telemetry-activity",pC="telemetry-signal";function Zb(n,t={}){return{type:"card",artifactID:n,width:t.width??rf,height:t.height??dr}}function ec(n){return n.layout.flatMap(Bb)}function Bb(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(Bb)}}const ie=Fe(),td=Fe(),Hi=Fe(),Bm=Fe();function fC(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const sf=fC("RequestError"),gC=200,mC=300,Ol=401;class vC{constructor(t,e){g(this,"serverURL");g(this,"token");g(this,"onUnauthorized");g(this,"telemetryMeta");this.serverURL=t.replace(/\/$/,""),this.token=e.token,this.onUnauthorized=e.onUnauthorized,this.telemetryMeta=e.telemetryMeta}async requestJSON(t,e,r){var o;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await yC(i);if(!i.ok||i.status<gC||i.status>=mC)throw i.status===Ol&&((o=this.onUnauthorized)==null||o.call(this)),this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){var s;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0);if(!i.ok)throw i.status===Ol&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await bh(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===Ol&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await bh(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){var s;const i=await this.request(t,e,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw i.status===Ol&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await bh(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new sf(t,r)}async request(t,e,r,i){const s=`${this.serverURL}${e}`;try{return await fetch(s,{method:t,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(t){const e={...t??{}};return this.token&&(e.Authorization=`Bearer ${this.token}`),this.telemetryMeta&&(e[hC]=JSON.stringify(this.telemetryMeta)),Object.keys(e).length>0?e:void 0}}async function yC(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function bh(n,t){try{const e=await n.json();if(typeof e.error=="string")return e.error;if(typeof e.message=="string")return e.message}catch{}return t}function bC(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var en,zc,Wb;class wC{constructor(t){b(this,zc);b(this,en);m(this,en,t)}list(){return l(this,en).requestJSON("GET","/screens")}async get(t={}){const e=await d(this,zc,Wb).call(this,t.screenID);return l(this,en).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,en).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,en).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,en).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}en=new WeakMap,zc=new WeakSet,Wb=async function(t){if(t!==void 0)return t;const{screens:e}=await this.list();if(e.length===1)return e[0].id;throw l(this,en).createError(`screenID is required when multiple screens exist. Available screens: ${bC(e)}`)};var Cn;class SC{constructor(t){b(this,Cn);m(this,Cn,t)}create(t){const e={kind:t.kind,title:t.title};switch(t.kind){case"path":e.path=t.path;break;case"url":e.url=t.url;break}return e.screenID=t.screenID,l(this,Cn).requestJSON("POST","/artifacts",e)}list(t={}){const e=new URLSearchParams;t.screenID!==void 0&&e.set("screenID",t.screenID);const r=e.toString();return l(this,Cn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,Cn).requestJSON("GET",`/artifacts/${encodeURIComponent(t.artifactID)}`)}update(t){const e={};return t.title!==void 0&&(e.title=t.title),t.path!==void 0&&(e.path=t.path),t.url!==void 0&&(e.url=t.url),l(this,Cn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return l(this,Cn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}Cn=new WeakMap;var ls;class _C{constructor(t){b(this,ls);m(this,ls,t)}get(t){return l(this,ls).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return l(this,ls).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}ls=new WeakMap;var Zr;class kC{constructor(t){b(this,Zr);m(this,Zr,t)}status(){return l(this,Zr).requestJSON("GET","/telemetry")}enable(){return l(this,Zr).requestJSON("POST","/telemetry/enable")}disable(){return l(this,Zr).requestJSON("POST","/telemetry/disable")}}Zr=new WeakMap;var Br;class EC{constructor(t){b(this,Br);m(this,Br,t)}get(){return l(this,Br).requestJSON("GET","/display")}patch(t){const e={};return t.activeScreenID!==void 0&&(e.activeScreenID=t.activeScreenID),t.activeThemeName!==void 0&&(e.activeThemeName=t.activeThemeName),l(this,Br).requestVoid("PATCH","/display",e)}focus(t){return l(this,Br).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}Br=new WeakMap;var tn;class xC{constructor(t,e={}){g(this,"screens");g(this,"artifacts");g(this,"display");g(this,"markdown");g(this,"telemetry");b(this,tn);m(this,tn,new vC(t,e)),this.screens=new wC(l(this,tn)),this.artifacts=new SC(l(this,tn)),this.display=new EC(l(this,tn)),this.markdown=new _C(l(this,tn)),this.telemetry=new kC(l(this,tn))}health(){return l(this,tn).requestJSON("GET","/health")}}tn=new WeakMap;const AC={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},nd="0.0.0",TC=/^\d+\.\d+\.\d+$/,$C=3;function of(n){return TC.test(n)}function jb(n,t){const e=n.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<$C;i++)if(e[i]!==r[i])return e[i]>r[i];return!1}function CC(n,t){return n===nd||t===nd?!1:n!==t}const IC="Local",RC="store-";function ee(n){return new URL(n).origin}function PC(n){return{servers:[{url:ee(n),name:IC}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{},authTokens:{},promotedOnboardingScreens:{}}}function LC(n,t){return[...n.promotedOnboardingScreens[ee(t)]??[]]}function DC(n,t,e){const r=ee(t),i=n.promotedOnboardingScreens[r]??[];return i.includes(e)?n:{...n,promotedOnboardingScreens:{...n.promotedOnboardingScreens,[r]:[...i,e]}}}function MC(n,t){return[...n.tabs[ee(t)]??[]]}function Wm(n,t,e){const r=ee(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function zC(n,t,e){const r=ee(t),i=n.tabs[r]??[],s=i.filter(a=>a!==e);if(s.length===i.length)return n;const o={...n.tabs};return s.length===0?delete o[r]:o[r]=s,{...n,tabs:o}}function OC(n,t,e=Date.now()){const r=n.screens[t]??{scrollPosition:0};return{...n,screens:{...n.screens,[t]:{...r,lastActivatedAt:e}}}}var Wr,jr,Gr;class NC extends It{constructor(e,r,i={}){super();b(this,Wr);b(this,jr);b(this,Gr);m(this,Wr,`${RC}${e}`),m(this,jr,i.storage??HC());const s=l(this,jr).getItem(l(this,Wr));s===null?(m(this,Gr,r),l(this,jr).setItem(l(this,Wr),JSON.stringify(r))):m(this,Gr,VC(JSON.parse(s),r))}get(){return l(this,Gr)}set(e){m(this,Gr,e),l(this,jr).setItem(l(this,Wr),JSON.stringify(e)),this.dispatchEvent(new ie("change"))}}Wr=new WeakMap,jr=new WeakMap,Gr=new WeakMap;function wh(n,t){return n.authTokens[ee(t)]??null}function UC(n,t,e){return{...n,authTokens:{...n.authTokens,[ee(t)]:e}}}function FC(n,t){const e=ee(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{...n,authTokens:r}}function HC(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function VC(n,t){return{servers:Array.isArray(n.servers)?n.servers:t.servers,activeServerURL:typeof n.activeServerURL=="string"||n.activeServerURL===null?n.activeServerURL:t.activeServerURL,activeScreenID:typeof n.activeScreenID=="string"||n.activeScreenID===null?n.activeScreenID:t.activeScreenID,tabs:n.tabs&&typeof n.tabs=="object"?n.tabs:t.tabs,screens:n.screens&&typeof n.screens=="object"?n.screens:t.screens,authTokens:n.authTokens&&typeof n.authTokens=="object"?n.authTokens:t.authTokens,promotedOnboardingScreens:n.promotedOnboardingScreens&&typeof n.promotedOnboardingScreens=="object"?n.promotedOnboardingScreens:{}}}class ZC extends Event{constructor(){super("theme-changed")}}const BC=gl(It);var qr,Be,Jn,Ye,Xn,In,Ko,ne,Ir,Gb,Jo,qb,Yb,Kb,Jb,rd,id,sd,Xb;class WC extends BC{constructor(e){var i;super();b(this,ne);g(this,"id");g(this,"server");b(this,qr);b(this,Be,new Map);b(this,Jn);b(this,Ye);b(this,Xn);b(this,In,null);b(this,Ko,0);b(this,Jo,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&d(this,ne,qb).call(this,r.screen);break;case"artifact-created":r.screenID===this.id&&d(this,ne,Yb).call(this,r.artifact);break;case"artifact-updated":d(this,ne,Kb).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&d(this,ne,Jb).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new Bm("artifact-content-changed",{artifactID:r.artifactID}));break;case"theme-changed":this.dispatchEvent(new ZC);break}});this.id=e.screen.id,this.server=e.server,m(this,qr,e.localStore),m(this,Jn,e.screen.name),m(this,Ye,structuredClone(e.screen.layout));const r=((i=l(this,qr).get().screens[this.id])==null?void 0:i.scrollPosition)??0;m(this,Xn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,Jo)),d(this,ne,Gb).call(this)}get name(){return l(this,Jn)}get layout(){return l(this,Ye)}get scrollPosition(){return l(this,Xn)}get artifacts(){return l(this,Be)}setScrollPosition(e){d(this,ne,Ir).call(this);const r=Math.max(0,e);r!==l(this,Xn)&&(m(this,Xn,r),d(this,ne,Xb).call(this),this.dispatchEvent(new ie("change")))}setLayout(e){d(this,ne,Ir).call(this);const r=Pb(e);if(!Db(r).valid)return;const s=d(this,ne,id).call(this);m(this,Ye,r),m(this,In,{layout:r,snapshot:s}),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,In))==null?void 0:o.layout)===r&&(m(this,In,null),d(this,ne,sd).call(this,s),this.dispatchEvent(new ie("change")))})}rename(e){d(this,ne,Ir).call(this),m(this,Jn,e),this.dispatchEvent(new ie("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){d(this,ne,Ir).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(d(this,ne,Ir).call(this),!l(this,Be).has(e))return;const r=d(this,ne,id).call(this);d(this,ne,rd).call(this,e),this.dispatchEvent(new ie("change")),this.server.client.artifacts.delete({artifactID:e}).catch(()=>{this.disposed||(d(this,ne,sd).call(this,r),this.dispatchEvent(new ie("change")))})}async refreshFromServer(){d(this,ne,Ir).call(this);const e=++Bu(this,Ko)._;let r;try{r=await this.server.client.screens.get({screenID:this.id})}catch{return}if(this.disposed||e!==l(this,Ko))return;const i=new Set([...l(this,Be).values()].filter(s=>s.kind==="path").map(s=>s.id));m(this,In,null),m(this,Jn,r.screen.name),m(this,Ye,structuredClone(r.screen.layout)),l(this,Be).clear();for(const s of r.artifacts)l(this,Be).set(s.id,s);this.dispatchEvent(new ie("change"));for(const s of r.artifacts)s.kind==="path"&&i.has(s.id)&&this.dispatchEvent(new Bm("artifact-content-changed",{artifactID:s.id}))}dispose(){this.server.removeEventListener("server-event",l(this,Jo))}}qr=new WeakMap,Be=new WeakMap,Jn=new WeakMap,Ye=new WeakMap,Xn=new WeakMap,In=new WeakMap,Ko=new WeakMap,ne=new WeakSet,Ir=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},Gb=async function(){try{const e=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of e.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new ie("change"))}catch{}},Jo=new WeakMap,qb=function(e){l(this,In)&&m(this,In,null),m(this,Jn,e.name),m(this,Ye,structuredClone(e.layout)),this.dispatchEvent(new ie("change"))},Yb=function(e){ec({layout:l(this,Ye)}).includes(e.id)||m(this,Ye,[...l(this,Ye),Zb(e.id)]),l(this,Be).set(e.id,e),this.dispatchEvent(new ie("change"))},Kb=function(e){const r=l(this,Be).get(e.id);r&&(l(this,Be).set(e.id,{...r,...e}),this.dispatchEvent(new ie("change")))},Jb=function(e){d(this,ne,rd).call(this,e)&&this.dispatchEvent(new ie("change"))},rd=function(e){const r=l(this,Be).delete(e),i=ec({layout:l(this,Ye)}).length,s=Lb(l(this,Ye),e),o=ec({layout:s}).length;return m(this,Ye,s),r||i!==o},id=function(){return{layout:structuredClone(l(this,Ye)),artifacts:new Map([...l(this,Be).entries()].map(([e,r])=>[e,structuredClone(r)]))}},sd=function(e){m(this,Ye,structuredClone(e.layout)),l(this,Be).clear();for(const[r,i]of e.artifacts)l(this,Be).set(r,structuredClone(i))},Xb=function(){const e=l(this,qr).get();l(this,qr).set({...e,screens:{...e.screens,[this.id]:{...e.screens[this.id],scrollPosition:l(this,Xn)}}})};const jC=gl(It);var Ee,xe,Dt,Xo,Qo,ea,ta,na,De,tc,nc,od,Wi;class GC extends jC{constructor(e){super();b(this,De);b(this,Ee);b(this,xe);b(this,Dt,null);b(this,Xo,()=>{this.disposed||d(this,De,tc).call(this)});b(this,Qo,()=>{this.disposed||(d(this,De,tc).call(this),d(this,De,nc).call(this))});b(this,ea,()=>{this.disposed||d(this,De,nc).call(this)});b(this,ta,e=>{if(this.disposed)return;const r=e.event;if(r.type==="screen-removed"){this.removeTab(e.serverURL,r.screenID);const i=l(this,Ee).get();i.activeServerURL===ee(e.serverURL)&&i.activeScreenID===r.screenID&&d(this,De,Wi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){d(this,De,Wi).call(this,e.serverURL,null);return}const i=l(this,xe).servers.get(ee(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),d(this,De,Wi).call(this,e.serverURL,r.screenID)}});b(this,na,e=>{if(this.disposed)return;const r=l(this,Dt);r&&ee(e.serverURL)===ee(r.server.url)&&r.refreshFromServer()});m(this,Ee,e.localStore),m(this,xe,e.serverManager),l(this,Ee).addEventListener("change",l(this,Xo)),l(this,xe).addEventListener("change",l(this,Qo)),l(this,xe).addEventListener("screens-changed",l(this,ea)),l(this,xe).addEventListener("server-event",l(this,ta)),l(this,xe).addEventListener("server-reconnected",l(this,na)),d(this,De,tc).call(this),d(this,De,nc).call(this)}get activeScreen(){return l(this,Dt)}get screens(){const e=l(this,Ee).get().screens,r=[];let i=0;for(const s of l(this,xe).servers.values())for(const o of s.screens.values())r.push({server:s,screen:o,local:e[o.id]??{scrollPosition:0},index:i}),i+=1;return r.sort((s,o)=>{const a=(o.local.lastActivatedAt??0)-(s.local.lastActivatedAt??0);return a===0?s.index-o.index:a}).map(({index:s,...o})=>o)}getTabs(e){const r=ee(e),i=MC(l(this,Ee).get(),r),s=l(this,xe).servers.get(r);return s?i.filter(o=>s.screens.has(o)):i}hasTab(e,r){return this.getTabs(e).includes(r)}addTab(e,r){const i=ee(e),s=l(this,xe).servers.get(i);s&&!s.screens.has(r)||d(this,De,od).call(this,Wm(l(this,Ee).get(),i,r))}removeTab(e,r){d(this,De,od).call(this,zC(l(this,Ee).get(),e,r))}setActive(e,r){const i=ee(e),s=l(this,xe).servers.get(i);!s||!s.screens.has(r)||d(this,De,Wi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Ee).get().activeServerURL;if(!e||!d(this,De,Wi).call(this,e,null))return;const r=l(this,xe).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Ee).removeEventListener("change",l(this,Xo)),l(this,xe).removeEventListener("change",l(this,Qo)),l(this,xe).removeEventListener("screens-changed",l(this,ea)),l(this,xe).removeEventListener("server-event",l(this,ta)),l(this,xe).removeEventListener("server-reconnected",l(this,na)),(e=l(this,Dt))==null||e.dispose(),m(this,Dt,null)}}Ee=new WeakMap,xe=new WeakMap,Dt=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,ea=new WeakMap,ta=new WeakMap,na=new WeakMap,De=new WeakSet,tc=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Ee).get(),i=e?l(this,xe).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,Dt))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,Dt))==null?void 0:u.server)===i||((h=l(this,Dt))==null||h.dispose(),m(this,Dt,i&&s?new WC({screen:s,server:i,localStore:l(this,Ee)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new K$("active-screen-changed")))},nc=function(){const e=l(this,Ee).get();let r=e;for(const[i,s]of l(this,xe).servers){const o=[...s.screens.values()].filter(c=>c.onboarding!==void 0).sort((c,u)=>c.onboarding.order-u.onboarding.order);if(o.length===0)continue;const a=new Set(LC(r,i));for(const c of o)a.has(c.onboarding.slug)||(r=DC(Wm(r,i,c.id),i,c.onboarding.slug))}r!==e&&(l(this,Ee).set(r),this.dispatchEvent(new Fm("tabs-changed")))},od=function(e){e!==l(this,Ee).get()&&(l(this,Ee).set(e),this.dispatchEvent(new Fm("tabs-changed")))},Wi=function(e,r){const i=ee(e),s=l(this,Ee).get();if(s.activeServerURL===i&&s.activeScreenID===r)return!1;const o=r===null?{...s,activeServerURL:i,activeScreenID:r}:OC({...s,activeServerURL:i,activeScreenID:r},r);return l(this,Ee).set(o),!0};const Qb="0123456789ABCDEFGHJKMNPQRSTVWXYZ",kc=32,qC=16,e0=10,jm=0xffffffffffff;var Ur;(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"})(Ur||(Ur={}));class _o extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function YC(n){const t=Math.floor(n()*kc)%kc;return Qb.charAt(t)}function KC(n){const t=JC(),e=t&&(t.crypto||t.msCrypto)||null;if(typeof(e==null?void 0:e.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]/256};if(typeof(e==null?void 0:e.randomBytes)=="function")return()=>e.randomBytes(1).readUInt8()/256;throw new _o(Ur.PRNGDetectFailure,"Failed to find a reliable PRNG")}function JC(){return eI()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function XC(n,t){let e="";for(;n>0;n--)e=YC(t)+e;return e}function QC(n,t=e0){if(isNaN(n))throw new _o(Ur.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>jm)throw new _o(Ur.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${jm}: ${n}`);if(n<0)throw new _o(Ur.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new _o(Ur.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%kc,r=Qb.charAt(e)+r,n=(n-e)/kc;return r}function eI(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function fu(n,t){const e=KC(),r=Date.now();return QC(r,e0)+XC(qC,e)}function A(n,t,e){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),t(a,c);const u=o.prototype,h=Object.keys(u);for(let f=0;f<h.length;f++){const v=h[f];v in a||(a[v]=u[v].bind(a))}}const i=(e==null?void 0:e.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=e!=null&&e.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 e!=null&&e.Parent&&a instanceof e.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 ss extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class t0 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const n0={};function pr(n){return n0}function r0(n){const t=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function ad(n,t){return typeof t=="bigint"?t.toString():t}function gu(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function af(n){return n==null}function lf(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function tI(n,t){const e=(n.toString().split(".")[1]||"").length,r=t.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=e>i?e:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return o%a/10**s}const Gm=Symbol("evaluating");function re(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==Gm)return r===void 0&&(r=Gm,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Ci(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function wr(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function qm(n){return JSON.stringify(n)}function nI(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const i0="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Bo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const rI=gu(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Hs(n){if(Bo(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(Bo(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function s0(n){return Hs(n)?{...n}:Array.isArray(n)?[...n]:n}const iI=new Set(["string","number","symbol"]);function Vs(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sr(n,t,e){const r=new n._zod.constr(t??n._zod.def);return(!t||e!=null&&e.parent)&&(r._zod.parent=n),r}function z(n){const t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function sI(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const oI={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 aI(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=wr(n._zod.def,{get shape(){const o={};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=e.shape[a])}return Ci(this,"shape",o),o},checks:[]});return Sr(n,s)}function lI(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=wr(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in t){if(!(a in e.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return Ci(this,"shape",o),o},checks:[]});return Sr(n,s)}function cI(n,t){if(!Hs(t))throw new Error("Invalid input to extend: expected a plain object");const e=n._zod.def.checks;if(e&&e.length>0){const s=n._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=wr(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Ci(this,"shape",s),s}});return Sr(n,i)}function uI(n,t){if(!Hs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=wr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Ci(this,"shape",r),r}});return Sr(n,e)}function hI(n,t){const e=wr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Ci(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Sr(n,e)}function dI(n,t,e){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=wr(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(e)for(const u in e){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);e[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 Ci(this,"shape",c),c},checks:[]});return Sr(t,o)}function pI(n,t,e){const r=wr(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(e)for(const o in e){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);e[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 Ci(this,"shape",s),s}});return Sr(t,r)}function ts(n,t=0){var e;if(n.aborted===!0)return!0;for(let r=t;r<n.issues.length;r++)if(((e=n.issues[r])==null?void 0:e.continue)!==!0)return!0;return!1}function ns(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Nl(n){return typeof n=="string"?n:n==null?void 0:n.message}function fr(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Nl((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Nl((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??Nl((c=e.customError)==null?void 0:c.call(e,n))??Nl((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function cf(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Wo(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const o0=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),n.message=JSON.stringify(t,ad,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},a0=A("$ZodError",o0),l0=A("$ZodError",o0,{Parent:Error});function fI(n,t=e=>e.message){const e={},r=[];for(const i of n.issues)i.path.length>0?(e[i.path[0]]=e[i.path[0]]||[],e[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:e}}function gI(n,t=e=>e.message){const e={_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)e._errors.push(t(s));else{let o=e,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(t(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),e}const uf=n=>(t,e,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:e,issues:[]},s);if(o instanceof Promise)throw new ss;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>fr(c,s,pr())));throw i0(a,i==null?void 0:i.callee),a}return o.value},hf=n=>async(t,e,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:e,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=>fr(c,s,pr())));throw i0(a,i==null?void 0:i.callee),a}return o.value},mu=n=>(t,e,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:e,issues:[]},i);if(s instanceof Promise)throw new ss;return s.issues.length?{success:!1,error:new(n??a0)(s.issues.map(o=>fr(o,i,pr())))}:{success:!0,data:s.value}},mI=mu(l0),vu=n=>async(t,e,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:e,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>fr(o,i,pr())))}:{success:!0,data:s.value}},vI=vu(l0),yI=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return uf(n)(t,e,i)},bI=n=>(t,e,r)=>uf(n)(t,e,r),wI=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return hf(n)(t,e,i)},SI=n=>async(t,e,r)=>hf(n)(t,e,r),_I=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return mu(n)(t,e,i)},kI=n=>(t,e,r)=>mu(n)(t,e,r),EI=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vu(n)(t,e,i)},xI=n=>async(t,e,r)=>vu(n)(t,e,r),AI=/^[cC][^\s-]{8,}$/,TI=/^[0-9a-z]+$/,$I=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,CI=/^[0-9a-vA-V]{20}$/,II=/^[A-Za-z0-9]{27}$/,RI=/^[a-zA-Z0-9_-]{21}$/,PI=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,LI=/^([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})$/,Ym=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)$/,DI=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,MI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function zI(){return new RegExp(MI,"u")}const OI=/^(?:(?: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])$/,NI=/^(([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}|:))$/,UI=/^((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])$/,FI=/^(([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])$/,HI=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,c0=/^[A-Za-z0-9_-]*$/,VI=/^\+[1-9]\d{6,14}$/,u0="(?:(?:\\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])))",ZI=new RegExp(`^${u0}$`);function h0(n){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function BI(n){return new RegExp(`^${h0(n)}$`)}function WI(n){const t=h0({precision:n.precision}),e=["Z"];n.local&&e.push(""),n.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${e.join("|")})`;return new RegExp(`^${u0}T(?:${r})$`)}const jI=n=>{const t=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},GI=/^-?\d+$/,d0=/^-?\d+(?:\.\d+)?$/,qI=/^(?:true|false)$/i,YI=/^[^A-Z]*$/,KI=/^[^a-z]*$/,ht=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),p0={number:"number",bigint:"bigint",object:"date"},f0=A("$ZodCheckLessThan",(n,t)=>{ht.init(n,t);const e=p0[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:e,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),g0=A("$ZodCheckGreaterThan",(n,t)=>{ht.init(n,t);const e=p0[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:e,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),JI=A("$ZodCheckMultipleOf",(n,t)=>{ht.init(n,t),n._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),n._zod.check=e=>{if(typeof e.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof e.value=="bigint"?e.value%t.value===BigInt(0):tI(e.value,t.value)===0)||e.issues.push({origin:typeof e.value,code:"not_multiple_of",divisor:t.value,input:e.value,inst:n,continue:!t.abort})}}),XI=A("$ZodCheckNumberFormat",(n,t)=>{var o;ht.init(n,t),t.format=t.format||"float64";const e=(o=t.format)==null?void 0:o.includes("int"),r=e?"int":"number",[i,s]=oI[t.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,e&&(c.pattern=GI)}),n._zod.check=a=>{const c=a.value;if(e){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.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:!t.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:!t.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!t.abort})}}),QI=A("$ZodCheckMaxLength",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!af(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const o=cf(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),eR=A("$ZodCheckMinLength",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!af(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const o=cf(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),tR=A("$ZodCheckLengthEquals",(n,t)=>{var e;ht.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!af(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===t.length)return;const o=cf(i),a=s>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!t.abort})}}),yu=A("$ZodCheckStringFormat",(n,t)=>{var e,r;ht.init(n,t),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(e=n._zod).check??(e.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(r=n._zod).check??(r.check=()=>{})}),nR=A("$ZodCheckRegex",(n,t)=>{yu.init(n,t),n._zod.check=e=>{t.pattern.lastIndex=0,!t.pattern.test(e.value)&&e.issues.push({origin:"string",code:"invalid_format",format:"regex",input:e.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),rR=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=YI),yu.init(n,t)}),iR=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=KI),yu.init(n,t)}),sR=A("$ZodCheckIncludes",(n,t)=>{ht.init(n,t);const e=Vs(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${e}`:e);t.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(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),oR=A("$ZodCheckStartsWith",(n,t)=>{ht.init(n,t);const e=new RegExp(`^${Vs(t.prefix)}.*`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:n,continue:!t.abort})}}),aR=A("$ZodCheckEndsWith",(n,t)=>{ht.init(n,t);const e=new RegExp(`.*${Vs(t.suffix)}$`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:n,continue:!t.abort})}}),lR=A("$ZodCheckOverwrite",(n,t)=>{ht.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class cR{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.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 t=Function,e=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...e,i.join(`
6
- `))}}const dR={major:4,minor:3,patch:6},ye=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=dR;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)(e=n._zod).deferred??(e.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,c,u)=>{let h=ts(a),f;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const y=a.issues.length,E=v._zod.check(a);if(E instanceof Promise&&(u==null?void 0:u.async)===!1)throw new ss;if(f||E instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await E,a.issues.length!==y&&(h||(h=ts(a,y)))});else{if(a.issues.length===y)continue;h||(h=ts(a,y))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if(ts(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new ss;return h.then(f=>n._zod.parse(f,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(f=>o(f,a,c)):o(h,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ss;return u.then(h=>s(h,r,c))}return s(u,r,c)}}re(n,"~standard",()=>({validate:s=>{var o;try{const a=yI(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return bI(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}))}),pf=A("$ZodString",(n,t)=>{var e;ye.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??qI(n._zod.bag),n._zod.parse=(r,i)=>{if(t.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}}),me=A("$ZodStringFormat",(n,t)=>{yu.init(n,t),pf.init(n,t)}),pR=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=MI),me.init(n,t)}),fR=A("$ZodUUID",(n,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Jm(r))}else t.pattern??(t.pattern=Jm());me.init(n,t)}),gR=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=zI),me.init(n,t)}),mR=A("$ZodURL",(n,t)=>{me.init(n,t),n._zod.check=e=>{try{const r=e.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:e.value,inst:n,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:e.value,inst:n,continue:!t.abort})),t.normalize?e.value=i.href:e.value=r;return}catch{e.issues.push({code:"invalid_format",format:"url",input:e.value,inst:n,continue:!t.abort})}}}),vR=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=NI()),me.init(n,t)}),yR=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=LI),me.init(n,t)}),bR=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=$I),me.init(n,t)}),wR=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=CI),me.init(n,t)}),SR=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=II),me.init(n,t)}),_R=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=RI),me.init(n,t)}),kR=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=PI),me.init(n,t)}),ER=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=GI(t)),me.init(n,t)}),xR=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=WI),me.init(n,t)}),AR=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=jI(t)),me.init(n,t)}),TR=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=DI),me.init(n,t)}),$R=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=UI),me.init(n,t),n._zod.bag.format="ipv4"}),CR=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=FI),me.init(n,t),n._zod.bag.format="ipv6",n._zod.check=e=>{try{new URL(`http://[${e.value}]`)}catch{e.issues.push({code:"invalid_format",format:"ipv6",input:e.value,inst:n,continue:!t.abort})}}}),IR=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=HI),me.init(n,t)}),RR=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=VI),me.init(n,t),n._zod.check=e=>{const r=e.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{e.issues.push({code:"invalid_format",format:"cidrv6",input:e.value,inst:n,continue:!t.abort})}}});function y0(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const PR=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=ZI),me.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{y0(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function LR(n){if(!h0.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return y0(e)}const DR=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=h0),me.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{LR(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),MR=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=BI),me.init(n,t)});function zR(n,t=null){try{const e=n.split(".");if(e.length!==3)return!1;const[r]=e;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const OR=A("$ZodJWT",(n,t)=>{me.init(n,t),n._zod.check=e=>{zR(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),b0=A("$ZodNumber",(n,t)=>{ye.init(n,t),n._zod.pattern=n._zod.bag.pattern??f0,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=Number(e.value)}catch{}const i=e.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return e;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return e.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),e}}),NR=A("$ZodNumberFormat",(n,t)=>{eR.init(n,t),b0.init(n,t)}),UR=A("$ZodBoolean",(n,t)=>{ye.init(n,t),n._zod.pattern=KI,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=!!e.value}catch{}const i=e.value;return typeof i=="boolean"||e.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),e}}),FR=A("$ZodUnknown",(n,t)=>{ye.init(n,t),n._zod.parse=e=>e}),HR=A("$ZodNever",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function Xm(n,t,e){n.issues.length&&t.issues.push(...ns(e,n.issues)),t.value[e]=n.value}const VR=A("$ZodArray",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Array.isArray(i))return e.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),e;e.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Xm(u,e,o))):Xm(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function Ec(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...ns(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function w0(n){var r,i,s,o;const t=Object.keys(n.shape);for(const a of t)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 e=aI(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function S0(n,t,e,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const f in t){if(a.has(f))continue;if(u==="never"){o.push(f);continue}const v=c.run({value:t[f],issues:[]},r);v instanceof Promise?n.push(v.then(y=>Ec(y,e,f,t,h))):Ec(v,e,f,t,h)}return o.length&&e.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const ZR=A("$ZodObject",(n,t)=>{ye.init(n,t);const e=Object.getOwnPropertyDescriptor(t,"shape");if(!(e!=null&&e.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=gu(()=>w0(t));re(n._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const h=a[u]._zod;if(h.values){c[u]??(c[u]=new Set);for(const f of h.values)c[u].add(f)}}return c});const i=Bo,s=t.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=[],f=o.shape;for(const v of o.keys){const y=f[v],E=y._zod.optout==="optional",x=y._zod.run({value:u[v],issues:[]},c);x instanceof Promise?h.push(x.then(C=>Ec(C,a,v,u,E))):Ec(x,a,v,u,E)}return s?S0(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),BR=A("$ZodObjectJIT",(n,t)=>{ZR.init(n,t);const e=n._zod.parse,r=gu(()=>w0(t)),i=v=>{var W;const y=new hR(["shape","payload","ctx"]),E=r.value,x=N=>{const V=Km(N);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};y.write("const input = payload.value;");const C=Object.create(null);let L=0;for(const N of E.keys)C[N]=`key_${L++}`;y.write("const newResult = {};");for(const N of E.keys){const V=C[N],K=Km(N),G=v[N],he=((W=G==null?void 0:G._zod)==null?void 0:W.optout)==="optional";y.write(`const ${V} = ${x(N)};`),he?y.write(`
6
+ `))}}const uR={major:4,minor:3,patch:6},ye=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=uR;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)(e=n._zod).deferred??(e.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,c,u)=>{let h=ts(a),f;for(const v of c){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(h)continue;const y=a.issues.length,E=v._zod.check(a);if(E instanceof Promise&&(u==null?void 0:u.async)===!1)throw new ss;if(f||E instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await E,a.issues.length!==y&&(h||(h=ts(a,y)))});else{if(a.issues.length===y)continue;h||(h=ts(a,y))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if(ts(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new ss;return h.then(f=>n._zod.parse(f,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(f=>o(f,a,c)):o(h,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ss;return u.then(h=>s(h,r,c))}return s(u,r,c)}}re(n,"~standard",()=>({validate:s=>{var o;try{const a=mI(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return vI(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}))}),df=A("$ZodString",(n,t)=>{var e;ye.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??jI(n._zod.bag),n._zod.parse=(r,i)=>{if(t.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}}),me=A("$ZodStringFormat",(n,t)=>{yu.init(n,t),df.init(n,t)}),hR=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=LI),me.init(n,t)}),dR=A("$ZodUUID",(n,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ym(r))}else t.pattern??(t.pattern=Ym());me.init(n,t)}),pR=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=DI),me.init(n,t)}),fR=A("$ZodURL",(n,t)=>{me.init(n,t),n._zod.check=e=>{try{const r=e.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:e.value,inst:n,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:e.value,inst:n,continue:!t.abort})),t.normalize?e.value=i.href:e.value=r;return}catch{e.issues.push({code:"invalid_format",format:"url",input:e.value,inst:n,continue:!t.abort})}}}),gR=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=zI()),me.init(n,t)}),mR=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=RI),me.init(n,t)}),vR=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=AI),me.init(n,t)}),yR=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=TI),me.init(n,t)}),bR=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=$I),me.init(n,t)}),wR=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=CI),me.init(n,t)}),SR=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=II),me.init(n,t)}),_R=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=WI(t)),me.init(n,t)}),kR=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=ZI),me.init(n,t)}),ER=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=BI(t)),me.init(n,t)}),xR=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=PI),me.init(n,t)}),AR=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=OI),me.init(n,t),n._zod.bag.format="ipv4"}),TR=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=NI),me.init(n,t),n._zod.bag.format="ipv6",n._zod.check=e=>{try{new URL(`http://[${e.value}]`)}catch{e.issues.push({code:"invalid_format",format:"ipv6",input:e.value,inst:n,continue:!t.abort})}}}),$R=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=UI),me.init(n,t)}),CR=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=FI),me.init(n,t),n._zod.check=e=>{const r=e.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{e.issues.push({code:"invalid_format",format:"cidrv6",input:e.value,inst:n,continue:!t.abort})}}});function m0(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const IR=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=HI),me.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{m0(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function RR(n){if(!c0.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return m0(e)}const PR=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=c0),me.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{RR(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),LR=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=VI),me.init(n,t)});function DR(n,t=null){try{const e=n.split(".");if(e.length!==3)return!1;const[r]=e;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const MR=A("$ZodJWT",(n,t)=>{me.init(n,t),n._zod.check=e=>{DR(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),v0=A("$ZodNumber",(n,t)=>{ye.init(n,t),n._zod.pattern=n._zod.bag.pattern??d0,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=Number(e.value)}catch{}const i=e.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return e;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return e.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),e}}),zR=A("$ZodNumberFormat",(n,t)=>{XI.init(n,t),v0.init(n,t)}),OR=A("$ZodBoolean",(n,t)=>{ye.init(n,t),n._zod.pattern=qI,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=!!e.value}catch{}const i=e.value;return typeof i=="boolean"||e.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),e}}),NR=A("$ZodUnknown",(n,t)=>{ye.init(n,t),n._zod.parse=e=>e}),UR=A("$ZodNever",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function Km(n,t,e){n.issues.length&&t.issues.push(...ns(e,n.issues)),t.value[e]=n.value}const FR=A("$ZodArray",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Array.isArray(i))return e.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),e;e.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Km(u,e,o))):Km(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function Ec(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...ns(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function y0(n){var r,i,s,o;const t=Object.keys(n.shape);for(const a of t)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 e=sI(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function b0(n,t,e,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,h=c.optout==="optional";for(const f in t){if(a.has(f))continue;if(u==="never"){o.push(f);continue}const v=c.run({value:t[f],issues:[]},r);v instanceof Promise?n.push(v.then(y=>Ec(y,e,f,t,h))):Ec(v,e,f,t,h)}return o.length&&e.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const HR=A("$ZodObject",(n,t)=>{ye.init(n,t);const e=Object.getOwnPropertyDescriptor(t,"shape");if(!(e!=null&&e.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=gu(()=>y0(t));re(n._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const h=a[u]._zod;if(h.values){c[u]??(c[u]=new Set);for(const f of h.values)c[u].add(f)}}return c});const i=Bo,s=t.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=[],f=o.shape;for(const v of o.keys){const y=f[v],E=y._zod.optout==="optional",x=y._zod.run({value:u[v],issues:[]},c);x instanceof Promise?h.push(x.then(C=>Ec(C,a,v,u,E))):Ec(x,a,v,u,E)}return s?b0(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),VR=A("$ZodObjectJIT",(n,t)=>{HR.init(n,t);const e=n._zod.parse,r=gu(()=>y0(t)),i=v=>{var W;const y=new cR(["shape","payload","ctx"]),E=r.value,x=N=>{const V=qm(N);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};y.write("const input = payload.value;");const C=Object.create(null);let L=0;for(const N of E.keys)C[N]=`key_${L++}`;y.write("const newResult = {};");for(const N of E.keys){const V=C[N],K=qm(N),G=v[N],he=((W=G==null?void 0:G._zod)==null?void 0:W.optout)==="optional";y.write(`const ${V} = ${x(N)};`),he?y.write(`
7
7
  if (${V}.issues.length) {
8
8
  if (${K} in input) {
9
9
  payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
@@ -37,10 +37,10 @@ var ek=Object.defineProperty;var og=n=>{throw TypeError(n)};var tk=(n,t,e)=>t in
37
37
  newResult[${K}] = ${V}.value;
38
38
  }
39
39
 
40
- `)}y.write("payload.value = newResult;"),y.write("return payload;");const R=y.compile();return(N,V)=>R(v,N,V)};let s;const o=Bo,a=!i0.jitless,u=a&&sI.value,h=t.catchall;let f;n._zod.parse=(v,y)=>{f??(f=r.value);const E=v.value;return o(E)?a&&u&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(s||(s=i(t.shape)),v=s(v,y),h?S0([],E,v,y,f,n):v):e(v,y):(v.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),v)}});function Qm(n,t,e,r){for(const s of n)if(s.issues.length===0)return t.value=s.value,t;const i=n.filter(s=>!ts(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:e,errors:n.map(s=>s.issues.map(o=>fr(o,r,pr())))}),t)}const _0=A("$ZodUnion",(n,t)=>{ye.init(n,t),re(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),re(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),re(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),re(n._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>cf(s.source)).join("|")})$`)}});const e=t.options.length===1,r=t.options[0]._zod.run;n._zod.parse=(i,s)=>{if(e)return r(i,s);let o=!1;const a=[];for(const c of t.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=>Qm(c,i,n,s)):Qm(a,i,n,s)}}),WR=A("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,_0.init(n,t);const e=n._zod.parse;re(n._zod,"propValues",()=>{const i={};for(const s of t.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(o)){i[a]||(i[a]=new Set);for(const u of c)i[a].add(u)}}return i});const r=gu(()=>{var o;const i=t.options,s=new Map;for(const a of i){const c=(o=a._zod.propValues)==null?void 0:o[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});n._zod.parse=(i,s)=>{const o=i.value;if(!Bo(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:n}),i;const a=r.value.get(o==null?void 0:o[t.discriminator]);return a?a._zod.run(i,s):t.unionFallback?e(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:o,path:[t.discriminator],inst:n}),i)}}),jR=A("$ZodIntersection",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>ev(e,c,u)):ev(e,s,o)}});function cd(n,t){if(n===t)return{valid:!0,data:n};if(n instanceof Date&&t instanceof Date&&+n==+t)return{valid:!0,data:n};if(Hs(n)&&Hs(t)){const e=Object.keys(t),r=Object.keys(n).filter(s=>e.indexOf(s)!==-1),i={...n,...t};for(const s of r){const o=cd(n[s],t[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(t)){if(n.length!==t.length)return{valid:!1,mergeErrorPath:[]};const e=[];for(let r=0;r<n.length;r++){const i=n[r],s=t[r],o=cd(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};e.push(o.data)}return{valid:!0,data:e}}return{valid:!1,mergeErrorPath:[]}}function ev(n,t,e){const r=new Map;let i;for(const a of t.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 e.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}),ts(n))return n;const o=cd(t.value,e.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const GR=A("$ZodRecord",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Hs(i))return e.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),e;const s=[],o=t.keyType._zod.values;if(o){e.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=t.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&e.issues.push(...ns(u,f.issues)),e.value[u]=f.value})):(h.issues.length&&e.issues.push(...ns(u,h.issues)),e.value[u]=h.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&e.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{e.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=t.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"&&f0.test(a)&&c.issues.length){const f=t.keyType._zod.run({value:Number(a),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?e.value[a]=i[a]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>fr(f,r,pr())),input:a,path:[a],inst:n});continue}const h=t.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&e.issues.push(...ns(a,f.issues)),e.value[c.value]=f.value})):(h.issues.length&&e.issues.push(...ns(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),qR=A("$ZodEnum",(n,t)=>{ye.init(n,t);const e=s0(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>oI.has(typeof i)).map(i=>typeof i=="string"?Vs(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:e,input:o,inst:n}),i}}),YR=A("$ZodLiteral",(n,t)=>{if(ye.init(n,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const e=new Set(t.values);n._zod.values=e,n._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Vs(r):r?Vs(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return e.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:n}),r}}),KR=A("$ZodTransform",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new r0(n.constructor.name);const i=t.transform(e.value,e);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(e.value=o,e));if(i instanceof Promise)throw new ss;return e.value=i,e}});function tv(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const k0=A("$ZodOptional",(n,t)=>{ye.init(n,t),n._zod.optin="optional",n._zod.optout="optional",re(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),re(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${cf(e.source)})?$`):void 0}),n._zod.parse=(e,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>tv(s,e.value)):tv(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),JR=A("$ZodExactOptional",(n,t)=>{k0.init(n,t),re(n._zod,"values",()=>t.innerType._zod.values),re(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),XR=A("$ZodNullable",(n,t)=>{ye.init(n,t),re(n._zod,"optin",()=>t.innerType._zod.optin),re(n._zod,"optout",()=>t.innerType._zod.optout),re(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${cf(e.source)}|null)$`):void 0}),re(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),n._zod.parse=(e,r)=>e.value===null?e:t.innerType._zod.run(e,r)}),QR=A("$ZodDefault",(n,t)=>{ye.init(n,t),n._zod.optin="optional",re(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);if(e.value===void 0)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>nv(s,t)):nv(i,t)}});function nv(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const eP=A("$ZodPrefault",(n,t)=>{ye.init(n,t),n._zod.optin="optional",re(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>(r.direction==="backward"||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),tP=A("$ZodNonOptional",(n,t)=>{ye.init(n,t),re(n._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(r=>r!==void 0)):void 0}),n._zod.parse=(e,r)=>{const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>rv(s,n)):rv(i,n)}});function rv(n,t){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:t}),n}const nP=A("$ZodCatch",(n,t)=>{ye.init(n,t),re(n._zod,"optin",()=>t.innerType._zod.optin),re(n._zod,"optout",()=>t.innerType._zod.optout),re(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(o=>fr(o,r,pr()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>fr(s,r,pr()))},input:e.value}),e.issues=[]),e)}}),rP=A("$ZodPipe",(n,t)=>{ye.init(n,t),re(n._zod,"values",()=>t.in._zod.values),re(n._zod,"optin",()=>t.in._zod.optin),re(n._zod,"optout",()=>t.out._zod.optout),re(n._zod,"propValues",()=>t.in._zod.propValues),n._zod.parse=(e,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(e,r);return s instanceof Promise?s.then(o=>Ul(o,t.in,r)):Ul(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Ul(s,t.out,r)):Ul(i,t.out,r)}});function Ul(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const iP=A("$ZodReadonly",(n,t)=>{ye.init(n,t),re(n._zod,"propValues",()=>t.innerType._zod.propValues),re(n._zod,"values",()=>t.innerType._zod.values),re(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),re(n._zod,"optout",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optout}),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(iv):iv(i)}});function iv(n){return n.value=Object.freeze(n.value),n}const sP=A("$ZodCustom",(n,t)=>{ht.init(n,t),ye.init(n,t),n._zod.parse=(e,r)=>e,n._zod.check=e=>{const r=e.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>sv(s,e,r,n));sv(i,e,r,n)}});function sv(n,t,e,r){if(!n){const i={code:"custom",input:e,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Wo(i))}}var ov;class oP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...e){const r=e[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const e=this._map.get(t);return e&&typeof e=="object"&&"id"in e&&this._idmap.delete(e.id),this._map.delete(t),this}get(t){const e=t._zod.parent;if(e){const r={...this.get(e)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function aP(){return new oP}(ov=globalThis).__zod_globalRegistry??(ov.__zod_globalRegistry=aP());const ko=globalThis.__zod_globalRegistry;function lP(n,t){return new n({type:"string",...z(t)})}function cP(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function av(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function uP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function hP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function dP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function pP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function fP(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function gP(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function mP(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function vP(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function yP(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function bP(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function wP(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function SP(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function _P(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function kP(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function EP(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function xP(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function AP(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function TP(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function $P(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function CP(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function IP(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function RP(n,t){return new n({type:"string",format:"date",check:"string_format",...z(t)})}function PP(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function LP(n,t){return new n({type:"string",format:"duration",check:"string_format",...z(t)})}function DP(n,t){return new n({type:"number",checks:[],...z(t)})}function MP(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function zP(n,t){return new n({type:"boolean",...z(t)})}function OP(n){return new n({type:"unknown"})}function NP(n,t){return new n({type:"never",...z(t)})}function lv(n,t){return new m0({check:"less_than",...z(t),value:n,inclusive:!1})}function _h(n,t){return new m0({check:"less_than",...z(t),value:n,inclusive:!0})}function cv(n,t){return new v0({check:"greater_than",...z(t),value:n,inclusive:!1})}function kh(n,t){return new v0({check:"greater_than",...z(t),value:n,inclusive:!0})}function uv(n,t){return new QI({check:"multiple_of",...z(t),value:n})}function E0(n,t){return new tR({check:"max_length",...z(t),maximum:n})}function xc(n,t){return new nR({check:"min_length",...z(t),minimum:n})}function x0(n,t){return new rR({check:"length_equals",...z(t),length:n})}function UP(n,t){return new iR({check:"string_format",format:"regex",...z(t),pattern:n})}function FP(n){return new sR({check:"string_format",format:"lowercase",...z(n)})}function HP(n){return new oR({check:"string_format",format:"uppercase",...z(n)})}function VP(n,t){return new aR({check:"string_format",format:"includes",...z(t),includes:n})}function ZP(n,t){return new lR({check:"string_format",format:"starts_with",...z(t),prefix:n})}function BP(n,t){return new cR({check:"string_format",format:"ends_with",...z(t),suffix:n})}function eo(n){return new uR({check:"overwrite",tx:n})}function WP(n){return eo(t=>t.normalize(n))}function jP(){return eo(n=>n.trim())}function GP(){return eo(n=>n.toLowerCase())}function qP(){return eo(n=>n.toUpperCase())}function YP(){return eo(n=>iI(n))}function KP(n,t,e){return new n({type:"array",element:t,...z(e)})}function JP(n,t,e){return new n({type:"custom",check:"custom",fn:t,...z(e)})}function XP(n){const t=QP(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(Wo(r,e.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=e.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),e.issues.push(Wo(i))}},n(e.value,e)));return t}function QP(n,t){const e=new ht({check:"custom",...z(t)});return e._zod.check=n,e}function A0(n){let t=(n==null?void 0:n.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??ko,target:t,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 $e(n,t,e={path:[],schemaPath:[]}){var h,f;var r;const i=n._zod.def,s=t.seen.get(n);if(s)return s.count++,e.schemaPath.includes(n)&&(s.cycle=e.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:e.path};t.seen.set(n,o);const a=(f=(h=n._zod).toJSONSchema)==null?void 0:f.call(h);if(a)o.schema=a;else{const v={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,o.schema,v);else{const E=o.schema,x=t.processors[i.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);x(n,t,E,v)}const y=n._zod.parent;y&&(o.ref||(o.ref=y),$e(y,t,v),t.seen.get(y).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),t.io==="input"&&Qe(n)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(n).schema}function T0(n,t){var o,a,c,u;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of n.seen.entries()){const f=(o=n.metadataRegistry.get(h[0]))==null?void 0:o.id;if(f){const v=r.get(f);if(v&&v!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,h[0])}}const i=h=>{var x;const f=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const C=(x=n.external.registry.get(h[0]))==null?void 0:x.id,L=n.external.uri??(W=>W);if(C)return{ref:L(C)};const R=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=R,{defId:R,ref:`${L("__shared")}#/${f}/${R}`}}if(h[1]===e)return{ref:"#"};const y=`#/${f}/`,E=h[1].schema.id??`__schema${n.counter++}`;return{defId:E,ref:y+E}},s=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:v,defId:y}=i(h);f.def={...f.schema},y&&(f.defId=y);const E=f.schema;for(const x in E)delete E[x];E.$ref=v};if(n.cycles==="throw")for(const h of n.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${(a=f.cycle)==null?void 0:a.join("/")}/<root>
40
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const R=y.compile();return(N,V)=>R(v,N,V)};let s;const o=Bo,a=!n0.jitless,u=a&&rI.value,h=t.catchall;let f;n._zod.parse=(v,y)=>{f??(f=r.value);const E=v.value;return o(E)?a&&u&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(s||(s=i(t.shape)),v=s(v,y),h?b0([],E,v,y,f,n):v):e(v,y):(v.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),v)}});function Jm(n,t,e,r){for(const s of n)if(s.issues.length===0)return t.value=s.value,t;const i=n.filter(s=>!ts(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:e,errors:n.map(s=>s.issues.map(o=>fr(o,r,pr())))}),t)}const w0=A("$ZodUnion",(n,t)=>{ye.init(n,t),re(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),re(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),re(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),re(n._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>lf(s.source)).join("|")})$`)}});const e=t.options.length===1,r=t.options[0]._zod.run;n._zod.parse=(i,s)=>{if(e)return r(i,s);let o=!1;const a=[];for(const c of t.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=>Jm(c,i,n,s)):Jm(a,i,n,s)}}),ZR=A("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,w0.init(n,t);const e=n._zod.parse;re(n._zod,"propValues",()=>{const i={};for(const s of t.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(o)){i[a]||(i[a]=new Set);for(const u of c)i[a].add(u)}}return i});const r=gu(()=>{var o;const i=t.options,s=new Map;for(const a of i){const c=(o=a._zod.propValues)==null?void 0:o[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});n._zod.parse=(i,s)=>{const o=i.value;if(!Bo(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:n}),i;const a=r.value.get(o==null?void 0:o[t.discriminator]);return a?a._zod.run(i,s):t.unionFallback?e(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:o,path:[t.discriminator],inst:n}),i)}}),BR=A("$ZodIntersection",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>Xm(e,c,u)):Xm(e,s,o)}});function ld(n,t){if(n===t)return{valid:!0,data:n};if(n instanceof Date&&t instanceof Date&&+n==+t)return{valid:!0,data:n};if(Hs(n)&&Hs(t)){const e=Object.keys(t),r=Object.keys(n).filter(s=>e.indexOf(s)!==-1),i={...n,...t};for(const s of r){const o=ld(n[s],t[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(t)){if(n.length!==t.length)return{valid:!1,mergeErrorPath:[]};const e=[];for(let r=0;r<n.length;r++){const i=n[r],s=t[r],o=ld(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};e.push(o.data)}return{valid:!0,data:e}}return{valid:!1,mergeErrorPath:[]}}function Xm(n,t,e){const r=new Map;let i;for(const a of t.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 e.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}),ts(n))return n;const o=ld(t.value,e.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const WR=A("$ZodRecord",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Hs(i))return e.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),e;const s=[],o=t.keyType._zod.values;if(o){e.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=t.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&e.issues.push(...ns(u,f.issues)),e.value[u]=f.value})):(h.issues.length&&e.issues.push(...ns(u,h.issues)),e.value[u]=h.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&e.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{e.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=t.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"&&d0.test(a)&&c.issues.length){const f=t.keyType._zod.run({value:Number(a),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?e.value[a]=i[a]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>fr(f,r,pr())),input:a,path:[a],inst:n});continue}const h=t.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&e.issues.push(...ns(a,f.issues)),e.value[c.value]=f.value})):(h.issues.length&&e.issues.push(...ns(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),jR=A("$ZodEnum",(n,t)=>{ye.init(n,t);const e=r0(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>iI.has(typeof i)).map(i=>typeof i=="string"?Vs(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:e,input:o,inst:n}),i}}),GR=A("$ZodLiteral",(n,t)=>{if(ye.init(n,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const e=new Set(t.values);n._zod.values=e,n._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Vs(r):r?Vs(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return e.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:n}),r}}),qR=A("$ZodTransform",(n,t)=>{ye.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new t0(n.constructor.name);const i=t.transform(e.value,e);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(e.value=o,e));if(i instanceof Promise)throw new ss;return e.value=i,e}});function Qm(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const S0=A("$ZodOptional",(n,t)=>{ye.init(n,t),n._zod.optin="optional",n._zod.optout="optional",re(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),re(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${lf(e.source)})?$`):void 0}),n._zod.parse=(e,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>Qm(s,e.value)):Qm(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),YR=A("$ZodExactOptional",(n,t)=>{S0.init(n,t),re(n._zod,"values",()=>t.innerType._zod.values),re(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),KR=A("$ZodNullable",(n,t)=>{ye.init(n,t),re(n._zod,"optin",()=>t.innerType._zod.optin),re(n._zod,"optout",()=>t.innerType._zod.optout),re(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${lf(e.source)}|null)$`):void 0}),re(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),n._zod.parse=(e,r)=>e.value===null?e:t.innerType._zod.run(e,r)}),JR=A("$ZodDefault",(n,t)=>{ye.init(n,t),n._zod.optin="optional",re(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);if(e.value===void 0)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>ev(s,t)):ev(i,t)}});function ev(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const XR=A("$ZodPrefault",(n,t)=>{ye.init(n,t),n._zod.optin="optional",re(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>(r.direction==="backward"||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),QR=A("$ZodNonOptional",(n,t)=>{ye.init(n,t),re(n._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(r=>r!==void 0)):void 0}),n._zod.parse=(e,r)=>{const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>tv(s,n)):tv(i,n)}});function tv(n,t){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:t}),n}const eP=A("$ZodCatch",(n,t)=>{ye.init(n,t),re(n._zod,"optin",()=>t.innerType._zod.optin),re(n._zod,"optout",()=>t.innerType._zod.optout),re(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(o=>fr(o,r,pr()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>fr(s,r,pr()))},input:e.value}),e.issues=[]),e)}}),tP=A("$ZodPipe",(n,t)=>{ye.init(n,t),re(n._zod,"values",()=>t.in._zod.values),re(n._zod,"optin",()=>t.in._zod.optin),re(n._zod,"optout",()=>t.out._zod.optout),re(n._zod,"propValues",()=>t.in._zod.propValues),n._zod.parse=(e,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(e,r);return s instanceof Promise?s.then(o=>Ul(o,t.in,r)):Ul(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Ul(s,t.out,r)):Ul(i,t.out,r)}});function Ul(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const nP=A("$ZodReadonly",(n,t)=>{ye.init(n,t),re(n._zod,"propValues",()=>t.innerType._zod.propValues),re(n._zod,"values",()=>t.innerType._zod.values),re(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),re(n._zod,"optout",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optout}),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(nv):nv(i)}});function nv(n){return n.value=Object.freeze(n.value),n}const rP=A("$ZodCustom",(n,t)=>{ht.init(n,t),ye.init(n,t),n._zod.parse=(e,r)=>e,n._zod.check=e=>{const r=e.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>rv(s,e,r,n));rv(i,e,r,n)}});function rv(n,t,e,r){if(!n){const i={code:"custom",input:e,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Wo(i))}}var iv;class iP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...e){const r=e[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const e=this._map.get(t);return e&&typeof e=="object"&&"id"in e&&this._idmap.delete(e.id),this._map.delete(t),this}get(t){const e=t._zod.parent;if(e){const r={...this.get(e)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function sP(){return new iP}(iv=globalThis).__zod_globalRegistry??(iv.__zod_globalRegistry=sP());const ko=globalThis.__zod_globalRegistry;function oP(n,t){return new n({type:"string",...z(t)})}function aP(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function sv(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function lP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function cP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function uP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function hP(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function dP(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function pP(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function fP(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function gP(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function mP(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function vP(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function yP(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function bP(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function wP(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function SP(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function _P(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function kP(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function EP(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function xP(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function AP(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function TP(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function $P(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function CP(n,t){return new n({type:"string",format:"date",check:"string_format",...z(t)})}function IP(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function RP(n,t){return new n({type:"string",format:"duration",check:"string_format",...z(t)})}function PP(n,t){return new n({type:"number",checks:[],...z(t)})}function LP(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function DP(n,t){return new n({type:"boolean",...z(t)})}function MP(n){return new n({type:"unknown"})}function zP(n,t){return new n({type:"never",...z(t)})}function ov(n,t){return new f0({check:"less_than",...z(t),value:n,inclusive:!1})}function Sh(n,t){return new f0({check:"less_than",...z(t),value:n,inclusive:!0})}function av(n,t){return new g0({check:"greater_than",...z(t),value:n,inclusive:!1})}function _h(n,t){return new g0({check:"greater_than",...z(t),value:n,inclusive:!0})}function lv(n,t){return new JI({check:"multiple_of",...z(t),value:n})}function _0(n,t){return new QI({check:"max_length",...z(t),maximum:n})}function xc(n,t){return new eR({check:"min_length",...z(t),minimum:n})}function k0(n,t){return new tR({check:"length_equals",...z(t),length:n})}function OP(n,t){return new nR({check:"string_format",format:"regex",...z(t),pattern:n})}function NP(n){return new rR({check:"string_format",format:"lowercase",...z(n)})}function UP(n){return new iR({check:"string_format",format:"uppercase",...z(n)})}function FP(n,t){return new sR({check:"string_format",format:"includes",...z(t),includes:n})}function HP(n,t){return new oR({check:"string_format",format:"starts_with",...z(t),prefix:n})}function VP(n,t){return new aR({check:"string_format",format:"ends_with",...z(t),suffix:n})}function eo(n){return new lR({check:"overwrite",tx:n})}function ZP(n){return eo(t=>t.normalize(n))}function BP(){return eo(n=>n.trim())}function WP(){return eo(n=>n.toLowerCase())}function jP(){return eo(n=>n.toUpperCase())}function GP(){return eo(n=>nI(n))}function qP(n,t,e){return new n({type:"array",element:t,...z(e)})}function YP(n,t,e){return new n({type:"custom",check:"custom",fn:t,...z(e)})}function KP(n){const t=JP(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(Wo(r,e.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=e.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),e.issues.push(Wo(i))}},n(e.value,e)));return t}function JP(n,t){const e=new ht({check:"custom",...z(t)});return e._zod.check=n,e}function E0(n){let t=(n==null?void 0:n.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??ko,target:t,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 $e(n,t,e={path:[],schemaPath:[]}){var h,f;var r;const i=n._zod.def,s=t.seen.get(n);if(s)return s.count++,e.schemaPath.includes(n)&&(s.cycle=e.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:e.path};t.seen.set(n,o);const a=(f=(h=n._zod).toJSONSchema)==null?void 0:f.call(h);if(a)o.schema=a;else{const v={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,o.schema,v);else{const E=o.schema,x=t.processors[i.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);x(n,t,E,v)}const y=n._zod.parent;y&&(o.ref||(o.ref=y),$e(y,t,v),t.seen.get(y).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),t.io==="input"&&Qe(n)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(n).schema}function x0(n,t){var o,a,c,u;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of n.seen.entries()){const f=(o=n.metadataRegistry.get(h[0]))==null?void 0:o.id;if(f){const v=r.get(f);if(v&&v!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,h[0])}}const i=h=>{var x;const f=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const C=(x=n.external.registry.get(h[0]))==null?void 0:x.id,L=n.external.uri??(W=>W);if(C)return{ref:L(C)};const R=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=R,{defId:R,ref:`${L("__shared")}#/${f}/${R}`}}if(h[1]===e)return{ref:"#"};const y=`#/${f}/`,E=h[1].schema.id??`__schema${n.counter++}`;return{defId:E,ref:y+E}},s=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:v,defId:y}=i(h);f.def={...f.schema},y&&(f.defId=y);const E=f.schema;for(const x in E)delete E[x];E.$ref=v};if(n.cycles==="throw")for(const h of n.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${(a=f.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 f=h[1];if(t===h[0]){s(h);continue}if(n.external){const y=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&y){s(h);continue}}if((u=n.metadataRegistry.get(h[0]))==null?void 0:u.id){s(h);continue}if(f.cycle){s(h);continue}if(f.count>1&&n.reused==="ref"){s(h);continue}}}function $0(n,t){var o,a,c;const e=n.seen.get(t);if(!e)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 f=h.def??h.schema,v={...f},y=h.ref;if(h.ref=null,y){r(y);const x=n.seen.get(y),C=x.schema;if(C.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(C)):Object.assign(f,C),Object.assign(f,v),u._zod.parent===y)for(const R in f)R==="$ref"||R==="allOf"||R in v||delete f[R];if(C.$ref&&x.def)for(const R in f)R==="$ref"||R==="allOf"||R in x.def&&JSON.stringify(f[R])===JSON.stringify(x.def[R])&&delete f[R]}const E=u._zod.parent;if(E&&E!==y){r(E);const x=n.seen.get(E);if(x!=null&&x.schema.$ref&&(f.$ref=x.schema.$ref,x.def))for(const C in f)C==="$ref"||C==="allOf"||C in x.def&&JSON.stringify(f[C])===JSON.stringify(x.def[C])&&delete f[C]}n.override({zodSchema:u,jsonSchema:f,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(t))==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,e.def??e.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:{...t["~standard"],jsonSchema:{input:Ac(t,"input",n.processors),output:Ac(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Qe(n,t){const e=t??{seen:new Set};if(e.seen.has(n))return!1;e.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Qe(r.element,e);if(r.type==="set")return Qe(r.valueType,e);if(r.type==="lazy")return Qe(r.getter(),e);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Qe(r.innerType,e);if(r.type==="intersection")return Qe(r.left,e)||Qe(r.right,e);if(r.type==="record"||r.type==="map")return Qe(r.keyType,e)||Qe(r.valueType,e);if(r.type==="pipe")return Qe(r.in,e)||Qe(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Qe(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Qe(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Qe(i,e))return!0;return!!(r.rest&&Qe(r.rest,e))}return!1}const e2=(n,t={})=>e=>{const r=A0({...e,processors:t});return $e(n,r),T0(r,n),$0(r,n)},Ac=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=A0({...i??{},target:s,io:t,processors:e});return $e(n,o),T0(o,n),$0(o,n)},t2={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},n2=(n,t,e,r)=>{const i=e;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=t2[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(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},r2=(n,t,e,r)=>{const i=e,{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"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&t.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},i2=(n,t,e,r)=>{e.type="boolean"},s2=(n,t,e,r)=>{e.not={}},o2=(n,t,e,r)=>{},a2=(n,t,e,r)=>{const i=n._zod.def,s=s0(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},l2=(n,t,e,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.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];e.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?e.enum=[o]:e.const=o}else s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),s.every(o=>typeof o=="boolean")&&(e.type="boolean"),s.every(o=>o===null)&&(e.type="null"),e.enum=s},c2=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},u2=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},h2=(n,t,e,r)=>{const i=e,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=$e(s.element,t,{...r,path:[...r.path,"items"]})},d2=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=$e(o[h],t,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(h=>{const f=s.shape[h]._zod;return t.io==="input"?f.optin===void 0:f.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=$e(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},p2=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>$e(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=o:e.anyOf=o},f2=(n,t,e,r)=>{const i=n._zod.def,s=$e(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=$e(i.right,t,{...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]];e.allOf=c},g2=(n,t,e,r)=>{const i=e,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=$e(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const f of c)i.patternProperties[f.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=$e(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=$e(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const h=[...u].filter(f=>typeof f=="string"||typeof f=="number");h.length>0&&(i.required=h)}},m2=(n,t,e,r)=>{const i=n._zod.def,s=$e(i.innerType,t,r),o=t.seen.get(n);t.target==="openapi-3.0"?(o.ref=i.innerType,e.nullable=!0):e.anyOf=[s,{type:"null"}]},v2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},y2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},b2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,t.io==="input"&&(e._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},w2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.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")}e.default=o},S2=(n,t,e,r)=>{const i=n._zod.def,s=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;$e(s,t,r);const o=t.seen.get(n);o.ref=s},_2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},C0=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},k2=A("ZodISODateTime",(n,t)=>{ER.init(n,t),we.init(n,t)});function E2(n){return IP(k2,n)}const x2=A("ZodISODate",(n,t)=>{xR.init(n,t),we.init(n,t)});function A2(n){return RP(x2,n)}const T2=A("ZodISOTime",(n,t)=>{AR.init(n,t),we.init(n,t)});function $2(n){return PP(T2,n)}const C2=A("ZodISODuration",(n,t)=>{TR.init(n,t),we.init(n,t)});function I2(n){return LP(C2,n)}const I0=(n,t)=>{c0.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>vI(n,e)},flatten:{value:e=>mI(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,ld,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,ld,2)}},isEmpty:{get(){return n.issues.length===0}}})},hv=A("ZodError",I0),Rt=A("ZodError",I0,{Parent:Error}),R2=hf(Rt),P2=df(Rt),L2=mu(Rt),D2=vu(Rt),M2=wI(Rt),z2=SI(Rt),O2=_I(Rt),N2=kI(Rt),U2=EI(Rt),F2=xI(Rt),H2=AI(Rt),V2=TI(Rt),be=A("ZodType",(n,t)=>(ye.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Ac(n,"input"),output:Ac(n,"output")}}),n.toJSONSchema=e2(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(wr(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(e,r)=>Sr(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>R2(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>L2(n,e,r),n.parseAsync=async(e,r)=>P2(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>D2(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>M2(n,e,r),n.decode=(e,r)=>z2(n,e,r),n.encodeAsync=async(e,r)=>O2(n,e,r),n.decodeAsync=async(e,r)=>N2(n,e,r),n.safeEncode=(e,r)=>U2(n,e,r),n.safeDecode=(e,r)=>F2(n,e,r),n.safeEncodeAsync=async(e,r)=>H2(n,e,r),n.safeDecodeAsync=async(e,r)=>V2(n,e,r),n.refine=(e,r)=>n.check(DL(e,r)),n.superRefine=e=>n.check(ML(e)),n.overwrite=e=>n.check(eo(e)),n.optional=()=>fv(n),n.exactOptional=()=>SL(n),n.nullable=()=>gv(n),n.nullish=()=>fv(gv(n)),n.nonoptional=e=>TL(n,e),n.array=()=>M(n),n.or=e=>j([n,e]),n.and=e=>bu(n,e),n.transform=e=>mv(n,bL(e)),n.default=e=>EL(n,e),n.prefault=e=>AL(n,e),n.catch=e=>CL(n,e),n.pipe=e=>mv(n,e),n.readonly=()=>PL(n),n.describe=e=>{const r=n.clone();return ko.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=ko.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return ko.get(n);const r=n.clone();return ko.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),R0=A("_ZodString",(n,t)=>{pf.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>n2(n,r,i);const e=n._zod.bag;n.format=e.format??null,n.minLength=e.minimum??null,n.maxLength=e.maximum??null,n.regex=(...r)=>n.check(UP(...r)),n.includes=(...r)=>n.check(VP(...r)),n.startsWith=(...r)=>n.check(ZP(...r)),n.endsWith=(...r)=>n.check(BP(...r)),n.min=(...r)=>n.check(xc(...r)),n.max=(...r)=>n.check(E0(...r)),n.length=(...r)=>n.check(x0(...r)),n.nonempty=(...r)=>n.check(xc(1,...r)),n.lowercase=r=>n.check(FP(r)),n.uppercase=r=>n.check(HP(r)),n.trim=()=>n.check(jP()),n.normalize=(...r)=>n.check(WP(...r)),n.toLowerCase=()=>n.check(GP()),n.toUpperCase=()=>n.check(qP()),n.slugify=()=>n.check(YP())}),Z2=A("ZodString",(n,t)=>{pf.init(n,t),R0.init(n,t),n.email=e=>n.check(cP(B2,e)),n.url=e=>n.check(fP(W2,e)),n.jwt=e=>n.check(CP(oL,e)),n.emoji=e=>n.check(gP(j2,e)),n.guid=e=>n.check(av(dv,e)),n.uuid=e=>n.check(uP(Fl,e)),n.uuidv4=e=>n.check(hP(Fl,e)),n.uuidv6=e=>n.check(dP(Fl,e)),n.uuidv7=e=>n.check(pP(Fl,e)),n.nanoid=e=>n.check(mP(G2,e)),n.guid=e=>n.check(av(dv,e)),n.cuid=e=>n.check(vP(q2,e)),n.cuid2=e=>n.check(yP(Y2,e)),n.ulid=e=>n.check(bP(K2,e)),n.base64=e=>n.check(AP(rL,e)),n.base64url=e=>n.check(TP(iL,e)),n.xid=e=>n.check(wP(J2,e)),n.ksuid=e=>n.check(SP(X2,e)),n.ipv4=e=>n.check(_P(Q2,e)),n.ipv6=e=>n.check(kP(eL,e)),n.cidrv4=e=>n.check(EP(tL,e)),n.cidrv6=e=>n.check(xP(nL,e)),n.e164=e=>n.check($P(sL,e)),n.datetime=e=>n.check(E2(e)),n.date=e=>n.check(A2(e)),n.time=e=>n.check($2(e)),n.duration=e=>n.check(I2(e))});function p(n){return lP(Z2,n)}const we=A("ZodStringFormat",(n,t)=>{me.init(n,t),R0.init(n,t)}),B2=A("ZodEmail",(n,t)=>{gR.init(n,t),we.init(n,t)}),dv=A("ZodGUID",(n,t)=>{pR.init(n,t),we.init(n,t)}),Fl=A("ZodUUID",(n,t)=>{fR.init(n,t),we.init(n,t)}),W2=A("ZodURL",(n,t)=>{mR.init(n,t),we.init(n,t)}),j2=A("ZodEmoji",(n,t)=>{vR.init(n,t),we.init(n,t)}),G2=A("ZodNanoID",(n,t)=>{yR.init(n,t),we.init(n,t)}),q2=A("ZodCUID",(n,t)=>{bR.init(n,t),we.init(n,t)}),Y2=A("ZodCUID2",(n,t)=>{wR.init(n,t),we.init(n,t)}),K2=A("ZodULID",(n,t)=>{SR.init(n,t),we.init(n,t)}),J2=A("ZodXID",(n,t)=>{_R.init(n,t),we.init(n,t)}),X2=A("ZodKSUID",(n,t)=>{kR.init(n,t),we.init(n,t)}),Q2=A("ZodIPv4",(n,t)=>{$R.init(n,t),we.init(n,t)}),eL=A("ZodIPv6",(n,t)=>{CR.init(n,t),we.init(n,t)}),tL=A("ZodCIDRv4",(n,t)=>{IR.init(n,t),we.init(n,t)}),nL=A("ZodCIDRv6",(n,t)=>{RR.init(n,t),we.init(n,t)}),rL=A("ZodBase64",(n,t)=>{PR.init(n,t),we.init(n,t)}),iL=A("ZodBase64URL",(n,t)=>{DR.init(n,t),we.init(n,t)}),sL=A("ZodE164",(n,t)=>{MR.init(n,t),we.init(n,t)}),oL=A("ZodJWT",(n,t)=>{OR.init(n,t),we.init(n,t)}),P0=A("ZodNumber",(n,t)=>{b0.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>r2(n,r,i),n.gt=(r,i)=>n.check(cv(r,i)),n.gte=(r,i)=>n.check(kh(r,i)),n.min=(r,i)=>n.check(kh(r,i)),n.lt=(r,i)=>n.check(lv(r,i)),n.lte=(r,i)=>n.check(_h(r,i)),n.max=(r,i)=>n.check(_h(r,i)),n.int=r=>n.check(pv(r)),n.safe=r=>n.check(pv(r)),n.positive=r=>n.check(cv(0,r)),n.nonnegative=r=>n.check(kh(0,r)),n.negative=r=>n.check(lv(0,r)),n.nonpositive=r=>n.check(_h(0,r)),n.multipleOf=(r,i)=>n.check(uv(r,i)),n.step=(r,i)=>n.check(uv(r,i)),n.finite=()=>n;const e=n._zod.bag;n.minValue=Math.max(e.minimum??Number.NEGATIVE_INFINITY,e.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(e.maximum??Number.POSITIVE_INFINITY,e.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(e.format??"").includes("int")||Number.isSafeInteger(e.multipleOf??.5),n.isFinite=!0,n.format=e.format??null});function B(n){return DP(P0,n)}const aL=A("ZodNumberFormat",(n,t)=>{NR.init(n,t),P0.init(n,t)});function pv(n){return MP(aL,n)}const lL=A("ZodBoolean",(n,t)=>{UR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>i2(n,e,r)});function Ne(n){return zP(lL,n)}const cL=A("ZodUnknown",(n,t)=>{FR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>o2()});function _(){return OP(cL)}const uL=A("ZodNever",(n,t)=>{HR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>s2(n,e,r)});function hL(n){return NP(uL,n)}const dL=A("ZodArray",(n,t)=>{VR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>h2(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(xc(e,r)),n.nonempty=e=>n.check(xc(1,e)),n.max=(e,r)=>n.check(E0(e,r)),n.length=(e,r)=>n.check(x0(e,r)),n.unwrap=()=>n.element});function M(n,t){return KP(dL,n,t)}const L0=A("ZodObject",(n,t)=>{BR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>d2(n,e,r,i),re(n,"shape",()=>t.shape),n.keyof=()=>z0(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:_()}),n.loose=()=>n.clone({...n._zod.def,catchall:_()}),n.strict=()=>n.clone({...n._zod.def,catchall:hL()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>hI(n,e),n.safeExtend=e=>dI(n,e),n.merge=e=>pI(n,e),n.pick=e=>cI(n,e),n.omit=e=>uI(n,e),n.partial=(...e)=>fI(O0,n,e[0]),n.required=(...e)=>gI(N0,n,e[0])});function D0(n,t){const e={type:"object",shape:n??{},...z(t)};return new L0(e)}function w(n,t){return new L0({type:"object",shape:n,catchall:_(),...z(t)})}const M0=A("ZodUnion",(n,t)=>{_0.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>p2(n,e,r,i),n.options=t.options});function j(n,t){return new M0({type:"union",options:n,...z(t)})}const pL=A("ZodDiscriminatedUnion",(n,t)=>{M0.init(n,t),WR.init(n,t)});function fL(n,t,e){return new pL({type:"union",options:t,discriminator:n,...z(e)})}const gL=A("ZodIntersection",(n,t)=>{jR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>f2(n,e,r,i)});function bu(n,t){return new gL({type:"intersection",left:n,right:t})}const mL=A("ZodRecord",(n,t)=>{GR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>g2(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function k(n,t,e){return new mL({type:"record",keyType:n,valueType:t,...z(e)})}const ud=A("ZodEnum",(n,t)=>{qR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>a2(n,r,i),n.enum=t.entries,n.options=Object.values(t.entries);const e=new Set(Object.keys(t.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(e.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ud({...t,checks:[],...z(i),entries:s})},n.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(e.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new ud({...t,checks:[],...z(i),entries:s})}});function z0(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new ud({type:"enum",entries:e,...z(t)})}const vL=A("ZodLiteral",(n,t)=>{YR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>l2(n,e,r),n.values=new Set(t.values),Object.defineProperty(n,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function T(n,t){return new vL({type:"literal",values:Array.isArray(n)?n:[n],...z(t)})}const yL=A("ZodTransform",(n,t)=>{KR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>u2(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new r0(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(Wo(s,e.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=e.value),o.inst??(o.inst=n),e.issues.push(Wo(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function bL(n){return new yL({type:"transform",transform:n})}const O0=A("ZodOptional",(n,t)=>{k0.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>C0(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function fv(n){return new O0({type:"optional",innerType:n})}const wL=A("ZodExactOptional",(n,t)=>{JR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>C0(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function SL(n){return new wL({type:"optional",innerType:n})}const _L=A("ZodNullable",(n,t)=>{XR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>m2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function gv(n){return new _L({type:"nullable",innerType:n})}const kL=A("ZodDefault",(n,t)=>{QR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>y2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function EL(n,t){return new kL({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():a0(t)}})}const xL=A("ZodPrefault",(n,t)=>{eP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>b2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function AL(n,t){return new xL({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():a0(t)}})}const N0=A("ZodNonOptional",(n,t)=>{tP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>v2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function TL(n,t){return new N0({type:"nonoptional",innerType:n,...z(t)})}const $L=A("ZodCatch",(n,t)=>{nP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>w2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function CL(n,t){return new $L({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const IL=A("ZodPipe",(n,t)=>{rP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>S2(n,e,r,i),n.in=t.in,n.out=t.out});function mv(n,t){return new IL({type:"pipe",in:n,out:t})}const RL=A("ZodReadonly",(n,t)=>{iP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>_2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function PL(n){return new RL({type:"readonly",innerType:n})}const LL=A("ZodCustom",(n,t)=>{sP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>c2(n,e)});function DL(n,t={}){return JP(LL,n,t)}function ML(n){return XP(n)}const zL=[".md",".markdown"];function U0(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function F0(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function OL(n){return F0(n).toLowerCase()}function NL(n,t){const e=OL(n);return t.some(r=>e.endsWith(r))}function H0(n){return!U0(n)&&NL(n,zL)}function UL(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function xn(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const FL=D0({id:p().min(1),kind:T("path"),title:p(),path:p()}).strict(),HL=D0({id:p().min(1),kind:T("url"),title:p(),url:p().refine(UL,{message:"url must be an http(s) URL"})}).strict();fL("kind",[FL,HL]);function V0(n){return typeof n=="object"&&n!==null}function Z0(n){return!V0(n)||n.type!=="ready"?!1:!("id"in n)}function B0(n){return!(!V0(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const VL="/views/markdown/",ZL="/views/url-unsupported/";function W0(n){return`/artifact/${encodeURIComponent(n)}`}function BL(n,t){return`${W0(n)}/${encodeURIComponent(t)}`}function WL(n){return`/markdown/${encodeURIComponent(n)}`}function Tc(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:xn(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:ZL,contentURL:null};if(H0(n.path)){const r={viewURL:VL,contentURL:WL(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=U0(n.path)?`${W0(n.id)}/`:BL(n.id,F0(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const jL="serverURL",GL="token",qL="mode",YL="desktopAppVersion",KL="electron";function j0(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(jL);return r?new URL(r).origin:new URL(t).origin}function JL(n=window.location.search){return new URLSearchParams(n).get(GL)}function Wt(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(qL)===KL}function G0(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(YL)}const vv="tv.telemetry.clientId",XL=5,QL=60,eD=1e3,tD=XL*QL*eD,yv=["pointerdown","scroll","keydown"],bv=["focus"],wv=["visibilitychange"],nD="hidden";function rD(n,t=lD){const e=n.getItem(vv);if(e)return e;const r=t();return n.setItem(vv,r),r}function iD(n){return{clientId:rD(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function sD(n){const t=new URLSearchParams;return t.set("clientId",n.clientId),t.set("userAgent",n.userAgent),t.set("clientApp",n.clientApp),n.desktopAppVersion&&t.set("desktopAppVersion",n.desktopAppVersion),t}function oD(n){return new aD(n)}var ra,Rn,Qn,ia,sa,yt,Yr,oa,Oc,q0;class aD{constructor(t){b(this,Oc);b(this,ra);b(this,Rn);b(this,Qn);b(this,ia);b(this,sa);b(this,yt);b(this,Yr,!1);b(this,oa,Number.NEGATIVE_INFINITY);m(this,ra,t.meta),m(this,Rn,t.documentTarget),m(this,Qn,t.windowTarget),m(this,ia,t.send),m(this,sa,t.nowMs??Date.now),m(this,yt,()=>d(this,Oc,q0).call(this))}start(){if(!l(this,Yr)){m(this,Yr,!0);for(const t of yv)l(this,Qn).addEventListener(t,l(this,yt)),l(this,Rn).addEventListener(t,l(this,yt));for(const t of bv)l(this,Qn).addEventListener(t,l(this,yt));for(const t of wv)l(this,Rn).addEventListener(t,l(this,yt))}}stop(){if(l(this,Yr)){m(this,Yr,!1);for(const t of yv)l(this,Qn).removeEventListener(t,l(this,yt)),l(this,Rn).removeEventListener(t,l(this,yt));for(const t of bv)l(this,Qn).removeEventListener(t,l(this,yt));for(const t of wv)l(this,Rn).removeEventListener(t,l(this,yt))}}}ra=new WeakMap,Rn=new WeakMap,Qn=new WeakMap,ia=new WeakMap,sa=new WeakMap,yt=new WeakMap,Yr=new WeakMap,oa=new WeakMap,Oc=new WeakSet,q0=function(){if(l(this,Rn).visibilityState===nD)return;const t=l(this,sa).call(this);t-l(this,oa)<tD||(m(this,oa,t),l(this,ia).call(this,{type:fC,clientId:l(this,ra).clientId}))};function lD(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():fu().toLowerCase()}const fe={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"},En={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"},cD=1,uD=w({_meta:k(p(),_()).nullish(),terminal:Ne().optional().default(!1)}),hD=w({_meta:k(p(),_()).nullish(),label:p().nullish(),name:p(),optional:Ne().optional().default(!1),secret:Ne().optional().default(!0)}),dD=w({_meta:k(p(),_()).nullish(),description:p().nullish(),id:p(),name:p()}),pD=w({_meta:k(p(),_()).nullish(),description:p().nullish(),id:p(),link:p().nullish(),name:p(),vars:M(hD)}),fD=w({_meta:k(p(),_()).nullish(),args:M(p()).optional(),description:p().nullish(),env:k(p(),p()).optional(),id:p(),name:p()}),gD=j([pD.and(w({type:T("env_var")})),fD.and(w({type:T("terminal")})),dD]),mD=w({_meta:k(p(),_()).nullish(),methodId:p()}),vD=w({_meta:k(p(),_()).nullish()}),yD=w({_meta:k(p(),_()).nullish(),blob:p(),mimeType:p().nullish(),uri:p()}),bD=w({default:Ne().nullish(),description:p().nullish(),title:p().nullish()}),wD=w({_meta:k(p(),_()).nullish()}),SD=w({_meta:k(p(),_()).nullish()}),_D=w({amount:B(),currency:p()}),kD=w({_meta:k(p(),_()).nullish(),terminalId:p()}),ED=w({_meta:k(p(),_()).nullish(),newText:p(),oldText:p().nullish(),path:p()}),xD=j([p(),B(),B(),Ne(),M(p())]),AD=w({content:k(p(),xD).nullish()}),TD=j([AD.and(w({action:T("accept")})),w({action:T("decline")}),w({action:T("cancel")})]),$D=w({_meta:k(p(),_()).nullish()}),Y0=p(),CD=w({_meta:k(p(),_()).nullish(),elicitationId:Y0}),ID=w({_meta:k(p(),_()).nullish(),action:TD}),RD=T("object"),PD=T("string"),LD=w({_meta:k(p(),_()).nullish()}),DD=w({_meta:k(p(),_()).nullish(),form:$D.nullish(),url:LD.nullish()}),MD=w({elicitationId:Y0,url:p().url()}),K0=w({const:p(),title:p()}),J0=w({_meta:k(p(),_()).nullish(),name:p(),value:p()}),zD=j([T(-32700),T(-32600),T(-32601),T(-32602),T(-32603),T(-32800),T(-32e3),T(-32002),T(-32042),B().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),X0=w({code:zD,data:_().optional(),message:p()}),Q0=_(),ew=_(),tw=_(),OD=w({_meta:k(p(),_()).nullish(),readTextFile:Ne().optional().default(!1),writeTextFile:Ne().optional().default(!1)}),nw=w({_meta:k(p(),_()).nullish(),name:p(),value:p()}),rw=w({_meta:k(p(),_()).nullish(),name:p(),title:p().nullish(),version:p()}),ND=w({default:B().nullish(),description:p().nullish(),maximum:B().nullish(),minimum:B().nullish(),title:p().nullish()}),UD=w({_meta:k(p(),_()).nullish()}),FD=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cursor:p().nullish(),cwd:p().nullish()}),HD=w({_meta:k(p(),_()).nullish()}),VD=w({_meta:k(p(),_()).nullish(),logout:HD.nullish()}),ZD=w({_meta:k(p(),_()).nullish()}),BD=w({_meta:k(p(),_()).nullish()}),WD=w({_meta:k(p(),_()).nullish(),http:Ne().optional().default(!1),sse:Ne().optional().default(!1)}),jD=w({_meta:k(p(),_()).nullish(),headers:M(nw),name:p(),url:p()}),GD=w({_meta:k(p(),_()).nullish(),headers:M(nw),name:p(),url:p()}),qD=w({_meta:k(p(),_()).nullish(),args:M(p()),command:p(),env:M(J0),name:p()}),wu=j([jD.and(w({type:T("http")})),GD.and(w({type:T("sse")})),qD]),ff=p(),YD=w({_meta:k(p(),_()).nullish(),description:p().nullish(),modelId:ff,name:p()}),KD=j([T("error"),T("warning"),T("information"),T("hint")]),JD=w({_meta:k(p(),_()).nullish()}),XD=w({_meta:k(p(),_()).nullish()}),QD=w({_meta:k(p(),_()).nullish()}),e6=w({_meta:k(p(),_()).nullish()}),t6=w({_meta:k(p(),_()).nullish()}),n6=w({_meta:k(p(),_()).nullish(),maxCount:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),r6=w({diff:p(),uri:p()}),i6=w({endLine:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:p()}),s6=w({_meta:k(p(),_()).nullish()}),o6=w({_meta:k(p(),_()).nullish()}),a6=w({languageId:p(),text:p(),uri:p()}),l6=w({_meta:k(p(),_()).nullish(),maxCount:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),c6=j([T("rejected"),T("ignored"),T("replaced"),T("cancelled")]),u6=w({excerpts:M(i6),uri:p()}),h6=w({_meta:k(p(),_()).nullish()}),d6=w({_meta:k(p(),_()).nullish()}),p6=w({name:p(),owner:p(),remoteUrl:p()}),f6=w({_meta:k(p(),_()).nullish()}),g6=w({_meta:k(p(),_()).nullish(),jump:s6.nullish(),rename:d6.nullish(),searchAndReplace:f6.nullish()}),m6=w({id:p(),isRegex:Ne().nullish(),replace:p(),search:p(),uri:p()}),v6=j([T("automatic"),T("diagnostic"),T("manual")]),y6=w({_meta:k(p(),_()).nullish(),maxCount:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),b6=w({_meta:k(p(),_()).nullish(),diagnostics:JD.nullish(),editHistory:n6.nullish(),openFiles:o6.nullish(),recentFiles:l6.nullish(),relatedSnippets:h6.nullish(),userActions:y6.nullish()}),w6=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu)}),S6=w({default:B().nullish(),description:p().nullish(),maximum:B().nullish(),minimum:B().nullish(),title:p().nullish()}),iw=p(),_6=j([T("allow_once"),T("allow_always"),T("reject_once"),T("reject_always")]),k6=w({_meta:k(p(),_()).nullish(),kind:_6,name:p(),optionId:iw}),E6=j([T("high"),T("medium"),T("low")]),x6=j([T("pending"),T("in_progress"),T("completed")]),A6=w({_meta:k(p(),_()).nullish(),content:p(),priority:E6,status:x6}),T6=w({_meta:k(p(),_()).nullish(),entries:M(A6)}),gr=w({character:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),$6=w({id:p(),position:gr,uri:p()}),C6=w({id:p(),newName:p(),position:gr,uri:p()}),I6=w({action:p(),position:gr,timestampMs:B(),uri:p()}),sw=j([T("utf-16"),T("utf-32"),T("utf-8")]),R6=w({_meta:k(p(),_()).nullish(),auth:uD.optional().default({terminal:!1}),elicitation:DD.nullish(),fs:OD.optional().default({readTextFile:!1,writeTextFile:!1}),nes:g6.nullish(),positionEncodings:M(sw).optional(),terminal:Ne().optional().default(!1)}),P6=w({_meta:k(p(),_()).nullish(),audio:Ne().optional().default(!1),embeddedContext:Ne().optional().default(!1),image:Ne().optional().default(!1)}),ow=B().int().gte(0).lte(65535),L6=w({_meta:k(p(),_()).nullish(),clientCapabilities:R6.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:rw.nullish(),protocolVersion:ow}),to=w({end:gr,start:gr}),D6=w({message:p(),range:to,severity:KD,uri:p()}),M6=w({languageId:p(),lastFocusedMs:B().nullish(),uri:p(),visibleRange:to.nullish()}),z6=w({_meta:k(p(),_()).nullish(),diagnostics:M(D6).nullish(),editHistory:M(r6).nullish(),openFiles:M(M6).nullish(),recentFiles:M(a6).nullish(),relatedSnippets:M(u6).nullish(),userActions:M(I6).nullish()}),O6=w({newText:p(),range:to}),N6=w({cursorPosition:gr.nullish(),edits:M(O6),id:p(),uri:p()}),U6=j([N6.and(w({kind:T("edit")})),$6.and(w({kind:T("jump")})),C6.and(w({kind:T("rename")})),m6.and(w({kind:T("searchAndReplace")}))]),F6=w({_meta:k(p(),_()).nullish(),content:p()}),H6=w({_meta:k(p(),_()).nullish()}),bi=j([B(),p()]).nullable();w({_meta:k(p(),_()).nullish(),requestId:bi});const V6=z0(["assistant","user"]),ml=w({_meta:k(p(),_()).nullish(),audience:M(V6).nullish(),lastModified:p().nullish(),priority:B().nullish()}),Z6=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),data:p(),mimeType:p()}),B6=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),data:p(),mimeType:p(),uri:p().nullish()}),W6=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),description:p().nullish(),mimeType:p().nullish(),name:p(),size:B().nullish(),title:p().nullish(),uri:p()}),j6=w({_meta:k(p(),_()).nullish(),optionId:iw}),G6=j([w({outcome:T("cancelled")}),j6.and(w({outcome:T("selected")}))]),q6=w({_meta:k(p(),_()).nullish(),outcome:G6}),Y6=w({_meta:k(p(),_()).nullish()}),K6=w({_meta:k(p(),_()).nullish()}),J6=w({currentValue:Ne()}),X6=p(),aw=p(),Q6=j([T("mode"),T("model"),T("thought_level"),p()]),gf=p(),lw=w({_meta:k(p(),_()).nullish(),description:p().nullish(),name:p(),value:gf}),eM=w({_meta:k(p(),_()).nullish(),group:X6,name:p(),options:M(lw)}),tM=j([M(lw),M(eM)]),nM=w({currentValue:gf,options:tM}),no=bu(j([nM.and(w({type:T("select")})),J6.and(w({type:T("boolean")}))]),w({_meta:k(p(),_()).nullish(),category:Q6.nullish(),description:p().nullish(),id:aw,name:p()})),rM=w({_meta:k(p(),_()).nullish(),configOptions:M(no)}),iM=w({_meta:k(p(),_()).nullish()}),te=p(),sM=w({_meta:k(p(),_()).nullish(),id:p(),sessionId:te}),oM=w({_meta:k(p(),_()).nullish(),sessionId:te}),aM=w({_meta:k(p(),_()).nullish(),sessionId:te}),lM=w({_meta:k(p(),_()).nullish(),sessionId:te}),cw=w({_meta:k(p(),_()).nullish(),args:M(p()).optional(),command:p(),cwd:p().nullish(),env:M(J0).optional(),outputByteLimit:B().nullish(),sessionId:te}),cM=w({_meta:k(p(),_()).nullish(),sessionId:te,uri:p()}),uM=w({_meta:k(p(),_()).nullish(),position:gr,sessionId:te,uri:p(),version:B(),visibleRange:to}),hM=w({_meta:k(p(),_()).nullish(),languageId:p(),sessionId:te,text:p(),uri:p(),version:B()}),dM=w({_meta:k(p(),_()).nullish(),sessionId:te,uri:p()}),pM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu).optional(),sessionId:te}),uw=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),fM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu),sessionId:te}),hw=w({_meta:k(p(),_()).nullish(),limit:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:p(),sessionId:te}),gM=w({_meta:k(p(),_()).nullish(),id:p(),reason:c6.nullish(),sessionId:te}),dw=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),mM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu).optional(),sessionId:te}),vM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),sessionId:te,title:p().nullish(),updatedAt:p().nullish()}),yM=w({_meta:k(p(),_()).nullish(),nextCursor:p().nullish(),sessions:M(vM)}),bM=w({_meta:k(p(),_()).nullish(),title:p().nullish(),updatedAt:p().nullish()}),wM=w({_meta:k(p(),_()).nullish()}),Su=p(),SM=w({_meta:k(p(),_()).nullish(),currentModeId:Su}),_M=w({_meta:k(p(),_()).nullish(),description:p().nullish(),id:Su,name:p()}),_u=w({_meta:k(p(),_()).nullish(),availableModes:M(_M),currentModeId:Su}),ku=w({_meta:k(p(),_()).nullish(),availableModels:M(YD),currentModelId:ff}),kM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish(),sessionId:te}),EM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish()}),xM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish(),sessionId:te}),AM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish()}),TM=w({_meta:k(p(),_()).nullish()}),$M=w({_meta:k(p(),_()).nullish(),additionalDirectories:Y6.nullish(),close:K6.nullish(),fork:iM.nullish(),list:wM.nullish(),resume:TM.nullish()}),CM=bu(j([w({type:T("boolean"),value:Ne()}),w({value:gf})]),w({_meta:k(p(),_()).nullish(),configId:aw,sessionId:te})),IM=w({_meta:k(p(),_()).nullish(),configOptions:M(no)}),RM=w({_meta:k(p(),_()).nullish(),modeId:Su,sessionId:te}),PM=w({_meta:k(p(),_()).nullish()}),LM=w({_meta:k(p(),_()).nullish(),modelId:ff,sessionId:te}),DM=w({_meta:k(p(),_()).nullish()}),MM=w({_meta:k(p(),_()).nullish(),sessionId:te}),zM=j([T("end_turn"),T("max_tokens"),T("max_turn_requests"),T("refusal"),T("cancelled")]),OM=j([T("email"),T("uri"),T("date"),T("date-time")]),NM=w({default:p().nullish(),description:p().nullish(),enum:M(p()).nullish(),format:OM.nullish(),maxLength:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:M(K0).nullish(),pattern:p().nullish(),title:p().nullish()}),UM=w({_meta:k(p(),_()).nullish(),context:z6.nullish(),position:gr,selection:to.nullish(),sessionId:te,triggerKind:v6,uri:p(),version:B()}),FM=w({_meta:k(p(),_()).nullish(),suggestions:M(U6)}),HM=w({_meta:k(p(),_()).nullish(),terminalId:p()}),VM=w({_meta:k(p(),_()).nullish(),exitCode:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:p().nullish()}),pw=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),ZM=w({_meta:k(p(),_()).nullish(),exitStatus:VM.nullish(),output:p(),truncated:Ne()}),BM=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),text:p()}),WM=w({range:to.nullish(),text:p()}),jM=w({_meta:k(p(),_()).nullish(),contentChanges:M(WM),sessionId:te,uri:p(),version:B()});w({method:p(),params:j([oM,hM,jM,cM,dM,uM,sM,gM,Q0]).nullish()});const GM=j([T("full"),T("incremental")]),qM=w({_meta:k(p(),_()).nullish(),syncKind:GM}),YM=w({_meta:k(p(),_()).nullish(),didChange:qM.nullish(),didClose:XD.nullish(),didFocus:QD.nullish(),didOpen:e6.nullish(),didSave:t6.nullish()}),KM=w({_meta:k(p(),_()).nullish(),document:YM.nullish()}),JM=w({_meta:k(p(),_()).nullish(),context:b6.nullish(),events:KM.nullish()}),XM=w({_meta:k(p(),_()).nullish(),auth:VD.optional().default({}),loadSession:Ne().optional().default(!1),mcpCapabilities:WD.optional().default({http:!1,sse:!1}),nes:JM.nullish(),positionEncoding:sw.nullish(),promptCapabilities:P6.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:$M.optional().default({})}),QM=w({_meta:k(p(),_()).nullish(),agentCapabilities:XM.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:rw.nullish(),authMethods:M(gD).optional().default([]),protocolVersion:ow}),ez=w({_meta:k(p(),_()).nullish(),mimeType:p().nullish(),text:p(),uri:p()}),tz=j([ez,yD]),nz=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),resource:tz}),mf=j([BM.and(w({type:T("text")})),B6.and(w({type:T("image")})),Z6.and(w({type:T("audio")})),W6.and(w({type:T("resource_link")})),nz.and(w({type:T("resource")}))]),rz=w({_meta:k(p(),_()).nullish(),content:mf}),Eh=w({_meta:k(p(),_()).nullish(),content:mf,messageId:p().nullish()}),iz=w({_meta:k(p(),_()).nullish(),messageId:p().nullish(),prompt:M(mf),sessionId:te}),sz=w({anyOf:M(K0)}),fw=j([rz.and(w({type:T("content")})),ED.and(w({type:T("diff")})),HM.and(w({type:T("terminal")}))]),gw=p(),mw=w({_meta:k(p(),_()).nullish(),line:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:p()}),vw=j([T("pending"),T("in_progress"),T("completed"),T("failed")]),yw=j([T("read"),T("edit"),T("delete"),T("move"),T("search"),T("execute"),T("think"),T("fetch"),T("switch_mode"),T("other")]),oz=w({_meta:k(p(),_()).nullish(),content:M(fw).optional(),kind:yw.optional(),locations:M(mw).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:vw.optional(),title:p(),toolCallId:gw}),bw=w({_meta:k(p(),_()).nullish(),content:M(fw).nullish(),kind:yw.nullish(),locations:M(mw).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:vw.nullish(),title:p().nullish(),toolCallId:gw}),ww=w({_meta:k(p(),_()).nullish(),options:M(k6),sessionId:te,toolCall:bw}),az=w({_meta:k(p(),_()).nullish(),hint:p()}),lz=az,cz=w({_meta:k(p(),_()).nullish(),description:p(),input:lz.nullish(),name:p()}),uz=w({_meta:k(p(),_()).nullish(),availableCommands:M(cz)}),hz=w({enum:M(p()),type:PD}),dz=j([hz,sz]),pz=w({default:M(p()).nullish(),description:p().nullish(),items:dz,maxItems:B().nullish(),minItems:B().nullish(),title:p().nullish()}),fz=j([NM.and(w({type:T("string")})),S6.and(w({type:T("number")})),ND.and(w({type:T("integer")})),bD.and(w({type:T("boolean")})),pz.and(w({type:T("array")}))]),gz=w({description:p().nullish(),properties:k(p(),fz).optional().default({}),required:M(p()).nullish(),title:p().nullish(),type:RD.optional().default("object")}),mz=w({requestedSchema:gz}),vz=bu(j([mz.and(w({mode:T("form")})),MD.and(w({mode:T("url")}))]),w({_meta:k(p(),_()).nullish(),message:p(),sessionId:te})),yz=w({cachedReadTokens:B().nullish(),cachedWriteTokens:B().nullish(),inputTokens:B(),outputTokens:B(),thoughtTokens:B().nullish(),totalTokens:B()}),bz=w({_meta:k(p(),_()).nullish(),stopReason:zM,usage:yz.nullish(),userMessageId:p().nullish()});j([w({id:bi,result:j([QM,vD,BD,xM,EM,yM,kM,AM,SD,PM,IM,bz,DM,MM,FM,wD,tw])}),w({error:X0,id:bi})]);const wz=w({_meta:k(p(),_()).nullish(),cost:_D.nullish(),size:B(),used:B()}),Sz=j([Eh.and(w({sessionUpdate:T("user_message_chunk")})),Eh.and(w({sessionUpdate:T("agent_message_chunk")})),Eh.and(w({sessionUpdate:T("agent_thought_chunk")})),oz.and(w({sessionUpdate:T("tool_call")})),bw.and(w({sessionUpdate:T("tool_call_update")})),T6.and(w({sessionUpdate:T("plan")})),uz.and(w({sessionUpdate:T("available_commands_update")})),SM.and(w({sessionUpdate:T("current_mode_update")})),rM.and(w({sessionUpdate:T("config_option_update")})),bM.and(w({sessionUpdate:T("session_info_update")})),wz.and(w({sessionUpdate:T("usage_update")}))]),Sw=w({_meta:k(p(),_()).nullish(),sessionId:te,update:Sz});w({method:p(),params:j([Sw,CD,Q0]).nullish()});const _w=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),_z=w({_meta:k(p(),_()).nullish(),exitCode:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:p().nullish()}),kz=w({name:p(),uri:p()}),Ez=w({_meta:k(p(),_()).nullish(),repository:p6.nullish(),workspaceFolders:M(kz).nullish(),workspaceUri:p().nullish()});w({id:bi,method:p(),params:j([L6,mD,ZD,w6,fM,FD,pM,mM,lM,RM,CM,iz,LM,Ez,UM,aM,ew]).nullish()});const kw=w({_meta:k(p(),_()).nullish(),content:p(),path:p(),sessionId:te});w({id:bi,method:p(),params:j([kw,hw,ww,cw,pw,dw,_w,uw,vz,ew]).nullish()});const xz=w({_meta:k(p(),_()).nullish()});j([w({id:bi,result:j([xz,F6,q6,kD,ZM,H6,_z,UD,ID,tw])}),w({error:X0,id:bi})]);var Q;class Az{constructor(t,e){b(this,Q);const r=t(this),i=async(o,a)=>{var c,u,h,f,v,y,E;switch(o){case En.fs_write_text_file:{const x=kw.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,x)}case En.fs_read_text_file:{const x=hw.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,x)}case En.session_request_permission:{const x=ww.parse(a);return r.requestPermission(x)}case En.terminal_create:{const x=cw.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,x)}case En.terminal_output:{const x=pw.parse(a);return(f=r.terminalOutput)==null?void 0:f.call(r,x)}case En.terminal_release:{const x=dw.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,x))??{}}case En.terminal_wait_for_exit:{const x=_w.parse(a);return(y=r.waitForTerminalExit)==null?void 0:y.call(r,x)}case En.terminal_kill:{const x=uw.parse(a);return await((E=r.killTerminal)==null?void 0:E.call(r,x))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Le.methodNotFound(o)}},s=async(o,a)=>{switch(o){case En.session_update:{const c=Sw.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Le.methodNotFound(o)}};m(this,Q,new Tz(i,s,e))}async initialize(t){return await l(this,Q).sendRequest(fe.initialize,t)}async newSession(t){return await l(this,Q).sendRequest(fe.session_new,t)}async loadSession(t){return await l(this,Q).sendRequest(fe.session_load,t)??{}}async unstable_forkSession(t){return await l(this,Q).sendRequest(fe.session_fork,t)}async listSessions(t){return await l(this,Q).sendRequest(fe.session_list,t)}async unstable_resumeSession(t){return await l(this,Q).sendRequest(fe.session_resume,t)}async unstable_closeSession(t){return await l(this,Q).sendRequest(fe.session_close,t)}async setSessionMode(t){return await l(this,Q).sendRequest(fe.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,Q).sendRequest(fe.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,Q).sendRequest(fe.session_set_config_option,t)}async authenticate(t){return await l(this,Q).sendRequest(fe.authenticate,t)??{}}async unstable_logout(t){return await l(this,Q).sendRequest(fe.logout,t)??{}}async prompt(t){return await l(this,Q).sendRequest(fe.session_prompt,t)}async cancel(t){return await l(this,Q).sendNotification(fe.session_cancel,t)}async unstable_startNes(t){return await l(this,Q).sendRequest(fe.nes_start,t)}async unstable_suggestNes(t){return await l(this,Q).sendRequest(fe.nes_suggest,t)}async unstable_closeNes(t){return await l(this,Q).sendRequest(fe.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,Q).sendNotification(fe.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,Q).sendNotification(fe.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,Q).sendNotification(fe.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,Q).sendNotification(fe.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,Q).sendNotification(fe.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,Q).sendNotification(fe.nes_accept,t)}async unstable_rejectNes(t){return await l(this,Q).sendNotification(fe.nes_reject,t)}async extMethod(t,e){return await l(this,Q).sendRequest(t,e)}async extNotification(t,e){return await l(this,Q).sendNotification(t,e)}get signal(){return l(this,Q).signal}get closed(){return l(this,Q).closed}}Q=new WeakMap;var er,Nc,aa,la,cs,us,nn,ca,ve,Ew,hd,xw,Aw,Tw,$w,dd,Eo;class Tz{constructor(t,e,r){b(this,ve);b(this,er,new Map);b(this,Nc,0);b(this,aa);b(this,la);b(this,cs);b(this,us,Promise.resolve());b(this,nn,new AbortController);b(this,ca);m(this,aa,t),m(this,la,e),m(this,cs,r),m(this,ca,new Promise(i=>{l(this,nn).signal.addEventListener("abort",()=>i())})),d(this,ve,Ew).call(this)}get signal(){return l(this,nn).signal}get closed(){return l(this,ca)}async sendRequest(t,e){d(this,ve,dd).call(this);const r=Bu(this,Nc)._++,i=new Promise((s,o)=>{l(this,er).set(r,{resolve:s,reject:o})});return await d(this,ve,Eo).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){d(this,ve,dd).call(this),await d(this,ve,Eo).call(this,{jsonrpc:"2.0",method:t,params:e})}}er=new WeakMap,Nc=new WeakMap,aa=new WeakMap,la=new WeakMap,cs=new WeakMap,us=new WeakMap,nn=new WeakMap,ca=new WeakMap,ve=new WeakSet,Ew=async function(){let t;try{const e=l(this,cs).readable.getReader();try{for(;!l(this,nn).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{d(this,ve,xw).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&d(this,ve,Eo).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{d(this,ve,hd).call(this,t)}},hd=function(t){if(l(this,nn).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,er).values())r.reject(e);l(this,er).clear(),l(this,nn).abort(e)},xw=async function(t){if("method"in t&&"id"in t){const e=await d(this,ve,Aw).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await d(this,ve,Eo).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await d(this,ve,Tw).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?d(this,ve,$w).call(this,t):console.error("Invalid message",{message:t})},Aw=async function(t,e){try{return{result:await l(this,aa).call(this,t,e)??null}}catch(r){if(r instanceof Le)return r.toResult();if(r instanceof hv)return Le.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 Le.internalError(i?JSON.parse(i):{}).toResult()}catch{return Le.internalError({details:i}).toResult()}}},Tw=async function(t,e){try{return await l(this,la).call(this,t,e),{result:null}}catch(r){if(r instanceof Le)return r.toResult();if(r instanceof hv)return Le.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 Le.internalError(i?JSON.parse(i):{}).toResult()}catch{return Le.internalError({details:i}).toResult()}}},$w=function(t){const e=l(this,er).get(t.id);if(e){if("result"in t)e.resolve(t.result);else if("error"in t){const{code:r,message:i,data:s}=t.error;e.reject(new Le(r,i,s))}l(this,er).delete(t.id)}else console.error("Got response to unknown request",t.id)},dd=function(){if(l(this,nn).signal.aborted)throw l(this,nn).signal.reason??new Error("ACP connection closed")},Eo=async function(t){return m(this,us,l(this,us).then(async()=>{const e=l(this,cs).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{d(this,ve,hd).call(this,e)})),l(this,us)};class Le extends Error{constructor(e,r,i){super(r);g(this,"code");g(this,"data");this.code=e,this.name="RequestError",this.data=i}static parseError(e,r){return new Le(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Le(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Le(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Le(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Le(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Le(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Le(-32002,`Resource not found${e?`: ${e}`:""}`,e&&{uri:e})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const $z=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,Cz=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,Iz=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,Rz=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,Pz=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,Lz="single_session",Dz={name:"television-acp-client",version:"0.0.0"},Cw="agent:main:television",Mz=gl(It);var hs,rn,pt,sn,tr,Mt,Pn,on,an,nr,zt,ds,ps,ln,et,Ln,fs,Kr,Dn,rr,ua,Ot,cn,Uc,un,$,pd,Iw,Rw,Pw,rc,Lw,Dw,Mw,zw,Ow,Nw,Uw,Rr,ji,Gi,An,Fw,qi,fd,gd,ic,Hw,sc,md,vd,ha,da,oc,Yi,yd,Vw;class zz extends Mz{constructor(e){super();b(this,$);b(this,hs,"disconnected");b(this,rn,null);b(this,pt,new Map);b(this,sn,null);b(this,tr,null);b(this,Mt,null);b(this,Pn,null);b(this,on,null);b(this,an,null);b(this,nr);b(this,zt,null);b(this,ds,0);b(this,ps,1);b(this,ln,null);b(this,et,null);b(this,Ln,!1);b(this,fs,!1);b(this,Kr,!1);b(this,Dn,null);b(this,rr,new Set);b(this,ua);b(this,Ot);b(this,cn);b(this,Uc,e=>{d(this,$,Rw).call(this,e)});b(this,un,null);b(this,ha,()=>{d(this,$,Yi).call(this,"ACP bridge websocket closed")});b(this,da,()=>{d(this,$,Yi).call(this,"ACP bridge websocket error")});m(this,Ot,e),m(this,cn,e.sessionMode??Lz),m(this,nr,e.mappedSessionStore??Oz()),m(this,ua,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,hs)}get messages(){return[...l(this,pt).values()]}get enabled(){return l(this,Ot).enabled??!1}setToken(e){l(this,Ot).token=e??""}setEnabled(e){l(this,Ot).enabled=e,e||(d(this,$,oc).call(this),m(this,rn,null),d(this,$,An).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,tr)===null&&(m(this,rn,null),m(this,tr,d(this,$,Iw).call(this)));try{await l(this,tr),await d(this,$,rc).call(this)}catch(e){throw d(this,$,Yi).call(this,xh(e)),e}}}dispose(){d(this,$,oc).call(this),m(this,rn,null),d(this,$,An).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await d(this,$,pd).call(this,"ready")),(l(this,on)===null||l(this,zt)!==d(this,$,sc).call(this))&&await d(this,$,rc).call(this),this.status!=="ready")throw new Error("ACPClient is not ready to send a new message");const r=e.text.trim();if(!r)throw new Error("Cannot send an empty message");d(this,$,ji).call(this,{id:d(this,$,qi).call(this,"user"),kind:"user",text:r,status:"final"}),d(this,$,An).call(this,"running");try{const i=await d(this,$,ic).call(this).prompt({sessionId:d(this,$,gd).call(this),prompt:[{type:"text",text:d(this,$,Fw).call(this,r)}]});d(this,$,Rr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),d(this,$,An).call(this,"ready")}catch(i){throw d(this,$,Vw).call(this)||(d(this,$,Rr).call(this,"error"),d(this,$,An).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await d(this,$,pd).call(this,"ready"));const e=d(this,$,sc).call(this);((r=l(this,an))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,nr).clearActualSessionId(e):m(this,ds,l(this,ds)+1),m(this,Mt,null),m(this,Pn,null),m(this,on,null),m(this,zt,null),d(this,$,yd).call(this)}async cancel(){this.status==="running"&&(d(this,$,An).call(this,"cancelling"),await d(this,$,ic).call(this).cancel({sessionId:d(this,$,gd).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,et)===null)return;m(this,et,null),m(this,Ln,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,et))==null?void 0:s.screenID)===r.screenID&&((o=l(this,et))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,et))==null?void 0:a.screenID)??null;if(m(this,et,r),l(this,cn)==="single_session"){(!l(this,zt)||i!==r.screenID)&&m(this,Ln,!0);return}l(this,zt)!==d(this,$,md).call(this,r.screenID)&&(m(this,Mt,null),m(this,Pn,null),l(this,sn)&&this.status==="ready"&&d(this,$,rc).call(this).catch(c=>{d(this,$,Yi).call(this,xh(c))}))}}hs=new WeakMap,rn=new WeakMap,pt=new WeakMap,sn=new WeakMap,tr=new WeakMap,Mt=new WeakMap,Pn=new WeakMap,on=new WeakMap,an=new WeakMap,nr=new WeakMap,zt=new WeakMap,ds=new WeakMap,ps=new WeakMap,ln=new WeakMap,et=new WeakMap,Ln=new WeakMap,fs=new WeakMap,Kr=new WeakMap,Dn=new WeakMap,rr=new WeakMap,ua=new WeakMap,Ot=new WeakMap,cn=new WeakMap,Uc=new WeakMap,un=new WeakMap,$=new WeakSet,pd=async function(e){if(this.status!==e){if(this.status==="disposed")throw new Error("ACPClient has been disposed");if(this.status==="disconnected")throw new Error(l(this,rn)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",o)},o=()=>{if(this.status===e){s(),r();return}if(this.status==="disposed"){s(),i(new Error("ACPClient has been disposed"));return}this.status==="disconnected"&&(s(),i(new Error(l(this,rn)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},Iw=async function(){try{const{stream:e,socket:r,metadata:i}=await Hz({serverURL:l(this,Ot).serverURL,token:l(this,Ot).token,createSocket:l(this,ua),onDisconnect:l(this,Uc)});m(this,an,i),m(this,un,r),r.addEventListener("close",l(this,ha)),r.addEventListener("error",l(this,da)),m(this,sn,new Az(s=>({connection:s,sessionUpdate:async o=>{await d(this,$,Dw).call(this,o)},requestPermission:async o=>d(this,$,Mw).call(this,o)}),e)),await l(this,sn).initialize({protocolVersion:cD,clientCapabilities:{},clientInfo:Dz})}catch(e){throw e}},Rw=function(e){d(this,$,Yi).call(this,xh(e))},Pw=function(e){const r=e==null?void 0:e.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})`)},rc=async function(){const e=d(this,$,sc).call(this);if(l(this,Mt)&&l(this,Pn)===e){await l(this,Mt);return}m(this,Pn,e),m(this,Mt,d(this,$,Lw).call(this,e)),await l(this,Mt)},Lw=async function(e){var c;const r=d(this,$,ic).call(this);d(this,$,yd).call(this);let i,s=!1,o=null;const a={cwd:d(this,$,Hw).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(m(this,Kr,!0),m(this,Dn,null),((c=l(this,an))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,nr).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(Nz(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,nr).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,nr).setActualSessionId(e,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:e}),i=e,s=l(this,pt).size>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{m(this,Kr,!1),m(this,Dn,null),d(this,$,Rr).call(this,"final")}d(this,$,Pw).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),m(this,on,i),m(this,zt,e),m(this,fs,!0),s?(l(this,rr).add(e),l(this,cn)==="single_session"&&m(this,Ln,!1)):(l(this,rr).delete(e),m(this,Ln,l(this,cn)==="single_session")),m(this,rn,null),d(this,$,An).call(this,"ready")},Dw=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&d(this,$,Uw).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&d(this,$,zw).call(this,r.content.text);return;case"tool_call":d(this,$,Ow).call(this,r);return;case"tool_call_update":d(this,$,Nw).call(this,r);return;case"agent_thought_chunk":return;default:return}},Mw=async function(e){return{outcome:{outcome:"cancelled"}}},zw=function(e){m(this,Dn,null);const r=Fz(e);if(!r)return;if(!l(this,ln)){const s={id:d(this,$,qi).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};m(this,ln,s.id),d(this,$,ji).call(this,s);return}const i=l(this,pt).get(l(this,ln));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");d(this,$,Gi).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Ow=function(e){d(this,$,Rr).call(this,"final");const r=d(this,$,fd).call(this,e.toolCallId),i=_v("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??d(this,$,qi).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:e.title,toolKind:e.kind??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:e.locations??(r==null?void 0:r.locations)};if(r){d(this,$,Gi).call(this,s);return}d(this,$,ji).call(this,s)},Nw=function(e){const r=d(this,$,fd).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=_v(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??d(this,$,qi).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:(r==null?void 0:r.title)??e.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:o,locations:e.locations??(r==null?void 0:r.locations)};if(r){d(this,$,Gi).call(this,a);return}d(this,$,ji).call(this,a)},Uw=function(e){if(d(this,$,Rr).call(this,"final"),!e)return;const r=l(this,Kr)?l(this,Dn):null;if(!r){const s=Sv(e);if(!s)return;const o={id:d(this,$,qi).call(this,"user"),kind:"user",text:s,status:"final"};d(this,$,ji).call(this,o),l(this,Kr)&&m(this,Dn,o.id);return}const i=l(this,pt).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");d(this,$,Gi).call(this,{...i,text:Sv(`${i.text}${e}`)})},Rr=function(e){if(!l(this,ln))return;const r=l(this,pt).get(l(this,ln));(r==null?void 0:r.kind)==="assistant"&&d(this,$,Gi).call(this,{...r,status:e}),m(this,ln,null)},ji=function(e){l(this,pt).set(e.id,e),this.dispatchEvent(new bh("messages-changed"))},Gi=function(e){l(this,pt).set(e.id,e),this.dispatchEvent(new bh("messages-changed"))},An=function(e){l(this,hs)!==e&&(m(this,hs,e),this.dispatchEvent(new eC("status-changed")))},Fw=function(e){const r=l(this,zt);if(!r)return e;const i=l(this,et)?l(this,cn)==="single_session"?l(this,Ln)||!l(this,rr).has(r):!l(this,rr).has(r):!1,s=l(this,fs)&&(l(this,et)!==null||Rz.test(e));if(!(s||i))return e;s&&m(this,fs,!1),i&&(m(this,Ln,!1),l(this,rr).add(r));const a=["[Television screen context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."];return l(this,et)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,et).screenID}`),a.push(`screen_name: ${l(this,et).screenName??""}`),a.push("When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.")):a.push("There is currently no active Television screen."),a.push("[/Television screen context]","",e),a.join(`
43
- `)},qi=function(e){const r=`${e}-${l(this,ps)}`;return m(this,ps,l(this,ps)+1),r},fd=function(e){for(const r of l(this,pt).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},gd=function(){if(!l(this,on))throw new Error("ACP session is not ready");return l(this,on)},ic=function(){if(!l(this,sn))throw new Error("ACP connection is not ready");return l(this,sn)},Hw=function(){var r;const e=(r=l(this,an))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},sc=function(){var r;if(l(this,cn)==="single_session")return d(this,$,vd).call(this,`${Cw}-${(l(this,Ot).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,et))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return d(this,$,md).call(this,e)},md=function(e){return d(this,$,vd).call(this,Uz(l(this,cn),e,l(this,Ot).clientGUID??"default-client"))},vd=function(e){var r;return((r=l(this,an))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,ds)>0?`${e}:epoch-${l(this,ds)}`:e},ha=new WeakMap,da=new WeakMap,oc=function(){m(this,sn,null),m(this,tr,null),m(this,Mt,null),m(this,Pn,null),m(this,on,null),m(this,zt,null),m(this,an,null),l(this,un)&&(l(this,un).removeEventListener("close",l(this,ha)),l(this,un).removeEventListener("error",l(this,da)),l(this,un).close(),m(this,un,null))},Yi=function(e){const r=l(this,sn)!==null||l(this,tr)!==null||l(this,Mt)!==null||l(this,Pn)!==null||l(this,on)!==null||l(this,zt)!==null||l(this,an)!==null||l(this,un)!==null;this.disposed||this.status==="disconnected"&&!r||(d(this,$,Rr).call(this,"error"),d(this,$,oc).call(this),m(this,rn,e??null),d(this,$,An).call(this,"disconnected"))},yd=function(){const e=l(this,pt).size>0;m(this,ln,null),m(this,Dn,null),m(this,ps,1),l(this,pt).clear(),e&&this.dispatchEvent(new bh("messages-changed"))},Vw=function(){return this.status==="disconnected"};function Oz(){const n=new Map;return{getActualSessionId(t){return n.get(t)??null},setActualSessionId(t,e){n.set(t,e)},clearActualSessionId(t){n.delete(t)}}}function Nz(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function Uz(n,t,e){return n==="single_session"?`${Cw}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function Zw(n){return n.replace(/^(?:\s*\n)+/,"")}function Sv(n){let t=n;return t=t.replace($z,""),t=t.replace(Cz,""),t=t.replace(Iz,""),t=Zw(t),t}function Fz(n){let t=n;return t=t.replace(Pz,""),t=Zw(t),t}function _v(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function Hz(n){const t=n.createSocket(Bz(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const f=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},v=x=>{const C=Zz(x);if(!C)return;let L;try{L=JSON.parse(C)}catch(R){const W=R instanceof Error?R:new Error(String(R));i(W),u.error(W);return}switch(L.type){case"acp-bridge-status":if(L.status==="ready"){let R;try{R=Vz(L)}catch(W){const N=W instanceof Error?W:new Error(String(W));e||i(N),u.error(N);return}e||(e=!0,r(R));return}if(L.status==="error"||L.status==="exited"){const R=new Error(L.error??`ACP bridge ${L.status}`);e||i(R),u.error(R)}return;case"acp-bridge-message":u.enqueue(L.message);return}},y=()=>{var C;if(h)return;h=!0;const x=new Error("ACP bridge websocket closed");e||i(x),(C=n.onDisconnect)==null||C.call(n,x),u.close()},E=()=>{var C;if(h)return;h=!0;const x=new Error("ACP bridge websocket error");e||i(x),(C=n.onDisconnect)==null||C.call(n,x),u.error(x)};t.addEventListener("open",f),t.addEventListener("message",v),t.addEventListener("close",y),t.addEventListener("error",E)}}),a=new WritableStream({async write(u){await s,t.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){t.close()},abort(){t.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:t,metadata:c}}function Vz(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0)return{agent:t,sessionIdStrategy:e,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function Zz(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 t=n.data;if(typeof t=="string")return t;if(t instanceof Uint8Array)return new TextDecoder().decode(t);if(Array.isArray(t))return Buffer.concat(t).toString("utf8")}return null}function Bz(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/acp",e.search="",e.searchParams.set("token",t),e.hash="",e.toString()}function xh(n){return n instanceof Error?n.message:String(n)}const kv="television.acpClientGUID",Ev="television.acpMappedSessions",xv=1;var gs;class Wz{constructor(){b(this,gs,new Map)}getActualSessionId(t){return l(this,gs).get(t)??null}setActualSessionId(t,e){l(this,gs).set(t,e)}clearActualSessionId(t){l(this,gs).delete(t)}}gs=new WeakMap;var ms,pa,mt,ac,lc,bd;class jz{constructor(t,e){b(this,mt);b(this,ms);b(this,pa);m(this,ms,t),m(this,pa,e)}getActualSessionId(t){const e=d(this,mt,lc).call(this)[d(this,mt,ac).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=d(this,mt,lc).call(this);r[d(this,mt,ac).call(this,t)]=e,d(this,mt,bd).call(this,r)}clearActualSessionId(t){const e=d(this,mt,lc).call(this);delete e[d(this,mt,ac).call(this,t)],d(this,mt,bd).call(this,e)}}ms=new WeakMap,pa=new WeakMap,mt=new WeakSet,ac=function(t){return JSON.stringify([l(this,pa),t])},lc=function(){const t=l(this,ms).getItem(Ev);if(!t)return{};let e;try{e=JSON.parse(t)}catch{return{}}if(typeof e!="object"||e===null||Array.isArray(e))return{};const r=e;return r.version!==xv?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},bd=function(t){const e={version:xv,entries:t};l(this,ms).setItem(Ev,JSON.stringify(e))};function Bw(){return typeof window>"u"?null:window.localStorage}function Gz(n){const t=n.getItem(kv);if(t)return t;const e=fu().toLowerCase();return n.setItem(kv,e),e}const Av=4401,qz=401,Hl=1e3,Yz=3e4;class Oo extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class Ww extends It{constructor(e){var o,a;super();g(this,"url");g(this,"name");g(this,"telemetryMeta");g(this,"status","unauthorized");g(this,"screens",new Map);g(this,"client");g(this,"acpClient");g(this,"_token");g(this,"attempting",!1);g(this,"nextRetryAt",null);g(this,"hasEverConnected",!1);g(this,"hasAuthRejected",!1);g(this,"bootState","pending");g(this,"serverVersion",null);g(this,"updateState",null);g(this,"decideBoot");g(this,"navigationPending");g(this,"createSocket");g(this,"createClient");g(this,"socket",null);g(this,"connectAttempt",0);g(this,"autoReconnect",!1);g(this,"retryTimer",null);g(this,"retryDelay",Hl);g(this,"visibilityEventTarget");g(this,"networkEventTarget");g(this,"onVisibilityChange");g(this,"onNetworkOnline");g(this,"telemetryActivityAgent");this.url=ee(e.url),this.name=e.name,this.decideBoot=e.decideBoot??null,this.navigationPending=e.navigationPending??(()=>!1),this._token=e.token??null,this.telemetryMeta=e.telemetryMeta??null,this.createSocket=e.createSocket??(c=>new WebSocket(c)),this.createClient=e.createClient??((c,u,h)=>new TC(c,{token:u??void 0,onUnauthorized:()=>this.handleAuthRejected(),...h?{telemetryMeta:h}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=e.mappedSessionStore??(e.acpStorage?new jz(e.acpStorage,this.url):new Wz);this.acpClient=new zz({serverURL:this.url,token:this._token??"",...e.createACPSocket?{createSocket:e.createACPSocket}:e.createSocket?{createSocket:e.createSocket}:{},...e.clientGUID?{clientGUID:e.clientGUID}:{},mappedSessionStore:r}),this.visibilityEventTarget=e.visibilityEventTarget!==void 0?e.visibilityEventTarget:typeof document<"u"?document:null,this.networkEventTarget=e.networkEventTarget!==void 0?e.networkEventTarget:typeof window<"u"?window:null,this.onVisibilityChange=()=>{this.isPageVisible()&&this.kickReconnect()},this.onNetworkOnline=()=>{this.kickReconnect()},(o=this.visibilityEventTarget)==null||o.addEventListener("visibilitychange",this.onVisibilityChange),(a=this.networkEventTarget)==null||a.addEventListener("online",this.onNetworkOnline);const i=e.telemetryDocumentTarget!==void 0?e.telemetryDocumentTarget:typeof document<"u"?document:null,s=e.telemetryWindowTarget!==void 0?e.telemetryWindowTarget:typeof window<"u"?window:null;this.telemetryActivityAgent=this.telemetryMeta&&i&&s?oD({meta:this.telemetryMeta,documentTarget:i,windowTarget:s,send:c=>this.sendTelemetryActivity(c)}):null}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null,this.telemetryMeta)}async connect(e){this._token=e,this.hasAuthRejected=!1,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Hl,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i,s;this.autoReconnect=!1,this.connectAttempt+=1,this.cancelRetryTimer(),(e=this.socket)==null||e.close(),this.socket=null,this.setStatus("unauthorized"),(r=this.visibilityEventTarget)==null||r.removeEventListener("visibilitychange",this.onVisibilityChange),(i=this.networkEventTarget)==null||i.removeEventListener("online",this.onNetworkOnline),(s=this.telemetryActivityAgent)==null||s.stop(),this.acpClient.dispose()}getViewURL(e){const r=Tc(e,{electron:Wt()});return Wt()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(e){const r=Tc(e,{electron:Wt()}).contentURL;return r===null?null:new URL(r,this.url).toString()}async createScreen(e){const{screen:r}=await this.client.screens.create({name:e});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(e){switch(e.type){case"screen-created":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new So("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new So("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new So("screens-changed"));break;case"artifact-created":{const r=this.screens.get(e.screenID);r&&!ec(r).includes(e.artifact.id)&&(r.layout=[...r.layout,Wb(e.artifact.id)]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=Mb(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return Kz(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1,this.bootState="pending";const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token,this.telemetryMeta),this.setStatus("disconnected"),this.dispatchEvent(new ie("change"));const r=this.createSocket(Jz(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{var f;a||this.connectAttempt!==e||(a=!0,this.retryDelay=Hl,this.hasEverConnected=!0,this.setStatus("connected"),(f=this.telemetryActivityAgent)==null||f.start(),s())},u=f=>{a||this.connectAttempt!==e||(a=!0,o(f))},h=async()=>{const f=this.hasEverConnected;try{const[{screens:v},y]=await Promise.all([this.client.screens.list(),this.client.display.get()]);this.screens=new Map(v.map(E=>[E.id,structuredClone(E)])),this.acpClient.setEnabled(y.acpEnabled),this.dispatchEvent(new ie("change")),f&&this.dispatchEvent(new So("screens-changed")),this.dispatchEvent(new nd("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:y.activeScreenID}})),c(),f&&this.connectAttempt===e&&this.dispatchEvent(new Pb("server-reconnected",{serverURL:this.url}))}catch(v){if(rO(v)){u(new Oo);return}u(v instanceof Error?v:new Error(String(v)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||h())}),r.addEventListener("message",f=>{const v=nO(f);if(!v)return;if(v.type==="server-status"){const E=v;this.serverVersion=E.version,this.updateState=E.update??null;let x=!1,C=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===e&&(this.decideBoot(E)==="boot"?(this.bootState="booted",x=!0):(this.bootState="halted",this.attempting=!1,C=!0)),this.dispatchEvent(new Lb("server-status",{serverURL:this.url,message:E})),x?this.navigationPending()||h():C&&this.dispatchEvent(new ie("change"));return}if(!tO(v.type))return;const y=v;this.applyServerEvent(y),this.dispatchEvent(new nd("server-event",{serverURL:this.url,event:y}))}),r.addEventListener("close",f=>{if(this.connectAttempt!==e)return;this.socket=null;const v=Xz(f);if(!a){u(v===Av?new Oo:new Error("Connection closed before initialization"));return}if(v===Av){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===e){if(a){this.handleTransportFailure(new Error("WebSocket error"));return}u(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAuthRejected(){this.hasAuthRejected=!0,this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized")}handleAttemptFailure(e){if(e instanceof Oo){this.handleAuthRejected();return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(e){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const e=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,Yz),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new ie("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new ie("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Hl,this.attempt().catch(()=>{})))}sendTelemetryActivity(e){var r;this.status==="connected"&&((r=this.socket)==null||r.send(JSON.stringify(e)))}sendTelemetrySignal(e,r){var s;if(!this.telemetryMeta||this.status!=="connected"&&this.bootState!=="halted")return;const i={type:gC,clientId:this.telemetryMeta.clientId,event:e,properties:r};(s=this.socket)==null||s.send(JSON.stringify(i))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new ie("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function Kz(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function Jz(n,t,e=null){const r=new URL(n);if(r.protocol=r.protocol==="https:"?"wss:":"ws:",r.pathname="/events",r.search="",t&&r.searchParams.set("token",t),e)for(const[i,s]of sD(e))r.searchParams.set(i,s);return r.hash="",r.toString()}function Xz(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const Qz={"artifact-created":!0,"artifact-updated":!0,"artifact-content-changed":!0,"artifact-removed":!0,"screen-created":!0,"screen-updated":!0,"screen-removed":!0,"screen-changed":!0,"theme-changed":!0,"artifact-focus":!0},eO=new Set(Object.keys(Qz));function tO(n){return eO.has(n)}function nO(n){const t=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return typeof e!="object"||e===null||!("type"in e)||typeof e.type!="string"?null:e}function rO(n){return n instanceof of&&n.status===qz}const iO="Local";var fa,wd;class sO extends It{constructor(e){super();b(this,fa);g(this,"servers",new Map);g(this,"localServerURL");g(this,"clientGUID");g(this,"acpStorage");g(this,"telemetryMeta");g(this,"localStore");g(this,"bootBarrier");g(this,"navigationPending");g(this,"createSocket");g(this,"lastActiveServerURL");g(this,"serverListeners",new Map);g(this,"handleLocalStoreChange",()=>{const e=this.localStore.get().activeServerURL;e!==this.lastActiveServerURL&&(this.lastActiveServerURL=e,this.dispatchEvent(new ie("change")))});this.localStore=e.localStore,this.bootBarrier=e.bootBarrier??null,this.navigationPending=e.navigationPending??null,this.localServerURL=e.localServerURL?ee(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?Bw():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?Gz(r):fu().toLowerCase()),this.telemetryMeta=e.telemetryMeta??null,this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const e=this.localStore.get().activeServerURL;return e===null?null:this.servers.get(e)??null}add(e){const r=ee(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e),this.bootBarrier&&ee(this.bootBarrier.serverURL)===r&&(e.decideBoot=this.bootBarrier.decideBoot),this.navigationPending!==null&&(e.navigationPending=this.navigationPending);const s=()=>{this.dispatchEvent(new ie("change"))},o=h=>{this.dispatchEvent(new nd("server-event",{serverURL:h.serverURL,event:h.event}))},a=()=>{this.dispatchEvent(new So("screens-changed"))},c=h=>{this.dispatchEvent(new Pb("server-reconnected",{serverURL:h.serverURL}))},u=h=>{this.dispatchEvent(new Lb("server-status",{serverURL:h.serverURL,message:h.message}))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),e.addEventListener("server-reconnected",c),e.addEventListener("server-status",u),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a,onServerReconnected:c,onServerStatus:u}),this.dispatchEvent(new ie("change"))}remove(e){const r=ee(e);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),i.removeEventListener("server-reconnected",s.onServerReconnected),i.removeEventListener("server-status",s.onServerStatus),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 ie("change"))}getStoredAuthToken(e){return Sh(this.localStore.get(),e)}setStoredAuthToken(e,r){this.localStore.set(HC(this.localStore.get(),e,r))}clearStoredAuthToken(e){const r=this.localStore.get(),i=VC(r,e);i!==r&&this.localStore.set(i)}setActive(e){const r=this.localStore.get(),i=e?ee(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?ee(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>ee(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:iO}]})}const s=this.localStore.get().servers;for(const a of s){const c=ee(a.url),h=i!==null&&c===i?r??Sh(this.localStore.get(),c):Sh(this.localStore.get(),c),f=d(this,fa,wd).call(this,{url:a.url,name:a.name,token:h});this.add(f),f.connect(h).catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(e,r){const i=ee(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>ee(a.url)!==i),{url:i,name:r}]});const o=d(this,fa,wd).call(this,{url:i,name:r,token:this.getStoredAuthToken(i)});this.add(o),this.setActive(o),o.connect(o.token).catch(()=>{})}removeServer(e){this.remove(e)}}fa=new WeakSet,wd=function(e){return new Ww({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage,telemetryMeta:this.telemetryMeta})};var ga;class oO extends It{constructor(){super();b(this,ga,e=>{const r=aO(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new Q$("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,ga))}dispose(){document.removeEventListener("keydown",l(this,ga))}}ga=new WeakMap;function aO(n){for(const[t,e]of Object.entries($C))if(lO(n,e.trigger))return t;return null}function lO(n,t){return!(n.key.toLowerCase()!==t.key.toLowerCase()||n.metaKey!==!!t.meta||n.ctrlKey!==!!t.ctrl||n.shiftKey!==!!t.shift||n.altKey!==!!t.alt)}const Sd="tv-nav:",Zs="tv-reload",Tv=100,cO=1e3,uO=60,hO=60,dO=24,pO=30,fO=pO*dO*hO*uO*cO;function Fn(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Zs);return t.searchParams.delete(Zs),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var ma,vs,de,oe,Jr,Ae,jw,Gn,Gw,_d,kd;class gO extends It{constructor(e,r){super();b(this,Ae);b(this,ma);b(this,vs);b(this,de,[]);b(this,oe,-1);b(this,Jr,0);m(this,ma,e),m(this,vs,Fn(r)),d(this,Ae,jw).call(this)}get currentURL(){var e;return l(this,oe)===-1?null:((e=l(this,de)[l(this,oe)])==null?void 0:e.url)??null}get canGoBack(){return l(this,oe)>-1}get canGoForward(){return l(this,oe)<l(this,de).length-1}get entries(){return l(this,de).map(e=>({...e}))}get cursor(){return l(this,oe)}navigate(e){const r=Fn(e);if(r===l(this,vs)){if(l(this,oe)===-1)return;m(this,oe,-1),d(this,Ae,Gn).call(this);return}l(this,oe)<l(this,de).length-1&&m(this,de,l(this,de).slice(0,l(this,oe)+1)),l(this,de).push({url:r}),m(this,oe,l(this,de).length-1),d(this,Ae,_d).call(this),d(this,Ae,Gn).call(this)}replace(e){var i;if(l(this,oe)===-1){this.navigate(e);return}const r=Fn(e);if(r===l(this,vs)){m(this,de,l(this,de).filter((s,o)=>o!==l(this,oe))),m(this,oe,-1),d(this,Ae,Gn).call(this);return}((i=l(this,de)[l(this,oe)])==null?void 0:i.url)!==r&&(m(this,de,l(this,de).map((s,o)=>o===l(this,oe)?{url:r}:s)),d(this,Ae,Gn).call(this))}back(){l(this,oe)!==-1&&(m(this,oe,l(this,oe)-1),d(this,Ae,Gn).call(this))}forward(){this.canGoForward&&(m(this,oe,l(this,oe)+1),d(this,Ae,Gn).call(this))}reset(){l(this,oe)===-1&&l(this,de).length===0||(m(this,de,[]),m(this,oe,-1),d(this,Ae,Gn).call(this))}}ma=new WeakMap,vs=new WeakMap,de=new WeakMap,oe=new WeakMap,Jr=new WeakMap,Ae=new WeakSet,jw=function(){const e=localStorage.getItem(l(this,Ae,kd));if(e!==null)try{const r=JSON.parse(e);if(!qw(r))return;m(this,de,r.entries.map(i=>({url:i.url}))),m(this,oe,r.cursor),m(this,Jr,r.lastWritten),d(this,Ae,_d).call(this)}catch{m(this,de,[]),m(this,oe,-1),m(this,Jr,0)}},Gn=function(){m(this,Jr,Date.now());try{localStorage.setItem(l(this,Ae,kd),JSON.stringify(d(this,Ae,Gw).call(this)))}catch(e){if(!yO(e))throw e}this.dispatchEvent(new ie("change"))},Gw=function(){return{v:1,entries:l(this,de).map(e=>({...e})),cursor:l(this,oe),lastWritten:l(this,Jr)}},_d=function(){if(l(this,de).length<=Tv)return;const e=l(this,de).length-Tv;m(this,de,l(this,de).slice(e)),m(this,oe,Math.max(-1,l(this,oe)-e))},kd=function(){return mO(l(this,ma))};function mO(n){return`${Sd}${n}`}function vO(n){const t=Date.now()-fO,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(Sd)))continue;const s=i.slice(Sd.length),o=localStorage.getItem(i);if(o===null)continue;let a;try{a=JSON.parse(o)}catch{e.push(i);continue}if(!qw(a)){e.push(i);continue}!n.has(s)&&a.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function yO(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function qw(n){if(typeof n!="object"||n===null)return!1;const t=n;if(t.v!==1||!Array.isArray(t.entries))return!1;const e=t.cursor;return typeof e!="number"||!Number.isInteger(e)||typeof t.lastWritten!="number"||!Number.isFinite(t.lastWritten)||e<-1||e>=t.entries.length?!1:t.entries.every(r=>typeof r=="object"&&r!==null&&typeof r.url=="string")}const bO="0.1.184";function vf(n=bO){return n!==void 0&&n.length>0?n:"0.0.0"}function yf(){let n=!1;return{get pending(){return n},begin(t){n||(n=!0,t())}}}const Ed="tv-reload-attempted";function wO(n){return n.originMatch?n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:RC(n.bundleVersion,n.serverVersion)?n.marker!==null&&n.marker.serverVersion===n.serverVersion?{action:"none"}:{action:"reload",marker:{serverVersion:n.serverVersion,fromVersion:n.bundleVersion}}:{action:"none"}:{action:"none"}}function SO(n){const t=n.getItem(Ed);if(t===null)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object")return null;const r=e;return typeof r.serverVersion!="string"||typeof r.fromVersion!="string"?null:{serverVersion:r.serverVersion,fromVersion:r.fromVersion}}function _O(n){const t=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,e=n.reload??(()=>location.reload()),r=n.navigationLatch??yf(),i=n.bundleVersion??vf();if(t===null)return{dispose(){}};let s=null;const o=()=>{if(s===null)return;const u=n.manager.servers.get(n.primaryServerURL);if(!u||u.status!=="connected")return;const h=s;s=null,u.sendTelemetrySignal("client_autoreloaded",{from_version:h.fromVersion,to_version:h.toVersion})},a=u=>{if(r.pending)return;const h=wO({bundleVersion:i,serverVersion:u.message.version,originMatch:u.serverURL===n.primaryServerURL,marker:SO(t)});switch(h.action){case"reload":t.setItem(Ed,JSON.stringify(h.marker)),r.begin(e);return;case"signal-autoreloaded":t.removeItem(Ed),s={fromVersion:h.fromVersion,toVersion:h.toVersion},o();return;case"none":return}},c=()=>{o()};return n.manager.addEventListener("server-status",a),n.manager.addEventListener("change",c),{dispose(){n.manager.removeEventListener("server-status",a),n.manager.removeEventListener("change",c)}}}function kO(n){const t=Wt(n.search),e=G0(n.search),r=e!==null&&af(e)?e:null;return{electron:t,shellVersion:r}}function EO(n){return!n.electron||n.requiredDesktopVersion===null||!af(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===rd?!1:qb(n.requiredDesktopVersion,n.shellVersion)}const xO=`# Desktop app upgrade required
42
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of n.seen.entries()){const f=h[1];if(t===h[0]){s(h);continue}if(n.external){const y=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&y){s(h);continue}}if((u=n.metadataRegistry.get(h[0]))==null?void 0:u.id){s(h);continue}if(f.cycle){s(h);continue}if(f.count>1&&n.reused==="ref"){s(h);continue}}}function A0(n,t){var o,a,c;const e=n.seen.get(t);if(!e)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 f=h.def??h.schema,v={...f},y=h.ref;if(h.ref=null,y){r(y);const x=n.seen.get(y),C=x.schema;if(C.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(C)):Object.assign(f,C),Object.assign(f,v),u._zod.parent===y)for(const R in f)R==="$ref"||R==="allOf"||R in v||delete f[R];if(C.$ref&&x.def)for(const R in f)R==="$ref"||R==="allOf"||R in x.def&&JSON.stringify(f[R])===JSON.stringify(x.def[R])&&delete f[R]}const E=u._zod.parent;if(E&&E!==y){r(E);const x=n.seen.get(E);if(x!=null&&x.schema.$ref&&(f.$ref=x.schema.$ref,x.def))for(const C in f)C==="$ref"||C==="allOf"||C in x.def&&JSON.stringify(f[C])===JSON.stringify(x.def[C])&&delete f[C]}n.override({zodSchema:u,jsonSchema:f,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(t))==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,e.def??e.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:{...t["~standard"],jsonSchema:{input:Ac(t,"input",n.processors),output:Ac(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Qe(n,t){const e=t??{seen:new Set};if(e.seen.has(n))return!1;e.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Qe(r.element,e);if(r.type==="set")return Qe(r.valueType,e);if(r.type==="lazy")return Qe(r.getter(),e);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Qe(r.innerType,e);if(r.type==="intersection")return Qe(r.left,e)||Qe(r.right,e);if(r.type==="record"||r.type==="map")return Qe(r.keyType,e)||Qe(r.valueType,e);if(r.type==="pipe")return Qe(r.in,e)||Qe(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Qe(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Qe(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Qe(i,e))return!0;return!!(r.rest&&Qe(r.rest,e))}return!1}const XP=(n,t={})=>e=>{const r=E0({...e,processors:t});return $e(n,r),x0(r,n),A0(r,n)},Ac=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=E0({...i??{},target:s,io:t,processors:e});return $e(n,o),x0(o,n),A0(o,n)},QP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},e2=(n,t,e,r)=>{const i=e;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=QP[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(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},t2=(n,t,e,r)=>{const i=e,{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"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&t.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},n2=(n,t,e,r)=>{e.type="boolean"},r2=(n,t,e,r)=>{e.not={}},i2=(n,t,e,r)=>{},s2=(n,t,e,r)=>{const i=n._zod.def,s=r0(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},o2=(n,t,e,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.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];e.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?e.enum=[o]:e.const=o}else s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),s.every(o=>typeof o=="boolean")&&(e.type="boolean"),s.every(o=>o===null)&&(e.type="null"),e.enum=s},a2=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},l2=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},c2=(n,t,e,r)=>{const i=e,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=$e(s.element,t,{...r,path:[...r.path,"items"]})},u2=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=$e(o[h],t,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(h=>{const f=s.shape[h]._zod;return t.io==="input"?f.optin===void 0:f.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=$e(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},h2=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>$e(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=o:e.anyOf=o},d2=(n,t,e,r)=>{const i=n._zod.def,s=$e(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=$e(i.right,t,{...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]];e.allOf=c},p2=(n,t,e,r)=>{const i=e,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=$e(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const f of c)i.patternProperties[f.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=$e(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=$e(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const h=[...u].filter(f=>typeof f=="string"||typeof f=="number");h.length>0&&(i.required=h)}},f2=(n,t,e,r)=>{const i=n._zod.def,s=$e(i.innerType,t,r),o=t.seen.get(n);t.target==="openapi-3.0"?(o.ref=i.innerType,e.nullable=!0):e.anyOf=[s,{type:"null"}]},g2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},m2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},v2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,t.io==="input"&&(e._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},y2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.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")}e.default=o},b2=(n,t,e,r)=>{const i=n._zod.def,s=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;$e(s,t,r);const o=t.seen.get(n);o.ref=s},w2=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},T0=(n,t,e,r)=>{const i=n._zod.def;$e(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},S2=A("ZodISODateTime",(n,t)=>{_R.init(n,t),we.init(n,t)});function _2(n){return $P(S2,n)}const k2=A("ZodISODate",(n,t)=>{kR.init(n,t),we.init(n,t)});function E2(n){return CP(k2,n)}const x2=A("ZodISOTime",(n,t)=>{ER.init(n,t),we.init(n,t)});function A2(n){return IP(x2,n)}const T2=A("ZodISODuration",(n,t)=>{xR.init(n,t),we.init(n,t)});function $2(n){return RP(T2,n)}const $0=(n,t)=>{a0.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>gI(n,e)},flatten:{value:e=>fI(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,ad,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,ad,2)}},isEmpty:{get(){return n.issues.length===0}}})},cv=A("ZodError",$0),Rt=A("ZodError",$0,{Parent:Error}),C2=uf(Rt),I2=hf(Rt),R2=mu(Rt),P2=vu(Rt),L2=yI(Rt),D2=bI(Rt),M2=wI(Rt),z2=SI(Rt),O2=_I(Rt),N2=kI(Rt),U2=EI(Rt),F2=xI(Rt),be=A("ZodType",(n,t)=>(ye.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Ac(n,"input"),output:Ac(n,"output")}}),n.toJSONSchema=XP(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(wr(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(e,r)=>Sr(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>C2(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>R2(n,e,r),n.parseAsync=async(e,r)=>I2(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>P2(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>L2(n,e,r),n.decode=(e,r)=>D2(n,e,r),n.encodeAsync=async(e,r)=>M2(n,e,r),n.decodeAsync=async(e,r)=>z2(n,e,r),n.safeEncode=(e,r)=>O2(n,e,r),n.safeDecode=(e,r)=>N2(n,e,r),n.safeEncodeAsync=async(e,r)=>U2(n,e,r),n.safeDecodeAsync=async(e,r)=>F2(n,e,r),n.refine=(e,r)=>n.check(PL(e,r)),n.superRefine=e=>n.check(LL(e)),n.overwrite=e=>n.check(eo(e)),n.optional=()=>dv(n),n.exactOptional=()=>bL(n),n.nullable=()=>pv(n),n.nullish=()=>dv(pv(n)),n.nonoptional=e=>xL(n,e),n.array=()=>M(n),n.or=e=>j([n,e]),n.and=e=>bu(n,e),n.transform=e=>fv(n,vL(e)),n.default=e=>_L(n,e),n.prefault=e=>EL(n,e),n.catch=e=>TL(n,e),n.pipe=e=>fv(n,e),n.readonly=()=>IL(n),n.describe=e=>{const r=n.clone();return ko.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=ko.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return ko.get(n);const r=n.clone();return ko.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),C0=A("_ZodString",(n,t)=>{df.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>e2(n,r,i);const e=n._zod.bag;n.format=e.format??null,n.minLength=e.minimum??null,n.maxLength=e.maximum??null,n.regex=(...r)=>n.check(OP(...r)),n.includes=(...r)=>n.check(FP(...r)),n.startsWith=(...r)=>n.check(HP(...r)),n.endsWith=(...r)=>n.check(VP(...r)),n.min=(...r)=>n.check(xc(...r)),n.max=(...r)=>n.check(_0(...r)),n.length=(...r)=>n.check(k0(...r)),n.nonempty=(...r)=>n.check(xc(1,...r)),n.lowercase=r=>n.check(NP(r)),n.uppercase=r=>n.check(UP(r)),n.trim=()=>n.check(BP()),n.normalize=(...r)=>n.check(ZP(...r)),n.toLowerCase=()=>n.check(WP()),n.toUpperCase=()=>n.check(jP()),n.slugify=()=>n.check(GP())}),H2=A("ZodString",(n,t)=>{df.init(n,t),C0.init(n,t),n.email=e=>n.check(aP(V2,e)),n.url=e=>n.check(dP(Z2,e)),n.jwt=e=>n.check(TP(iL,e)),n.emoji=e=>n.check(pP(B2,e)),n.guid=e=>n.check(sv(uv,e)),n.uuid=e=>n.check(lP(Fl,e)),n.uuidv4=e=>n.check(cP(Fl,e)),n.uuidv6=e=>n.check(uP(Fl,e)),n.uuidv7=e=>n.check(hP(Fl,e)),n.nanoid=e=>n.check(fP(W2,e)),n.guid=e=>n.check(sv(uv,e)),n.cuid=e=>n.check(gP(j2,e)),n.cuid2=e=>n.check(mP(G2,e)),n.ulid=e=>n.check(vP(q2,e)),n.base64=e=>n.check(EP(tL,e)),n.base64url=e=>n.check(xP(nL,e)),n.xid=e=>n.check(yP(Y2,e)),n.ksuid=e=>n.check(bP(K2,e)),n.ipv4=e=>n.check(wP(J2,e)),n.ipv6=e=>n.check(SP(X2,e)),n.cidrv4=e=>n.check(_P(Q2,e)),n.cidrv6=e=>n.check(kP(eL,e)),n.e164=e=>n.check(AP(rL,e)),n.datetime=e=>n.check(_2(e)),n.date=e=>n.check(E2(e)),n.time=e=>n.check(A2(e)),n.duration=e=>n.check($2(e))});function p(n){return oP(H2,n)}const we=A("ZodStringFormat",(n,t)=>{me.init(n,t),C0.init(n,t)}),V2=A("ZodEmail",(n,t)=>{pR.init(n,t),we.init(n,t)}),uv=A("ZodGUID",(n,t)=>{hR.init(n,t),we.init(n,t)}),Fl=A("ZodUUID",(n,t)=>{dR.init(n,t),we.init(n,t)}),Z2=A("ZodURL",(n,t)=>{fR.init(n,t),we.init(n,t)}),B2=A("ZodEmoji",(n,t)=>{gR.init(n,t),we.init(n,t)}),W2=A("ZodNanoID",(n,t)=>{mR.init(n,t),we.init(n,t)}),j2=A("ZodCUID",(n,t)=>{vR.init(n,t),we.init(n,t)}),G2=A("ZodCUID2",(n,t)=>{yR.init(n,t),we.init(n,t)}),q2=A("ZodULID",(n,t)=>{bR.init(n,t),we.init(n,t)}),Y2=A("ZodXID",(n,t)=>{wR.init(n,t),we.init(n,t)}),K2=A("ZodKSUID",(n,t)=>{SR.init(n,t),we.init(n,t)}),J2=A("ZodIPv4",(n,t)=>{AR.init(n,t),we.init(n,t)}),X2=A("ZodIPv6",(n,t)=>{TR.init(n,t),we.init(n,t)}),Q2=A("ZodCIDRv4",(n,t)=>{$R.init(n,t),we.init(n,t)}),eL=A("ZodCIDRv6",(n,t)=>{CR.init(n,t),we.init(n,t)}),tL=A("ZodBase64",(n,t)=>{IR.init(n,t),we.init(n,t)}),nL=A("ZodBase64URL",(n,t)=>{PR.init(n,t),we.init(n,t)}),rL=A("ZodE164",(n,t)=>{LR.init(n,t),we.init(n,t)}),iL=A("ZodJWT",(n,t)=>{MR.init(n,t),we.init(n,t)}),I0=A("ZodNumber",(n,t)=>{v0.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>t2(n,r,i),n.gt=(r,i)=>n.check(av(r,i)),n.gte=(r,i)=>n.check(_h(r,i)),n.min=(r,i)=>n.check(_h(r,i)),n.lt=(r,i)=>n.check(ov(r,i)),n.lte=(r,i)=>n.check(Sh(r,i)),n.max=(r,i)=>n.check(Sh(r,i)),n.int=r=>n.check(hv(r)),n.safe=r=>n.check(hv(r)),n.positive=r=>n.check(av(0,r)),n.nonnegative=r=>n.check(_h(0,r)),n.negative=r=>n.check(ov(0,r)),n.nonpositive=r=>n.check(Sh(0,r)),n.multipleOf=(r,i)=>n.check(lv(r,i)),n.step=(r,i)=>n.check(lv(r,i)),n.finite=()=>n;const e=n._zod.bag;n.minValue=Math.max(e.minimum??Number.NEGATIVE_INFINITY,e.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(e.maximum??Number.POSITIVE_INFINITY,e.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(e.format??"").includes("int")||Number.isSafeInteger(e.multipleOf??.5),n.isFinite=!0,n.format=e.format??null});function B(n){return PP(I0,n)}const sL=A("ZodNumberFormat",(n,t)=>{zR.init(n,t),I0.init(n,t)});function hv(n){return LP(sL,n)}const oL=A("ZodBoolean",(n,t)=>{OR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>n2(n,e,r)});function Ne(n){return DP(oL,n)}const aL=A("ZodUnknown",(n,t)=>{NR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>i2()});function _(){return MP(aL)}const lL=A("ZodNever",(n,t)=>{UR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>r2(n,e,r)});function cL(n){return zP(lL,n)}const uL=A("ZodArray",(n,t)=>{FR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>c2(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(xc(e,r)),n.nonempty=e=>n.check(xc(1,e)),n.max=(e,r)=>n.check(_0(e,r)),n.length=(e,r)=>n.check(k0(e,r)),n.unwrap=()=>n.element});function M(n,t){return qP(uL,n,t)}const R0=A("ZodObject",(n,t)=>{VR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>u2(n,e,r,i),re(n,"shape",()=>t.shape),n.keyof=()=>D0(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:_()}),n.loose=()=>n.clone({...n._zod.def,catchall:_()}),n.strict=()=>n.clone({...n._zod.def,catchall:cL()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>cI(n,e),n.safeExtend=e=>uI(n,e),n.merge=e=>hI(n,e),n.pick=e=>aI(n,e),n.omit=e=>lI(n,e),n.partial=(...e)=>dI(M0,n,e[0]),n.required=(...e)=>pI(z0,n,e[0])});function P0(n,t){const e={type:"object",shape:n??{},...z(t)};return new R0(e)}function w(n,t){return new R0({type:"object",shape:n,catchall:_(),...z(t)})}const L0=A("ZodUnion",(n,t)=>{w0.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>h2(n,e,r,i),n.options=t.options});function j(n,t){return new L0({type:"union",options:n,...z(t)})}const hL=A("ZodDiscriminatedUnion",(n,t)=>{L0.init(n,t),ZR.init(n,t)});function dL(n,t,e){return new hL({type:"union",options:t,discriminator:n,...z(e)})}const pL=A("ZodIntersection",(n,t)=>{BR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>d2(n,e,r,i)});function bu(n,t){return new pL({type:"intersection",left:n,right:t})}const fL=A("ZodRecord",(n,t)=>{WR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>p2(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function k(n,t,e){return new fL({type:"record",keyType:n,valueType:t,...z(e)})}const cd=A("ZodEnum",(n,t)=>{jR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(r,i,s)=>s2(n,r,i),n.enum=t.entries,n.options=Object.values(t.entries);const e=new Set(Object.keys(t.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(e.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new cd({...t,checks:[],...z(i),entries:s})},n.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(e.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new cd({...t,checks:[],...z(i),entries:s})}});function D0(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new cd({type:"enum",entries:e,...z(t)})}const gL=A("ZodLiteral",(n,t)=>{GR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>o2(n,e,r),n.values=new Set(t.values),Object.defineProperty(n,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function T(n,t){return new gL({type:"literal",values:Array.isArray(n)?n:[n],...z(t)})}const mL=A("ZodTransform",(n,t)=>{qR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>l2(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new t0(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(Wo(s,e.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=e.value),o.inst??(o.inst=n),e.issues.push(Wo(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function vL(n){return new mL({type:"transform",transform:n})}const M0=A("ZodOptional",(n,t)=>{S0.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>T0(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function dv(n){return new M0({type:"optional",innerType:n})}const yL=A("ZodExactOptional",(n,t)=>{YR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>T0(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function bL(n){return new yL({type:"optional",innerType:n})}const wL=A("ZodNullable",(n,t)=>{KR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>f2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function pv(n){return new wL({type:"nullable",innerType:n})}const SL=A("ZodDefault",(n,t)=>{JR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>m2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function _L(n,t){return new SL({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():s0(t)}})}const kL=A("ZodPrefault",(n,t)=>{XR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>v2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function EL(n,t){return new kL({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():s0(t)}})}const z0=A("ZodNonOptional",(n,t)=>{QR.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>g2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function xL(n,t){return new z0({type:"nonoptional",innerType:n,...z(t)})}const AL=A("ZodCatch",(n,t)=>{eP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>y2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function TL(n,t){return new AL({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const $L=A("ZodPipe",(n,t)=>{tP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>b2(n,e,r,i),n.in=t.in,n.out=t.out});function fv(n,t){return new $L({type:"pipe",in:n,out:t})}const CL=A("ZodReadonly",(n,t)=>{nP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>w2(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function IL(n){return new CL({type:"readonly",innerType:n})}const RL=A("ZodCustom",(n,t)=>{rP.init(n,t),be.init(n,t),n._zod.processJSONSchema=(e,r,i)=>a2(n,e)});function PL(n,t={}){return YP(RL,n,t)}function LL(n){return KP(n)}const DL=[".md",".markdown"];function O0(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function N0(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function ML(n){return N0(n).toLowerCase()}function zL(n,t){const e=ML(n);return t.some(r=>e.endsWith(r))}function U0(n){return!O0(n)&&zL(n,DL)}function OL(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function xn(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const NL=P0({id:p().min(1),kind:T("path"),title:p(),path:p()}).strict(),UL=P0({id:p().min(1),kind:T("url"),title:p(),url:p().refine(OL,{message:"url must be an http(s) URL"})}).strict();dL("kind",[NL,UL]);function F0(n){return typeof n=="object"&&n!==null}function H0(n){return!F0(n)||n.type!=="ready"?!1:!("id"in n)}function V0(n){return!(!F0(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const FL="/views/markdown/",HL="/views/url-unsupported/";function Z0(n){return`/artifact/${encodeURIComponent(n)}`}function VL(n,t){return`${Z0(n)}/${encodeURIComponent(t)}`}function ZL(n){return`/markdown/${encodeURIComponent(n)}`}function Tc(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:xn(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:HL,contentURL:null};if(U0(n.path)){const r={viewURL:FL,contentURL:ZL(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=O0(n.path)?`${Z0(n.id)}/`:VL(n.id,N0(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const BL="serverURL",WL="token",jL="mode",GL="desktopAppVersion",qL="electron";function B0(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(BL);return r?new URL(r).origin:new URL(t).origin}function YL(n=window.location.search){return new URLSearchParams(n).get(WL)}function Wt(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(jL)===qL}function W0(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(GL)}const gv="tv.telemetry.clientId",KL=5,JL=60,XL=1e3,QL=KL*JL*XL,mv=["pointerdown","scroll","keydown"],vv=["focus"],yv=["visibilitychange"],eD="hidden";function tD(n,t=oD){const e=n.getItem(gv);if(e)return e;const r=t();return n.setItem(gv,r),r}function nD(n){return{clientId:tD(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function rD(n){const t=new URLSearchParams;return t.set("clientId",n.clientId),t.set("userAgent",n.userAgent),t.set("clientApp",n.clientApp),n.desktopAppVersion&&t.set("desktopAppVersion",n.desktopAppVersion),t}function iD(n){return new sD(n)}var ra,Rn,Qn,ia,sa,yt,Yr,oa,Oc,j0;class sD{constructor(t){b(this,Oc);b(this,ra);b(this,Rn);b(this,Qn);b(this,ia);b(this,sa);b(this,yt);b(this,Yr,!1);b(this,oa,Number.NEGATIVE_INFINITY);m(this,ra,t.meta),m(this,Rn,t.documentTarget),m(this,Qn,t.windowTarget),m(this,ia,t.send),m(this,sa,t.nowMs??Date.now),m(this,yt,()=>d(this,Oc,j0).call(this))}start(){if(!l(this,Yr)){m(this,Yr,!0);for(const t of mv)l(this,Qn).addEventListener(t,l(this,yt)),l(this,Rn).addEventListener(t,l(this,yt));for(const t of vv)l(this,Qn).addEventListener(t,l(this,yt));for(const t of yv)l(this,Rn).addEventListener(t,l(this,yt))}}stop(){if(l(this,Yr)){m(this,Yr,!1);for(const t of mv)l(this,Qn).removeEventListener(t,l(this,yt)),l(this,Rn).removeEventListener(t,l(this,yt));for(const t of vv)l(this,Qn).removeEventListener(t,l(this,yt));for(const t of yv)l(this,Rn).removeEventListener(t,l(this,yt))}}}ra=new WeakMap,Rn=new WeakMap,Qn=new WeakMap,ia=new WeakMap,sa=new WeakMap,yt=new WeakMap,Yr=new WeakMap,oa=new WeakMap,Oc=new WeakSet,j0=function(){if(l(this,Rn).visibilityState===eD)return;const t=l(this,sa).call(this);t-l(this,oa)<QL||(m(this,oa,t),l(this,ia).call(this,{type:dC,clientId:l(this,ra).clientId}))};function oD(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():fu().toLowerCase()}const fe={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"},En={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"},aD=1,lD=w({_meta:k(p(),_()).nullish(),terminal:Ne().optional().default(!1)}),cD=w({_meta:k(p(),_()).nullish(),label:p().nullish(),name:p(),optional:Ne().optional().default(!1),secret:Ne().optional().default(!0)}),uD=w({_meta:k(p(),_()).nullish(),description:p().nullish(),id:p(),name:p()}),hD=w({_meta:k(p(),_()).nullish(),description:p().nullish(),id:p(),link:p().nullish(),name:p(),vars:M(cD)}),dD=w({_meta:k(p(),_()).nullish(),args:M(p()).optional(),description:p().nullish(),env:k(p(),p()).optional(),id:p(),name:p()}),pD=j([hD.and(w({type:T("env_var")})),dD.and(w({type:T("terminal")})),uD]),fD=w({_meta:k(p(),_()).nullish(),methodId:p()}),gD=w({_meta:k(p(),_()).nullish()}),mD=w({_meta:k(p(),_()).nullish(),blob:p(),mimeType:p().nullish(),uri:p()}),vD=w({default:Ne().nullish(),description:p().nullish(),title:p().nullish()}),yD=w({_meta:k(p(),_()).nullish()}),bD=w({_meta:k(p(),_()).nullish()}),wD=w({amount:B(),currency:p()}),SD=w({_meta:k(p(),_()).nullish(),terminalId:p()}),_D=w({_meta:k(p(),_()).nullish(),newText:p(),oldText:p().nullish(),path:p()}),kD=j([p(),B(),B(),Ne(),M(p())]),ED=w({content:k(p(),kD).nullish()}),xD=j([ED.and(w({action:T("accept")})),w({action:T("decline")}),w({action:T("cancel")})]),AD=w({_meta:k(p(),_()).nullish()}),G0=p(),TD=w({_meta:k(p(),_()).nullish(),elicitationId:G0}),$D=w({_meta:k(p(),_()).nullish(),action:xD}),CD=T("object"),ID=T("string"),RD=w({_meta:k(p(),_()).nullish()}),PD=w({_meta:k(p(),_()).nullish(),form:AD.nullish(),url:RD.nullish()}),LD=w({elicitationId:G0,url:p().url()}),q0=w({const:p(),title:p()}),Y0=w({_meta:k(p(),_()).nullish(),name:p(),value:p()}),DD=j([T(-32700),T(-32600),T(-32601),T(-32602),T(-32603),T(-32800),T(-32e3),T(-32002),T(-32042),B().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),K0=w({code:DD,data:_().optional(),message:p()}),J0=_(),X0=_(),Q0=_(),MD=w({_meta:k(p(),_()).nullish(),readTextFile:Ne().optional().default(!1),writeTextFile:Ne().optional().default(!1)}),ew=w({_meta:k(p(),_()).nullish(),name:p(),value:p()}),tw=w({_meta:k(p(),_()).nullish(),name:p(),title:p().nullish(),version:p()}),zD=w({default:B().nullish(),description:p().nullish(),maximum:B().nullish(),minimum:B().nullish(),title:p().nullish()}),OD=w({_meta:k(p(),_()).nullish()}),ND=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cursor:p().nullish(),cwd:p().nullish()}),UD=w({_meta:k(p(),_()).nullish()}),FD=w({_meta:k(p(),_()).nullish(),logout:UD.nullish()}),HD=w({_meta:k(p(),_()).nullish()}),VD=w({_meta:k(p(),_()).nullish()}),ZD=w({_meta:k(p(),_()).nullish(),http:Ne().optional().default(!1),sse:Ne().optional().default(!1)}),BD=w({_meta:k(p(),_()).nullish(),headers:M(ew),name:p(),url:p()}),WD=w({_meta:k(p(),_()).nullish(),headers:M(ew),name:p(),url:p()}),jD=w({_meta:k(p(),_()).nullish(),args:M(p()),command:p(),env:M(Y0),name:p()}),wu=j([BD.and(w({type:T("http")})),WD.and(w({type:T("sse")})),jD]),pf=p(),GD=w({_meta:k(p(),_()).nullish(),description:p().nullish(),modelId:pf,name:p()}),qD=j([T("error"),T("warning"),T("information"),T("hint")]),YD=w({_meta:k(p(),_()).nullish()}),KD=w({_meta:k(p(),_()).nullish()}),JD=w({_meta:k(p(),_()).nullish()}),XD=w({_meta:k(p(),_()).nullish()}),QD=w({_meta:k(p(),_()).nullish()}),e6=w({_meta:k(p(),_()).nullish(),maxCount:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),t6=w({diff:p(),uri:p()}),n6=w({endLine:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:p()}),r6=w({_meta:k(p(),_()).nullish()}),i6=w({_meta:k(p(),_()).nullish()}),s6=w({languageId:p(),text:p(),uri:p()}),o6=w({_meta:k(p(),_()).nullish(),maxCount:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),a6=j([T("rejected"),T("ignored"),T("replaced"),T("cancelled")]),l6=w({excerpts:M(n6),uri:p()}),c6=w({_meta:k(p(),_()).nullish()}),u6=w({_meta:k(p(),_()).nullish()}),h6=w({name:p(),owner:p(),remoteUrl:p()}),d6=w({_meta:k(p(),_()).nullish()}),p6=w({_meta:k(p(),_()).nullish(),jump:r6.nullish(),rename:u6.nullish(),searchAndReplace:d6.nullish()}),f6=w({id:p(),isRegex:Ne().nullish(),replace:p(),search:p(),uri:p()}),g6=j([T("automatic"),T("diagnostic"),T("manual")]),m6=w({_meta:k(p(),_()).nullish(),maxCount:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),v6=w({_meta:k(p(),_()).nullish(),diagnostics:YD.nullish(),editHistory:e6.nullish(),openFiles:i6.nullish(),recentFiles:o6.nullish(),relatedSnippets:c6.nullish(),userActions:m6.nullish()}),y6=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu)}),b6=w({default:B().nullish(),description:p().nullish(),maximum:B().nullish(),minimum:B().nullish(),title:p().nullish()}),nw=p(),w6=j([T("allow_once"),T("allow_always"),T("reject_once"),T("reject_always")]),S6=w({_meta:k(p(),_()).nullish(),kind:w6,name:p(),optionId:nw}),_6=j([T("high"),T("medium"),T("low")]),k6=j([T("pending"),T("in_progress"),T("completed")]),E6=w({_meta:k(p(),_()).nullish(),content:p(),priority:_6,status:k6}),x6=w({_meta:k(p(),_()).nullish(),entries:M(E6)}),gr=w({character:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),A6=w({id:p(),position:gr,uri:p()}),T6=w({id:p(),newName:p(),position:gr,uri:p()}),$6=w({action:p(),position:gr,timestampMs:B(),uri:p()}),rw=j([T("utf-16"),T("utf-32"),T("utf-8")]),C6=w({_meta:k(p(),_()).nullish(),auth:lD.optional().default({terminal:!1}),elicitation:PD.nullish(),fs:MD.optional().default({readTextFile:!1,writeTextFile:!1}),nes:p6.nullish(),positionEncodings:M(rw).optional(),terminal:Ne().optional().default(!1)}),I6=w({_meta:k(p(),_()).nullish(),audio:Ne().optional().default(!1),embeddedContext:Ne().optional().default(!1),image:Ne().optional().default(!1)}),iw=B().int().gte(0).lte(65535),R6=w({_meta:k(p(),_()).nullish(),clientCapabilities:C6.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:tw.nullish(),protocolVersion:iw}),to=w({end:gr,start:gr}),P6=w({message:p(),range:to,severity:qD,uri:p()}),L6=w({languageId:p(),lastFocusedMs:B().nullish(),uri:p(),visibleRange:to.nullish()}),D6=w({_meta:k(p(),_()).nullish(),diagnostics:M(P6).nullish(),editHistory:M(t6).nullish(),openFiles:M(L6).nullish(),recentFiles:M(s6).nullish(),relatedSnippets:M(l6).nullish(),userActions:M($6).nullish()}),M6=w({newText:p(),range:to}),z6=w({cursorPosition:gr.nullish(),edits:M(M6),id:p(),uri:p()}),O6=j([z6.and(w({kind:T("edit")})),A6.and(w({kind:T("jump")})),T6.and(w({kind:T("rename")})),f6.and(w({kind:T("searchAndReplace")}))]),N6=w({_meta:k(p(),_()).nullish(),content:p()}),U6=w({_meta:k(p(),_()).nullish()}),bi=j([B(),p()]).nullable();w({_meta:k(p(),_()).nullish(),requestId:bi});const F6=D0(["assistant","user"]),ml=w({_meta:k(p(),_()).nullish(),audience:M(F6).nullish(),lastModified:p().nullish(),priority:B().nullish()}),H6=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),data:p(),mimeType:p()}),V6=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),data:p(),mimeType:p(),uri:p().nullish()}),Z6=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),description:p().nullish(),mimeType:p().nullish(),name:p(),size:B().nullish(),title:p().nullish(),uri:p()}),B6=w({_meta:k(p(),_()).nullish(),optionId:nw}),W6=j([w({outcome:T("cancelled")}),B6.and(w({outcome:T("selected")}))]),j6=w({_meta:k(p(),_()).nullish(),outcome:W6}),G6=w({_meta:k(p(),_()).nullish()}),q6=w({_meta:k(p(),_()).nullish()}),Y6=w({currentValue:Ne()}),K6=p(),sw=p(),J6=j([T("mode"),T("model"),T("thought_level"),p()]),ff=p(),ow=w({_meta:k(p(),_()).nullish(),description:p().nullish(),name:p(),value:ff}),X6=w({_meta:k(p(),_()).nullish(),group:K6,name:p(),options:M(ow)}),Q6=j([M(ow),M(X6)]),eM=w({currentValue:ff,options:Q6}),no=bu(j([eM.and(w({type:T("select")})),Y6.and(w({type:T("boolean")}))]),w({_meta:k(p(),_()).nullish(),category:J6.nullish(),description:p().nullish(),id:sw,name:p()})),tM=w({_meta:k(p(),_()).nullish(),configOptions:M(no)}),nM=w({_meta:k(p(),_()).nullish()}),te=p(),rM=w({_meta:k(p(),_()).nullish(),id:p(),sessionId:te}),iM=w({_meta:k(p(),_()).nullish(),sessionId:te}),sM=w({_meta:k(p(),_()).nullish(),sessionId:te}),oM=w({_meta:k(p(),_()).nullish(),sessionId:te}),aw=w({_meta:k(p(),_()).nullish(),args:M(p()).optional(),command:p(),cwd:p().nullish(),env:M(Y0).optional(),outputByteLimit:B().nullish(),sessionId:te}),aM=w({_meta:k(p(),_()).nullish(),sessionId:te,uri:p()}),lM=w({_meta:k(p(),_()).nullish(),position:gr,sessionId:te,uri:p(),version:B(),visibleRange:to}),cM=w({_meta:k(p(),_()).nullish(),languageId:p(),sessionId:te,text:p(),uri:p(),version:B()}),uM=w({_meta:k(p(),_()).nullish(),sessionId:te,uri:p()}),hM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu).optional(),sessionId:te}),lw=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),dM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu),sessionId:te}),cw=w({_meta:k(p(),_()).nullish(),limit:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:p(),sessionId:te}),pM=w({_meta:k(p(),_()).nullish(),id:p(),reason:a6.nullish(),sessionId:te}),uw=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),fM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),mcpServers:M(wu).optional(),sessionId:te}),gM=w({_meta:k(p(),_()).nullish(),additionalDirectories:M(p()).optional(),cwd:p(),sessionId:te,title:p().nullish(),updatedAt:p().nullish()}),mM=w({_meta:k(p(),_()).nullish(),nextCursor:p().nullish(),sessions:M(gM)}),vM=w({_meta:k(p(),_()).nullish(),title:p().nullish(),updatedAt:p().nullish()}),yM=w({_meta:k(p(),_()).nullish()}),Su=p(),bM=w({_meta:k(p(),_()).nullish(),currentModeId:Su}),wM=w({_meta:k(p(),_()).nullish(),description:p().nullish(),id:Su,name:p()}),_u=w({_meta:k(p(),_()).nullish(),availableModes:M(wM),currentModeId:Su}),ku=w({_meta:k(p(),_()).nullish(),availableModels:M(GD),currentModelId:pf}),SM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish(),sessionId:te}),_M=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish()}),kM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish(),sessionId:te}),EM=w({_meta:k(p(),_()).nullish(),configOptions:M(no).nullish(),models:ku.nullish(),modes:_u.nullish()}),xM=w({_meta:k(p(),_()).nullish()}),AM=w({_meta:k(p(),_()).nullish(),additionalDirectories:G6.nullish(),close:q6.nullish(),fork:nM.nullish(),list:yM.nullish(),resume:xM.nullish()}),TM=bu(j([w({type:T("boolean"),value:Ne()}),w({value:ff})]),w({_meta:k(p(),_()).nullish(),configId:sw,sessionId:te})),$M=w({_meta:k(p(),_()).nullish(),configOptions:M(no)}),CM=w({_meta:k(p(),_()).nullish(),modeId:Su,sessionId:te}),IM=w({_meta:k(p(),_()).nullish()}),RM=w({_meta:k(p(),_()).nullish(),modelId:pf,sessionId:te}),PM=w({_meta:k(p(),_()).nullish()}),LM=w({_meta:k(p(),_()).nullish(),sessionId:te}),DM=j([T("end_turn"),T("max_tokens"),T("max_turn_requests"),T("refusal"),T("cancelled")]),MM=j([T("email"),T("uri"),T("date"),T("date-time")]),zM=w({default:p().nullish(),description:p().nullish(),enum:M(p()).nullish(),format:MM.nullish(),maxLength:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:M(q0).nullish(),pattern:p().nullish(),title:p().nullish()}),OM=w({_meta:k(p(),_()).nullish(),context:D6.nullish(),position:gr,selection:to.nullish(),sessionId:te,triggerKind:g6,uri:p(),version:B()}),NM=w({_meta:k(p(),_()).nullish(),suggestions:M(O6)}),UM=w({_meta:k(p(),_()).nullish(),terminalId:p()}),FM=w({_meta:k(p(),_()).nullish(),exitCode:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:p().nullish()}),hw=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),HM=w({_meta:k(p(),_()).nullish(),exitStatus:FM.nullish(),output:p(),truncated:Ne()}),VM=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),text:p()}),ZM=w({range:to.nullish(),text:p()}),BM=w({_meta:k(p(),_()).nullish(),contentChanges:M(ZM),sessionId:te,uri:p(),version:B()});w({method:p(),params:j([iM,cM,BM,aM,uM,lM,rM,pM,J0]).nullish()});const WM=j([T("full"),T("incremental")]),jM=w({_meta:k(p(),_()).nullish(),syncKind:WM}),GM=w({_meta:k(p(),_()).nullish(),didChange:jM.nullish(),didClose:KD.nullish(),didFocus:JD.nullish(),didOpen:XD.nullish(),didSave:QD.nullish()}),qM=w({_meta:k(p(),_()).nullish(),document:GM.nullish()}),YM=w({_meta:k(p(),_()).nullish(),context:v6.nullish(),events:qM.nullish()}),KM=w({_meta:k(p(),_()).nullish(),auth:FD.optional().default({}),loadSession:Ne().optional().default(!1),mcpCapabilities:ZD.optional().default({http:!1,sse:!1}),nes:YM.nullish(),positionEncoding:rw.nullish(),promptCapabilities:I6.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:AM.optional().default({})}),JM=w({_meta:k(p(),_()).nullish(),agentCapabilities:KM.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:tw.nullish(),authMethods:M(pD).optional().default([]),protocolVersion:iw}),XM=w({_meta:k(p(),_()).nullish(),mimeType:p().nullish(),text:p(),uri:p()}),QM=j([XM,mD]),ez=w({_meta:k(p(),_()).nullish(),annotations:ml.nullish(),resource:QM}),gf=j([VM.and(w({type:T("text")})),V6.and(w({type:T("image")})),H6.and(w({type:T("audio")})),Z6.and(w({type:T("resource_link")})),ez.and(w({type:T("resource")}))]),tz=w({_meta:k(p(),_()).nullish(),content:gf}),kh=w({_meta:k(p(),_()).nullish(),content:gf,messageId:p().nullish()}),nz=w({_meta:k(p(),_()).nullish(),messageId:p().nullish(),prompt:M(gf),sessionId:te}),rz=w({anyOf:M(q0)}),dw=j([tz.and(w({type:T("content")})),_D.and(w({type:T("diff")})),UM.and(w({type:T("terminal")}))]),pw=p(),fw=w({_meta:k(p(),_()).nullish(),line:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:p()}),gw=j([T("pending"),T("in_progress"),T("completed"),T("failed")]),mw=j([T("read"),T("edit"),T("delete"),T("move"),T("search"),T("execute"),T("think"),T("fetch"),T("switch_mode"),T("other")]),iz=w({_meta:k(p(),_()).nullish(),content:M(dw).optional(),kind:mw.optional(),locations:M(fw).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:gw.optional(),title:p(),toolCallId:pw}),vw=w({_meta:k(p(),_()).nullish(),content:M(dw).nullish(),kind:mw.nullish(),locations:M(fw).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:gw.nullish(),title:p().nullish(),toolCallId:pw}),yw=w({_meta:k(p(),_()).nullish(),options:M(S6),sessionId:te,toolCall:vw}),sz=w({_meta:k(p(),_()).nullish(),hint:p()}),oz=sz,az=w({_meta:k(p(),_()).nullish(),description:p(),input:oz.nullish(),name:p()}),lz=w({_meta:k(p(),_()).nullish(),availableCommands:M(az)}),cz=w({enum:M(p()),type:ID}),uz=j([cz,rz]),hz=w({default:M(p()).nullish(),description:p().nullish(),items:uz,maxItems:B().nullish(),minItems:B().nullish(),title:p().nullish()}),dz=j([zM.and(w({type:T("string")})),b6.and(w({type:T("number")})),zD.and(w({type:T("integer")})),vD.and(w({type:T("boolean")})),hz.and(w({type:T("array")}))]),pz=w({description:p().nullish(),properties:k(p(),dz).optional().default({}),required:M(p()).nullish(),title:p().nullish(),type:CD.optional().default("object")}),fz=w({requestedSchema:pz}),gz=bu(j([fz.and(w({mode:T("form")})),LD.and(w({mode:T("url")}))]),w({_meta:k(p(),_()).nullish(),message:p(),sessionId:te})),mz=w({cachedReadTokens:B().nullish(),cachedWriteTokens:B().nullish(),inputTokens:B(),outputTokens:B(),thoughtTokens:B().nullish(),totalTokens:B()}),vz=w({_meta:k(p(),_()).nullish(),stopReason:DM,usage:mz.nullish(),userMessageId:p().nullish()});j([w({id:bi,result:j([JM,gD,VD,kM,_M,mM,SM,EM,bD,IM,$M,vz,PM,LM,NM,yD,Q0])}),w({error:K0,id:bi})]);const yz=w({_meta:k(p(),_()).nullish(),cost:wD.nullish(),size:B(),used:B()}),bz=j([kh.and(w({sessionUpdate:T("user_message_chunk")})),kh.and(w({sessionUpdate:T("agent_message_chunk")})),kh.and(w({sessionUpdate:T("agent_thought_chunk")})),iz.and(w({sessionUpdate:T("tool_call")})),vw.and(w({sessionUpdate:T("tool_call_update")})),x6.and(w({sessionUpdate:T("plan")})),lz.and(w({sessionUpdate:T("available_commands_update")})),bM.and(w({sessionUpdate:T("current_mode_update")})),tM.and(w({sessionUpdate:T("config_option_update")})),vM.and(w({sessionUpdate:T("session_info_update")})),yz.and(w({sessionUpdate:T("usage_update")}))]),bw=w({_meta:k(p(),_()).nullish(),sessionId:te,update:bz});w({method:p(),params:j([bw,TD,J0]).nullish()});const ww=w({_meta:k(p(),_()).nullish(),sessionId:te,terminalId:p()}),wz=w({_meta:k(p(),_()).nullish(),exitCode:B().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:p().nullish()}),Sz=w({name:p(),uri:p()}),_z=w({_meta:k(p(),_()).nullish(),repository:h6.nullish(),workspaceFolders:M(Sz).nullish(),workspaceUri:p().nullish()});w({id:bi,method:p(),params:j([R6,fD,HD,y6,dM,ND,hM,fM,oM,CM,TM,nz,RM,_z,OM,sM,X0]).nullish()});const Sw=w({_meta:k(p(),_()).nullish(),content:p(),path:p(),sessionId:te});w({id:bi,method:p(),params:j([Sw,cw,yw,aw,hw,uw,ww,lw,gz,X0]).nullish()});const kz=w({_meta:k(p(),_()).nullish()});j([w({id:bi,result:j([kz,N6,j6,SD,HM,U6,wz,OD,$D,Q0])}),w({error:K0,id:bi})]);var Q;class Ez{constructor(t,e){b(this,Q);const r=t(this),i=async(o,a)=>{var c,u,h,f,v,y,E;switch(o){case En.fs_write_text_file:{const x=Sw.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,x)}case En.fs_read_text_file:{const x=cw.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,x)}case En.session_request_permission:{const x=yw.parse(a);return r.requestPermission(x)}case En.terminal_create:{const x=aw.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,x)}case En.terminal_output:{const x=hw.parse(a);return(f=r.terminalOutput)==null?void 0:f.call(r,x)}case En.terminal_release:{const x=uw.parse(a);return await((v=r.releaseTerminal)==null?void 0:v.call(r,x))??{}}case En.terminal_wait_for_exit:{const x=ww.parse(a);return(y=r.waitForTerminalExit)==null?void 0:y.call(r,x)}case En.terminal_kill:{const x=lw.parse(a);return await((E=r.killTerminal)==null?void 0:E.call(r,x))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Le.methodNotFound(o)}},s=async(o,a)=>{switch(o){case En.session_update:{const c=bw.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Le.methodNotFound(o)}};m(this,Q,new xz(i,s,e))}async initialize(t){return await l(this,Q).sendRequest(fe.initialize,t)}async newSession(t){return await l(this,Q).sendRequest(fe.session_new,t)}async loadSession(t){return await l(this,Q).sendRequest(fe.session_load,t)??{}}async unstable_forkSession(t){return await l(this,Q).sendRequest(fe.session_fork,t)}async listSessions(t){return await l(this,Q).sendRequest(fe.session_list,t)}async unstable_resumeSession(t){return await l(this,Q).sendRequest(fe.session_resume,t)}async unstable_closeSession(t){return await l(this,Q).sendRequest(fe.session_close,t)}async setSessionMode(t){return await l(this,Q).sendRequest(fe.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,Q).sendRequest(fe.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,Q).sendRequest(fe.session_set_config_option,t)}async authenticate(t){return await l(this,Q).sendRequest(fe.authenticate,t)??{}}async unstable_logout(t){return await l(this,Q).sendRequest(fe.logout,t)??{}}async prompt(t){return await l(this,Q).sendRequest(fe.session_prompt,t)}async cancel(t){return await l(this,Q).sendNotification(fe.session_cancel,t)}async unstable_startNes(t){return await l(this,Q).sendRequest(fe.nes_start,t)}async unstable_suggestNes(t){return await l(this,Q).sendRequest(fe.nes_suggest,t)}async unstable_closeNes(t){return await l(this,Q).sendRequest(fe.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,Q).sendNotification(fe.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,Q).sendNotification(fe.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,Q).sendNotification(fe.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,Q).sendNotification(fe.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,Q).sendNotification(fe.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,Q).sendNotification(fe.nes_accept,t)}async unstable_rejectNes(t){return await l(this,Q).sendNotification(fe.nes_reject,t)}async extMethod(t,e){return await l(this,Q).sendRequest(t,e)}async extNotification(t,e){return await l(this,Q).sendNotification(t,e)}get signal(){return l(this,Q).signal}get closed(){return l(this,Q).closed}}Q=new WeakMap;var er,Nc,aa,la,cs,us,nn,ca,ve,_w,ud,kw,Ew,xw,Aw,hd,Eo;class xz{constructor(t,e,r){b(this,ve);b(this,er,new Map);b(this,Nc,0);b(this,aa);b(this,la);b(this,cs);b(this,us,Promise.resolve());b(this,nn,new AbortController);b(this,ca);m(this,aa,t),m(this,la,e),m(this,cs,r),m(this,ca,new Promise(i=>{l(this,nn).signal.addEventListener("abort",()=>i())})),d(this,ve,_w).call(this)}get signal(){return l(this,nn).signal}get closed(){return l(this,ca)}async sendRequest(t,e){d(this,ve,hd).call(this);const r=Bu(this,Nc)._++,i=new Promise((s,o)=>{l(this,er).set(r,{resolve:s,reject:o})});return await d(this,ve,Eo).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){d(this,ve,hd).call(this),await d(this,ve,Eo).call(this,{jsonrpc:"2.0",method:t,params:e})}}er=new WeakMap,Nc=new WeakMap,aa=new WeakMap,la=new WeakMap,cs=new WeakMap,us=new WeakMap,nn=new WeakMap,ca=new WeakMap,ve=new WeakSet,_w=async function(){let t;try{const e=l(this,cs).readable.getReader();try{for(;!l(this,nn).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{d(this,ve,kw).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&d(this,ve,Eo).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{d(this,ve,ud).call(this,t)}},ud=function(t){if(l(this,nn).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,er).values())r.reject(e);l(this,er).clear(),l(this,nn).abort(e)},kw=async function(t){if("method"in t&&"id"in t){const e=await d(this,ve,Ew).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await d(this,ve,Eo).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await d(this,ve,xw).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?d(this,ve,Aw).call(this,t):console.error("Invalid message",{message:t})},Ew=async function(t,e){try{return{result:await l(this,aa).call(this,t,e)??null}}catch(r){if(r instanceof Le)return r.toResult();if(r instanceof cv)return Le.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 Le.internalError(i?JSON.parse(i):{}).toResult()}catch{return Le.internalError({details:i}).toResult()}}},xw=async function(t,e){try{return await l(this,la).call(this,t,e),{result:null}}catch(r){if(r instanceof Le)return r.toResult();if(r instanceof cv)return Le.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 Le.internalError(i?JSON.parse(i):{}).toResult()}catch{return Le.internalError({details:i}).toResult()}}},Aw=function(t){const e=l(this,er).get(t.id);if(e){if("result"in t)e.resolve(t.result);else if("error"in t){const{code:r,message:i,data:s}=t.error;e.reject(new Le(r,i,s))}l(this,er).delete(t.id)}else console.error("Got response to unknown request",t.id)},hd=function(){if(l(this,nn).signal.aborted)throw l(this,nn).signal.reason??new Error("ACP connection closed")},Eo=async function(t){return m(this,us,l(this,us).then(async()=>{const e=l(this,cs).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{d(this,ve,ud).call(this,e)})),l(this,us)};class Le extends Error{constructor(e,r,i){super(r);g(this,"code");g(this,"data");this.code=e,this.name="RequestError",this.data=i}static parseError(e,r){return new Le(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Le(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Le(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Le(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Le(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Le(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Le(-32002,`Resource not found${e?`: ${e}`:""}`,e&&{uri:e})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const Az=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,Tz=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,$z=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,Cz=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,Iz=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,Rz="single_session",Pz={name:"television-acp-client",version:"0.0.0"},Tw="agent:main:television",Lz=gl(It);var hs,rn,pt,sn,tr,Mt,Pn,on,an,nr,zt,ds,ps,ln,et,Ln,fs,Kr,Dn,rr,ua,Ot,cn,Uc,un,$,dd,$w,Cw,Iw,rc,Rw,Pw,Lw,Dw,Mw,zw,Ow,Rr,ji,Gi,An,Nw,qi,pd,fd,ic,Uw,sc,gd,md,ha,da,oc,Yi,vd,Fw;class Dz extends Lz{constructor(e){super();b(this,$);b(this,hs,"disconnected");b(this,rn,null);b(this,pt,new Map);b(this,sn,null);b(this,tr,null);b(this,Mt,null);b(this,Pn,null);b(this,on,null);b(this,an,null);b(this,nr);b(this,zt,null);b(this,ds,0);b(this,ps,1);b(this,ln,null);b(this,et,null);b(this,Ln,!1);b(this,fs,!1);b(this,Kr,!1);b(this,Dn,null);b(this,rr,new Set);b(this,ua);b(this,Ot);b(this,cn);b(this,Uc,e=>{d(this,$,Cw).call(this,e)});b(this,un,null);b(this,ha,()=>{d(this,$,Yi).call(this,"ACP bridge websocket closed")});b(this,da,()=>{d(this,$,Yi).call(this,"ACP bridge websocket error")});m(this,Ot,e),m(this,cn,e.sessionMode??Rz),m(this,nr,e.mappedSessionStore??Mz()),m(this,ua,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,hs)}get messages(){return[...l(this,pt).values()]}get enabled(){return l(this,Ot).enabled??!1}setToken(e){l(this,Ot).token=e??""}setEnabled(e){l(this,Ot).enabled=e,e||(d(this,$,oc).call(this),m(this,rn,null),d(this,$,An).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,tr)===null&&(m(this,rn,null),m(this,tr,d(this,$,$w).call(this)));try{await l(this,tr),await d(this,$,rc).call(this)}catch(e){throw d(this,$,Yi).call(this,Eh(e)),e}}}dispose(){d(this,$,oc).call(this),m(this,rn,null),d(this,$,An).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await d(this,$,dd).call(this,"ready")),(l(this,on)===null||l(this,zt)!==d(this,$,sc).call(this))&&await d(this,$,rc).call(this),this.status!=="ready")throw new Error("ACPClient is not ready to send a new message");const r=e.text.trim();if(!r)throw new Error("Cannot send an empty message");d(this,$,ji).call(this,{id:d(this,$,qi).call(this,"user"),kind:"user",text:r,status:"final"}),d(this,$,An).call(this,"running");try{const i=await d(this,$,ic).call(this).prompt({sessionId:d(this,$,fd).call(this),prompt:[{type:"text",text:d(this,$,Nw).call(this,r)}]});d(this,$,Rr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),d(this,$,An).call(this,"ready")}catch(i){throw d(this,$,Fw).call(this)||(d(this,$,Rr).call(this,"error"),d(this,$,An).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await d(this,$,dd).call(this,"ready"));const e=d(this,$,sc).call(this);((r=l(this,an))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,nr).clearActualSessionId(e):m(this,ds,l(this,ds)+1),m(this,Mt,null),m(this,Pn,null),m(this,on,null),m(this,zt,null),d(this,$,vd).call(this)}async cancel(){this.status==="running"&&(d(this,$,An).call(this,"cancelling"),await d(this,$,ic).call(this).cancel({sessionId:d(this,$,fd).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,et)===null)return;m(this,et,null),m(this,Ln,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,et))==null?void 0:s.screenID)===r.screenID&&((o=l(this,et))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,et))==null?void 0:a.screenID)??null;if(m(this,et,r),l(this,cn)==="single_session"){(!l(this,zt)||i!==r.screenID)&&m(this,Ln,!0);return}l(this,zt)!==d(this,$,gd).call(this,r.screenID)&&(m(this,Mt,null),m(this,Pn,null),l(this,sn)&&this.status==="ready"&&d(this,$,rc).call(this).catch(c=>{d(this,$,Yi).call(this,Eh(c))}))}}hs=new WeakMap,rn=new WeakMap,pt=new WeakMap,sn=new WeakMap,tr=new WeakMap,Mt=new WeakMap,Pn=new WeakMap,on=new WeakMap,an=new WeakMap,nr=new WeakMap,zt=new WeakMap,ds=new WeakMap,ps=new WeakMap,ln=new WeakMap,et=new WeakMap,Ln=new WeakMap,fs=new WeakMap,Kr=new WeakMap,Dn=new WeakMap,rr=new WeakMap,ua=new WeakMap,Ot=new WeakMap,cn=new WeakMap,Uc=new WeakMap,un=new WeakMap,$=new WeakSet,dd=async function(e){if(this.status!==e){if(this.status==="disposed")throw new Error("ACPClient has been disposed");if(this.status==="disconnected")throw new Error(l(this,rn)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",o)},o=()=>{if(this.status===e){s(),r();return}if(this.status==="disposed"){s(),i(new Error("ACPClient has been disposed"));return}this.status==="disconnected"&&(s(),i(new Error(l(this,rn)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},$w=async function(){try{const{stream:e,socket:r,metadata:i}=await Uz({serverURL:l(this,Ot).serverURL,token:l(this,Ot).token,createSocket:l(this,ua),onDisconnect:l(this,Uc)});m(this,an,i),m(this,un,r),r.addEventListener("close",l(this,ha)),r.addEventListener("error",l(this,da)),m(this,sn,new Ez(s=>({connection:s,sessionUpdate:async o=>{await d(this,$,Pw).call(this,o)},requestPermission:async o=>d(this,$,Lw).call(this,o)}),e)),await l(this,sn).initialize({protocolVersion:aD,clientCapabilities:{},clientInfo:Pz})}catch(e){throw e}},Cw=function(e){d(this,$,Yi).call(this,Eh(e))},Iw=function(e){const r=e==null?void 0:e.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})`)},rc=async function(){const e=d(this,$,sc).call(this);if(l(this,Mt)&&l(this,Pn)===e){await l(this,Mt);return}m(this,Pn,e),m(this,Mt,d(this,$,Rw).call(this,e)),await l(this,Mt)},Rw=async function(e){var c;const r=d(this,$,ic).call(this);d(this,$,vd).call(this);let i,s=!1,o=null;const a={cwd:d(this,$,Uw).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(m(this,Kr,!0),m(this,Dn,null),((c=l(this,an))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,nr).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(zz(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,nr).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,nr).setActualSessionId(e,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:e}),i=e,s=l(this,pt).size>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{m(this,Kr,!1),m(this,Dn,null),d(this,$,Rr).call(this,"final")}d(this,$,Iw).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),m(this,on,i),m(this,zt,e),m(this,fs,!0),s?(l(this,rr).add(e),l(this,cn)==="single_session"&&m(this,Ln,!1)):(l(this,rr).delete(e),m(this,Ln,l(this,cn)==="single_session")),m(this,rn,null),d(this,$,An).call(this,"ready")},Pw=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&d(this,$,Ow).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&d(this,$,Dw).call(this,r.content.text);return;case"tool_call":d(this,$,Mw).call(this,r);return;case"tool_call_update":d(this,$,zw).call(this,r);return;case"agent_thought_chunk":return;default:return}},Lw=async function(e){return{outcome:{outcome:"cancelled"}}},Dw=function(e){m(this,Dn,null);const r=Nz(e);if(!r)return;if(!l(this,ln)){const s={id:d(this,$,qi).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};m(this,ln,s.id),d(this,$,ji).call(this,s);return}const i=l(this,pt).get(l(this,ln));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");d(this,$,Gi).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Mw=function(e){d(this,$,Rr).call(this,"final");const r=d(this,$,pd).call(this,e.toolCallId),i=wv("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??d(this,$,qi).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:e.title,toolKind:e.kind??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:e.locations??(r==null?void 0:r.locations)};if(r){d(this,$,Gi).call(this,s);return}d(this,$,ji).call(this,s)},zw=function(e){const r=d(this,$,pd).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=wv(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??d(this,$,qi).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:(r==null?void 0:r.title)??e.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:o,locations:e.locations??(r==null?void 0:r.locations)};if(r){d(this,$,Gi).call(this,a);return}d(this,$,ji).call(this,a)},Ow=function(e){if(d(this,$,Rr).call(this,"final"),!e)return;const r=l(this,Kr)?l(this,Dn):null;if(!r){const s=bv(e);if(!s)return;const o={id:d(this,$,qi).call(this,"user"),kind:"user",text:s,status:"final"};d(this,$,ji).call(this,o),l(this,Kr)&&m(this,Dn,o.id);return}const i=l(this,pt).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");d(this,$,Gi).call(this,{...i,text:bv(`${i.text}${e}`)})},Rr=function(e){if(!l(this,ln))return;const r=l(this,pt).get(l(this,ln));(r==null?void 0:r.kind)==="assistant"&&d(this,$,Gi).call(this,{...r,status:e}),m(this,ln,null)},ji=function(e){l(this,pt).set(e.id,e),this.dispatchEvent(new yh("messages-changed"))},Gi=function(e){l(this,pt).set(e.id,e),this.dispatchEvent(new yh("messages-changed"))},An=function(e){l(this,hs)!==e&&(m(this,hs,e),this.dispatchEvent(new X$("status-changed")))},Nw=function(e){const r=l(this,zt);if(!r)return e;const i=l(this,et)?l(this,cn)==="single_session"?l(this,Ln)||!l(this,rr).has(r):!l(this,rr).has(r):!1,s=l(this,fs)&&(l(this,et)!==null||Cz.test(e));if(!(s||i))return e;s&&m(this,fs,!1),i&&(m(this,Ln,!1),l(this,rr).add(r));const a=["[Television screen context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."];return l(this,et)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,et).screenID}`),a.push(`screen_name: ${l(this,et).screenName??""}`),a.push("When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.")):a.push("There is currently no active Television screen."),a.push("[/Television screen context]","",e),a.join(`
43
+ `)},qi=function(e){const r=`${e}-${l(this,ps)}`;return m(this,ps,l(this,ps)+1),r},pd=function(e){for(const r of l(this,pt).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},fd=function(){if(!l(this,on))throw new Error("ACP session is not ready");return l(this,on)},ic=function(){if(!l(this,sn))throw new Error("ACP connection is not ready");return l(this,sn)},Uw=function(){var r;const e=(r=l(this,an))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},sc=function(){var r;if(l(this,cn)==="single_session")return d(this,$,md).call(this,`${Tw}-${(l(this,Ot).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,et))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return d(this,$,gd).call(this,e)},gd=function(e){return d(this,$,md).call(this,Oz(l(this,cn),e,l(this,Ot).clientGUID??"default-client"))},md=function(e){var r;return((r=l(this,an))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,ds)>0?`${e}:epoch-${l(this,ds)}`:e},ha=new WeakMap,da=new WeakMap,oc=function(){m(this,sn,null),m(this,tr,null),m(this,Mt,null),m(this,Pn,null),m(this,on,null),m(this,zt,null),m(this,an,null),l(this,un)&&(l(this,un).removeEventListener("close",l(this,ha)),l(this,un).removeEventListener("error",l(this,da)),l(this,un).close(),m(this,un,null))},Yi=function(e){const r=l(this,sn)!==null||l(this,tr)!==null||l(this,Mt)!==null||l(this,Pn)!==null||l(this,on)!==null||l(this,zt)!==null||l(this,an)!==null||l(this,un)!==null;this.disposed||this.status==="disconnected"&&!r||(d(this,$,Rr).call(this,"error"),d(this,$,oc).call(this),m(this,rn,e??null),d(this,$,An).call(this,"disconnected"))},vd=function(){const e=l(this,pt).size>0;m(this,ln,null),m(this,Dn,null),m(this,ps,1),l(this,pt).clear(),e&&this.dispatchEvent(new yh("messages-changed"))},Fw=function(){return this.status==="disconnected"};function Mz(){const n=new Map;return{getActualSessionId(t){return n.get(t)??null},setActualSessionId(t,e){n.set(t,e)},clearActualSessionId(t){n.delete(t)}}}function zz(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function Oz(n,t,e){return n==="single_session"?`${Tw}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function Hw(n){return n.replace(/^(?:\s*\n)+/,"")}function bv(n){let t=n;return t=t.replace(Az,""),t=t.replace(Tz,""),t=t.replace($z,""),t=Hw(t),t}function Nz(n){let t=n;return t=t.replace(Iz,""),t=Hw(t),t}function wv(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function Uz(n){const t=n.createSocket(Vz(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const f=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},v=x=>{const C=Hz(x);if(!C)return;let L;try{L=JSON.parse(C)}catch(R){const W=R instanceof Error?R:new Error(String(R));i(W),u.error(W);return}switch(L.type){case"acp-bridge-status":if(L.status==="ready"){let R;try{R=Fz(L)}catch(W){const N=W instanceof Error?W:new Error(String(W));e||i(N),u.error(N);return}e||(e=!0,r(R));return}if(L.status==="error"||L.status==="exited"){const R=new Error(L.error??`ACP bridge ${L.status}`);e||i(R),u.error(R)}return;case"acp-bridge-message":u.enqueue(L.message);return}},y=()=>{var C;if(h)return;h=!0;const x=new Error("ACP bridge websocket closed");e||i(x),(C=n.onDisconnect)==null||C.call(n,x),u.close()},E=()=>{var C;if(h)return;h=!0;const x=new Error("ACP bridge websocket error");e||i(x),(C=n.onDisconnect)==null||C.call(n,x),u.error(x)};t.addEventListener("open",f),t.addEventListener("message",v),t.addEventListener("close",y),t.addEventListener("error",E)}}),a=new WritableStream({async write(u){await s,t.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){t.close()},abort(){t.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:t,metadata:c}}function Fz(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0)return{agent:t,sessionIdStrategy:e,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function Hz(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 t=n.data;if(typeof t=="string")return t;if(t instanceof Uint8Array)return new TextDecoder().decode(t);if(Array.isArray(t))return Buffer.concat(t).toString("utf8")}return null}function Vz(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/acp",e.search="",e.searchParams.set("token",t),e.hash="",e.toString()}function Eh(n){return n instanceof Error?n.message:String(n)}const Sv="television.acpClientGUID",_v="television.acpMappedSessions",kv=1;var gs;class Zz{constructor(){b(this,gs,new Map)}getActualSessionId(t){return l(this,gs).get(t)??null}setActualSessionId(t,e){l(this,gs).set(t,e)}clearActualSessionId(t){l(this,gs).delete(t)}}gs=new WeakMap;var ms,pa,mt,ac,lc,yd;class Bz{constructor(t,e){b(this,mt);b(this,ms);b(this,pa);m(this,ms,t),m(this,pa,e)}getActualSessionId(t){const e=d(this,mt,lc).call(this)[d(this,mt,ac).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=d(this,mt,lc).call(this);r[d(this,mt,ac).call(this,t)]=e,d(this,mt,yd).call(this,r)}clearActualSessionId(t){const e=d(this,mt,lc).call(this);delete e[d(this,mt,ac).call(this,t)],d(this,mt,yd).call(this,e)}}ms=new WeakMap,pa=new WeakMap,mt=new WeakSet,ac=function(t){return JSON.stringify([l(this,pa),t])},lc=function(){const t=l(this,ms).getItem(_v);if(!t)return{};let e;try{e=JSON.parse(t)}catch{return{}}if(typeof e!="object"||e===null||Array.isArray(e))return{};const r=e;return r.version!==kv?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},yd=function(t){const e={version:kv,entries:t};l(this,ms).setItem(_v,JSON.stringify(e))};function Vw(){return typeof window>"u"?null:window.localStorage}function Wz(n){const t=n.getItem(Sv);if(t)return t;const e=fu().toLowerCase();return n.setItem(Sv,e),e}const Ev=4401,jz=401,Hl=1e3,Gz=3e4;class Oo extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class Zw extends It{constructor(e){var o,a;super();g(this,"url");g(this,"name");g(this,"telemetryMeta");g(this,"status","unauthorized");g(this,"screens",new Map);g(this,"client");g(this,"acpClient");g(this,"_token");g(this,"attempting",!1);g(this,"nextRetryAt",null);g(this,"hasEverConnected",!1);g(this,"hasAuthRejected",!1);g(this,"bootState","pending");g(this,"serverVersion",null);g(this,"updateState",null);g(this,"decideBoot");g(this,"navigationPending");g(this,"createSocket");g(this,"createClient");g(this,"socket",null);g(this,"connectAttempt",0);g(this,"autoReconnect",!1);g(this,"retryTimer",null);g(this,"retryDelay",Hl);g(this,"visibilityEventTarget");g(this,"networkEventTarget");g(this,"onVisibilityChange");g(this,"onNetworkOnline");g(this,"telemetryActivityAgent");this.url=ee(e.url),this.name=e.name,this.decideBoot=e.decideBoot??null,this.navigationPending=e.navigationPending??(()=>!1),this._token=e.token??null,this.telemetryMeta=e.telemetryMeta??null,this.createSocket=e.createSocket??(c=>new WebSocket(c)),this.createClient=e.createClient??((c,u,h)=>new xC(c,{token:u??void 0,onUnauthorized:()=>this.handleAuthRejected(),...h?{telemetryMeta:h}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=e.mappedSessionStore??(e.acpStorage?new Bz(e.acpStorage,this.url):new Zz);this.acpClient=new Dz({serverURL:this.url,token:this._token??"",...e.createACPSocket?{createSocket:e.createACPSocket}:e.createSocket?{createSocket:e.createSocket}:{},...e.clientGUID?{clientGUID:e.clientGUID}:{},mappedSessionStore:r}),this.visibilityEventTarget=e.visibilityEventTarget!==void 0?e.visibilityEventTarget:typeof document<"u"?document:null,this.networkEventTarget=e.networkEventTarget!==void 0?e.networkEventTarget:typeof window<"u"?window:null,this.onVisibilityChange=()=>{this.isPageVisible()&&this.kickReconnect()},this.onNetworkOnline=()=>{this.kickReconnect()},(o=this.visibilityEventTarget)==null||o.addEventListener("visibilitychange",this.onVisibilityChange),(a=this.networkEventTarget)==null||a.addEventListener("online",this.onNetworkOnline);const i=e.telemetryDocumentTarget!==void 0?e.telemetryDocumentTarget:typeof document<"u"?document:null,s=e.telemetryWindowTarget!==void 0?e.telemetryWindowTarget:typeof window<"u"?window:null;this.telemetryActivityAgent=this.telemetryMeta&&i&&s?iD({meta:this.telemetryMeta,documentTarget:i,windowTarget:s,send:c=>this.sendTelemetryActivity(c)}):null}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null,this.telemetryMeta)}async connect(e){this._token=e,this.hasAuthRejected=!1,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Hl,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i,s;this.autoReconnect=!1,this.connectAttempt+=1,this.cancelRetryTimer(),(e=this.socket)==null||e.close(),this.socket=null,this.setStatus("unauthorized"),(r=this.visibilityEventTarget)==null||r.removeEventListener("visibilitychange",this.onVisibilityChange),(i=this.networkEventTarget)==null||i.removeEventListener("online",this.onNetworkOnline),(s=this.telemetryActivityAgent)==null||s.stop(),this.acpClient.dispose()}getViewURL(e){const r=Tc(e,{electron:Wt()});return Wt()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(e){const r=Tc(e,{electron:Wt()}).contentURL;return r===null?null:new URL(r,this.url).toString()}async createScreen(e){const{screen:r}=await this.client.screens.create({name:e});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(e){switch(e.type){case"screen-created":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new So("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new So("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new So("screens-changed"));break;case"artifact-created":{const r=this.screens.get(e.screenID);r&&!ec(r).includes(e.artifact.id)&&(r.layout=[...r.layout,Zb(e.artifact.id)]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=Lb(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return qz(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1,this.bootState="pending";const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token,this.telemetryMeta),this.setStatus("disconnected"),this.dispatchEvent(new ie("change"));const r=this.createSocket(Yz(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{var f;a||this.connectAttempt!==e||(a=!0,this.retryDelay=Hl,this.hasEverConnected=!0,this.setStatus("connected"),(f=this.telemetryActivityAgent)==null||f.start(),s())},u=f=>{a||this.connectAttempt!==e||(a=!0,o(f))},h=async()=>{const f=this.hasEverConnected;try{const[{screens:v},y]=await Promise.all([this.client.screens.list(),this.client.display.get()]);this.screens=new Map(v.map(E=>[E.id,structuredClone(E)])),this.acpClient.setEnabled(y.acpEnabled),this.dispatchEvent(new ie("change")),f&&this.dispatchEvent(new So("screens-changed")),this.dispatchEvent(new td("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:y.activeScreenID}})),c(),f&&this.connectAttempt===e&&this.dispatchEvent(new Ib("server-reconnected",{serverURL:this.url}))}catch(v){if(tO(v)){u(new Oo);return}u(v instanceof Error?v:new Error(String(v)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||h())}),r.addEventListener("message",f=>{const v=eO(f);if(!v)return;if(v.type==="server-status"){const E=v;this.serverVersion=E.version,this.updateState=E.update??null;let x=!1,C=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===e&&(this.decideBoot(E)==="boot"?(this.bootState="booted",x=!0):(this.bootState="halted",this.attempting=!1,C=!0)),this.dispatchEvent(new Rb("server-status",{serverURL:this.url,message:E})),x?this.navigationPending()||h():C&&this.dispatchEvent(new ie("change"));return}if(!Qz(v.type))return;const y=v;this.applyServerEvent(y),this.dispatchEvent(new td("server-event",{serverURL:this.url,event:y}))}),r.addEventListener("close",f=>{if(this.connectAttempt!==e)return;this.socket=null;const v=Kz(f);if(!a){u(v===Ev?new Oo:new Error("Connection closed before initialization"));return}if(v===Ev){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===e){if(a){this.handleTransportFailure(new Error("WebSocket error"));return}u(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAuthRejected(){this.hasAuthRejected=!0,this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized")}handleAttemptFailure(e){if(e instanceof Oo){this.handleAuthRejected();return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(e){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const e=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,Gz),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new ie("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new ie("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Hl,this.attempt().catch(()=>{})))}sendTelemetryActivity(e){var r;this.status==="connected"&&((r=this.socket)==null||r.send(JSON.stringify(e)))}sendTelemetrySignal(e,r){var s;if(!this.telemetryMeta||this.status!=="connected"&&this.bootState!=="halted")return;const i={type:pC,clientId:this.telemetryMeta.clientId,event:e,properties:r};(s=this.socket)==null||s.send(JSON.stringify(i))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new ie("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function qz(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function Yz(n,t,e=null){const r=new URL(n);if(r.protocol=r.protocol==="https:"?"wss:":"ws:",r.pathname="/events",r.search="",t&&r.searchParams.set("token",t),e)for(const[i,s]of rD(e))r.searchParams.set(i,s);return r.hash="",r.toString()}function Kz(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const Jz={"artifact-created":!0,"artifact-updated":!0,"artifact-content-changed":!0,"artifact-removed":!0,"screen-created":!0,"screen-updated":!0,"screen-removed":!0,"screen-changed":!0,"theme-changed":!0,"artifact-focus":!0},Xz=new Set(Object.keys(Jz));function Qz(n){return Xz.has(n)}function eO(n){const t=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return typeof e!="object"||e===null||!("type"in e)||typeof e.type!="string"?null:e}function tO(n){return n instanceof sf&&n.status===jz}const nO="Local";var fa,bd;class rO extends It{constructor(e){super();b(this,fa);g(this,"servers",new Map);g(this,"localServerURL");g(this,"clientGUID");g(this,"acpStorage");g(this,"telemetryMeta");g(this,"localStore");g(this,"bootBarrier");g(this,"navigationPending");g(this,"createSocket");g(this,"lastActiveServerURL");g(this,"serverListeners",new Map);g(this,"handleLocalStoreChange",()=>{const e=this.localStore.get().activeServerURL;e!==this.lastActiveServerURL&&(this.lastActiveServerURL=e,this.dispatchEvent(new ie("change")))});this.localStore=e.localStore,this.bootBarrier=e.bootBarrier??null,this.navigationPending=e.navigationPending??null,this.localServerURL=e.localServerURL?ee(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?Vw():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?Wz(r):fu().toLowerCase()),this.telemetryMeta=e.telemetryMeta??null,this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const e=this.localStore.get().activeServerURL;return e===null?null:this.servers.get(e)??null}add(e){const r=ee(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e),this.bootBarrier&&ee(this.bootBarrier.serverURL)===r&&(e.decideBoot=this.bootBarrier.decideBoot),this.navigationPending!==null&&(e.navigationPending=this.navigationPending);const s=()=>{this.dispatchEvent(new ie("change"))},o=h=>{this.dispatchEvent(new td("server-event",{serverURL:h.serverURL,event:h.event}))},a=()=>{this.dispatchEvent(new So("screens-changed"))},c=h=>{this.dispatchEvent(new Ib("server-reconnected",{serverURL:h.serverURL}))},u=h=>{this.dispatchEvent(new Rb("server-status",{serverURL:h.serverURL,message:h.message}))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),e.addEventListener("server-reconnected",c),e.addEventListener("server-status",u),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a,onServerReconnected:c,onServerStatus:u}),this.dispatchEvent(new ie("change"))}remove(e){const r=ee(e);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),i.removeEventListener("server-reconnected",s.onServerReconnected),i.removeEventListener("server-status",s.onServerStatus),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 ie("change"))}getStoredAuthToken(e){return wh(this.localStore.get(),e)}setStoredAuthToken(e,r){this.localStore.set(UC(this.localStore.get(),e,r))}clearStoredAuthToken(e){const r=this.localStore.get(),i=FC(r,e);i!==r&&this.localStore.set(i)}setActive(e){const r=this.localStore.get(),i=e?ee(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?ee(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>ee(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:nO}]})}const s=this.localStore.get().servers;for(const a of s){const c=ee(a.url),h=i!==null&&c===i?r??wh(this.localStore.get(),c):wh(this.localStore.get(),c),f=d(this,fa,bd).call(this,{url:a.url,name:a.name,token:h});this.add(f),f.connect(h).catch(()=>{})}const o=i?this.servers.get(i)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(e,r){const i=ee(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>ee(a.url)!==i),{url:i,name:r}]});const o=d(this,fa,bd).call(this,{url:i,name:r,token:this.getStoredAuthToken(i)});this.add(o),this.setActive(o),o.connect(o.token).catch(()=>{})}removeServer(e){this.remove(e)}}fa=new WeakSet,bd=function(e){return new Zw({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage,telemetryMeta:this.telemetryMeta})};var ga;class iO extends It{constructor(){super();b(this,ga,e=>{const r=sO(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new J$("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,ga))}dispose(){document.removeEventListener("keydown",l(this,ga))}}ga=new WeakMap;function sO(n){for(const[t,e]of Object.entries(AC))if(oO(n,e.trigger))return t;return null}function oO(n,t){return!(n.key.toLowerCase()!==t.key.toLowerCase()||n.metaKey!==!!t.meta||n.ctrlKey!==!!t.ctrl||n.shiftKey!==!!t.shift||n.altKey!==!!t.alt)}const wd="tv-nav:",Zs="tv-reload",xv=100,aO=1e3,lO=60,cO=60,uO=24,hO=30,dO=hO*uO*cO*lO*aO;function Fn(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Zs);return t.searchParams.delete(Zs),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var ma,vs,de,oe,Jr,Ae,Bw,Gn,Ww,Sd,_d;class pO extends It{constructor(e,r){super();b(this,Ae);b(this,ma);b(this,vs);b(this,de,[]);b(this,oe,-1);b(this,Jr,0);m(this,ma,e),m(this,vs,Fn(r)),d(this,Ae,Bw).call(this)}get currentURL(){var e;return l(this,oe)===-1?null:((e=l(this,de)[l(this,oe)])==null?void 0:e.url)??null}get canGoBack(){return l(this,oe)>-1}get canGoForward(){return l(this,oe)<l(this,de).length-1}get entries(){return l(this,de).map(e=>({...e}))}get cursor(){return l(this,oe)}navigate(e){const r=Fn(e);if(r===l(this,vs)){if(l(this,oe)===-1)return;m(this,oe,-1),d(this,Ae,Gn).call(this);return}l(this,oe)<l(this,de).length-1&&m(this,de,l(this,de).slice(0,l(this,oe)+1)),l(this,de).push({url:r}),m(this,oe,l(this,de).length-1),d(this,Ae,Sd).call(this),d(this,Ae,Gn).call(this)}replace(e){var i;if(l(this,oe)===-1){this.navigate(e);return}const r=Fn(e);if(r===l(this,vs)){m(this,de,l(this,de).filter((s,o)=>o!==l(this,oe))),m(this,oe,-1),d(this,Ae,Gn).call(this);return}((i=l(this,de)[l(this,oe)])==null?void 0:i.url)!==r&&(m(this,de,l(this,de).map((s,o)=>o===l(this,oe)?{url:r}:s)),d(this,Ae,Gn).call(this))}back(){l(this,oe)!==-1&&(m(this,oe,l(this,oe)-1),d(this,Ae,Gn).call(this))}forward(){this.canGoForward&&(m(this,oe,l(this,oe)+1),d(this,Ae,Gn).call(this))}reset(){l(this,oe)===-1&&l(this,de).length===0||(m(this,de,[]),m(this,oe,-1),d(this,Ae,Gn).call(this))}}ma=new WeakMap,vs=new WeakMap,de=new WeakMap,oe=new WeakMap,Jr=new WeakMap,Ae=new WeakSet,Bw=function(){const e=localStorage.getItem(l(this,Ae,_d));if(e!==null)try{const r=JSON.parse(e);if(!jw(r))return;m(this,de,r.entries.map(i=>({url:i.url}))),m(this,oe,r.cursor),m(this,Jr,r.lastWritten),d(this,Ae,Sd).call(this)}catch{m(this,de,[]),m(this,oe,-1),m(this,Jr,0)}},Gn=function(){m(this,Jr,Date.now());try{localStorage.setItem(l(this,Ae,_d),JSON.stringify(d(this,Ae,Ww).call(this)))}catch(e){if(!mO(e))throw e}this.dispatchEvent(new ie("change"))},Ww=function(){return{v:1,entries:l(this,de).map(e=>({...e})),cursor:l(this,oe),lastWritten:l(this,Jr)}},Sd=function(){if(l(this,de).length<=xv)return;const e=l(this,de).length-xv;m(this,de,l(this,de).slice(e)),m(this,oe,Math.max(-1,l(this,oe)-e))},_d=function(){return fO(l(this,ma))};function fO(n){return`${wd}${n}`}function gO(n){const t=Date.now()-dO,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(wd)))continue;const s=i.slice(wd.length),o=localStorage.getItem(i);if(o===null)continue;let a;try{a=JSON.parse(o)}catch{e.push(i);continue}if(!jw(a)){e.push(i);continue}!n.has(s)&&a.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function mO(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function jw(n){if(typeof n!="object"||n===null)return!1;const t=n;if(t.v!==1||!Array.isArray(t.entries))return!1;const e=t.cursor;return typeof e!="number"||!Number.isInteger(e)||typeof t.lastWritten!="number"||!Number.isFinite(t.lastWritten)||e<-1||e>=t.entries.length?!1:t.entries.every(r=>typeof r=="object"&&r!==null&&typeof r.url=="string")}const vO="0.1.186";function mf(n=vO){return n!==void 0&&n.length>0?n:"0.0.0"}function vf(){let n=!1;return{get pending(){return n},begin(t){n||(n=!0,t())}}}const kd="tv-reload-attempted";function yO(n){return n.originMatch?n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:CC(n.bundleVersion,n.serverVersion)?n.marker!==null&&n.marker.serverVersion===n.serverVersion?{action:"none"}:{action:"reload",marker:{serverVersion:n.serverVersion,fromVersion:n.bundleVersion}}:{action:"none"}:{action:"none"}}function bO(n){const t=n.getItem(kd);if(t===null)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object")return null;const r=e;return typeof r.serverVersion!="string"||typeof r.fromVersion!="string"?null:{serverVersion:r.serverVersion,fromVersion:r.fromVersion}}function wO(n){const t=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,e=n.reload??(()=>location.reload()),r=n.navigationLatch??vf(),i=n.bundleVersion??mf();if(t===null)return{dispose(){}};let s=null;const o=()=>{if(s===null)return;const u=n.manager.servers.get(n.primaryServerURL);if(!u||u.status!=="connected")return;const h=s;s=null,u.sendTelemetrySignal("client_autoreloaded",{from_version:h.fromVersion,to_version:h.toVersion})},a=u=>{if(r.pending)return;const h=yO({bundleVersion:i,serverVersion:u.message.version,originMatch:u.serverURL===n.primaryServerURL,marker:bO(t)});switch(h.action){case"reload":t.setItem(kd,JSON.stringify(h.marker)),r.begin(e);return;case"signal-autoreloaded":t.removeItem(kd),s={fromVersion:h.fromVersion,toVersion:h.toVersion},o();return;case"none":return}},c=()=>{o()};return n.manager.addEventListener("server-status",a),n.manager.addEventListener("change",c),{dispose(){n.manager.removeEventListener("server-status",a),n.manager.removeEventListener("change",c)}}}function SO(n){const t=Wt(n.search),e=W0(n.search),r=e!==null&&of(e)?e:null;return{electron:t,shellVersion:r}}function _O(n){return!n.electron||n.requiredDesktopVersion===null||!of(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===nd?!1:jb(n.requiredDesktopVersion,n.shellVersion)}const kO=`# Desktop app upgrade required
44
44
 
45
45
  Your Television server requires a newer version of this desktop app.
46
46
  In a terminal, please upgrade:
@@ -53,44 +53,44 @@ Then quit this app, and relaunch it from the terminal with:
53
53
 
54
54
  \`\`\`bash
55
55
  tv-desktop
56
- \`\`\``;function Yw(n){return n===null?xO:n.upgradeMarkdown}function AO(n){const t=EO(n);return{gated:t,instructionsMarkdown:t?Yw(n.desktop):null,suppressUpdateToast:t}}/**
56
+ \`\`\``;function Gw(n){return n===null?kO:n.upgradeMarkdown}function EO(n){const t=_O(n);return{gated:t,instructionsMarkdown:t?Gw(n.desktop):null,suppressUpdateToast:t}}/**
57
57
  * @license
58
58
  * Copyright 2017 Google LLC
59
59
  * SPDX-License-Identifier: BSD-3-Clause
60
- */const No=globalThis,$v=n=>n,$c=No.trustedTypes,Cv=$c?$c.createPolicy("lit-html",{createHTML:n=>n}):void 0,Kw="$lit$",Kn=`lit$${Math.random().toFixed(9).slice(2)}$`,Jw="?"+Kn,TO=`<${Jw}>`,wi=document,jo=()=>wi.createComment(""),Go=n=>n===null||typeof n!="object"&&typeof n!="function",bf=Array.isArray,$O=n=>bf(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Ah=`[
61
- \f\r]`,ho=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Iv=/-->/g,Rv=/>/g,Ar=RegExp(`>|${Ah}(?:([^\\s"'>=/]+)(${Ah}*=${Ah}*(?:[^
62
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Pv=/'/g,Lv=/"/g,Xw=/^(?:script|style|textarea|title)$/i,CO=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),P=CO(1),Si=Symbol.for("lit-noChange"),ue=Symbol.for("lit-nothing"),Dv=new WeakMap,Fr=wi.createTreeWalker(wi,129);function Qw(n,t){if(!bf(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Cv!==void 0?Cv.createHTML(t):t}const IO=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=ho;for(let a=0;a<e;a++){const c=n[a];let u,h,f=-1,v=0;for(;v<c.length&&(o.lastIndex=v,h=o.exec(c),h!==null);)v=o.lastIndex,o===ho?h[1]==="!--"?o=Iv:h[1]!==void 0?o=Rv:h[2]!==void 0?(Xw.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Ar):h[3]!==void 0&&(o=Ar):o===Ar?h[0]===">"?(o=i??ho,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Ar:h[3]==='"'?Lv:Pv):o===Lv||o===Pv?o=Ar:o===Iv||o===Rv?o=ho:(o=Ar,i=void 0);const y=o===Ar&&n[a+1].startsWith("/>")?" ":"";s+=o===ho?c+TO:f>=0?(r.push(u),c.slice(0,f)+Kw+c.slice(f)+Kn+y):c+Kn+(f===-2?a:y)}return[Qw(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class qo{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[u,h]=IO(t,e);if(this.el=qo.createElement(u,r),Fr.currentNode=this.el.content,e===2||e===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Fr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const f of i.getAttributeNames())if(f.endsWith(Kw)){const v=h[o++],y=i.getAttribute(f).split(Kn),E=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:E[2],strings:y,ctor:E[1]==="."?PO:E[1]==="?"?LO:E[1]==="@"?DO:xu}),i.removeAttribute(f)}else f.startsWith(Kn)&&(c.push({type:6,index:s}),i.removeAttribute(f));if(Xw.test(i.tagName)){const f=i.textContent.split(Kn),v=f.length-1;if(v>0){i.textContent=$c?$c.emptyScript:"";for(let y=0;y<v;y++)i.append(f[y],jo()),Fr.nextNode(),c.push({type:2,index:++s});i.append(f[v],jo())}}}else if(i.nodeType===8)if(i.data===Jw)c.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(Kn,f+1))!==-1;)c.push({type:7,index:s}),f+=Kn.length-1}s++}}static createElement(t,e){const r=wi.createElement("template");return r.innerHTML=t,r}}function Bs(n,t,e=n,r){var o,a;if(t===Si)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=Go(t)?void 0:t._$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,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Bs(n,i._$AS(n,t.values),i,r)),t}class RO{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=((t==null?void 0:t.creationScope)??wi).importNode(e,!0);Fr.currentNode=i;let s=Fr.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Eu(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new MO(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Fr.nextNode(),o++)}return Fr.currentNode=wi,i}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}let Eu=class eS{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=ue,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Bs(this,t,e),Go(t)?t===ue||t==null||t===""?(this._$AH!==ue&&this._$AR(),this._$AH=ue):t!==this._$AH&&t!==Si&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):$O(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==ue&&Go(this._$AH)?this._$AA.nextSibling.data=t:this.T(wi.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=qo.createElement(Qw(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(e);else{const o=new RO(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Dv.get(t.strings);return e===void 0&&Dv.set(t.strings,e=new qo(t)),e}k(t){bf(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const s of t)i===e.length?e.push(r=new eS(this.O(jo()),this.O(jo()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t!==this._$AB;){const i=$v(t).nextSibling;$v(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},xu=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=ue,this._$AN=void 0,this.element=t,this.name=e,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=ue}_$AI(t,e=this,r,i){const s=this.strings;let o=!1;if(s===void 0)t=Bs(this,t,e,0),o=!Go(t)||t!==this._$AH&&t!==Si,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=Bs(this,a[r+c],e,c),u===Si&&(u=this._$AH[c]),o||(o=!Go(u)||u!==this._$AH[c]),u===ue?t=ue:t!==ue&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===ue?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},PO=class extends xu{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ue?void 0:t}},LO=class extends xu{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==ue)}},DO=class extends xu{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Bs(this,t,e,0)??ue)===Si)return;const r=this._$AH,i=t===ue&&r!==ue||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==ue&&(r===ue||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}};class MO{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Bs(this,t)}}const zO={I:Eu},Th=No.litHtmlPolyfillSupport;Th==null||Th(qo,Eu),(No.litHtmlVersions??(No.litHtmlVersions=[])).push("3.3.2");const Ue=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Eu(t.insertBefore(jo(),null),null,void 0,{})),i._$AI(n),i};/**
60
+ */const No=globalThis,Av=n=>n,$c=No.trustedTypes,Tv=$c?$c.createPolicy("lit-html",{createHTML:n=>n}):void 0,qw="$lit$",Kn=`lit$${Math.random().toFixed(9).slice(2)}$`,Yw="?"+Kn,xO=`<${Yw}>`,wi=document,jo=()=>wi.createComment(""),Go=n=>n===null||typeof n!="object"&&typeof n!="function",yf=Array.isArray,AO=n=>yf(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",xh=`[
61
+ \f\r]`,ho=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$v=/-->/g,Cv=/>/g,Ar=RegExp(`>|${xh}(?:([^\\s"'>=/]+)(${xh}*=${xh}*(?:[^
62
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Iv=/'/g,Rv=/"/g,Kw=/^(?:script|style|textarea|title)$/i,TO=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),P=TO(1),Si=Symbol.for("lit-noChange"),ue=Symbol.for("lit-nothing"),Pv=new WeakMap,Fr=wi.createTreeWalker(wi,129);function Jw(n,t){if(!yf(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tv!==void 0?Tv.createHTML(t):t}const $O=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=ho;for(let a=0;a<e;a++){const c=n[a];let u,h,f=-1,v=0;for(;v<c.length&&(o.lastIndex=v,h=o.exec(c),h!==null);)v=o.lastIndex,o===ho?h[1]==="!--"?o=$v:h[1]!==void 0?o=Cv:h[2]!==void 0?(Kw.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Ar):h[3]!==void 0&&(o=Ar):o===Ar?h[0]===">"?(o=i??ho,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Ar:h[3]==='"'?Rv:Iv):o===Rv||o===Iv?o=Ar:o===$v||o===Cv?o=ho:(o=Ar,i=void 0);const y=o===Ar&&n[a+1].startsWith("/>")?" ":"";s+=o===ho?c+xO:f>=0?(r.push(u),c.slice(0,f)+qw+c.slice(f)+Kn+y):c+Kn+(f===-2?a:y)}return[Jw(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class qo{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,o=0;const a=t.length-1,c=this.parts,[u,h]=$O(t,e);if(this.el=qo.createElement(u,r),Fr.currentNode=this.el.content,e===2||e===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Fr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const f of i.getAttributeNames())if(f.endsWith(qw)){const v=h[o++],y=i.getAttribute(f).split(Kn),E=/([.?@])?(.*)/.exec(v);c.push({type:1,index:s,name:E[2],strings:y,ctor:E[1]==="."?IO:E[1]==="?"?RO:E[1]==="@"?PO:xu}),i.removeAttribute(f)}else f.startsWith(Kn)&&(c.push({type:6,index:s}),i.removeAttribute(f));if(Kw.test(i.tagName)){const f=i.textContent.split(Kn),v=f.length-1;if(v>0){i.textContent=$c?$c.emptyScript:"";for(let y=0;y<v;y++)i.append(f[y],jo()),Fr.nextNode(),c.push({type:2,index:++s});i.append(f[v],jo())}}}else if(i.nodeType===8)if(i.data===Yw)c.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(Kn,f+1))!==-1;)c.push({type:7,index:s}),f+=Kn.length-1}s++}}static createElement(t,e){const r=wi.createElement("template");return r.innerHTML=t,r}}function Bs(n,t,e=n,r){var o,a;if(t===Si)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=Go(t)?void 0:t._$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,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Bs(n,i._$AS(n,t.values),i,r)),t}class CO{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=((t==null?void 0:t.creationScope)??wi).importNode(e,!0);Fr.currentNode=i;let s=Fr.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Eu(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new LO(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Fr.nextNode(),o++)}return Fr.currentNode=wi,i}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}let Eu=class Xw{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=ue,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Bs(this,t,e),Go(t)?t===ue||t==null||t===""?(this._$AH!==ue&&this._$AR(),this._$AH=ue):t!==this._$AH&&t!==Si&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):AO(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==ue&&Go(this._$AH)?this._$AA.nextSibling.data=t:this.T(wi.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=qo.createElement(Jw(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(e);else{const o=new CO(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Pv.get(t.strings);return e===void 0&&Pv.set(t.strings,e=new qo(t)),e}k(t){yf(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const s of t)i===e.length?e.push(r=new Xw(this.O(jo()),this.O(jo()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t!==this._$AB;){const i=Av(t).nextSibling;Av(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},xu=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=ue,this._$AN=void 0,this.element=t,this.name=e,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=ue}_$AI(t,e=this,r,i){const s=this.strings;let o=!1;if(s===void 0)t=Bs(this,t,e,0),o=!Go(t)||t!==this._$AH&&t!==Si,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=Bs(this,a[r+c],e,c),u===Si&&(u=this._$AH[c]),o||(o=!Go(u)||u!==this._$AH[c]),u===ue?t=ue:t!==ue&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===ue?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},IO=class extends xu{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ue?void 0:t}},RO=class extends xu{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==ue)}},PO=class extends xu{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Bs(this,t,e,0)??ue)===Si)return;const r=this._$AH,i=t===ue&&r!==ue||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==ue&&(r===ue||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}};class LO{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Bs(this,t)}}const DO={I:Eu},Ah=No.litHtmlPolyfillSupport;Ah==null||Ah(qo,Eu),(No.litHtmlVersions??(No.litHtmlVersions=[])).push("3.3.2");const Ue=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Eu(t.insertBefore(jo(),null),null,void 0,{})),i._$AI(n),i};/**
63
63
  * @license
64
64
  * Copyright 2017 Google LLC
65
65
  * SPDX-License-Identifier: BSD-3-Clause
66
- */const wf={CHILD:2},Au=n=>(...t)=>({_$litDirective$:n,values:t});let Sf=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
66
+ */const bf={CHILD:2},Au=n=>(...t)=>({_$litDirective$:n,values:t});let wf=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
67
67
  * @license
68
68
  * Copyright 2017 Google LLC
69
69
  * SPDX-License-Identifier: BSD-3-Clause
70
- */let Cc=class extends Sf{constructor(t){if(super(t),this.it=ue,t.type!==wf.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===ue||t==null)return this._t=void 0,this.it=t;if(t===Si)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Cc.directiveName="unsafeHTML",Cc.resultType=1;const OO=Au(Cc);/**
70
+ */let Cc=class extends wf{constructor(t){if(super(t),this.it=ue,t.type!==bf.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===ue||t==null)return this._t=void 0,this.it=t;if(t===Si)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Cc.directiveName="unsafeHTML",Cc.resultType=1;const MO=Au(Cc);/**
71
71
  * @license
72
72
  * Copyright 2017 Google LLC
73
73
  * SPDX-License-Identifier: BSD-3-Clause
74
- */let xd=class extends Cc{};xd.directiveName="unsafeSVG",xd.resultType=2;const tS=Au(xd),NO={size:16,color:"currentColor",weight:"regular"};function UO(n){return typeof n=="string"?{regular:n}:n}function Pt(n,t="0 0 256 256"){const e=UO(n);return r=>{const{size:i,color:s,weight:o}={...NO,...r},a=e[o]??e.regular;return P`<svg
74
+ */let Ed=class extends Cc{};Ed.directiveName="unsafeSVG",Ed.resultType=2;const Qw=Au(Ed),zO={size:16,color:"currentColor",weight:"regular"};function OO(n){return typeof n=="string"?{regular:n}:n}function Pt(n,t="0 0 256 256"){const e=OO(n);return r=>{const{size:i,color:s,weight:o}={...zO,...r},a=e[o]??e.regular;return P`<svg
75
75
  xmlns="http://www.w3.org/2000/svg"
76
76
  data-ui-icon=""
77
77
  width="${i}"
78
78
  height="${i}"
79
79
  viewBox="${t}"
80
80
  fill="${s}"
81
- >${tS(a)}</svg>`}}/**
81
+ >${Qw(a)}</svg>`}}/**
82
82
  * @license
83
83
  * Copyright 2020 Google LLC
84
84
  * SPDX-License-Identifier: BSD-3-Clause
85
- */const{I:FO}=zO,Mv=n=>n,HO=n=>n.strings===void 0,zv=()=>document.createComment(""),po=(n,t,e)=>{var s;const r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){const o=r.insertBefore(zv(),i),a=r.insertBefore(zv(),i);e=new FO(o,a,n,n.options)}else{const o=e._$AB.nextSibling,a=e._$AM,c=a!==n;if(c){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==a._$AU&&e._$AP(u)}if(o!==i||c){let u=e._$AA;for(;u!==o;){const h=Mv(u).nextSibling;Mv(r).insertBefore(u,i),u=h}}}return e},Tr=(n,t,e=n)=>(n._$AI(t,e),n),VO={},ZO=(n,t=VO)=>n._$AH=t,BO=n=>n._$AH,$h=n=>{n._$AR(),n._$AA.remove()};/**
85
+ */const{I:NO}=DO,Lv=n=>n,UO=n=>n.strings===void 0,Dv=()=>document.createComment(""),po=(n,t,e)=>{var s;const r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){const o=r.insertBefore(Dv(),i),a=r.insertBefore(Dv(),i);e=new NO(o,a,n,n.options)}else{const o=e._$AB.nextSibling,a=e._$AM,c=a!==n;if(c){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==a._$AU&&e._$AP(u)}if(o!==i||c){let u=e._$AA;for(;u!==o;){const h=Lv(u).nextSibling;Lv(r).insertBefore(u,i),u=h}}}return e},Tr=(n,t,e=n)=>(n._$AI(t,e),n),FO={},HO=(n,t=FO)=>n._$AH=t,VO=n=>n._$AH,Th=n=>{n._$AR(),n._$AA.remove()};/**
86
86
  * @license
87
87
  * Copyright 2017 Google LLC
88
88
  * SPDX-License-Identifier: BSD-3-Clause
89
- */const Uo=(n,t)=>{var r;const e=n._$AN;if(e===void 0)return!1;for(const i of e)(r=i._$AO)==null||r.call(i,t,!1),Uo(i,t);return!0},Ic=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while((e==null?void 0:e.size)===0)},nS=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),GO(t)}};function WO(n){this._$AN!==void 0?(Ic(this),this._$AM=n,nS(this)):this._$AM=n}function jO(n,t=!1,e=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)Uo(r[s],!1),Ic(r[s]);else r!=null&&(Uo(r,!1),Ic(r));else Uo(this,n)}const GO=n=>{n.type==wf.CHILD&&(n._$AP??(n._$AP=jO),n._$AQ??(n._$AQ=WO))};class qO extends Sf{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),nS(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,i;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),e&&(Uo(this,t),Ic(this))}setValue(t){if(HO(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/**
89
+ */const Uo=(n,t)=>{var r;const e=n._$AN;if(e===void 0)return!1;for(const i of e)(r=i._$AO)==null||r.call(i,t,!1),Uo(i,t);return!0},Ic=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while((e==null?void 0:e.size)===0)},eS=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),WO(t)}};function ZO(n){this._$AN!==void 0?(Ic(this),this._$AM=n,eS(this)):this._$AM=n}function BO(n,t=!1,e=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)Uo(r[s],!1),Ic(r[s]);else r!=null&&(Uo(r,!1),Ic(r));else Uo(this,n)}const WO=n=>{n.type==bf.CHILD&&(n._$AP??(n._$AP=BO),n._$AQ??(n._$AQ=ZO))};class jO extends wf{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),eS(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,i;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),e&&(Uo(this,t),Ic(this))}setValue(t){if(UO(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/**
90
90
  * @license
91
91
  * Copyright 2020 Google LLC
92
92
  * SPDX-License-Identifier: BSD-3-Clause
93
- */const Hr=()=>new YO;class YO{}const Ch=new WeakMap,Vr=Au(class extends qO{render(n){return ue}update(n,[t]){var r;const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),ue}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=Ch.get(t);e===void 0&&(e=new WeakMap,Ch.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,t;return typeof this.G=="function"?(n=Ch.get(this.ht??globalThis))==null?void 0:n.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),_f=Pt('<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"/>'),KO=Pt('<path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/>'),JO=Pt('<path d="M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z"/>'),Rc=Pt('<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"/>'),XO=Pt('<path d="M213.66,162.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,53.66,173.66L128,99.31l74.34,74.35a8,8,0,0,0,11.32-11.32Z"/>'),QO=Pt({regular:'<path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64Zm0,136H40V80H216V200Z"/>',bold:'<path d="M216,60H157l27.52-27.52a12,12,0,0,0-17-17L128,55,88.49,15.51a12,12,0,0,0-17,17L99,60H40A20,20,0,0,0,20,80V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V80A20,20,0,0,0,216,60Zm-4,136H44V84H212Z"/>'}),e8=Pt({regular:'<path d="M224,160V96a8,8,0,0,0-8-8H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V160Zm-60.69,48-40-40h33.38l40,40ZM168,156.69V123.31l40,40v33.38Zm40-16L171.31,104H208ZM48,48H152v56h0v48H48Zm56,123.31L140.69,208H104Z"/>',duotone:'<path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/>'}),t8=Pt({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"/>',duotone:'<path d="M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z" opacity="0.2"/><path d="M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,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,64H56V152h48v48Z"/>'}),n8=Pt('<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"/>'),r8=Pt({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"/>'}),rS=Pt({regular:'<path d="M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"/>',bold:'<path d="M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm84,84H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"/>'}),i8=Pt('<path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/>');class s8 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const Ov='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Ih=4;var ze,ot,Xr,at,va,ys,bs,Z,Ad,Td,sS,cc,oS,$d,Cd,ya,ba,Qr,aS,Id,Rd,Pd,lS,xo,Ki;class iS extends HTMLElement{constructor(){super();b(this,Z);b(this,ze,!1);b(this,ot,null);b(this,Xr);b(this,at,null);b(this,va,"bottom-start");b(this,ys,!1);b(this,bs,!1);b(this,ya,e=>{l(this,ze)&&(l(this,ys)||this.hasAttribute("no-light-dismiss")||e.composedPath().includes(this)||(this.open=!1))});b(this,ba,e=>{if(l(this,ze)&&!(this.hasAttribute("no-autofocus")&&!d(this,Z,Rd).call(this))){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&d(this,Z,aS).call(this,e)}});b(this,Qr,()=>{l(this,ze)&&d(this,Z,xo).call(this)});m(this,Xr,this.attachShadow({mode:"open"})),nf(l(this,Xr)),d(this,Z,Td).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),d(this,Z,Td).call(this,"open"),d(this,Z,Ki).call(this),l(this,ze)&&(d(this,Z,$d).call(this),d(this,Z,cc).call(this))}disconnectedCallback(){var e;d(this,Z,Cd).call(this),(e=l(this,ot))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?d(this,Z,sS).call(this,this.hasAttribute("open")):e==="material"&&l(this,ze)?(d(this,Z,Ki).call(this),d(this,Z,cc).call(this)):e==="placement"&&l(this,ze)&&d(this,Z,xo).call(this)}get open(){return l(this,ze)}set open(e){this.toggleAttribute("open",e)}get anchor(){return l(this,ot)}set anchor(e){l(this,ot)!==e&&(l(this,ot)&&l(this,ot).removeAttribute("aria-expanded"),m(this,ot,e),d(this,Z,Ad).call(this),l(this,ze)&&d(this,Z,xo).call(this))}}ze=new WeakMap,ot=new WeakMap,Xr=new WeakMap,at=new WeakMap,va=new WeakMap,ys=new WeakMap,bs=new WeakMap,Z=new WeakSet,Ad=function(){l(this,ot)&&l(this,ot).setAttribute("aria-expanded",l(this,ze)?"true":"false")},Td=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},sS=function(e){var r,i,s;if(l(this,ze)!==e){if(m(this,ze,e),d(this,Z,Ad).call(this),!this.isConnected){d(this,Z,Ki).call(this);return}if(e)m(this,ys,!0),setTimeout(()=>{m(this,ys,!1)},0),d(this,Z,Ki).call(this),d(this,Z,$d).call(this),d(this,Z,cc).call(this);else{const o=d(this,Z,Rd).call(this);d(this,Z,Cd).call(this),(i=(r=l(this,at))==null?void 0:r.hidePopover)==null||i.call(r),d(this,Z,Ki).call(this),o&&((s=l(this,ot))==null||s.focus()),this.dispatchEvent(new s8)}}},cc=function(){l(this,bs)||(m(this,bs,!0),queueMicrotask(()=>{m(this,bs,!1),!(!l(this,ze)||!this.isConnected)&&(d(this,Z,oS).call(this),this.hasAttribute("no-autofocus")||d(this,Z,lS).call(this))}))},oS=function(){var e,r;if(l(this,at)){try{(r=(e=l(this,at)).showPopover)==null||r.call(e)}catch{}d(this,Z,xo).call(this)}},$d=function(){document.addEventListener("click",l(this,ya)),document.addEventListener("keydown",l(this,ba),!0),window.addEventListener("resize",l(this,Qr)),window.addEventListener("scroll",l(this,Qr),!0)},Cd=function(){document.removeEventListener("click",l(this,ya)),document.removeEventListener("keydown",l(this,ba),!0),window.removeEventListener("resize",l(this,Qr)),window.removeEventListener("scroll",l(this,Qr),!0)},ya=new WeakMap,ba=new WeakMap,Qr=new WeakMap,aS=function(e){const r=d(this,Z,Id).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=d(this,Z,Pd).call(this),a=o instanceof HTMLElement&&r.includes(o);e.shiftKey?(!a||o===i)&&(e.preventDefault(),s.focus()):(!a||o===s)&&(e.preventDefault(),i.focus())},Id=function(){if(!l(this,at))return[];const e=l(this,at).querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const r=[];for(const i of e.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(Ov)&&r.push(i);for(const s of i.querySelectorAll(Ov))r.push(s)}return r},Rd=function(){const e=d(this,Z,Pd).call(this);return e instanceof Node&&this.contains(e)},Pd=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},lS=function(){var r;const e=d(this,Z,Id).call(this);e.length>0?e[0].focus():(r=l(this,at))==null||r.focus()},xo=function(){if(!l(this,ze)||!l(this,ot)||!l(this,at))return;const e=l(this,ot).getBoundingClientRect(),r=l(this,at).getBoundingClientRect(),s=window.innerHeight-e.bottom,o=r.height+Ih,a=this.getAttribute("placement")==="bottom-end",c=s<o&&e.top>o,u=c?a?"top-end":"top-start":a?"bottom-end":"bottom-start";m(this,va,u);const h=c?e.top-r.height-Ih:e.bottom+Ih,f=a?e.right-r.width:e.left;l(this,at).style.transform=`translate(${f}px, ${h}px)`,l(this,at).setAttribute("data-placement",u)},Ki=function(){this.toggleAttribute("open",l(this,ze));const e=this.getAttribute("material")??"paper";Ue(l(this,ze)?P`<div
93
+ */const Hr=()=>new GO;class GO{}const $h=new WeakMap,Vr=Au(class extends jO{render(n){return ue}update(n,[t]){var r;const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),ue}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=$h.get(t);e===void 0&&(e=new WeakMap,$h.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,t;return typeof this.G=="function"?(n=$h.get(this.ht??globalThis))==null?void 0:n.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Sf=Pt('<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"/>'),qO=Pt('<path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/>'),YO=Pt('<path d="M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z"/>'),Rc=Pt('<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"/>'),KO=Pt('<path d="M213.66,162.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,53.66,173.66L128,99.31l74.34,74.35a8,8,0,0,0,11.32-11.32Z"/>'),JO=Pt({regular:'<path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64Zm0,136H40V80H216V200Z"/>',bold:'<path d="M216,60H157l27.52-27.52a12,12,0,0,0-17-17L128,55,88.49,15.51a12,12,0,0,0-17,17L99,60H40A20,20,0,0,0,20,80V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V80A20,20,0,0,0,216,60Zm-4,136H44V84H212Z"/>'}),XO=Pt({regular:'<path d="M224,160V96a8,8,0,0,0-8-8H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V160Zm-60.69,48-40-40h33.38l40,40ZM168,156.69V123.31l40,40v33.38Zm40-16L171.31,104H208ZM48,48H152v56h0v48H48Zm56,123.31L140.69,208H104Z"/>',duotone:'<path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/>'}),QO=Pt({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"/>',duotone:'<path d="M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z" opacity="0.2"/><path d="M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,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,64H56V152h48v48Z"/>'}),e8=Pt('<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"/>'),t8=Pt({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"/>'}),tS=Pt({regular:'<path d="M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"/>',bold:'<path d="M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm84,84H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"/>'}),n8=Pt('<path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/>');class r8 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const Mv='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Ch=4;var ze,ot,Xr,at,va,ys,bs,Z,xd,Ad,rS,cc,iS,Td,$d,ya,ba,Qr,sS,Cd,Id,Rd,oS,xo,Ki;class nS extends HTMLElement{constructor(){super();b(this,Z);b(this,ze,!1);b(this,ot,null);b(this,Xr);b(this,at,null);b(this,va,"bottom-start");b(this,ys,!1);b(this,bs,!1);b(this,ya,e=>{l(this,ze)&&(l(this,ys)||this.hasAttribute("no-light-dismiss")||e.composedPath().includes(this)||(this.open=!1))});b(this,ba,e=>{if(l(this,ze)&&!(this.hasAttribute("no-autofocus")&&!d(this,Z,Id).call(this))){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&d(this,Z,sS).call(this,e)}});b(this,Qr,()=>{l(this,ze)&&d(this,Z,xo).call(this)});m(this,Xr,this.attachShadow({mode:"open"})),tf(l(this,Xr)),d(this,Z,Ad).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),d(this,Z,Ad).call(this,"open"),d(this,Z,Ki).call(this),l(this,ze)&&(d(this,Z,Td).call(this),d(this,Z,cc).call(this))}disconnectedCallback(){var e;d(this,Z,$d).call(this),(e=l(this,ot))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?d(this,Z,rS).call(this,this.hasAttribute("open")):e==="material"&&l(this,ze)?(d(this,Z,Ki).call(this),d(this,Z,cc).call(this)):e==="placement"&&l(this,ze)&&d(this,Z,xo).call(this)}get open(){return l(this,ze)}set open(e){this.toggleAttribute("open",e)}get anchor(){return l(this,ot)}set anchor(e){l(this,ot)!==e&&(l(this,ot)&&l(this,ot).removeAttribute("aria-expanded"),m(this,ot,e),d(this,Z,xd).call(this),l(this,ze)&&d(this,Z,xo).call(this))}}ze=new WeakMap,ot=new WeakMap,Xr=new WeakMap,at=new WeakMap,va=new WeakMap,ys=new WeakMap,bs=new WeakMap,Z=new WeakSet,xd=function(){l(this,ot)&&l(this,ot).setAttribute("aria-expanded",l(this,ze)?"true":"false")},Ad=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},rS=function(e){var r,i,s;if(l(this,ze)!==e){if(m(this,ze,e),d(this,Z,xd).call(this),!this.isConnected){d(this,Z,Ki).call(this);return}if(e)m(this,ys,!0),setTimeout(()=>{m(this,ys,!1)},0),d(this,Z,Ki).call(this),d(this,Z,Td).call(this),d(this,Z,cc).call(this);else{const o=d(this,Z,Id).call(this);d(this,Z,$d).call(this),(i=(r=l(this,at))==null?void 0:r.hidePopover)==null||i.call(r),d(this,Z,Ki).call(this),o&&((s=l(this,ot))==null||s.focus()),this.dispatchEvent(new r8)}}},cc=function(){l(this,bs)||(m(this,bs,!0),queueMicrotask(()=>{m(this,bs,!1),!(!l(this,ze)||!this.isConnected)&&(d(this,Z,iS).call(this),this.hasAttribute("no-autofocus")||d(this,Z,oS).call(this))}))},iS=function(){var e,r;if(l(this,at)){try{(r=(e=l(this,at)).showPopover)==null||r.call(e)}catch{}d(this,Z,xo).call(this)}},Td=function(){document.addEventListener("click",l(this,ya)),document.addEventListener("keydown",l(this,ba),!0),window.addEventListener("resize",l(this,Qr)),window.addEventListener("scroll",l(this,Qr),!0)},$d=function(){document.removeEventListener("click",l(this,ya)),document.removeEventListener("keydown",l(this,ba),!0),window.removeEventListener("resize",l(this,Qr)),window.removeEventListener("scroll",l(this,Qr),!0)},ya=new WeakMap,ba=new WeakMap,Qr=new WeakMap,sS=function(e){const r=d(this,Z,Cd).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=d(this,Z,Rd).call(this),a=o instanceof HTMLElement&&r.includes(o);e.shiftKey?(!a||o===i)&&(e.preventDefault(),s.focus()):(!a||o===s)&&(e.preventDefault(),i.focus())},Cd=function(){if(!l(this,at))return[];const e=l(this,at).querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const r=[];for(const i of e.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(Mv)&&r.push(i);for(const s of i.querySelectorAll(Mv))r.push(s)}return r},Id=function(){const e=d(this,Z,Rd).call(this);return e instanceof Node&&this.contains(e)},Rd=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},oS=function(){var r;const e=d(this,Z,Cd).call(this);e.length>0?e[0].focus():(r=l(this,at))==null||r.focus()},xo=function(){if(!l(this,ze)||!l(this,ot)||!l(this,at))return;const e=l(this,ot).getBoundingClientRect(),r=l(this,at).getBoundingClientRect(),s=window.innerHeight-e.bottom,o=r.height+Ch,a=this.getAttribute("placement")==="bottom-end",c=s<o&&e.top>o,u=c?a?"top-end":"top-start":a?"bottom-end":"bottom-start";m(this,va,u);const h=c?e.top-r.height-Ch:e.bottom+Ch,f=a?e.right-r.width:e.left;l(this,at).style.transform=`translate(${f}px, ${h}px)`,l(this,at).setAttribute("data-placement",u)},Ki=function(){this.toggleAttribute("open",l(this,ze));const e=this.getAttribute("material")??"paper";Ue(l(this,ze)?P`<div
94
94
  class="panel"
95
95
  part="panel"
96
96
  popover="manual"
@@ -101,7 +101,7 @@ tv-desktop
101
101
  level="1"
102
102
  >
103
103
  <slot></slot>
104
- </div>`:ue,l(this,Xr)),m(this,at,l(this,Xr).querySelector(".panel"))},g(iS,"observedAttributes",["open","material","placement"]);customElements.get("ui-popover")||customElements.define("ui-popover",iS);class cS extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}class o8 extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var lt,Nt,ir,sr,le,wa,Sa,O,hS,Ao,dS,pS,Ld,fS,To,Pr,ei,_a,Fc,ka,Hc,gS,mS,Dd,$o,Md,zd,Tn;class uS extends HTMLElement{constructor(){super();b(this,O);b(this,lt,!1);b(this,Nt,null);b(this,ir,null);b(this,sr);b(this,le,null);b(this,wa,Hr());b(this,Sa,new MutationObserver(e=>d(this,O,gS).call(this,e)));b(this,ei,()=>{d(this,O,To).call(this,!l(this,lt))});b(this,_a,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,ei).call(this))});b(this,Fc,()=>{l(this,lt)&&d(this,O,To).call(this,!1)});b(this,ka,e=>{e instanceof cS&&(e.stopPropagation(),m(this,lt,!1),d(this,O,Ao).call(this,e.value),d(this,O,Tn).call(this),this.dispatchEvent(new o8(e.value)))});b(this,Hc,()=>{d(this,O,Dd).call(this)});m(this,sr,this.attachShadow({mode:"open"})),nf(l(this,sr))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,ka)),d(this,O,hS).call(this),l(this,Sa).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),d(this,O,Tn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,ka)),l(this,Sa).disconnect(),d(this,O,zd).call(this)}attributeChangedCallback(e){if(e==="open"){d(this,O,To).call(this,this.hasAttribute("open"));return}d(this,O,Tn).call(this)}get open(){return l(this,lt)}set open(e){this.toggleAttribute("open",e)}get title(){return this.getAttribute("title")??""}get value(){return l(this,Nt)}set value(e){e===null?(d(this,O,Pr).call(this,null,null),d(this,O,dS).call(this)):d(this,O,Ao).call(this,e),d(this,O,Tn).call(this)}close(){d(this,O,To).call(this,!1)}}lt=new WeakMap,Nt=new WeakMap,ir=new WeakMap,sr=new WeakMap,le=new WeakMap,wa=new WeakMap,Sa=new WeakMap,O=new WeakSet,hS=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&d(this,O,Pr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},Ao=function(e){var r;for(const i of l(this,O,Ld))i.value===e?(d(this,O,Pr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},dS=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},pS=function(e){for(const r of l(this,O,Ld))if(r.value===e)return r;return null},Ld=function(){return this.querySelectorAll("dropdown-item")},fS=function(){return l(this,ir)??this.title},To=function(e){l(this,lt)!==e&&(m(this,lt,e),d(this,O,Tn).call(this))},Pr=function(e,r){m(this,Nt,e),m(this,ir,r)},ei=new WeakMap,_a=new WeakMap,Fc=new WeakMap,ka=new WeakMap,Hc=new WeakMap,gS=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||d(this,O,mS).call(this)},mS=function(){var r,i;const e=this.querySelector("dropdown-item[selected]");if(e){const s=e.value,o=((r=e.textContent)==null?void 0:r.trim())??null,a=l(this,Nt)!==s||l(this,ir)!==o;d(this,O,Pr).call(this,s,o),d(this,O,Ao).call(this,s),a?d(this,O,Tn).call(this):d(this,O,$o).call(this);return}if(l(this,Nt)!==null){const s=d(this,O,pS).call(this,l(this,Nt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,ir)!==o;d(this,O,Pr).call(this,l(this,Nt),o),d(this,O,Ao).call(this,l(this,Nt)),a?d(this,O,Tn).call(this):d(this,O,$o).call(this);return}}if(l(this,Nt)!==null||l(this,ir)!==null){d(this,O,Pr).call(this,null,null),d(this,O,Tn).call(this);return}d(this,O,$o).call(this)},Dd=function(){const e=l(this,sr).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,le)!==r&&(d(this,O,zd).call(this),m(this,le,r),l(this,le)&&(l(this,le).addEventListener("click",l(this,ei)),l(this,le)instanceof HTMLButtonElement?l(this,le).hasAttribute("type")||(l(this,le).type="button"):(l(this,le).hasAttribute("role")||l(this,le).setAttribute("role","button"),l(this,le).hasAttribute("tabindex")||(l(this,le).tabIndex=0),l(this,le).addEventListener("keydown",l(this,_a))))),d(this,O,$o).call(this),d(this,O,Md).call(this)},$o=function(){l(this,le)&&(l(this,le).setAttribute("data-dropdown-trigger",""),l(this,le).setAttribute("aria-haspopup","listbox"),l(this,le).setAttribute("aria-expanded",l(this,lt)?"true":"false"))},Md=function(){const e=l(this,wa).value;if(!e)return;const r=l(this,sr).querySelector("button.fallback-trigger");e.anchor=l(this,le)??r??null},zd=function(){l(this,le)&&(l(this,le).removeEventListener("click",l(this,ei)),l(this,le).removeEventListener("keydown",l(this,_a)),l(this,le).removeAttribute("data-dropdown-trigger"),l(this,le).removeAttribute("aria-haspopup"),l(this,le).removeAttribute("aria-expanded"),m(this,le,null))},Tn=function(){this.toggleAttribute("open",l(this,lt)),Ue(P`
104
+ </div>`:ue,l(this,Xr)),m(this,at,l(this,Xr).querySelector(".panel"))},g(nS,"observedAttributes",["open","material","placement"]);customElements.get("ui-popover")||customElements.define("ui-popover",nS);class aS extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}class i8 extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var lt,Nt,ir,sr,le,wa,Sa,O,cS,Ao,uS,hS,Pd,dS,To,Pr,ei,_a,Fc,ka,Hc,pS,fS,Ld,$o,Dd,Md,Tn;class lS extends HTMLElement{constructor(){super();b(this,O);b(this,lt,!1);b(this,Nt,null);b(this,ir,null);b(this,sr);b(this,le,null);b(this,wa,Hr());b(this,Sa,new MutationObserver(e=>d(this,O,pS).call(this,e)));b(this,ei,()=>{d(this,O,To).call(this,!l(this,lt))});b(this,_a,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,ei).call(this))});b(this,Fc,()=>{l(this,lt)&&d(this,O,To).call(this,!1)});b(this,ka,e=>{e instanceof aS&&(e.stopPropagation(),m(this,lt,!1),d(this,O,Ao).call(this,e.value),d(this,O,Tn).call(this),this.dispatchEvent(new i8(e.value)))});b(this,Hc,()=>{d(this,O,Ld).call(this)});m(this,sr,this.attachShadow({mode:"open"})),tf(l(this,sr))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,ka)),d(this,O,cS).call(this),l(this,Sa).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),d(this,O,Tn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,ka)),l(this,Sa).disconnect(),d(this,O,Md).call(this)}attributeChangedCallback(e){if(e==="open"){d(this,O,To).call(this,this.hasAttribute("open"));return}d(this,O,Tn).call(this)}get open(){return l(this,lt)}set open(e){this.toggleAttribute("open",e)}get title(){return this.getAttribute("title")??""}get value(){return l(this,Nt)}set value(e){e===null?(d(this,O,Pr).call(this,null,null),d(this,O,uS).call(this)):d(this,O,Ao).call(this,e),d(this,O,Tn).call(this)}close(){d(this,O,To).call(this,!1)}}lt=new WeakMap,Nt=new WeakMap,ir=new WeakMap,sr=new WeakMap,le=new WeakMap,wa=new WeakMap,Sa=new WeakMap,O=new WeakSet,cS=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&d(this,O,Pr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},Ao=function(e){var r;for(const i of l(this,O,Pd))i.value===e?(d(this,O,Pr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},uS=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},hS=function(e){for(const r of l(this,O,Pd))if(r.value===e)return r;return null},Pd=function(){return this.querySelectorAll("dropdown-item")},dS=function(){return l(this,ir)??this.title},To=function(e){l(this,lt)!==e&&(m(this,lt,e),d(this,O,Tn).call(this))},Pr=function(e,r){m(this,Nt,e),m(this,ir,r)},ei=new WeakMap,_a=new WeakMap,Fc=new WeakMap,ka=new WeakMap,Hc=new WeakMap,pS=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||d(this,O,fS).call(this)},fS=function(){var r,i;const e=this.querySelector("dropdown-item[selected]");if(e){const s=e.value,o=((r=e.textContent)==null?void 0:r.trim())??null,a=l(this,Nt)!==s||l(this,ir)!==o;d(this,O,Pr).call(this,s,o),d(this,O,Ao).call(this,s),a?d(this,O,Tn).call(this):d(this,O,$o).call(this);return}if(l(this,Nt)!==null){const s=d(this,O,hS).call(this,l(this,Nt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,ir)!==o;d(this,O,Pr).call(this,l(this,Nt),o),d(this,O,Ao).call(this,l(this,Nt)),a?d(this,O,Tn).call(this):d(this,O,$o).call(this);return}}if(l(this,Nt)!==null||l(this,ir)!==null){d(this,O,Pr).call(this,null,null),d(this,O,Tn).call(this);return}d(this,O,$o).call(this)},Ld=function(){const e=l(this,sr).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,le)!==r&&(d(this,O,Md).call(this),m(this,le,r),l(this,le)&&(l(this,le).addEventListener("click",l(this,ei)),l(this,le)instanceof HTMLButtonElement?l(this,le).hasAttribute("type")||(l(this,le).type="button"):(l(this,le).hasAttribute("role")||l(this,le).setAttribute("role","button"),l(this,le).hasAttribute("tabindex")||(l(this,le).tabIndex=0),l(this,le).addEventListener("keydown",l(this,_a))))),d(this,O,$o).call(this),d(this,O,Dd).call(this)},$o=function(){l(this,le)&&(l(this,le).setAttribute("data-dropdown-trigger",""),l(this,le).setAttribute("aria-haspopup","listbox"),l(this,le).setAttribute("aria-expanded",l(this,lt)?"true":"false"))},Dd=function(){const e=l(this,wa).value;if(!e)return;const r=l(this,sr).querySelector("button.fallback-trigger");e.anchor=l(this,le)??r??null},Md=function(){l(this,le)&&(l(this,le).removeEventListener("click",l(this,ei)),l(this,le).removeEventListener("keydown",l(this,_a)),l(this,le).removeAttribute("data-dropdown-trigger"),l(this,le).removeAttribute("aria-haspopup"),l(this,le).removeAttribute("aria-expanded"),m(this,le,null))},Tn=function(){this.toggleAttribute("open",l(this,lt)),Ue(P`
105
105
  <slot name="trigger" @slotchange=${l(this,Hc)}>
106
106
  <button
107
107
  class="fallback-trigger"
@@ -111,7 +111,7 @@ tv-desktop
111
111
  aria-expanded=${l(this,lt)?"true":"false"}
112
112
  @click=${l(this,ei)}
113
113
  >
114
- <span class="trigger-label" part="trigger-label">${l(this,O,fS)}</span>
114
+ <span class="trigger-label" part="trigger-label">${l(this,O,dS)}</span>
115
115
  <span class="trigger-icon" part="trigger-icon" aria-hidden="true">
116
116
  ${Rc({size:16})}
117
117
  </span>
@@ -128,7 +128,7 @@ tv-desktop
128
128
  <slot></slot>
129
129
  </div>`:ue}
130
130
  </ui-popover>
131
- `,l(this,sr)),d(this,O,Md).call(this),queueMicrotask(()=>d(this,O,Dd).call(this))},g(uS,"observedAttributes",["title","open"]);class a8 extends HTMLElement{}class l8 extends HTMLElement{}class c8 extends HTMLElement{}var xi,Od,yS,Ea,xa;class vS extends HTMLElement{constructor(){super(...arguments);b(this,xi);b(this,Ea,()=>{this.action||d(this,xi,yS).call(this)});b(this,xa,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",l(this,Ea)),this.addEventListener("keydown",l(this,xa)),d(this,xi,Od).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Ea)),this.removeEventListener("keydown",l(this,xa))}attributeChangedCallback(){d(this,xi,Od).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}xi=new WeakSet,Od=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")},yS=function(){this.dispatchEvent(new cS(this.value))},Ea=new WeakMap,xa=new WeakMap,g(vS,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",uS);customElements.get("dropdown-group")||customElements.define("dropdown-group",a8);customElements.get("dropdown-label")||customElements.define("dropdown-label",l8);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",c8);customElements.get("dropdown-item")||customElements.define("dropdown-item",vS);class u8 extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var hn,Ut,ae,We,Co,Aa,Nd,uc,Ud,Ta,$a,Ca;class bS extends HTMLElement{constructor(){super(...arguments);b(this,We);b(this,hn,"");b(this,Ut,!1);b(this,ae,null);b(this,Aa,e=>{l(this,Ut)||(e.preventDefault(),d(this,We,Nd).call(this))});b(this,Ta,e=>{e.stopPropagation()});b(this,$a,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),d(this,We,uc).call(this,!0),(r=l(this,ae))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),d(this,We,uc).call(this,!1),(i=l(this,ae))==null||i.blur())});b(this,Ca,()=>{d(this,We,uc).call(this,!0)})}connectedCallback(){l(this,ae)||(m(this,ae,document.createElement("span")),l(this,ae).className="editable-text-span",this.append(l(this,ae)));const e=this.getAttribute("value");e!==null&&m(this,hn,e),d(this,We,Co).call(this),this.addEventListener("dblclick",l(this,Aa))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,Aa)),l(this,Ut)&&d(this,We,Ud).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";m(this,hn,r),l(this,Ut)||d(this,We,Co).call(this)}}get value(){return l(this,hn)}set value(e){m(this,hn,e),l(this,Ut)||d(this,We,Co).call(this)}startEditing(){l(this,Ut)||d(this,We,Nd).call(this)}}hn=new WeakMap,Ut=new WeakMap,ae=new WeakMap,We=new WeakSet,Co=function(){l(this,ae)&&(l(this,ae).textContent=l(this,hn),l(this,ae).scrollLeft=0)},Aa=new WeakMap,Nd=function(){l(this,ae)&&(m(this,Ut,!0),l(this,ae).setAttribute("contenteditable","plaintext-only"),l(this,ae).setAttribute("spellcheck","false"),l(this,ae).addEventListener("keydown",l(this,$a)),l(this,ae).addEventListener("blur",l(this,Ca)),l(this,ae).addEventListener("mousedown",l(this,Ta)),this.toggleAttribute("data-editing",!0),queueMicrotask(()=>{var r;if(!l(this,ae))return;l(this,ae).focus();const e=(r=this.ownerDocument.defaultView)==null?void 0:r.getSelection();e==null||e.selectAllChildren(l(this,ae))}))},uc=function(e){if(!l(this,Ut)||!l(this,ae))return;const r=(l(this,ae).textContent??"").trim();m(this,Ut,!1),l(this,ae).removeAttribute("contenteditable"),l(this,ae).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),d(this,We,Ud).call(this),e&&r.length>0&&r!==l(this,hn)&&(m(this,hn,r),this.dispatchEvent(new u8(r))),d(this,We,Co).call(this)},Ud=function(){var e,r,i;(e=l(this,ae))==null||e.removeEventListener("keydown",l(this,$a)),(r=l(this,ae))==null||r.removeEventListener("blur",l(this,Ca)),(i=l(this,ae))==null||i.removeEventListener("mousedown",l(this,Ta))},Ta=new WeakMap,$a=new WeakMap,Ca=new WeakMap,g(bS,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",bS);const h8=16,d8=24,p8=32,wS={check:{regular:'<path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/>'},"copy-simple":{regular:'<path d="M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z"/>'},"bell-ringing":{regular:'<path d="M224,71.1a8,8,0,0,1-10.78-3.42,94.13,94.13,0,0,0-33.46-36.91,8,8,0,1,1,8.54-13.54,111.46,111.46,0,0,1,39.12,43.09A8,8,0,0,1,224,71.1ZM35.71,72a8,8,0,0,0,7.1-4.32A94.13,94.13,0,0,1,76.27,30.77a8,8,0,1,0-8.54-13.54A111.46,111.46,0,0,0,28.61,60.32,8,8,0,0,0,35.71,72Zm186.1,103.94A16,16,0,0,1,208,200H167.2a40,40,0,0,1-78.4,0H48a16,16,0,0,1-13.79-24.06C43.22,160.39,48,138.28,48,112a80,80,0,0,1,160,0C208,138.27,212.78,160.38,221.81,175.94ZM150.62,200H105.38a24,24,0,0,0,45.24,0ZM208,184c-10.64-18.27-16-42.49-16-72a64,64,0,0,0-128,0c0,29.52-5.38,53.74-16,72Z"/>'},plus:{regular:'<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"/>',bold:'<path d="M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"/>'},"subtract-square":{regular:'<path d="M224,160V96a8,8,0,0,0-8-8H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V160Zm-60.69,48-40-40h33.38l40,40ZM168,156.69V123.31l40,40v33.38Zm40-16L171.31,104H208ZM48,48H152v56h0v48H48Zm56,123.31L140.69,208H104Z"/>',duotone:'<path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/>'},television:{regular:'<path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64ZM40,80H144V200H40ZM216,200H160V80h56V200Zm-16-84a12,12,0,1,1-12-12A12,12,0,0,1,200,116Zm0,48a12,12,0,1,1-12-12A12,12,0,0,1,200,164Z"/>'},"squares-four":{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"/>',duotone:'<path d="M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z" opacity="0.2"/><path d="M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,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,64H56V152h48v48Z"/>'},shapes:{regular:'<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M24 184L64 64L104 184H24Z"/><circle cx="156" cy="76" r="44" fill="none" stroke="currentColor" stroke-width="16"/><rect x="136" y="152" width="88" height="56" rx="8" fill="none" stroke="currentColor" stroke-width="16" stroke-linejoin="round"/>'},"calendar-blank":{regular:'<path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"/>'},hash:{regular:'<path d="M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z"/>'}},f8=`
131
+ `,l(this,sr)),d(this,O,Dd).call(this),queueMicrotask(()=>d(this,O,Ld).call(this))},g(lS,"observedAttributes",["title","open"]);class s8 extends HTMLElement{}class o8 extends HTMLElement{}class a8 extends HTMLElement{}var xi,zd,mS,Ea,xa;class gS extends HTMLElement{constructor(){super(...arguments);b(this,xi);b(this,Ea,()=>{this.action||d(this,xi,mS).call(this)});b(this,xa,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",l(this,Ea)),this.addEventListener("keydown",l(this,xa)),d(this,xi,zd).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Ea)),this.removeEventListener("keydown",l(this,xa))}attributeChangedCallback(){d(this,xi,zd).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}xi=new WeakSet,zd=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")},mS=function(){this.dispatchEvent(new aS(this.value))},Ea=new WeakMap,xa=new WeakMap,g(gS,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",lS);customElements.get("dropdown-group")||customElements.define("dropdown-group",s8);customElements.get("dropdown-label")||customElements.define("dropdown-label",o8);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",a8);customElements.get("dropdown-item")||customElements.define("dropdown-item",gS);class l8 extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var hn,Ut,ae,We,Co,Aa,Od,uc,Nd,Ta,$a,Ca;class vS extends HTMLElement{constructor(){super(...arguments);b(this,We);b(this,hn,"");b(this,Ut,!1);b(this,ae,null);b(this,Aa,e=>{l(this,Ut)||(e.preventDefault(),d(this,We,Od).call(this))});b(this,Ta,e=>{e.stopPropagation()});b(this,$a,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),d(this,We,uc).call(this,!0),(r=l(this,ae))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),d(this,We,uc).call(this,!1),(i=l(this,ae))==null||i.blur())});b(this,Ca,()=>{d(this,We,uc).call(this,!0)})}connectedCallback(){l(this,ae)||(m(this,ae,document.createElement("span")),l(this,ae).className="editable-text-span",this.append(l(this,ae)));const e=this.getAttribute("value");e!==null&&m(this,hn,e),d(this,We,Co).call(this),this.addEventListener("dblclick",l(this,Aa))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,Aa)),l(this,Ut)&&d(this,We,Nd).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";m(this,hn,r),l(this,Ut)||d(this,We,Co).call(this)}}get value(){return l(this,hn)}set value(e){m(this,hn,e),l(this,Ut)||d(this,We,Co).call(this)}startEditing(){l(this,Ut)||d(this,We,Od).call(this)}}hn=new WeakMap,Ut=new WeakMap,ae=new WeakMap,We=new WeakSet,Co=function(){l(this,ae)&&(l(this,ae).textContent=l(this,hn),l(this,ae).scrollLeft=0)},Aa=new WeakMap,Od=function(){l(this,ae)&&(m(this,Ut,!0),l(this,ae).setAttribute("contenteditable","plaintext-only"),l(this,ae).setAttribute("spellcheck","false"),l(this,ae).addEventListener("keydown",l(this,$a)),l(this,ae).addEventListener("blur",l(this,Ca)),l(this,ae).addEventListener("mousedown",l(this,Ta)),this.toggleAttribute("data-editing",!0),queueMicrotask(()=>{var r;if(!l(this,ae))return;l(this,ae).focus();const e=(r=this.ownerDocument.defaultView)==null?void 0:r.getSelection();e==null||e.selectAllChildren(l(this,ae))}))},uc=function(e){if(!l(this,Ut)||!l(this,ae))return;const r=(l(this,ae).textContent??"").trim();m(this,Ut,!1),l(this,ae).removeAttribute("contenteditable"),l(this,ae).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),d(this,We,Nd).call(this),e&&r.length>0&&r!==l(this,hn)&&(m(this,hn,r),this.dispatchEvent(new l8(r))),d(this,We,Co).call(this)},Nd=function(){var e,r,i;(e=l(this,ae))==null||e.removeEventListener("keydown",l(this,$a)),(r=l(this,ae))==null||r.removeEventListener("blur",l(this,Ca)),(i=l(this,ae))==null||i.removeEventListener("mousedown",l(this,Ta))},Ta=new WeakMap,$a=new WeakMap,Ca=new WeakMap,g(vS,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",vS);const c8=16,u8=24,h8=32,yS={check:{regular:'<path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/>'},"copy-simple":{regular:'<path d="M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z"/>'},"bell-ringing":{regular:'<path d="M224,71.1a8,8,0,0,1-10.78-3.42,94.13,94.13,0,0,0-33.46-36.91,8,8,0,1,1,8.54-13.54,111.46,111.46,0,0,1,39.12,43.09A8,8,0,0,1,224,71.1ZM35.71,72a8,8,0,0,0,7.1-4.32A94.13,94.13,0,0,1,76.27,30.77a8,8,0,1,0-8.54-13.54A111.46,111.46,0,0,0,28.61,60.32,8,8,0,0,0,35.71,72Zm186.1,103.94A16,16,0,0,1,208,200H167.2a40,40,0,0,1-78.4,0H48a16,16,0,0,1-13.79-24.06C43.22,160.39,48,138.28,48,112a80,80,0,0,1,160,0C208,138.27,212.78,160.38,221.81,175.94ZM150.62,200H105.38a24,24,0,0,0,45.24,0ZM208,184c-10.64-18.27-16-42.49-16-72a64,64,0,0,0-128,0c0,29.52-5.38,53.74-16,72Z"/>'},plus:{regular:'<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"/>',bold:'<path d="M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"/>'},"subtract-square":{regular:'<path d="M224,160V96a8,8,0,0,0-8-8H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V160Zm-60.69,48-40-40h33.38l40,40ZM168,156.69V123.31l40,40v33.38Zm40-16L171.31,104H208ZM48,48H152v56h0v48H48Zm56,123.31L140.69,208H104Z"/>',duotone:'<path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/>'},television:{regular:'<path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64ZM40,80H144V200H40ZM216,200H160V80h56V200Zm-16-84a12,12,0,1,1-12-12A12,12,0,0,1,200,116Zm0,48a12,12,0,1,1-12-12A12,12,0,0,1,200,164Z"/>'},"squares-four":{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"/>',duotone:'<path d="M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z" opacity="0.2"/><path d="M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,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,64H56V152h48v48Z"/>'},shapes:{regular:'<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M24 184L64 64L104 184H24Z"/><circle cx="156" cy="76" r="44" fill="none" stroke="currentColor" stroke-width="16"/><rect x="136" y="152" width="88" height="56" rx="8" fill="none" stroke="currentColor" stroke-width="16" stroke-linejoin="round"/>'},"calendar-blank":{regular:'<path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"/>'},hash:{regular:'<path d="M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z"/>'}},d8=`
132
132
  :host {
133
133
  display: inline-flex;
134
134
  width: var(--tv-icon-size, 1em);
@@ -143,16 +143,16 @@ tv-desktop
143
143
  height: 100%;
144
144
  fill: currentColor;
145
145
  }
146
- `;function g8(n){return n!==null&&Object.hasOwn(wS,n)}function m8(n){return n==="regular"||n==="bold"||n==="duotone"}var Ia,jt,Fd,_S,kS,ES;class SS extends HTMLElement{constructor(){super();b(this,jt);b(this,Ia);m(this,Ia,this.attachShadow({mode:"open"}))}connectedCallback(){d(this,jt,Fd).call(this)}attributeChangedCallback(){d(this,jt,Fd).call(this)}}Ia=new WeakMap,jt=new WeakSet,Fd=function(){const e=d(this,jt,_S).call(this),r=d(this,jt,kS).call(this),i=d(this,jt,ES).call(this),s=wS[e],o=s[r]??s.regular;l(this,Ia).innerHTML=`
147
- <style>${f8}</style>
146
+ `;function p8(n){return n!==null&&Object.hasOwn(yS,n)}function f8(n){return n==="regular"||n==="bold"||n==="duotone"}var Ia,jt,Ud,wS,SS,_S;class bS extends HTMLElement{constructor(){super();b(this,jt);b(this,Ia);m(this,Ia,this.attachShadow({mode:"open"}))}connectedCallback(){d(this,jt,Ud).call(this)}attributeChangedCallback(){d(this,jt,Ud).call(this)}}Ia=new WeakMap,jt=new WeakSet,Ud=function(){const e=d(this,jt,wS).call(this),r=d(this,jt,SS).call(this),i=d(this,jt,_S).call(this),s=yS[e],o=s[r]??s.regular;l(this,Ia).innerHTML=`
147
+ <style>${d8}</style>
148
148
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" aria-hidden="true" focusable="false">${o}</svg>
149
- `,this.style.setProperty("--tv-icon-size",`${i}px`)},_S=function(){const e=this.getAttribute("name");return g8(e)?e:"subtract-square"},kS=function(){const e=this.getAttribute("weight");return m8(e)?e:"regular"},ES=function(){const e=Number(this.getAttribute("size"));return e===d8||e===p8?e:h8},g(SS,"observedAttributes",["name","weight","size"]);customElements.get("tv-icon")||customElements.define("tv-icon",SS);class v8 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Ra,mr,Hd,Vc,Pa,Vd;class xS extends HTMLElement{constructor(){super();b(this,mr);b(this,Ra);b(this,Vc,e=>{e.target===e.currentTarget&&d(this,mr,Hd).call(this)});b(this,Pa,e=>{this.open&&e.key==="Escape"&&d(this,mr,Hd).call(this)});m(this,Ra,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Pa)),d(this,mr,Vd).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Pa))}attributeChangedCallback(){d(this,mr,Vd).call(this)}get open(){return this.hasAttribute("open")}}Ra=new WeakMap,mr=new WeakSet,Hd=function(){this.dispatchEvent(new v8)},Vc=new WeakMap,Pa=new WeakMap,Vd=function(){Ue(P`
149
+ `,this.style.setProperty("--tv-icon-size",`${i}px`)},wS=function(){const e=this.getAttribute("name");return p8(e)?e:"subtract-square"},SS=function(){const e=this.getAttribute("weight");return f8(e)?e:"regular"},_S=function(){const e=Number(this.getAttribute("size"));return e===u8||e===h8?e:c8},g(bS,"observedAttributes",["name","weight","size"]);customElements.get("tv-icon")||customElements.define("tv-icon",bS);class g8 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Ra,mr,Fd,Vc,Pa,Hd;class kS extends HTMLElement{constructor(){super();b(this,mr);b(this,Ra);b(this,Vc,e=>{e.target===e.currentTarget&&d(this,mr,Fd).call(this)});b(this,Pa,e=>{this.open&&e.key==="Escape"&&d(this,mr,Fd).call(this)});m(this,Ra,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Pa)),d(this,mr,Hd).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Pa))}attributeChangedCallback(){d(this,mr,Hd).call(this)}get open(){return this.hasAttribute("open")}}Ra=new WeakMap,mr=new WeakSet,Fd=function(){this.dispatchEvent(new g8)},Vc=new WeakMap,Pa=new WeakMap,Hd=function(){Ue(P`
150
150
  ${this.open?P`
151
151
  <div class="backdrop" part="backdrop" @click=${l(this,Vc)}>
152
152
  <slot></slot>
153
153
  </div>
154
154
  `:null}
155
- `,l(this,Ra))},g(xS,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",xS);const y8=16,Rh=24,b8=32;var ws;class AS extends HTMLElement{constructor(){super();b(this,ws);m(this,ws,this.attachShadow({mode:"open"})),nf(l(this,ws))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return Rh;const r=Number(e);return r===y8||r===Rh||r===b8?r:Rh}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ue(P`<span class="spin">${rS({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,ws))}}ws=new WeakMap,g(AS,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",AS);class w8 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class S8 extends HTMLElement{}var La,Da,Zd;class TS extends HTMLElement{constructor(){super();b(this,Da);b(this,La);m(this,La,this.attachShadow({mode:"open"}))}connectedCallback(){d(this,Da,Zd).call(this)}attributeChangedCallback(){d(this,Da,Zd).call(this)}get closable(){return this.hasAttribute("closable")}}La=new WeakMap,Da=new WeakSet,Zd=function(){const e=this.querySelector("panel-page");Ue(P`
155
+ `,l(this,Ra))},g(kS,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",kS);const m8=16,Ih=24,v8=32;var ws;class ES extends HTMLElement{constructor(){super();b(this,ws);m(this,ws,this.attachShadow({mode:"open"})),tf(l(this,ws))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return Ih;const r=Number(e);return r===m8||r===Ih||r===v8?r:Ih}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ue(P`<span class="spin">${tS({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,ws))}}ws=new WeakMap,g(ES,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",ES);class y8 extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class b8 extends HTMLElement{}var La,Da,Vd;class xS extends HTMLElement{constructor(){super();b(this,Da);b(this,La);m(this,La,this.attachShadow({mode:"open"}))}connectedCallback(){d(this,Da,Vd).call(this)}attributeChangedCallback(){d(this,Da,Vd).call(this)}get closable(){return this.hasAttribute("closable")}}La=new WeakMap,Da=new WeakSet,Vd=function(){const e=this.querySelector("panel-page");Ue(P`
156
156
  <section class="panel" part="panel">
157
157
  <header class="title-bar" part="header">
158
158
  <h2 class="title" part="title">${(e==null?void 0:e.getAttribute("title"))??""}</h2>
@@ -162,19 +162,19 @@ tv-desktop
162
162
  class="title-button"
163
163
  part="button close-button"
164
164
  aria-label="Close"
165
- @click=${()=>this.dispatchEvent(new w8)}
165
+ @click=${()=>this.dispatchEvent(new y8)}
166
166
  >
167
- <span class="close-icon" part="icon close-icon">${_f({size:16})}</span>
167
+ <span class="close-icon" part="icon close-icon">${Sf({size:16})}</span>
168
168
  </button>
169
169
  `:null}
170
170
  </header>
171
171
  <slot></slot>
172
172
  </section>
173
- `,l(this,La))},g(TS,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",TS);customElements.get("panel-page")||customElements.define("panel-page",S8);const _8=`
173
+ `,l(this,La))},g(xS,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",xS);customElements.get("panel-page")||customElements.define("panel-page",b8);const w8=`
174
174
  <svg viewBox="0 0 12 12" aria-hidden="true" focusable="false">
175
175
  <path d="M10.2 3.1 5.1 8.2 2.4 5.5" />
176
176
  </svg>
177
- `,k8=`
177
+ `,S8=`
178
178
  :host {
179
179
  display: block;
180
180
  margin: var(--checkbox-list-margin, var(--space-12) 0);
@@ -184,7 +184,7 @@ tv-desktop
184
184
  display: grid;
185
185
  gap: var(--checkbox-list-gap, var(--space-6));
186
186
  }
187
- `,E8=`
187
+ `,_8=`
188
188
  :host {
189
189
  display: block;
190
190
  --checkbox-size: 1em;
@@ -265,19 +265,19 @@ tv-desktop
265
265
  text-decoration-line: var(--checkbox-checked-decoration);
266
266
  text-decoration-thickness: var(--checkbox-checked-decoration-thickness);
267
267
  }
268
- `;var Ma;class x8 extends HTMLElement{constructor(){super();b(this,Ma);m(this,Ma,this.attachShadow({mode:"open"})),l(this,Ma).innerHTML=`<style>${k8}</style><div part="list"><slot></slot></div>`}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","list")}}Ma=new WeakMap;var Ss,za,Oa,Bd;class $S extends HTMLElement{constructor(){super();b(this,Oa);b(this,Ss);b(this,za);m(this,Ss,this.attachShadow({mode:"open"})),l(this,Ss).innerHTML=`
269
- <style>${E8}</style>
268
+ `;var Ma;class k8 extends HTMLElement{constructor(){super();b(this,Ma);m(this,Ma,this.attachShadow({mode:"open"})),l(this,Ma).innerHTML=`<style>${S8}</style><div part="list"><slot></slot></div>`}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","list")}}Ma=new WeakMap;var Ss,za,Oa,Zd;class AS extends HTMLElement{constructor(){super();b(this,Oa);b(this,Ss);b(this,za);m(this,Ss,this.attachShadow({mode:"open"})),l(this,Ss).innerHTML=`
269
+ <style>${_8}</style>
270
270
  <label part="label">
271
271
  <input type="checkbox" disabled tabindex="-1">
272
- <span part="box"><span part="check">${_8}</span></span>
272
+ <span part="box"><span part="check">${w8}</span></span>
273
273
  <span part="content"><slot></slot></span>
274
274
  </label>
275
- `;const e=l(this,Ss).querySelector("input");if(!(e instanceof HTMLInputElement))throw new Error("checkbox-item failed to initialize input");m(this,za,e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","listitem"),this.setAttribute("aria-disabled","true"),d(this,Oa,Bd).call(this)}attributeChangedCallback(){d(this,Oa,Bd).call(this)}}Ss=new WeakMap,za=new WeakMap,Oa=new WeakSet,Bd=function(){const e=this.hasAttribute("checked");l(this,za).checked=e,this.setAttribute("aria-checked",e?"true":"false")},g($S,"observedAttributes",["checked"]);customElements.get("checkbox-list")||customElements.define("checkbox-list",x8);customElements.get("checkbox-item")||customElements.define("checkbox-item",$S);function A8(n,t){const e=typeof navigator>"u"?void 0:navigator.clipboard;if(e&&typeof e.writeText=="function"){e.writeText(n).catch(()=>{});return}const r=document.createElement("textarea");r.value=n,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",t.appendChild(r),r.select();try{document.execCommand("copy")}catch{}r.remove()}var dn,ti,Na,Zc,CS;const Bc=class Bc extends HTMLElement{constructor(){super(...arguments);b(this,Zc);b(this,dn,null);b(this,ti,null);b(this,Na,()=>{const e=this.getAttribute("prompt")??"";A8(e,this),this.toggleAttribute("copied",!0),d(this,Zc,CS).call(this),l(this,dn)!==null&&clearTimeout(l(this,dn)),m(this,dn,setTimeout(()=>{m(this,dn,null),this.toggleAttribute("copied",!1)},Bc.DWELL_MS))})}connectedCallback(){this.addEventListener("click",l(this,Na))}disconnectedCallback(){this.removeEventListener("click",l(this,Na)),l(this,dn)!==null&&(clearTimeout(l(this,dn)),m(this,dn,null))}};dn=new WeakMap,ti=new WeakMap,Na=new WeakMap,Zc=new WeakSet,CS=function(){if(!l(this,ti)){const e=document.createElement("span");e.setAttribute("aria-live","polite"),e.setAttribute("role","status"),e.style.position="absolute",e.style.width="1px",e.style.height="1px",e.style.margin="-1px",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.clip="rect(0 0 0 0)",e.style.clipPath="inset(50%)",e.style.whiteSpace="nowrap",this.append(e),m(this,ti,e)}l(this,ti).textContent="",l(this,ti).textContent="Copied"},g(Bc,"DWELL_MS",1400);let Wd=Bc;customElements.get("copy-button")||customElements.define("copy-button",Wd);/*! @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:IS,setPrototypeOf:Nv,isFrozen:T8,getPrototypeOf:$8,getOwnPropertyDescriptor:C8}=Object;let{freeze:rt,seal:Tt,create:hc}=Object,{apply:jd,construct:Gd}=typeof Reflect<"u"&&Reflect;rt||(rt=function(t){return t});Tt||(Tt=function(t){return t});jd||(jd=function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return t.apply(e,i)});Gd||(Gd=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return new t(...r)});const Vl=it(Array.prototype.forEach),I8=it(Array.prototype.lastIndexOf),Uv=it(Array.prototype.pop),fo=it(Array.prototype.push),R8=it(Array.prototype.splice),dc=it(String.prototype.toLowerCase),Ph=it(String.prototype.toString),Lh=it(String.prototype.match),go=it(String.prototype.replace),P8=it(String.prototype.indexOf),L8=it(String.prototype.trim),dt=it(Object.prototype.hasOwnProperty),Xe=it(RegExp.prototype.test),mo=D8(TypeError);function it(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return jd(n,t,r)}}function D8(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Gd(n,e)}}function q(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dc;Nv&&Nv(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(T8(t)||(t[r]=s),i=s)}n[i]=!0}return n}function M8(n){for(let t=0;t<n.length;t++)dt(n,t)||(n[t]=null);return n}function Xt(n){const t=hc(null);for(const[e,r]of IS(n))dt(n,e)&&(Array.isArray(r)?t[e]=M8(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Xt(r):t[e]=r);return t}function vo(n,t){for(;n!==null;){const r=C8(n,t);if(r){if(r.get)return it(r.get);if(typeof r.value=="function")return it(r.value)}n=$8(n)}function e(){return null}return e}const Fv=rt(["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"]),Dh=rt(["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"]),Mh=rt(["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"]),z8=rt(["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"]),zh=rt(["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"]),O8=rt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hv=rt(["#text"]),Vv=rt(["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"]),Oh=rt(["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"]),Zv=rt(["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"]),Zl=rt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),N8=Tt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),U8=Tt(/<%[\w\W]*|[\w\W]*%>/gm),F8=Tt(/\$\{[\w\W]*/gm),H8=Tt(/^data-[\-\w.\u00B7-\uFFFF]+$/),V8=Tt(/^aria-[\-\w]+$/),RS=Tt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Z8=Tt(/^(?:\w+script|data):/i),B8=Tt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),PS=Tt(/^html$/i),W8=Tt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Bv=Object.freeze({__proto__:null,ARIA_ATTR:V8,ATTR_WHITESPACE:B8,CUSTOM_ELEMENT:W8,DATA_ATTR:H8,DOCTYPE_NAME:PS,ERB_EXPR:U8,IS_ALLOWED_URI:RS,IS_SCRIPT_OR_DATA:Z8,MUSTACHE_EXPR:N8,TMPLIT_EXPR:F8});const yo={element:1,text:3,progressingInstruction:7,comment:8,document:9},j8=function(){return typeof window>"u"?null:window},G8=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(r=e.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Wv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function LS(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j8();const t=U=>LS(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==yo.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n;const r=e,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:y}=n,E=c.prototype,x=vo(E,"cloneNode"),C=vo(E,"remove"),L=vo(E,"nextSibling"),R=vo(E,"childNodes"),W=vo(E,"parentNode");if(typeof o=="function"){const U=e.createElement("template");U.content&&U.content.ownerDocument&&(e=U.content.ownerDocument)}let N,V="";const{implementation:K,createNodeIterator:G,createDocumentFragment:he,getElementsByTagName:Lt}=e,{importNode:_r}=r;let He=Wv();t.isSupported=typeof IS=="function"&&typeof W=="function"&&K&&K.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:kr,ERB_EXPR:Gt,TMPLIT_EXPR:Bn,DATA_ATTR:Ru,ARIA_ATTR:bl,IS_SCRIPT_OR_DATA:B_,ATTR_WHITESPACE:zf,CUSTOM_ELEMENT:W_}=Bv;let{IS_ALLOWED_URI:Of}=Bv,Me=null;const Nf=q({},[...Fv,...Dh,...Mh,...zh,...Hv]);let Ve=null;const Uf=q({},[...Vv,...Oh,...Zv,...Zl]);let _e=Object.seal(hc(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}})),io=null,wl=null;const Wn=Object.seal(hc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ff=!0,Pu=!0,Hf=!1,Vf=!0,Ri=!1,Sl=!0,Er=!1,Lu=!1,Du=!1,Pi=!1,_l=!1,kl=!1,Zf=!0,Bf=!1;const j_="user-content-";let Mu=!0,so=!1,Li={},qt=null;const zu=q({},["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 Wf=null;const jf=q({},["audio","video","img","source","image","track"]);let Ou=null;const Gf=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),El="http://www.w3.org/1998/Math/MathML",xl="http://www.w3.org/2000/svg",wn="http://www.w3.org/1999/xhtml";let Di=wn,Nu=!1,Uu=null;const G_=q({},[El,xl,wn],Ph);let Al=q({},["mi","mo","mn","ms","mtext"]),Tl=q({},["annotation-xml"]);const q_=q({},["title","style","font","a","script"]);let oo=null;const Y_=["application/xhtml+xml","text/html"],K_="text/html";let Ce=null,Mi=null;const J_=e.createElement("form"),qf=function(S){return S instanceof RegExp||S instanceof Function},Fu=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Mi&&Mi===S)){if((!S||typeof S!="object")&&(S={}),S=Xt(S),oo=Y_.indexOf(S.PARSER_MEDIA_TYPE)===-1?K_:S.PARSER_MEDIA_TYPE,Ce=oo==="application/xhtml+xml"?Ph:dc,Me=dt(S,"ALLOWED_TAGS")?q({},S.ALLOWED_TAGS,Ce):Nf,Ve=dt(S,"ALLOWED_ATTR")?q({},S.ALLOWED_ATTR,Ce):Uf,Uu=dt(S,"ALLOWED_NAMESPACES")?q({},S.ALLOWED_NAMESPACES,Ph):G_,Ou=dt(S,"ADD_URI_SAFE_ATTR")?q(Xt(Gf),S.ADD_URI_SAFE_ATTR,Ce):Gf,Wf=dt(S,"ADD_DATA_URI_TAGS")?q(Xt(jf),S.ADD_DATA_URI_TAGS,Ce):jf,qt=dt(S,"FORBID_CONTENTS")?q({},S.FORBID_CONTENTS,Ce):zu,io=dt(S,"FORBID_TAGS")?q({},S.FORBID_TAGS,Ce):Xt({}),wl=dt(S,"FORBID_ATTR")?q({},S.FORBID_ATTR,Ce):Xt({}),Li=dt(S,"USE_PROFILES")?S.USE_PROFILES:!1,Ff=S.ALLOW_ARIA_ATTR!==!1,Pu=S.ALLOW_DATA_ATTR!==!1,Hf=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Vf=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ri=S.SAFE_FOR_TEMPLATES||!1,Sl=S.SAFE_FOR_XML!==!1,Er=S.WHOLE_DOCUMENT||!1,Pi=S.RETURN_DOM||!1,_l=S.RETURN_DOM_FRAGMENT||!1,kl=S.RETURN_TRUSTED_TYPE||!1,Du=S.FORCE_BODY||!1,Zf=S.SANITIZE_DOM!==!1,Bf=S.SANITIZE_NAMED_PROPS||!1,Mu=S.KEEP_CONTENT!==!1,so=S.IN_PLACE||!1,Of=S.ALLOWED_URI_REGEXP||RS,Di=S.NAMESPACE||wn,Al=S.MATHML_TEXT_INTEGRATION_POINTS||Al,Tl=S.HTML_INTEGRATION_POINTS||Tl,_e=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&qf(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_e.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&qf(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_e.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_e.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ri&&(Pu=!1),_l&&(Pi=!0),Li&&(Me=q({},Hv),Ve=hc(null),Li.html===!0&&(q(Me,Fv),q(Ve,Vv)),Li.svg===!0&&(q(Me,Dh),q(Ve,Oh),q(Ve,Zl)),Li.svgFilters===!0&&(q(Me,Mh),q(Ve,Oh),q(Ve,Zl)),Li.mathMl===!0&&(q(Me,zh),q(Ve,Zv),q(Ve,Zl))),dt(S,"ADD_TAGS")||(Wn.tagCheck=null),dt(S,"ADD_ATTR")||(Wn.attributeCheck=null),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?Wn.tagCheck=S.ADD_TAGS:(Me===Nf&&(Me=Xt(Me)),q(Me,S.ADD_TAGS,Ce))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?Wn.attributeCheck=S.ADD_ATTR:(Ve===Uf&&(Ve=Xt(Ve)),q(Ve,S.ADD_ATTR,Ce))),S.ADD_URI_SAFE_ATTR&&q(Ou,S.ADD_URI_SAFE_ATTR,Ce),S.FORBID_CONTENTS&&(qt===zu&&(qt=Xt(qt)),q(qt,S.FORBID_CONTENTS,Ce)),S.ADD_FORBID_CONTENTS&&(qt===zu&&(qt=Xt(qt)),q(qt,S.ADD_FORBID_CONTENTS,Ce)),Mu&&(Me["#text"]=!0),Er&&q(Me,["html","head","body"]),Me.table&&(q(Me,["tbody"]),delete io.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=S.TRUSTED_TYPES_POLICY,V=N.createHTML("")}else N===void 0&&(N=G8(y,i)),N!==null&&typeof V=="string"&&(V=N.createHTML(""));rt&&rt(S),Mi=S}},Yf=q({},[...Dh,...Mh,...z8]),Kf=q({},[...zh,...O8]),X_=function(S){let I=W(S);(!I||!I.tagName)&&(I={namespaceURI:Di,tagName:"template"});const D=dc(S.tagName),pe=dc(I.tagName);return Uu[S.namespaceURI]?S.namespaceURI===xl?I.namespaceURI===wn?D==="svg":I.namespaceURI===El?D==="svg"&&(pe==="annotation-xml"||Al[pe]):!!Yf[D]:S.namespaceURI===El?I.namespaceURI===wn?D==="math":I.namespaceURI===xl?D==="math"&&Tl[pe]:!!Kf[D]:S.namespaceURI===wn?I.namespaceURI===xl&&!Tl[pe]||I.namespaceURI===El&&!Al[pe]?!1:!Kf[D]&&(q_[D]||!Yf[D]):!!(oo==="application/xhtml+xml"&&Uu[S.namespaceURI]):!1},Yt=function(S){fo(t.removed,{element:S});try{W(S).removeChild(S)}catch{C(S)}},xr=function(S,I){try{fo(t.removed,{attribute:I.getAttributeNode(S),from:I})}catch{fo(t.removed,{attribute:null,from:I})}if(I.removeAttribute(S),S==="is")if(Pi||_l)try{Yt(I)}catch{}else try{I.setAttribute(S,"")}catch{}},Jf=function(S){let I=null,D=null;if(Du)S="<remove></remove>"+S;else{const ke=Lh(S,/^[\r\n\t ]+/);D=ke&&ke[0]}oo==="application/xhtml+xml"&&Di===wn&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const pe=N?N.createHTML(S):S;if(Di===wn)try{I=new v().parseFromString(pe,oo)}catch{}if(!I||!I.documentElement){I=K.createDocument(Di,"template",null);try{I.documentElement.innerHTML=Nu?V:pe}catch{}}const qe=I.body||I.documentElement;return S&&D&&qe.insertBefore(e.createTextNode(D),qe.childNodes[0]||null),Di===wn?Lt.call(I,Er?"html":"body")[0]:Er?I.documentElement:qe},Xf=function(S){return G.call(S.ownerDocument||S,S,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Hu=function(S){return S instanceof f&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof h)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Qf=function(S){return typeof a=="function"&&S instanceof a};function Sn(U,S,I){Vl(U,D=>{D.call(t,S,I,Mi)})}const eg=function(S){let I=null;if(Sn(He.beforeSanitizeElements,S,null),Hu(S))return Yt(S),!0;const D=Ce(S.nodeName);if(Sn(He.uponSanitizeElement,S,{tagName:D,allowedTags:Me}),Sl&&S.hasChildNodes()&&!Qf(S.firstElementChild)&&Xe(/<[/\w!]/g,S.innerHTML)&&Xe(/<[/\w!]/g,S.textContent)||S.nodeType===yo.progressingInstruction||Sl&&S.nodeType===yo.comment&&Xe(/<[/\w]/g,S.data))return Yt(S),!0;if(!(Wn.tagCheck instanceof Function&&Wn.tagCheck(D))&&(!Me[D]||io[D])){if(!io[D]&&ng(D)&&(_e.tagNameCheck instanceof RegExp&&Xe(_e.tagNameCheck,D)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(D)))return!1;if(Mu&&!qt[D]){const pe=W(S)||S.parentNode,qe=R(S)||S.childNodes;if(qe&&pe){const ke=qe.length;for(let st=ke-1;st>=0;--st){const _n=x(qe[st],!0);_n.__removalCount=(S.__removalCount||0)+1,pe.insertBefore(_n,L(S))}}}return Yt(S),!0}return S instanceof c&&!X_(S)||(D==="noscript"||D==="noembed"||D==="noframes")&&Xe(/<\/no(script|embed|frames)/i,S.innerHTML)?(Yt(S),!0):(Ri&&S.nodeType===yo.text&&(I=S.textContent,Vl([kr,Gt,Bn],pe=>{I=go(I,pe," ")}),S.textContent!==I&&(fo(t.removed,{element:S.cloneNode()}),S.textContent=I)),Sn(He.afterSanitizeElements,S,null),!1)},tg=function(S,I,D){if(wl[I]||Zf&&(I==="id"||I==="name")&&(D in e||D in J_))return!1;if(!(Pu&&!wl[I]&&Xe(Ru,I))){if(!(Ff&&Xe(bl,I))){if(!(Wn.attributeCheck instanceof Function&&Wn.attributeCheck(I,S))){if(!Ve[I]||wl[I]){if(!(ng(S)&&(_e.tagNameCheck instanceof RegExp&&Xe(_e.tagNameCheck,S)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(S))&&(_e.attributeNameCheck instanceof RegExp&&Xe(_e.attributeNameCheck,I)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(I,S))||I==="is"&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&Xe(_e.tagNameCheck,D)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(D))))return!1}else if(!Ou[I]){if(!Xe(Of,go(D,zf,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&S!=="script"&&P8(D,"data:")===0&&Wf[S])){if(!(Hf&&!Xe(B_,go(D,zf,"")))){if(D)return!1}}}}}}}return!0},ng=function(S){return S!=="annotation-xml"&&Lh(S,W_)},rg=function(S){Sn(He.beforeSanitizeAttributes,S,null);const{attributes:I}=S;if(!I||Hu(S))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let pe=I.length;for(;pe--;){const qe=I[pe],{name:ke,namespaceURI:st,value:_n}=qe,zi=Ce(ke),Vu=_n;let Ze=ke==="value"?Vu:L8(Vu);if(D.attrName=zi,D.attrValue=Ze,D.keepAttr=!0,D.forceKeepAttr=void 0,Sn(He.uponSanitizeAttribute,S,D),Ze=D.attrValue,Bf&&(zi==="id"||zi==="name")&&(xr(ke,S),Ze=j_+Ze),Sl&&Xe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ze)){xr(ke,S);continue}if(zi==="attributename"&&Lh(Ze,"href")){xr(ke,S);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){xr(ke,S);continue}if(!Vf&&Xe(/\/>/i,Ze)){xr(ke,S);continue}Ri&&Vl([kr,Gt,Bn],sg=>{Ze=go(Ze,sg," ")});const ig=Ce(S.nodeName);if(!tg(ig,zi,Ze)){xr(ke,S);continue}if(N&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!st)switch(y.getAttributeType(ig,zi)){case"TrustedHTML":{Ze=N.createHTML(Ze);break}case"TrustedScriptURL":{Ze=N.createScriptURL(Ze);break}}if(Ze!==Vu)try{st?S.setAttributeNS(st,ke,Ze):S.setAttribute(ke,Ze),Hu(S)?Yt(S):Uv(t.removed)}catch{xr(ke,S)}}Sn(He.afterSanitizeAttributes,S,null)},Q_=function U(S){let I=null;const D=Xf(S);for(Sn(He.beforeSanitizeShadowDOM,S,null);I=D.nextNode();)Sn(He.uponSanitizeShadowNode,I,null),eg(I),rg(I),I.content instanceof s&&U(I.content);Sn(He.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,D=null,pe=null,qe=null;if(Nu=!U,Nu&&(U="<!-->"),typeof U!="string"&&!Qf(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw mo("dirty is not a string, aborting")}else throw mo("toString is not a function");if(!t.isSupported)return U;if(Lu||Fu(S),t.removed=[],typeof U=="string"&&(so=!1),so){if(U.nodeName){const _n=Ce(U.nodeName);if(!Me[_n]||io[_n])throw mo("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)I=Jf("<!---->"),D=I.ownerDocument.importNode(U,!0),D.nodeType===yo.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?I=D:I.appendChild(D);else{if(!Pi&&!Ri&&!Er&&U.indexOf("<")===-1)return N&&kl?N.createHTML(U):U;if(I=Jf(U),!I)return Pi?null:kl?V:""}I&&Du&&Yt(I.firstChild);const ke=Xf(so?U:I);for(;pe=ke.nextNode();)eg(pe),rg(pe),pe.content instanceof s&&Q_(pe.content);if(so)return U;if(Pi){if(_l)for(qe=he.call(I.ownerDocument);I.firstChild;)qe.appendChild(I.firstChild);else qe=I;return(Ve.shadowroot||Ve.shadowrootmode)&&(qe=_r.call(r,qe,!0)),qe}let st=Er?I.outerHTML:I.innerHTML;return Er&&Me["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&Xe(PS,I.ownerDocument.doctype.name)&&(st="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
276
- `+st),Ri&&Vl([kr,Gt,Bn],_n=>{st=go(st,_n," ")}),N&&kl?N.createHTML(st):st},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fu(U),Lu=!0},t.clearConfig=function(){Mi=null,Lu=!1},t.isValidAttribute=function(U,S,I){Mi||Fu({});const D=Ce(U),pe=Ce(S);return tg(D,pe,I)},t.addHook=function(U,S){typeof S=="function"&&fo(He[U],S)},t.removeHook=function(U,S){if(S!==void 0){const I=I8(He[U],S);return I===-1?void 0:R8(He[U],I,1)[0]}return Uv(He[U])},t.removeHooks=function(U){He[U]=[]},t.removeAllHooks=function(){He=Wv()},t}var DS=LS();function kf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ii=kf();function MS(n){Ii=n}var Mr={exec:()=>null};function X(n,t=""){let e=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(tt.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var q8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),tt={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)}}>`)},Y8=/^(?:[ \t]*(?:\n|$))+/,K8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,J8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,X8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ef=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,zS=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,OS=X(zS).replace(/bull/g,Ef).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(),Q8=X(zS).replace(/bull/g,Ef).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(),xf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,eN=/^[^\n]+/,Af=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tN=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Af).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nN=X(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ef).getRegex(),Tu="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",Tf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rN=X("^ {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",Tf).replace("tag",Tu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),NS=X(xf).replace("hr",vl).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",Tu).getRegex(),iN=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",NS).getRegex(),$f={blockquote:iN,code:K8,def:tN,fences:J8,heading:X8,hr:vl,html:rN,lheading:OS,list:nN,newline:Y8,paragraph:NS,table:Mr,text:eN},jv=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vl).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",Tu).getRegex(),sN={...$f,lheading:Q8,table:jv,paragraph:X(xf).replace("hr",vl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jv).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",Tu).getRegex()},oN={...$f,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Tf).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:Mr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(xf).replace("hr",vl).replace("heading",` *#{1,6} *[^
277
- ]`).replace("lheading",OS).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},aN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,US=/^( {2,}|\\)\n(?!\s*$)/,cN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ro=/[\p{P}\p{S}]/u,$u=/[\s\p{P}\p{S}]/u,Cf=/[^\s\p{P}\p{S}]/u,uN=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$u).getRegex(),FS=/(?!~)[\p{P}\p{S}]/u,hN=/(?!~)[\s\p{P}\p{S}]/u,dN=/(?:[^\s\p{P}\p{S}]|~)/u,pN=X(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",q8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),HS=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fN=X(HS,"u").replace(/punct/g,ro).getRegex(),gN=X(HS,"u").replace(/punct/g,FS).getRegex(),VS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",mN=X(VS,"gu").replace(/notPunctSpace/g,Cf).replace(/punctSpace/g,$u).replace(/punct/g,ro).getRegex(),vN=X(VS,"gu").replace(/notPunctSpace/g,dN).replace(/punctSpace/g,hN).replace(/punct/g,FS).getRegex(),yN=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Cf).replace(/punctSpace/g,$u).replace(/punct/g,ro).getRegex(),bN=X(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ro).getRegex(),wN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",SN=X(wN,"gu").replace(/notPunctSpace/g,Cf).replace(/punctSpace/g,$u).replace(/punct/g,ro).getRegex(),_N=X(/\\(punct)/,"gu").replace(/punct/g,ro).getRegex(),kN=X(/^<(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(),EN=X(Tf).replace("(?:-->|$)","-->").getRegex(),xN=X("^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",EN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,AN=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Pc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ZS=X(/^!?\[(label)\]\[(ref)\]/).replace("label",Pc).replace("ref",Af).getRegex(),BS=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",Af).getRegex(),TN=X("reflink|nolink(?!\\()","g").replace("reflink",ZS).replace("nolink",BS).getRegex(),Gv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,If={_backpedal:Mr,anyPunctuation:_N,autolink:kN,blockSkip:pN,br:US,code:lN,del:Mr,delLDelim:Mr,delRDelim:Mr,emStrongLDelim:fN,emStrongRDelimAst:mN,emStrongRDelimUnd:yN,escape:aN,link:AN,nolink:BS,punctuation:uN,reflink:ZS,reflinkSearch:TN,tag:xN,text:cN,url:Mr},$N={...If,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",Pc).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pc).getRegex()},qd={...If,emStrongRDelimAst:vN,emStrongLDelim:gN,delLDelim:bN,delRDelim:SN,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Gv).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:X(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Gv).getRegex()},CN={...qd,br:X(US).replace("{2,}","*").getRegex(),text:X(qd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Bl={normal:$f,gfm:sN,pedantic:oN},bo={normal:If,gfm:qd,breaks:CN,pedantic:$N},IN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qv=n=>IN[n];function Qt(n,t){if(t){if(tt.escapeTest.test(n))return n.replace(tt.escapeReplace,qv)}else if(tt.escapeTestNoEncode.test(n))return n.replace(tt.escapeReplaceNoEncode,qv);return n}function Yv(n){try{n=encodeURI(n).replace(tt.percentDecode,"%")}catch{return null}return n}function Kv(n,t){var s;let e=n.replace(tt.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(tt.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(tt.slashPipe,"|");return r}function wo(n,t,e){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===t;)i++;return n.slice(0,r-i)}function RN(n,t){if(n.indexOf(t[1])===-1)return-1;let e=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===t[0])e++;else if(n[r]===t[1]&&(e--,e<0))return r;return e>0?-2:-1}function PN(n,t=0){let e=t,r="";for(let i of n)if(i===" "){let s=4-e%4;r+=" ".repeat(s),e+=s}else r+=i,e++;return r}function Jv(n,t,e,r,i){let s=t.href,o=t.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:e,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function LN(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
275
+ `;const e=l(this,Ss).querySelector("input");if(!(e instanceof HTMLInputElement))throw new Error("checkbox-item failed to initialize input");m(this,za,e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","listitem"),this.setAttribute("aria-disabled","true"),d(this,Oa,Zd).call(this)}attributeChangedCallback(){d(this,Oa,Zd).call(this)}}Ss=new WeakMap,za=new WeakMap,Oa=new WeakSet,Zd=function(){const e=this.hasAttribute("checked");l(this,za).checked=e,this.setAttribute("aria-checked",e?"true":"false")},g(AS,"observedAttributes",["checked"]);customElements.get("checkbox-list")||customElements.define("checkbox-list",k8);customElements.get("checkbox-item")||customElements.define("checkbox-item",AS);function E8(n,t){const e=typeof navigator>"u"?void 0:navigator.clipboard;if(e&&typeof e.writeText=="function"){e.writeText(n).catch(()=>{});return}const r=document.createElement("textarea");r.value=n,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",t.appendChild(r),r.select();try{document.execCommand("copy")}catch{}r.remove()}var dn,ti,Na,Zc,TS;const Bc=class Bc extends HTMLElement{constructor(){super(...arguments);b(this,Zc);b(this,dn,null);b(this,ti,null);b(this,Na,()=>{const e=this.getAttribute("prompt")??"";E8(e,this),this.toggleAttribute("copied",!0),d(this,Zc,TS).call(this),l(this,dn)!==null&&clearTimeout(l(this,dn)),m(this,dn,setTimeout(()=>{m(this,dn,null),this.toggleAttribute("copied",!1)},Bc.DWELL_MS))})}connectedCallback(){this.addEventListener("click",l(this,Na))}disconnectedCallback(){this.removeEventListener("click",l(this,Na)),l(this,dn)!==null&&(clearTimeout(l(this,dn)),m(this,dn,null))}};dn=new WeakMap,ti=new WeakMap,Na=new WeakMap,Zc=new WeakSet,TS=function(){if(!l(this,ti)){const e=document.createElement("span");e.setAttribute("aria-live","polite"),e.setAttribute("role","status"),e.style.position="absolute",e.style.width="1px",e.style.height="1px",e.style.margin="-1px",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.clip="rect(0 0 0 0)",e.style.clipPath="inset(50%)",e.style.whiteSpace="nowrap",this.append(e),m(this,ti,e)}l(this,ti).textContent="",l(this,ti).textContent="Copied"},g(Bc,"DWELL_MS",1400);let Bd=Bc;customElements.get("copy-button")||customElements.define("copy-button",Bd);/*! @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:$S,setPrototypeOf:zv,isFrozen:x8,getPrototypeOf:A8,getOwnPropertyDescriptor:T8}=Object;let{freeze:rt,seal:Tt,create:hc}=Object,{apply:Wd,construct:jd}=typeof Reflect<"u"&&Reflect;rt||(rt=function(t){return t});Tt||(Tt=function(t){return t});Wd||(Wd=function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return t.apply(e,i)});jd||(jd=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return new t(...r)});const Vl=it(Array.prototype.forEach),$8=it(Array.prototype.lastIndexOf),Ov=it(Array.prototype.pop),fo=it(Array.prototype.push),C8=it(Array.prototype.splice),dc=it(String.prototype.toLowerCase),Rh=it(String.prototype.toString),Ph=it(String.prototype.match),go=it(String.prototype.replace),I8=it(String.prototype.indexOf),R8=it(String.prototype.trim),dt=it(Object.prototype.hasOwnProperty),Xe=it(RegExp.prototype.test),mo=P8(TypeError);function it(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return Wd(n,t,r)}}function P8(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return jd(n,e)}}function q(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dc;zv&&zv(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(x8(t)||(t[r]=s),i=s)}n[i]=!0}return n}function L8(n){for(let t=0;t<n.length;t++)dt(n,t)||(n[t]=null);return n}function Xt(n){const t=hc(null);for(const[e,r]of $S(n))dt(n,e)&&(Array.isArray(r)?t[e]=L8(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Xt(r):t[e]=r);return t}function vo(n,t){for(;n!==null;){const r=T8(n,t);if(r){if(r.get)return it(r.get);if(typeof r.value=="function")return it(r.value)}n=A8(n)}function e(){return null}return e}const Nv=rt(["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"]),Lh=rt(["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"]),Dh=rt(["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"]),D8=rt(["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"]),Mh=rt(["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"]),M8=rt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Uv=rt(["#text"]),Fv=rt(["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"]),zh=rt(["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"]),Hv=rt(["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"]),Zl=rt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z8=Tt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),O8=Tt(/<%[\w\W]*|[\w\W]*%>/gm),N8=Tt(/\$\{[\w\W]*/gm),U8=Tt(/^data-[\-\w.\u00B7-\uFFFF]+$/),F8=Tt(/^aria-[\-\w]+$/),CS=Tt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),H8=Tt(/^(?:\w+script|data):/i),V8=Tt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),IS=Tt(/^html$/i),Z8=Tt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Vv=Object.freeze({__proto__:null,ARIA_ATTR:F8,ATTR_WHITESPACE:V8,CUSTOM_ELEMENT:Z8,DATA_ATTR:U8,DOCTYPE_NAME:IS,ERB_EXPR:O8,IS_ALLOWED_URI:CS,IS_SCRIPT_OR_DATA:H8,MUSTACHE_EXPR:z8,TMPLIT_EXPR:N8});const yo={element:1,text:3,progressingInstruction:7,comment:8,document:9},B8=function(){return typeof window>"u"?null:window},W8=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(r=e.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Zv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function RS(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B8();const t=U=>RS(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==yo.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n;const r=e,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:y}=n,E=c.prototype,x=vo(E,"cloneNode"),C=vo(E,"remove"),L=vo(E,"nextSibling"),R=vo(E,"childNodes"),W=vo(E,"parentNode");if(typeof o=="function"){const U=e.createElement("template");U.content&&U.content.ownerDocument&&(e=U.content.ownerDocument)}let N,V="";const{implementation:K,createNodeIterator:G,createDocumentFragment:he,getElementsByTagName:Lt}=e,{importNode:_r}=r;let He=Zv();t.isSupported=typeof $S=="function"&&typeof W=="function"&&K&&K.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:kr,ERB_EXPR:Gt,TMPLIT_EXPR:Bn,DATA_ATTR:Ru,ARIA_ATTR:bl,IS_SCRIPT_OR_DATA:V_,ATTR_WHITESPACE:Mf,CUSTOM_ELEMENT:Z_}=Vv;let{IS_ALLOWED_URI:zf}=Vv,Me=null;const Of=q({},[...Nv,...Lh,...Dh,...Mh,...Uv]);let Ve=null;const Nf=q({},[...Fv,...zh,...Hv,...Zl]);let _e=Object.seal(hc(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}})),io=null,wl=null;const Wn=Object.seal(hc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Uf=!0,Pu=!0,Ff=!1,Hf=!0,Ri=!1,Sl=!0,Er=!1,Lu=!1,Du=!1,Pi=!1,_l=!1,kl=!1,Vf=!0,Zf=!1;const B_="user-content-";let Mu=!0,so=!1,Li={},qt=null;const zu=q({},["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 Bf=null;const Wf=q({},["audio","video","img","source","image","track"]);let Ou=null;const jf=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),El="http://www.w3.org/1998/Math/MathML",xl="http://www.w3.org/2000/svg",wn="http://www.w3.org/1999/xhtml";let Di=wn,Nu=!1,Uu=null;const W_=q({},[El,xl,wn],Rh);let Al=q({},["mi","mo","mn","ms","mtext"]),Tl=q({},["annotation-xml"]);const j_=q({},["title","style","font","a","script"]);let oo=null;const G_=["application/xhtml+xml","text/html"],q_="text/html";let Ce=null,Mi=null;const Y_=e.createElement("form"),Gf=function(S){return S instanceof RegExp||S instanceof Function},Fu=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Mi&&Mi===S)){if((!S||typeof S!="object")&&(S={}),S=Xt(S),oo=G_.indexOf(S.PARSER_MEDIA_TYPE)===-1?q_:S.PARSER_MEDIA_TYPE,Ce=oo==="application/xhtml+xml"?Rh:dc,Me=dt(S,"ALLOWED_TAGS")?q({},S.ALLOWED_TAGS,Ce):Of,Ve=dt(S,"ALLOWED_ATTR")?q({},S.ALLOWED_ATTR,Ce):Nf,Uu=dt(S,"ALLOWED_NAMESPACES")?q({},S.ALLOWED_NAMESPACES,Rh):W_,Ou=dt(S,"ADD_URI_SAFE_ATTR")?q(Xt(jf),S.ADD_URI_SAFE_ATTR,Ce):jf,Bf=dt(S,"ADD_DATA_URI_TAGS")?q(Xt(Wf),S.ADD_DATA_URI_TAGS,Ce):Wf,qt=dt(S,"FORBID_CONTENTS")?q({},S.FORBID_CONTENTS,Ce):zu,io=dt(S,"FORBID_TAGS")?q({},S.FORBID_TAGS,Ce):Xt({}),wl=dt(S,"FORBID_ATTR")?q({},S.FORBID_ATTR,Ce):Xt({}),Li=dt(S,"USE_PROFILES")?S.USE_PROFILES:!1,Uf=S.ALLOW_ARIA_ATTR!==!1,Pu=S.ALLOW_DATA_ATTR!==!1,Ff=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Hf=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ri=S.SAFE_FOR_TEMPLATES||!1,Sl=S.SAFE_FOR_XML!==!1,Er=S.WHOLE_DOCUMENT||!1,Pi=S.RETURN_DOM||!1,_l=S.RETURN_DOM_FRAGMENT||!1,kl=S.RETURN_TRUSTED_TYPE||!1,Du=S.FORCE_BODY||!1,Vf=S.SANITIZE_DOM!==!1,Zf=S.SANITIZE_NAMED_PROPS||!1,Mu=S.KEEP_CONTENT!==!1,so=S.IN_PLACE||!1,zf=S.ALLOWED_URI_REGEXP||CS,Di=S.NAMESPACE||wn,Al=S.MATHML_TEXT_INTEGRATION_POINTS||Al,Tl=S.HTML_INTEGRATION_POINTS||Tl,_e=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Gf(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_e.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Gf(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_e.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_e.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ri&&(Pu=!1),_l&&(Pi=!0),Li&&(Me=q({},Uv),Ve=hc(null),Li.html===!0&&(q(Me,Nv),q(Ve,Fv)),Li.svg===!0&&(q(Me,Lh),q(Ve,zh),q(Ve,Zl)),Li.svgFilters===!0&&(q(Me,Dh),q(Ve,zh),q(Ve,Zl)),Li.mathMl===!0&&(q(Me,Mh),q(Ve,Hv),q(Ve,Zl))),dt(S,"ADD_TAGS")||(Wn.tagCheck=null),dt(S,"ADD_ATTR")||(Wn.attributeCheck=null),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?Wn.tagCheck=S.ADD_TAGS:(Me===Of&&(Me=Xt(Me)),q(Me,S.ADD_TAGS,Ce))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?Wn.attributeCheck=S.ADD_ATTR:(Ve===Nf&&(Ve=Xt(Ve)),q(Ve,S.ADD_ATTR,Ce))),S.ADD_URI_SAFE_ATTR&&q(Ou,S.ADD_URI_SAFE_ATTR,Ce),S.FORBID_CONTENTS&&(qt===zu&&(qt=Xt(qt)),q(qt,S.FORBID_CONTENTS,Ce)),S.ADD_FORBID_CONTENTS&&(qt===zu&&(qt=Xt(qt)),q(qt,S.ADD_FORBID_CONTENTS,Ce)),Mu&&(Me["#text"]=!0),Er&&q(Me,["html","head","body"]),Me.table&&(q(Me,["tbody"]),delete io.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=S.TRUSTED_TYPES_POLICY,V=N.createHTML("")}else N===void 0&&(N=W8(y,i)),N!==null&&typeof V=="string"&&(V=N.createHTML(""));rt&&rt(S),Mi=S}},qf=q({},[...Lh,...Dh,...D8]),Yf=q({},[...Mh,...M8]),K_=function(S){let I=W(S);(!I||!I.tagName)&&(I={namespaceURI:Di,tagName:"template"});const D=dc(S.tagName),pe=dc(I.tagName);return Uu[S.namespaceURI]?S.namespaceURI===xl?I.namespaceURI===wn?D==="svg":I.namespaceURI===El?D==="svg"&&(pe==="annotation-xml"||Al[pe]):!!qf[D]:S.namespaceURI===El?I.namespaceURI===wn?D==="math":I.namespaceURI===xl?D==="math"&&Tl[pe]:!!Yf[D]:S.namespaceURI===wn?I.namespaceURI===xl&&!Tl[pe]||I.namespaceURI===El&&!Al[pe]?!1:!Yf[D]&&(j_[D]||!qf[D]):!!(oo==="application/xhtml+xml"&&Uu[S.namespaceURI]):!1},Yt=function(S){fo(t.removed,{element:S});try{W(S).removeChild(S)}catch{C(S)}},xr=function(S,I){try{fo(t.removed,{attribute:I.getAttributeNode(S),from:I})}catch{fo(t.removed,{attribute:null,from:I})}if(I.removeAttribute(S),S==="is")if(Pi||_l)try{Yt(I)}catch{}else try{I.setAttribute(S,"")}catch{}},Kf=function(S){let I=null,D=null;if(Du)S="<remove></remove>"+S;else{const ke=Ph(S,/^[\r\n\t ]+/);D=ke&&ke[0]}oo==="application/xhtml+xml"&&Di===wn&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const pe=N?N.createHTML(S):S;if(Di===wn)try{I=new v().parseFromString(pe,oo)}catch{}if(!I||!I.documentElement){I=K.createDocument(Di,"template",null);try{I.documentElement.innerHTML=Nu?V:pe}catch{}}const qe=I.body||I.documentElement;return S&&D&&qe.insertBefore(e.createTextNode(D),qe.childNodes[0]||null),Di===wn?Lt.call(I,Er?"html":"body")[0]:Er?I.documentElement:qe},Jf=function(S){return G.call(S.ownerDocument||S,S,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Hu=function(S){return S instanceof f&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof h)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Xf=function(S){return typeof a=="function"&&S instanceof a};function Sn(U,S,I){Vl(U,D=>{D.call(t,S,I,Mi)})}const Qf=function(S){let I=null;if(Sn(He.beforeSanitizeElements,S,null),Hu(S))return Yt(S),!0;const D=Ce(S.nodeName);if(Sn(He.uponSanitizeElement,S,{tagName:D,allowedTags:Me}),Sl&&S.hasChildNodes()&&!Xf(S.firstElementChild)&&Xe(/<[/\w!]/g,S.innerHTML)&&Xe(/<[/\w!]/g,S.textContent)||S.nodeType===yo.progressingInstruction||Sl&&S.nodeType===yo.comment&&Xe(/<[/\w]/g,S.data))return Yt(S),!0;if(!(Wn.tagCheck instanceof Function&&Wn.tagCheck(D))&&(!Me[D]||io[D])){if(!io[D]&&tg(D)&&(_e.tagNameCheck instanceof RegExp&&Xe(_e.tagNameCheck,D)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(D)))return!1;if(Mu&&!qt[D]){const pe=W(S)||S.parentNode,qe=R(S)||S.childNodes;if(qe&&pe){const ke=qe.length;for(let st=ke-1;st>=0;--st){const _n=x(qe[st],!0);_n.__removalCount=(S.__removalCount||0)+1,pe.insertBefore(_n,L(S))}}}return Yt(S),!0}return S instanceof c&&!K_(S)||(D==="noscript"||D==="noembed"||D==="noframes")&&Xe(/<\/no(script|embed|frames)/i,S.innerHTML)?(Yt(S),!0):(Ri&&S.nodeType===yo.text&&(I=S.textContent,Vl([kr,Gt,Bn],pe=>{I=go(I,pe," ")}),S.textContent!==I&&(fo(t.removed,{element:S.cloneNode()}),S.textContent=I)),Sn(He.afterSanitizeElements,S,null),!1)},eg=function(S,I,D){if(wl[I]||Vf&&(I==="id"||I==="name")&&(D in e||D in Y_))return!1;if(!(Pu&&!wl[I]&&Xe(Ru,I))){if(!(Uf&&Xe(bl,I))){if(!(Wn.attributeCheck instanceof Function&&Wn.attributeCheck(I,S))){if(!Ve[I]||wl[I]){if(!(tg(S)&&(_e.tagNameCheck instanceof RegExp&&Xe(_e.tagNameCheck,S)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(S))&&(_e.attributeNameCheck instanceof RegExp&&Xe(_e.attributeNameCheck,I)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(I,S))||I==="is"&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&Xe(_e.tagNameCheck,D)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(D))))return!1}else if(!Ou[I]){if(!Xe(zf,go(D,Mf,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&S!=="script"&&I8(D,"data:")===0&&Bf[S])){if(!(Ff&&!Xe(V_,go(D,Mf,"")))){if(D)return!1}}}}}}}return!0},tg=function(S){return S!=="annotation-xml"&&Ph(S,Z_)},ng=function(S){Sn(He.beforeSanitizeAttributes,S,null);const{attributes:I}=S;if(!I||Hu(S))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let pe=I.length;for(;pe--;){const qe=I[pe],{name:ke,namespaceURI:st,value:_n}=qe,zi=Ce(ke),Vu=_n;let Ze=ke==="value"?Vu:R8(Vu);if(D.attrName=zi,D.attrValue=Ze,D.keepAttr=!0,D.forceKeepAttr=void 0,Sn(He.uponSanitizeAttribute,S,D),Ze=D.attrValue,Zf&&(zi==="id"||zi==="name")&&(xr(ke,S),Ze=B_+Ze),Sl&&Xe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ze)){xr(ke,S);continue}if(zi==="attributename"&&Ph(Ze,"href")){xr(ke,S);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){xr(ke,S);continue}if(!Hf&&Xe(/\/>/i,Ze)){xr(ke,S);continue}Ri&&Vl([kr,Gt,Bn],ig=>{Ze=go(Ze,ig," ")});const rg=Ce(S.nodeName);if(!eg(rg,zi,Ze)){xr(ke,S);continue}if(N&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!st)switch(y.getAttributeType(rg,zi)){case"TrustedHTML":{Ze=N.createHTML(Ze);break}case"TrustedScriptURL":{Ze=N.createScriptURL(Ze);break}}if(Ze!==Vu)try{st?S.setAttributeNS(st,ke,Ze):S.setAttribute(ke,Ze),Hu(S)?Yt(S):Ov(t.removed)}catch{xr(ke,S)}}Sn(He.afterSanitizeAttributes,S,null)},J_=function U(S){let I=null;const D=Jf(S);for(Sn(He.beforeSanitizeShadowDOM,S,null);I=D.nextNode();)Sn(He.uponSanitizeShadowNode,I,null),Qf(I),ng(I),I.content instanceof s&&U(I.content);Sn(He.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,D=null,pe=null,qe=null;if(Nu=!U,Nu&&(U="<!-->"),typeof U!="string"&&!Xf(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw mo("dirty is not a string, aborting")}else throw mo("toString is not a function");if(!t.isSupported)return U;if(Lu||Fu(S),t.removed=[],typeof U=="string"&&(so=!1),so){if(U.nodeName){const _n=Ce(U.nodeName);if(!Me[_n]||io[_n])throw mo("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)I=Kf("<!---->"),D=I.ownerDocument.importNode(U,!0),D.nodeType===yo.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?I=D:I.appendChild(D);else{if(!Pi&&!Ri&&!Er&&U.indexOf("<")===-1)return N&&kl?N.createHTML(U):U;if(I=Kf(U),!I)return Pi?null:kl?V:""}I&&Du&&Yt(I.firstChild);const ke=Jf(so?U:I);for(;pe=ke.nextNode();)Qf(pe),ng(pe),pe.content instanceof s&&J_(pe.content);if(so)return U;if(Pi){if(_l)for(qe=he.call(I.ownerDocument);I.firstChild;)qe.appendChild(I.firstChild);else qe=I;return(Ve.shadowroot||Ve.shadowrootmode)&&(qe=_r.call(r,qe,!0)),qe}let st=Er?I.outerHTML:I.innerHTML;return Er&&Me["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&Xe(IS,I.ownerDocument.doctype.name)&&(st="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
276
+ `+st),Ri&&Vl([kr,Gt,Bn],_n=>{st=go(st,_n," ")}),N&&kl?N.createHTML(st):st},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fu(U),Lu=!0},t.clearConfig=function(){Mi=null,Lu=!1},t.isValidAttribute=function(U,S,I){Mi||Fu({});const D=Ce(U),pe=Ce(S);return eg(D,pe,I)},t.addHook=function(U,S){typeof S=="function"&&fo(He[U],S)},t.removeHook=function(U,S){if(S!==void 0){const I=$8(He[U],S);return I===-1?void 0:C8(He[U],I,1)[0]}return Ov(He[U])},t.removeHooks=function(U){He[U]=[]},t.removeAllHooks=function(){He=Zv()},t}var PS=RS();function _f(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ii=_f();function LS(n){Ii=n}var Mr={exec:()=>null};function X(n,t=""){let e=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(tt.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var j8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),tt={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)}}>`)},G8=/^(?:[ \t]*(?:\n|$))+/,q8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Y8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,K8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kf=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,DS=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,MS=X(DS).replace(/bull/g,kf).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(),J8=X(DS).replace(/bull/g,kf).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(),Ef=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,X8=/^[^\n]+/,xf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Q8=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),eN=X(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kf).getRegex(),Tu="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",Af=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,tN=X("^ {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",Af).replace("tag",Tu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),zS=X(Ef).replace("hr",vl).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",Tu).getRegex(),nN=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",zS).getRegex(),Tf={blockquote:nN,code:q8,def:Q8,fences:Y8,heading:K8,hr:vl,html:tN,lheading:MS,list:eN,newline:G8,paragraph:zS,table:Mr,text:X8},Bv=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vl).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",Tu).getRegex(),rN={...Tf,lheading:J8,table:Bv,paragraph:X(Ef).replace("hr",vl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Bv).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",Tu).getRegex()},iN={...Tf,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Af).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:Mr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Ef).replace("hr",vl).replace("heading",` *#{1,6} *[^
277
+ ]`).replace("lheading",MS).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},sN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,oN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,OS=/^( {2,}|\\)\n(?!\s*$)/,aN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ro=/[\p{P}\p{S}]/u,$u=/[\s\p{P}\p{S}]/u,$f=/[^\s\p{P}\p{S}]/u,lN=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$u).getRegex(),NS=/(?!~)[\p{P}\p{S}]/u,cN=/(?!~)[\s\p{P}\p{S}]/u,uN=/(?:[^\s\p{P}\p{S}]|~)/u,hN=X(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",j8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),US=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,dN=X(US,"u").replace(/punct/g,ro).getRegex(),pN=X(US,"u").replace(/punct/g,NS).getRegex(),FS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fN=X(FS,"gu").replace(/notPunctSpace/g,$f).replace(/punctSpace/g,$u).replace(/punct/g,ro).getRegex(),gN=X(FS,"gu").replace(/notPunctSpace/g,uN).replace(/punctSpace/g,cN).replace(/punct/g,NS).getRegex(),mN=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,$f).replace(/punctSpace/g,$u).replace(/punct/g,ro).getRegex(),vN=X(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ro).getRegex(),yN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",bN=X(yN,"gu").replace(/notPunctSpace/g,$f).replace(/punctSpace/g,$u).replace(/punct/g,ro).getRegex(),wN=X(/\\(punct)/,"gu").replace(/punct/g,ro).getRegex(),SN=X(/^<(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(),_N=X(Af).replace("(?:-->|$)","-->").getRegex(),kN=X("^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",_N).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,EN=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Pc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),HS=X(/^!?\[(label)\]\[(ref)\]/).replace("label",Pc).replace("ref",xf).getRegex(),VS=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",xf).getRegex(),xN=X("reflink|nolink(?!\\()","g").replace("reflink",HS).replace("nolink",VS).getRegex(),Wv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Cf={_backpedal:Mr,anyPunctuation:wN,autolink:SN,blockSkip:hN,br:OS,code:oN,del:Mr,delLDelim:Mr,delRDelim:Mr,emStrongLDelim:dN,emStrongRDelimAst:fN,emStrongRDelimUnd:mN,escape:sN,link:EN,nolink:VS,punctuation:lN,reflink:HS,reflinkSearch:xN,tag:kN,text:aN,url:Mr},AN={...Cf,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",Pc).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pc).getRegex()},Gd={...Cf,emStrongRDelimAst:gN,emStrongLDelim:pN,delLDelim:vN,delRDelim:bN,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Wv).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:X(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Wv).getRegex()},TN={...Gd,br:X(OS).replace("{2,}","*").getRegex(),text:X(Gd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Bl={normal:Tf,gfm:rN,pedantic:iN},bo={normal:Cf,gfm:Gd,breaks:TN,pedantic:AN},$N={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},jv=n=>$N[n];function Qt(n,t){if(t){if(tt.escapeTest.test(n))return n.replace(tt.escapeReplace,jv)}else if(tt.escapeTestNoEncode.test(n))return n.replace(tt.escapeReplaceNoEncode,jv);return n}function Gv(n){try{n=encodeURI(n).replace(tt.percentDecode,"%")}catch{return null}return n}function qv(n,t){var s;let e=n.replace(tt.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(tt.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(tt.slashPipe,"|");return r}function wo(n,t,e){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===t;)i++;return n.slice(0,r-i)}function CN(n,t){if(n.indexOf(t[1])===-1)return-1;let e=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===t[0])e++;else if(n[r]===t[1]&&(e--,e<0))return r;return e>0?-2:-1}function IN(n,t=0){let e=t,r="";for(let i of n)if(i===" "){let s=4-e%4;r+=" ".repeat(s),e+=s}else r+=i,e++;return r}function Yv(n,t,e,r,i){let s=t.href,o=t.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:e,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function RN(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
278
278
  `).map(s=>{let o=s.match(e.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
279
279
  `)}var Lc=class{constructor(n){g(this,"options");g(this,"rules");g(this,"lexer");this.options=n||Ii}space(n){let t=this.rules.block.newline.exec(n);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(n){let t=this.rules.block.code.exec(n);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:wo(e,`
280
- `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=LN(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(n){let t=this.rules.block.heading.exec(n);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let r=wo(e,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(e=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(n){let t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:wo(t[0],`
280
+ `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=RN(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(n){let t=this.rules.block.heading.exec(n);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let r=wo(e,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(e=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(n){let t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:wo(t[0],`
281
281
  `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=wo(t[0],`
282
282
  `).split(`
283
283
  `),r="",i="",s=[];for(;e.length>0;){let o=!1,a=[],c;for(c=0;c<e.length;c++)if(this.rules.other.blockquoteStart.test(e[c]))a.push(e[c]),o=!0;else if(!o)a.push(e[c]);else break;e=e.slice(c);let u=a.join(`
@@ -289,16 +289,16 @@ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
289
289
  `),x=this.blockquote(E);s[s.length-1]=x,r=r.substring(0,r.length-y.raw.length)+x.raw,i=i.substring(0,i.length-y.text.length)+x.text;break}else if((v==null?void 0:v.type)==="list"){let y=v,E=y.raw+`
290
290
  `+e.join(`
291
291
  `),x=this.list(E);s[s.length-1]=x,r=r.substring(0,r.length-v.raw.length)+x.raw,i=i.substring(0,i.length-y.raw.length)+x.raw,e=E.substring(s.at(-1).raw.length).split(`
292
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var e,r;let t=this.rules.block.list.exec(n);if(t){let i=t[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,f="",v="";if(!(t=a.exec(n))||this.rules.block.hr.test(n))break;f=t[0],n=n.substring(f.length);let y=PN(t[2].split(`
292
+ `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var e,r;let t=this.rules.block.list.exec(n);if(t){let i=t[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,f="",v="";if(!(t=a.exec(n))||this.rules.block.hr.test(n))break;f=t[0],n=n.substring(f.length);let y=IN(t[2].split(`
293
293
  `,1)[0],t[1].length),E=n.split(`
294
294
  `,1)[0],x=!y.trim(),C=0;if(this.options.pedantic?(C=2,v=y.trimStart()):x?C=t[1].length+1:(C=y.search(this.rules.other.nonSpaceChar),C=C>4?1:C,v=y.slice(C),C+=t[1].length),x&&this.rules.other.blankLine.test(E)&&(f+=E+`
295
295
  `,n=n.substring(E.length+1),h=!0),!h){let L=this.rules.other.nextBulletRegex(C),R=this.rules.other.hrRegex(C),W=this.rules.other.fencesBeginRegex(C),N=this.rules.other.headingBeginRegex(C),V=this.rules.other.htmlBeginRegex(C),K=this.rules.other.blockquoteBeginRegex(C);for(;n;){let G=n.split(`
296
296
  `,1)[0],he;if(E=G,this.options.pedantic?(E=E.replace(this.rules.other.listReplaceNesting," "),he=E):he=E.replace(this.rules.other.tabCharGlobal," "),W.test(E)||N.test(E)||V.test(E)||K.test(E)||L.test(E)||R.test(E))break;if(he.search(this.rules.other.nonSpaceChar)>=C||!E.trim())v+=`
297
297
  `+he.slice(C);else{if(x||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||W.test(y)||N.test(y)||R.test(y))break;v+=`
298
298
  `+E}x=!E.trim(),f+=G+`
299
- `,n=n.substring(G.length+1),y=he.slice(C)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(c=!0)),o.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),o.raw+=f}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,""),((e=h.tokens[0])==null?void 0:e.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 f=this.rules.other.listTaskCheckbox.exec(h.raw);if(f){let v={type:"checkbox",raw:f[0]+" ",checked:f[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 f=h.tokens.filter(y=>y.type==="space"),v=f.length>0&&f.some(y=>this.rules.other.anyLine.test(y.raw));o.loose=v}}if(o.loose)for(let h of o.items){h.loose=!0;for(let f of h.tokens)f.type==="text"&&(f.type="paragraph")}return o}}html(n){let t=this.rules.block.html.exec(n);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(n){let t=this.rules.block.def.exec(n);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:i}}}table(n){var o;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=Kv(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
300
- `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.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<e.length;a++)s.header.push({text:e[a],tokens:this.lexer.inline(e[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(Kv(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 t=this.rules.block.lheading.exec(n);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(n){let t=this.rules.block.paragraph.exec(n);if(t){let e=t[1].charAt(t[1].length-1)===`
301
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(n){let t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){let t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(n){let t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(n){let t=this.rules.inline.link.exec(n);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let s=wo(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=RN(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r=r.slice(1):r=r.slice(1,-1)),Jv(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(n,t){let e;if((e=this.rules.inline.reflink.exec(n))||(e=this.rules.inline.nolink.exec(n))){let r=(e[2]||e[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return Jv(e,i,e[0],this.lexer,this.rules)}}emStrong(n,t,e=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&e.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!e||this.rules.inline.punctuation.exec(e))){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,t=t.slice(-1*n.length+i);(r=u.exec(t))!=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,f=n.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let y=f.slice(1,-1);return{type:"em",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}let v=f.slice(2,-2);return{type:"strong",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,e=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*n.length+i);(r=c.exec(t))!=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),f=h.slice(i,-i);return{type:"del",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(n){let t=this.rules.inline.autolink.exec(n);if(t){let e,r;return t[2]==="@"?(e=t[1],r="mailto:"+e):(e=t[1],r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(n){var e;let t;if(t=this.rules.inline.url.exec(n)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let s;do s=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let t=this.rules.inline.text.exec(n);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Vt=class Yd{constructor(t){g(this,"tokens");g(this,"options");g(this,"state");g(this,"inlineQueue");g(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ii,this.options.tokenizer=this.options.tokenizer||new Lc,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 e={other:tt,block:Bl.normal,inline:bo.normal};this.options.pedantic?(e.block=Bl.pedantic,e.inline=bo.pedantic):this.options.gfm&&(e.block=Bl.gfm,this.options.breaks?e.inline=bo.breaks:e.inline=bo.gfm),this.tokenizer.rules=e}static get rules(){return{block:Bl,inline:bo}}static lex(t,e){return new Yd(e).lex(t)}static lexInline(t,e){return new Yd(e).inlineTokens(t)}lex(t){t=t.replace(tt.carriageReturn,`
299
+ `,n=n.substring(G.length+1),y=he.slice(C)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(c=!0)),o.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),o.raw+=f}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,""),((e=h.tokens[0])==null?void 0:e.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 f=this.rules.other.listTaskCheckbox.exec(h.raw);if(f){let v={type:"checkbox",raw:f[0]+" ",checked:f[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 f=h.tokens.filter(y=>y.type==="space"),v=f.length>0&&f.some(y=>this.rules.other.anyLine.test(y.raw));o.loose=v}}if(o.loose)for(let h of o.items){h.loose=!0;for(let f of h.tokens)f.type==="text"&&(f.type="paragraph")}return o}}html(n){let t=this.rules.block.html.exec(n);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(n){let t=this.rules.block.def.exec(n);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:i}}}table(n){var o;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=qv(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
300
+ `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.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<e.length;a++)s.header.push({text:e[a],tokens:this.lexer.inline(e[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(qv(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 t=this.rules.block.lheading.exec(n);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(n){let t=this.rules.block.paragraph.exec(n);if(t){let e=t[1].charAt(t[1].length-1)===`
301
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(n){let t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){let t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(n){let t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(n){let t=this.rules.inline.link.exec(n);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let s=wo(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=CN(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r=r.slice(1):r=r.slice(1,-1)),Yv(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(n,t){let e;if((e=this.rules.inline.reflink.exec(n))||(e=this.rules.inline.nolink.exec(n))){let r=(e[2]||e[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return Yv(e,i,e[0],this.lexer,this.rules)}}emStrong(n,t,e=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&e.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!e||this.rules.inline.punctuation.exec(e))){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,t=t.slice(-1*n.length+i);(r=u.exec(t))!=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,f=n.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let y=f.slice(1,-1);return{type:"em",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}let v=f.slice(2,-2);return{type:"strong",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,e=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*n.length+i);(r=c.exec(t))!=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),f=h.slice(i,-i);return{type:"del",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(n){let t=this.rules.inline.autolink.exec(n);if(t){let e,r;return t[2]==="@"?(e=t[1],r="mailto:"+e):(e=t[1],r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(n){var e;let t;if(t=this.rules.inline.url.exec(n)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let s;do s=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let t=this.rules.inline.text.exec(n);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Vt=class qd{constructor(t){g(this,"tokens");g(this,"options");g(this,"state");g(this,"inlineQueue");g(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ii,this.options.tokenizer=this.options.tokenizer||new Lc,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 e={other:tt,block:Bl.normal,inline:bo.normal};this.options.pedantic?(e.block=Bl.pedantic,e.inline=bo.pedantic):this.options.gfm&&(e.block=Bl.gfm,this.options.breaks?e.inline=bo.breaks:e.inline=bo.gfm),this.tokenizer.rules=e}static get rules(){return{block:Bl,inline:bo}}static lex(t,e){return new qd(e).lex(t)}static lexInline(t,e){return new qd(e).inlineTokens(t)}lex(t){t=t.replace(tt.carriageReturn,`
302
302
  `),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let r=this.inlineQueue[e];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],r=!1){var i,s,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(tt.tabCharGlobal," ").replace(tt.spaceLine,""));t;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(a=u.call({lexer:this},t,e))?(t=t.substring(a.raw.length),e.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let u=e.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
303
303
  `:e.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
304
304
  `)?"":`
@@ -330,26 +330,26 @@ ${this.parser.parse(n)}</blockquote>
330
330
  `}tablerow({text:n}){return`<tr>
331
331
  ${n}</tr>
332
332
  `}tablecell(n){let t=this.parser.parseInline(n.tokens),e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
333
- `}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>${Qt(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:t,tokens:e}){let r=this.parser.parseInline(e),i=Yv(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+Qt(t)+'"'),s+=">"+r+"</a>",s}image({href:n,title:t,text:e,tokens:r}){r&&(e=this.parser.parseInline(r,this.parser.textRenderer));let i=Yv(n);if(i===null)return Qt(e);n=i;let s=`<img src="${n}" alt="${Qt(e)}"`;return t&&(s+=` title="${Qt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Qt(n.text)}},Rf=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}},Zt=class Kd{constructor(t){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=t||Ii,this.options.renderer=this.options.renderer||new Dc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rf}static parse(t,e){return new Kd(e).parse(t)}static parseInline(t,e){return new Kd(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let s=0;s<t.length;s++){let o=t[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)){e+=u||"";continue}}let a=o;switch(a.type){case"space":{e+=this.renderer.space(a);break}case"hr":{e+=this.renderer.hr(a);break}case"heading":{e+=this.renderer.heading(a);break}case"code":{e+=this.renderer.code(a);break}case"table":{e+=this.renderer.table(a);break}case"blockquote":{e+=this.renderer.blockquote(a);break}case"list":{e+=this.renderer.list(a);break}case"checkbox":{e+=this.renderer.checkbox(a);break}case"html":{e+=this.renderer.html(a);break}case"def":{e+=this.renderer.def(a);break}case"paragraph":{e+=this.renderer.paragraph(a);break}case"text":{e+=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 e}parseInline(t,e=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<t.length;o++){let a=t[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+=e.text(c);break}case"html":{r+=e.html(c);break}case"link":{r+=e.link(c);break}case"image":{r+=e.image(c);break}case"checkbox":{r+=e.checkbox(c);break}case"strong":{r+=e.strong(c);break}case"em":{r+=e.em(c);break}case"codespan":{r+=e.codespan(c);break}case"br":{r+=e.br(c);break}case"del":{r+=e.del(c);break}case"text":{r+=e.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}},jl,Io=(jl=class{constructor(n){g(this,"options");g(this,"block");this.options=n||Ii}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?Zt.parse:Zt.parseInline}},g(jl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),g(jl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),jl),DN=class{constructor(...n){g(this,"defaults",kf());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",Zt);g(this,"Renderer",Dc);g(this,"TextRenderer",Rf);g(this,"Lexer",Vt);g(this,"Tokenizer",Lc);g(this,"Hooks",Io);this.use(...n)}walkTokens(n,t){var r,i;let e=[];for(let s of n)switch(e=e.concat(t.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)e=e.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let c of a)e=e.concat(this.walkTokens(c.tokens,t));break}case"list":{let o=s;e=e.concat(this.walkTokens(o.items,t));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);e=e.concat(this.walkTokens(c,t))}):o.tokens&&(e=e.concat(this.walkTokens(o.tokens,t)))}}return e}use(...n){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:t.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=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),e.renderer){let i=this.defaults.renderer||new Dc(this.defaults);for(let s in e.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=e.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(e.tokenizer){let i=this.defaults.tokenizer||new Lc(this.defaults);for(let s in e.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=e.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(e.hooks){let i=this.defaults.hooks||new Io;for(let s in e.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=e.hooks[o],c=i[o];Io.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Io.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await a.call(i,u);return c.call(i,f)})();let h=a.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(i,u);return f===!1&&(f=await c.apply(i,u)),f})();let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,s=e.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,t){return Vt.lex(n,t??this.defaults)}parser(n,t){return Zt.parse(n,t??this.defaults)}parseMarkdown(n){return(t,e)=>{let r={...e},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 t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", 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(t):t,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?Zt.parse:Zt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():n?Vt.lex:Vt.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?Zt.parse:Zt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,t){return e=>{if(e.message+=`
334
- Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Qt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},_i=new DN;function se(n,t){return _i.parse(n,t)}se.options=se.setOptions=function(n){return _i.setOptions(n),se.defaults=_i.defaults,MS(se.defaults),se};se.getDefaults=kf;se.defaults=Ii;se.use=function(...n){return _i.use(...n),se.defaults=_i.defaults,MS(se.defaults),se};se.walkTokens=function(n,t){return _i.walkTokens(n,t)};se.parseInline=_i.parseInline;se.Parser=Zt;se.parser=Zt.parse;se.Renderer=Dc;se.TextRenderer=Rf;se.Lexer=Vt;se.lexer=Vt.lex;se.Tokenizer=Lc;se.Hooks=Io;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;Zt.parse;Vt.lex;DS.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function Pf(n){const t=se.parse(n,{async:!1});return DS.sanitize(t,{USE_PROFILES:{html:!0}})}const MN=`
333
+ `}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>${Qt(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:t,tokens:e}){let r=this.parser.parseInline(e),i=Gv(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+Qt(t)+'"'),s+=">"+r+"</a>",s}image({href:n,title:t,text:e,tokens:r}){r&&(e=this.parser.parseInline(r,this.parser.textRenderer));let i=Gv(n);if(i===null)return Qt(e);n=i;let s=`<img src="${n}" alt="${Qt(e)}"`;return t&&(s+=` title="${Qt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Qt(n.text)}},If=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}},Zt=class Yd{constructor(t){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=t||Ii,this.options.renderer=this.options.renderer||new Dc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new If}static parse(t,e){return new Yd(e).parse(t)}static parseInline(t,e){return new Yd(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let s=0;s<t.length;s++){let o=t[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)){e+=u||"";continue}}let a=o;switch(a.type){case"space":{e+=this.renderer.space(a);break}case"hr":{e+=this.renderer.hr(a);break}case"heading":{e+=this.renderer.heading(a);break}case"code":{e+=this.renderer.code(a);break}case"table":{e+=this.renderer.table(a);break}case"blockquote":{e+=this.renderer.blockquote(a);break}case"list":{e+=this.renderer.list(a);break}case"checkbox":{e+=this.renderer.checkbox(a);break}case"html":{e+=this.renderer.html(a);break}case"def":{e+=this.renderer.def(a);break}case"paragraph":{e+=this.renderer.paragraph(a);break}case"text":{e+=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 e}parseInline(t,e=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<t.length;o++){let a=t[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+=e.text(c);break}case"html":{r+=e.html(c);break}case"link":{r+=e.link(c);break}case"image":{r+=e.image(c);break}case"checkbox":{r+=e.checkbox(c);break}case"strong":{r+=e.strong(c);break}case"em":{r+=e.em(c);break}case"codespan":{r+=e.codespan(c);break}case"br":{r+=e.br(c);break}case"del":{r+=e.del(c);break}case"text":{r+=e.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}},jl,Io=(jl=class{constructor(n){g(this,"options");g(this,"block");this.options=n||Ii}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?Zt.parse:Zt.parseInline}},g(jl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),g(jl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),jl),PN=class{constructor(...n){g(this,"defaults",_f());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",Zt);g(this,"Renderer",Dc);g(this,"TextRenderer",If);g(this,"Lexer",Vt);g(this,"Tokenizer",Lc);g(this,"Hooks",Io);this.use(...n)}walkTokens(n,t){var r,i;let e=[];for(let s of n)switch(e=e.concat(t.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)e=e.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let c of a)e=e.concat(this.walkTokens(c.tokens,t));break}case"list":{let o=s;e=e.concat(this.walkTokens(o.items,t));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);e=e.concat(this.walkTokens(c,t))}):o.tokens&&(e=e.concat(this.walkTokens(o.tokens,t)))}}return e}use(...n){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:t.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=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),e.renderer){let i=this.defaults.renderer||new Dc(this.defaults);for(let s in e.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=e.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(e.tokenizer){let i=this.defaults.tokenizer||new Lc(this.defaults);for(let s in e.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=e.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(e.hooks){let i=this.defaults.hooks||new Io;for(let s in e.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=e.hooks[o],c=i[o];Io.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Io.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await a.call(i,u);return c.call(i,f)})();let h=a.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(i,u);return f===!1&&(f=await c.apply(i,u)),f})();let h=a.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,s=e.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,t){return Vt.lex(n,t??this.defaults)}parser(n,t){return Zt.parse(n,t??this.defaults)}parseMarkdown(n){return(t,e)=>{let r={...e},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 t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", 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(t):t,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?Zt.parse:Zt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():n?Vt.lex:Vt.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?Zt.parse:Zt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,t){return e=>{if(e.message+=`
334
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Qt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},_i=new PN;function se(n,t){return _i.parse(n,t)}se.options=se.setOptions=function(n){return _i.setOptions(n),se.defaults=_i.defaults,LS(se.defaults),se};se.getDefaults=_f;se.defaults=Ii;se.use=function(...n){return _i.use(...n),se.defaults=_i.defaults,LS(se.defaults),se};se.walkTokens=function(n,t){return _i.walkTokens(n,t)};se.parseInline=_i.parseInline;se.Parser=Zt;se.parser=Zt.parse;se.Renderer=Dc;se.TextRenderer=If;se.Lexer=Vt;se.lexer=Vt.lex;se.Tokenizer=Lc;se.Hooks=Io;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;Zt.parse;Vt.lex;PS.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function Rf(n){const t=se.parse(n,{async:!1});return PS.sanitize(t,{USE_PROFILES:{html:!0}})}const LN=`
335
335
  <modal-overlay open>
336
336
  <system-modal material="paper" tone="dark" level="1" size="lg">
337
337
  <div class="prose upgrade-gate-body" data-testid="upgrade-gate-body"></div>
338
338
  </system-modal>
339
339
  </modal-overlay>
340
- `;var _s,Ua,Ai,Jd,WS;class zN extends HTMLElement{constructor(){super(...arguments);b(this,Ai);b(this,_s,null);b(this,Ua,null)}get instructions(){return l(this,_s)}set instructions(e){m(this,_s,e),this.isConnected&&d(this,Ai,Jd).call(this)}connectedCallback(){d(this,Ai,Jd).call(this)}}_s=new WeakMap,Ua=new WeakMap,Ai=new WeakSet,Jd=function(){this.firstElementChild===null&&(this.innerHTML=MN),d(this,Ai,WS).call(this)},WS=function(){const e=this.querySelector('[data-testid="upgrade-gate-body"]');if(e===null)return;const r=Yw(l(this,_s));l(this,Ua)===r&&e.innerHTML.length>0||(e.innerHTML=Pf(r),m(this,Ua,r))};customElements.get("desktop-upgrade-gate")||customElements.define("desktop-upgrade-gate",zN);function ON(n){const t=n.reload??(()=>location.reload()),e=n.navigationLatch??yf();let r=null,i=!1,s=null;const o=new Set,a=v=>{var y;return AO({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:v.requiredDesktopVersion,desktop:((y=v.update)==null?void 0:y.desktop)??null})};function c(v){var E;const y=n.mountTarget??document.body;s===null&&(s=document.createElement("desktop-upgrade-gate"),y.appendChild(s)),s.instructions=((E=v.update)==null?void 0:E.desktop)??null}function u(){var v;(v=n.presentation)==null||v.suppressToasts()}function h(v){var E;const y=v.requiredDesktopVersion;y===null||o.has(y)||(o.add(y),(E=r==null?void 0:r.servers.get(n.primaryServerURL))==null||E.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:y}))}const f=v=>{e.pending||v.serverURL===n.primaryServerURL&&(a(v.message).gated?(i=!0,c(v.message),u(),h(v.message)):i&&e.begin(t))};return{get gated(){return i},decideBoot(v){return a(v).gated?"halt":"boot"},attach(v){r=v,v.addEventListener("server-status",f)},dispose(){r==null||r.removeEventListener("server-status",f),r=null}}}var ks;class NN extends It{constructor(){super(...arguments);b(this,ks,!1)}get toastsSuppressed(){return l(this,ks)}suppressToasts(){l(this,ks)||(m(this,ks,!0),this.dispatchEvent(new ie("change")))}}ks=new WeakMap;let jn=null;async function jS(n,t){if(jn==null||jn.abort(),n===null){jn=null,_c();return}const e=new AbortController;jn=e;try{const r=t.token?{Authorization:`Bearer ${t.token}`}:void 0,i=new URL(`/themes/${n}/theme.css`,t.url).toString(),s=await fetch(i,{signal:e.signal,...r?{headers:r}:{}});if(!s.ok)throw new Error(`Theme fetch failed: ${s.status}`);const o=await s.text();if(jn!==e)return;Rb(o)}catch(r){if(r.name==="AbortError")return;_c();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{jn===e&&(jn=null)}}const GS=Fe(),qS="No handler registered for update-content",YS="handleUpdateContent: handler already registered",Xv="television-artifact-bridge";function KS(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const JS=gl(It);var Es,xs,As,ni,ri,Fa,je,Xd,XS,QS,Ro,Qd,Ey;let UN=(Ey=class extends JS{constructor(e){super();b(this,je);b(this,Es);b(this,xs);b(this,As);b(this,ni,null);b(this,ri,null);b(this,Fa,!1);m(this,Es,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");m(this,xs,r),m(this,As,i=>d(this,je,XS).call(this,i)),l(this,xs).addEventListener("message",l(this,As))}get content(){return l(this,ri)}set content(e){d(this,je,Qd).call(this),m(this,ri,e),l(this,Fa)&&d(this,je,Xd).call(this,e)}handleUpdateContent(e){if(d(this,je,Qd).call(this),l(this,ni)!==null)throw new Error(YS);m(this,ni,e)}dispose(){l(this,xs).removeEventListener("message",l(this,As)),m(this,ni,null)}},Es=new WeakMap,xs=new WeakMap,As=new WeakMap,ni=new WeakMap,ri=new WeakMap,Fa=new WeakMap,je=new WeakSet,Xd=function(e){const r={type:"content-updated",content:e};d(this,je,Ro).call(this,r)},XS=function(e){if(this.disposed||e.source!==l(this,Es).contentWindow)return;const r=e.data;if(Z0(r)){m(this,Fa,!0),this.dispatchEvent(new GS("ready")),l(this,ri)!==null&&d(this,je,Xd).call(this,l(this,ri));return}if(B0(r)){d(this,je,QS).call(this,r);return}},QS=async function(e){const r=l(this,ni);if(r===null){d(this,je,Ro).call(this,{type:"response",id:e.id,error:{message:qS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;d(this,je,Ro).call(this,{type:"response",id:e.id,error:{message:KS(i)}});return}this.disposed||d(this,je,Ro).call(this,{type:"response",id:e.id,result:{}})},Ro=function(e){const r=l(this,Es).contentWindow;r&&r.postMessage(e,"*")},Qd=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Ey);var ii,Ts,si,oi,Ha,Ge,ep,e_,t_,Po,tp;class FN extends JS{constructor(e){super();b(this,Ge);b(this,ii);b(this,Ts);b(this,si,null);b(this,oi,null);b(this,Ha,!1);m(this,ii,e),m(this,Ts,r=>d(this,Ge,e_).call(this,r)),l(this,ii).addEventListener("ipc-message",l(this,Ts))}get content(){return l(this,oi)}set content(e){d(this,Ge,tp).call(this),m(this,oi,e),l(this,Ha)&&d(this,Ge,ep).call(this,e)}handleUpdateContent(e){if(d(this,Ge,tp).call(this),l(this,si)!==null)throw new Error(YS);m(this,si,e)}dispose(){l(this,ii).removeEventListener("ipc-message",l(this,Ts)),m(this,si,null)}}ii=new WeakMap,Ts=new WeakMap,si=new WeakMap,oi=new WeakMap,Ha=new WeakMap,Ge=new WeakSet,ep=function(e){const r={type:"content-updated",content:e};d(this,Ge,Po).call(this,r)},e_=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==Xv)return;const i=(s=r.args)==null?void 0:s[0];if(Z0(i)){m(this,Ha,!0),this.dispatchEvent(new GS("ready")),l(this,oi)!==null&&d(this,Ge,ep).call(this,l(this,oi));return}if(B0(i)){d(this,Ge,t_).call(this,i);return}},t_=async function(e){const r=l(this,si);if(r===null){d(this,Ge,Po).call(this,{type:"response",id:e.id,error:{message:qS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;d(this,Ge,Po).call(this,{type:"response",id:e.id,error:{message:KS(i)}});return}this.disposed||d(this,Ge,Po).call(this,{type:"response",id:e.id,result:{}})},Po=function(e){var r,i;(i=(r=l(this,ii)).send)==null||i.call(r,Xv,e)},tp=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};const Qv="television-artifact-bridge",ey="/views/url-unsupported/",HN=404,n_=Fe(),VN=Fe(),ZN=Fe();class BN extends HTMLElement{constructor(){super(...arguments);g(this,"_artifact",null);g(this,"_viewURL",null);g(this,"_contentURL",null);g(this,"_screen",null);g(this,"_standaloneScroll",!1);g(this,"_subscribedWebview",null);g(this,"_embedLoadFrame",null);g(this,"_embedLoadKey",null);g(this,"_bridgePending",!0);g(this,"_bridgeCurrentGuid",null);g(this,"_bridgeLifecycleWindow",null);g(this,"_activeReloadFrameSrc",null);g(this,"_markdownFrame",null);g(this,"_markdownHost",null);g(this,"_markdownContentURL",null);g(this,"_markdownArtifactID",null);g(this,"_markdownContent",null);g(this,"_markdownFetchedArtifactID",null);g(this,"_markdownFetchedScreen",null);g(this,"_screenSubscriptionsAttached",!1);g(this,"_proxyReloadVersion",0);g(this,"_navigationState",null);g(this,"_navigationArtifactId",null);g(this,"_navigationCanonicalURL",null);g(this,"_preserveFrameSrcOnNavigationRender",!1);g(this,"_missingArtifactID",null);g(this,"handleIframeMessage",e=>{var u,h;const r=this.querySelector("iframe.artifact-frame");if(!r)return;const i=ag(e.data),s=Wu(e.data)&&e.data.native===!0&&e.data.sameDocument!==!0,o=r.contentWindow===e.source,a=(i||s)&&this._bridgeLifecycleWindow!==null&&this._bridgeLifecycleWindow===e.source,c=i&&this.isArtifactFrameMessageOrigin(r,e.origin);if(!(!o&&!a&&!c)){if(lg(e.data)){this.handleBridgeReady(e.data,r);return}if(i){this.handleBridgeLeaving(e.data.guid);return}if(cg(e.data)){this.dispatchArtifactWheel({deltaX:e.data.deltaX,shiftKey:e.data.shiftKey});return}if(ug(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),this.dispatchArtifactFilmstripKey(e.data.direction);return}if(nk(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),(u=r.contentWindow)==null||u.postMessage({type:rk,url:this.currentExternalTargetURL()},"*");return}if(hg(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),(h=r.contentWindow)==null||h.postMessage(this.currentMissingArtifactMessage(),"*");return}if(dg(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),this.handleProxyContentChanged();return}if(Wu(e.data)){const f=e.data.native===!0&&e.data.sameDocument!==!0;this.handleNavigationRequest(e.data),f||this.markLegacyBridgeProofOfLife(e.data,r);return}}});g(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;r&&this.closeBridgeGate({render:!1}),this.render({preserveFrameSrc:e}),this._preserveFrameSrcOnNavigationRender=!1,r&&window.setTimeout(()=>this.forceCurrentFrameSrc(),0)});g(this,"handleArtifactContentChanged",e=>{var i;if(e.artifactID===((i=this._artifact)==null?void 0:i.id)){if(this._markdownHost&&this._markdownContentURL||this.isCurrentMarkdownMissing()){this.fetchMarkdownContent();return}this.reloadProxyFrame()}});g(this,"handleThemeChanged",()=>{var e;((e=this._artifact)==null?void 0:e.kind)==="url"&&xn(this._artifact.url)||this.reloadProxyFrame()});g(this,"handleWebviewIpcMessage",e=>{var o,a;const r=e.detail??e;if(!r||r.channel!==Qv)return;const i=(o=r.args)==null?void 0:o[0];if(!i)return;const s=this._subscribedWebview;if(s){if(lg(i)){this.handleBridgeReady(i,s);return}if(ag(i)){this.handleBridgeLeaving(i.guid);return}if(hg(i)){this.markLegacyBridgeProofOfLife(i,s);const c=this.currentMissingArtifactMessage();c&&((a=s.send)==null||a.call(s,Qv,c));return}if(Wu(i)){this.handleNavigationRequest(i);return}if(cg(i)){this.markLegacyBridgeProofOfLife(i,s),this.dispatchArtifactWheel({deltaX:i.deltaX,shiftKey:i.shiftKey});return}if(ug(i)){this.markLegacyBridgeProofOfLife(i,s),this.dispatchArtifactFilmstripKey(i.direction);return}dg(i)&&(this.markLegacyBridgeProofOfLife(i,s),this.handleProxyContentChanged())}});g(this,"handleWebviewDidStartNavigation",e=>{const r=e.detail??e;r.isMainFrame===!0&&r.isInPlace!==!0&&this.closeBridgeGate()});g(this,"handleWebviewDidFailLoad",e=>{(e.detail??e).isMainFrame!==!1&&this.closeBridgeGate()});g(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});g(this,"handleWebviewDidNavigateInPage",e=>{this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(e)||(this._preserveFrameSrcOnNavigationRender=!1)});g(this,"handleEmbedLoad",()=>{const e=this.querySelector(".artifact-frame");!e||e!==this._embedLoadFrame||this.setAttribute("data-embed-loaded","")})}set artifact(e){const r=this._artifact,i=r?!WN(r,e):!0;((r==null?void 0:r.id)!==e.id||r.kind==="path"&&e.kind==="path"&&r.path!==e.path)&&(this._missingArtifactID=null),i&&(this._bridgePending=!0,this._bridgeCurrentGuid=null,this._bridgeLifecycleWindow=null,this._activeReloadFrameSrc=null,this._markdownContent=null,this._markdownHost&&(this._markdownHost.content=""),this._markdownFetchedArtifactID=null,this._markdownFetchedScreen=null),this._artifact=e,this.syncNavigationState(),this.render(),this.syncWebviewSubscription()}get artifact(){return this._artifact}set viewURL(e){this._viewURL=e,this.syncNavigationState(),this.render(),this.syncWebviewSubscription()}get viewURL(){return this._viewURL}set contentURL(e){this._contentURL=e,this.render()}get contentURL(){return this._contentURL}set screen(e){this._screen!==e&&(this.detachScreenSubscriptions(),this._screen=e,this.attachScreenSubscriptions(),this.syncMarkdownHost())}get screen(){return this._screen}attachScreenSubscriptions(){!this._screen||this._screenSubscriptionsAttached||(this._screen.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._screen.addEventListener("theme-changed",this.handleThemeChanged),this._screenSubscriptionsAttached=!0)}detachScreenSubscriptions(){!this._screen||!this._screenSubscriptionsAttached||(this._screen.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._screen.removeEventListener("theme-changed",this.handleThemeChanged),this._screenSubscriptionsAttached=!1)}get activeView(){return null}set standaloneScroll(e){this._standaloneScroll=e}get standaloneScroll(){return this._standaloneScroll}connectedCallback(){this.setAttribute("level","2"),window.addEventListener("message",this.handleIframeMessage),this.attachScreenSubscriptions(),this.rearmArtifactFrameOnConnect(),this.render(),this.syncWebviewSubscription(),this.syncNavigationState()}disconnectedCallback(){window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview(),this.unsubscribeFromEmbedLoad(),this.syncNavigationState(),this.detachScreenSubscriptions(),this.disposeMarkdownHost()}handleClose(){this._artifact&&this.dispatchEvent(new n_("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}currentExternalTargetURL(){var r,i;const e=((r=this._navigationState)==null?void 0:r.currentURL)??null;return e&&Nh(e)?e:((i=this._artifact)==null?void 0:i.kind)==="url"?this._artifact.url:null}currentMissingArtifactMessage(){const e=this._artifact;return(e==null?void 0:e.kind)!=="path"?null:{type:ik,title:e.title,path:e.path}}handleBridgeReady(e,r=this.querySelector(".artifact-frame")){if(this.isArtifactFrame(r)){if(typeof e.guid=="string"){(e.guid!==this._bridgeCurrentGuid||this._bridgePending)&&(this._bridgeCurrentGuid=e.guid,this._bridgeLifecycleWindow=r.tagName.toLowerCase()==="iframe"?r.contentWindow:null,this._bridgePending=!1,this.render({preserveFrameSrc:!0}));return}this.markLegacyBridgeProofOfLife(e,r)}}handleBridgeLeaving(e){e===this._bridgeCurrentGuid&&this.closeBridgeGate()}markLegacyBridgeProofOfLife(e,r=this.querySelector(".artifact-frame")){this.isArtifactFrame(r)&&(!this._bridgePending||jN(e)||(this._bridgePending=!1,this.render({preserveFrameSrc:!0})))}closeBridgeGate(e={}){const r=!this._bridgePending||this._bridgeCurrentGuid!==null;this._bridgePending=!0,this._bridgeCurrentGuid=null,this._bridgeLifecycleWindow=null,r&&e.render!==!1&&this.render({preserveFrameSrc:!0})}isArtifactFrame(e){if(!e)return!1;const r=e.tagName.toLowerCase();return r==="iframe"||r==="webview"}isArtifactFrameMessageOrigin(e,r){try{return new URL(e.getAttribute("src")??e.src,window.location.href).origin===r}catch{return!1}}shouldGateFrame(){return this._bridgePending}rearmArtifactFrameOnConnect(){const e=this.querySelector(".artifact-frame");this.isArtifactFrame(e)&&this.closeBridgeGate({render:!1})}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!xn(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===ey||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0),s&&e.sameDocument!==!0&&this.closeBridgeGate({render:!1}),e.replace?r.replace(i):r.navigate(i)}dispatchArtifactFilmstripKey(e){this._standaloneScroll||this.dispatchEvent(new ZN("artifact-filmstrip-key",{bubbles:!0,composed:!0,direction:e}))}dispatchArtifactWheel(e){this._standaloneScroll||this.dispatchEvent(new VN("artifact-wheel",{bubbles:!0,composed:!0,deltaX:e.deltaX,shiftKey:e.shiftKey}))}syncNavigationState(){if(!this.isConnected||!this._artifact){this.disposeNavigationState();return}const e=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===e||(this.disposeNavigationState(),this._navigationState=new gO(this._artifact.id,e),this._navigationArtifactId=this._artifact.id,this._navigationCanonicalURL=e,this._navigationState.addEventListener("change",this.handleNavigationChange),this._navigationState.currentURL!==null&&this.render())}disposeNavigationState(){var e;(e=this._navigationState)==null||e.removeEventListener("change",this.handleNavigationChange),this._navigationState=null,this._navigationArtifactId=null,this._navigationCanonicalURL=null,this._preserveFrameSrcOnNavigationRender=!1}canonicalURLForArtifact(e){const r=Tc(e,{electron:Wt()}),i=this._viewURL??r.viewURL;return e.kind==="url"&&xn(e.url)||r.renderer==="url-webview"?Fn(i):ty(i,i)}convertIframeNavigationURL(e){var i,s;if(((i=this._artifact)==null?void 0:i.kind)==="url"&&xn(this._artifact.url)&&xn(e))return Fn(e);const r=(s=this.querySelector(".artifact-frame"))==null?void 0:s.getAttribute("src");return ty(e,r??this._viewURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string")return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=Fn(r);return s===i.currentURL?!1:(i.navigate(s),!0)}viewURLForInternalNavigation(e){if(!e.startsWith("/")||!this._viewURL)return e;try{return new URL(e,this._viewURL).toString()}catch{return e}}syncWebviewSubscription(){const e=this.querySelector("webview");e!==this._subscribedWebview&&(this.unsubscribeFromWebview(),e&&(e.addEventListener("ipc-message",this.handleWebviewIpcMessage),e.addEventListener("did-start-navigation",this.handleWebviewDidStartNavigation),e.addEventListener("did-fail-load",this.handleWebviewDidFailLoad),e.addEventListener("did-navigate",this.handleWebviewDidNavigate),e.addEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=e))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview.removeEventListener("did-start-navigation",this.handleWebviewDidStartNavigation),this._subscribedWebview.removeEventListener("did-fail-load",this.handleWebviewDidFailLoad),this._subscribedWebview.removeEventListener("did-navigate",this.handleWebviewDidNavigate),this._subscribedWebview.removeEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=null)}syncEmbedLoadState(){var s;const e=this.querySelector(".artifact-frame"),r=e?`${e.tagName.toLowerCase()}:${e.getAttribute("src")??""}:${e.dataset.contentUrl??""}`:null;if(e&&e===this._embedLoadFrame&&r===this._embedLoadKey||(this.unsubscribeFromEmbedLoad(),this.removeAttribute("data-embed-loaded"),!e||!r))return;if(this._embedLoadFrame=e,this._embedLoadKey=r,e.tagName.toLowerCase()==="webview"){e.addEventListener("did-finish-load",this.handleEmbedLoad),e.addEventListener("did-fail-load",this.handleEmbedLoad);return}e.addEventListener("load",this.handleEmbedLoad);const i=e;try{((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&this.handleEmbedLoad()}catch{}}unsubscribeFromEmbedLoad(){if(!this._embedLoadFrame){this._embedLoadKey=null;return}this._embedLoadFrame.removeEventListener("load",this.handleEmbedLoad),this._embedLoadFrame.removeEventListener("did-finish-load",this.handleEmbedLoad),this._embedLoadFrame.removeEventListener("did-fail-load",this.handleEmbedLoad),this._embedLoadFrame=null,this._embedLoadKey=null}iframeTargetOrigin(e){const r=e.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=e.getAttribute("src")??e.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}syncMarkdownHost(){var s;const e=this.querySelector("[data-content-url]"),r=(e==null?void 0:e.dataset.contentUrl)??null,i=((s=this._artifact)==null?void 0:s.id)??null;if(!e||!r||!i){this.disposeMarkdownHost({clearContent:!0});return}if(e!==this._markdownFrame||i!==this._markdownArtifactID){this.disposeMarkdownHost(),this._markdownFrame=e,this._markdownContentURL=r,this._markdownArtifactID=i;const o=e.tagName.toLowerCase()==="webview"?new FN(e):new UN(e);this._markdownHost=o,o.handleUpdateContent(async a=>{const c=this._artifact,u=this._screen;if(!c||!u)throw new Error("No markdown artifact selected");await u.server.client.markdown.update({artifactID:c.id,content:a}),this._markdownContent=a,this._markdownHost===o&&(o.content=a)}),this._markdownContent!==null&&(o.content=this._markdownContent)}else this._markdownContentURL=r;this.ensureMarkdownContentFetched()}ensureMarkdownContentFetched(){const e=this._artifact,r=this._screen;!e||!r||!this._markdownHost||this._markdownFetchedArtifactID===e.id&&this._markdownFetchedScreen===r||(this._markdownFetchedArtifactID=e.id,this._markdownFetchedScreen=r,this.fetchMarkdownContent())}async fetchMarkdownContent(){var s,o;const e=this._artifact,r=this._screen;if(!e||!r)return;const i=e.id;try{const a=await r.server.client.markdown.get({artifactID:i});if(((s=this._artifact)==null?void 0:s.id)!==i||this._screen!==r)return;this._missingArtifactID=null,this._markdownContent=a;const c=this._markdownHost;if(!c){this.render();return}c.content=a}catch(a){if(((o=this._artifact)==null?void 0:o.id)!==i||this._screen!==r)return;if(a instanceof of&&a.status===HN){this._missingArtifactID=i,this._markdownContent=null,this.disposeMarkdownHost(),this.render();return}this._markdownFetchedArtifactID=null,this._markdownFetchedScreen=null}}isCurrentMarkdownMissing(){var e;return this._missingArtifactID===((e=this._artifact)==null?void 0:e.id)&&this._artifact.kind==="path"&&H0(this._artifact.path)}missingArtifactTemplate(e){return P`
340
+ `;var _s,Ua,Ai,Kd,ZS;class DN extends HTMLElement{constructor(){super(...arguments);b(this,Ai);b(this,_s,null);b(this,Ua,null)}get instructions(){return l(this,_s)}set instructions(e){m(this,_s,e),this.isConnected&&d(this,Ai,Kd).call(this)}connectedCallback(){d(this,Ai,Kd).call(this)}}_s=new WeakMap,Ua=new WeakMap,Ai=new WeakSet,Kd=function(){this.firstElementChild===null&&(this.innerHTML=LN),d(this,Ai,ZS).call(this)},ZS=function(){const e=this.querySelector('[data-testid="upgrade-gate-body"]');if(e===null)return;const r=Gw(l(this,_s));l(this,Ua)===r&&e.innerHTML.length>0||(e.innerHTML=Rf(r),m(this,Ua,r))};customElements.get("desktop-upgrade-gate")||customElements.define("desktop-upgrade-gate",DN);function MN(n){const t=n.reload??(()=>location.reload()),e=n.navigationLatch??vf();let r=null,i=!1,s=null;const o=new Set,a=v=>{var y;return EO({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:v.requiredDesktopVersion,desktop:((y=v.update)==null?void 0:y.desktop)??null})};function c(v){var E;const y=n.mountTarget??document.body;s===null&&(s=document.createElement("desktop-upgrade-gate"),y.appendChild(s)),s.instructions=((E=v.update)==null?void 0:E.desktop)??null}function u(){var v;(v=n.presentation)==null||v.suppressToasts()}function h(v){var E;const y=v.requiredDesktopVersion;y===null||o.has(y)||(o.add(y),(E=r==null?void 0:r.servers.get(n.primaryServerURL))==null||E.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:y}))}const f=v=>{e.pending||v.serverURL===n.primaryServerURL&&(a(v.message).gated?(i=!0,c(v.message),u(),h(v.message)):i&&e.begin(t))};return{get gated(){return i},decideBoot(v){return a(v).gated?"halt":"boot"},attach(v){r=v,v.addEventListener("server-status",f)},dispose(){r==null||r.removeEventListener("server-status",f),r=null}}}var ks;class zN extends It{constructor(){super(...arguments);b(this,ks,!1)}get toastsSuppressed(){return l(this,ks)}suppressToasts(){l(this,ks)||(m(this,ks,!0),this.dispatchEvent(new ie("change")))}}ks=new WeakMap;let jn=null;async function BS(n,t){if(jn==null||jn.abort(),n===null){jn=null,_c();return}const e=new AbortController;jn=e;try{const r=t.token?{Authorization:`Bearer ${t.token}`}:void 0,i=new URL(`/themes/${n}/theme.css`,t.url).toString(),s=await fetch(i,{signal:e.signal,...r?{headers:r}:{}});if(!s.ok)throw new Error(`Theme fetch failed: ${s.status}`);const o=await s.text();if(jn!==e)return;Cb(o)}catch(r){if(r.name==="AbortError")return;_c();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{jn===e&&(jn=null)}}const WS=Fe(),jS="No handler registered for update-content",GS="handleUpdateContent: handler already registered",Kv="television-artifact-bridge";function qS(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const YS=gl(It);var Es,xs,As,ni,ri,Fa,je,Jd,KS,JS,Ro,Xd,_y;let ON=(_y=class extends YS{constructor(e){super();b(this,je);b(this,Es);b(this,xs);b(this,As);b(this,ni,null);b(this,ri,null);b(this,Fa,!1);m(this,Es,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");m(this,xs,r),m(this,As,i=>d(this,je,KS).call(this,i)),l(this,xs).addEventListener("message",l(this,As))}get content(){return l(this,ri)}set content(e){d(this,je,Xd).call(this),m(this,ri,e),l(this,Fa)&&d(this,je,Jd).call(this,e)}handleUpdateContent(e){if(d(this,je,Xd).call(this),l(this,ni)!==null)throw new Error(GS);m(this,ni,e)}dispose(){l(this,xs).removeEventListener("message",l(this,As)),m(this,ni,null)}},Es=new WeakMap,xs=new WeakMap,As=new WeakMap,ni=new WeakMap,ri=new WeakMap,Fa=new WeakMap,je=new WeakSet,Jd=function(e){const r={type:"content-updated",content:e};d(this,je,Ro).call(this,r)},KS=function(e){if(this.disposed||e.source!==l(this,Es).contentWindow)return;const r=e.data;if(H0(r)){m(this,Fa,!0),this.dispatchEvent(new WS("ready")),l(this,ri)!==null&&d(this,je,Jd).call(this,l(this,ri));return}if(V0(r)){d(this,je,JS).call(this,r);return}},JS=async function(e){const r=l(this,ni);if(r===null){d(this,je,Ro).call(this,{type:"response",id:e.id,error:{message:jS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;d(this,je,Ro).call(this,{type:"response",id:e.id,error:{message:qS(i)}});return}this.disposed||d(this,je,Ro).call(this,{type:"response",id:e.id,result:{}})},Ro=function(e){const r=l(this,Es).contentWindow;r&&r.postMessage(e,"*")},Xd=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},_y);var ii,Ts,si,oi,Ha,Ge,Qd,XS,QS,Po,ep;class NN extends YS{constructor(e){super();b(this,Ge);b(this,ii);b(this,Ts);b(this,si,null);b(this,oi,null);b(this,Ha,!1);m(this,ii,e),m(this,Ts,r=>d(this,Ge,XS).call(this,r)),l(this,ii).addEventListener("ipc-message",l(this,Ts))}get content(){return l(this,oi)}set content(e){d(this,Ge,ep).call(this),m(this,oi,e),l(this,Ha)&&d(this,Ge,Qd).call(this,e)}handleUpdateContent(e){if(d(this,Ge,ep).call(this),l(this,si)!==null)throw new Error(GS);m(this,si,e)}dispose(){l(this,ii).removeEventListener("ipc-message",l(this,Ts)),m(this,si,null)}}ii=new WeakMap,Ts=new WeakMap,si=new WeakMap,oi=new WeakMap,Ha=new WeakMap,Ge=new WeakSet,Qd=function(e){const r={type:"content-updated",content:e};d(this,Ge,Po).call(this,r)},XS=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==Kv)return;const i=(s=r.args)==null?void 0:s[0];if(H0(i)){m(this,Ha,!0),this.dispatchEvent(new WS("ready")),l(this,oi)!==null&&d(this,Ge,Qd).call(this,l(this,oi));return}if(V0(i)){d(this,Ge,QS).call(this,i);return}},QS=async function(e){const r=l(this,si);if(r===null){d(this,Ge,Po).call(this,{type:"response",id:e.id,error:{message:jS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;d(this,Ge,Po).call(this,{type:"response",id:e.id,error:{message:qS(i)}});return}this.disposed||d(this,Ge,Po).call(this,{type:"response",id:e.id,result:{}})},Po=function(e){var r,i;(i=(r=l(this,ii)).send)==null||i.call(r,Kv,e)},ep=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};const Jv="television-artifact-bridge",Xv="/views/url-unsupported/",UN=404,e_=Fe(),FN=Fe(),HN=Fe();class VN extends HTMLElement{constructor(){super(...arguments);g(this,"_artifact",null);g(this,"_viewURL",null);g(this,"_contentURL",null);g(this,"_screen",null);g(this,"_standaloneScroll",!1);g(this,"_subscribedWebview",null);g(this,"_embedLoadFrame",null);g(this,"_embedLoadKey",null);g(this,"_bridgePending",!0);g(this,"_bridgeCurrentGuid",null);g(this,"_bridgeLifecycleWindow",null);g(this,"_activeReloadFrameSrc",null);g(this,"_markdownFrame",null);g(this,"_markdownHost",null);g(this,"_markdownContentURL",null);g(this,"_markdownArtifactID",null);g(this,"_markdownContent",null);g(this,"_markdownFetchedArtifactID",null);g(this,"_markdownFetchedScreen",null);g(this,"_screenSubscriptionsAttached",!1);g(this,"_proxyReloadVersion",0);g(this,"_navigationState",null);g(this,"_navigationArtifactId",null);g(this,"_navigationCanonicalURL",null);g(this,"_preserveFrameSrcOnNavigationRender",!1);g(this,"_missingArtifactID",null);g(this,"handleIframeMessage",e=>{var u,h;const r=this.querySelector("iframe.artifact-frame");if(!r)return;const i=og(e.data),s=Wu(e.data)&&e.data.native===!0&&e.data.sameDocument!==!0,o=r.contentWindow===e.source,a=(i||s)&&this._bridgeLifecycleWindow!==null&&this._bridgeLifecycleWindow===e.source,c=i&&this.isArtifactFrameMessageOrigin(r,e.origin);if(!(!o&&!a&&!c)){if(ag(e.data)){this.handleBridgeReady(e.data,r);return}if(i){this.handleBridgeLeaving(e.data.guid);return}if(lg(e.data)){this.dispatchArtifactWheel({deltaX:e.data.deltaX,shiftKey:e.data.shiftKey});return}if(cg(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),this.dispatchArtifactFilmstripKey(e.data.direction);return}if(ek(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),(u=r.contentWindow)==null||u.postMessage({type:tk,url:this.currentExternalTargetURL()},"*");return}if(ug(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),(h=r.contentWindow)==null||h.postMessage(this.currentMissingArtifactMessage(),"*");return}if(hg(e.data)){this.markLegacyBridgeProofOfLife(e.data,r),this.handleProxyContentChanged();return}if(Wu(e.data)){const f=e.data.native===!0&&e.data.sameDocument!==!0;this.handleNavigationRequest(e.data),f||this.markLegacyBridgeProofOfLife(e.data,r);return}}});g(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;r&&this.closeBridgeGate({render:!1}),this.render({preserveFrameSrc:e}),this._preserveFrameSrcOnNavigationRender=!1,r&&window.setTimeout(()=>this.forceCurrentFrameSrc(),0)});g(this,"handleArtifactContentChanged",e=>{var i;if(e.artifactID===((i=this._artifact)==null?void 0:i.id)){if(this._markdownHost&&this._markdownContentURL||this.isCurrentMarkdownMissing()){this.fetchMarkdownContent();return}this.reloadProxyFrame()}});g(this,"handleThemeChanged",()=>{var e;((e=this._artifact)==null?void 0:e.kind)==="url"&&xn(this._artifact.url)||this.reloadProxyFrame()});g(this,"handleWebviewIpcMessage",e=>{var o,a;const r=e.detail??e;if(!r||r.channel!==Jv)return;const i=(o=r.args)==null?void 0:o[0];if(!i)return;const s=this._subscribedWebview;if(s){if(ag(i)){this.handleBridgeReady(i,s);return}if(og(i)){this.handleBridgeLeaving(i.guid);return}if(ug(i)){this.markLegacyBridgeProofOfLife(i,s);const c=this.currentMissingArtifactMessage();c&&((a=s.send)==null||a.call(s,Jv,c));return}if(Wu(i)){this.handleNavigationRequest(i);return}if(lg(i)){this.markLegacyBridgeProofOfLife(i,s),this.dispatchArtifactWheel({deltaX:i.deltaX,shiftKey:i.shiftKey});return}if(cg(i)){this.markLegacyBridgeProofOfLife(i,s),this.dispatchArtifactFilmstripKey(i.direction);return}hg(i)&&(this.markLegacyBridgeProofOfLife(i,s),this.handleProxyContentChanged())}});g(this,"handleWebviewDidStartNavigation",e=>{const r=e.detail??e;r.isMainFrame===!0&&r.isInPlace!==!0&&this.closeBridgeGate()});g(this,"handleWebviewDidFailLoad",e=>{(e.detail??e).isMainFrame!==!1&&this.closeBridgeGate()});g(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});g(this,"handleWebviewDidNavigateInPage",e=>{this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(e)||(this._preserveFrameSrcOnNavigationRender=!1)});g(this,"handleEmbedLoad",()=>{const e=this.querySelector(".artifact-frame");!e||e!==this._embedLoadFrame||this.setAttribute("data-embed-loaded","")})}set artifact(e){const r=this._artifact,i=r?!ZN(r,e):!0;((r==null?void 0:r.id)!==e.id||r.kind==="path"&&e.kind==="path"&&r.path!==e.path)&&(this._missingArtifactID=null),i&&(this._bridgePending=!0,this._bridgeCurrentGuid=null,this._bridgeLifecycleWindow=null,this._activeReloadFrameSrc=null,this._markdownContent=null,this._markdownHost&&(this._markdownHost.content=""),this._markdownFetchedArtifactID=null,this._markdownFetchedScreen=null),this._artifact=e,this.syncNavigationState(),this.render(),this.syncWebviewSubscription()}get artifact(){return this._artifact}set viewURL(e){this._viewURL=e,this.syncNavigationState(),this.render(),this.syncWebviewSubscription()}get viewURL(){return this._viewURL}set contentURL(e){this._contentURL=e,this.render()}get contentURL(){return this._contentURL}set screen(e){this._screen!==e&&(this.detachScreenSubscriptions(),this._screen=e,this.attachScreenSubscriptions(),this.syncMarkdownHost())}get screen(){return this._screen}attachScreenSubscriptions(){!this._screen||this._screenSubscriptionsAttached||(this._screen.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._screen.addEventListener("theme-changed",this.handleThemeChanged),this._screenSubscriptionsAttached=!0)}detachScreenSubscriptions(){!this._screen||!this._screenSubscriptionsAttached||(this._screen.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._screen.removeEventListener("theme-changed",this.handleThemeChanged),this._screenSubscriptionsAttached=!1)}get activeView(){return null}set standaloneScroll(e){this._standaloneScroll=e}get standaloneScroll(){return this._standaloneScroll}connectedCallback(){this.setAttribute("level","2"),window.addEventListener("message",this.handleIframeMessage),this.attachScreenSubscriptions(),this.rearmArtifactFrameOnConnect(),this.render(),this.syncWebviewSubscription(),this.syncNavigationState()}disconnectedCallback(){window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview(),this.unsubscribeFromEmbedLoad(),this.syncNavigationState(),this.detachScreenSubscriptions(),this.disposeMarkdownHost()}handleClose(){this._artifact&&this.dispatchEvent(new e_("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}currentExternalTargetURL(){var r,i;const e=((r=this._navigationState)==null?void 0:r.currentURL)??null;return e&&Oh(e)?e:((i=this._artifact)==null?void 0:i.kind)==="url"?this._artifact.url:null}currentMissingArtifactMessage(){const e=this._artifact;return(e==null?void 0:e.kind)!=="path"?null:{type:nk,title:e.title,path:e.path}}handleBridgeReady(e,r=this.querySelector(".artifact-frame")){if(this.isArtifactFrame(r)){if(typeof e.guid=="string"){(e.guid!==this._bridgeCurrentGuid||this._bridgePending)&&(this._bridgeCurrentGuid=e.guid,this._bridgeLifecycleWindow=r.tagName.toLowerCase()==="iframe"?r.contentWindow:null,this._bridgePending=!1,this.render({preserveFrameSrc:!0}));return}this.markLegacyBridgeProofOfLife(e,r)}}handleBridgeLeaving(e){e===this._bridgeCurrentGuid&&this.closeBridgeGate()}markLegacyBridgeProofOfLife(e,r=this.querySelector(".artifact-frame")){this.isArtifactFrame(r)&&(!this._bridgePending||BN(e)||(this._bridgePending=!1,this.render({preserveFrameSrc:!0})))}closeBridgeGate(e={}){const r=!this._bridgePending||this._bridgeCurrentGuid!==null;this._bridgePending=!0,this._bridgeCurrentGuid=null,this._bridgeLifecycleWindow=null,r&&e.render!==!1&&this.render({preserveFrameSrc:!0})}isArtifactFrame(e){if(!e)return!1;const r=e.tagName.toLowerCase();return r==="iframe"||r==="webview"}isArtifactFrameMessageOrigin(e,r){try{return new URL(e.getAttribute("src")??e.src,window.location.href).origin===r}catch{return!1}}shouldGateFrame(){return this._bridgePending}rearmArtifactFrameOnConnect(){const e=this.querySelector(".artifact-frame");this.isArtifactFrame(e)&&this.closeBridgeGate({render:!1})}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!xn(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===Xv||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0),s&&e.sameDocument!==!0&&this.closeBridgeGate({render:!1}),e.replace?r.replace(i):r.navigate(i)}dispatchArtifactFilmstripKey(e){this._standaloneScroll||this.dispatchEvent(new HN("artifact-filmstrip-key",{bubbles:!0,composed:!0,direction:e}))}dispatchArtifactWheel(e){this._standaloneScroll||this.dispatchEvent(new FN("artifact-wheel",{bubbles:!0,composed:!0,deltaX:e.deltaX,shiftKey:e.shiftKey}))}syncNavigationState(){if(!this.isConnected||!this._artifact){this.disposeNavigationState();return}const e=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===e||(this.disposeNavigationState(),this._navigationState=new pO(this._artifact.id,e),this._navigationArtifactId=this._artifact.id,this._navigationCanonicalURL=e,this._navigationState.addEventListener("change",this.handleNavigationChange),this._navigationState.currentURL!==null&&this.render())}disposeNavigationState(){var e;(e=this._navigationState)==null||e.removeEventListener("change",this.handleNavigationChange),this._navigationState=null,this._navigationArtifactId=null,this._navigationCanonicalURL=null,this._preserveFrameSrcOnNavigationRender=!1}canonicalURLForArtifact(e){const r=Tc(e,{electron:Wt()}),i=this._viewURL??r.viewURL;return e.kind==="url"&&xn(e.url)||r.renderer==="url-webview"?Fn(i):Qv(i,i)}convertIframeNavigationURL(e){var i,s;if(((i=this._artifact)==null?void 0:i.kind)==="url"&&xn(this._artifact.url)&&xn(e))return Fn(e);const r=(s=this.querySelector(".artifact-frame"))==null?void 0:s.getAttribute("src");return Qv(e,r??this._viewURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string")return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=Fn(r);return s===i.currentURL?!1:(i.navigate(s),!0)}viewURLForInternalNavigation(e){if(!e.startsWith("/")||!this._viewURL)return e;try{return new URL(e,this._viewURL).toString()}catch{return e}}syncWebviewSubscription(){const e=this.querySelector("webview");e!==this._subscribedWebview&&(this.unsubscribeFromWebview(),e&&(e.addEventListener("ipc-message",this.handleWebviewIpcMessage),e.addEventListener("did-start-navigation",this.handleWebviewDidStartNavigation),e.addEventListener("did-fail-load",this.handleWebviewDidFailLoad),e.addEventListener("did-navigate",this.handleWebviewDidNavigate),e.addEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=e))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("ipc-message",this.handleWebviewIpcMessage),this._subscribedWebview.removeEventListener("did-start-navigation",this.handleWebviewDidStartNavigation),this._subscribedWebview.removeEventListener("did-fail-load",this.handleWebviewDidFailLoad),this._subscribedWebview.removeEventListener("did-navigate",this.handleWebviewDidNavigate),this._subscribedWebview.removeEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=null)}syncEmbedLoadState(){var s;const e=this.querySelector(".artifact-frame"),r=e?`${e.tagName.toLowerCase()}:${e.getAttribute("src")??""}:${e.dataset.contentUrl??""}`:null;if(e&&e===this._embedLoadFrame&&r===this._embedLoadKey||(this.unsubscribeFromEmbedLoad(),this.removeAttribute("data-embed-loaded"),!e||!r))return;if(this._embedLoadFrame=e,this._embedLoadKey=r,e.tagName.toLowerCase()==="webview"){e.addEventListener("did-finish-load",this.handleEmbedLoad),e.addEventListener("did-fail-load",this.handleEmbedLoad);return}e.addEventListener("load",this.handleEmbedLoad);const i=e;try{((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&this.handleEmbedLoad()}catch{}}unsubscribeFromEmbedLoad(){if(!this._embedLoadFrame){this._embedLoadKey=null;return}this._embedLoadFrame.removeEventListener("load",this.handleEmbedLoad),this._embedLoadFrame.removeEventListener("did-finish-load",this.handleEmbedLoad),this._embedLoadFrame.removeEventListener("did-fail-load",this.handleEmbedLoad),this._embedLoadFrame=null,this._embedLoadKey=null}iframeTargetOrigin(e){const r=e.getAttribute("sandbox")??"";if(!new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin"))return"*";const s=e.getAttribute("src")??e.src;if(!s)return"*";try{return new URL(s,window.location.href).origin}catch{return"*"}}syncMarkdownHost(){var s;const e=this.querySelector("[data-content-url]"),r=(e==null?void 0:e.dataset.contentUrl)??null,i=((s=this._artifact)==null?void 0:s.id)??null;if(!e||!r||!i){this.disposeMarkdownHost({clearContent:!0});return}if(e!==this._markdownFrame||i!==this._markdownArtifactID){this.disposeMarkdownHost(),this._markdownFrame=e,this._markdownContentURL=r,this._markdownArtifactID=i;const o=e.tagName.toLowerCase()==="webview"?new NN(e):new ON(e);this._markdownHost=o,o.handleUpdateContent(async a=>{const c=this._artifact,u=this._screen;if(!c||!u)throw new Error("No markdown artifact selected");await u.server.client.markdown.update({artifactID:c.id,content:a}),this._markdownContent=a,this._markdownHost===o&&(o.content=a)}),this._markdownContent!==null&&(o.content=this._markdownContent)}else this._markdownContentURL=r;this.ensureMarkdownContentFetched()}ensureMarkdownContentFetched(){const e=this._artifact,r=this._screen;!e||!r||!this._markdownHost||this._markdownFetchedArtifactID===e.id&&this._markdownFetchedScreen===r||(this._markdownFetchedArtifactID=e.id,this._markdownFetchedScreen=r,this.fetchMarkdownContent())}async fetchMarkdownContent(){var s,o;const e=this._artifact,r=this._screen;if(!e||!r)return;const i=e.id;try{const a=await r.server.client.markdown.get({artifactID:i});if(((s=this._artifact)==null?void 0:s.id)!==i||this._screen!==r)return;this._missingArtifactID=null,this._markdownContent=a;const c=this._markdownHost;if(!c){this.render();return}c.content=a}catch(a){if(((o=this._artifact)==null?void 0:o.id)!==i||this._screen!==r)return;if(a instanceof sf&&a.status===UN){this._missingArtifactID=i,this._markdownContent=null,this.disposeMarkdownHost(),this.render();return}this._markdownFetchedArtifactID=null,this._markdownFetchedScreen=null}}isCurrentMarkdownMissing(){var e;return this._missingArtifactID===((e=this._artifact)==null?void 0:e.id)&&this._artifact.kind==="path"&&U0(this._artifact.path)}missingArtifactTemplate(e){return P`
341
341
  <section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
342
342
  <div class="artifact-missing-wrapper">
343
- <h1>${ak()}</h1>
344
- <p>${lk()}</p>
343
+ <h1>${sk()}</h1>
344
+ <p>${ok()}</p>
345
345
  <section class="artifact-missing-path" aria-label="Missing artifact path">
346
346
  <p class="artifact-missing-path-label">Registered path:</p>
347
347
  <p><code>${e.path}</code></p>
348
348
  </section>
349
- <p>${ck()}</p>
349
+ <p>${ak()}</p>
350
350
  </div>
351
351
  </section>
352
- `}disposeMarkdownHost(e={}){var r;(r=this._markdownHost)==null||r.dispose(),this._markdownHost=null,this._markdownFrame=null,this._markdownContentURL=null,this._markdownArtifactID=null,this._markdownFetchedArtifactID=null,this._markdownFetchedScreen=null,e.clearContent&&(this._markdownContent=null)}reloadProxyFrame(){var o,a,c,u;const e=this.querySelector(".artifact-frame:not([data-content-url])");if(!e||e.tagName.toLowerCase()==="webview"&&!(((o=this._artifact)==null?void 0:o.kind)==="path"||((a=this._artifact)==null?void 0:a.kind)==="url"&&xn(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&xn(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??e.getAttribute("src"):e.getAttribute("src");if(r===null)return;this.closeBridgeGate({render:!1});const i=new URL(r,window.location.href);i.searchParams.set(Zs,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=s,this.removeAttribute("data-embed-loaded"),this.render({frameSrcOverride:s})}contentTemplate(e,r){var h;if(e.kind==="path"&&this.isCurrentMarkdownMissing())return this.missingArtifactTemplate(e);const i=this.routeForCurrentNavigation(e),s=(h=this.querySelector(".artifact-frame"))==null?void 0:h.getAttribute("src");let o=null;this._activeReloadFrameSrc&&(GN(this._activeReloadFrameSrc,i.viewURL)?o=this._activeReloadFrameSrc:this._activeReloadFrameSrc=null);const a=r.frameSrcOverride??o??(r.preserveFrameSrc&&s?s:i.viewURL),c=this._contentURL??i.contentURL,u=this.shouldGateFrame();return i.renderer==="url-webview"?i.contentURL?P`<webview allowpopups class="artifact-frame artifact-content" src=${a} data-content-url=${c} ?data-bridge-pending=${u}></webview>`:P`<webview allowpopups class="artifact-frame artifact-content" src=${a} ?data-bridge-pending=${u}></webview>`:i.renderer==="markdown"?P`<iframe class="artifact-frame artifact-content" src=${a} data-content-url=${c} ?data-bridge-pending=${u}></iframe>`:P`<iframe class="artifact-frame artifact-content" src=${a} ?data-bridge-pending=${u}></iframe>`}routeForCurrentNavigation(e){var s;const r=Tc(e,{electron:Wt()}),i=((s=this._navigationState)==null?void 0:s.currentURL)??null;if(i===null){const o=this._viewURL??r.viewURL;return r.renderer==="markdown"?{renderer:"markdown",viewURL:o,contentURL:this._contentURL??r.contentURL}:{...r,viewURL:o}}return Nh(i)&&!Wt()?xn(i)?{renderer:"proxy-iframe",viewURL:i,contentURL:null}:{renderer:"proxy-iframe",viewURL:ey,contentURL:null}:Nh(i)&&Wt()?{renderer:"url-webview",viewURL:i,contentURL:null}:Wt()?{renderer:"url-webview",viewURL:this.viewURLForInternalNavigation(i),contentURL:null}:{renderer:"proxy-iframe",viewURL:this.viewURLForInternalNavigation(i),contentURL:null}}forceCurrentFrameSrc(){if(!this._artifact)return;const e=this.routeForCurrentNavigation(this._artifact);if(e.renderer==="url-webview")return;const r=this.querySelector("iframe.artifact-frame");if(r){this.closeBridgeGate(),this._activeReloadFrameSrc=null,this.removeAttribute("data-embed-loaded");try{r.contentWindow&&(r.contentWindow.location.href=e.viewURL)}catch{r.src=e.viewURL}r.src=e.viewURL,r.setAttribute("src",e.viewURL),this.syncEmbedLoadState()}}titleIconTemplate(){const e=this._navigationState;return e!=null&&e.canGoBack?P`
352
+ `}disposeMarkdownHost(e={}){var r;(r=this._markdownHost)==null||r.dispose(),this._markdownHost=null,this._markdownFrame=null,this._markdownContentURL=null,this._markdownArtifactID=null,this._markdownFetchedArtifactID=null,this._markdownFetchedScreen=null,e.clearContent&&(this._markdownContent=null)}reloadProxyFrame(){var o,a,c,u;const e=this.querySelector(".artifact-frame:not([data-content-url])");if(!e||e.tagName.toLowerCase()==="webview"&&!(((o=this._artifact)==null?void 0:o.kind)==="path"||((a=this._artifact)==null?void 0:a.kind)==="url"&&xn(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&xn(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??e.getAttribute("src"):e.getAttribute("src");if(r===null)return;this.closeBridgeGate({render:!1});const i=new URL(r,window.location.href);i.searchParams.set(Zs,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=s,this.removeAttribute("data-embed-loaded"),this.render({frameSrcOverride:s})}contentTemplate(e,r){var h;if(e.kind==="path"&&this.isCurrentMarkdownMissing())return this.missingArtifactTemplate(e);const i=this.routeForCurrentNavigation(e),s=(h=this.querySelector(".artifact-frame"))==null?void 0:h.getAttribute("src");let o=null;this._activeReloadFrameSrc&&(WN(this._activeReloadFrameSrc,i.viewURL)?o=this._activeReloadFrameSrc:this._activeReloadFrameSrc=null);const a=r.frameSrcOverride??o??(r.preserveFrameSrc&&s?s:i.viewURL),c=this._contentURL??i.contentURL,u=this.shouldGateFrame();return i.renderer==="url-webview"?i.contentURL?P`<webview allowpopups class="artifact-frame artifact-content" src=${a} data-content-url=${c} ?data-bridge-pending=${u}></webview>`:P`<webview allowpopups class="artifact-frame artifact-content" src=${a} ?data-bridge-pending=${u}></webview>`:i.renderer==="markdown"?P`<iframe class="artifact-frame artifact-content" src=${a} data-content-url=${c} ?data-bridge-pending=${u}></iframe>`:P`<iframe class="artifact-frame artifact-content" src=${a} ?data-bridge-pending=${u}></iframe>`}routeForCurrentNavigation(e){var s;const r=Tc(e,{electron:Wt()}),i=((s=this._navigationState)==null?void 0:s.currentURL)??null;if(i===null){const o=this._viewURL??r.viewURL;return r.renderer==="markdown"?{renderer:"markdown",viewURL:o,contentURL:this._contentURL??r.contentURL}:{...r,viewURL:o}}return Oh(i)&&!Wt()?xn(i)?{renderer:"proxy-iframe",viewURL:i,contentURL:null}:{renderer:"proxy-iframe",viewURL:Xv,contentURL:null}:Oh(i)&&Wt()?{renderer:"url-webview",viewURL:i,contentURL:null}:Wt()?{renderer:"url-webview",viewURL:this.viewURLForInternalNavigation(i),contentURL:null}:{renderer:"proxy-iframe",viewURL:this.viewURLForInternalNavigation(i),contentURL:null}}forceCurrentFrameSrc(){if(!this._artifact)return;const e=this.routeForCurrentNavigation(this._artifact);if(e.renderer==="url-webview")return;const r=this.querySelector("iframe.artifact-frame");if(r){this.closeBridgeGate(),this._activeReloadFrameSrc=null,this.removeAttribute("data-embed-loaded");try{r.contentWindow&&(r.contentWindow.location.href=e.viewURL)}catch{r.src=e.viewURL}r.src=e.viewURL,r.setAttribute("src",e.viewURL),this.syncEmbedLoadState()}}titleIconTemplate(){const e=this._navigationState;return e!=null&&e.canGoBack?P`
353
353
  <button
354
354
  icon-only
355
355
  size="sm"
@@ -358,7 +358,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
358
358
  @click=${()=>e.back()}
359
359
  aria-label="Back"
360
360
  >
361
- ${KO({size:16})}
361
+ ${qO({size:16})}
362
362
  </button>
363
363
  `:P`
364
364
  <button
@@ -369,7 +369,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
369
369
  disabled
370
370
  aria-label="No history"
371
371
  >
372
- ${e8({size:16,weight:"duotone"})}
372
+ ${XO({size:16,weight:"duotone"})}
373
373
  </button>
374
374
  `}template(e={preserveFrameSrc:!1}){const r=this._artifact;return P`
375
375
  ${this.contentTemplate(r,e)}
@@ -387,15 +387,15 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
387
387
  @click=${()=>this.handleClose()}
388
388
  aria-label="Close"
389
389
  >
390
- ${_f({size:16})}
390
+ ${Sf({size:16})}
391
391
  </button>
392
392
  </div>
393
393
  </footer>
394
- `}render(e={}){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ue(this.template({preserveFrameSrc:e.preserveFrameSrc??!1,frameSrcOverride:e.frameSrcOverride}),this),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncWebviewSubscription(),this.syncEmbedLoadState(),this.syncMarkdownHost())}}function Nh(n){return n.startsWith("http://")||n.startsWith("https://")}function WN(n,t){return n.id!==t.id||n.kind!==t.kind?!1:n.kind==="path"&&t.kind==="path"?n.path===t.path:n.kind==="url"&&t.kind==="url"?n.url===t.url:!0}function jN(n){return typeof n=="object"&&n!==null&&"guid"in n}function GN(n,t){try{const e=new URL(n,window.location.href),r=new URL(t,window.location.href);return e.searchParams.delete(Zs),r.searchParams.delete(Zs),e.origin===r.origin&&e.pathname===r.pathname&&e.search===r.search}catch{return!1}}function ty(n,t){try{const e=new URL(n,window.location.href);if(t){const r=new URL(t,window.location.href);if(e.origin===r.origin)return e.searchParams.delete(Zs),`${e.pathname}${e.search}${e.hash}`}}catch{return Fn(n)}return Fn(n)}customElements.define("artifact-view",BN);/**
394
+ `}render(e={}){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ue(this.template({preserveFrameSrc:e.preserveFrameSrc??!1,frameSrcOverride:e.frameSrcOverride}),this),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncWebviewSubscription(),this.syncEmbedLoadState(),this.syncMarkdownHost())}}function Oh(n){return n.startsWith("http://")||n.startsWith("https://")}function ZN(n,t){return n.id!==t.id||n.kind!==t.kind?!1:n.kind==="path"&&t.kind==="path"?n.path===t.path:n.kind==="url"&&t.kind==="url"?n.url===t.url:!0}function BN(n){return typeof n=="object"&&n!==null&&"guid"in n}function WN(n,t){try{const e=new URL(n,window.location.href),r=new URL(t,window.location.href);return e.searchParams.delete(Zs),r.searchParams.delete(Zs),e.origin===r.origin&&e.pathname===r.pathname&&e.search===r.search}catch{return!1}}function Qv(n,t){try{const e=new URL(n,window.location.href);if(t){const r=new URL(t,window.location.href);if(e.origin===r.origin)return e.searchParams.delete(Zs),`${e.pathname}${e.search}${e.hash}`}}catch{return Fn(n)}return Fn(n)}customElements.define("artifact-view",VN);/**
395
395
  * @license
396
396
  * Copyright 2017 Google LLC
397
397
  * SPDX-License-Identifier: BSD-3-Clause
398
- */const ny=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},ry=Au(class extends Sf{constructor(n){if(super(n),n.type!==wf.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);const i=[],s=[];let o=0;for(const a of n)i[o]=r?r(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){const i=BO(n),{values:s,keys:o}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),c=[];let u,h,f=0,v=i.length-1,y=0,E=s.length-1;for(;f<=v&&y<=E;)if(i[f]===null)f++;else if(i[v]===null)v--;else if(a[f]===o[y])c[y]=Tr(i[f],s[y]),f++,y++;else if(a[v]===o[E])c[E]=Tr(i[v],s[E]),v--,E--;else if(a[f]===o[E])c[E]=Tr(i[f],s[E]),po(n,c[E+1],i[f]),f++,E--;else if(a[v]===o[y])c[y]=Tr(i[v],s[y]),po(n,i[f],i[v]),v--,y++;else if(u===void 0&&(u=ny(o,y,E),h=ny(a,f,v)),u.has(a[f]))if(u.has(a[v])){const x=h.get(o[y]),C=x!==void 0?i[x]:null;if(C===null){const L=po(n,i[f]);Tr(L,s[y]),c[y]=L}else c[y]=Tr(C,s[y]),po(n,i[f],C),i[x]=null;y++}else $h(i[v]),v--;else $h(i[f]),f++;for(;y<=E;){const x=po(n,c[E+1]);Tr(x,s[y]),c[y++]=x}for(;f<=v;){const x=i[f++];x!==null&&$h(x)}return this.ut=o,ZO(n,c),Si}}),Pe=n=>({type:"px",...n}),Re=n=>({type:"unit",...n}),Wl=2;class qN{constructor(t){g(this,"basis");g(this,"min");g(this,"_gap");g(this,"_viewport");g(this,"_unit");this.basis=t.basis,this.min=t.min,this._viewport=t.viewport,this._gap=t.gap??Pe({x:ce,y:ce});const e=this._viewport.x??yi,r=this._viewport.y??Zo,i=this._gap.x??ce,s=this._gap.y??ce,o=e<=nC,a=o?e-i*Wl:Math.min(yi,e-i*Wl),c=o?r-s*Wl:Math.min(Zo,r-s*Wl),u=(a-i*(Je-1))/Je,h=(c-s*(vt-1))/vt,f=this.basis.x??0,v=this.basis.y??0,y=this.min.x??0,E=this.min.y??0;this._unit=Pe(o?{x:Math.max(y,u),y:Math.max(E,h)}:{x:Math.max(y,Math.min(f,u)),y:Math.max(E,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(t){return Re({x:t.x==null?void 0:t.x/(this._unit.x??1),y:t.y==null?void 0:t.y/(this._unit.y??1)})}toPixels(t){const e=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??ce,s=this._gap.y??ce,o=t.x==null?void 0:t.x*e+Math.max(0,t.x-1)*i,a=t.y==null?void 0:t.y*r+Math.max(0,t.y-1)*s;return Pe({x:o,y:a})}}const ki=1e-4,Bt=1e-6,YN=40,KN=24;function r_(n,t){return Math.max(0,n-t*2)}function i_(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function s_(n){const t=[0];for(let e=0;e<n.length;e+=1){const r=t[e]??0;t.push(r+n[e]+ce)}return t}function o_(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s<n.length;s+=1){const o=n[s],a=i===0?o:r+ce+o;if(a>e+ki)break;r=a,i+=1}return Math.max(1,i)}function JN(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s>=0;s-=1){const o=n[s],a=i===0?o:r+ce+o;if(a>e+ki)break;r=a,i+=1}return Math.max(1,i)}function XN(n,t){if(n.length===0)return 0;let e=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:e+ce+s;if(o>t+ki)break;e=o,r+=1}return Math.max(1,r)}function Lf(n,t){if(n.length===0)return 0;const e=XN(n,t);return Math.max(0,n.length-e)}function iy(n,t,e){if(n.length===0)return 0;const r=o_(n,t,e),i=Math.min(n.length,t+r);if(i<=t)return 0;const s=n.slice(t,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*ce}function np(n,t,e){const r=n[t]??0;return e-r}function Ji(n,t,e,r,i){if(n.length===0)return 0;const s=Lf(n,i),o=t[s]??0,a=Math.max(0,Math.min(o,e));let c=0;for(let V=0;V<s;V+=1){const K=t[V]??0,G=t[V+1]??K;if(a>=K&&a<=G+ki){c=V;break}c=V+1}const u=Math.min(c+1,s),h=t[c]??0,f=t[u]??h,v=Math.max(f-h,ki),y=u===c?0:(a-h)/v,E=s_(n),x=iy(n,c,i),C=iy(n,u,i),L=(r-x)/2,R=(r-C)/2,W=np(E,c,L),N=np(E,u,R);return W+(N-W)*y}function QN(n,t,e,r,i){const s=Lf(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<YN;u+=1){const h=(a+c)/2;Ji(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function e4(n,t,e){const r=s_(n),[i,s]=t,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ce,c=(e-a)/2;return np(r,i,c)}function t4(n,t,e){const r=o_(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function n4(n,t,e){const r=JN(n,t,e);return[Math.max(0,t-r+1),t]}function r4(n,t){return n[0]===t[0]&&n[1]===t[1]}function i4(n){const{nodeCols:t,nodeWidthsPx:e,viewportWidthPx:r}=n;if(t.length===0||e.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=e.length,s=n.gapPx??ce,o=r_(r,s),a=i_(t),c=Lf(e,o),u=a[c]??0;function h(C){const L=e4(e,C,r),R=QN(e,a,r,o,L);return{nodeRange:C,anchor:Math.max(0,Math.min(u,R))}}const f=[];for(let C=0;C<i;){const L=t4(e,C,o);f.push(h(L)),C=L[1]+1}const v=h(n4(e,i-1,o)),y=f.filter(C=>C.nodeRange[0]<v.nodeRange[0]),E=y[y.length-1];return{viewspans:E&&r4(E.nodeRange,v.nodeRange)?y:[...y,v],minScroll:0,maxScroll:u}}function Vi(n,t){var i;let e=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)-t);if(o+Bt<r){r=o,e=s;continue}Math.abs(o-r)<=Bt&&s<e&&(e=s)}return e}function s4(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function $r(n,t,e){return Math.max(t,Math.min(e,n))}function o4(n,t){var e;for(let r=0;r<n.length;r+=1)if(Math.abs((((e=n[r])==null?void 0:e.anchor)??0)-t)<=Bt)return r;return-1}function a4(n,t,e){var i,s;if(n.length===0)return t;const r=o4(n,t);if(r>=0){const o=n[r+e];return(o==null?void 0:o.anchor)??n[e>0?n.length-1:0].anchor}if(e>0){for(const o of n)if(o.anchor>t+Bt)return o.anchor;return((i=n[n.length-1])==null?void 0:i.anchor)??t}for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a&&a.anchor<t-Bt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class l4 extends It{constructor(e){super();g(this,"_scroll",0);g(this,"_minScroll",0);g(this,"_maxScroll",0);g(this,"_viewspans",[]);g(this,"_activeViewspanIndex",0);g(this,"_nodeWidthsPx",[]);g(this,"_boundaryCols",[0]);g(this,"_viewportWidthPx",0);g(this,"_framedViewportWidthPx",0);this._scroll=(e==null?void 0:e.x)??0}get scroll(){return Re({x:this._scroll})}get translate(){return Pe({x:Ji(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx)})}get activeViewspan(){return this._viewspans[this._activeViewspanIndex]??null}get viewspans(){return this._viewspans}set scroll(e){const r=$r(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Bt||(this._scroll=r,this._activeViewspanIndex=Vi(this._viewspans,this._scroll),this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}rebuild(e){var v;const r=e.nodeWidths.map(y=>Math.max(0,y.x??0)),i=r.map(y=>e.grid.toPixels(Re({x:y})).x??0),s=e.grid.viewport.x??0,o=e.grid.gap.x??ce,a=i4({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=i_(r),this._viewportWidthPx=s,this._framedViewportWidthPx=r_(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=$r(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=Vi(this._viewspans,c);const h=e.snap!==!1?((v=this._viewspans[this._activeViewspanIndex])==null?void 0:v.anchor)??c:c,f=$r(h,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)>Bt&&(this._scroll=f,this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=s4(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=$r(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=Bt)&&(this._scroll=s,this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[Vi(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:a4(this._viewspans,this._scroll,e),i=$r(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=Vi(this._viewspans,i),!(Math.abs(i-this._scroll)<=Bt)&&(this._scroll=i,this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=$r(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Bt||(this._scroll=r,this._activeViewspanIndex=Vi(this._viewspans,this._scroll),this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=ki)return;const i=Ji(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=Ji(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=Ji(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=ki)return;let u=this._minScroll,h=this._maxScroll;for(let v=0;v<KN;v+=1){const y=(u+h)/2;Ji(this._nodeWidthsPx,this._boundaryCols,y,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=y:h=y}const f=$r((u+h)/2,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)<=Bt||(this._scroll=f,this._activeViewspanIndex=Vi(this._viewspans,this._scroll),this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}}const Uh={"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}},c4=["stack-above","stack-below","reorder-before","reorder-after"];function Fh(n,t){return{left:n.left+n.width*t.left,top:n.top+n.height*t.top,width:n.width*t.width,height:n.height*t.height}}function Cr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function os(n){return n.artifactID}function rp(n){return Number.isFinite(n)?Math.max(Vo,Math.min(rf,Math.round(n))):Vo}function u4(n,t,e){const r=n.findIndex(a=>a.type==="card"&&os(a)===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=rp(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function a_(n,t){for(const e of n){if(e.type==="card"&&os(e)===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&os(r)===t)return r;if(r.type==="row"){for(const i of r.children)if(os(i)===t)return i}}}return null}function ip(n){const t=n.height===vt||n.height===dr?dr:n.height;return n.width===Je&&n.height===t?n:{...n,width:Je,height:t}}function sp(n){return n.height===dr?{...n,height:vt}:n}function h4(n,t,e,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===t);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"&&os(h)===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.type!=="card"||os(h)!==e);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"?sp(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,sp(o)),c}const d4=Fe(),p4=Fe(),f4=50;function g4(n,t){if(n.type!==t.type)return!1;switch(n.type){case"reorder":return t.index===n.index;case"stack":return t.targetCardId===n.targetCardId&&t.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return t.toIndex===n.toIndex;case"stack-child-reorder":return t.position===n.position;default:return!1}}function nt(n){return n.artifactID}function sy(n){return n.type==="card"?nt(n):n.id}function yl(n){return{id:nt(n),type:"drop-target",width:n.width,height:n.height}}function oy(n){return n.map(v4)}function m4(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function v4(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(m4)}:n}function l_(n,t){return n.find(r=>r.type==="card"&&nt(r)===t)??null}function ay(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function y4(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&nt(a)===n.nodeId);if(r===-1)return null;const i=e[r];if(!i||i.type!=="card")return null;e.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,e.length));e.splice(s,0,i);const o=e.findIndex(a=>a.type==="card"&&nt(a)===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function b4(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&nt(v)===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=l_(r,t.nodeId);if(!a)return null;const c=ip(a),u=ip(o),h=yl(c),f=e.position==="above"?[h,u]:[u,h];return i[s]={id:nt(o),type:"stack",children:f},i}function Hh(n,t){return n.parentStackId?S4(n,t):w4(n,t)}function w4(n,t){const e=n.hitTarget;if(e.type==="reorder"){const r=t[n.sourceIndex];if(!r||r.type!=="card")return[...t];const i=[...t];return i.splice(n.sourceIndex,1),i.splice(e.index,0,yl(r)),i}if(e.type==="stack"){const r=y4(n,t);return r?b4(r,n,e,t)??[...t]:[...t]}return[...t]}function S4(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return _4(n,t,e.position);case"stack-child-extract":return k4(n,t,e.toIndex);case"stack-child-noop":return E4(n,t);default:return[...t]}}function _4(n,t,e){const r=t.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...t];const i=t[r];if(!i||i.type!=="stack")return[...t];if(!i.children.every(v=>v.type==="card"))return[...t];const s=i.children,o=s.findIndex(v=>nt(v)===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(v=>nt(v)!==n.nodeId),u=yl(a),h=e==="above"?[u,...c]:[...c,u],f=[...t];return f[r]={...i,children:h},f}function k4(n,t,e){if(!n.parentStackId)return[...t];const r=h4(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&nt(a)===n.nodeId);if(i===-1)return[...t];const s=r[i];if(!s||s.type!=="card")return[...t];const o=[...r];return o[i]=yl(s),o}function E4(n,t){const e=t.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(e===-1)return[...t];const r=t[e];if(!r||r.type!=="stack")return[...t];const i=r.children.findIndex(c=>c.type==="card"&&nt(c)===n.nodeId);if(i===-1)return[...t];const s=r.children[i];if(!s||s.type!=="card")return[...t];const o=[...t],a=[...r.children];return a[i]=yl(s),o[e]={...r,children:a},o}function x4(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:fu()}function A4(n,t,e){if(n.type==="drop-target"){const r=a_(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return ip(r)}return n}function T4(n,t,e){const r=n.children.map(s=>A4(s,t,e));return{id:x4(n,t),type:"stack",children:r}}function $4(n,t,e){if(n.type==="drop-target"){const r=a_(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return l_(t,e)!==null?r:sp(r)}return n.type==="card"||n.type==="row"?n:T4(n,t,e)}function C4(n,t,e){return n.map(r=>$4(r,t,e))}function I4(n,t){return JSON.stringify(n)===JSON.stringify(t)}const R4=gl(It);class P4 extends R4{constructor(e={}){super();g(this,"pending",null);g(this,"active",null)}start(e){if(this.pending||this.active)return;const r=e.pointer.x??0,i=e.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:e.grabOffset.x??0,grabOffsetY:e.grabOffset.y??0,nodeId:e.nodeId,sourceIndex:e.source.index,parentStackId:e.source.parentId,width:e.size.x??0,height:e.size.y??0,baseLayout:e.layout}}update(e){const r=e.pointer.x??0,i=e.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=iC&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ie("change")));return}if(!this.active)return;const o=Hh(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,e,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&g4(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 ie("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const e=this.active.baseLayout;let r=null;try{const i=Hh(this.active,e),s=C4(i,e,this.active.nodeId);I4(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new p4("drop",{layout:r})),this.dispatchEvent(new ie("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ie("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 e=Hh(this.active,this.active.baseLayout);this.dispatchEvent(new d4("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:Pe({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:Pe({x:this.active.pointerX,y:this.active.pointerY}),size:Pe({x:this.active.width,y:this.active.height}),projectedLayout:e}))}getHitTargetForPointer(e,r,i,s){return this.active?this.isPointerInsideDragBounds(e,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(e,r,i,s):this.getTopLevelCardHitTarget(e,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(e,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&&Cr(e,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&&Cr(e,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(e,r,i,s)}}getSourceRemainingSiblingRect(e){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=ay(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&nt(a)!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===nt(i)))==null?void 0:o.rect}getSourceStackInteractionRect(e){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=e.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=ay(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&nt(a)!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===nt(s));if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(e,r,i,s){var y,E,x;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((y=this.active)==null?void 0:y.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=f4;for(const C of o){const L=C.rect;if(!Cr(e,r,L))continue;const R=this.resolveTopLevelTargetForCard(e,r,C,C.logicalIndex,c);if(R)return R;if(!c&&((E=this.active)!=null&&E.hitTarget))return this.active.hitTarget.type==="reorder"?this.active.hitTarget:this.active.hitTarget.type==="stack"&&this.active.hitTarget.targetCardId===C.id?this.active.hitTarget:{type:"reorder",index:e<this.active.pointerX?C.logicalIndex:C.logicalIndex+1}}const u=this.getNearestTargetableZone(e,o);if(!u)return{type:"reorder",index:((x=this.active)==null?void 0:x.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,e)),f=this.resolveTopLevelTargetForCard(h,r,u,u.logicalIndex,c);if(f)return f;const v=u.rect.left+u.rect.width/2;return{type:"reorder",index:e<v?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(e,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 f of o){if(!Cr(e,r,f.rect))continue;const v=Fh(f.rect,Uh["reorder-before"]);if(Cr(e,r,v))return f.logicalIndex;const y=Fh(f.rect,Uh["reorder-after"]);if(Cr(e,r,y))return f.logicalIndex+1}const a=this.getNearestTargetableZone(e,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return e<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(e,r){const i=new Map(r.map(a=>[sy(a),a])),s=[];let o=0;for(const a of e){const c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:sy(c),rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of c4){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Uh[c],h=Fh(a,u);if(Cr(e,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(e,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=e<a?a-e:e>c?e-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(e,r,i){return e>=i.left&&e<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const L4=100,D4=1e3;class M4{constructor(t,e){g(this,"_status","idle");g(this,"cumulativeOffset",0);g(this,"samples",[]);g(this,"scroll");g(this,"setAnimating");this.scroll=t,this.setAnimating=e}get status(){return this._status}start(t){this._status="active",this.cumulativeOffset=0,this.samples=[{time:t,offset:0}]}move(t,e){this._status==="active"&&(this.cumulativeOffset+=e,this.samples.push({time:t,offset:this.cumulativeOffset}),this.pruneSamples(t),this.setAnimating(!1),this.scroll.wheelPixels(Pe({x:-e})))}end(){if(this._status!=="active")return;const t=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(t)<oC?this.scroll.snap():this.scroll.snap(t>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(t){const e=t-L4;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=e){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 t=this.samples[0],e=this.samples[this.samples.length-1],r=e.time-t.time;return r<=0?0:(e.offset-t.offset)/r*D4}}function rs(n){return n.artifactID}function z4(n){return n.type==="card"?rs(n):n.id}function O4({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var E;const a=new Map(t.map(x=>[z4(x),x])),c=e.nodes.map((x,C)=>{const L=a.get(x.id),R=[];for(const N of x.cards){if(s&&N.artifactID===s.nodeId){R.push({key:`placeholder:${N.artifactID}`,kind:"placeholder",card:null,placement:N,isTopLevelCard:!1,isDragged:!1,sourceStackId:s.source.parentId??null});continue}const V=r.get(N.artifactID);V&&R.push({key:rs(V),kind:"card",card:V,placement:N,isTopLevelCard:(L==null?void 0:L.type)==="card",isDragged:!1,sourceStackId:null})}if(s!=null&&s.source.parentId&&x.id===s.source.parentId){const N=r.get(s.nodeId);if(N){const V={key:rs(N),kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},K=N4(n,s.source.parentId,s.nodeId),G=K<0?R.length:Math.min(K,R.length);R.splice(G,0,V)}}const W=!!(s&&(L==null?void 0:L.type)==="card"&&rs(L)===s.nodeId);return{key:W?`placeholder:${x.id}`:x.id,kind:"visible",nodeId:x.id,widthPx:i.toPixels(Re({x:x.width})).x??0,widthUnits:x.width,layoutIndex:C,isForeground:o(C),isPlaceholder:W,slots:R}});if(!s||s.source.parentId&&a.has(s.source.parentId))return c;const u=r.get(s.nodeId);if(!u)return c;const h=s.source.parentId??s.nodeId,f=((E=Nr(n).nodes[s.source.index])==null?void 0:E.width)??Je,v={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:f,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:rs(u),kind:"card",card:u,placement:null,isTopLevelCard:!s.source.parentId,isDragged:!0,sourceStackId:s.source.parentId??null}]},y=Math.max(0,Math.min(s.source.index,c.length));return c.splice(y,0,v),c}function ly(n){if(!n)return null;const t=n.projectedLayout,e=n.source.parentId;for(const i of t){if(i.type!=="stack")continue;const s=i.children.findIndex(u=>u.type==="drop-target");if(s===-1)continue;const o=s===0?"above":"below";if(e&&e===i.id)return`stack-child-reorder:${o}`;const a=i.children.find(u=>u.type!=="drop-target");return`stack:${(a==null?void 0:a.type)==="card"?a.artifactID:(a==null?void 0:a.id)??""}:${o}`}const r=t.findIndex(i=>i.type==="drop-target");return r===-1?"none":e?`stack-child-extract:${r}`:`reorder:${r}`}function N4(n,t,e){const r=n.find(i=>i.type==="stack"&&i.id===t);return!r||r.type!=="stack"?-1:r.children.findIndex(i=>i.type==="card"&&rs(i)===e)}const U4=2,cy=1e3,Zi=1e-4,F4=120,uy=!1;function hy(n){return n.replace(/["\\]/g,"\\$&")}function Se(n){return n.artifactID}function as(n){return n.type==="card"?Se(n):n.id}function dy(n,t,e){if(n===0)return 0;const r=t.toPixels(Re({y:vt})).y??0;return(e-r)/U4}function Vh(n){const t=n.clientWidth>0?n.clientWidth:yi,e=n.clientHeight>0?n.clientHeight:Zo;let r=0,i=0;if(n.isConnected){const u=getComputedStyle(n);r=parseFloat(u.paddingTop)||0,i=parseFloat(u.paddingBottom)||0}const s=Math.max(1,e-r-i),o=n.isConnected&&parseFloat(getComputedStyle(n).getPropertyValue("--layout-virtual-bottom-balance"))||0,a=Zo+ce*2,c=Math.min(o,Math.max(0,s-a));return{width:t,height:s-c,offsetY:r}}function H4(n){return n.shiftKey&&n.deltaX===0&&n.deltaY!==0?n.deltaY:n.deltaX}function V4(n){var e;if(!(n instanceof Element))return!1;const t=n.closest("input, textarea, select, [contenteditable], [role='textbox'], [role='searchbox'], [role='combobox'], [role='spinbutton'], [role='slider']");return t?t.hasAttribute("contenteditable")?((e=t.getAttribute("contenteditable"))==null?void 0:e.toLowerCase())!=="false":!0:!1}class Z4 extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});g(this,"scrollPosition");this.scrollPosition=e}}class c_ extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});g(this,"layout");this.layout=e}}class B4 extends HTMLElement{constructor(){super();g(this,"_layout",[]);g(this,"_scrollPosition",0);g(this,"layoutGrid",null);g(this,"layoutScroll",new l4(Re({x:0})));g(this,"scrollModelKey","");g(this,"resizeObserver",null);g(this,"renderPending",!1);g(this,"animateNextRender",!0);g(this,"swipeGesture",new M4(this.layoutScroll,e=>{this.animateNextRender=e}));g(this,"swipePointerId",null);g(this,"swipeStartX",0);g(this,"swipeStartY",0);g(this,"swipeLastX",0);g(this,"swipeActive",!1);g(this,"swipeShouldSuppressClick",!1);g(this,"swipeListenersAttached",!1);g(this,"wheelIdleSnapTimer",null);g(this,"dragController",new P4);g(this,"dragState",null);g(this,"activeDragPointerId",null);g(this,"dragListenersAttached",!1);g(this,"dragFrame",0);g(this,"lastDragFrameTime",0);g(this,"lastPointerX",0);g(this,"lastPointerY",0);g(this,"pointerVelocityPxPerSec",0);g(this,"scrollVelocityPxPerSec",0);g(this,"motionSampleTime",0);g(this,"motionSampleX",0);g(this,"motionSampleY",0);g(this,"lastDragControllerStatus","idle");g(this,"lastProjectedDragLayoutSignature","");g(this,"lastDragDropIntent",null);g(this,"lastActivePlaceholderId",null);g(this,"draggedSlotElement",null);g(this,"draggedSlotContainingBlock",null);g(this,"currentDragPreviewSize",null);g(this,"dragTrackOffsetXPx",0);g(this,"previousProjectedLayoutForOffset",null);g(this,"resizeState",null);g(this,"resizeListenersAttached",!1);g(this,"_cards",new Map);g(this,"onDragControllerChange",()=>{const e=this.dragController.status;e!==this.lastDragControllerStatus&&(this.lastDragControllerStatus=e,e==="idle"&&(this.dragState=null,this.resetDragPreviewState()),this.scheduleRender())});g(this,"onDragControllerDrag",e=>{var c;const r=JSON.stringify(e.projectedLayout),i=ly(e),s=j4(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=oy(e.projectedLayout),h=this.shouldApplyTrackOffset(e.projectedLayout,e.source.parentId),f=e.source.parentId?this.getStackChildAnchorCardId(e.source.parentId,e.nodeId):null;this.dragTrackOffsetXPx=h?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,u,e.nodeId,e.source.parentId,f,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=u,this.lastProjectedDragLayoutSignature=r,this.lastDragDropIntent=i,this.lastActivePlaceholderId=s,this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:e.projectedLayout},this.scheduleRender();return}this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:((c=this.dragState)==null?void 0:c.projectedLayout)??e.projectedLayout};const a=this.getCachedDraggedSlotElement(e.nodeId);a&&this.writeDraggedSlotPosition(a,this.dragState)});g(this,"onDragControllerDrop",e=>{this.dragState=null,this.resetDragPreviewState(),this.commitLayout(e.layout)});g(this,"onLayoutScrollInternal",e=>{const i=e.scroll.x??0;Math.abs(i-this._scrollPosition)<Zi||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});g(this,"handleKeyDown",e=>{if(e.key==="Escape"&&this.dragController.status!=="idle"){e.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(V4(e.target)||(e.key==="ArrowRight"?(e.preventDefault(),this.stepFilmstrip(1)):e.key==="ArrowLeft"&&(e.preventDefault(),this.stepFilmstrip(-1))))});g(this,"handleWheel",e=>{if(this._layout.length===0)return;const r=H4(e);Math.abs(r)<Zi||(e.preventDefault(),this.applyHorizontalWheel(r))});g(this,"handleWindowMessage",e=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(e.source);if(r&&this.isTrustedArtifactFrameMessage(e,r)){if(sk(e.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,e.data.deltaX);return}if(ok(e.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});g(this,"handleArtifactFilmstripKey",e=>{this._layout.length!==0&&this.stepFilmstrip(e.direction)});g(this,"handleArtifactWheel",e=>{this._layout.length!==0&&(Math.abs(e.deltaX)<Zi||this.applyHorizontalWheel(e.deltaX))});g(this,"handlePointerDown",e=>{if(e.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=e.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(e,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(e.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(e);return}if(!s){if(!o){const f=r.closest(".node");if(f&&!f.hasAttribute("data-foreground")){const v=f.getAttribute("layout-node");if(v!==null){const y=parseInt(v,10);if(!isNaN(y)){const E=this.findViewspanContainingNode(y);if(E){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=Re({x:E.anchor}),e.preventDefault(),e.stopPropagation();return}}}}}return}if(o)return;const a=r.closest(".card-slot");if(!a)return;const c=a.getAttribute("data-layout-card-id");if(!c)return;const u=G4(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.resetMotionTracking(e.clientX,e.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:Pe({x:e.clientX,y:e.clientY}),grabOffset:Pe({x:e.clientX-h.left,y:e.clientY-h.top}),size:Pe({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=e.pointerId;try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()});g(this,"handleResizePointerMove",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??Yn)+ce;if(s<=0)return;const o=e.clientX-r.startClientX,a=rp(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});g(this,"handleResizePointerUp",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(e.pointerId),i!==s?this.commitLayout(u4(this._layout,o,i)):this.scheduleRender()});g(this,"handleResizePointerCancel",e=>{!this.resizeState||e.pointerId!==this.resizeState.pointerId||(this.endResize(e.pointerId),this.scheduleRender())});g(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});g(this,"handleResizeKeyDown",e=>{this.resizeState&&e.key==="Escape"&&(e.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});g(this,"handleSwipePointerMove",e=>{if(this.swipePointerId===null||e.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=e.clientX-this.swipeStartX,s=e.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Wm&&a<Wm)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(e.pointerId)}catch{}this.swipeGesture.start(e.timeStamp)}const r=e.clientX-this.swipeLastX;this.swipeLastX=e.clientX,this.swipeGesture.move(e.timeStamp,r),e.preventDefault()});g(this,"handleSwipePointerUp",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});g(this,"handleSwipePointerCancel",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});g(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});g(this,"handleSwipeClick",e=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation())});g(this,"handleWindowPointerMove",e=>{this.activeDragPointerId!==null&&e.pointerId!==this.activeDragPointerId||(this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.updatePointerVelocity(e.clientX,e.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop())});g(this,"handleWindowPointerUp",e=>{this.activeDragPointerId!==null&&e.pointerId!==this.activeDragPointerId||(this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners())});g(this,"handleWindowPointerCancel",e=>{if(!(this.activeDragPointerId!==null&&e.pointerId!==this.activeDragPointerId)){if(this.dragController.status==="active"){this.ensureDragFrameLoop();return}this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()}});g(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});g(this,"runDragFrame",e=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,e-this.lastDragFrameTime)/cy;this.lastDragFrameTime=e,this.samplePointerVelocityAt(e,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>Zi?Math.abs(o)/r:0,Math.abs(o)>Zi&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(Pe({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 cards(e){this._cards!==e&&(this._cards=e,this.scheduleRender())}get cards(){return this._cards}set layout(e){const r=[...e];this.dragController.status!=="idle"&&JSON.stringify(r)===JSON.stringify(this._layout)||(this._layout=r,this.stopDragFrameLoop(),this.dragController.cancel(),this.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Re({x:this._scrollPosition}),this.scheduleRender())}get layout(){return this._layout}commitLayout(e){this.layout=e,this.emitLayoutChanged()}set scrollPosition(e){Math.abs(e-this._scrollPosition)<Zi||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Re({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=Nr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===e));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="${hy(e)}"]`);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),this.addEventListener("artifact-filmstrip-key",this.handleArtifactFilmstripKey),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var e;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),this.removeEventListener("artifact-wheel",this.handleArtifactWheel),this.removeEventListener("artifact-filmstrip-key",this.handleArtifactFilmstripKey),window.removeEventListener("message",this.handleWindowMessage),(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,this.clearWheelIdleSnap(),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(e,r){return new qN({basis:Pe({x:Yn,y:Yn}),min:Pe({x:Zm,y:Zm}),viewport:Pe({x:e,y:r}),gap:Pe({x:ce,y:ce})})}syncScrollModel(){const e=Vh(this),i=Nr(this._layout).nodes.map(o=>o.width),s=`${e.width}x${e.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(e.width,e.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>Re({x:o})),snap:uy}))}emitScrollPositionChanged(e){this.dispatchEvent(new Z4(e))}emitLayoutChanged(){this.dispatchEvent(new c_([...this._layout]))}stepFilmstrip(e){this.clearWheelIdleSnap(),this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(e)}applyHorizontalWheel(e){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(Pe({x:e}));this.layoutScroll.wheel(Re({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},F4)}clearWheelIdleSnap(){this.wheelIdleSnapTimer!==null&&(clearTimeout(this.wheelIdleSnapTimer),this.wheelIdleSnapTimer=null)}findViewspanContainingNode(e){const r=this.layoutScroll.viewspans,i=this._scrollPosition;let s=null,o=Number.POSITIVE_INFINITY;for(const a of r)if(e>=a.nodeRange[0]&&e<=a.nodeRange[1]){const c=Math.abs(a.anchor-i);c<o&&(o=c,s=a)}return s}findManagedArtifactFrame(e){if(!e)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===e)return i;return null}isTrustedArtifactFrameMessage(e,r){if(e.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||e.origin===i}getArtifactFrameOrigin(e){const r=e.getAttribute("src")??e.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginResize(e,r){const i=r.getAttribute("data-resize-handle");if(!i)return;const s=this._layout.find(a=>a.type==="card"&&Se(a)===i);if(!s)return;const o=rp(typeof s.width=="number"?s.width:Je);this.resizeState={cardId:i,pointerId:e.pointerId,startClientX:e.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault(),e.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(e){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}beginSwipeTracking(e){this.swipePointerId=e.pointerId,this.swipeStartX=e.clientX,this.swipeStartY=e.clientY,this.swipeLastX=e.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(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}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)}getVisibleLayout(){return this.dragController.status!=="active"||!this.dragState?this.applyResizeOverride(this._layout):oy(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&Se(a)===r.cardId);if(i===-1)return e;const s=e[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return e;const o=[...e];return o[i]={...s,width:r.currentWidth},o}getGridSlotStyle(e){return`grid-column: ${e.col} / span ${e.width}; grid-row: ${e.row} / span ${e.height};`}findContainingBlock(e){let r=e.parentElement;for(;r;){const i=getComputedStyle(r);if(i.transform!=="none"||i.perspective!=="none"||i.filter!=="none")return r;const s=i.willChange;if(s.includes("transform")||s.includes("perspective")||s.includes("filter"))return r;const o=i.contain;if(o.includes("layout")||o.includes("paint")||o.includes("strict"))return r;r=r.parentElement}return document.documentElement}getDraggedSlotStyle(e){const r=this.currentDragPreviewSize??{width:e.size.x??0,height:e.size.y??0};return["position: fixed;",`width: ${r.width}px;`,`height: ${r.height}px;`,"pointer-events: none;","z-index: 10;"].join(" ")}writeDraggedSlotPosition(e,r){(!this.draggedSlotContainingBlock||!this.draggedSlotContainingBlock.isConnected||!this.draggedSlotContainingBlock.contains(e))&&(this.draggedSlotContainingBlock=this.findContainingBlock(e));const i=this.draggedSlotContainingBlock.getBoundingClientRect(),s=r.pointer.x??0,o=r.pointer.y??0,a=r.grabOffset.x??0,c=r.grabOffset.y??0,u=this.currentDragPreviewSize??{width:r.size.x??0,height:r.size.y??0},h=r.size.x??0,f=r.size.y??0,v=h>0?a*(u.width/h):a,y=f>0?c*(u.height/f):c;e.style.left=`${s-v-i.left}px`,e.style.top=`${o-y-i.top}px`,e.style.width=`${u.width}px`,e.style.height=`${u.height}px`}renderSlot(e,r){var o,a;if(e.kind==="placeholder")return e.placement?P`
398
+ */const ey=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},ty=Au(class extends wf{constructor(n){if(super(n),n.type!==bf.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);const i=[],s=[];let o=0;for(const a of n)i[o]=r?r(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){const i=VO(n),{values:s,keys:o}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),c=[];let u,h,f=0,v=i.length-1,y=0,E=s.length-1;for(;f<=v&&y<=E;)if(i[f]===null)f++;else if(i[v]===null)v--;else if(a[f]===o[y])c[y]=Tr(i[f],s[y]),f++,y++;else if(a[v]===o[E])c[E]=Tr(i[v],s[E]),v--,E--;else if(a[f]===o[E])c[E]=Tr(i[f],s[E]),po(n,c[E+1],i[f]),f++,E--;else if(a[v]===o[y])c[y]=Tr(i[v],s[y]),po(n,i[f],i[v]),v--,y++;else if(u===void 0&&(u=ey(o,y,E),h=ey(a,f,v)),u.has(a[f]))if(u.has(a[v])){const x=h.get(o[y]),C=x!==void 0?i[x]:null;if(C===null){const L=po(n,i[f]);Tr(L,s[y]),c[y]=L}else c[y]=Tr(C,s[y]),po(n,i[f],C),i[x]=null;y++}else Th(i[v]),v--;else Th(i[f]),f++;for(;y<=E;){const x=po(n,c[E+1]);Tr(x,s[y]),c[y++]=x}for(;f<=v;){const x=i[f++];x!==null&&Th(x)}return this.ut=o,HO(n,c),Si}}),Pe=n=>({type:"px",...n}),Re=n=>({type:"unit",...n}),Wl=2;class jN{constructor(t){g(this,"basis");g(this,"min");g(this,"_gap");g(this,"_viewport");g(this,"_unit");this.basis=t.basis,this.min=t.min,this._viewport=t.viewport,this._gap=t.gap??Pe({x:ce,y:ce});const e=this._viewport.x??yi,r=this._viewport.y??Zo,i=this._gap.x??ce,s=this._gap.y??ce,o=e<=eC,a=o?e-i*Wl:Math.min(yi,e-i*Wl),c=o?r-s*Wl:Math.min(Zo,r-s*Wl),u=(a-i*(Je-1))/Je,h=(c-s*(vt-1))/vt,f=this.basis.x??0,v=this.basis.y??0,y=this.min.x??0,E=this.min.y??0;this._unit=Pe(o?{x:Math.max(y,u),y:Math.max(E,h)}:{x:Math.max(y,Math.min(f,u)),y:Math.max(E,Math.min(v,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(t){return Re({x:t.x==null?void 0:t.x/(this._unit.x??1),y:t.y==null?void 0:t.y/(this._unit.y??1)})}toPixels(t){const e=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??ce,s=this._gap.y??ce,o=t.x==null?void 0:t.x*e+Math.max(0,t.x-1)*i,a=t.y==null?void 0:t.y*r+Math.max(0,t.y-1)*s;return Pe({x:o,y:a})}}const ki=1e-4,Bt=1e-6,GN=40,qN=24;function t_(n,t){return Math.max(0,n-t*2)}function n_(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function r_(n){const t=[0];for(let e=0;e<n.length;e+=1){const r=t[e]??0;t.push(r+n[e]+ce)}return t}function i_(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s<n.length;s+=1){const o=n[s],a=i===0?o:r+ce+o;if(a>e+ki)break;r=a,i+=1}return Math.max(1,i)}function YN(n,t,e){if(t<0||t>=n.length)return 0;let r=0,i=0;for(let s=t;s>=0;s-=1){const o=n[s],a=i===0?o:r+ce+o;if(a>e+ki)break;r=a,i+=1}return Math.max(1,i)}function KN(n,t){if(n.length===0)return 0;let e=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:e+ce+s;if(o>t+ki)break;e=o,r+=1}return Math.max(1,r)}function Pf(n,t){if(n.length===0)return 0;const e=KN(n,t);return Math.max(0,n.length-e)}function ny(n,t,e){if(n.length===0)return 0;const r=i_(n,t,e),i=Math.min(n.length,t+r);if(i<=t)return 0;const s=n.slice(t,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*ce}function tp(n,t,e){const r=n[t]??0;return e-r}function Ji(n,t,e,r,i){if(n.length===0)return 0;const s=Pf(n,i),o=t[s]??0,a=Math.max(0,Math.min(o,e));let c=0;for(let V=0;V<s;V+=1){const K=t[V]??0,G=t[V+1]??K;if(a>=K&&a<=G+ki){c=V;break}c=V+1}const u=Math.min(c+1,s),h=t[c]??0,f=t[u]??h,v=Math.max(f-h,ki),y=u===c?0:(a-h)/v,E=r_(n),x=ny(n,c,i),C=ny(n,u,i),L=(r-x)/2,R=(r-C)/2,W=tp(E,c,L),N=tp(E,u,R);return W+(N-W)*y}function JN(n,t,e,r,i){const s=Pf(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<GN;u+=1){const h=(a+c)/2;Ji(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function XN(n,t,e){const r=r_(n),[i,s]=t,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ce,c=(e-a)/2;return tp(r,i,c)}function QN(n,t,e){const r=i_(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function e4(n,t,e){const r=YN(n,t,e);return[Math.max(0,t-r+1),t]}function t4(n,t){return n[0]===t[0]&&n[1]===t[1]}function n4(n){const{nodeCols:t,nodeWidthsPx:e,viewportWidthPx:r}=n;if(t.length===0||e.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=e.length,s=n.gapPx??ce,o=t_(r,s),a=n_(t),c=Pf(e,o),u=a[c]??0;function h(C){const L=XN(e,C,r),R=JN(e,a,r,o,L);return{nodeRange:C,anchor:Math.max(0,Math.min(u,R))}}const f=[];for(let C=0;C<i;){const L=QN(e,C,o);f.push(h(L)),C=L[1]+1}const v=h(e4(e,i-1,o)),y=f.filter(C=>C.nodeRange[0]<v.nodeRange[0]),E=y[y.length-1];return{viewspans:E&&t4(E.nodeRange,v.nodeRange)?y:[...y,v],minScroll:0,maxScroll:u}}function Vi(n,t){var i;let e=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)-t);if(o+Bt<r){r=o,e=s;continue}Math.abs(o-r)<=Bt&&s<e&&(e=s)}return e}function r4(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function $r(n,t,e){return Math.max(t,Math.min(e,n))}function i4(n,t){var e;for(let r=0;r<n.length;r+=1)if(Math.abs((((e=n[r])==null?void 0:e.anchor)??0)-t)<=Bt)return r;return-1}function s4(n,t,e){var i,s;if(n.length===0)return t;const r=i4(n,t);if(r>=0){const o=n[r+e];return(o==null?void 0:o.anchor)??n[e>0?n.length-1:0].anchor}if(e>0){for(const o of n)if(o.anchor>t+Bt)return o.anchor;return((i=n[n.length-1])==null?void 0:i.anchor)??t}for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a&&a.anchor<t-Bt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class o4 extends It{constructor(e){super();g(this,"_scroll",0);g(this,"_minScroll",0);g(this,"_maxScroll",0);g(this,"_viewspans",[]);g(this,"_activeViewspanIndex",0);g(this,"_nodeWidthsPx",[]);g(this,"_boundaryCols",[0]);g(this,"_viewportWidthPx",0);g(this,"_framedViewportWidthPx",0);this._scroll=(e==null?void 0:e.x)??0}get scroll(){return Re({x:this._scroll})}get translate(){return Pe({x:Ji(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx)})}get activeViewspan(){return this._viewspans[this._activeViewspanIndex]??null}get viewspans(){return this._viewspans}set scroll(e){const r=$r(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Bt||(this._scroll=r,this._activeViewspanIndex=Vi(this._viewspans,this._scroll),this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}rebuild(e){var v;const r=e.nodeWidths.map(y=>Math.max(0,y.x??0)),i=r.map(y=>e.grid.toPixels(Re({x:y})).x??0),s=e.grid.viewport.x??0,o=e.grid.gap.x??ce,a=n4({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=n_(r),this._viewportWidthPx=s,this._framedViewportWidthPx=t_(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=$r(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=Vi(this._viewspans,c);const h=e.snap!==!1?((v=this._viewspans[this._activeViewspanIndex])==null?void 0:v.anchor)??c:c,f=$r(h,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)>Bt&&(this._scroll=f,this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=r4(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=$r(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=Bt)&&(this._scroll=s,this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[Vi(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:s4(this._viewspans,this._scroll,e),i=$r(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=Vi(this._viewspans,i),!(Math.abs(i-this._scroll)<=Bt)&&(this._scroll=i,this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=$r(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Bt||(this._scroll=r,this._activeViewspanIndex=Vi(this._viewspans,this._scroll),this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=ki)return;const i=Ji(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=Ji(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=Ji(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=ki)return;let u=this._minScroll,h=this._maxScroll;for(let v=0;v<qN;v+=1){const y=(u+h)/2;Ji(this._nodeWidthsPx,this._boundaryCols,y,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=y:h=y}const f=$r((u+h)/2,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)<=Bt||(this._scroll=f,this._activeViewspanIndex=Vi(this._viewspans,this._scroll),this.dispatchEvent(new Hi("layout-scroll",{scroll:this.scroll})))}}const Nh={"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}},a4=["stack-above","stack-below","reorder-before","reorder-after"];function Uh(n,t){return{left:n.left+n.width*t.left,top:n.top+n.height*t.top,width:n.width*t.width,height:n.height*t.height}}function Cr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function os(n){return n.artifactID}function np(n){return Number.isFinite(n)?Math.max(Vo,Math.min(nf,Math.round(n))):Vo}function l4(n,t,e){const r=n.findIndex(a=>a.type==="card"&&os(a)===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=np(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function s_(n,t){for(const e of n){if(e.type==="card"&&os(e)===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&os(r)===t)return r;if(r.type==="row"){for(const i of r.children)if(os(i)===t)return i}}}return null}function rp(n){const t=n.height===vt||n.height===dr?dr:n.height;return n.width===Je&&n.height===t?n:{...n,width:Je,height:t}}function ip(n){return n.height===dr?{...n,height:vt}:n}function c4(n,t,e,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===t);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"&&os(h)===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.type!=="card"||os(h)!==e);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"?ip(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,ip(o)),c}const u4=Fe(),h4=Fe(),d4=50;function p4(n,t){if(n.type!==t.type)return!1;switch(n.type){case"reorder":return t.index===n.index;case"stack":return t.targetCardId===n.targetCardId&&t.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return t.toIndex===n.toIndex;case"stack-child-reorder":return t.position===n.position;default:return!1}}function nt(n){return n.artifactID}function ry(n){return n.type==="card"?nt(n):n.id}function yl(n){return{id:nt(n),type:"drop-target",width:n.width,height:n.height}}function iy(n){return n.map(g4)}function f4(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function g4(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(f4)}:n}function o_(n,t){return n.find(r=>r.type==="card"&&nt(r)===t)??null}function sy(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function m4(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&nt(a)===n.nodeId);if(r===-1)return null;const i=e[r];if(!i||i.type!=="card")return null;e.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,e.length));e.splice(s,0,i);const o=e.findIndex(a=>a.type==="card"&&nt(a)===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function v4(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(v=>v.type==="card"&&nt(v)===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=o_(r,t.nodeId);if(!a)return null;const c=rp(a),u=rp(o),h=yl(c),f=e.position==="above"?[h,u]:[u,h];return i[s]={id:nt(o),type:"stack",children:f},i}function Fh(n,t){return n.parentStackId?b4(n,t):y4(n,t)}function y4(n,t){const e=n.hitTarget;if(e.type==="reorder"){const r=t[n.sourceIndex];if(!r||r.type!=="card")return[...t];const i=[...t];return i.splice(n.sourceIndex,1),i.splice(e.index,0,yl(r)),i}if(e.type==="stack"){const r=m4(n,t);return r?v4(r,n,e,t)??[...t]:[...t]}return[...t]}function b4(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return w4(n,t,e.position);case"stack-child-extract":return S4(n,t,e.toIndex);case"stack-child-noop":return _4(n,t);default:return[...t]}}function w4(n,t,e){const r=t.findIndex(v=>v.type==="stack"&&v.id===n.parentStackId);if(r===-1)return[...t];const i=t[r];if(!i||i.type!=="stack")return[...t];if(!i.children.every(v=>v.type==="card"))return[...t];const s=i.children,o=s.findIndex(v=>nt(v)===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(v=>nt(v)!==n.nodeId),u=yl(a),h=e==="above"?[u,...c]:[...c,u],f=[...t];return f[r]={...i,children:h},f}function S4(n,t,e){if(!n.parentStackId)return[...t];const r=c4(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&nt(a)===n.nodeId);if(i===-1)return[...t];const s=r[i];if(!s||s.type!=="card")return[...t];const o=[...r];return o[i]=yl(s),o}function _4(n,t){const e=t.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(e===-1)return[...t];const r=t[e];if(!r||r.type!=="stack")return[...t];const i=r.children.findIndex(c=>c.type==="card"&&nt(c)===n.nodeId);if(i===-1)return[...t];const s=r.children[i];if(!s||s.type!=="card")return[...t];const o=[...t],a=[...r.children];return a[i]=yl(s),o[e]={...r,children:a},o}function k4(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:fu()}function E4(n,t,e){if(n.type==="drop-target"){const r=s_(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return rp(r)}return n}function x4(n,t,e){const r=n.children.map(s=>E4(s,t,e));return{id:k4(n,t),type:"stack",children:r}}function A4(n,t,e){if(n.type==="drop-target"){const r=s_(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return o_(t,e)!==null?r:ip(r)}return n.type==="card"||n.type==="row"?n:x4(n,t,e)}function T4(n,t,e){return n.map(r=>A4(r,t,e))}function $4(n,t){return JSON.stringify(n)===JSON.stringify(t)}const C4=gl(It);class I4 extends C4{constructor(e={}){super();g(this,"pending",null);g(this,"active",null)}start(e){if(this.pending||this.active)return;const r=e.pointer.x??0,i=e.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:e.grabOffset.x??0,grabOffsetY:e.grabOffset.y??0,nodeId:e.nodeId,sourceIndex:e.source.index,parentStackId:e.source.parentId,width:e.size.x??0,height:e.size.y??0,baseLayout:e.layout}}update(e){const r=e.pointer.x??0,i=e.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=nC&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new ie("change")));return}if(!this.active)return;const o=Fh(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,e,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&p4(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 ie("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const e=this.active.baseLayout;let r=null;try{const i=Fh(this.active,e),s=T4(i,e,this.active.nodeId);$4(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new h4("drop",{layout:r})),this.dispatchEvent(new ie("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new ie("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 e=Fh(this.active,this.active.baseLayout);this.dispatchEvent(new u4("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:Pe({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:Pe({x:this.active.pointerX,y:this.active.pointerY}),size:Pe({x:this.active.width,y:this.active.height}),projectedLayout:e}))}getHitTargetForPointer(e,r,i,s){return this.active?this.isPointerInsideDragBounds(e,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(e,r,i,s):this.getTopLevelCardHitTarget(e,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(e,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&&Cr(e,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&&Cr(e,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(e,r,i,s)}}getSourceRemainingSiblingRect(e){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=sy(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&nt(a)!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===nt(i)))==null?void 0:o.rect}getSourceStackInteractionRect(e){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=e.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=sy(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&nt(a)!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===nt(s));if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(e,r,i,s){var y,E,x;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((y=this.active)==null?void 0:y.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=d4;for(const C of o){const L=C.rect;if(!Cr(e,r,L))continue;const R=this.resolveTopLevelTargetForCard(e,r,C,C.logicalIndex,c);if(R)return R;if(!c&&((E=this.active)!=null&&E.hitTarget))return this.active.hitTarget.type==="reorder"?this.active.hitTarget:this.active.hitTarget.type==="stack"&&this.active.hitTarget.targetCardId===C.id?this.active.hitTarget:{type:"reorder",index:e<this.active.pointerX?C.logicalIndex:C.logicalIndex+1}}const u=this.getNearestTargetableZone(e,o);if(!u)return{type:"reorder",index:((x=this.active)==null?void 0:x.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,e)),f=this.resolveTopLevelTargetForCard(h,r,u,u.logicalIndex,c);if(f)return f;const v=u.rect.left+u.rect.width/2;return{type:"reorder",index:e<v?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(e,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 f of o){if(!Cr(e,r,f.rect))continue;const v=Uh(f.rect,Nh["reorder-before"]);if(Cr(e,r,v))return f.logicalIndex;const y=Uh(f.rect,Nh["reorder-after"]);if(Cr(e,r,y))return f.logicalIndex+1}const a=this.getNearestTargetableZone(e,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return e<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(e,r){const i=new Map(r.map(a=>[ry(a),a])),s=[];let o=0;for(const a of e){const c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:ry(c),rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of a4){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Nh[c],h=Uh(a,u);if(Cr(e,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(e,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=e<a?a-e:e>c?e-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(e,r,i){return e>=i.left&&e<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const R4=100,P4=1e3;class L4{constructor(t,e){g(this,"_status","idle");g(this,"cumulativeOffset",0);g(this,"samples",[]);g(this,"scroll");g(this,"setAnimating");this.scroll=t,this.setAnimating=e}get status(){return this._status}start(t){this._status="active",this.cumulativeOffset=0,this.samples=[{time:t,offset:0}]}move(t,e){this._status==="active"&&(this.cumulativeOffset+=e,this.samples.push({time:t,offset:this.cumulativeOffset}),this.pruneSamples(t),this.setAnimating(!1),this.scroll.wheelPixels(Pe({x:-e})))}end(){if(this._status!=="active")return;const t=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(t)<iC?this.scroll.snap():this.scroll.snap(t>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(t){const e=t-R4;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=e){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 t=this.samples[0],e=this.samples[this.samples.length-1],r=e.time-t.time;return r<=0?0:(e.offset-t.offset)/r*P4}}function rs(n){return n.artifactID}function D4(n){return n.type==="card"?rs(n):n.id}function M4({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var E;const a=new Map(t.map(x=>[D4(x),x])),c=e.nodes.map((x,C)=>{const L=a.get(x.id),R=[];for(const N of x.cards){if(s&&N.artifactID===s.nodeId){R.push({key:`placeholder:${N.artifactID}`,kind:"placeholder",card:null,placement:N,isTopLevelCard:!1,isDragged:!1,sourceStackId:s.source.parentId??null});continue}const V=r.get(N.artifactID);V&&R.push({key:rs(V),kind:"card",card:V,placement:N,isTopLevelCard:(L==null?void 0:L.type)==="card",isDragged:!1,sourceStackId:null})}if(s!=null&&s.source.parentId&&x.id===s.source.parentId){const N=r.get(s.nodeId);if(N){const V={key:rs(N),kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},K=z4(n,s.source.parentId,s.nodeId),G=K<0?R.length:Math.min(K,R.length);R.splice(G,0,V)}}const W=!!(s&&(L==null?void 0:L.type)==="card"&&rs(L)===s.nodeId);return{key:W?`placeholder:${x.id}`:x.id,kind:"visible",nodeId:x.id,widthPx:i.toPixels(Re({x:x.width})).x??0,widthUnits:x.width,layoutIndex:C,isForeground:o(C),isPlaceholder:W,slots:R}});if(!s||s.source.parentId&&a.has(s.source.parentId))return c;const u=r.get(s.nodeId);if(!u)return c;const h=s.source.parentId??s.nodeId,f=((E=Nr(n).nodes[s.source.index])==null?void 0:E.width)??Je,v={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:f,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:rs(u),kind:"card",card:u,placement:null,isTopLevelCard:!s.source.parentId,isDragged:!0,sourceStackId:s.source.parentId??null}]},y=Math.max(0,Math.min(s.source.index,c.length));return c.splice(y,0,v),c}function oy(n){if(!n)return null;const t=n.projectedLayout,e=n.source.parentId;for(const i of t){if(i.type!=="stack")continue;const s=i.children.findIndex(u=>u.type==="drop-target");if(s===-1)continue;const o=s===0?"above":"below";if(e&&e===i.id)return`stack-child-reorder:${o}`;const a=i.children.find(u=>u.type!=="drop-target");return`stack:${(a==null?void 0:a.type)==="card"?a.artifactID:(a==null?void 0:a.id)??""}:${o}`}const r=t.findIndex(i=>i.type==="drop-target");return r===-1?"none":e?`stack-child-extract:${r}`:`reorder:${r}`}function z4(n,t,e){const r=n.find(i=>i.type==="stack"&&i.id===t);return!r||r.type!=="stack"?-1:r.children.findIndex(i=>i.type==="card"&&rs(i)===e)}const O4=2,ay=1e3,Zi=1e-4,N4=120,ly=!1;function cy(n){return n.replace(/["\\]/g,"\\$&")}function Se(n){return n.artifactID}function as(n){return n.type==="card"?Se(n):n.id}function uy(n,t,e){if(n===0)return 0;const r=t.toPixels(Re({y:vt})).y??0;return(e-r)/O4}function Hh(n){const t=n.clientWidth>0?n.clientWidth:yi,e=n.clientHeight>0?n.clientHeight:Zo;let r=0,i=0;if(n.isConnected){const u=getComputedStyle(n);r=parseFloat(u.paddingTop)||0,i=parseFloat(u.paddingBottom)||0}const s=Math.max(1,e-r-i),o=n.isConnected&&parseFloat(getComputedStyle(n).getPropertyValue("--layout-virtual-bottom-balance"))||0,a=Zo+ce*2,c=Math.min(o,Math.max(0,s-a));return{width:t,height:s-c,offsetY:r}}function U4(n){return n.shiftKey&&n.deltaX===0&&n.deltaY!==0?n.deltaY:n.deltaX}function F4(n){var e;if(!(n instanceof Element))return!1;const t=n.closest("input, textarea, select, [contenteditable], [role='textbox'], [role='searchbox'], [role='combobox'], [role='spinbutton'], [role='slider']");return t?t.hasAttribute("contenteditable")?((e=t.getAttribute("contenteditable"))==null?void 0:e.toLowerCase())!=="false":!0:!1}class H4 extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});g(this,"scrollPosition");this.scrollPosition=e}}class a_ extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});g(this,"layout");this.layout=e}}class V4 extends HTMLElement{constructor(){super();g(this,"_layout",[]);g(this,"_scrollPosition",0);g(this,"layoutGrid",null);g(this,"layoutScroll",new o4(Re({x:0})));g(this,"scrollModelKey","");g(this,"resizeObserver",null);g(this,"renderPending",!1);g(this,"animateNextRender",!0);g(this,"swipeGesture",new L4(this.layoutScroll,e=>{this.animateNextRender=e}));g(this,"swipePointerId",null);g(this,"swipeStartX",0);g(this,"swipeStartY",0);g(this,"swipeLastX",0);g(this,"swipeActive",!1);g(this,"swipeShouldSuppressClick",!1);g(this,"swipeListenersAttached",!1);g(this,"wheelIdleSnapTimer",null);g(this,"dragController",new I4);g(this,"dragState",null);g(this,"activeDragPointerId",null);g(this,"dragListenersAttached",!1);g(this,"dragFrame",0);g(this,"lastDragFrameTime",0);g(this,"lastPointerX",0);g(this,"lastPointerY",0);g(this,"pointerVelocityPxPerSec",0);g(this,"scrollVelocityPxPerSec",0);g(this,"motionSampleTime",0);g(this,"motionSampleX",0);g(this,"motionSampleY",0);g(this,"lastDragControllerStatus","idle");g(this,"lastProjectedDragLayoutSignature","");g(this,"lastDragDropIntent",null);g(this,"lastActivePlaceholderId",null);g(this,"draggedSlotElement",null);g(this,"draggedSlotContainingBlock",null);g(this,"currentDragPreviewSize",null);g(this,"dragTrackOffsetXPx",0);g(this,"previousProjectedLayoutForOffset",null);g(this,"resizeState",null);g(this,"resizeListenersAttached",!1);g(this,"_cards",new Map);g(this,"onDragControllerChange",()=>{const e=this.dragController.status;e!==this.lastDragControllerStatus&&(this.lastDragControllerStatus=e,e==="idle"&&(this.dragState=null,this.resetDragPreviewState()),this.scheduleRender())});g(this,"onDragControllerDrag",e=>{var c;const r=JSON.stringify(e.projectedLayout),i=oy(e),s=B4(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=iy(e.projectedLayout),h=this.shouldApplyTrackOffset(e.projectedLayout,e.source.parentId),f=e.source.parentId?this.getStackChildAnchorCardId(e.source.parentId,e.nodeId):null;this.dragTrackOffsetXPx=h?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,u,e.nodeId,e.source.parentId,f,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=u,this.lastProjectedDragLayoutSignature=r,this.lastDragDropIntent=i,this.lastActivePlaceholderId=s,this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:e.projectedLayout},this.scheduleRender();return}this.dragState={nodeId:e.nodeId,source:e.source,grabOffset:e.grabOffset,pointer:e.pointer,size:e.size,projectedLayout:((c=this.dragState)==null?void 0:c.projectedLayout)??e.projectedLayout};const a=this.getCachedDraggedSlotElement(e.nodeId);a&&this.writeDraggedSlotPosition(a,this.dragState)});g(this,"onDragControllerDrop",e=>{this.dragState=null,this.resetDragPreviewState(),this.commitLayout(e.layout)});g(this,"onLayoutScrollInternal",e=>{const i=e.scroll.x??0;Math.abs(i-this._scrollPosition)<Zi||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});g(this,"handleKeyDown",e=>{if(e.key==="Escape"&&this.dragController.status!=="idle"){e.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(F4(e.target)||(e.key==="ArrowRight"?(e.preventDefault(),this.stepFilmstrip(1)):e.key==="ArrowLeft"&&(e.preventDefault(),this.stepFilmstrip(-1))))});g(this,"handleWheel",e=>{if(this._layout.length===0)return;const r=U4(e);Math.abs(r)<Zi||(e.preventDefault(),this.applyHorizontalWheel(r))});g(this,"handleWindowMessage",e=>{if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(e.source);if(r&&this.isTrustedArtifactFrameMessage(e,r)){if(rk(e.data)){const i=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(i),this.swipeGesture.move(i,e.data.deltaX);return}if(ik(e.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}}});g(this,"handleArtifactFilmstripKey",e=>{this._layout.length!==0&&this.stepFilmstrip(e.direction)});g(this,"handleArtifactWheel",e=>{this._layout.length!==0&&(Math.abs(e.deltaX)<Zi||this.applyHorizontalWheel(e.deltaX))});g(this,"handlePointerDown",e=>{if(e.button!==0||this.dragController.status!=="idle"||this.resizeState)return;const r=e.target;if(!(r instanceof Element))return;const i=r.closest("[data-resize-handle]");if(i){this.beginResize(e,i);return}const s=r.closest("[drag-handle]")!==null,o=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(e.pointerType==="touch"&&!s&&!o&&this._layout.length>0){this.beginSwipeTracking(e);return}if(!s){if(!o){const f=r.closest(".node");if(f&&!f.hasAttribute("data-foreground")){const v=f.getAttribute("layout-node");if(v!==null){const y=parseInt(v,10);if(!isNaN(y)){const E=this.findViewspanContainingNode(y);if(E){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=Re({x:E.anchor}),e.preventDefault(),e.stopPropagation();return}}}}}return}if(o)return;const a=r.closest(".card-slot");if(!a)return;const c=a.getAttribute("data-layout-card-id");if(!c)return;const u=W4(this._layout,c);if(!u)return;const h=a.getBoundingClientRect();this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.resetMotionTracking(e.clientX,e.clientY),this.focus(),this.dragController.start({nodeId:c,source:{index:u.topLevelIndex,parentId:u.sourceStackId},pointer:Pe({x:e.clientX,y:e.clientY}),grabOffset:Pe({x:e.clientX-h.left,y:e.clientY-h.top}),size:Pe({x:h.width,y:h.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=e.pointerId;try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()});g(this,"handleResizePointerMove",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=this.layoutGrid,s=((i==null?void 0:i.unit.x)??Yn)+ce;if(s<=0)return;const o=e.clientX-r.startClientX,a=np(r.startWidth+o/s);a!==r.currentWidth&&(r.currentWidth=a,this.scheduleRender())});g(this,"handleResizePointerUp",e=>{const r=this.resizeState;if(!r||e.pointerId!==r.pointerId)return;const i=r.currentWidth,s=r.startWidth,o=r.cardId;this.endResize(e.pointerId),i!==s?this.commitLayout(l4(this._layout,o,i)):this.scheduleRender()});g(this,"handleResizePointerCancel",e=>{!this.resizeState||e.pointerId!==this.resizeState.pointerId||(this.endResize(e.pointerId),this.scheduleRender())});g(this,"handleResizeWindowBlur",()=>{this.resizeState&&(this.endResize(this.resizeState.pointerId),this.scheduleRender())});g(this,"handleResizeKeyDown",e=>{this.resizeState&&e.key==="Escape"&&(e.preventDefault(),this.endResize(this.resizeState.pointerId),this.scheduleRender())});g(this,"handleSwipePointerMove",e=>{if(this.swipePointerId===null||e.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=e.clientX-this.swipeStartX,s=e.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Zm&&a<Zm)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(e.pointerId)}catch{}this.swipeGesture.start(e.timeStamp)}const r=e.clientX-this.swipeLastX;this.swipeLastX=e.clientX,this.swipeGesture.move(e.timeStamp,r),e.preventDefault()});g(this,"handleSwipePointerUp",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});g(this,"handleSwipePointerCancel",e=>{this.swipePointerId===null||e.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(e.pointerId),this.endSwipeTracking())});g(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});g(this,"handleSwipeClick",e=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation())});g(this,"handleWindowPointerMove",e=>{this.activeDragPointerId!==null&&e.pointerId!==this.activeDragPointerId||(this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.updatePointerVelocity(e.clientX,e.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop())});g(this,"handleWindowPointerUp",e=>{this.activeDragPointerId!==null&&e.pointerId!==this.activeDragPointerId||(this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners())});g(this,"handleWindowPointerCancel",e=>{if(!(this.activeDragPointerId!==null&&e.pointerId!==this.activeDragPointerId)){if(this.dragController.status==="active"){this.ensureDragFrameLoop();return}this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(e.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()}});g(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});g(this,"runDragFrame",e=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,e-this.lastDragFrameTime)/ay;this.lastDragFrameTime=e,this.samplePointerVelocityAt(e,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>Zi?Math.abs(o)/r:0,Math.abs(o)>Zi&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(Pe({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 cards(e){this._cards!==e&&(this._cards=e,this.scheduleRender())}get cards(){return this._cards}set layout(e){const r=[...e];this.dragController.status!=="idle"&&JSON.stringify(r)===JSON.stringify(this._layout)||(this._layout=r,this.stopDragFrameLoop(),this.dragController.cancel(),this.resizeState&&this.endResize(this.resizeState.pointerId),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Re({x:this._scrollPosition}),this.scheduleRender())}get layout(){return this._layout}commitLayout(e){this.layout=e,this.emitLayoutChanged()}set scrollPosition(e){Math.abs(e-this._scrollPosition)<Zi||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Re({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=Nr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===e));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="${cy(e)}"]`);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),this.addEventListener("artifact-filmstrip-key",this.handleArtifactFilmstripKey),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var e;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),this.removeEventListener("artifact-wheel",this.handleArtifactWheel),this.removeEventListener("artifact-filmstrip-key",this.handleArtifactFilmstripKey),window.removeEventListener("message",this.handleWindowMessage),(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,this.clearWheelIdleSnap(),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(e,r){return new jN({basis:Pe({x:Yn,y:Yn}),min:Pe({x:Hm,y:Hm}),viewport:Pe({x:e,y:r}),gap:Pe({x:ce,y:ce})})}syncScrollModel(){const e=Hh(this),i=Nr(this._layout).nodes.map(o=>o.width),s=`${e.width}x${e.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(e.width,e.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>Re({x:o})),snap:ly}))}emitScrollPositionChanged(e){this.dispatchEvent(new H4(e))}emitLayoutChanged(){this.dispatchEvent(new a_([...this._layout]))}stepFilmstrip(e){this.clearWheelIdleSnap(),this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(e)}applyHorizontalWheel(e){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(Pe({x:e}));this.layoutScroll.wheel(Re({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},N4)}clearWheelIdleSnap(){this.wheelIdleSnapTimer!==null&&(clearTimeout(this.wheelIdleSnapTimer),this.wheelIdleSnapTimer=null)}findViewspanContainingNode(e){const r=this.layoutScroll.viewspans,i=this._scrollPosition;let s=null,o=Number.POSITIVE_INFINITY;for(const a of r)if(e>=a.nodeRange[0]&&e<=a.nodeRange[1]){const c=Math.abs(a.anchor-i);c<o&&(o=c,s=a)}return s}findManagedArtifactFrame(e){if(!e)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===e)return i;return null}isTrustedArtifactFrameMessage(e,r){if(e.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||e.origin===i}getArtifactFrameOrigin(e){const r=e.getAttribute("src")??e.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginResize(e,r){const i=r.getAttribute("data-resize-handle");if(!i)return;const s=this._layout.find(a=>a.type==="card"&&Se(a)===i);if(!s)return;const o=np(typeof s.width=="number"?s.width:Je);this.resizeState={cardId:i,pointerId:e.pointerId,startClientX:e.clientX,startWidth:o,currentWidth:o},this.attachResizeListeners();try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault(),e.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(e){this.resizeState=null,this.detachResizeListeners();try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}beginSwipeTracking(e){this.swipePointerId=e.pointerId,this.swipeStartX=e.clientX,this.swipeStartY=e.clientY,this.swipeLastX=e.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(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(e){try{this.hasPointerCapture(e)&&this.releasePointerCapture(e)}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)}getVisibleLayout(){return this.dragController.status!=="active"||!this.dragState?this.applyResizeOverride(this._layout):iy(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&Se(a)===r.cardId);if(i===-1)return e;const s=e[i];if(!s||s.type!=="card"||s.width===r.currentWidth)return e;const o=[...e];return o[i]={...s,width:r.currentWidth},o}getGridSlotStyle(e){return`grid-column: ${e.col} / span ${e.width}; grid-row: ${e.row} / span ${e.height};`}findContainingBlock(e){let r=e.parentElement;for(;r;){const i=getComputedStyle(r);if(i.transform!=="none"||i.perspective!=="none"||i.filter!=="none")return r;const s=i.willChange;if(s.includes("transform")||s.includes("perspective")||s.includes("filter"))return r;const o=i.contain;if(o.includes("layout")||o.includes("paint")||o.includes("strict"))return r;r=r.parentElement}return document.documentElement}getDraggedSlotStyle(e){const r=this.currentDragPreviewSize??{width:e.size.x??0,height:e.size.y??0};return["position: fixed;",`width: ${r.width}px;`,`height: ${r.height}px;`,"pointer-events: none;","z-index: 10;"].join(" ")}writeDraggedSlotPosition(e,r){(!this.draggedSlotContainingBlock||!this.draggedSlotContainingBlock.isConnected||!this.draggedSlotContainingBlock.contains(e))&&(this.draggedSlotContainingBlock=this.findContainingBlock(e));const i=this.draggedSlotContainingBlock.getBoundingClientRect(),s=r.pointer.x??0,o=r.pointer.y??0,a=r.grabOffset.x??0,c=r.grabOffset.y??0,u=this.currentDragPreviewSize??{width:r.size.x??0,height:r.size.y??0},h=r.size.x??0,f=r.size.y??0,v=h>0?a*(u.width/h):a,y=f>0?c*(u.height/f):c;e.style.left=`${s-v-i.left}px`,e.style.top=`${o-y-i.top}px`,e.style.width=`${u.width}px`,e.style.height=`${u.height}px`}renderSlot(e,r){var o,a;if(e.kind==="placeholder")return e.placement?P`
399
399
  <div
400
400
  class="card-slot card-placeholder"
401
401
  data-layout-placeholder-for=${(r==null?void 0:r.nodeId)??""}
@@ -430,14 +430,14 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
430
430
  style=${e.kind==="visible"?`width: ${e.widthPx}px; --card-width-px: ${e.widthPx};`:""}
431
431
  >
432
432
  <div class="node-inner" style=${`grid-template-columns: repeat(${e.widthUnits}, var(--layout-unit-x));`}>
433
- ${ry(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
433
+ ${ty(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
434
434
  </div>
435
435
  </div>
436
- `}render(){var K;const e=Vh(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=Nr(i),a=o.nodes.map(G=>G.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(G=>Re({x:G})),snap:uy}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=W4(this._layout),h=r.unit.x??Yn,f=r.unit.y??Yn,v=s?this.dragTrackOffsetXPx:0,y=(this.layoutScroll.translate.x??0)+v,E=dy(o.nodes.length,r,e.height),x=this.animateNextRender&&!s,C=[`transform: translate(${y}px, ${E}px);`,`transition-duration: ${x?rC:0}ms;`,`pointer-events: ${s?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${h}px`),this.style.setProperty("--layout-unit-y",`${f}px`),this.style.setProperty("--layout-gap",`${ce}px`);const L=this.dragState,R=new Set;{let G=y;for(let he=0;he<o.nodes.length;he+=1){const Lt=r.toPixels(Re({x:o.nodes[he].width})).x??0,_r=G+Lt;G>=-1&&_r<=e.width+1&&R.add(he),G=_r+ce}}const W=G=>R.has(G),N=O4({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:W}),V=ly(this.dragState);if(V?this.setAttribute("data-test-drop-intent",V):this.removeAttribute("data-test-drop-intent"),this.dragState){let G=null;for(const he of o.nodes){for(const Lt of he.cards)if(Lt.artifactID===this.dragState.nodeId){G={width:r.toPixels(Re({x:Lt.width})).x??0,height:r.toPixels(Re({y:Lt.height})).y??0};break}if(G)break}this.currentDragPreviewSize=G??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ue(P`
436
+ `}render(){var K;const e=Hh(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=Nr(i),a=o.nodes.map(G=>G.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(G=>Re({x:G})),snap:ly}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=Z4(this._layout),h=r.unit.x??Yn,f=r.unit.y??Yn,v=s?this.dragTrackOffsetXPx:0,y=(this.layoutScroll.translate.x??0)+v,E=uy(o.nodes.length,r,e.height),x=this.animateNextRender&&!s,C=[`transform: translate(${y}px, ${E}px);`,`transition-duration: ${x?tC:0}ms;`,`pointer-events: ${s?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${h}px`),this.style.setProperty("--layout-unit-y",`${f}px`),this.style.setProperty("--layout-gap",`${ce}px`);const L=this.dragState,R=new Set;{let G=y;for(let he=0;he<o.nodes.length;he+=1){const Lt=r.toPixels(Re({x:o.nodes[he].width})).x??0,_r=G+Lt;G>=-1&&_r<=e.width+1&&R.add(he),G=_r+ce}}const W=G=>R.has(G),N=M4({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:W}),V=oy(this.dragState);if(V?this.setAttribute("data-test-drop-intent",V):this.removeAttribute("data-test-drop-intent"),this.dragState){let G=null;for(const he of o.nodes){for(const Lt of he.cards)if(Lt.artifactID===this.dragState.nodeId){G={width:r.toPixels(Re({x:Lt.width})).x??0,height:r.toPixels(Re({y:Lt.height})).y??0};break}if(G)break}this.currentDragPreviewSize=G??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ue(P`
437
437
  <div class="track" style=${C}>
438
- ${ry(N,G=>G.key,G=>this.renderNode(G,L))}
438
+ ${ty(N,G=>G.key,G=>this.renderNode(G,L))}
439
439
  </div>
440
- `,this),this.syncCardElements(u,L?((K=u.get(L.nodeId))==null?void 0:K.artifactID)??null:null),this.syncDraggedSlotElement(L)}syncCardElements(e,r){var o;const i=new Map;for(const a of this.querySelectorAll(".card-content-mount[data-mount-for]")){const c=a.getAttribute("data-mount-for");c&&i.set(c,a)}const s=new Set;for(const a of e.values()){const c=this._cards.get(a.artifactID);if(!c)continue;s.add(a.artifactID);const u=i.get(Se(a));if(!u){c.removeAttribute("data-dragging");continue}const h=(o=u.parentElement)==null?void 0:o.getAttribute("data-layout-card-id");console.assert(h===Se(a),`layout-view: mount mismatch for ${Se(a)}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${Se(a)}`),c.toggleAttribute("data-dragging",a.artifactID===r)}for(const[a,c]of this._cards)s.has(a)||c.removeAttribute("data-dragging")}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 e=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);this.syncDragTarget(i.x,i.y,e);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,e),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,e)}syncDragTarget(e,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getVisibleLayout(),o=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,a=this.measureLayoutGeometry(s,o);this.dragController.update({pointer:Pe({x:e,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:a,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(e,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=e,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(e,r){this.samplePointerVelocityAt(performance.now(),e,r)}samplePointerVelocityAt(e,r,i){if(this.motionSampleTime===0){this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=e-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*cy,this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(e,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,e)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}getDragEdgeScrollDeltaPixels(e,r,i){var u;const s=r.left+zl,o=r.left+r.width-zl,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Yn,c=sC*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/zl));return-(c*h**Bm)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/zl));return c*h**Bm*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=Nr(e),o=new Map(s.nodes.map(E=>[E.id,E.width])),a=i.toPixels(Re({y:vt})).y??Zo,c=Vh(this),u=(this.layoutScroll.translate.x??0)+r,h=dy(s.nodes.length,i,c.height),f=c.offsetY+h,v=[];let y=u;for(const E of e){const x=as(E),C=o.get(x)??Je,L=i.toPixels(Re({x:C})).x??yi,R={left:y,top:f,width:L,height:a};v.push({id:x,rect:R}),y+=L+ce}return v}resetDragPreviewState(){this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.lastProjectedDragLayoutSignature="",this.lastDragDropIntent=null,this.lastActivePlaceholderId=null,this.draggedSlotElement=null,this.draggedSlotContainingBlock=null,this.currentDragPreviewSize=null}getCachedDraggedSlotElement(e){var r;return(r=this.draggedSlotElement)!=null&&r.isConnected&&this.draggedSlotElement.getAttribute("data-layout-card-id")===e&&this.draggedSlotElement.getAttribute("data-layout-drag-source")==="true"?this.draggedSlotElement:(this.draggedSlotElement=this.querySelector(`.card-slot[data-layout-card-id="${hy(e)}"][data-layout-drag-source="true"]`),this.draggedSlotElement)}syncDraggedSlotElement(e){if(!e||this.dragController.status!=="active"){this.draggedSlotElement=null;return}const r=this.getCachedDraggedSlotElement(e.nodeId);r&&this.writeDraggedSlotPosition(r,e)}shouldApplyTrackOffset(e,r){if(r)return!0;for(const i of e){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(e,r,i,s,o,a){if(!e)return a;const c=s?o??this.getStableAnchorCardId(e,r,i):this.getStableAnchorNodeId(e,r,i);if(!c)return a;const u=s?fy(e,c,this.layoutGrid):gy(e,c,this.layoutGrid),h=s?fy(r,c,this.layoutGrid):gy(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=py(e),o=new Set(py(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(e,r,i){const s=new Set(r.map(as));for(const o of e){const a=as(o);if(a!==i&&s.has(a))return a}return null}getStackChildAnchorCardId(e,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===e);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&Se(o)!==r);return s?Se(s):null}}function W4(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(Se(e),e);continue}for(const r of e.children)if(r.type==="card")t.set(Se(r),r);else for(const i of r.children)t.set(Se(i),i)}return t}function j4(n){for(const t of n)if(t.type==="drop-target"||t.type==="stack"&&t.children.some(e=>e.type==="drop-target"))return t.id;return null}function G4(n,t){const e=n.findIndex(r=>r.type==="card"&&Se(r)===t);if(e!==-1)return{topLevelIndex:e};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"&&Se(s)===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function py(n){const t=[];for(const e of n){if(e.type==="card"){t.push(Se(e));continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(Se(r))}}return t}function fy(n,t,e){if(!e)return null;const r=Nr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&Se(o)===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&Se(u)===t))return s;const a=i.get(as(o))??Je,c=e.toPixels(Re({x:a})).x??yi;s+=c+ce}return null}function gy(n,t,e){if(!e)return null;const r=Nr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(as(o)===t)return s;const a=i.get(as(o))??Je,c=e.toPixels(Re({x:a})).x??yi;s+=c+ce}return null}customElements.get("layout-view")||customElements.define("layout-view",B4);class q4 extends HTMLElement{constructor(){super(...arguments);g(this,"screenManager",bn.resolve("ScreenManager"));g(this,"boundModel",null);g(this,"cardEls",new Map);g(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});g(this,"handleModelChange",()=>{this.render()});g(this,"handleCloseArtifact",e=>{e instanceof n_&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(e.artifactID)});g(this,"handleScrollPositionChanged",e=>{const r=e;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});g(this,"handleLayoutChanged",e=>{e instanceof c_&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(e.layout)});g(this,"handleGlobalArrowKey",e=>{var s;if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||this.isTextEditingTarget(e.target))return;const r=e.target;if(r instanceof Node&&((s=this.querySelector("layout-view"))!=null&&s.contains(r)))return;const i=this.querySelector("layout-view");i&&(e.preventDefault(),i.stepFilmstrip(e.key==="ArrowRight"?1:-1))});g(this,"handleServerEvent",e=>{const r=e.event;if(r.type!=="artifact-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),window.addEventListener("keydown",this.handleGlobalArrowKey,{capture:!0}),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),window.removeEventListener("keydown",this.handleGlobalArrowKey,{capture:!0}),this.unbindModel(),this.disposeCardElements()}rebindModel(){const e=this.screenManager.activeScreen;this.boundModel!==e&&(this.unbindModel(),this.boundModel=e,e&&(e.addEventListener("change",this.handleModelChange),e.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)}isTextEditingTarget(e){var i;if(!(e instanceof Element))return!1;const r=e.closest("input, textarea, select, [contenteditable], [role='textbox'], [role='searchbox'], [role='combobox'], [role='spinbutton'], [role='slider']");return r?r.hasAttribute("contenteditable")?((i=r.getAttribute("contenteditable"))==null?void 0:i.toLowerCase())!=="false":!0:!1}buildCards(e){if(!e)return this.disposeCardElements(),new Map;const r=new Map;for(const i of e.artifacts.values()){let s=this.cardEls.get(i.id);s||(s=document.createElement("artifact-view"),this.cardEls.set(i.id,s)),s.artifact=i,s.screen=e,s.viewURL=e.server.getViewURL(i),s.contentURL=e.server.getContentURL(i),r.set(i.id,s)}for(const[i,s]of this.cardEls)r.has(i)||(s.remove(),this.cardEls.delete(i));return r}disposeCardElements(){for(const e of this.cardEls.values())e.remove();this.cardEls.clear()}render(){const e=this.screenManager.activeScreen,r=(e==null?void 0:e.layout)??[],i=this.buildCards(e);if(r.length===0){Ue(P``,this);return}Ue(P`
440
+ `,this),this.syncCardElements(u,L?((K=u.get(L.nodeId))==null?void 0:K.artifactID)??null:null),this.syncDraggedSlotElement(L)}syncCardElements(e,r){var o;const i=new Map;for(const a of this.querySelectorAll(".card-content-mount[data-mount-for]")){const c=a.getAttribute("data-mount-for");c&&i.set(c,a)}const s=new Set;for(const a of e.values()){const c=this._cards.get(a.artifactID);if(!c)continue;s.add(a.artifactID);const u=i.get(Se(a));if(!u){c.removeAttribute("data-dragging");continue}const h=(o=u.parentElement)==null?void 0:o.getAttribute("data-layout-card-id");console.assert(h===Se(a),`layout-view: mount mismatch for ${Se(a)}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${Se(a)}`),c.toggleAttribute("data-dragging",a.artifactID===r)}for(const[a,c]of this._cards)s.has(a)||c.removeAttribute("data-dragging")}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 e=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);this.syncDragTarget(i.x,i.y,e);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,e),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,e);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,e)}syncDragTarget(e,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getVisibleLayout(),o=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,a=this.measureLayoutGeometry(s,o);this.dragController.update({pointer:Pe({x:e,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:a,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(e,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=e,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(e,r){this.samplePointerVelocityAt(performance.now(),e,r)}samplePointerVelocityAt(e,r,i){if(this.motionSampleTime===0){this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=e-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*ay,this.motionSampleTime=e,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(e,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,e)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}getDragEdgeScrollDeltaPixels(e,r,i){var u;const s=r.left+zl,o=r.left+r.width-zl,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Yn,c=rC*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/zl));return-(c*h**Vm)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/zl));return c*h**Vm*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=Nr(e),o=new Map(s.nodes.map(E=>[E.id,E.width])),a=i.toPixels(Re({y:vt})).y??Zo,c=Hh(this),u=(this.layoutScroll.translate.x??0)+r,h=uy(s.nodes.length,i,c.height),f=c.offsetY+h,v=[];let y=u;for(const E of e){const x=as(E),C=o.get(x)??Je,L=i.toPixels(Re({x:C})).x??yi,R={left:y,top:f,width:L,height:a};v.push({id:x,rect:R}),y+=L+ce}return v}resetDragPreviewState(){this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.lastProjectedDragLayoutSignature="",this.lastDragDropIntent=null,this.lastActivePlaceholderId=null,this.draggedSlotElement=null,this.draggedSlotContainingBlock=null,this.currentDragPreviewSize=null}getCachedDraggedSlotElement(e){var r;return(r=this.draggedSlotElement)!=null&&r.isConnected&&this.draggedSlotElement.getAttribute("data-layout-card-id")===e&&this.draggedSlotElement.getAttribute("data-layout-drag-source")==="true"?this.draggedSlotElement:(this.draggedSlotElement=this.querySelector(`.card-slot[data-layout-card-id="${cy(e)}"][data-layout-drag-source="true"]`),this.draggedSlotElement)}syncDraggedSlotElement(e){if(!e||this.dragController.status!=="active"){this.draggedSlotElement=null;return}const r=this.getCachedDraggedSlotElement(e.nodeId);r&&this.writeDraggedSlotPosition(r,e)}shouldApplyTrackOffset(e,r){if(r)return!0;for(const i of e){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(e,r,i,s,o,a){if(!e)return a;const c=s?o??this.getStableAnchorCardId(e,r,i):this.getStableAnchorNodeId(e,r,i);if(!c)return a;const u=s?dy(e,c,this.layoutGrid):py(e,c,this.layoutGrid),h=s?dy(r,c,this.layoutGrid):py(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=hy(e),o=new Set(hy(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(e,r,i){const s=new Set(r.map(as));for(const o of e){const a=as(o);if(a!==i&&s.has(a))return a}return null}getStackChildAnchorCardId(e,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===e);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&Se(o)!==r);return s?Se(s):null}}function Z4(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(Se(e),e);continue}for(const r of e.children)if(r.type==="card")t.set(Se(r),r);else for(const i of r.children)t.set(Se(i),i)}return t}function B4(n){for(const t of n)if(t.type==="drop-target"||t.type==="stack"&&t.children.some(e=>e.type==="drop-target"))return t.id;return null}function W4(n,t){const e=n.findIndex(r=>r.type==="card"&&Se(r)===t);if(e!==-1)return{topLevelIndex:e};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"&&Se(s)===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function hy(n){const t=[];for(const e of n){if(e.type==="card"){t.push(Se(e));continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(Se(r))}}return t}function dy(n,t,e){if(!e)return null;const r=Nr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&Se(o)===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&Se(u)===t))return s;const a=i.get(as(o))??Je,c=e.toPixels(Re({x:a})).x??yi;s+=c+ce}return null}function py(n,t,e){if(!e)return null;const r=Nr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(as(o)===t)return s;const a=i.get(as(o))??Je,c=e.toPixels(Re({x:a})).x??yi;s+=c+ce}return null}customElements.get("layout-view")||customElements.define("layout-view",V4);class j4 extends HTMLElement{constructor(){super(...arguments);g(this,"screenManager",bn.resolve("ScreenManager"));g(this,"boundModel",null);g(this,"cardEls",new Map);g(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});g(this,"handleModelChange",()=>{this.render()});g(this,"handleCloseArtifact",e=>{e instanceof e_&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(e.artifactID)});g(this,"handleScrollPositionChanged",e=>{const r=e;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});g(this,"handleLayoutChanged",e=>{e instanceof a_&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(e.layout)});g(this,"handleGlobalArrowKey",e=>{var s;if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||this.isTextEditingTarget(e.target))return;const r=e.target;if(r instanceof Node&&((s=this.querySelector("layout-view"))!=null&&s.contains(r)))return;const i=this.querySelector("layout-view");i&&(e.preventDefault(),i.stepFilmstrip(e.key==="ArrowRight"?1:-1))});g(this,"handleServerEvent",e=>{const r=e.event;if(r.type!=="artifact-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),window.addEventListener("keydown",this.handleGlobalArrowKey,{capture:!0}),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),window.removeEventListener("keydown",this.handleGlobalArrowKey,{capture:!0}),this.unbindModel(),this.disposeCardElements()}rebindModel(){const e=this.screenManager.activeScreen;this.boundModel!==e&&(this.unbindModel(),this.boundModel=e,e&&(e.addEventListener("change",this.handleModelChange),e.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)}isTextEditingTarget(e){var i;if(!(e instanceof Element))return!1;const r=e.closest("input, textarea, select, [contenteditable], [role='textbox'], [role='searchbox'], [role='combobox'], [role='spinbutton'], [role='slider']");return r?r.hasAttribute("contenteditable")?((i=r.getAttribute("contenteditable"))==null?void 0:i.toLowerCase())!=="false":!0:!1}buildCards(e){if(!e)return this.disposeCardElements(),new Map;const r=new Map;for(const i of e.artifacts.values()){let s=this.cardEls.get(i.id);s||(s=document.createElement("artifact-view"),this.cardEls.set(i.id,s)),s.artifact=i,s.screen=e,s.viewURL=e.server.getViewURL(i),s.contentURL=e.server.getContentURL(i),r.set(i.id,s)}for(const[i,s]of this.cardEls)r.has(i)||(s.remove(),this.cardEls.delete(i));return r}disposeCardElements(){for(const e of this.cardEls.values())e.remove();this.cardEls.clear()}render(){const e=this.screenManager.activeScreen,r=(e==null?void 0:e.layout)??[],i=this.buildCards(e);if(r.length===0){Ue(P``,this);return}Ue(P`
441
441
  <layout-view
442
442
  .layout=${r}
443
443
  .cards=${i}
@@ -446,14 +446,14 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
446
446
  @layout-change=${this.handleLayoutChanged}
447
447
  @close-artifact=${this.handleCloseArtifact}
448
448
  ></layout-view>
449
- `,this)}}customElements.define("screen-view",q4);function Mc(n){return typeof n=="object"&&n!==null}const Zh=new WeakMap,my=Object.prototype.hasOwnProperty,Y4=(()=>{const n=new Set;let t=HTMLElement.prototype;for(;t;){for(const e of Object.getOwnPropertyNames(t))n.add(e);if(t===Node.prototype)break;t=Object.getPrototypeOf(t)}return n})();function K4(n,t){if(Mc(n))return t===null?void 0:n.parse(t);if(n===Boolean)return t!==null;if(t!==null)return n===Number?Number(t):t}function J4(n,t){return Mc(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var Va,op,ai,bt,pn,$s,li,Cs,Te,Xi,u_,h_,d_,p_,pc;const zr=class zr extends HTMLElement{constructor(){var i;super();b(this,Te);b(this,ai,new Map);b(this,bt,new Map);b(this,pn,new Map);b(this,$s,!1);b(this,li,!1);b(this,Cs,!1);const e=d(i=zr,Va,op).call(i,this.constructor),r=this;for(const s of e.properties)my.call(r,s)&&(l(this,pn).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return d(e=zr,Va,op).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(d(this,Te,p_).call(this),!l(this,li))for(const e of d(this,Te,Xi).call(this).properties)l(this,bt).has(e)||l(this,bt).set(e,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),d(this,Te,pc).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=d(this,Te,Xi).call(this).byAttr.get(e);s&&(l(this,pn).has(s.property)||(this[s.property]=K4(s.type,i)))}};Va=new WeakSet,op=function(e){const r=Zh.get(e);if(r)return r;const i=[...e.properties??[]],s=e.attributes??{},o=new Map,a=new Map;for(const u of i)if(Y4.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 f=h.property??u;if(!i.includes(f))throw new Error(`Attribute '${u}' references property '${f}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);if(Mc(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:f,type:h.type};o.set(u,v),a.set(f,v)}for(const u of i){const h=Object.getOwnPropertyDescriptor(e.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(e.prototype,u,{configurable:!0,enumerable:!0,get(){return l(this,ai).get(u)},set(f){d(this,Te,u_).call(this,u,f)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return Zh.set(e,c),c},ai=new WeakMap,bt=new WeakMap,pn=new WeakMap,$s=new WeakMap,li=new WeakMap,Cs=new WeakMap,Te=new WeakSet,Xi=function(){return Zh.get(this.constructor)},u_=function(e,r){if(!l(this,Cs)&&l(this,pn).has(e))return;const i=l(this,ai).get(e);d(this,Te,h_).call(this,e,i,r)||(l(this,bt).has(e)||l(this,bt).set(e,i),l(this,ai).set(e,r),l(this,pn).delete(e),d(this,Te,d_).call(this,e,r),this.isConnected&&d(this,Te,pc).call(this))},h_=function(e,r,i){if(Object.is(r,i))return!0;const s=d(this,Te,Xi).call(this).byProp.get(e);if(!s||!Mc(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}},d_=function(e,r){const i=d(this,Te,Xi).call(this).byProp.get(e);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=J4(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},p_=function(){const e=this,r=d(this,Te,Xi).call(this);for(const i of r.properties){if(!my.call(e,i))continue;const s=e[i];delete e[i],!(l(this,pn).has(i)||l(this,ai).has(i))&&(e[i]=s)}m(this,Cs,!0);try{for(const[i,s]of l(this,pn))e[i]=s;l(this,pn).clear()}finally{m(this,Cs,!1)}},pc=function(){l(this,$s)||!this.isConnected||l(this,li)&&l(this,bt).size===0||(m(this,$s,!0),queueMicrotask(()=>{if(m(this,$s,!1),!this.isConnected||l(this,li)&&l(this,bt).size===0)return;const e=new Map(l(this,bt));l(this,bt).clear(),m(this,li,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,bt).size>0&&d(this,Te,pc).call(this)}))},b(zr,Va),g(zr,"properties"),g(zr,"attributes");let Ei=zr;var ge,Mn,or,Is,ar,zn,Za,Ba,Ie,Rs,On,fn,F,f_,Wa,ja,Ga,qa,ap,lp,cp,g_,m_,v_,y_,Wc,jc,Gc,qc,up,b_,fc,w_,Ya,Yc,Kc,Lo,Jc,S_,__,k_,E_,x_,A_,Ke;class X4 extends Ei{constructor(){super(...arguments);b(this,F);b(this,ge,bn.resolve("ScreenManager"));b(this,Mn,bn.resolve("ServerManager"));b(this,or,null);b(this,Is,new DisposableStack);b(this,ar,Hr());b(this,zn,Hr());b(this,Za,Hr());b(this,Ba,Hr());b(this,Ie,{kind:"none"});b(this,Rs,!1);b(this,On,null);b(this,fn,[]);b(this,Wa,()=>{d(this,F,ap).call(this),m(this,Ie,{kind:"none"}),l(this,Ke).call(this)});b(this,ja,()=>{l(this,Ke).call(this)});b(this,Ga,()=>{l(this,Ke).call(this)});b(this,qa,()=>{l(this,Ke).call(this)});b(this,Wc,()=>{var i,s;if(l(this,Ie).kind==="picker"){d(this,F,Lo).call(this);return}m(this,fn,d(this,F,b_).call(this));const e=((i=l(this,ge).activeScreen)==null?void 0:i.id)??null,r=e&&l(this,fn).some(o=>o.screenID===e)?e:((s=l(this,fn)[0])==null?void 0:s.screenID)??null;m(this,Ie,{kind:"picker",filter:"",highlightedID:r}),l(this,Ke).call(this),queueMicrotask(()=>{var o;(o=l(this,Za).value)==null||o.focus()})});b(this,jc,e=>{var u;const r=l(this,Ie);if(r.kind!=="picker")return;const i=e.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=d(this,F,fc).call(this,l(this,fn),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;m(this,Ie,{kind:"picker",filter:s,highlightedID:c}),l(this,Ke).call(this)});b(this,Gc,e=>{var s;const r=l(this,Ie);if(r.kind!=="picker"||e.target instanceof Element&&e.target.closest(".picker-row-delete")!==null)return;if(e.key==="Escape"){e.preventDefault(),d(this,F,Lo).call(this),(s=l(this,ar).value)==null||s.focus();return}const i=d(this,F,fc).call(this,l(this,fn),r.filter);if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=e.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));m(this,Ie,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,Ke).call(this);return}if(e.key==="Enter"){e.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&d(this,F,up).call(this,o)}});b(this,qc,e=>{d(this,F,up).call(this,e)});b(this,Ya,()=>{var e;l(this,On)!==null&&(m(this,On,null),l(this,Ke).call(this),(e=l(this,ar).value)==null||e.focus())});b(this,Yc,()=>{var i;const e=l(this,On);if(e===null)return;m(this,On,null),l(this,Ke).call(this);const r=l(this,Mn).servers.get(e.serverURL);r==null||r.client.screens.remove({screenID:e.screenID}).catch(()=>{}),(i=l(this,ar).value)==null||i.focus()});b(this,Kc,e=>{l(this,Ie).kind==="picker"&&e.target===l(this,zn).value&&(m(this,Ie,{kind:"none"}),l(this,Ke).call(this))});b(this,Jc,async()=>{if(l(this,Rs))return;const e=d(this,F,S_).call(this);if(e){m(this,Rs,!0);try{const r=await e.createScreen(Q4(new Date));l(this,ge).addTab(e.url,r.id),l(this,ge).setActive(e.url,r.id)}catch{}finally{m(this,Rs,!1)}}});b(this,Ke,()=>{const e=d(this,F,v_).call(this);Ue(P`
450
- ${d(this,F,__).call(this)}
449
+ `,this)}}customElements.define("screen-view",j4);function Mc(n){return typeof n=="object"&&n!==null}const Vh=new WeakMap,fy=Object.prototype.hasOwnProperty,G4=(()=>{const n=new Set;let t=HTMLElement.prototype;for(;t;){for(const e of Object.getOwnPropertyNames(t))n.add(e);if(t===Node.prototype)break;t=Object.getPrototypeOf(t)}return n})();function q4(n,t){if(Mc(n))return t===null?void 0:n.parse(t);if(n===Boolean)return t!==null;if(t!==null)return n===Number?Number(t):t}function Y4(n,t){return Mc(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var Va,sp,ai,bt,pn,$s,li,Cs,Te,Xi,l_,c_,u_,h_,pc;const zr=class zr extends HTMLElement{constructor(){var i;super();b(this,Te);b(this,ai,new Map);b(this,bt,new Map);b(this,pn,new Map);b(this,$s,!1);b(this,li,!1);b(this,Cs,!1);const e=d(i=zr,Va,sp).call(i,this.constructor),r=this;for(const s of e.properties)fy.call(r,s)&&(l(this,pn).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return d(e=zr,Va,sp).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(d(this,Te,h_).call(this),!l(this,li))for(const e of d(this,Te,Xi).call(this).properties)l(this,bt).has(e)||l(this,bt).set(e,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),d(this,Te,pc).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=d(this,Te,Xi).call(this).byAttr.get(e);s&&(l(this,pn).has(s.property)||(this[s.property]=q4(s.type,i)))}};Va=new WeakSet,sp=function(e){const r=Vh.get(e);if(r)return r;const i=[...e.properties??[]],s=e.attributes??{},o=new Map,a=new Map;for(const u of i)if(G4.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 f=h.property??u;if(!i.includes(f))throw new Error(`Attribute '${u}' references property '${f}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);if(Mc(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:f,type:h.type};o.set(u,v),a.set(f,v)}for(const u of i){const h=Object.getOwnPropertyDescriptor(e.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(e.prototype,u,{configurable:!0,enumerable:!0,get(){return l(this,ai).get(u)},set(f){d(this,Te,l_).call(this,u,f)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return Vh.set(e,c),c},ai=new WeakMap,bt=new WeakMap,pn=new WeakMap,$s=new WeakMap,li=new WeakMap,Cs=new WeakMap,Te=new WeakSet,Xi=function(){return Vh.get(this.constructor)},l_=function(e,r){if(!l(this,Cs)&&l(this,pn).has(e))return;const i=l(this,ai).get(e);d(this,Te,c_).call(this,e,i,r)||(l(this,bt).has(e)||l(this,bt).set(e,i),l(this,ai).set(e,r),l(this,pn).delete(e),d(this,Te,u_).call(this,e,r),this.isConnected&&d(this,Te,pc).call(this))},c_=function(e,r,i){if(Object.is(r,i))return!0;const s=d(this,Te,Xi).call(this).byProp.get(e);if(!s||!Mc(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}},u_=function(e,r){const i=d(this,Te,Xi).call(this).byProp.get(e);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=Y4(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},h_=function(){const e=this,r=d(this,Te,Xi).call(this);for(const i of r.properties){if(!fy.call(e,i))continue;const s=e[i];delete e[i],!(l(this,pn).has(i)||l(this,ai).has(i))&&(e[i]=s)}m(this,Cs,!0);try{for(const[i,s]of l(this,pn))e[i]=s;l(this,pn).clear()}finally{m(this,Cs,!1)}},pc=function(){l(this,$s)||!this.isConnected||l(this,li)&&l(this,bt).size===0||(m(this,$s,!0),queueMicrotask(()=>{if(m(this,$s,!1),!this.isConnected||l(this,li)&&l(this,bt).size===0)return;const e=new Map(l(this,bt));l(this,bt).clear(),m(this,li,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,bt).size>0&&d(this,Te,pc).call(this)}))},b(zr,Va),g(zr,"properties"),g(zr,"attributes");let Ei=zr;var ge,Mn,or,Is,ar,zn,Za,Ba,Ie,Rs,On,fn,F,d_,Wa,ja,Ga,qa,op,ap,lp,p_,f_,g_,m_,Wc,jc,Gc,qc,cp,v_,fc,y_,Ya,Yc,Kc,Lo,Jc,b_,w_,S_,__,k_,E_,Ke;class K4 extends Ei{constructor(){super(...arguments);b(this,F);b(this,ge,bn.resolve("ScreenManager"));b(this,Mn,bn.resolve("ServerManager"));b(this,or,null);b(this,Is,new DisposableStack);b(this,ar,Hr());b(this,zn,Hr());b(this,Za,Hr());b(this,Ba,Hr());b(this,Ie,{kind:"none"});b(this,Rs,!1);b(this,On,null);b(this,fn,[]);b(this,Wa,()=>{d(this,F,op).call(this),m(this,Ie,{kind:"none"}),l(this,Ke).call(this)});b(this,ja,()=>{l(this,Ke).call(this)});b(this,Ga,()=>{l(this,Ke).call(this)});b(this,qa,()=>{l(this,Ke).call(this)});b(this,Wc,()=>{var i,s;if(l(this,Ie).kind==="picker"){d(this,F,Lo).call(this);return}m(this,fn,d(this,F,v_).call(this));const e=((i=l(this,ge).activeScreen)==null?void 0:i.id)??null,r=e&&l(this,fn).some(o=>o.screenID===e)?e:((s=l(this,fn)[0])==null?void 0:s.screenID)??null;m(this,Ie,{kind:"picker",filter:"",highlightedID:r}),l(this,Ke).call(this),queueMicrotask(()=>{var o;(o=l(this,Za).value)==null||o.focus()})});b(this,jc,e=>{var u;const r=l(this,Ie);if(r.kind!=="picker")return;const i=e.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=d(this,F,fc).call(this,l(this,fn),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;m(this,Ie,{kind:"picker",filter:s,highlightedID:c}),l(this,Ke).call(this)});b(this,Gc,e=>{var s;const r=l(this,Ie);if(r.kind!=="picker"||e.target instanceof Element&&e.target.closest(".picker-row-delete")!==null)return;if(e.key==="Escape"){e.preventDefault(),d(this,F,Lo).call(this),(s=l(this,ar).value)==null||s.focus();return}const i=d(this,F,fc).call(this,l(this,fn),r.filter);if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),i.length===0)return;const o=i.findIndex(u=>u.screenID===r.highlightedID),a=e.key==="ArrowDown"?1:-1,c=o<0?0:Math.max(0,Math.min(i.length-1,o+a));m(this,Ie,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,Ke).call(this);return}if(e.key==="Enter"){e.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&d(this,F,cp).call(this,o)}});b(this,qc,e=>{d(this,F,cp).call(this,e)});b(this,Ya,()=>{var e;l(this,On)!==null&&(m(this,On,null),l(this,Ke).call(this),(e=l(this,ar).value)==null||e.focus())});b(this,Yc,()=>{var i;const e=l(this,On);if(e===null)return;m(this,On,null),l(this,Ke).call(this);const r=l(this,Mn).servers.get(e.serverURL);r==null||r.client.screens.remove({screenID:e.screenID}).catch(()=>{}),(i=l(this,ar).value)==null||i.focus()});b(this,Kc,e=>{l(this,Ie).kind==="picker"&&e.target===l(this,zn).value&&(m(this,Ie,{kind:"none"}),l(this,Ke).call(this))});b(this,Jc,async()=>{if(l(this,Rs))return;const e=d(this,F,b_).call(this);if(e){m(this,Rs,!0);try{const r=await e.createScreen(J4(new Date));l(this,ge).addTab(e.url,r.id),l(this,ge).setActive(e.url,r.id)}catch{}finally{m(this,Rs,!1)}}});b(this,Ke,()=>{const e=d(this,F,g_).call(this);Ue(P`
450
+ ${d(this,F,w_).call(this)}
451
451
  <div class="pills" role="group" aria-label="Open tabs">
452
- ${e.map(r=>d(this,F,k_).call(this,r))}
452
+ ${e.map(r=>d(this,F,S_).call(this,r))}
453
453
  </div>
454
+ ${d(this,F,__).call(this)}
454
455
  ${d(this,F,E_).call(this)}
455
- ${d(this,F,A_).call(this)}
456
- `,this),l(this,zn).value&&(l(this,zn).value.anchor=l(this,ar).value??null)})}connected(){l(this,ge).addEventListener("active-screen-changed",l(this,Wa)),l(this,ge).addEventListener("tabs-changed",l(this,ja)),l(this,Mn).addEventListener("screens-changed",l(this,Ga)),d(this,F,ap).call(this),l(this,Ke).call(this),d(this,F,f_).call(this),l(this,Is).defer(()=>{l(this,ge).removeEventListener("active-screen-changed",l(this,Wa)),l(this,ge).removeEventListener("tabs-changed",l(this,ja)),l(this,Mn).removeEventListener("screens-changed",l(this,Ga)),d(this,F,lp).call(this)})}disconnected(){l(this,Is).dispose(),m(this,Is,new DisposableStack)}}ge=new WeakMap,Mn=new WeakMap,or=new WeakMap,Is=new WeakMap,ar=new WeakMap,zn=new WeakMap,Za=new WeakMap,Ba=new WeakMap,Ie=new WeakMap,Rs=new WeakMap,On=new WeakMap,fn=new WeakMap,F=new WeakSet,f_=async function(){const e=await $b(this);this.setAttribute("tone",e)},Wa=new WeakMap,ja=new WeakMap,Ga=new WeakMap,qa=new WeakMap,ap=function(){var r;const e=l(this,ge).activeScreen;l(this,or)!==e&&(d(this,F,lp).call(this),m(this,or,e),(r=l(this,or))==null||r.addEventListener("change",l(this,qa)))},lp=function(){var e;(e=l(this,or))==null||e.removeEventListener("change",l(this,qa)),m(this,or,null)},cp=function(e,r){l(this,ge).setActive(e,r)},g_=function(e,r,i){i.stopPropagation();const s=l(this,ge).getTabs(e),o=d(this,F,y_).call(this,s,r),a=l(this,ge).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,ge).removeTab(e,r),c&&(o?l(this,ge).setActive(e,o):l(this,ge).clearActive())},m_=function(e,r,i){const s=l(this,ge).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,Mn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},v_=function(){const e=l(this,ge).activeScreen,r=[];for(const i of l(this,Mn).servers.values())for(const s of l(this,ge).getTabs(i.url)){const o=i.screens.get(s);o&&r.push({serverURL:i.url,screenID:o.id,name:o.name,isActive:(e==null?void 0:e.id)===o.id&&e.server.url===i.url})}return r},y_=function(e,r){const i=e.indexOf(r);if(i<0)return null;const s=e.filter(a=>a!==r);if(s.length===0)return null;const o=Math.max(0,i-1);return s[o]??null},Wc=new WeakMap,jc=new WeakMap,Gc=new WeakMap,qc=new WeakMap,up=function(e){l(this,ge).addTab(e.serverURL,e.screenID),l(this,ge).setActive(e.serverURL,e.screenID),d(this,F,Lo).call(this)},b_=function(){return l(this,ge).screens.map(e=>({serverURL:e.server.url,screenID:e.screen.id,name:e.screen.name}))},fc=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},w_=function(e,r){r.stopPropagation(),d(this,F,Lo).call(this),m(this,On,e),l(this,Ke).call(this),queueMicrotask(()=>{var i;(i=l(this,Ba).value)==null||i.focus()})},Ya=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Lo=function(){l(this,Ie).kind==="picker"&&(l(this,zn).value&&(l(this,zn).value.open=!1),m(this,Ie,{kind:"none"}),l(this,Ke).call(this))},Jc=new WeakMap,S_=function(){for(const e of l(this,Mn).servers.values())return e;return null},__=function(){return P`
456
+ `,this),l(this,zn).value&&(l(this,zn).value.anchor=l(this,ar).value??null)})}connected(){l(this,ge).addEventListener("active-screen-changed",l(this,Wa)),l(this,ge).addEventListener("tabs-changed",l(this,ja)),l(this,Mn).addEventListener("screens-changed",l(this,Ga)),d(this,F,op).call(this),l(this,Ke).call(this),d(this,F,d_).call(this),l(this,Is).defer(()=>{l(this,ge).removeEventListener("active-screen-changed",l(this,Wa)),l(this,ge).removeEventListener("tabs-changed",l(this,ja)),l(this,Mn).removeEventListener("screens-changed",l(this,Ga)),d(this,F,ap).call(this)})}disconnected(){l(this,Is).dispose(),m(this,Is,new DisposableStack)}}ge=new WeakMap,Mn=new WeakMap,or=new WeakMap,Is=new WeakMap,ar=new WeakMap,zn=new WeakMap,Za=new WeakMap,Ba=new WeakMap,Ie=new WeakMap,Rs=new WeakMap,On=new WeakMap,fn=new WeakMap,F=new WeakSet,d_=async function(){const e=await Ab(this);this.setAttribute("tone",e)},Wa=new WeakMap,ja=new WeakMap,Ga=new WeakMap,qa=new WeakMap,op=function(){var r;const e=l(this,ge).activeScreen;l(this,or)!==e&&(d(this,F,ap).call(this),m(this,or,e),(r=l(this,or))==null||r.addEventListener("change",l(this,qa)))},ap=function(){var e;(e=l(this,or))==null||e.removeEventListener("change",l(this,qa)),m(this,or,null)},lp=function(e,r){l(this,ge).setActive(e,r)},p_=function(e,r,i){i.stopPropagation();const s=l(this,ge).getTabs(e),o=d(this,F,m_).call(this,s,r),a=l(this,ge).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,ge).removeTab(e,r),c&&(o?l(this,ge).setActive(e,o):l(this,ge).clearActive())},f_=function(e,r,i){const s=l(this,ge).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,Mn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},g_=function(){const e=l(this,ge).activeScreen,r=[];for(const i of l(this,Mn).servers.values())for(const s of l(this,ge).getTabs(i.url)){const o=i.screens.get(s);o&&r.push({serverURL:i.url,screenID:o.id,name:o.name,isActive:(e==null?void 0:e.id)===o.id&&e.server.url===i.url})}return r},m_=function(e,r){const i=e.indexOf(r);if(i<0)return null;const s=e.filter(a=>a!==r);if(s.length===0)return null;const o=Math.max(0,i-1);return s[o]??null},Wc=new WeakMap,jc=new WeakMap,Gc=new WeakMap,qc=new WeakMap,cp=function(e){l(this,ge).addTab(e.serverURL,e.screenID),l(this,ge).setActive(e.serverURL,e.screenID),d(this,F,Lo).call(this)},v_=function(){return l(this,ge).screens.map(e=>({serverURL:e.server.url,screenID:e.screen.id,name:e.screen.name}))},fc=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},y_=function(e,r){r.stopPropagation(),d(this,F,Lo).call(this),m(this,On,e),l(this,Ke).call(this),queueMicrotask(()=>{var i;(i=l(this,Ba).value)==null||i.focus()})},Ya=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Lo=function(){l(this,Ie).kind==="picker"&&(l(this,zn).value&&(l(this,zn).value.open=!1),m(this,Ie,{kind:"none"}),l(this,Ke).call(this))},Jc=new WeakMap,b_=function(){for(const e of l(this,Mn).servers.values())return e;return null},w_=function(){return P`
457
457
  <segmented-control variant="glass" role="group" aria-label="Screens">
458
458
  <button
459
459
  type="button"
@@ -462,7 +462,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
462
462
  @click=${l(this,Wc)}
463
463
  ${Vr(l(this,ar))}
464
464
  >
465
- ${t8({size:16,weight:"regular"})}
465
+ ${QO({size:16,weight:"regular"})}
466
466
  </button>
467
467
  <button
468
468
  type="button"
@@ -470,10 +470,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
470
470
  aria-label="New screen"
471
471
  @click=${l(this,Jc)}
472
472
  >
473
- ${n8({size:16,weight:"regular"})}
473
+ ${e8({size:16,weight:"regular"})}
474
474
  </button>
475
475
  </segmented-control>
476
- `},k_=function(e){return P`
476
+ `},S_=function(e){return P`
477
477
  <span class="tab" ?data-active=${e.isActive}>
478
478
  <button
479
479
  type="button"
@@ -482,16 +482,16 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
482
482
  aria-pressed=${e.isActive?"true":"false"}
483
483
  aria-current=${e.isActive?"page":ue}
484
484
  aria-label=${e.isActive?`Current tab: ${e.name}`:`Switch to ${e.name}`}
485
- @mousedown=${r=>{r.button===0&&d(this,F,cp).call(this,e.serverURL,e.screenID)}}
486
- @click=${()=>d(this,F,cp).call(this,e.serverURL,e.screenID)}
485
+ @mousedown=${r=>{r.button===0&&d(this,F,lp).call(this,e.serverURL,e.screenID)}}
486
+ @click=${()=>d(this,F,lp).call(this,e.serverURL,e.screenID)}
487
487
  >
488
488
  <span class="tab-leading">
489
- ${QO({weight:"bold"})}
489
+ ${JO({weight:"bold"})}
490
490
  </span>
491
491
  <editable-text
492
492
  class="tab-name"
493
493
  .value=${e.name}
494
- @rename=${r=>d(this,F,m_).call(this,e.serverURL,e.screenID,r)}
494
+ @rename=${r=>d(this,F,f_).call(this,e.serverURL,e.screenID,r)}
495
495
  ></editable-text>
496
496
  </button>
497
497
  <button
@@ -501,12 +501,12 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
501
501
  icon-only
502
502
  class="tab-close"
503
503
  aria-label=${`Close ${e.name}`}
504
- @click=${r=>d(this,F,g_).call(this,e.serverURL,e.screenID,r)}
504
+ @click=${r=>d(this,F,p_).call(this,e.serverURL,e.screenID,r)}
505
505
  >
506
- ${_f({weight:"bold"})}
506
+ ${Sf({weight:"bold"})}
507
507
  </button>
508
508
  </span>
509
- `},E_=function(){var o;const e=l(this,Ie).kind==="picker"?l(this,Ie).filter:"",r=l(this,Ie).kind==="picker"?l(this,Ie).highlightedID:null,i=((o=l(this,ge).activeScreen)==null?void 0:o.id)??null,s=d(this,F,fc).call(this,l(this,fn),e);return P`
509
+ `},__=function(){var o;const e=l(this,Ie).kind==="picker"?l(this,Ie).filter:"",r=l(this,Ie).kind==="picker"?l(this,Ie).highlightedID:null,i=((o=l(this,ge).activeScreen)==null?void 0:o.id)??null,s=d(this,F,fc).call(this,l(this,fn),e);return P`
510
510
  <ui-popover
511
511
  class="picker-popover"
512
512
  material="glass-frosted"
@@ -527,10 +527,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
527
527
  />
528
528
  ${s.length===0?P`<p class="picker-empty">
529
529
  ${l(this,fn).length===0?"No screens":"No matches"}
530
- </p>`:d(this,F,x_).call(this,s,r,i)}
530
+ </p>`:d(this,F,k_).call(this,s,r,i)}
531
531
  </div>
532
532
  </ui-popover>
533
- `},x_=function(e,r,i){return P`
533
+ `},k_=function(e,r,i){return P`
534
534
  <ul class="picker-list" role="listbox">
535
535
  <li class="picker-section-label" role="presentation">Recent</li>
536
536
  ${e.map(s=>{const o=s.screenID===i;return P`
@@ -551,14 +551,14 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
551
551
  ?icon-only=${!0}
552
552
  class="picker-row-delete"
553
553
  aria-label=${`Delete screen “${s.name}”`}
554
- @click=${a=>d(this,F,w_).call(this,s,a)}
554
+ @click=${a=>d(this,F,y_).call(this,s,a)}
555
555
  >
556
- ${r8({size:16,weight:"regular"})}
556
+ ${t8({size:16,weight:"regular"})}
557
557
  </button>
558
558
  </li>
559
559
  `})}
560
560
  </ul>
561
- `},A_=function(){const e=l(this,On);return P`
561
+ `},E_=function(){const e=l(this,On);return P`
562
562
  <modal-overlay
563
563
  class="screen-delete-modal"
564
564
  ?open=${e!==null}
@@ -596,7 +596,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
596
596
  </div>
597
597
  </div>
598
598
  </modal-overlay>
599
- `},Ke=new WeakMap;customElements.define("screen-select",X4);function Q4(n){const t=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),e=12,r=n.getHours(),i=r%e===0?e:r%e,s=n.getMinutes().toString().padStart(2,"0"),o=r>=e?"pm":"am";return`${t} at ${i}:${s}${o}`}var Ka,Nn,gn,mn,ur,T_,gc;class hp extends Ei{constructor(){super(...arguments);b(this,ur);g(this,"phase","thinking");g(this,"toolCalls",[]);g(this,"expanded",!1);g(this,"expandedTexts",new Set);b(this,Ka,`agent-activity-panel-${++nU}`);g(this,"overflowingTexts",new Set);b(this,Nn,null);b(this,gn,null);b(this,mn,null);g(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ue(this.template(),this),d(this,ur,T_).call(this),l(this,gn)!==null&&cancelAnimationFrame(l(this,gn)),m(this,gn,requestAnimationFrame(()=>{m(this,gn,null),d(this,ur,gc).call(this)})),e.has("expanded")&&(l(this,mn)!==null&&clearTimeout(l(this,mn)),m(this,mn,window.setTimeout(()=>{m(this,mn,null),d(this,ur,gc).call(this)},tU)))}disconnected(){var e;(e=l(this,Nn))==null||e.disconnect(),m(this,Nn,null),l(this,gn)!==null&&(cancelAnimationFrame(l(this,gn)),m(this,gn,null)),l(this,mn)!==null&&(clearTimeout(l(this,mn)),m(this,mn,null))}template(){const e=this.toolCalls.length>0;return P`
599
+ `},Ke=new WeakMap;customElements.define("screen-select",K4);function J4(n){const t=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),e=12,r=n.getHours(),i=r%e===0?e:r%e,s=n.getMinutes().toString().padStart(2,"0"),o=r>=e?"pm":"am";return`${t} at ${i}:${s}${o}`}var Ka,Nn,gn,mn,ur,x_,gc;class up extends Ei{constructor(){super(...arguments);b(this,ur);g(this,"phase","thinking");g(this,"toolCalls",[]);g(this,"expanded",!1);g(this,"expandedTexts",new Set);b(this,Ka,`agent-activity-panel-${++eU}`);g(this,"overflowingTexts",new Set);b(this,Nn,null);b(this,gn,null);b(this,mn,null);g(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ue(this.template(),this),d(this,ur,x_).call(this),l(this,gn)!==null&&cancelAnimationFrame(l(this,gn)),m(this,gn,requestAnimationFrame(()=>{m(this,gn,null),d(this,ur,gc).call(this)})),e.has("expanded")&&(l(this,mn)!==null&&clearTimeout(l(this,mn)),m(this,mn,window.setTimeout(()=>{m(this,mn,null),d(this,ur,gc).call(this)},Q4)))}disconnected(){var e;(e=l(this,Nn))==null||e.disconnect(),m(this,Nn,null),l(this,gn)!==null&&(cancelAnimationFrame(l(this,gn)),m(this,gn,null)),l(this,mn)!==null&&(clearTimeout(l(this,mn)),m(this,mn,null))}template(){const e=this.toolCalls.length>0;return P`
600
600
  ${this.barTemplate()}
601
601
  ${e?this.panelTemplate():null}
602
602
  `}barTemplate(){return this.phase==="thinking"?P`<div class="bar bar-static" unselectable>${this.indicator()}${this.label({expanded:this.expanded})}</div>`:P`
@@ -631,7 +631,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
631
631
  class="tool-dot"
632
632
  data-status=${e.status}
633
633
  role="img"
634
- aria-label=${rU(e.status)}
634
+ aria-label=${tU(e.status)}
635
635
  ></span>
636
636
  <span class="tool-title">${e.title}</span>
637
637
  ${e.text?P`
@@ -648,13 +648,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
648
648
  @click=${()=>this.toggleTextExpand(e.toolCallId)}
649
649
  >
650
650
  <span>${s}</span>
651
- ${r?XO({size:16}):Rc({size:16})}
651
+ ${r?KO({size:16}):Rc({size:16})}
652
652
  </button>`:null}
653
653
  </div>
654
654
  `:null}
655
655
  </li>
656
656
  `}toggleTextExpand(e){const r=new Set(this.expandedTexts);r.has(e)?r.delete(e):r.add(e),this.expandedTexts=r}indicator(){if(this.expanded)return P`<span class="indicator">${Rc({size:16})}</span>`;const e=this.phase==="thinking"||this.phase==="using";return P`<span class=${e?"indicator indicator-active":"indicator"}
657
- >${e?rS({size:16}):i8({size:16})}</span>`}label(e){var s;if(this.phase==="thinking")return"Thinking…";const r=this.toolCalls.length;if(this.phase==="using"){if(e.expanded)return`Using ${r} ${r===1?"tool":"tools"}…`;const o=[...this.toolCalls].reverse().find(c=>c.status==="in_progress"),a=(o==null?void 0:o.toolKind)??((s=this.toolCalls.at(-1))==null?void 0:s.toolKind)??"other";return eU(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}Ka=new WeakMap,Nn=new WeakMap,gn=new WeakMap,mn=new WeakMap,ur=new WeakSet,T_=function(){if(!(typeof ResizeObserver>"u")){l(this,Nn)||m(this,Nn,new ResizeObserver(()=>d(this,ur,gc).call(this))),l(this,Nn).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,Nn).observe(e)}},gc=function(){const e=new Set;for(const r of this.querySelectorAll(".tool-text")){const i=r.dataset.toolCallId;if(i){if(this.expandedTexts.has(i)){e.add(i);continue}r.scrollHeight>r.clientHeight+1&&e.add(i)}}iU(this.overflowingTexts,e)||(this.overflowingTexts=e)},g(hp,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),g(hp,"attributes",{expanded:{type:Boolean}});function eU(n){switch(n){case"read":return"Reading files…";case"edit":return"Editing files…";case"delete":return"Deleting files…";case"move":return"Moving files…";case"search":return"Searching files…";case"execute":return"Running commands…";case"think":return"Thinking…";case"fetch":return"Fetching content…";case"switch_mode":return"Switching modes…";default:return"Working…"}}const tU=160;let nU=0;function rU(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function iU(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}customElements.define("agent-activity",hp);function sU(n){const t=[];let e=0;for(;e<n.length;)if(n[e].kind==="tool_call"){const i=[];for(;e<n.length&&n[e].kind==="tool_call";)i.push(n[e]),e+=1;const s=e>=n.length;t.push({kind:"tool-run",toolCalls:i,live:s})}else t.push({kind:"message",message:n[e]}),e+=1;const r=n[n.length-1];return r&&r.kind==="user"&&t.push({kind:"thinking"}),t}const vy=8,yy=new WeakMap;function oU(n){const t=yy.get(n);if(t&&t.text===n.text)return t.html;const e=Pf(n.text);return yy.set(n,{text:n.text,html:e}),e}function by(n){for(let t=n.length-1;t>=0;t-=1){const e=n[t];if(e&&e.kind==="user")return e.id}return null}var wt,St,ci,ui,lr,$t,C_,dp,I_,Xc,Qc,pp;class $_ extends Ei{constructor(){super(...arguments);b(this,$t);g(this,"messages",[]);b(this,wt,!0);b(this,St,null);b(this,ci,null);b(this,ui,null);b(this,lr,!1);b(this,Xc,()=>{if(l(this,lr))return;const e=l(this,St);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=vy;i!==l(this,wt)&&(m(this,wt,i),this.toggleAttribute("data-pinned",i))});b(this,Qc,()=>{m(this,wt,!0),this.toggleAttribute("data-pinned",!0),d(this,$t,pp).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=by(this.messages);r=s!==null&&s!==by(i),r&&m(this,wt,!0)}Ue(this.template(),this),l(this,St)||(m(this,St,this.querySelector(".history-scroll")),l(this,St)&&d(this,$t,C_).call(this)),this.toggleAttribute("data-pinned",l(this,wt)),d(this,$t,dp).call(this),d(this,$t,pp).call(this,r)}disconnected(){var e,r;(e=l(this,ci))==null||e.disconnect(),m(this,ci,null),(r=l(this,ui))==null||r.disconnect(),m(this,ui,null)}template(){const e=sU(this.messages);return P`
657
+ >${e?tS({size:16}):n8({size:16})}</span>`}label(e){var s;if(this.phase==="thinking")return"Thinking…";const r=this.toolCalls.length;if(this.phase==="using"){if(e.expanded)return`Using ${r} ${r===1?"tool":"tools"}…`;const o=[...this.toolCalls].reverse().find(c=>c.status==="in_progress"),a=(o==null?void 0:o.toolKind)??((s=this.toolCalls.at(-1))==null?void 0:s.toolKind)??"other";return X4(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}Ka=new WeakMap,Nn=new WeakMap,gn=new WeakMap,mn=new WeakMap,ur=new WeakSet,x_=function(){if(!(typeof ResizeObserver>"u")){l(this,Nn)||m(this,Nn,new ResizeObserver(()=>d(this,ur,gc).call(this))),l(this,Nn).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,Nn).observe(e)}},gc=function(){const e=new Set;for(const r of this.querySelectorAll(".tool-text")){const i=r.dataset.toolCallId;if(i){if(this.expandedTexts.has(i)){e.add(i);continue}r.scrollHeight>r.clientHeight+1&&e.add(i)}}nU(this.overflowingTexts,e)||(this.overflowingTexts=e)},g(up,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),g(up,"attributes",{expanded:{type:Boolean}});function X4(n){switch(n){case"read":return"Reading files…";case"edit":return"Editing files…";case"delete":return"Deleting files…";case"move":return"Moving files…";case"search":return"Searching files…";case"execute":return"Running commands…";case"think":return"Thinking…";case"fetch":return"Fetching content…";case"switch_mode":return"Switching modes…";default:return"Working…"}}const Q4=160;let eU=0;function tU(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function nU(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}customElements.define("agent-activity",up);function rU(n){const t=[];let e=0;for(;e<n.length;)if(n[e].kind==="tool_call"){const i=[];for(;e<n.length&&n[e].kind==="tool_call";)i.push(n[e]),e+=1;const s=e>=n.length;t.push({kind:"tool-run",toolCalls:i,live:s})}else t.push({kind:"message",message:n[e]}),e+=1;const r=n[n.length-1];return r&&r.kind==="user"&&t.push({kind:"thinking"}),t}const gy=8,my=new WeakMap;function iU(n){const t=my.get(n);if(t&&t.text===n.text)return t.html;const e=Rf(n.text);return my.set(n,{text:n.text,html:e}),e}function vy(n){for(let t=n.length-1;t>=0;t-=1){const e=n[t];if(e&&e.kind==="user")return e.id}return null}var wt,St,ci,ui,lr,$t,T_,hp,$_,Xc,Qc,dp;class A_ extends Ei{constructor(){super(...arguments);b(this,$t);g(this,"messages",[]);b(this,wt,!0);b(this,St,null);b(this,ci,null);b(this,ui,null);b(this,lr,!1);b(this,Xc,()=>{if(l(this,lr))return;const e=l(this,St);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=gy;i!==l(this,wt)&&(m(this,wt,i),this.toggleAttribute("data-pinned",i))});b(this,Qc,()=>{m(this,wt,!0),this.toggleAttribute("data-pinned",!0),d(this,$t,dp).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=vy(this.messages);r=s!==null&&s!==vy(i),r&&m(this,wt,!0)}Ue(this.template(),this),l(this,St)||(m(this,St,this.querySelector(".history-scroll")),l(this,St)&&d(this,$t,T_).call(this)),this.toggleAttribute("data-pinned",l(this,wt)),d(this,$t,hp).call(this),d(this,$t,dp).call(this,r)}disconnected(){var e,r;(e=l(this,ci))==null||e.disconnect(),m(this,ci,null),(r=l(this,ui))==null||r.disconnect(),m(this,ui,null)}template(){const e=rU(this.messages);return P`
658
658
  <div class="history-scroll" @scroll=${l(this,Xc)}>
659
659
  ${e.map(r=>{if(r.kind==="tool-run")return P`<agent-activity
660
660
  .phase=${r.live?"using":"final"}
@@ -662,7 +662,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
662
662
  ></agent-activity>`;if(r.kind==="thinking")return P`<agent-activity
663
663
  .phase=${"thinking"}
664
664
  .toolCalls=${[]}
665
- ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?OO(oU(i)):i.text;return P`<div
665
+ ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?MO(iU(i)):i.text;return P`<div
666
666
  class="message message-${i.kind}"
667
667
  data-message-id=${i.id}
668
668
  >${s}</div>`})}
@@ -675,7 +675,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
675
675
  >
676
676
  ${Rc({size:16})}
677
677
  </button>
678
- `}}wt=new WeakMap,St=new WeakMap,ci=new WeakMap,ui=new WeakMap,lr=new WeakMap,$t=new WeakSet,C_=function(){l(this,St)&&(typeof ResizeObserver>"u"||(m(this,ci,new ResizeObserver(()=>d(this,$t,I_).call(this))),m(this,ui,new MutationObserver(()=>d(this,$t,dp).call(this))),l(this,ui).observe(l(this,St),{childList:!0})))},dp=function(){const e=l(this,St),r=l(this,ci);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},I_=function(){const e=l(this,St);if(!e)return;if(l(this,wt)){m(this,lr,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{m(this,lr,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=vy;i!==l(this,wt)&&(m(this,wt,i),this.toggleAttribute("data-pinned",i))},Xc=new WeakMap,Qc=new WeakMap,pp=function(e){requestAnimationFrame(()=>{const r=l(this,St);r&&(!l(this,wt)&&!e||(m(this,lr,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{m(this,lr,!1)})))})},g($_,"properties",["messages"]);customElements.define("message-history",$_);var Ft,Ja,Ps,vn,Ls,Ds,Xa,Ms,eu,tu,nu,Et,mc,Qa,gp,mp,el,tl;class fp extends Ei{constructor(){super(...arguments);b(this,Et);g(this,"placeholder","What do you want to do?");g(this,"open",!1);g(this,"messages",[]);g(this,"status","disconnected");b(this,Ft,bn.resolve("ServerManager"));b(this,Ja,bn.resolve("ShortcutService"));b(this,Ps,null);b(this,vn,null);b(this,Ls,()=>{var e;this.status=((e=l(this,vn))==null?void 0:e.status)??"disconnected"});b(this,Ds,()=>{var e;this.messages=((e=l(this,vn))==null?void 0:e.messages)??[]});b(this,Xa,()=>{var e,r;(e=l(this,vn))==null||e.removeEventListener("status-changed",l(this,Ls)),(r=l(this,vn))==null||r.removeEventListener("messages-changed",l(this,Ds)),m(this,vn,null)});b(this,Ms,()=>{var r;const e=((r=l(this,Ft).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,vn)&&(l(this,Xa).call(this),m(this,vn,e),e==null||e.addEventListener("status-changed",l(this,Ls)),e==null||e.addEventListener("messages-changed",l(this,Ds)),l(this,Ls).call(this),l(this,Ds).call(this),e!=null&&e.enabled&&e.status==="disconnected"&&e.connect().catch(i=>{console.error("ACPClient.connect() failed",i)}))});g(this,"handleTriggerActivate",()=>{var r;const e=(r=l(this,Ft).activeServer)==null?void 0:r.acpClient;e&&!e.enabled||(this.open=!0)});g(this,"handleKeydown",e=>{var o;if(e.key!=="Enter"||e.shiftKey)return;const r=e.currentTarget,i=r.value.trim();if(e.preventDefault(),!i)return;r.value="",d(this,Et,mc).call(this,r);const s=(o=l(this,Ft).activeServer)==null?void 0:o.acpClient;if(s!=null&&s.enabled){if(i==="/new"){s.startNewSession().catch(a=>{console.error("ACPClient.startNewSession() failed",a)});return}s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})}});b(this,eu,e=>{d(this,Et,mc).call(this,e.currentTarget)});b(this,tu,e=>{var i;e.stopPropagation();const r=(i=l(this,Ft).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});b(this,nu,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});b(this,Qa,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Ft).activeServer)==null?void 0:s.acpClient;if(r&&!r.enabled)return;if(!this.open){this.open=!0;return}const i=this.querySelector("textarea");if(i){if(document.activeElement===i){this.open=!1;return}i.focus()}});b(this,el,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});b(this,tl,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;m(this,Ps,e),l(this,Ft).addEventListener("change",l(this,Ms)),e.defer(()=>{l(this,Ft).removeEventListener("change",l(this,Ms)),l(this,Xa).call(this)}),l(this,Ms).call(this),l(this,Ja).addEventListener("shortcut-triggered",l(this,Qa)),e.defer(()=>l(this,Ja).removeEventListener("shortcut-triggered",l(this,Qa))),this.open&&d(this,Et,gp).call(this)}disconnected(){var e;(e=l(this,Ps))==null||e.dispose(),m(this,Ps,null),d(this,Et,mp).call(this)}changed(e){if(this.open&&this.status!=="disconnected"?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Ue(this.template(),this),e.has("open"))if(this.open){d(this,Et,gp).call(this);const r=this.querySelector("textarea");r&&(d(this,Et,mc).call(this,r),r.focus())}else d(this,Et,mp).call(this)}template(){var i;const e=(i=l(this,Ft).activeServer)==null?void 0:i.acpClient;if(e&&!e.enabled||this.status==="disposed")return null;if(this.status==="disconnected")return P`
678
+ `}}wt=new WeakMap,St=new WeakMap,ci=new WeakMap,ui=new WeakMap,lr=new WeakMap,$t=new WeakSet,T_=function(){l(this,St)&&(typeof ResizeObserver>"u"||(m(this,ci,new ResizeObserver(()=>d(this,$t,$_).call(this))),m(this,ui,new MutationObserver(()=>d(this,$t,hp).call(this))),l(this,ui).observe(l(this,St),{childList:!0})))},hp=function(){const e=l(this,St),r=l(this,ci);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},$_=function(){const e=l(this,St);if(!e)return;if(l(this,wt)){m(this,lr,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{m(this,lr,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=gy;i!==l(this,wt)&&(m(this,wt,i),this.toggleAttribute("data-pinned",i))},Xc=new WeakMap,Qc=new WeakMap,dp=function(e){requestAnimationFrame(()=>{const r=l(this,St);r&&(!l(this,wt)&&!e||(m(this,lr,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{m(this,lr,!1)})))})},g(A_,"properties",["messages"]);customElements.define("message-history",A_);var Ft,Ja,Ps,vn,Ls,Ds,Xa,Ms,eu,tu,nu,Et,mc,Qa,fp,gp,el,tl;class pp extends Ei{constructor(){super(...arguments);b(this,Et);g(this,"placeholder","What do you want to do?");g(this,"open",!1);g(this,"messages",[]);g(this,"status","disconnected");b(this,Ft,bn.resolve("ServerManager"));b(this,Ja,bn.resolve("ShortcutService"));b(this,Ps,null);b(this,vn,null);b(this,Ls,()=>{var e;this.status=((e=l(this,vn))==null?void 0:e.status)??"disconnected"});b(this,Ds,()=>{var e;this.messages=((e=l(this,vn))==null?void 0:e.messages)??[]});b(this,Xa,()=>{var e,r;(e=l(this,vn))==null||e.removeEventListener("status-changed",l(this,Ls)),(r=l(this,vn))==null||r.removeEventListener("messages-changed",l(this,Ds)),m(this,vn,null)});b(this,Ms,()=>{var r;const e=((r=l(this,Ft).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,vn)&&(l(this,Xa).call(this),m(this,vn,e),e==null||e.addEventListener("status-changed",l(this,Ls)),e==null||e.addEventListener("messages-changed",l(this,Ds)),l(this,Ls).call(this),l(this,Ds).call(this),e!=null&&e.enabled&&e.status==="disconnected"&&e.connect().catch(i=>{console.error("ACPClient.connect() failed",i)}))});g(this,"handleTriggerActivate",()=>{var r;const e=(r=l(this,Ft).activeServer)==null?void 0:r.acpClient;e&&!e.enabled||(this.open=!0)});g(this,"handleKeydown",e=>{var o;if(e.key!=="Enter"||e.shiftKey)return;const r=e.currentTarget,i=r.value.trim();if(e.preventDefault(),!i)return;r.value="",d(this,Et,mc).call(this,r);const s=(o=l(this,Ft).activeServer)==null?void 0:o.acpClient;if(s!=null&&s.enabled){if(i==="/new"){s.startNewSession().catch(a=>{console.error("ACPClient.startNewSession() failed",a)});return}s.sendMessage({text:i}).catch(a=>{console.error("ACPClient.sendMessage() failed",a)})}});b(this,eu,e=>{d(this,Et,mc).call(this,e.currentTarget)});b(this,tu,e=>{var i;e.stopPropagation();const r=(i=l(this,Ft).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});b(this,nu,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});b(this,Qa,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Ft).activeServer)==null?void 0:s.acpClient;if(r&&!r.enabled)return;if(!this.open){this.open=!0;return}const i=this.querySelector("textarea");if(i){if(document.activeElement===i){this.open=!1;return}i.focus()}});b(this,el,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});b(this,tl,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;m(this,Ps,e),l(this,Ft).addEventListener("change",l(this,Ms)),e.defer(()=>{l(this,Ft).removeEventListener("change",l(this,Ms)),l(this,Xa).call(this)}),l(this,Ms).call(this),l(this,Ja).addEventListener("shortcut-triggered",l(this,Qa)),e.defer(()=>l(this,Ja).removeEventListener("shortcut-triggered",l(this,Qa))),this.open&&d(this,Et,fp).call(this)}disconnected(){var e;(e=l(this,Ps))==null||e.dispose(),m(this,Ps,null),d(this,Et,gp).call(this)}changed(e){if(this.open&&this.status!=="disconnected"?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Ue(this.template(),this),e.has("open"))if(this.open){d(this,Et,fp).call(this);const r=this.querySelector("textarea");r&&(d(this,Et,mc).call(this,r),r.focus())}else d(this,Et,gp).call(this)}template(){var i;const e=(i=l(this,Ft).activeServer)==null?void 0:i.acpClient;if(e&&!e.enabled||this.status==="disposed")return null;if(this.status==="disconnected")return P`
679
679
  <div class="connecting" aria-disabled="true">
680
680
  <ui-spinner size="16" weight="bold"></ui-spinner>
681
681
  <span class="label">Connecting<span class="dots" aria-hidden="true"></span></span>
@@ -712,7 +712,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
712
712
  ?disabled=${o}
713
713
  @click=${l(this,tu)}
714
714
  >
715
- ${o?P`<ui-spinner size="16" weight="bold"></ui-spinner>`:JO({size:16})}
715
+ ${o?P`<ui-spinner size="16" weight="bold"></ui-spinner>`:YO({size:16})}
716
716
  </button>
717
717
  `:null}
718
718
  </div>
@@ -728,22 +728,22 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
728
728
  <span class="label">${this.placeholder}</span>
729
729
  <span class="kbd" aria-hidden="true">⌘K</span>
730
730
  </div>
731
- `}}Ft=new WeakMap,Ja=new WeakMap,Ps=new WeakMap,vn=new WeakMap,Ls=new WeakMap,Ds=new WeakMap,Xa=new WeakMap,Ms=new WeakMap,eu=new WeakMap,tu=new WeakMap,nu=new WeakMap,Et=new WeakSet,mc=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},Qa=new WeakMap,gp=function(){document.addEventListener("mousedown",l(this,el)),document.addEventListener("keydown",l(this,tl))},mp=function(){document.removeEventListener("mousedown",l(this,el)),document.removeEventListener("keydown",l(this,tl))},el=new WeakMap,tl=new WeakMap,g(fp,"properties",["placeholder","open","messages","status"]),g(fp,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",fp);const wy="tv-update-dismissed",Yo={update_available:"Update available",copy_prompt:"Copy upgrade prompt",copied:"Copied!",later:"Later"},aU=1500;function lU(n,t){return t===null?!0:qb(n,t)}const Sy=new Set;function cU(n,t){const e=typeof navigator>"u"?void 0:navigator.clipboard;if(e&&typeof e.writeText=="function"){e.writeText(n).catch(()=>{});return}const r=document.createElement("textarea");r.value=n,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",t.appendChild(r),r.select();try{document.execCommand("copy")}catch{}r.remove()}const uU=`
731
+ `}}Ft=new WeakMap,Ja=new WeakMap,Ps=new WeakMap,vn=new WeakMap,Ls=new WeakMap,Ds=new WeakMap,Xa=new WeakMap,Ms=new WeakMap,eu=new WeakMap,tu=new WeakMap,nu=new WeakMap,Et=new WeakSet,mc=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},Qa=new WeakMap,fp=function(){document.addEventListener("mousedown",l(this,el)),document.addEventListener("keydown",l(this,tl))},gp=function(){document.removeEventListener("mousedown",l(this,el)),document.removeEventListener("keydown",l(this,tl))},el=new WeakMap,tl=new WeakMap,g(pp,"properties",["placeholder","open","messages","status"]),g(pp,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",pp);const yy="tv-update-dismissed",Yo={update_available:"Update available",copy_prompt:"Copy upgrade prompt",copied:"Copied!",later:"Later"},sU=1500;function oU(n,t){return t===null?!0:jb(n,t)}const by=new Set;function aU(n,t){const e=typeof navigator>"u"?void 0:navigator.clipboard;if(e&&typeof e.writeText=="function"){e.writeText(n).catch(()=>{});return}const r=document.createElement("textarea");r.value=n,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",t.appendChild(r),r.select();try{document.execCommand("copy")}catch{}r.remove()}const lU=`
732
732
  <button class="update-bell" icon-only aria-expanded="false"
733
733
  aria-label="${Yo.update_available}" title="${Yo.update_available}">
734
734
  <tv-icon name="bell-ringing"></tv-icon>
735
735
  </button>
736
- `,hU=`
736
+ `,cU=`
737
737
  <span class="update-copy-idle"><tv-icon name="copy-simple"></tv-icon>${Yo.copy_prompt}</span>
738
738
  <span class="update-copy-done"><tv-icon name="check"></tv-icon>${Yo.copied}</span>
739
- `;var ft,Ht,zs,hi,di,Os,_t,pi,fi,gt,gi,H,vp,yp,bp,wp,nl,mi,Lr,R_,Sp,_p,kp,P_,Ep,ru,rl,iu,qn,xp;class dU extends HTMLElement{constructor(){super(...arguments);b(this,H);g(this,"primaryServerURL","");b(this,ft,null);b(this,Ht,null);b(this,zs);b(this,hi,!1);b(this,di,!1);b(this,Os,null);b(this,_t,!1);b(this,pi,null);b(this,fi,!1);b(this,gt,null);b(this,gi,[]);b(this,nl,()=>{d(this,H,qn).call(this)});b(this,mi,()=>{d(this,H,kp).call(this),d(this,H,qn).call(this)});b(this,ru,()=>{var r,i;const e=((i=(r=d(this,H,Lr).call(this))==null?void 0:r.updateState)==null?void 0:i.toast)??null;e!==null&&(l(this,_t)?d(this,H,Ep).call(this):d(this,H,P_).call(this,e))});b(this,rl,()=>{l(this,_t)&&d(this,H,Ep).call(this)});b(this,iu,e=>{var s,o;const r=((o=(s=d(this,H,Lr).call(this))==null?void 0:s.updateState)==null?void 0:o.toast)??null,i=r==null?void 0:r.prompt;r===null||i===void 0||(cU(i,this),d(this,H,_p).call(this,"update_prompt_copy_clicked",r),m(this,fi,!0),e.currentTarget.classList.add("copied"),l(this,gt)!==null&&clearTimeout(l(this,gt)),m(this,gt,setTimeout(()=>{var a;m(this,gt,null),m(this,fi,!1),(a=this.querySelector(".update-copy"))==null||a.classList.remove("copied")},aU)))})}get manager(){return l(this,ft)}set manager(e){e!==l(this,ft)&&(d(this,H,yp).call(this),m(this,ft,e),this.isConnected&&(d(this,H,vp).call(this),d(this,H,qn).call(this)))}get dismissalStorage(){return l(this,zs)!==void 0?l(this,zs):typeof localStorage>"u"?null:localStorage}set dismissalStorage(e){m(this,zs,e)}get presentation(){return l(this,Ht)}set presentation(e){e!==l(this,Ht)&&(d(this,H,wp).call(this),m(this,Ht,e),this.isConnected&&(d(this,H,bp).call(this),d(this,H,qn).call(this)))}connectedCallback(){d(this,H,vp).call(this),d(this,H,bp).call(this),d(this,H,qn).call(this)}disconnectedCallback(){d(this,H,yp).call(this),d(this,H,wp).call(this),l(this,gt)!==null&&(clearTimeout(l(this,gt)),m(this,gt,null))}}ft=new WeakMap,Ht=new WeakMap,zs=new WeakMap,hi=new WeakMap,di=new WeakMap,Os=new WeakMap,_t=new WeakMap,pi=new WeakMap,fi=new WeakMap,gt=new WeakMap,gi=new WeakMap,H=new WeakSet,vp=function(){l(this,hi)||l(this,ft)===null||(l(this,ft).addEventListener("server-status",l(this,mi)),l(this,ft).addEventListener("change",l(this,mi)),m(this,hi,!0))},yp=function(){!l(this,hi)||l(this,ft)===null||(l(this,ft).removeEventListener("server-status",l(this,mi)),l(this,ft).removeEventListener("change",l(this,mi)),m(this,hi,!1))},bp=function(){l(this,di)||l(this,Ht)===null||(l(this,Ht).addEventListener("change",l(this,nl)),m(this,di,!0))},wp=function(){!l(this,di)||l(this,Ht)===null||(l(this,Ht).removeEventListener("change",l(this,nl)),m(this,di,!1))},nl=new WeakMap,mi=new WeakMap,Lr=function(){var e;return((e=l(this,ft))==null?void 0:e.servers.get(this.primaryServerURL))??null},R_=function(){var r;const e=((r=this.dismissalStorage)==null?void 0:r.getItem(wy))??null;return e!==null&&af(e)?e:null},Sp=function(e){Sy.has(e.version)||(Sy.add(e.version),d(this,H,_p).call(this,"update_toast_shown",e))},_p=function(e,r){var i;l(this,gi).push({event:e,properties:{server_version:((i=d(this,H,Lr).call(this))==null?void 0:i.serverVersion)??"",channel_version:r.version}}),d(this,H,kp).call(this)},kp=function(){if(l(this,gi).length===0)return;const e=d(this,H,Lr).call(this);if(!e||e.status!=="connected")return;const r=l(this,gi);m(this,gi,[]);for(const i of r)e.sendTelemetrySignal(i.event,i.properties)},P_=function(e){l(this,_t)||(m(this,_t,!0),d(this,H,Sp).call(this,e),d(this,H,qn).call(this))},Ep=function(){var r,i,s;const e=((i=(r=d(this,H,Lr).call(this))==null?void 0:r.updateState)==null?void 0:i.toast)??null;e!==null&&((s=this.dismissalStorage)==null||s.setItem(wy,e.version)),m(this,_t,!1),m(this,fi,!1),l(this,gt)!==null&&(clearTimeout(l(this,gt)),m(this,gt,null)),d(this,H,qn).call(this)},ru=new WeakMap,rl=new WeakMap,iu=new WeakMap,qn=function(){var c,u,h;const e=((u=(c=d(this,H,Lr).call(this))==null?void 0:c.updateState)==null?void 0:u.toast)??null,r=((h=l(this,Ht))==null?void 0:h.toastsSuppressed)??!1;if(e===null?(m(this,Os,null),m(this,_t,!1)):e.version!==l(this,Os)&&(m(this,Os,e.version),m(this,_t,lU(e.version,d(this,H,R_).call(this))),l(this,_t)&&!r&&d(this,H,Sp).call(this,e)),!(e!==null&&!r)){this.replaceChildren(),this.removeAttribute("open"),m(this,pi,null);return}const s=l(this,_t);this.toggleAttribute("open",s);let o=this.querySelector(".update-bell");o===null&&(this.insertAdjacentHTML("afterbegin",uU),o=this.querySelector(".update-bell"),o.addEventListener("click",l(this,ru)));const a=this.querySelector("ui-popover");s&&a===null?d(this,H,xp).call(this,e,o):!s&&a!==null?(a.remove(),m(this,pi,null)):s&&a!==null&&(l(this,pi)!==e.markdown||a.querySelector(".update-copy")!==null!=(e.prompt!==void 0))&&(a.remove(),d(this,H,xp).call(this,e,o)),o.setAttribute("aria-expanded",String(s))},xp=function(e,r){const i=document.createElement("ui-popover");i.className="update-popover",i.setAttribute("placement","bottom-end"),i.setAttribute("role","status"),i.setAttribute("no-autofocus",""),i.setAttribute("no-light-dismiss",""),i.innerHTML=Pf(e.markdown),m(this,pi,e.markdown);const s=document.createElement("action-row"),o=document.createElement("button");if(o.setAttribute("size","sm"),o.className="update-later",o.textContent=Yo.later,o.addEventListener("click",l(this,rl)),s.append(o),e.prompt!==void 0){const a=document.createElement("button");a.setAttribute("size","sm"),a.setAttribute("variant","primary"),a.className=l(this,fi)?"update-copy copied":"update-copy",a.innerHTML=hU,a.addEventListener("click",l(this,iu)),s.append(a)}i.append(s),i.addEventListener("close",l(this,rl)),i.anchor=r,i.setAttribute("open",""),this.appendChild(i)};customElements.get("update-notification")||customElements.define("update-notification",dU);const pU=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,fU=""+new URL("table-oeG9uAN1.png",import.meta.url).href,gU=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,mU=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,vU=[{name:"Calendar",description:"Visualize your calendar events across day and week views.",prompt:"Use the tv-calendar skill to make a calendar artifact for the following request, and put it on TV: ",thumb:pU},{name:"Table",description:"Beautiful tables with headers, grouping, and chips for displaying data.",prompt:"Use the tv-table skill to make a table artifact for the following request, and put it on TV: ",thumb:fU},{name:"Tasks",description:"Track tasks and plans in a checklist, with due dates, projects, and labels.",prompt:"Use the tv-tasks skill to make a task list artifact for the following request, and put it on TV: ",thumb:gU},{name:"Markdown",description:"An interactive markdown editor for Obsidian notes and other formatted docs.",prompt:"Make a markdown artifact for the following request, and put it on TV: ",thumb:mU}],_y="Artifact skills",yU="Artifact skills",bU="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",wU="Copy prompt",SU="Copied";var il,Ns,vr,L_,D_,M_,su,ou;class Ap extends Ei{constructor(){super(...arguments);b(this,vr);g(this,"open",!1);b(this,il,Hr());b(this,Ns,Hr());b(this,su,()=>{this.open=!this.open});b(this,ou,()=>{this.open=!1})}changed(){d(this,vr,L_).call(this)}}il=new WeakMap,Ns=new WeakMap,vr=new WeakSet,L_=function(){Ue(d(this,vr,D_).call(this),this),l(this,Ns).value&&(l(this,Ns).value.anchor=l(this,il).value??null)},D_=function(){return P`
739
+ `;var ft,Ht,zs,hi,di,Os,_t,pi,fi,gt,gi,H,mp,vp,yp,bp,nl,mi,Lr,C_,wp,Sp,_p,I_,kp,ru,rl,iu,qn,Ep;class uU extends HTMLElement{constructor(){super(...arguments);b(this,H);g(this,"primaryServerURL","");b(this,ft,null);b(this,Ht,null);b(this,zs);b(this,hi,!1);b(this,di,!1);b(this,Os,null);b(this,_t,!1);b(this,pi,null);b(this,fi,!1);b(this,gt,null);b(this,gi,[]);b(this,nl,()=>{d(this,H,qn).call(this)});b(this,mi,()=>{d(this,H,_p).call(this),d(this,H,qn).call(this)});b(this,ru,()=>{var r,i;const e=((i=(r=d(this,H,Lr).call(this))==null?void 0:r.updateState)==null?void 0:i.toast)??null;e!==null&&(l(this,_t)?d(this,H,kp).call(this):d(this,H,I_).call(this,e))});b(this,rl,()=>{l(this,_t)&&d(this,H,kp).call(this)});b(this,iu,e=>{var s,o;const r=((o=(s=d(this,H,Lr).call(this))==null?void 0:s.updateState)==null?void 0:o.toast)??null,i=r==null?void 0:r.prompt;r===null||i===void 0||(aU(i,this),d(this,H,Sp).call(this,"update_prompt_copy_clicked",r),m(this,fi,!0),e.currentTarget.classList.add("copied"),l(this,gt)!==null&&clearTimeout(l(this,gt)),m(this,gt,setTimeout(()=>{var a;m(this,gt,null),m(this,fi,!1),(a=this.querySelector(".update-copy"))==null||a.classList.remove("copied")},sU)))})}get manager(){return l(this,ft)}set manager(e){e!==l(this,ft)&&(d(this,H,vp).call(this),m(this,ft,e),this.isConnected&&(d(this,H,mp).call(this),d(this,H,qn).call(this)))}get dismissalStorage(){return l(this,zs)!==void 0?l(this,zs):typeof localStorage>"u"?null:localStorage}set dismissalStorage(e){m(this,zs,e)}get presentation(){return l(this,Ht)}set presentation(e){e!==l(this,Ht)&&(d(this,H,bp).call(this),m(this,Ht,e),this.isConnected&&(d(this,H,yp).call(this),d(this,H,qn).call(this)))}connectedCallback(){d(this,H,mp).call(this),d(this,H,yp).call(this),d(this,H,qn).call(this)}disconnectedCallback(){d(this,H,vp).call(this),d(this,H,bp).call(this),l(this,gt)!==null&&(clearTimeout(l(this,gt)),m(this,gt,null))}}ft=new WeakMap,Ht=new WeakMap,zs=new WeakMap,hi=new WeakMap,di=new WeakMap,Os=new WeakMap,_t=new WeakMap,pi=new WeakMap,fi=new WeakMap,gt=new WeakMap,gi=new WeakMap,H=new WeakSet,mp=function(){l(this,hi)||l(this,ft)===null||(l(this,ft).addEventListener("server-status",l(this,mi)),l(this,ft).addEventListener("change",l(this,mi)),m(this,hi,!0))},vp=function(){!l(this,hi)||l(this,ft)===null||(l(this,ft).removeEventListener("server-status",l(this,mi)),l(this,ft).removeEventListener("change",l(this,mi)),m(this,hi,!1))},yp=function(){l(this,di)||l(this,Ht)===null||(l(this,Ht).addEventListener("change",l(this,nl)),m(this,di,!0))},bp=function(){!l(this,di)||l(this,Ht)===null||(l(this,Ht).removeEventListener("change",l(this,nl)),m(this,di,!1))},nl=new WeakMap,mi=new WeakMap,Lr=function(){var e;return((e=l(this,ft))==null?void 0:e.servers.get(this.primaryServerURL))??null},C_=function(){var r;const e=((r=this.dismissalStorage)==null?void 0:r.getItem(yy))??null;return e!==null&&of(e)?e:null},wp=function(e){by.has(e.version)||(by.add(e.version),d(this,H,Sp).call(this,"update_toast_shown",e))},Sp=function(e,r){var i;l(this,gi).push({event:e,properties:{server_version:((i=d(this,H,Lr).call(this))==null?void 0:i.serverVersion)??"",channel_version:r.version}}),d(this,H,_p).call(this)},_p=function(){if(l(this,gi).length===0)return;const e=d(this,H,Lr).call(this);if(!e||e.status!=="connected")return;const r=l(this,gi);m(this,gi,[]);for(const i of r)e.sendTelemetrySignal(i.event,i.properties)},I_=function(e){l(this,_t)||(m(this,_t,!0),d(this,H,wp).call(this,e),d(this,H,qn).call(this))},kp=function(){var r,i,s;const e=((i=(r=d(this,H,Lr).call(this))==null?void 0:r.updateState)==null?void 0:i.toast)??null;e!==null&&((s=this.dismissalStorage)==null||s.setItem(yy,e.version)),m(this,_t,!1),m(this,fi,!1),l(this,gt)!==null&&(clearTimeout(l(this,gt)),m(this,gt,null)),d(this,H,qn).call(this)},ru=new WeakMap,rl=new WeakMap,iu=new WeakMap,qn=function(){var c,u,h;const e=((u=(c=d(this,H,Lr).call(this))==null?void 0:c.updateState)==null?void 0:u.toast)??null,r=((h=l(this,Ht))==null?void 0:h.toastsSuppressed)??!1;if(e===null?(m(this,Os,null),m(this,_t,!1)):e.version!==l(this,Os)&&(m(this,Os,e.version),m(this,_t,oU(e.version,d(this,H,C_).call(this))),l(this,_t)&&!r&&d(this,H,wp).call(this,e)),!(e!==null&&!r)){this.replaceChildren(),this.removeAttribute("open"),m(this,pi,null);return}const s=l(this,_t);this.toggleAttribute("open",s);let o=this.querySelector(".update-bell");o===null&&(this.insertAdjacentHTML("afterbegin",lU),o=this.querySelector(".update-bell"),o.addEventListener("click",l(this,ru)));const a=this.querySelector("ui-popover");s&&a===null?d(this,H,Ep).call(this,e,o):!s&&a!==null?(a.remove(),m(this,pi,null)):s&&a!==null&&(l(this,pi)!==e.markdown||a.querySelector(".update-copy")!==null!=(e.prompt!==void 0))&&(a.remove(),d(this,H,Ep).call(this,e,o)),o.setAttribute("aria-expanded",String(s))},Ep=function(e,r){const i=document.createElement("ui-popover");i.className="update-popover",i.setAttribute("placement","bottom-end"),i.setAttribute("role","status"),i.setAttribute("no-autofocus",""),i.setAttribute("no-light-dismiss",""),i.innerHTML=Rf(e.markdown),m(this,pi,e.markdown);const s=document.createElement("action-row"),o=document.createElement("button");if(o.setAttribute("size","sm"),o.className="update-later",o.textContent=Yo.later,o.addEventListener("click",l(this,rl)),s.append(o),e.prompt!==void 0){const a=document.createElement("button");a.setAttribute("size","sm"),a.setAttribute("variant","primary"),a.className=l(this,fi)?"update-copy copied":"update-copy",a.innerHTML=cU,a.addEventListener("click",l(this,iu)),s.append(a)}i.append(s),i.addEventListener("close",l(this,rl)),i.anchor=r,i.setAttribute("open",""),this.appendChild(i)};customElements.get("update-notification")||customElements.define("update-notification",uU);const hU=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,dU=""+new URL("table-oeG9uAN1.png",import.meta.url).href,pU=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,fU=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,gU=[{name:"Calendar",description:"Visualize your calendar events across day and week views.",prompt:"Use the tv-calendar skill to make a calendar artifact for the following request, and put it on TV: ",thumb:hU},{name:"Table",description:"Beautiful tables with headers, grouping, and chips for displaying data.",prompt:"Use the tv-table skill to make a table artifact for the following request, and put it on TV: ",thumb:dU},{name:"Tasks",description:"Track tasks and plans in a checklist, with due dates, projects, and labels.",prompt:"Use the tv-tasks skill to make a task list artifact for the following request, and put it on TV: ",thumb:pU},{name:"Markdown",description:"An interactive markdown editor for Obsidian notes and other formatted docs.",prompt:"Make a markdown artifact for the following request, and put it on TV: ",thumb:fU}],wy="Artifact skills",mU="Artifact skills",vU="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",yU="Copy prompt",bU="Copied";var il,Ns,vr,R_,P_,L_,su,ou;class xp extends Ei{constructor(){super(...arguments);b(this,vr);g(this,"open",!1);b(this,il,Hr());b(this,Ns,Hr());b(this,su,()=>{this.open=!this.open});b(this,ou,()=>{this.open=!1})}changed(){d(this,vr,R_).call(this)}}il=new WeakMap,Ns=new WeakMap,vr=new WeakSet,R_=function(){Ue(d(this,vr,P_).call(this),this),l(this,Ns).value&&(l(this,Ns).value.anchor=l(this,il).value??null)},P_=function(){return P`
740
740
  <button
741
741
  class="skill-trigger"
742
742
  variant="glass"
743
743
  icon-only
744
744
  aria-expanded=${this.open?"true":"false"}
745
- aria-label=${_y}
746
- title=${_y}
745
+ aria-label=${wy}
746
+ title=${wy}
747
747
  @click=${l(this,su)}
748
748
  ${Vr(l(this,il))}
749
749
  >
@@ -758,13 +758,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
758
758
  @close=${l(this,ou)}
759
759
  ${Vr(l(this,Ns))}
760
760
  >
761
- <div class="skill-heading">${yU}</div>
762
- <p class="skill-intro">${bU}</p>
761
+ <div class="skill-heading">${mU}</div>
762
+ <p class="skill-intro">${vU}</p>
763
763
  <div class="skill-grid">
764
- ${vU.map(e=>d(this,vr,M_).call(this,e))}
764
+ ${gU.map(e=>d(this,vr,L_).call(this,e))}
765
765
  </div>
766
766
  </ui-popover>
767
- `},M_=function(e){return P`
767
+ `},L_=function(e){return P`
768
768
  <article class="skill-card">
769
769
  <div class="skill-thumb"><img src=${e.thumb} alt="" /></div>
770
770
  <div class="skill-name">${e.name}</div>
@@ -772,21 +772,21 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
772
772
  <copy-button prompt=${e.prompt}>
773
773
  <button size="sm">
774
774
  <span class="copy-button-idle">
775
- <tv-icon name="copy-simple"></tv-icon>${wU}
775
+ <tv-icon name="copy-simple"></tv-icon>${yU}
776
776
  </span>
777
777
  <span class="copy-button-done">
778
- <tv-icon name="check"></tv-icon>${SU}
778
+ <tv-icon name="check"></tv-icon>${bU}
779
779
  </span>
780
780
  </button>
781
781
  </copy-button>
782
782
  </article>
783
- `},su=new WeakMap,ou=new WeakMap,g(Ap,"properties",["open"]),g(Ap,"attributes",{open:{type:Boolean}});customElements.get("skill-selector")||customElements.define("skill-selector",Ap);const _U='<path d="M128,112a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm80-72H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/>';class z_ extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});g(this,"token");this.token=e}}class kU extends HTMLElement{constructor(){super(...arguments);g(this,"_invalid",!1);g(this,"_tokenValue","")}set invalid(e){this._invalid=e,this.render()}get invalid(){return this._invalid}set tokenValue(e){this._tokenValue=e,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(e){const r=e.currentTarget;this._tokenValue=r.value}handleSubmit(e){e.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new z_(r))}render(){Ue(P`
783
+ `},su=new WeakMap,ou=new WeakMap,g(xp,"properties",["open"]),g(xp,"attributes",{open:{type:Boolean}});customElements.get("skill-selector")||customElements.define("skill-selector",xp);const wU='<path d="M128,112a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm80-72H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/>';class D_ extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});g(this,"token");this.token=e}}class SU extends HTMLElement{constructor(){super(...arguments);g(this,"_invalid",!1);g(this,"_tokenValue","")}set invalid(e){this._invalid=e,this.render()}get invalid(){return this._invalid}set tokenValue(e){this._tokenValue=e,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(e){const r=e.currentTarget;this._tokenValue=r.value}handleSubmit(e){e.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new D_(r))}render(){Ue(P`
784
784
  <modal-overlay open>
785
785
  <system-modal material="glass-frosted" level="1" class="auth-modal">
786
786
  <form class="auth-form" @submit=${r=>this.handleSubmit(r)}>
787
787
  <header>
788
788
  <span class="auth-modal-icon" aria-hidden="true">
789
- <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${tS(_U)}</svg>
789
+ <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${Qw(wU)}</svg>
790
790
  </span>
791
791
  <hgroup>
792
792
  <h2>Enter access token</h2>
@@ -815,7 +815,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
815
815
  </form>
816
816
  </system-modal>
817
817
  </modal-overlay>
818
- `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",kU);const EU=250,xU=1e3;class O_ extends HTMLElement{constructor(){super(...arguments);g(this,"_nextRetryAt",null);g(this,"_hasEverConnected",!1);g(this,"tickHandle",null)}set nextRetryAt(e){e!==this._nextRetryAt&&(this._nextRetryAt=e,this.updateTickerState(),this.render())}get nextRetryAt(){return this._nextRetryAt}set hasEverConnected(e){e!==this._hasEverConnected&&(this._hasEverConnected=e,this.render())}get hasEverConnected(){return this._hasEverConnected}connectedCallback(){if(this._nextRetryAt===null&&this.hasAttribute("next-retry-at")){const e=Number(this.getAttribute("next-retry-at"));this._nextRetryAt=Number.isFinite(e)?e:null}this.updateTickerState(),this.render()}disconnectedCallback(){this.stopTicker()}attributeChangedCallback(e,r,i){if(e==="next-retry-at"){if(i===null||i==="")this._nextRetryAt=null;else{const s=Number(i);this._nextRetryAt=Number.isFinite(s)?s:null}this.updateTickerState()}else e==="has-ever-connected"&&(this._hasEverConnected=i!==null&&i!=="false");this.render()}updateTickerState(){this._nextRetryAt!==null?this.startTicker():this.stopTicker()}startTicker(){this.tickHandle===null&&(this.tickHandle=setInterval(()=>{this.render()},EU))}stopTicker(){this.tickHandle!==null&&(clearInterval(this.tickHandle),this.tickHandle=null)}render(){const e=this._hasEverConnected,r=e?"Disconnected":"Connecting",i=this._nextRetryAt!==null?this.formatCountdown(this._nextRetryAt):"Reattempting now…";Ue(P`
818
+ `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",SU);const _U=250,kU=1e3;class M_ extends HTMLElement{constructor(){super(...arguments);g(this,"_nextRetryAt",null);g(this,"_hasEverConnected",!1);g(this,"tickHandle",null)}set nextRetryAt(e){e!==this._nextRetryAt&&(this._nextRetryAt=e,this.updateTickerState(),this.render())}get nextRetryAt(){return this._nextRetryAt}set hasEverConnected(e){e!==this._hasEverConnected&&(this._hasEverConnected=e,this.render())}get hasEverConnected(){return this._hasEverConnected}connectedCallback(){if(this._nextRetryAt===null&&this.hasAttribute("next-retry-at")){const e=Number(this.getAttribute("next-retry-at"));this._nextRetryAt=Number.isFinite(e)?e:null}this.updateTickerState(),this.render()}disconnectedCallback(){this.stopTicker()}attributeChangedCallback(e,r,i){if(e==="next-retry-at"){if(i===null||i==="")this._nextRetryAt=null;else{const s=Number(i);this._nextRetryAt=Number.isFinite(s)?s:null}this.updateTickerState()}else e==="has-ever-connected"&&(this._hasEverConnected=i!==null&&i!=="false");this.render()}updateTickerState(){this._nextRetryAt!==null?this.startTicker():this.stopTicker()}startTicker(){this.tickHandle===null&&(this.tickHandle=setInterval(()=>{this.render()},_U))}stopTicker(){this.tickHandle!==null&&(clearInterval(this.tickHandle),this.tickHandle=null)}render(){const e=this._hasEverConnected,r=e?"Disconnected":"Connecting",i=this._nextRetryAt!==null?this.formatCountdown(this._nextRetryAt):"Reattempting now…";Ue(P`
819
819
  <modal-overlay open role="status" aria-live="polite">
820
820
  <system-modal material="glass-frosted" level="1" class="connecting-overlay-panel">
821
821
  <header>
@@ -827,7 +827,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
827
827
  </header>
828
828
  </system-modal>
829
829
  </modal-overlay>
830
- `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/xU)}s…`}}g(O_,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",O_);class AU extends HTMLElement{constructor(){super(...arguments);g(this,"runtimeServerURL",j0());g(this,"electronMode",Wt());g(this,"updatePresentation",null);g(this,"serverManager",bn.resolve("ServerManager"));g(this,"screenManager",bn.resolve("ScreenManager"));g(this,"connectError",null);g(this,"topRowResizeObserver",null);g(this,"observedTopRow",null);g(this,"handleServerManagerChange",()=>{var e;this.clearStoredTokenIfUnauthorized(),this.connectError!==null&&((e=this.serverManager.activeServer)==null?void 0:e.status)==="connected"&&(this.connectError=null),this.render()});g(this,"handleScreenManagerChange",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.addEventListener("tabs-changed",this.handleScreenManagerChange),this.addEventListener("auth-submit",e=>{var i;const r=e instanceof z_?e.token:e instanceof CustomEvent&&typeof((i=e.detail)==null?void 0:i.token)=="string"?e.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){var e;this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.removeEventListener("tabs-changed",this.handleScreenManagerChange),(e=this.topRowResizeObserver)==null||e.disconnect(),this.topRowResizeObserver=null,this.observedTopRow=null}async initializeConnection(){const e=JL();if(this.electronMode){e&&(this.serverManager.setStoredAuthToken(this.runtimeServerURL,e),this.stripTokenQueryParam()),this.serverManager.connectConfiguredServers(this.runtimeServerURL,e);return}if(this.serverManager.activeServer)return;e&&(this.serverManager.setStoredAuthToken(this.runtimeServerURL,e),this.stripTokenQueryParam());const r=e??this.serverManager.getStoredAuthToken(this.runtimeServerURL),i=new Ww({url:this.runtimeServerURL,name:"Server",token:r,telemetryMeta:this.serverManager.telemetryMeta});this.serverManager.add(i),this.serverManager.setActive(i);try{await i.connect(r),this.connectError=null}catch(s){this.connectError=s instanceof Error&&!(s instanceof Oo)?s.message:null}this.render()}async handleAuthSubmit(e){const r=this.serverManager.activeServer;if(r){this.connectError=null,this.serverManager.setStoredAuthToken(r.url,e);try{await r.connect(e)}catch(i){i instanceof Oo||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}stripTokenQueryParam(){const e=new URL(window.location.href);e.searchParams.delete("token"),window.history.replaceState({},"",`${e.pathname}${e.search}${e.hash}`)}clearStoredTokenIfUnauthorized(){const e=this.serverManager.activeServer;!e||e.status!=="unauthorized"||!e.token||!e.hasAuthRejected||(this.serverManager.clearStoredAuthToken(e.url),e.clearToken())}render(){const e=this.serverManager.activeServer,r=(e==null?void 0:e.status)??null,i=this.screenManager.activeScreen,s=!!(e&&i&&this.screenManager.hasTab(e.url,i.id));if(r==="unauthorized"){const f=e;if(!f)return;Ue(P`
830
+ `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/kU)}s…`}}g(M_,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",M_);class EU extends HTMLElement{constructor(){super(...arguments);g(this,"runtimeServerURL",B0());g(this,"electronMode",Wt());g(this,"updatePresentation",null);g(this,"serverManager",bn.resolve("ServerManager"));g(this,"screenManager",bn.resolve("ScreenManager"));g(this,"connectError",null);g(this,"topRowResizeObserver",null);g(this,"observedTopRow",null);g(this,"handleServerManagerChange",()=>{var e;this.clearStoredTokenIfUnauthorized(),this.connectError!==null&&((e=this.serverManager.activeServer)==null?void 0:e.status)==="connected"&&(this.connectError=null),this.render()});g(this,"handleScreenManagerChange",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.addEventListener("tabs-changed",this.handleScreenManagerChange),this.addEventListener("auth-submit",e=>{var i;const r=e instanceof D_?e.token:e instanceof CustomEvent&&typeof((i=e.detail)==null?void 0:i.token)=="string"?e.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){var e;this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleScreenManagerChange),this.screenManager.removeEventListener("tabs-changed",this.handleScreenManagerChange),(e=this.topRowResizeObserver)==null||e.disconnect(),this.topRowResizeObserver=null,this.observedTopRow=null}async initializeConnection(){const e=YL();if(this.electronMode){e&&(this.serverManager.setStoredAuthToken(this.runtimeServerURL,e),this.stripTokenQueryParam()),this.serverManager.connectConfiguredServers(this.runtimeServerURL,e);return}if(this.serverManager.activeServer)return;e&&(this.serverManager.setStoredAuthToken(this.runtimeServerURL,e),this.stripTokenQueryParam());const r=e??this.serverManager.getStoredAuthToken(this.runtimeServerURL),i=new Zw({url:this.runtimeServerURL,name:"Server",token:r,telemetryMeta:this.serverManager.telemetryMeta});this.serverManager.add(i),this.serverManager.setActive(i);try{await i.connect(r),this.connectError=null}catch(s){this.connectError=s instanceof Error&&!(s instanceof Oo)?s.message:null}this.render()}async handleAuthSubmit(e){const r=this.serverManager.activeServer;if(r){this.connectError=null,this.serverManager.setStoredAuthToken(r.url,e);try{await r.connect(e)}catch(i){i instanceof Oo||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}stripTokenQueryParam(){const e=new URL(window.location.href);e.searchParams.delete("token"),window.history.replaceState({},"",`${e.pathname}${e.search}${e.hash}`)}clearStoredTokenIfUnauthorized(){const e=this.serverManager.activeServer;!e||e.status!=="unauthorized"||!e.token||!e.hasAuthRejected||(this.serverManager.clearStoredAuthToken(e.url),e.clearToken())}render(){const e=this.serverManager.activeServer,r=(e==null?void 0:e.status)??null,i=this.screenManager.activeScreen,s=!!(e&&i&&this.screenManager.hasTab(e.url,i.id));if(r==="unauthorized"){const f=e;if(!f)return;Ue(P`
831
831
  <main class="auth-gate">
832
832
  <auth-modal
833
833
  .invalid=${!!f.token}
@@ -862,4 +862,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
862
862
  .hasEverConnected=${(e==null?void 0:e.hasEverConnected)??!1}
863
863
  ></connecting-overlay>`:null}
864
864
  </main>
865
- `,this),this.updateLayoutChromeBalance()}primaryServerURL(){return this.electronMode?ee(this.runtimeServerURL):ee(window.location.origin)}updateLayoutChromeBalance(){var o;const e=this.querySelector("main"),r=this.querySelector(".top-row"),i=this.querySelector(".command-panel-region"),s=r&&!i?r.getBoundingClientRect().height:0;e==null||e.style.setProperty("--layout-virtual-bottom-balance",`${s}px`),r!==this.observedTopRow&&((o=this.topRowResizeObserver)==null||o.disconnect(),this.observedTopRow=r,r&&typeof ResizeObserver<"u"?(this.topRowResizeObserver=new ResizeObserver(()=>this.updateLayoutChromeBalance()),this.topRowResizeObserver.observe(r)):this.topRowResizeObserver=null)}}customElements.get("television-app")||customElements.define("television-app",AU);document.documentElement.dataset.tvBundleVersion=vf();Object.defineProperty(window,"__tvVersion",{value:vf(),writable:!1,configurable:!1});const Ws=Wt(),Cu=j0(),N_=new FC(Ws?"television-electron":"television-browser",DC(Cu)),ky=Bw(),TU=ky?iD({storage:ky,clientApp:Ws?"desktop":"browser",desktopAppVersion:Ws?G0():null}):null,Df=ee(Ws?Cu:window.location.origin),U_=kO({search:window.location.search}),Mf=yf(),F_=new NN,H_=ON({detection:U_,primaryServerURL:Df,navigationLatch:Mf,presentation:F_}),kt=new sO({localStore:N_,localServerURL:Cu,telemetryMeta:TU,navigationPending:()=>Mf.pending,bootBarrier:U_.electron?{serverURL:Df,decideBoot:n=>H_.decideBoot(n)}:null}),V_=new YC({localStore:N_,serverManager:kt}),$U=new oO;_O({manager:kt,primaryServerURL:Df,navigationLatch:Mf});H_.attach(kt);const CU=()=>{const n=[...kt.servers.values()].filter(t=>t.status==="connected");n.length!==0&&Promise.all(n.map(t=>t.client.artifacts.list())).then(t=>{const e=new Set(t.flatMap(({artifacts:r})=>r.map(i=>i.id)));vO(e)}).catch(()=>{})},Z_=()=>{const n=kt.activeServer;if(!n||n.status!=="connected"){_c();return}CU(),n.client.display.get().then(t=>{if(!(kt.activeServer!==n||n.status!=="connected"))return jS(t.activeThemeName,n)}).catch(()=>{kt.activeServer===n&&_c()})};Z_();kt.addEventListener("change",Z_);kt.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=kt.activeServer;!t||t.url!==n.serverURL||jS(n.event.themeName,t)});bn.register("ServerManager",()=>kt);bn.register("ScreenManager",()=>V_);bn.register("ShortcutService",()=>$U);globalThis.__telepath={screenManager:V_,serverManager:kt};const Iu=document.createElement("television-app");Iu.runtimeServerURL=Cu;Iu.electronMode=Ws;Iu.updatePresentation=F_;Ws&&document.body.classList.add("electron");document.body.appendChild(Iu);
865
+ `,this),this.updateLayoutChromeBalance()}primaryServerURL(){return this.electronMode?ee(this.runtimeServerURL):ee(window.location.origin)}updateLayoutChromeBalance(){var o;const e=this.querySelector("main"),r=this.querySelector(".top-row"),i=this.querySelector(".command-panel-region"),s=r&&!i?r.getBoundingClientRect().height:0;e==null||e.style.setProperty("--layout-virtual-bottom-balance",`${s}px`),r!==this.observedTopRow&&((o=this.topRowResizeObserver)==null||o.disconnect(),this.observedTopRow=r,r&&typeof ResizeObserver<"u"?(this.topRowResizeObserver=new ResizeObserver(()=>this.updateLayoutChromeBalance()),this.topRowResizeObserver.observe(r)):this.topRowResizeObserver=null)}}customElements.get("television-app")||customElements.define("television-app",EU);document.documentElement.dataset.tvBundleVersion=mf();Object.defineProperty(window,"__tvVersion",{value:mf(),writable:!1,configurable:!1});const Ws=Wt(),Cu=B0(),z_=new NC(Ws?"television-electron":"television-browser",PC(Cu)),Sy=Vw(),xU=Sy?nD({storage:Sy,clientApp:Ws?"desktop":"browser",desktopAppVersion:Ws?W0():null}):null,Lf=ee(Ws?Cu:window.location.origin),O_=SO({search:window.location.search}),Df=vf(),N_=new zN,U_=MN({detection:O_,primaryServerURL:Lf,navigationLatch:Df,presentation:N_}),kt=new rO({localStore:z_,localServerURL:Cu,telemetryMeta:xU,navigationPending:()=>Df.pending,bootBarrier:O_.electron?{serverURL:Lf,decideBoot:n=>U_.decideBoot(n)}:null}),F_=new GC({localStore:z_,serverManager:kt}),AU=new iO;wO({manager:kt,primaryServerURL:Lf,navigationLatch:Df});U_.attach(kt);const TU=()=>{const n=[...kt.servers.values()].filter(t=>t.status==="connected");n.length!==0&&Promise.all(n.map(t=>t.client.artifacts.list())).then(t=>{const e=new Set(t.flatMap(({artifacts:r})=>r.map(i=>i.id)));gO(e)}).catch(()=>{})},H_=()=>{const n=kt.activeServer;if(!n||n.status!=="connected"){_c();return}TU(),n.client.display.get().then(t=>{if(!(kt.activeServer!==n||n.status!=="connected"))return BS(t.activeThemeName,n)}).catch(()=>{kt.activeServer===n&&_c()})};H_();kt.addEventListener("change",H_);kt.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=kt.activeServer;!t||t.url!==n.serverURL||BS(n.event.themeName,t)});bn.register("ServerManager",()=>kt);bn.register("ScreenManager",()=>F_);bn.register("ShortcutService",()=>AU);globalThis.__telepath={screenManager:F_,serverManager:kt};const Iu=document.createElement("television-app");Iu.runtimeServerURL=Cu;Iu.electronMode=Ws;Iu.updatePresentation=N_;Ws&&document.body.classList.add("electron");document.body.appendChild(Iu);