@telepath-computer/television 0.1.165 → 0.1.167

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 K0=Object.defineProperty;var Op=n=>{throw TypeError(n)};var J0=(n,t,e)=>t in n?K0(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>J0(n,typeof t!="symbol"?t+"":t,e),Hc=(n,t,e)=>t.has(n)||Op("Cannot "+e);var l=(n,t,e)=>(Hc(n,t,"read from private field"),e?e.call(n):t.get(n)),S=(n,t,e)=>t.has(n)?Op("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),w=(n,t,e,r)=>(Hc(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),p=(n,t,e)=>(Hc(n,t,"access private method"),e);var Zc=(n,t,e,r)=>({set _(i){w(n,t,i,e)},get _(){return l(n,t,r)}});import{i as Mp,a as Np,b as X0,U as Q0,c as Up,d as Fp,e as eS,A as tS,f as nS,g as rS}from"./artifact-bridge-KdJfBNuH.js";import{m as iS,a as sS,b as oS}from"./missing-artifact-page-DVzJ41AE.js";var br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function aS(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 Hp=Object.prototype.toString,Wm=function(t){var e=Hp.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Hp.call(t.callee)==="[object Function]"),r},Wc,Zp;function lS(){if(Zp)return Wc;Zp=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Wm,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(y){var m=y.constructor;return m&&m.prototype===y},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 y in window)try{if(!u["$"+y]&&t.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1}(),f=function(y){if(typeof window>"u"||!h)return c(y);try{return c(y)}catch{return!1}};n=function(m){var E=m!==null&&typeof m=="object",x=e.call(m)==="[object Function]",I=r(m),P=E&&e.call(m)==="[object String]",R=[];if(!E&&!x&&!I)throw new TypeError("Object.keys called on a non-object");var V=o&&x;if(P&&m.length>0&&!t.call(m,0))for(var N=0;N<m.length;++N)R.push(String(N));if(I&&m.length>0)for(var F=0;F<m.length;++F)R.push(String(F));else for(var Y in m)!(V&&Y==="prototype")&&t.call(m,Y)&&R.push(String(Y));if(s)for(var B=f(m),ce=0;ce<a.length;++ce)!(B&&a[ce]==="constructor")&&t.call(m,a[ce])&&R.push(a[ce]);return R}}return Wc=n,Wc}var cS=Array.prototype.slice,uS=Wm,Wp=Object.keys,Xa=Wp?function(t){return Wp(t)}:lS(),Vp=Object.keys;Xa.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 uS(r)?Vp(cS.call(r)):Vp(r)})}else Object.keys=Xa;return Object.keys||Xa};var hS=Xa,Qa=Object.defineProperty||!1;if(Qa)try{Qa({},"a",{value:1})}catch{Qa=!1}var ua=Qa,Cn=SyntaxError,K=TypeError,dS=Object.getOwnPropertyDescriptor,el=dS;if(el)try{el([],"length")}catch{el=null}var ps=el,jp=ua,pS=Cn,ci=K,Bp=ps,Vm=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new ci("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ci("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ci("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ci("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ci("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ci("`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=!!Bp&&Bp(t,e);if(jp)jp(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 pS("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Fu=ua,jm=function(){return!!Fu};jm.hasArrayLengthDefineBug=function(){if(!Fu)return null;try{return Fu([],"length",{value:1}).length!==1}catch{return!0}};var lc=jm,fS=hS,gS=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",mS=Object.prototype.toString,vS=Array.prototype.concat,Gp=Vm,yS=function(n){return typeof n=="function"&&mS.call(n)==="[object Function]"},Bm=lc(),bS=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!yS(r)||!r())return}Bm?Gp(n,t,e,!0):Gp(n,t,e)},Gm=function(n,t){var e=arguments.length>2?arguments[2]:{},r=fS(t);gS&&(r=vS.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)bS(n,r[i],t[r[i]],e[r[i]])};Gm.supportsDescriptors=!!Bm;var Qr=Gm,tl={exports:{}};typeof self<"u"?tl.exports=self:typeof window<"u"?tl.exports=window:tl.exports=Function("return this")();var qm=tl.exports,wS=qm,Ym=function(){return typeof br!="object"||!br||br.Math!==Math||br.Array!==Array?wS:br},SS=Qr,_S=ps,kS=Ym,xS=function(){var t=kS();if(SS.supportsDescriptors){var e=_S(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},ES=Qr,AS=qm,Km=Ym,$S=xS,TS=Km(),Jm=function(){return TS};ES(Jm,{getPolyfill:Km,implementation:AS,shim:$S});var od=Jm,Rn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},ad=Object,Xm=Error,IS=EvalError,CS=RangeError,ld=ReferenceError,RS=URIError,PS=Math.abs,DS=Math.floor,LS=Math.max,zS=Math.min,OS=Math.pow,MS=Math.round,cd=Number.isNaN||function(t){return t!==t},NS=cd,US=function(t){return NS(t)||t===0?t:t<0?-1:1},fs=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},qp=typeof Symbol<"u"&&Symbol,FS=fs,ud=function(){return typeof qp!="function"||typeof Symbol!="function"||typeof qp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:FS()},Qm=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,HS=ad,ev=HS.getPrototypeOf||null,ZS="Function.prototype.bind called on incompatible ",WS=Object.prototype.toString,VS=Math.max,jS="[object Function]",Yp=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},BS=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},GS=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},qS=function(t){var e=this;if(typeof e!="function"||WS.apply(e)!==jS)throw new TypeError(ZS+e);for(var r=BS(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,Yp(r,arguments));return Object(h)===h?h:this}return e.apply(t,Yp(r,arguments))},o=VS(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+GS(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},YS=qS,ha=Function.prototype.bind||YS,hd=Function.prototype.call,dd=Function.prototype.apply,KS=typeof Reflect<"u"&&Reflect&&Reflect.apply,JS=ha,XS=dd,QS=hd,e_=KS,tv=e_||JS.call(QS,XS),t_=ha,n_=K,r_=hd,i_=tv,cc=function(t){if(t.length<1||typeof t[0]!="function")throw new n_("a function is required");return i_(t_,r_,t)},s_=cc,Kp=ps,nv;try{nv=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Vc=!!nv&&Kp&&Kp(Object.prototype,"__proto__"),rv=Object,Jp=rv.getPrototypeOf,o_=Vc&&typeof Vc.get=="function"?s_([Vc.get]):typeof Jp=="function"?function(t){return Jp(t==null?t:rv(t))}:!1,Xp=Qm,Qp=ev,ef=o_,iv=Xp?function(t){return Xp(t)}:Qp?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Qp(t)}:ef?function(t){return ef(t)}:null,a_=Function.prototype.call,l_=Object.prototype.hasOwnProperty,c_=ha,Pn=c_.call(a_,l_),q,u_=ad,h_=Xm,d_=IS,p_=CS,f_=ld,as=Cn,Ci=K,g_=RS,m_=PS,v_=DS,y_=LS,b_=zS,w_=OS,S_=MS,__=US,sv=Function,jc=function(n){try{return sv('"use strict"; return ('+n+").constructor;")()}catch{}},io=ps,k_=ua,Bc=function(){throw new Ci},x_=io?function(){try{return arguments.callee,Bc}catch{try{return io(arguments,"callee").get}catch{return Bc}}}():Bc,ui=ud(),De=iv,E_=ev,A_=Qm,ov=dd,da=hd,mi={},$_=typeof Uint8Array>"u"||!De?q:De(Uint8Array),jr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":ui&&De?De([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":mi,"%AsyncGenerator%":mi,"%AsyncGeneratorFunction%":mi,"%AsyncIteratorPrototype%":mi,"%Atomics%":typeof Atomics>"u"?q:Atomics,"%BigInt%":typeof BigInt>"u"?q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":h_,"%eval%":eval,"%EvalError%":d_,"%Float16Array%":typeof Float16Array>"u"?q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?q:FinalizationRegistry,"%Function%":sv,"%GeneratorFunction%":mi,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ui&&De?De(De([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ui||!De?q:De(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":u_,"%Object.getOwnPropertyDescriptor%":io,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":p_,"%ReferenceError%":f_,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ui||!De?q:De(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ui&&De?De(""[Symbol.iterator]()):q,"%Symbol%":ui?Symbol:q,"%SyntaxError%":as,"%ThrowTypeError%":x_,"%TypedArray%":$_,"%TypeError%":Ci,"%Uint8Array%":typeof Uint8Array>"u"?q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?q:Uint32Array,"%URIError%":g_,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet,"%Function.prototype.call%":da,"%Function.prototype.apply%":ov,"%Object.defineProperty%":k_,"%Object.getPrototypeOf%":E_,"%Math.abs%":m_,"%Math.floor%":v_,"%Math.max%":y_,"%Math.min%":b_,"%Math.pow%":w_,"%Math.round%":S_,"%Math.sign%":__,"%Reflect.getPrototypeOf%":A_};if(De)try{null.error}catch(n){var T_=De(De(n));jr["%Error.prototype%"]=T_}var I_=function n(t){var e;if(t==="%AsyncFunction%")e=jc("async function () {}");else if(t==="%GeneratorFunction%")e=jc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=jc("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&De&&(e=De(i.prototype))}return jr[t]=e,e},tf={__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"]},pa=ha,El=Pn,C_=pa.call(da,Array.prototype.concat),R_=pa.call(ov,Array.prototype.splice),nf=pa.call(da,String.prototype.replace),Al=pa.call(da,String.prototype.slice),P_=pa.call(da,RegExp.prototype.exec),D_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,L_=/\\(\\)?/g,z_=function(t){var e=Al(t,0,1),r=Al(t,-1);if(e==="%"&&r!=="%")throw new as("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new as("invalid intrinsic syntax, expected opening `%`");var i=[];return nf(t,D_,function(s,o,a,c){i[i.length]=a?nf(c,L_,"$1"):o||s}),i},O_=function(t,e){var r=t,i;if(El(tf,r)&&(i=tf[r],r="%"+i[0]+"%"),El(jr,r)){var s=jr[r];if(s===mi&&(s=I_(r)),typeof s>"u"&&!e)throw new Ci("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new as("intrinsic "+t+" does not exist!")},kt=function(t,e){if(typeof t!="string"||t.length===0)throw new Ci("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ci('"allowMissing" argument must be a boolean');if(P_(/^%?[^%]*%?$/,t)===null)throw new as("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=z_(t),i=r.length>0?r[0]:"",s=O_("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],R_(r,C_([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var y=r[h],m=Al(y,0,1),E=Al(y,-1);if((m==='"'||m==="'"||m==="`"||E==='"'||E==="'"||E==="`")&&m!==E)throw new as("property names with quotes must have matching quotes");if((y==="constructor"||!f)&&(c=!0),i+="."+y,o="%"+i+"%",El(jr,o))a=jr[o];else if(a!=null){if(!(y in a)){if(!e)throw new Ci("base intrinsic for "+t+" exists, but the property is not available.");return}if(io&&h+1>=r.length){var x=io(a,y);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[y]}else f=El(a,y),a=a[y];f&&!c&&(jr[o]=a)}}return a},Gc,rf;function ir(){if(rf)return Gc;rf=1;var n=kt,t=cc,e=t([n("%String.prototype.indexOf%")]);return Gc=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},Gc}var qc,sf;function pd(){if(sf)return qc;sf=1;var n=kt,t=n("%Array%"),e=!t.isArray&&ir()("Object.prototype.toString");return qc=t.isArray||function(i){return e(i)==="[object Array]"},qc}var M_=lc,of=ua,av=M_.hasArrayLengthDefineBug(),N_=av&&pd(),U_=ir(),F_=U_("Object.prototype.propertyIsEnumerable"),fd=function(t,e,r,i,s,o){if(!of){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&F_(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return av&&s==="length"&&"[[Value]]"in o&&N_(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(of(i,s,r(o)),!0)},H_=K,Ts=Pn,Z_={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},gs=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(Ts(t,e)&&!Z_[e])return!1;var r=Ts(t,"[[Value]]")||Ts(t,"[[Writable]]"),i=Ts(t,"[[Get]]")||Ts(t,"[[Set]]");if(r&&i)throw new H_("Property Descriptors may not be both accessor and data descriptors");return!0},lv=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},W_=K,V_=gs,j_=lv,cv=function(t){if(typeof t<"u"&&!V_(t))throw new W_("Assertion failed: `Desc` must be a Property Descriptor");return j_(t)},B_=K,af=Pn,G_=gs,uv=function(t){if(typeof t>"u")return!1;if(!G_(t))throw new B_("Assertion failed: `Desc` must be a Property Descriptor");return!(!af(t,"[[Value]]")&&!af(t,"[[Writable]]"))},ms=function(t){return typeof t=="string"||typeof t=="symbol"},lf=cd,hv=function(t,e){return t===e?t===0?1/t===1/e:!0:lf(t)&&lf(e)},cf=K,q_=Rn,Y_=fd,K_=cv,J_=uv,X_=ms,Q_=hv,gd=function(t,e,r){if(!q_(t))throw new cf("Assertion failed: Type(O) is not Object");if(!X_(e))throw new cf("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return Y_(J_,Q_,K_,t,e,i)},dv=Function.prototype.toString,Ei=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Hu,nl;if(typeof Ei=="function"&&typeof Object.defineProperty=="function")try{Hu=Object.defineProperty({},"length",{get:function(){throw nl}}),nl={},Ei(function(){throw 42},null,Hu)}catch(n){n!==nl&&(Ei=null)}else Ei=null;var ek=/^\s*class\b/,Zu=function(t){try{var e=dv.call(t);return ek.test(e)}catch{return!1}},Yc=function(t){try{return Zu(t)?!1:(dv.call(t),!0)}catch{return!1}},rl=Object.prototype.toString,tk="[object Object]",nk="[object Function]",rk="[object GeneratorFunction]",ik="[object HTMLAllCollection]",sk="[object HTML document.all class]",ok="[object HTMLCollection]",ak=typeof Symbol=="function"&&!!Symbol.toStringTag,lk=!(0 in[,]),Wu=function(){return!1};if(typeof document=="object"){var ck=document.all;rl.call(ck)===rl.call(document.all)&&(Wu=function(t){if((lk||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=rl.call(t);return(e===ik||e===sk||e===ok||e===tk)&&t("")==null}catch{}return!1})}var pv=Ei?function(t){if(Wu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Ei(t,null,Hu)}catch(e){if(e!==nl)return!1}return!Zu(t)&&Yc(t)}:function(t){if(Wu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(ak)return Yc(t);if(Zu(t))return!1;var e=rl.call(t);return e!==nk&&e!==rk&&!/^\[object HTML/.test(e)?!1:Yc(t)},uk=pv,hk=function(t){return!!t},Ht=Pn,Da=K,dk=Rn,uf=uk,Kc=hk,pk=function(t){if(!dk(t))throw new Da("ToPropertyDescriptor requires an object");var e={};if(Ht(t,"enumerable")&&(e["[[Enumerable]]"]=Kc(t.enumerable)),Ht(t,"configurable")&&(e["[[Configurable]]"]=Kc(t.configurable)),Ht(t,"value")&&(e["[[Value]]"]=t.value),Ht(t,"writable")&&(e["[[Writable]]"]=Kc(t.writable)),Ht(t,"get")){var r=t.get;if(typeof r<"u"&&!uf(r))throw new Da("getter must be a function");e["[[Get]]"]=r}if(Ht(t,"set")){var i=t.set;if(typeof i<"u"&&!uf(i))throw new Da("setter must be a function");e["[[Set]]"]=i}if((Ht(e,"[[Get]]")||Ht(e,"[[Set]]"))&&(Ht(e,"[[Value]]")||Ht(e,"[[Writable]]")))throw new Da("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Jc=K,fk=Rn,hf=gs,gk=fd,mk=cv,vk=uv,yk=ms,bk=hv,wk=pk,Sk=function(t,e,r){if(!fk(t))throw new Jc("Assertion failed: Type(O) is not Object");if(!yk(e))throw new Jc("Assertion failed: P is not a Property Key");var i=hf(r)?r:wk(r);if(!hf(i))throw new Jc("Assertion failed: Desc is not a valid Property Descriptor");return gk(vk,bk,mk,t,e,i)},df=K,_k=Rn,kk=Sk,xk=ms,Ek=function(t,e,r){if(!_k(t))throw new df("Assertion failed: Type(O) is not Object");if(!xk(e))throw new df("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return kk(t,e,i)},Ak=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,$k=ad,Tk=$k.setPrototypeOf||null,Ik=cc,pf=ps,Ck=K,fv={};try{fv.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Rk=!("toString"in fv),Xc=pf&&pf(Object.prototype,"__proto__"),Pk=Rk&&(!!Xc&&typeof Xc.set=="function"&&Ik([Xc.set])||function(t,e){if(t==null)throw new Ck("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),ff=Ak,Dk=Tk,gf=Pk,Lk=K,zk=ff?function(t,e){if(ff(t,e))return t;throw new Lk("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:Dk||(gf?function(t,e){return gf(t,e),t}:null),mf=K,Ok=Rn,vf=iv,Mk=function(t){if(!Ok(t))throw new mf("Assertion failed: O must be an Object");if(!vf)throw new mf("This environment does not support fetching prototypes.");return vf(t)},Nk=K,Uk=zk,Fk=Rn,Hk=Mk,Zk=function(t,e){if(e!==null&&!Fk(e))throw new Nk("Assertion failed: V must be Object or Null");try{Uk(t,e)}catch{return!1}return Hk(t)===e},Qc=gd,yf=Ek,gv=Zk,Wk=lc(),md=Xm;function fa(n,t,e){var r=new md(e);return gv(r,il),delete r.constructor,yf(r,"error",n),yf(r,"suppressed",t),r}Wk&&Object.defineProperty(fa,"prototype",{writable:!1});var il=fa.prototype;if(!Qc(il,"constructor",fa)||!Qc(il,"message","")||!Qc(il,"name","SuppressedError"))throw new md("unable to install SuppressedError.prototype properties; please report this!");gv(fa.prototype,md.prototype);var Vk=fa,jk=Vk,mv=function(){return typeof SuppressedError=="function"?SuppressedError:jk},Bk=Qr,bf=od(),Gk=mv,qk=function(){var t=Gk();return Bk(bf,{SuppressedError:t},{SuppressedError:function(){return bf.SuppressedError!==t}}),t};qk();var Yk=K,Kk=gs,Jk=lv,Xk=function(t){if(typeof t<"u"&&!Kk(t))throw new Yk("Assertion failed: `Desc` must be a Property Descriptor");return Jk(t)},Qk=K,wf=Pn,ex=gs,tx=function(t){if(typeof t>"u")return!1;if(!ex(t))throw new Qk("Assertion failed: `Desc` must be a Property Descriptor");return!(!wf(t,"[[Value]]")&&!wf(t,"[[Writable]]"))},Sf=cd,nx=function(t,e){return t===e?t===0?1/t===1/e:!0:Sf(t)&&Sf(e)},vs=pv,rx=function(t){return!!t},Zt=Pn,La=K,ix=Rn,_f=vs,eu=rx,sx=function(t){if(!ix(t))throw new La("ToPropertyDescriptor requires an object");var e={};if(Zt(t,"enumerable")&&(e["[[Enumerable]]"]=eu(t.enumerable)),Zt(t,"configurable")&&(e["[[Configurable]]"]=eu(t.configurable)),Zt(t,"value")&&(e["[[Value]]"]=t.value),Zt(t,"writable")&&(e["[[Writable]]"]=eu(t.writable)),Zt(t,"get")){var r=t.get;if(typeof r<"u"&&!_f(r))throw new La("getter must be a function");e["[[Get]]"]=r}if(Zt(t,"set")){var i=t.set;if(typeof i<"u"&&!_f(i))throw new La("setter must be a function");e["[[Set]]"]=i}if((Zt(e,"[[Get]]")||Zt(e,"[[Set]]"))&&(Zt(e,"[[Value]]")||Zt(e,"[[Writable]]")))throw new La("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},tu=K,ox=Rn,kf=gs,ax=fd,lx=Xk,cx=tx,ux=ms,hx=nx,dx=sx,ga=function(t,e,r){if(!ox(t))throw new tu("Assertion failed: Type(O) is not Object");if(!ux(e))throw new tu("Assertion failed: P is not a Property Key");var i=kf(r)?r:dx(r);if(!kf(i))throw new tu("Assertion failed: Desc is not a valid Property Descriptor");return ax(cx,hx,lx,t,e,i)},px=fs(),fx=px?Symbol.dispose||Symbol("Symbol.dispose"):null,gx=fs,mx=fx,vd=function(){return gx()&&Symbol.dispose||mx},vx=ud,yx=ga,bx=vd,wx=function(){var t=bx();return vx()&&yx(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},Sx=fs(),_x=Sx?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,kx=fs,xx=_x,yd=function(){return kx()&&Symbol.asyncDispose||xx},Ex=ud,Ax=ga,$x=yd,Tx=function(){var t=$x();return Ex()&&Ax(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},Ix=pd(),Cx=kt,Rx=ir(),Px=K,Dx=Ix,Lx=Cx("%Reflect.apply%",!0)||Rx("Function.prototype.apply"),uc=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!Dx(r))throw new Px("Assertion failed: optional `argumentsList`, if provided, must be a List");return Lx(t,e,r)};const zx={},Ox=Object.freeze(Object.defineProperty({__proto__:null,default:zx},Symbol.toStringTag,{value:"Module"})),Mx=aS(Ox);var bd=typeof Map=="function"&&Map.prototype,nu=Object.getOwnPropertyDescriptor&&bd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$l=bd&&nu&&typeof nu.get=="function"?nu.get:null,xf=bd&&Map.prototype.forEach,wd=typeof Set=="function"&&Set.prototype,ru=Object.getOwnPropertyDescriptor&&wd?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Tl=wd&&ru&&typeof ru.get=="function"?ru.get:null,Ef=wd&&Set.prototype.forEach,Nx=typeof WeakMap=="function"&&WeakMap.prototype,Xs=Nx?WeakMap.prototype.has:null,Ux=typeof WeakSet=="function"&&WeakSet.prototype,Qs=Ux?WeakSet.prototype.has:null,Fx=typeof WeakRef=="function"&&WeakRef.prototype,Af=Fx?WeakRef.prototype.deref:null,Hx=Boolean.prototype.valueOf,Zx=Object.prototype.toString,Wx=Function.prototype.toString,Vx=String.prototype.match,Sd=String.prototype.slice,Kn=String.prototype.replace,jx=String.prototype.toUpperCase,$f=String.prototype.toLowerCase,vv=RegExp.prototype.test,Tf=Array.prototype.concat,an=Array.prototype.join,Bx=Array.prototype.slice,If=Math.floor,Vu=typeof BigInt=="function"?BigInt.prototype.valueOf:null,iu=Object.getOwnPropertySymbols,ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ls=typeof Symbol=="function"&&typeof Symbol.iterator=="object",eo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ls||!0)?Symbol.toStringTag:null,yv=Object.prototype.propertyIsEnumerable,Cf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Rf(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||vv.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-If(-n):If(n);if(r!==n){var i=String(r),s=Sd.call(t,i.length+1);return Kn.call(i,e,"$&_")+"."+Kn.call(Kn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Kn.call(t,e,"$&_")}var Bu=Mx,Pf=Bu.custom,Df=Sv(Pf)?Pf:null,bv={__proto__:null,double:'"',single:"'"},Gx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},ys=function n(t,e,r,i){var s=e||{};if(bn(s,"quoteStyle")&&!bn(bv,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(bn(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=bn(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(bn(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(bn(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 kv(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?Rf(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?Rf(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 Gu(t)?"[Array]":"[Object]";var f=hE(s,r);if(typeof i>"u")i=[];else if(_v(i,t)>=0)return"[Circular]";function y(Nt,Dn,Ic){if(Dn&&(i=Bx.call(i),i.push(Dn)),Ic){var xa={depth:s.depth};return bn(s,"quoteStyle")&&(xa.quoteStyle=s.quoteStyle),n(Nt,xa,r+1,i)}return n(Nt,s,r+1,i)}if(typeof t=="function"&&!Lf(t)){var m=nE(t),E=za(t,y);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(E.length>0?" { "+an.call(E,", ")+" }":"")}if(Sv(t)){var x=ls?Kn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):ju.call(t);return typeof t=="object"&&!ls?Is(x):x}if(lE(t)){for(var I="<"+$f.call(String(t.nodeName)),P=t.attributes||[],R=0;R<P.length;R++)I+=" "+P[R].name+"="+wv(qx(P[R].value),"double",s);return I+=">",t.childNodes&&t.childNodes.length&&(I+="..."),I+="</"+$f.call(String(t.nodeName))+">",I}if(Gu(t)){if(t.length===0)return"[]";var V=za(t,y);return f&&!uE(V)?"["+qu(V,f)+"]":"[ "+an.call(V,", ")+" ]"}if(Kx(t)){var N=za(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!yv.call(t,"cause")?"{ ["+String(t)+"] "+an.call(Tf.call("[cause]: "+y(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+an.call(N,", ")+" }"}if(typeof t=="object"&&o){if(Df&&typeof t[Df]=="function"&&Bu)return Bu(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(rE(t)){var F=[];return xf&&xf.call(t,function(Nt,Dn){F.push(y(Dn,t,!0)+" => "+y(Nt,t))}),zf("Map",$l.call(t),F,f)}if(oE(t)){var Y=[];return Ef&&Ef.call(t,function(Nt){Y.push(y(Nt,t))}),zf("Set",Tl.call(t),Y,f)}if(iE(t))return su("WeakMap");if(aE(t))return su("WeakSet");if(sE(t))return su("WeakRef");if(Xx(t))return Is(y(Number(t)));if(eE(t))return Is(y(Vu.call(t)));if(Qx(t))return Is(Hx.call(t));if(Jx(t))return Is(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof br<"u"&&t===br)return"{ [object globalThis] }";if(!Yx(t)&&!Lf(t)){var B=za(t,y),ce=Cf?Cf(t)===Object.prototype:t instanceof Object||t.constructor===Object,Et=t instanceof Object?"":"null prototype",lr=!ce&&eo&&Object(t)===t&&eo in t?Sd.call(sr(t),8,-1):Et?"Object":"",ze=ce||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",cr=ze+(lr||Et?"["+an.call(Tf.call([],lr||[],Et||[]),": ")+"] ":"");return B.length===0?cr+"{}":f?cr+"{"+qu(B,f)+"}":cr+"{ "+an.call(B,", ")+" }"}return String(t)};function wv(n,t,e){var r=e.quoteStyle||t,i=bv[r];return i+n+i}function qx(n){return Kn.call(String(n),/"/g,"&quot;")}function ei(n){return!eo||!(typeof n=="object"&&(eo in n||typeof n[eo]<"u"))}function Gu(n){return sr(n)==="[object Array]"&&ei(n)}function Yx(n){return sr(n)==="[object Date]"&&ei(n)}function Lf(n){return sr(n)==="[object RegExp]"&&ei(n)}function Kx(n){return sr(n)==="[object Error]"&&ei(n)}function Jx(n){return sr(n)==="[object String]"&&ei(n)}function Xx(n){return sr(n)==="[object Number]"&&ei(n)}function Qx(n){return sr(n)==="[object Boolean]"&&ei(n)}function Sv(n){if(ls)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!ju)return!1;try{return ju.call(n),!0}catch{}return!1}function eE(n){if(!n||typeof n!="object"||!Vu)return!1;try{return Vu.call(n),!0}catch{}return!1}var tE=Object.prototype.hasOwnProperty||function(n){return n in this};function bn(n,t){return tE.call(n,t)}function sr(n){return Zx.call(n)}function nE(n){if(n.name)return n.name;var t=Vx.call(Wx.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function _v(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 rE(n){if(!$l||!n||typeof n!="object")return!1;try{$l.call(n);try{Tl.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function iE(n){if(!Xs||!n||typeof n!="object")return!1;try{Xs.call(n,Xs);try{Qs.call(n,Qs)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function sE(n){if(!Af||!n||typeof n!="object")return!1;try{return Af.call(n),!0}catch{}return!1}function oE(n){if(!Tl||!n||typeof n!="object")return!1;try{Tl.call(n);try{$l.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function aE(n){if(!Qs||!n||typeof n!="object")return!1;try{Qs.call(n,Qs);try{Xs.call(n,Xs)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function lE(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function kv(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return kv(Sd.call(n,0,t.maxStringLength),t)+r}var i=Gx[t.quoteStyle||"single"];i.lastIndex=0;var s=Kn.call(Kn.call(n,i,"\\$1"),/[\x00-\x1f]/g,cE);return wv(s,"single",t)}function cE(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 Is(n){return"Object("+n+")"}function su(n){return n+" { ? }"}function zf(n,t,e,r){var i=r?qu(e,r):an.call(e,", ");return n+" ("+t+") {"+i+"}"}function uE(n){for(var t=0;t<n.length;t++)if(_v(n[t],`
2
- `)>=0)return!1;return!0}function hE(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=an.call(Array(n.indent+1)," ");else return null;return{base:e,prev:an.call(Array(t+1),e)}}function qu(n,t){if(n.length===0)return"";var e=`
1
+ var X0=Object.defineProperty;var Mp=n=>{throw TypeError(n)};var Q0=(n,t,e)=>t in n?X0(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>Q0(n,typeof t!="symbol"?t+"":t,e),Hc=(n,t,e)=>t.has(n)||Mp("Cannot "+e);var l=(n,t,e)=>(Hc(n,t,"read from private field"),e?e.call(n):t.get(n)),S=(n,t,e)=>t.has(n)?Mp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),w=(n,t,e,r)=>(Hc(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),p=(n,t,e)=>(Hc(n,t,"access private method"),e);var Zc=(n,t,e,r)=>({set _(i){w(n,t,i,e)},get _(){return l(n,t,r)}});import{i as Np,a as Up,b as eS,U as tS,c as Fp,d as Hp,e as nS,A as rS,f as iS,g as sS}from"./artifact-bridge-KdJfBNuH.js";import{m as oS,a as aS,b as lS}from"./missing-artifact-page-DVzJ41AE.js";var br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cS(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 Zp=Object.prototype.toString,jm=function(t){var e=Zp.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Zp.call(t.callee)==="[object Function]"),r},Wc,Wp;function uS(){if(Wp)return Wc;Wp=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=jm,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(y){var m=y.constructor;return m&&m.prototype===y},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 y in window)try{if(!u["$"+y]&&t.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1}(),f=function(y){if(typeof window>"u"||!h)return c(y);try{return c(y)}catch{return!1}};n=function(m){var E=m!==null&&typeof m=="object",x=e.call(m)==="[object Function]",I=r(m),P=E&&e.call(m)==="[object String]",R=[];if(!E&&!x&&!I)throw new TypeError("Object.keys called on a non-object");var V=o&&x;if(P&&m.length>0&&!t.call(m,0))for(var N=0;N<m.length;++N)R.push(String(N));if(I&&m.length>0)for(var F=0;F<m.length;++F)R.push(String(F));else for(var Y in m)!(V&&Y==="prototype")&&t.call(m,Y)&&R.push(String(Y));if(s)for(var B=f(m),ce=0;ce<a.length;++ce)!(B&&a[ce]==="constructor")&&t.call(m,a[ce])&&R.push(a[ce]);return R}}return Wc=n,Wc}var hS=Array.prototype.slice,dS=jm,Vp=Object.keys,Xa=Vp?function(t){return Vp(t)}:uS(),jp=Object.keys;Xa.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 dS(r)?jp(hS.call(r)):jp(r)})}else Object.keys=Xa;return Object.keys||Xa};var pS=Xa,Qa=Object.defineProperty||!1;if(Qa)try{Qa({},"a",{value:1})}catch{Qa=!1}var ua=Qa,Cn=SyntaxError,K=TypeError,fS=Object.getOwnPropertyDescriptor,el=fS;if(el)try{el([],"length")}catch{el=null}var ps=el,Bp=ua,gS=Cn,ci=K,Gp=ps,Bm=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new ci("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ci("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ci("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ci("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ci("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ci("`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=!!Gp&&Gp(t,e);if(Bp)Bp(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 gS("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Hu=ua,Gm=function(){return!!Hu};Gm.hasArrayLengthDefineBug=function(){if(!Hu)return null;try{return Hu([],"length",{value:1}).length!==1}catch{return!0}};var lc=Gm,mS=pS,vS=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",yS=Object.prototype.toString,bS=Array.prototype.concat,qp=Bm,wS=function(n){return typeof n=="function"&&yS.call(n)==="[object Function]"},qm=lc(),SS=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!wS(r)||!r())return}qm?qp(n,t,e,!0):qp(n,t,e)},Ym=function(n,t){var e=arguments.length>2?arguments[2]:{},r=mS(t);vS&&(r=bS.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)SS(n,r[i],t[r[i]],e[r[i]])};Ym.supportsDescriptors=!!qm;var Qr=Ym,tl={exports:{}};typeof self<"u"?tl.exports=self:typeof window<"u"?tl.exports=window:tl.exports=Function("return this")();var Km=tl.exports,_S=Km,Jm=function(){return typeof br!="object"||!br||br.Math!==Math||br.Array!==Array?_S:br},kS=Qr,xS=ps,ES=Jm,AS=function(){var t=ES();if(kS.supportsDescriptors){var e=xS(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},$S=Qr,TS=Km,Xm=Jm,IS=AS,CS=Xm(),Qm=function(){return CS};$S(Qm,{getPolyfill:Xm,implementation:TS,shim:IS});var ad=Qm,Rn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},ld=Object,ev=Error,RS=EvalError,PS=RangeError,cd=ReferenceError,DS=URIError,LS=Math.abs,zS=Math.floor,OS=Math.max,MS=Math.min,NS=Math.pow,US=Math.round,ud=Number.isNaN||function(t){return t!==t},FS=ud,HS=function(t){return FS(t)||t===0?t:t<0?-1:1},fs=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},Yp=typeof Symbol<"u"&&Symbol,ZS=fs,hd=function(){return typeof Yp!="function"||typeof Symbol!="function"||typeof Yp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ZS()},tv=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,WS=ld,nv=WS.getPrototypeOf||null,VS="Function.prototype.bind called on incompatible ",jS=Object.prototype.toString,BS=Math.max,GS="[object Function]",Kp=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},qS=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},YS=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},KS=function(t){var e=this;if(typeof e!="function"||jS.apply(e)!==GS)throw new TypeError(VS+e);for(var r=qS(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,Kp(r,arguments));return Object(h)===h?h:this}return e.apply(t,Kp(r,arguments))},o=BS(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+YS(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},JS=KS,ha=Function.prototype.bind||JS,dd=Function.prototype.call,Vc,Jp;function pd(){return Jp||(Jp=1,Vc=Function.prototype.apply),Vc}var XS=typeof Reflect<"u"&&Reflect&&Reflect.apply,QS=ha,e_=pd(),t_=dd,n_=XS,rv=n_||QS.call(t_,e_),r_=ha,i_=K,s_=dd,o_=rv,cc=function(t){if(t.length<1||typeof t[0]!="function")throw new i_("a function is required");return o_(r_,s_,t)},a_=cc,Xp=ps,iv;try{iv=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var jc=!!iv&&Xp&&Xp(Object.prototype,"__proto__"),sv=Object,Qp=sv.getPrototypeOf,l_=jc&&typeof jc.get=="function"?a_([jc.get]):typeof Qp=="function"?function(t){return Qp(t==null?t:sv(t))}:!1,ef=tv,tf=nv,nf=l_,ov=ef?function(t){return ef(t)}:tf?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return tf(t)}:nf?function(t){return nf(t)}:null,c_=Function.prototype.call,u_=Object.prototype.hasOwnProperty,h_=ha,Pn=h_.call(c_,u_),q,d_=ld,p_=ev,f_=RS,g_=PS,m_=cd,as=Cn,Ci=K,v_=DS,y_=LS,b_=zS,w_=OS,S_=MS,__=NS,k_=US,x_=HS,av=Function,Bc=function(n){try{return av('"use strict"; return ('+n+").constructor;")()}catch{}},io=ps,E_=ua,Gc=function(){throw new Ci},A_=io?function(){try{return arguments.callee,Gc}catch{try{return io(arguments,"callee").get}catch{return Gc}}}():Gc,ui=hd(),De=ov,$_=nv,T_=tv,lv=pd(),da=dd,mi={},I_=typeof Uint8Array>"u"||!De?q:De(Uint8Array),jr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":ui&&De?De([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":mi,"%AsyncGenerator%":mi,"%AsyncGeneratorFunction%":mi,"%AsyncIteratorPrototype%":mi,"%Atomics%":typeof Atomics>"u"?q:Atomics,"%BigInt%":typeof BigInt>"u"?q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":p_,"%eval%":eval,"%EvalError%":f_,"%Float16Array%":typeof Float16Array>"u"?q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?q:FinalizationRegistry,"%Function%":av,"%GeneratorFunction%":mi,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ui&&De?De(De([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ui||!De?q:De(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":d_,"%Object.getOwnPropertyDescriptor%":io,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":g_,"%ReferenceError%":m_,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ui||!De?q:De(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ui&&De?De(""[Symbol.iterator]()):q,"%Symbol%":ui?Symbol:q,"%SyntaxError%":as,"%ThrowTypeError%":A_,"%TypedArray%":I_,"%TypeError%":Ci,"%Uint8Array%":typeof Uint8Array>"u"?q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?q:Uint32Array,"%URIError%":v_,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet,"%Function.prototype.call%":da,"%Function.prototype.apply%":lv,"%Object.defineProperty%":E_,"%Object.getPrototypeOf%":$_,"%Math.abs%":y_,"%Math.floor%":b_,"%Math.max%":w_,"%Math.min%":S_,"%Math.pow%":__,"%Math.round%":k_,"%Math.sign%":x_,"%Reflect.getPrototypeOf%":T_};if(De)try{null.error}catch(n){var C_=De(De(n));jr["%Error.prototype%"]=C_}var R_=function n(t){var e;if(t==="%AsyncFunction%")e=Bc("async function () {}");else if(t==="%GeneratorFunction%")e=Bc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Bc("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&De&&(e=De(i.prototype))}return jr[t]=e,e},rf={__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"]},pa=ha,El=Pn,P_=pa.call(da,Array.prototype.concat),D_=pa.call(lv,Array.prototype.splice),sf=pa.call(da,String.prototype.replace),Al=pa.call(da,String.prototype.slice),L_=pa.call(da,RegExp.prototype.exec),z_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,O_=/\\(\\)?/g,M_=function(t){var e=Al(t,0,1),r=Al(t,-1);if(e==="%"&&r!=="%")throw new as("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new as("invalid intrinsic syntax, expected opening `%`");var i=[];return sf(t,z_,function(s,o,a,c){i[i.length]=a?sf(c,O_,"$1"):o||s}),i},N_=function(t,e){var r=t,i;if(El(rf,r)&&(i=rf[r],r="%"+i[0]+"%"),El(jr,r)){var s=jr[r];if(s===mi&&(s=R_(r)),typeof s>"u"&&!e)throw new Ci("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new as("intrinsic "+t+" does not exist!")},kt=function(t,e){if(typeof t!="string"||t.length===0)throw new Ci("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ci('"allowMissing" argument must be a boolean');if(L_(/^%?[^%]*%?$/,t)===null)throw new as("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=M_(t),i=r.length>0?r[0]:"",s=N_("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],D_(r,P_([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var y=r[h],m=Al(y,0,1),E=Al(y,-1);if((m==='"'||m==="'"||m==="`"||E==='"'||E==="'"||E==="`")&&m!==E)throw new as("property names with quotes must have matching quotes");if((y==="constructor"||!f)&&(c=!0),i+="."+y,o="%"+i+"%",El(jr,o))a=jr[o];else if(a!=null){if(!(y in a)){if(!e)throw new Ci("base intrinsic for "+t+" exists, but the property is not available.");return}if(io&&h+1>=r.length){var x=io(a,y);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[y]}else f=El(a,y),a=a[y];f&&!c&&(jr[o]=a)}}return a},qc,of;function ir(){if(of)return qc;of=1;var n=kt,t=cc,e=t([n("%String.prototype.indexOf%")]);return qc=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},qc}var Yc,af;function fd(){if(af)return Yc;af=1;var n=kt,t=n("%Array%"),e=!t.isArray&&ir()("Object.prototype.toString");return Yc=t.isArray||function(i){return e(i)==="[object Array]"},Yc}var U_=lc,lf=ua,cv=U_.hasArrayLengthDefineBug(),F_=cv&&fd(),H_=ir(),Z_=H_("Object.prototype.propertyIsEnumerable"),gd=function(t,e,r,i,s,o){if(!lf){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&Z_(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return cv&&s==="length"&&"[[Value]]"in o&&F_(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(lf(i,s,r(o)),!0)},W_=K,Ts=Pn,V_={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},gs=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if(Ts(t,e)&&!V_[e])return!1;var r=Ts(t,"[[Value]]")||Ts(t,"[[Writable]]"),i=Ts(t,"[[Get]]")||Ts(t,"[[Set]]");if(r&&i)throw new W_("Property Descriptors may not be both accessor and data descriptors");return!0},uv=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},j_=K,B_=gs,G_=uv,hv=function(t){if(typeof t<"u"&&!B_(t))throw new j_("Assertion failed: `Desc` must be a Property Descriptor");return G_(t)},q_=K,cf=Pn,Y_=gs,dv=function(t){if(typeof t>"u")return!1;if(!Y_(t))throw new q_("Assertion failed: `Desc` must be a Property Descriptor");return!(!cf(t,"[[Value]]")&&!cf(t,"[[Writable]]"))},ms=function(t){return typeof t=="string"||typeof t=="symbol"},uf=ud,pv=function(t,e){return t===e?t===0?1/t===1/e:!0:uf(t)&&uf(e)},hf=K,K_=Rn,J_=gd,X_=hv,Q_=dv,ek=ms,tk=pv,md=function(t,e,r){if(!K_(t))throw new hf("Assertion failed: Type(O) is not Object");if(!ek(e))throw new hf("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return J_(Q_,tk,X_,t,e,i)},fv=Function.prototype.toString,Ei=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Zu,nl;if(typeof Ei=="function"&&typeof Object.defineProperty=="function")try{Zu=Object.defineProperty({},"length",{get:function(){throw nl}}),nl={},Ei(function(){throw 42},null,Zu)}catch(n){n!==nl&&(Ei=null)}else Ei=null;var nk=/^\s*class\b/,Wu=function(t){try{var e=fv.call(t);return nk.test(e)}catch{return!1}},Kc=function(t){try{return Wu(t)?!1:(fv.call(t),!0)}catch{return!1}},rl=Object.prototype.toString,rk="[object Object]",ik="[object Function]",sk="[object GeneratorFunction]",ok="[object HTMLAllCollection]",ak="[object HTML document.all class]",lk="[object HTMLCollection]",ck=typeof Symbol=="function"&&!!Symbol.toStringTag,uk=!(0 in[,]),Vu=function(){return!1};if(typeof document=="object"){var hk=document.all;rl.call(hk)===rl.call(document.all)&&(Vu=function(t){if((uk||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=rl.call(t);return(e===ok||e===ak||e===lk||e===rk)&&t("")==null}catch{}return!1})}var gv=Ei?function(t){if(Vu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Ei(t,null,Zu)}catch(e){if(e!==nl)return!1}return!Wu(t)&&Kc(t)}:function(t){if(Vu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(ck)return Kc(t);if(Wu(t))return!1;var e=rl.call(t);return e!==ik&&e!==sk&&!/^\[object HTML/.test(e)?!1:Kc(t)},dk=gv,pk=function(t){return!!t},Ht=Pn,Da=K,fk=Rn,df=dk,Jc=pk,gk=function(t){if(!fk(t))throw new Da("ToPropertyDescriptor requires an object");var e={};if(Ht(t,"enumerable")&&(e["[[Enumerable]]"]=Jc(t.enumerable)),Ht(t,"configurable")&&(e["[[Configurable]]"]=Jc(t.configurable)),Ht(t,"value")&&(e["[[Value]]"]=t.value),Ht(t,"writable")&&(e["[[Writable]]"]=Jc(t.writable)),Ht(t,"get")){var r=t.get;if(typeof r<"u"&&!df(r))throw new Da("getter must be a function");e["[[Get]]"]=r}if(Ht(t,"set")){var i=t.set;if(typeof i<"u"&&!df(i))throw new Da("setter must be a function");e["[[Set]]"]=i}if((Ht(e,"[[Get]]")||Ht(e,"[[Set]]"))&&(Ht(e,"[[Value]]")||Ht(e,"[[Writable]]")))throw new Da("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Xc=K,mk=Rn,pf=gs,vk=gd,yk=hv,bk=dv,wk=ms,Sk=pv,_k=gk,kk=function(t,e,r){if(!mk(t))throw new Xc("Assertion failed: Type(O) is not Object");if(!wk(e))throw new Xc("Assertion failed: P is not a Property Key");var i=pf(r)?r:_k(r);if(!pf(i))throw new Xc("Assertion failed: Desc is not a valid Property Descriptor");return vk(bk,Sk,yk,t,e,i)},ff=K,xk=Rn,Ek=kk,Ak=ms,$k=function(t,e,r){if(!xk(t))throw new ff("Assertion failed: Type(O) is not Object");if(!Ak(e))throw new ff("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return Ek(t,e,i)},Tk=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,Ik=ld,Ck=Ik.setPrototypeOf||null,Rk=cc,gf=ps,Pk=K,mv={};try{mv.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Dk=!("toString"in mv),Qc=gf&&gf(Object.prototype,"__proto__"),Lk=Dk&&(!!Qc&&typeof Qc.set=="function"&&Rk([Qc.set])||function(t,e){if(t==null)throw new Pk("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),mf=Tk,zk=Ck,vf=Lk,Ok=K,Mk=mf?function(t,e){if(mf(t,e))return t;throw new Ok("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:zk||(vf?function(t,e){return vf(t,e),t}:null),yf=K,Nk=Rn,bf=ov,Uk=function(t){if(!Nk(t))throw new yf("Assertion failed: O must be an Object");if(!bf)throw new yf("This environment does not support fetching prototypes.");return bf(t)},Fk=K,Hk=Mk,Zk=Rn,Wk=Uk,Vk=function(t,e){if(e!==null&&!Zk(e))throw new Fk("Assertion failed: V must be Object or Null");try{Hk(t,e)}catch{return!1}return Wk(t)===e},eu=md,wf=$k,vv=Vk,jk=lc(),vd=ev;function fa(n,t,e){var r=new vd(e);return vv(r,il),delete r.constructor,wf(r,"error",n),wf(r,"suppressed",t),r}jk&&Object.defineProperty(fa,"prototype",{writable:!1});var il=fa.prototype;if(!eu(il,"constructor",fa)||!eu(il,"message","")||!eu(il,"name","SuppressedError"))throw new vd("unable to install SuppressedError.prototype properties; please report this!");vv(fa.prototype,vd.prototype);var Bk=fa,Gk=Bk,yv=function(){return typeof SuppressedError=="function"?SuppressedError:Gk},qk=Qr,Sf=ad(),Yk=yv,Kk=function(){var t=Yk();return qk(Sf,{SuppressedError:t},{SuppressedError:function(){return Sf.SuppressedError!==t}}),t};Kk();var Jk=K,Xk=gs,Qk=uv,ex=function(t){if(typeof t<"u"&&!Xk(t))throw new Jk("Assertion failed: `Desc` must be a Property Descriptor");return Qk(t)},tx=K,_f=Pn,nx=gs,rx=function(t){if(typeof t>"u")return!1;if(!nx(t))throw new tx("Assertion failed: `Desc` must be a Property Descriptor");return!(!_f(t,"[[Value]]")&&!_f(t,"[[Writable]]"))},kf=ud,ix=function(t,e){return t===e?t===0?1/t===1/e:!0:kf(t)&&kf(e)},vs=gv,sx=function(t){return!!t},Zt=Pn,La=K,ox=Rn,xf=vs,tu=sx,ax=function(t){if(!ox(t))throw new La("ToPropertyDescriptor requires an object");var e={};if(Zt(t,"enumerable")&&(e["[[Enumerable]]"]=tu(t.enumerable)),Zt(t,"configurable")&&(e["[[Configurable]]"]=tu(t.configurable)),Zt(t,"value")&&(e["[[Value]]"]=t.value),Zt(t,"writable")&&(e["[[Writable]]"]=tu(t.writable)),Zt(t,"get")){var r=t.get;if(typeof r<"u"&&!xf(r))throw new La("getter must be a function");e["[[Get]]"]=r}if(Zt(t,"set")){var i=t.set;if(typeof i<"u"&&!xf(i))throw new La("setter must be a function");e["[[Set]]"]=i}if((Zt(e,"[[Get]]")||Zt(e,"[[Set]]"))&&(Zt(e,"[[Value]]")||Zt(e,"[[Writable]]")))throw new La("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},nu=K,lx=Rn,Ef=gs,cx=gd,ux=ex,hx=rx,dx=ms,px=ix,fx=ax,ga=function(t,e,r){if(!lx(t))throw new nu("Assertion failed: Type(O) is not Object");if(!dx(e))throw new nu("Assertion failed: P is not a Property Key");var i=Ef(r)?r:fx(r);if(!Ef(i))throw new nu("Assertion failed: Desc is not a valid Property Descriptor");return cx(hx,px,ux,t,e,i)},gx=fs(),mx=gx?Symbol.dispose||Symbol("Symbol.dispose"):null,vx=fs,yx=mx,yd=function(){return vx()&&Symbol.dispose||yx},bx=hd,wx=ga,Sx=yd,_x=function(){var t=Sx();return bx()&&wx(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},kx=fs(),xx=kx?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,Ex=fs,Ax=xx,bd=function(){return Ex()&&Symbol.asyncDispose||Ax},$x=hd,Tx=ga,Ix=bd,Cx=function(){var t=Ix();return $x()&&Tx(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},Rx=fd(),Px=kt,Dx=ir(),Lx=K,zx=Rx,Ox=Px("%Reflect.apply%",!0)||Dx("Function.prototype.apply"),uc=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!zx(r))throw new Lx("Assertion failed: optional `argumentsList`, if provided, must be a List");return Ox(t,e,r)};const Mx={},Nx=Object.freeze(Object.defineProperty({__proto__:null,default:Mx},Symbol.toStringTag,{value:"Module"})),Ux=cS(Nx);var wd=typeof Map=="function"&&Map.prototype,ru=Object.getOwnPropertyDescriptor&&wd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$l=wd&&ru&&typeof ru.get=="function"?ru.get:null,Af=wd&&Map.prototype.forEach,Sd=typeof Set=="function"&&Set.prototype,iu=Object.getOwnPropertyDescriptor&&Sd?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Tl=Sd&&iu&&typeof iu.get=="function"?iu.get:null,$f=Sd&&Set.prototype.forEach,Fx=typeof WeakMap=="function"&&WeakMap.prototype,Xs=Fx?WeakMap.prototype.has:null,Hx=typeof WeakSet=="function"&&WeakSet.prototype,Qs=Hx?WeakSet.prototype.has:null,Zx=typeof WeakRef=="function"&&WeakRef.prototype,Tf=Zx?WeakRef.prototype.deref:null,Wx=Boolean.prototype.valueOf,Vx=Object.prototype.toString,jx=Function.prototype.toString,Bx=String.prototype.match,_d=String.prototype.slice,Kn=String.prototype.replace,Gx=String.prototype.toUpperCase,If=String.prototype.toLowerCase,bv=RegExp.prototype.test,Cf=Array.prototype.concat,an=Array.prototype.join,qx=Array.prototype.slice,Rf=Math.floor,ju=typeof BigInt=="function"?BigInt.prototype.valueOf:null,su=Object.getOwnPropertySymbols,Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ls=typeof Symbol=="function"&&typeof Symbol.iterator=="object",eo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ls||!0)?Symbol.toStringTag:null,wv=Object.prototype.propertyIsEnumerable,Pf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Df(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||bv.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Rf(-n):Rf(n);if(r!==n){var i=String(r),s=_d.call(t,i.length+1);return Kn.call(i,e,"$&_")+"."+Kn.call(Kn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Kn.call(t,e,"$&_")}var Gu=Ux,Lf=Gu.custom,zf=kv(Lf)?Lf:null,Sv={__proto__:null,double:'"',single:"'"},Yx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},ys=function n(t,e,r,i){var s=e||{};if(bn(s,"quoteStyle")&&!bn(Sv,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(bn(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=bn(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(bn(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(bn(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 Ev(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?Df(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?Df(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 qu(t)?"[Array]":"[Object]";var f=pE(s,r);if(typeof i>"u")i=[];else if(xv(i,t)>=0)return"[Circular]";function y(Nt,Dn,Ic){if(Dn&&(i=qx.call(i),i.push(Dn)),Ic){var xa={depth:s.depth};return bn(s,"quoteStyle")&&(xa.quoteStyle=s.quoteStyle),n(Nt,xa,r+1,i)}return n(Nt,s,r+1,i)}if(typeof t=="function"&&!Of(t)){var m=iE(t),E=za(t,y);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(E.length>0?" { "+an.call(E,", ")+" }":"")}if(kv(t)){var x=ls?Kn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Bu.call(t);return typeof t=="object"&&!ls?Is(x):x}if(uE(t)){for(var I="<"+If.call(String(t.nodeName)),P=t.attributes||[],R=0;R<P.length;R++)I+=" "+P[R].name+"="+_v(Kx(P[R].value),"double",s);return I+=">",t.childNodes&&t.childNodes.length&&(I+="..."),I+="</"+If.call(String(t.nodeName))+">",I}if(qu(t)){if(t.length===0)return"[]";var V=za(t,y);return f&&!dE(V)?"["+Yu(V,f)+"]":"[ "+an.call(V,", ")+" ]"}if(Xx(t)){var N=za(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!wv.call(t,"cause")?"{ ["+String(t)+"] "+an.call(Cf.call("[cause]: "+y(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+an.call(N,", ")+" }"}if(typeof t=="object"&&o){if(zf&&typeof t[zf]=="function"&&Gu)return Gu(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(sE(t)){var F=[];return Af&&Af.call(t,function(Nt,Dn){F.push(y(Dn,t,!0)+" => "+y(Nt,t))}),Mf("Map",$l.call(t),F,f)}if(lE(t)){var Y=[];return $f&&$f.call(t,function(Nt){Y.push(y(Nt,t))}),Mf("Set",Tl.call(t),Y,f)}if(oE(t))return ou("WeakMap");if(cE(t))return ou("WeakSet");if(aE(t))return ou("WeakRef");if(eE(t))return Is(y(Number(t)));if(nE(t))return Is(y(ju.call(t)));if(tE(t))return Is(Wx.call(t));if(Qx(t))return Is(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof br<"u"&&t===br)return"{ [object globalThis] }";if(!Jx(t)&&!Of(t)){var B=za(t,y),ce=Pf?Pf(t)===Object.prototype:t instanceof Object||t.constructor===Object,Et=t instanceof Object?"":"null prototype",lr=!ce&&eo&&Object(t)===t&&eo in t?_d.call(sr(t),8,-1):Et?"Object":"",ze=ce||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",cr=ze+(lr||Et?"["+an.call(Cf.call([],lr||[],Et||[]),": ")+"] ":"");return B.length===0?cr+"{}":f?cr+"{"+Yu(B,f)+"}":cr+"{ "+an.call(B,", ")+" }"}return String(t)};function _v(n,t,e){var r=e.quoteStyle||t,i=Sv[r];return i+n+i}function Kx(n){return Kn.call(String(n),/"/g,"&quot;")}function ei(n){return!eo||!(typeof n=="object"&&(eo in n||typeof n[eo]<"u"))}function qu(n){return sr(n)==="[object Array]"&&ei(n)}function Jx(n){return sr(n)==="[object Date]"&&ei(n)}function Of(n){return sr(n)==="[object RegExp]"&&ei(n)}function Xx(n){return sr(n)==="[object Error]"&&ei(n)}function Qx(n){return sr(n)==="[object String]"&&ei(n)}function eE(n){return sr(n)==="[object Number]"&&ei(n)}function tE(n){return sr(n)==="[object Boolean]"&&ei(n)}function kv(n){if(ls)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Bu)return!1;try{return Bu.call(n),!0}catch{}return!1}function nE(n){if(!n||typeof n!="object"||!ju)return!1;try{return ju.call(n),!0}catch{}return!1}var rE=Object.prototype.hasOwnProperty||function(n){return n in this};function bn(n,t){return rE.call(n,t)}function sr(n){return Vx.call(n)}function iE(n){if(n.name)return n.name;var t=Bx.call(jx.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function xv(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 sE(n){if(!$l||!n||typeof n!="object")return!1;try{$l.call(n);try{Tl.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function oE(n){if(!Xs||!n||typeof n!="object")return!1;try{Xs.call(n,Xs);try{Qs.call(n,Qs)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function aE(n){if(!Tf||!n||typeof n!="object")return!1;try{return Tf.call(n),!0}catch{}return!1}function lE(n){if(!Tl||!n||typeof n!="object")return!1;try{Tl.call(n);try{$l.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function cE(n){if(!Qs||!n||typeof n!="object")return!1;try{Qs.call(n,Qs);try{Xs.call(n,Xs)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function uE(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Ev(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return Ev(_d.call(n,0,t.maxStringLength),t)+r}var i=Yx[t.quoteStyle||"single"];i.lastIndex=0;var s=Kn.call(Kn.call(n,i,"\\$1"),/[\x00-\x1f]/g,hE);return _v(s,"single",t)}function hE(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":"")+Gx.call(t.toString(16))}function Is(n){return"Object("+n+")"}function ou(n){return n+" { ? }"}function Mf(n,t,e,r){var i=r?Yu(e,r):an.call(e,", ");return n+" ("+t+") {"+i+"}"}function dE(n){for(var t=0;t<n.length;t++)if(xv(n[t],`
2
+ `)>=0)return!1;return!0}function pE(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=an.call(Array(n.indent+1)," ");else return null;return{base:e,prev:an.call(Array(t+1),e)}}function Yu(n,t){if(n.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+an.call(n,","+e)+`
4
- `+t.prev}function za(n,t){var e=Gu(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=bn(n,i)?t(n[i],n):""}var s=typeof iu=="function"?iu(n):[],o;if(ls){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)bn(n,c)&&(e&&String(Number(c))===c&&c<n.length||ls&&o["$"+c]instanceof Symbol||(vv.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof iu=="function")for(var u=0;u<s.length;u++)yv.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var dE=ys,pE=K,hc=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},fE=function(n,t){if(n){var e=hc(n,t);return e&&e.value}},gE=function(n,t,e){var r=hc(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},mE=function(n,t){return n?!!hc(n,t):!1},vE=function(n,t){if(n)return hc(n,t,!0)},yE=function(){var t,e={assert:function(r){if(!e.has(r))throw new pE("Side channel does not contain "+dE(r))},delete:function(r){var i=t&&t.next,s=vE(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return fE(t,r)},has:function(r){return mE(t,r)},set:function(r,i){t||(t={next:void 0}),gE(t,r,i)}};return e},bE=kt,ma=ir(),wE=ys,SE=K,Of=bE("%Map%",!0),_E=ma("Map.prototype.get",!0),kE=ma("Map.prototype.set",!0),xE=ma("Map.prototype.has",!0),EE=ma("Map.prototype.delete",!0),AE=ma("Map.prototype.size",!0),xv=!!Of&&function(){var t,e={assert:function(r){if(!e.has(r))throw new SE("Side channel does not contain "+wE(r))},delete:function(r){if(t){var i=EE(t,r);return AE(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return _E(t,r)},has:function(r){return t?xE(t,r):!1},set:function(r,i){t||(t=new Of),kE(t,r,i)}};return e},$E=kt,dc=ir(),TE=ys,Oa=xv,IE=K,hi=$E("%WeakMap%",!0),CE=dc("WeakMap.prototype.get",!0),RE=dc("WeakMap.prototype.set",!0),PE=dc("WeakMap.prototype.has",!0),DE=dc("WeakMap.prototype.delete",!0),LE=hi?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new IE("Side channel does not contain "+TE(i))},delete:function(i){if(hi&&i&&(typeof i=="object"||typeof i=="function")){if(t)return DE(t,i)}else if(Oa&&e)return e.delete(i);return!1},get:function(i){return hi&&i&&(typeof i=="object"||typeof i=="function")&&t?CE(t,i):e&&e.get(i)},has:function(i){return hi&&i&&(typeof i=="object"||typeof i=="function")&&t?PE(t,i):!!e&&e.has(i)},set:function(i,s){hi&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new hi),RE(t,i,s)):Oa&&(e||(e=Oa()),e.set(i,s))}};return r}:Oa,zE=K,OE=ys,ME=yE,NE=xv,UE=LE,FE=UE||NE||ME,HE=function(){var t,e={assert:function(r){if(!e.has(r))throw new zE("Side channel does not contain "+OE(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=FE()),t.set(r,i)}};return e},ZE=Pn,Cs=HE(),fn=K,_d={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");if(Cs.assert(n),!_d.has(n,t))throw new fn("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");var e=Cs.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");var e=Cs.get(n);return!!e&&ZE(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");var r=Cs.get(n);r||(r={},Cs.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(_d);var kd=_d,Ev=Cn,Xn=kd,va=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 Ev('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Xn.set(this,"[[Type]]",t),Xn.set(this,"[[Value]]",e)};va.prototype.type=function(){return Xn.get(this,"[[Type]]")};va.prototype.value=function(){return Xn.get(this,"[[Value]]")};va.prototype["?"]=function(){var t=Xn.get(this,"[[Type]]"),e=Xn.get(this,"[[Value]]");if(t==="throw")throw e;return e};va.prototype["!"]=function(){var t=Xn.get(this,"[[Type]]");if(t!=="normal")throw new Ev('Assertion failed: Completion Record is not of type "normal"');return Xn.get(this,"[[Value]]")};var xd=va,WE=xd,Ed=function(t){return new WE("normal",t)},ou,Mf;function VE(){if(Mf)return ou;Mf=1;var n=fs;return ou=function(){return n()&&!!Symbol.toStringTag},ou}var jE=kt,Nf=jE("%Object.defineProperty%",!0),BE=VE()(),GE=Pn,qE=K,Ma=BE?Symbol.toStringTag:null,Av=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 qE("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ma&&(r||!GE(t,Ma))&&(Nf?Nf(t,Ma,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Ma]=e)},$v={exports:{}},YE=kt,Uf=Vm,KE=lc(),Ff=ps,Hf=K,JE=YE("%Math.floor%"),XE=function(t,e){if(typeof t!="function")throw new Hf("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||JE(e)!==e)throw new Hf("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&Ff){var o=Ff(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(KE?Uf(t,"length",e,!0,!0):Uf(t,"length",e)),t},QE=ha,eA=dd,tA=tv,nA=function(){return tA(QE,eA,arguments)};(function(n){var t=XE,e=ua,r=cc,i=nA;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})($v);var Ad=$v.exports,rA=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},iA=Object,sA=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||iA(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},oA=Pn,aA=pd(),lA=rA,cA=sA,uA=function(t){return t&&typeof t=="object"&&oA(t,"[[DisposableResourceStack]]")&&aA(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||lA(t["[[DisposableResourceStack]]"],cA))},hA=Rn,dA=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(hA(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},pA=dA,$d=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":pA(t)},fA=K,gA=ys,mA=ms,vA=function(t,e){if(!mA(e))throw new fA("Assertion failed: P is not a Property Key, got "+gA(e));return t[e]},Zf=K,yA=vA,bA=vs,wA=ms,Wf=ys,SA=function(t,e){if(!wA(e))throw new Zf("Assertion failed: P is not a Property Key");var r=yA(t,e);if(r!=null){if(!bA(r))throw new Zf(Wf(e)+" is not a function: "+Wf(r));return r}},Yu={exports:{}},_A=kt,kA=_A,Vf=kA("%Reflect.construct%",!0),Il=ga;try{Il({},"",{"[[Get]]":function(){}})}catch{Il=null}if(Il&&Vf){var jf={},Bf={};Il(Bf,"length",{"[[Get]]":function(){throw jf},"[[Enumerable]]":!0}),Yu.exports=function(t){try{Vf(t,Bf)}catch(e){return e===jf}}}else Yu.exports=function(t){return typeof t=="function"&&!!t.prototype};var xA=Yu.exports,au=K,Gf=vs,EA=xA,AA=function(t){if(!EA(t))throw new au("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 au("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!Gf(e["[[Resolve]]"])||!Gf(e["[[Reject]]"]))throw new au("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},qf=Cn,$A=K,lu=uc,Yf=SA,TA=AA,IA=$d,Kf=vd(),Jf=yd(),CA=function(t,e){if(IA(t)!=="Object")throw new $A("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new qf("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&Jf&&(r=Yf(t,Jf)),!r){if(!Kf)throw new qf("`Symbol.dispose` is not supported");if(r=Yf(t,Kf),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=TA(Promise);try{lu(r,i),lu(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}lu(r,i)}}return r},RA=Cn,cu=K,PA=vs,DA=$d,LA=CA,zA=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new RA("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"&&DA(t)!=="Object")throw new cu("`V` must be an Object, or `null` or `undefined`");if(r=LA(t,e),typeof r>"u")throw new cu("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!PA(r))throw new cu("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},OA=Cn,Na=K,MA=uA,Xf=zA,NA=ir(),UA=NA("Array.prototype.push"),Tv=function(t,e,r){if(!MA(t))throw new Na("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new OA("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 Na("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new Na("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=Xf(e,r)}else{if(typeof e<"u")throw new Na("Assertion failed: `V` must be undefined when `method` is present");s=Xf(void 0,r,i)}return UA(t["[[DisposableResourceStack]]"],s),"UNUSED"},uu,Qf;function Td(){if(Qf)return uu;Qf=1;var n=kt,t=Ad,e=Cn,r=n("%Promise.resolve%",!0),i=r&&t(r);return uu=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},uu}var hu,eg;function FA(){if(eg)return hu;eg=1;var n=kt,t=Cn,e=n("%Promise%",!0),r=uc,i=Td(),s=$d;return hu=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)},hu}var du,tg;function HA(){if(tg)return du;tg=1;var n=xd;return du=function(e){return new n("throw",e)},du}var ZA=kt,pu=Cn,ng=K,WA=ZA("%Promise%",!0),VA=ir(),rg=VA("Promise.prototype.then",!0),jA=xd,ig=FA(),BA=Ed,GA=Td(),sg=HA(),qA=mv(),Iv=function(t,e){if(!(e instanceof jA))throw new ng("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new ng("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 pu("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&GA(WA,e),a=function(y){if(e.type()==="throw"){var m=e.value(),E=new qA(y,m);e=sg(E)}else e=sg(y)},c=i==="ASYNC-DISPOSE"&&function(m){return rg(o,function(){var E=ig(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!E)throw new pu("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return rg(E,BA)},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=ig(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(f)throw new pu("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){a(y)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},Cv=function(){var t=[];return{"[[DisposableResourceStack]]":t}},pc=ld,Id=K,YA=uc,bs=gd,KA=ga,Rv=vs,JA=Ed,at=kd,XA=Av,Pv=Qr.supportsDescriptors,QA=Ad,Cd=Tv,e1=Iv,Dv=Cv,og=vd(),bt=function n(){if(!(this instanceof n)||at.has(this,"[[DisposableState]]")||at.has(this,"[[DisposeCapability]]"))throw new Id("can only be used with new");at.set(this,"[[DisposableState]]","PENDING"),at.set(this,"[[DisposeCapability]]",Dv())},Lv=function(){var t=this;return at.assert(t,"[[DisposableState]]"),at.get(t,"[[DisposableState]]")==="DISPOSED"},ya=QA(Lv);Pv?KA(bt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Lv}):bt.prototype.disposed=!1;var zv=function(t){at.set(t,"[[DisposableState]]","DISPOSED"),Pv||(t.disposed=!0)};bs(bt.prototype,"dispose",function(){var t=this;if(!ya(t))return zv(t),e1(at.get(t,"[[DisposeCapability]]"),JA())["?"]()});bs(bt.prototype,"use",function(t){var e=this;if(ya(e))throw new pc("a disposed stack can not use anything new");return Cd(at.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});bs(bt.prototype,"adopt",function(t,e){var r=this;if(ya(r))throw new pc("a disposed stack can not use anything new");if(!Rv(e))throw new Id("`onDispose` must be a function");var i=function(){return YA(e,void 0,[t])};return Cd(at.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});bs(bt.prototype,"defer",function(t){var e=this;if(ya(e))throw new pc("a disposed stack can not defer anything new");if(!Rv(t))throw new Id("`onDispose` must be a function");Cd(at.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});bs(bt.prototype,"move",function(){var t=this;if(ya(t))throw new pc("a disposed stack can not use anything new");var e=new bt;return at.set(e,"[[DisposeCapability]]",at.get(t,"[[DisposeCapability]]")),at.set(t,"[[DisposeCapability]]",Dv()),zv(t),e});og&&bs(bt.prototype,og,bt.prototype.dispose);XA(bt.prototype,"DisposableStack");var t1=bt,n1=t1,r1=function(){return typeof DisposableStack=="function"?DisposableStack:n1},i1=Qr,s1=od(),o1=r1,a1=function(){var t=o1();return i1(s1,{DisposableStack:t},{DisposableStack:!0}),t},l1=kt,fc=ld,Rd=K,ag=l1("%Promise%",!0),Pd=Tv,c1=uc,ws=gd,u1=ga,h1=Iv,Ov=vs,Mv=Cv,d1=Ed,lg=Td(),lt=kd,p1=Av,Nv=Qr.supportsDescriptors,f1=Ad,g1=ir(),m1=g1("Promise.prototype.then",!0),cg=yd(),wt=function n(){if(!(this instanceof n)||lt.has(this,"[[AsyncDisposableState]]")||lt.has(this,"[[DisposeCapability]]"))throw new Rd("can only be used with new");lt.set(this,"[[AsyncDisposableState]]","pending"),lt.set(this,"[[DisposeCapability]]",Mv())},Uv=function(){var t=this;return lt.assert(t,"[[AsyncDisposableState]]"),lt.get(t,"[[AsyncDisposableState]]")==="disposed"},ba=f1(Uv);Nv?u1(wt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Uv}):wt.prototype.disposed=!1;var Fv=function(t){lt.set(t,"[[AsyncDisposableState]]","disposed"),Nv||(t.disposed=!0)};ws(wt.prototype,"disposeAsync",function(){var t=this;return ba(t)?lg(ag):(Fv(t),m1(lg(ag,h1(lt.get(t,"[[DisposeCapability]]"),d1())),function(e){return e["?"]()}))});ws(wt.prototype,"use",function(t){var e=this;if(ba(e))throw new fc("a disposed stack can not use anything new");return Pd(lt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});ws(wt.prototype,"adopt",function(t,e){var r=this;if(ba(r))throw new fc("a disposed stack can not use anything new");if(!Ov(e))throw new Rd("`onDisposeAsync` must be a function");var i=function(){return c1(e,void 0,[t])};return i.value=t,Pd(lt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});ws(wt.prototype,"defer",function(t){var e=this;if(ba(e))throw new fc("a disposed stack can not defer anything new");if(!Ov(t))throw new Rd("`onDispose` must be a function");Pd(lt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});ws(wt.prototype,"move",function(){var t=this;if(ba(t))throw new fc("a disposed stack can not use anything new");var e=new wt;return lt.set(e,"[[DisposeCapability]]",lt.get(t,"[[DisposeCapability]]")),lt.set(t,"[[DisposeCapability]]",Mv()),Fv(t),e});cg&&ws(wt.prototype,cg,wt.prototype.disposeAsync);p1(wt.prototype,"AsyncDisposableStack");var v1=wt,y1=v1,b1=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:y1},w1=Qr,S1=od(),_1=b1,k1=function(){var t=_1();return w1(S1,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},x1=wx,E1=Tx,A1=a1,$1=k1,T1=function(){x1(),E1(),A1(),$1()};T1();const ug=new WeakMap;function I1(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function di(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function hg(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function C1(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class R1{constructor(){g(this,"entries",new Map);g(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw hg();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw hg();if(e.constructor.name==="AsyncFunction")throw C1();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=ug.get(t);if(e){if(t.length!==e.length)throw new Error(`${di(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(`${di(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=ug.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(`${di(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=>di(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(I1(r))throw new Error(`Factory for ${di(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${di(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 un=new R1,P1=.5,dg=.1,pg=8,D1=4,Hv=3,Zv=3,L1=4,_r=255,Wv=.2126,Vv=.7152,jv=.0722;async function Bv(n){const t=z1(n);if(!t)return"light";try{return await N1(n,t)>=P1?"light":"dark"}catch{return"light"}}function z1(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(O1(o))return s}return null}function O1(n){return Gv(n.backgroundImage)?!0:M1(n.backgroundColor)>0}function M1(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===L1?parseFloat(e[Hv]):e.length===Zv?1:0}async function N1(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:Ua((e.left-r.left)/r.width),y:Ua((e.top-r.top)/r.height),width:Ua(e.width/r.width),height:Ua(e.height/r.height)},s=window.getComputedStyle(t),o=Gv(s.backgroundImage);return o?F1({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):H1(s.backgroundColor)}function Gv(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const fg=new Map;function U1(n){let t=fg.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}),fg.set(n,t),t)}async function F1(n){const t=await U1(n.url),e=Math.max(pg,Math.ceil(n.surfaceWidth*dg)),r=Math.max(pg,Math.ceil(n.surfaceHeight*dg)),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 y=Math.max(0,Math.floor(n.region.x*e)),m=Math.max(0,Math.floor(n.region.y*r)),E=Math.max(1,Math.min(e-y,Math.floor(n.region.width*e))),x=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),I=s.getImageData(y,m,E,x).data;let P=0,R=0;for(let V=0;V<I.length;V+=D1){const N=I[V]/_r,F=I[V+1]/_r,Y=I[V+2]/_r,B=I[V+Hv]/_r;P+=B*(Wv*N+Vv*F+jv*Y),R+=1}return R>0?P/R:1}function H1(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<Zv)return 1;const r=e[0]/_r,i=e[1]/_r,s=e[2]/_r;return Wv*r+Vv*i+jv*s}function Ua(n){return n<0?0:n>1?1:n}const Z1=["ghost","glass"],so=[...Z1.map(n=>`[variant="${n}"]`),'[material="glass"]'].join(", "),Fa=new WeakSet,gg=new WeakSet;function qv(n){if(gg.has(n))return;gg.add(n);for(const e of n.querySelectorAll(so))fu(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)W1(i,fu);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(so)&&fu(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function W1(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(so)&&t(n);for(const e of n.querySelectorAll(so))t(e)}}async function fu(n){var e,r;if(Fa.has(n)||n.hasAttribute("tone")||(e=n.parentElement)!=null&&e.closest("[tone]"))return;Fa.add(n);const t=await Bv(n);if(!n.matches(so)){Fa.delete(n);return}if(n.hasAttribute("tone")||(r=n.parentElement)!=null&&r.closest("[tone]")){Fa.delete(n);return}n.setAttribute("tone",t)}const V1="*,*: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)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass-frosted]{background:color-mix(in srgb,var(--black) 70%,transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-50), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-100), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}ui-popover.dropdown-popover::part(panel){min-width:192px;padding:var(--space-4)}.dropdown-list{display:flex;flex-direction:column;gap:2px}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover,dropdown-item[action]:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}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{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)}',Dd=new CSSStyleSheet;Dd.replaceSync(V1);const Ld=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,Dd,Ld]}catch{}qv(document);function Yv(n){Ld.replaceSync(n)}function Cl(){Yv("")}function zd(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,Dd,Ld]}catch{}qv(n)}const j1=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function B1(n){for(const t of Object.keys(n))if(j1.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function G1(n,t){B1(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function je(){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}),G1(this,c)}}return n}class Ot extends globalThis.EventTarget{}function q1(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function wa(n){var e;class t extends n{constructor(...s){super(...s);S(this,e,!1);q1(this,()=>l(this,e),()=>{w(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const Y1=je(),K1=je(),J1=je(),Hs=je(),Kv=je(),X1=je(),gu=je(),qe=4,ft=6,oo=2,Ku=2,Od=8,Q1=ft,Md="auto",Qn="auto",Mn=128,mg=50,ae=16,Br=Mn*qe+ae*(qe-1),ao=Mn*ft+ae*(ft-1),e$=Br+ae*2,t$=200,n$=4,Ha=150,r$=10,vg=2,yg=8,i$=300,s$=4;function Jv(n){return ey(n)}function Xv(n,t){return ey(n.flatMap(e=>ny(e,t)))}function Qv(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}ry(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function kr(n){const t=Jv(n),e=Qv(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(c$)}}function ey(n){const t=[];for(const e of n){const r=ty(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(Tn));continue}t.push(i)}}return t}function ty(n){switch(n.type){case"card":return[Tn(n)];case"row":{const t=n.children.map(Tn);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=ty(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(Ju));continue}if(i.type==="row"){t.push({...i,children:i.children.map(Tn)});continue}t.push(Tn(i))}}return t.length===0?[]:t.length===1?[Ju(t[0])]:[{...n,children:t}]}}}function ny(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[Tn(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(Tn);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>ny(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[Ju(e[0])]:[{...n,children:e}]}}}function ry(n,t,e,r){switch(n.type){case"card":iy(n,t,e,r);return;case"row":o$(n,t,e,r);return;case"stack":a$(n,t,e,r);return}}function iy(n,t,e,r){"id"in n&&e.push(`Card ${Rs(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),l$(n.width)||e.push(`Card ${Rs(n)} width must be an integer in the range ${oo}-${Od}`),oy(n.height)||e.push(`Card ${Rs(n)} height must be an integer in the range 2-6 or "auto"`);const i=Ai(n.width);t==="stack"&&i!==qe&&e.push(`Stack child ${Rs(n)} width must be ${qe}`),t==="row"&&i<oo&&e.push(`Row child ${Rs(n)} must be at least 2 columns wide`)}function Rs(n){return typeof n.artifactID=="string"&&n.artifactID.length>0?n.artifactID:"<missing artifactID>"}function o$(n,t,e,r){if(sy(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),oy(n.height,s$)||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}iy(s,"row",e,r),i+=Ai(s.width)}i!==qe&&e.push(`Row ${n.id} children must sum to 4 columns`)}function a$(n,t,e,r){if(sy(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(ry(a,"stack",e,r),a.height===Qn){s+=1;continue}i+=a.height}if(i>ft&&e.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=ft-i;if(o<s*Ku||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Ku&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function sy(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function l$(n){return n===Md||Number.isInteger(n)&&n>=oo&&n<=Od}function oy(n,t=Q1){return n===Qn||Number.isInteger(n)&&n>=Ku&&n<=t}function Ai(n){return n===Md?qe:n}function c$(n){if(n.type==="card")return{id:n.artifactID,type:"card",width:Ai(n.width),cards:[{id:n.artifactID,artifactID:n.artifactID,col:1,row:1,width:Ai(n.width),height:ay(n.height,ft)}]};const t=u$(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:qe,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:Ai(c.width),height:o}),a+=Ai(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 u$(n){let t=0,e=0;for(const i of n)i.height===Qn?e+=1:t+=i.height;const r=e>0?(ft-t)/e:0;return n.map(i=>ay(i.height,r))}function ay(n,t){return n===Qn?t:n}function Tn(n){return{...n}}function Ju(n){return n.type==="card"?Tn(n):{...n,children:n.children.map(Tn)}}function ly(n,t={}){return{type:"card",artifactID:n,width:t.width??Md,height:t.height??Qn}}function sl(n){return n.layout.flatMap(cy)}function cy(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(cy)}}const oe=je(),Xu=je(),pi=je(),bg=je();function h$(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const Nd=h$("RequestError"),d$=200,p$=300,Za=401;class f${constructor(t,e){g(this,"serverURL");g(this,"token");g(this,"onUnauthorized");this.serverURL=t.replace(/\/$/,""),this.token=e.token,this.onUnauthorized=e.onUnauthorized}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 g$(i);if(!i.ok||i.status<d$||i.status>=p$)throw i.status===Za&&((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===Za&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await mu(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===Za&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await mu(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===Za&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await mu(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new Nd(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}`),Object.keys(e).length>0?e:void 0}}async function g$(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function mu(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 m$(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var jt,jl,uy;class v${constructor(t){S(this,jl);S(this,jt);w(this,jt,t)}list(){return l(this,jt).requestJSON("GET","/screens")}async get(t={}){const e=await p(this,jl,uy).call(this,t.screenID);return l(this,jt).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,jt).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,jt).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,jt).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}jt=new WeakMap,jl=new WeakSet,uy=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,jt).createError(`screenID is required when multiple screens exist. Available screens: ${m$(e)}`)};var wn;class y${constructor(t){S(this,wn);w(this,wn,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,wn).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,wn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,wn).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,wn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return l(this,wn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}wn=new WeakMap;var Li;class b${constructor(t){S(this,Li);w(this,Li,t)}get(t){return l(this,Li).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return l(this,Li).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}Li=new WeakMap;var Ar;class w${constructor(t){S(this,Ar);w(this,Ar,t)}get(){return l(this,Ar).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,Ar).requestVoid("PATCH","/display",e)}focus(t){return l(this,Ar).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}Ar=new WeakMap;var Sn;class S${constructor(t,e={}){g(this,"screens");g(this,"artifacts");g(this,"display");g(this,"markdown");S(this,Sn);w(this,Sn,new f$(t,e)),this.screens=new v$(l(this,Sn)),this.artifacts=new y$(l(this,Sn)),this.display=new w$(l(this,Sn)),this.markdown=new b$(l(this,Sn))}health(){return l(this,Sn).requestJSON("GET","/health")}}Sn=new WeakMap;const _$={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},k$="Local",x$="store-";function he(n){return new URL(n).origin}function E$(n){return{servers:[{url:he(n),name:k$}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{},authTokens:{}}}function A$(n,t){return[...n.tabs[he(t)]??[]]}function $$(n,t,e){const r=he(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function T$(n,t,e){const r=he(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 I$(n,t,e=Date.now()){const r=n.screens[t]??{scrollPosition:0};return{...n,screens:{...n.screens,[t]:{...r,lastActivatedAt:e}}}}var $r,Tr,Ir;class C$ extends Ot{constructor(e,r,i={}){super();S(this,$r);S(this,Tr);S(this,Ir);w(this,$r,`${x$}${e}`),w(this,Tr,i.storage??D$());const s=l(this,Tr).getItem(l(this,$r));s===null?(w(this,Ir,r),l(this,Tr).setItem(l(this,$r),JSON.stringify(r))):w(this,Ir,L$(JSON.parse(s),r))}get(){return l(this,Ir)}set(e){w(this,Ir,e),l(this,Tr).setItem(l(this,$r),JSON.stringify(e)),this.dispatchEvent(new oe("change"))}}$r=new WeakMap,Tr=new WeakMap,Ir=new WeakMap;function vu(n,t){return n.authTokens[he(t)]??null}function R$(n,t,e){return{...n,authTokens:{...n.authTokens,[he(t)]:e}}}function P$(n,t){const e=he(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{...n,authTokens:r}}function D$(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function L$(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}}class z$ extends Event{constructor(){super("theme-changed")}}const O$=wa(Ot);var Cr,Ne,Un,Ge,Fn,_n,fo,ee,mr,hy,go,dy,py,fy,gy,Qu,eh,th,my;class M$ extends O${constructor(e){var i;super();S(this,ee);g(this,"id");g(this,"server");S(this,Cr);S(this,Ne,new Map);S(this,Un);S(this,Ge);S(this,Fn);S(this,_n,null);S(this,fo,0);S(this,go,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&p(this,ee,dy).call(this,r.screen);break;case"artifact-created":r.screenID===this.id&&p(this,ee,py).call(this,r.artifact);break;case"artifact-updated":p(this,ee,fy).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&p(this,ee,gy).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Ne).has(r.artifactID)&&this.dispatchEvent(new bg("artifact-content-changed",{artifactID:r.artifactID}));break;case"theme-changed":this.dispatchEvent(new z$);break}});this.id=e.screen.id,this.server=e.server,w(this,Cr,e.localStore),w(this,Un,e.screen.name),w(this,Ge,structuredClone(e.screen.layout));const r=((i=l(this,Cr).get().screens[this.id])==null?void 0:i.scrollPosition)??0;w(this,Fn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,go)),p(this,ee,hy).call(this)}get name(){return l(this,Un)}get layout(){return l(this,Ge)}get scrollPosition(){return l(this,Fn)}get artifacts(){return l(this,Ne)}setScrollPosition(e){p(this,ee,mr).call(this);const r=Math.max(0,e);r!==l(this,Fn)&&(w(this,Fn,r),p(this,ee,my).call(this),this.dispatchEvent(new oe("change")))}setLayout(e){p(this,ee,mr).call(this);const r=Jv(e);if(!Qv(r).valid)return;const s=p(this,ee,eh).call(this);w(this,Ge,r),w(this,_n,{layout:r,snapshot:s}),this.dispatchEvent(new oe("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,_n))==null?void 0:o.layout)===r&&(w(this,_n,null),p(this,ee,th).call(this,s),this.dispatchEvent(new oe("change")))})}rename(e){p(this,ee,mr).call(this),w(this,Un,e),this.dispatchEvent(new oe("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){p(this,ee,mr).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(p(this,ee,mr).call(this),!l(this,Ne).has(e))return;const r=p(this,ee,eh).call(this);p(this,ee,Qu).call(this,e),this.dispatchEvent(new oe("change")),this.server.client.artifacts.delete({artifactID:e}).catch(()=>{this.disposed||(p(this,ee,th).call(this,r),this.dispatchEvent(new oe("change")))})}async refreshFromServer(){p(this,ee,mr).call(this);const e=++Zc(this,fo)._;let r;try{r=await this.server.client.screens.get({screenID:this.id})}catch{return}if(this.disposed||e!==l(this,fo))return;const i=new Set([...l(this,Ne).values()].filter(s=>s.kind==="path").map(s=>s.id));w(this,_n,null),w(this,Un,r.screen.name),w(this,Ge,structuredClone(r.screen.layout)),l(this,Ne).clear();for(const s of r.artifacts)l(this,Ne).set(s.id,s);this.dispatchEvent(new oe("change"));for(const s of r.artifacts)s.kind==="path"&&i.has(s.id)&&this.dispatchEvent(new bg("artifact-content-changed",{artifactID:s.id}))}dispose(){this.server.removeEventListener("server-event",l(this,go))}}Cr=new WeakMap,Ne=new WeakMap,Un=new WeakMap,Ge=new WeakMap,Fn=new WeakMap,_n=new WeakMap,fo=new WeakMap,ee=new WeakSet,mr=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},hy=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,Ne).set(r.id,r);this.dispatchEvent(new oe("change"))}catch{}},go=new WeakMap,dy=function(e){l(this,_n)&&w(this,_n,null),w(this,Un,e.name),w(this,Ge,structuredClone(e.layout)),this.dispatchEvent(new oe("change"))},py=function(e){sl({layout:l(this,Ge)}).includes(e.id)||w(this,Ge,[...l(this,Ge),ly(e.id)]),l(this,Ne).set(e.id,e),this.dispatchEvent(new oe("change"))},fy=function(e){const r=l(this,Ne).get(e.id);r&&(l(this,Ne).set(e.id,{...r,...e}),this.dispatchEvent(new oe("change")))},gy=function(e){p(this,ee,Qu).call(this,e)&&this.dispatchEvent(new oe("change"))},Qu=function(e){const r=l(this,Ne).delete(e),i=sl({layout:l(this,Ge)}).length,s=Xv(l(this,Ge),e),o=sl({layout:s}).length;return w(this,Ge,s),r||i!==o},eh=function(){return{layout:structuredClone(l(this,Ge)),artifacts:new Map([...l(this,Ne).entries()].map(([e,r])=>[e,structuredClone(r)]))}},th=function(e){w(this,Ge,structuredClone(e.layout)),l(this,Ne).clear();for(const[r,i]of e.artifacts)l(this,Ne).set(r,structuredClone(i))},my=function(){const e=l(this,Cr).get();l(this,Cr).set({...e,screens:{...e.screens,[this.id]:{...e.screens[this.id],scrollPosition:l(this,Fn)}}})};const N$=wa(Ot);var Pe,Ue,At,mo,vo,yo,bo,Xe,ol,nh,vi;class U$ extends N${constructor(e){super();S(this,Xe);S(this,Pe);S(this,Ue);S(this,At,null);S(this,mo,()=>{this.disposed||p(this,Xe,ol).call(this)});S(this,vo,()=>{this.disposed||p(this,Xe,ol).call(this)});S(this,yo,e=>{if(this.disposed)return;const r=e.event;if(r.type==="screen-removed"){this.removeTab(e.serverURL,r.screenID);const i=l(this,Pe).get();i.activeServerURL===he(e.serverURL)&&i.activeScreenID===r.screenID&&p(this,Xe,vi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){p(this,Xe,vi).call(this,e.serverURL,null);return}const i=l(this,Ue).servers.get(he(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),p(this,Xe,vi).call(this,e.serverURL,r.screenID)}});S(this,bo,e=>{if(this.disposed)return;const r=l(this,At);r&&he(e.serverURL)===he(r.server.url)&&r.refreshFromServer()});w(this,Pe,e.localStore),w(this,Ue,e.serverManager),l(this,Pe).addEventListener("change",l(this,mo)),l(this,Ue).addEventListener("change",l(this,vo)),l(this,Ue).addEventListener("server-event",l(this,yo)),l(this,Ue).addEventListener("server-reconnected",l(this,bo)),p(this,Xe,ol).call(this)}get activeScreen(){return l(this,At)}get screens(){const e=l(this,Pe).get().screens,r=[];let i=0;for(const s of l(this,Ue).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=he(e),i=A$(l(this,Pe).get(),r),s=l(this,Ue).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=he(e),s=l(this,Ue).servers.get(i);s&&!s.screens.has(r)||p(this,Xe,nh).call(this,$$(l(this,Pe).get(),i,r))}removeTab(e,r){p(this,Xe,nh).call(this,T$(l(this,Pe).get(),e,r))}setActive(e,r){const i=he(e),s=l(this,Ue).servers.get(i);!s||!s.screens.has(r)||p(this,Xe,vi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Pe).get().activeServerURL;if(!e||!p(this,Xe,vi).call(this,e,null))return;const r=l(this,Ue).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Pe).removeEventListener("change",l(this,mo)),l(this,Ue).removeEventListener("change",l(this,vo)),l(this,Ue).removeEventListener("server-event",l(this,yo)),l(this,Ue).removeEventListener("server-reconnected",l(this,bo)),(e=l(this,At))==null||e.dispose(),w(this,At,null)}}Pe=new WeakMap,Ue=new WeakMap,At=new WeakMap,mo=new WeakMap,vo=new WeakMap,yo=new WeakMap,bo=new WeakMap,Xe=new WeakSet,ol=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Pe).get(),i=e?l(this,Ue).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,At))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,At))==null?void 0:u.server)===i||((h=l(this,At))==null||h.dispose(),w(this,At,i&&s?new M$({screen:s,server:i,localStore:l(this,Pe)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new Y1("active-screen-changed")))},nh=function(e){e!==l(this,Pe).get()&&(l(this,Pe).set(e),this.dispatchEvent(new K1("tabs-changed")))},vi=function(e,r){const i=he(e),s=l(this,Pe).get();if(s.activeServerURL===i&&s.activeScreenID===r)return!1;const o=r===null?{...s,activeServerURL:i,activeScreenID:r}:I$({...s,activeServerURL:i,activeScreenID:r},r);return l(this,Pe).set(o),!0};const vy="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Rl=32,F$=16,yy=10,wg=0xffffffffffff;var xr;(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"})(xr||(xr={}));class Zs extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function H$(n){const t=Math.floor(n()*Rl)%Rl;return vy.charAt(t)}function Z$(n){const t=W$(),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 Zs(xr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function W$(){return B$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function V$(n,t){let e="";for(;n>0;n--)e=H$(t)+e;return e}function j$(n,t=yy){if(isNaN(n))throw new Zs(xr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>wg)throw new Zs(xr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${wg}: ${n}`);if(n<0)throw new Zs(xr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Zs(xr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%Rl,r=vy.charAt(e)+r,n=(n-e)/Rl;return r}function B$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Ud(n,t){const e=Z$(),r=Date.now();return j$(r,yy)+V$(F$,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 y=h[f];y in a||(a[y]=u[y].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 Ri extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class by extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const wy={};function er(n){return wy}function Sy(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 rh(n,t){return typeof t=="bigint"?t.toString():t}function gc(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function Fd(n){return n==null}function Hd(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function G$(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 Sg=Symbol("evaluating");function te(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==Sg)return r===void 0&&(r=Sg,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function ti(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function or(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function _g(n){return JSON.stringify(n)}function q$(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const _y="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function lo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const Y$=gc(()=>{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 cs(n){if(lo(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(lo(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function ky(n){return cs(n)?{...n}:Array.isArray(n)?[...n]:n}const K$=new Set(["string","number","symbol"]);function us(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ar(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 O(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 J$(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const X$={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 Q$(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=or(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 ti(this,"shape",o),o},checks:[]});return ar(n,s)}function eT(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=or(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 ti(this,"shape",o),o},checks:[]});return ar(n,s)}function tT(n,t){if(!cs(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=or(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return ti(this,"shape",s),s}});return ar(n,i)}function nT(n,t){if(!cs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=or(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return ti(this,"shape",r),r}});return ar(n,e)}function rT(n,t){const e=or(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return ti(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ar(n,e)}function iT(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=or(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 ti(this,"shape",c),c},checks:[]});return ar(t,o)}function sT(n,t,e){const r=or(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 ti(this,"shape",s),s}});return ar(t,r)}function $i(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 Ti(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Wa(n){return typeof n=="string"?n:n==null?void 0:n.message}function tr(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Wa((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Wa((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??Wa((c=e.customError)==null?void 0:c.call(e,n))??Wa((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 Zd(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function co(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const xy=(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,rh,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Ey=A("$ZodError",xy),Ay=A("$ZodError",xy,{Parent:Error});function oT(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 aT(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 Wd=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 Ri;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>tr(c,s,er())));throw _y(a,i==null?void 0:i.callee),a}return o.value},Vd=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=>tr(c,s,er())));throw _y(a,i==null?void 0:i.callee),a}return o.value},mc=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 Ri;return s.issues.length?{success:!1,error:new(n??Ey)(s.issues.map(o=>tr(o,i,er())))}:{success:!0,data:s.value}},lT=mc(Ay),vc=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=>tr(o,i,er())))}:{success:!0,data:s.value}},cT=vc(Ay),uT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wd(n)(t,e,i)},hT=n=>(t,e,r)=>Wd(n)(t,e,r),dT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vd(n)(t,e,i)},pT=n=>async(t,e,r)=>Vd(n)(t,e,r),fT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return mc(n)(t,e,i)},gT=n=>(t,e,r)=>mc(n)(t,e,r),mT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vc(n)(t,e,i)},vT=n=>async(t,e,r)=>vc(n)(t,e,r),yT=/^[cC][^\s-]{8,}$/,bT=/^[0-9a-z]+$/,wT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ST=/^[0-9a-vA-V]{20}$/,_T=/^[A-Za-z0-9]{27}$/,kT=/^[a-zA-Z0-9_-]{21}$/,xT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ET=/^([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})$/,kg=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)$/,AT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$T="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function TT(){return new RegExp($T,"u")}const IT=/^(?:(?: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])$/,CT=/^(([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}|:))$/,RT=/^((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])$/,PT=/^(([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])$/,DT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$y=/^[A-Za-z0-9_-]*$/,LT=/^\+[1-9]\d{6,14}$/,Ty="(?:(?:\\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])))",zT=new RegExp(`^${Ty}$`);function Iy(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 OT(n){return new RegExp(`^${Iy(n)}$`)}function MT(n){const t=Iy({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(`^${Ty}T(?:${r})$`)}const NT=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}$`)},UT=/^-?\d+$/,Cy=/^-?\d+(?:\.\d+)?$/,FT=/^(?:true|false)$/i,HT=/^[^A-Z]*$/,ZT=/^[^a-z]*$/,ct=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),Ry={number:"number",bigint:"bigint",object:"date"},Py=A("$ZodCheckLessThan",(n,t)=>{ct.init(n,t);const e=Ry[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})}}),Dy=A("$ZodCheckGreaterThan",(n,t)=>{ct.init(n,t);const e=Ry[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})}}),WT=A("$ZodCheckMultipleOf",(n,t)=>{ct.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):G$(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})}}),VT=A("$ZodCheckNumberFormat",(n,t)=>{var o;ct.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]=X$[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=UT)}),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})}}),jT=A("$ZodCheckMaxLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Fd(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=Zd(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),BT=A("$ZodCheckMinLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Fd(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=Zd(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),GT=A("$ZodCheckLengthEquals",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Fd(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=Zd(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})}}),yc=A("$ZodCheckStringFormat",(n,t)=>{var e,r;ct.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=()=>{})}),qT=A("$ZodCheckRegex",(n,t)=>{yc.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})}}),YT=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=HT),yc.init(n,t)}),KT=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=ZT),yc.init(n,t)}),JT=A("$ZodCheckIncludes",(n,t)=>{ct.init(n,t);const e=us(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})}}),XT=A("$ZodCheckStartsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`^${us(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})}}),QT=A("$ZodCheckEndsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`.*${us(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})}}),eI=A("$ZodCheckOverwrite",(n,t)=>{ct.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class tI{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 za(n,t){var e=qu(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=bn(n,i)?t(n[i],n):""}var s=typeof su=="function"?su(n):[],o;if(ls){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)bn(n,c)&&(e&&String(Number(c))===c&&c<n.length||ls&&o["$"+c]instanceof Symbol||(bv.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof su=="function")for(var u=0;u<s.length;u++)wv.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var fE=ys,gE=K,hc=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},mE=function(n,t){if(n){var e=hc(n,t);return e&&e.value}},vE=function(n,t,e){var r=hc(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},yE=function(n,t){return n?!!hc(n,t):!1},bE=function(n,t){if(n)return hc(n,t,!0)},wE=function(){var t,e={assert:function(r){if(!e.has(r))throw new gE("Side channel does not contain "+fE(r))},delete:function(r){var i=t&&t.next,s=bE(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return mE(t,r)},has:function(r){return yE(t,r)},set:function(r,i){t||(t={next:void 0}),vE(t,r,i)}};return e},SE=kt,ma=ir(),_E=ys,kE=K,Nf=SE("%Map%",!0),xE=ma("Map.prototype.get",!0),EE=ma("Map.prototype.set",!0),AE=ma("Map.prototype.has",!0),$E=ma("Map.prototype.delete",!0),TE=ma("Map.prototype.size",!0),Av=!!Nf&&function(){var t,e={assert:function(r){if(!e.has(r))throw new kE("Side channel does not contain "+_E(r))},delete:function(r){if(t){var i=$E(t,r);return TE(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return xE(t,r)},has:function(r){return t?AE(t,r):!1},set:function(r,i){t||(t=new Nf),EE(t,r,i)}};return e},IE=kt,dc=ir(),CE=ys,Oa=Av,RE=K,hi=IE("%WeakMap%",!0),PE=dc("WeakMap.prototype.get",!0),DE=dc("WeakMap.prototype.set",!0),LE=dc("WeakMap.prototype.has",!0),zE=dc("WeakMap.prototype.delete",!0),OE=hi?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new RE("Side channel does not contain "+CE(i))},delete:function(i){if(hi&&i&&(typeof i=="object"||typeof i=="function")){if(t)return zE(t,i)}else if(Oa&&e)return e.delete(i);return!1},get:function(i){return hi&&i&&(typeof i=="object"||typeof i=="function")&&t?PE(t,i):e&&e.get(i)},has:function(i){return hi&&i&&(typeof i=="object"||typeof i=="function")&&t?LE(t,i):!!e&&e.has(i)},set:function(i,s){hi&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new hi),DE(t,i,s)):Oa&&(e||(e=Oa()),e.set(i,s))}};return r}:Oa,ME=K,NE=ys,UE=wE,FE=Av,HE=OE,ZE=HE||FE||UE,WE=function(){var t,e={assert:function(r){if(!e.has(r))throw new ME("Side channel does not contain "+NE(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=ZE()),t.set(r,i)}};return e},VE=Pn,Cs=WE(),fn=K,kd={assert:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");if(Cs.assert(n),!kd.has(n,t))throw new fn("`"+t+"` is not present on `O`")},get:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");var e=Cs.get(n);return e&&e["$"+t]},has:function(n,t){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");var e=Cs.get(n);return!!e&&VE(e,"$"+t)},set:function(n,t,e){if(!n||typeof n!="object"&&typeof n!="function")throw new fn("`O` is not an object");if(typeof t!="string")throw new fn("`slot` must be a string");var r=Cs.get(n);r||(r={},Cs.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(kd);var xd=kd,$v=Cn,Xn=xd,va=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 $v('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Xn.set(this,"[[Type]]",t),Xn.set(this,"[[Value]]",e)};va.prototype.type=function(){return Xn.get(this,"[[Type]]")};va.prototype.value=function(){return Xn.get(this,"[[Value]]")};va.prototype["?"]=function(){var t=Xn.get(this,"[[Type]]"),e=Xn.get(this,"[[Value]]");if(t==="throw")throw e;return e};va.prototype["!"]=function(){var t=Xn.get(this,"[[Type]]");if(t!=="normal")throw new $v('Assertion failed: Completion Record is not of type "normal"');return Xn.get(this,"[[Value]]")};var Ed=va,jE=Ed,Ad=function(t){return new jE("normal",t)},au,Uf;function BE(){if(Uf)return au;Uf=1;var n=fs;return au=function(){return n()&&!!Symbol.toStringTag},au}var GE=kt,Ff=GE("%Object.defineProperty%",!0),qE=BE()(),YE=Pn,KE=K,Ma=qE?Symbol.toStringTag:null,Tv=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 KE("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ma&&(r||!YE(t,Ma))&&(Ff?Ff(t,Ma,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Ma]=e)},Iv={exports:{}},JE=kt,Hf=Bm,XE=lc(),Zf=ps,Wf=K,QE=JE("%Math.floor%"),eA=function(t,e){if(typeof t!="function")throw new Wf("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||QE(e)!==e)throw new Wf("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&Zf){var o=Zf(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(XE?Hf(t,"length",e,!0,!0):Hf(t,"length",e)),t},tA=ha,nA=pd(),rA=rv,iA=function(){return rA(tA,nA,arguments)};(function(n){var t=eA,e=ua,r=cc,i=iA;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})(Iv);var $d=Iv.exports,sA=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},oA=Object,aA=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||oA(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},lA=Pn,cA=fd(),uA=sA,hA=aA,dA=function(t){return t&&typeof t=="object"&&lA(t,"[[DisposableResourceStack]]")&&cA(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||uA(t["[[DisposableResourceStack]]"],hA))},pA=Rn,fA=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(pA(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},gA=fA,Td=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":gA(t)},mA=K,vA=ys,yA=ms,bA=function(t,e){if(!yA(e))throw new mA("Assertion failed: P is not a Property Key, got "+vA(e));return t[e]},Vf=K,wA=bA,SA=vs,_A=ms,jf=ys,kA=function(t,e){if(!_A(e))throw new Vf("Assertion failed: P is not a Property Key");var r=wA(t,e);if(r!=null){if(!SA(r))throw new Vf(jf(e)+" is not a function: "+jf(r));return r}},Ku={exports:{}},xA=kt,EA=xA,Bf=EA("%Reflect.construct%",!0),Il=ga;try{Il({},"",{"[[Get]]":function(){}})}catch{Il=null}if(Il&&Bf){var Gf={},qf={};Il(qf,"length",{"[[Get]]":function(){throw Gf},"[[Enumerable]]":!0}),Ku.exports=function(t){try{Bf(t,qf)}catch(e){return e===Gf}}}else Ku.exports=function(t){return typeof t=="function"&&!!t.prototype};var AA=Ku.exports,lu=K,Yf=vs,$A=AA,TA=function(t){if(!$A(t))throw new lu("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 lu("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!Yf(e["[[Resolve]]"])||!Yf(e["[[Reject]]"]))throw new lu("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},Kf=Cn,IA=K,cu=uc,Jf=kA,CA=TA,RA=Td,Xf=yd(),Qf=bd(),PA=function(t,e){if(RA(t)!=="Object")throw new IA("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new Kf("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&Qf&&(r=Jf(t,Qf)),!r){if(!Xf)throw new Kf("`Symbol.dispose` is not supported");if(r=Jf(t,Xf),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=CA(Promise);try{cu(r,i),cu(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}cu(r,i)}}return r},DA=Cn,uu=K,LA=vs,zA=Td,OA=PA,MA=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new DA("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"&&zA(t)!=="Object")throw new uu("`V` must be an Object, or `null` or `undefined`");if(r=OA(t,e),typeof r>"u")throw new uu("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!LA(r))throw new uu("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},NA=Cn,Na=K,UA=dA,eg=MA,FA=ir(),HA=FA("Array.prototype.push"),Cv=function(t,e,r){if(!UA(t))throw new Na("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new NA("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 Na("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new Na("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=eg(e,r)}else{if(typeof e<"u")throw new Na("Assertion failed: `V` must be undefined when `method` is present");s=eg(void 0,r,i)}return HA(t["[[DisposableResourceStack]]"],s),"UNUSED"},hu,tg;function Id(){if(tg)return hu;tg=1;var n=kt,t=$d,e=Cn,r=n("%Promise.resolve%",!0),i=r&&t(r);return hu=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},hu}var du,ng;function ZA(){if(ng)return du;ng=1;var n=kt,t=Cn,e=n("%Promise%",!0),r=uc,i=Id(),s=Td;return du=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)},du}var pu,rg;function WA(){if(rg)return pu;rg=1;var n=Ed;return pu=function(e){return new n("throw",e)},pu}var VA=kt,fu=Cn,ig=K,jA=VA("%Promise%",!0),BA=ir(),sg=BA("Promise.prototype.then",!0),GA=Ed,og=ZA(),qA=Ad,YA=Id(),ag=WA(),KA=yv(),Rv=function(t,e){if(!(e instanceof GA))throw new ig("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new ig("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 fu("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&YA(jA,e),a=function(y){if(e.type()==="throw"){var m=e.value(),E=new KA(y,m);e=ag(E)}else e=ag(y)},c=i==="ASYNC-DISPOSE"&&function(m){return sg(o,function(){var E=og(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!E)throw new fu("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return sg(E,qA)},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=og(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(f)throw new fu("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){a(y)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},Pv=function(){var t=[];return{"[[DisposableResourceStack]]":t}},pc=cd,Cd=K,JA=uc,bs=md,XA=ga,Dv=vs,QA=Ad,at=xd,e1=Tv,Lv=Qr.supportsDescriptors,t1=$d,Rd=Cv,n1=Rv,zv=Pv,lg=yd(),bt=function n(){if(!(this instanceof n)||at.has(this,"[[DisposableState]]")||at.has(this,"[[DisposeCapability]]"))throw new Cd("can only be used with new");at.set(this,"[[DisposableState]]","PENDING"),at.set(this,"[[DisposeCapability]]",zv())},Ov=function(){var t=this;return at.assert(t,"[[DisposableState]]"),at.get(t,"[[DisposableState]]")==="DISPOSED"},ya=t1(Ov);Lv?XA(bt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Ov}):bt.prototype.disposed=!1;var Mv=function(t){at.set(t,"[[DisposableState]]","DISPOSED"),Lv||(t.disposed=!0)};bs(bt.prototype,"dispose",function(){var t=this;if(!ya(t))return Mv(t),n1(at.get(t,"[[DisposeCapability]]"),QA())["?"]()});bs(bt.prototype,"use",function(t){var e=this;if(ya(e))throw new pc("a disposed stack can not use anything new");return Rd(at.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});bs(bt.prototype,"adopt",function(t,e){var r=this;if(ya(r))throw new pc("a disposed stack can not use anything new");if(!Dv(e))throw new Cd("`onDispose` must be a function");var i=function(){return JA(e,void 0,[t])};return Rd(at.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});bs(bt.prototype,"defer",function(t){var e=this;if(ya(e))throw new pc("a disposed stack can not defer anything new");if(!Dv(t))throw new Cd("`onDispose` must be a function");Rd(at.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});bs(bt.prototype,"move",function(){var t=this;if(ya(t))throw new pc("a disposed stack can not use anything new");var e=new bt;return at.set(e,"[[DisposeCapability]]",at.get(t,"[[DisposeCapability]]")),at.set(t,"[[DisposeCapability]]",zv()),Mv(t),e});lg&&bs(bt.prototype,lg,bt.prototype.dispose);e1(bt.prototype,"DisposableStack");var r1=bt,i1=r1,s1=function(){return typeof DisposableStack=="function"?DisposableStack:i1},o1=Qr,a1=ad(),l1=s1,c1=function(){var t=l1();return o1(a1,{DisposableStack:t},{DisposableStack:!0}),t},u1=kt,fc=cd,Pd=K,cg=u1("%Promise%",!0),Dd=Cv,h1=uc,ws=md,d1=ga,p1=Rv,Nv=vs,Uv=Pv,f1=Ad,ug=Id(),lt=xd,g1=Tv,Fv=Qr.supportsDescriptors,m1=$d,v1=ir(),y1=v1("Promise.prototype.then",!0),hg=bd(),wt=function n(){if(!(this instanceof n)||lt.has(this,"[[AsyncDisposableState]]")||lt.has(this,"[[DisposeCapability]]"))throw new Pd("can only be used with new");lt.set(this,"[[AsyncDisposableState]]","pending"),lt.set(this,"[[DisposeCapability]]",Uv())},Hv=function(){var t=this;return lt.assert(t,"[[AsyncDisposableState]]"),lt.get(t,"[[AsyncDisposableState]]")==="disposed"},ba=m1(Hv);Fv?d1(wt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Hv}):wt.prototype.disposed=!1;var Zv=function(t){lt.set(t,"[[AsyncDisposableState]]","disposed"),Fv||(t.disposed=!0)};ws(wt.prototype,"disposeAsync",function(){var t=this;return ba(t)?ug(cg):(Zv(t),y1(ug(cg,p1(lt.get(t,"[[DisposeCapability]]"),f1())),function(e){return e["?"]()}))});ws(wt.prototype,"use",function(t){var e=this;if(ba(e))throw new fc("a disposed stack can not use anything new");return Dd(lt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});ws(wt.prototype,"adopt",function(t,e){var r=this;if(ba(r))throw new fc("a disposed stack can not use anything new");if(!Nv(e))throw new Pd("`onDisposeAsync` must be a function");var i=function(){return h1(e,void 0,[t])};return i.value=t,Dd(lt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});ws(wt.prototype,"defer",function(t){var e=this;if(ba(e))throw new fc("a disposed stack can not defer anything new");if(!Nv(t))throw new Pd("`onDispose` must be a function");Dd(lt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});ws(wt.prototype,"move",function(){var t=this;if(ba(t))throw new fc("a disposed stack can not use anything new");var e=new wt;return lt.set(e,"[[DisposeCapability]]",lt.get(t,"[[DisposeCapability]]")),lt.set(t,"[[DisposeCapability]]",Uv()),Zv(t),e});hg&&ws(wt.prototype,hg,wt.prototype.disposeAsync);g1(wt.prototype,"AsyncDisposableStack");var b1=wt,w1=b1,S1=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:w1},_1=Qr,k1=ad(),x1=S1,E1=function(){var t=x1();return _1(k1,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},A1=_x,$1=Cx,T1=c1,I1=E1,C1=function(){A1(),$1(),T1(),I1()};C1();const dg=new WeakMap;function R1(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function di(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function pg(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function P1(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class D1{constructor(){g(this,"entries",new Map);g(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw pg();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw pg();if(e.constructor.name==="AsyncFunction")throw P1();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=dg.get(t);if(e){if(t.length!==e.length)throw new Error(`${di(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(`${di(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=dg.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(`${di(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=>di(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(R1(r))throw new Error(`Factory for ${di(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${di(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 un=new D1,L1=.5,fg=.1,gg=8,z1=4,Wv=3,Vv=3,O1=4,_r=255,jv=.2126,Bv=.7152,Gv=.0722;async function qv(n){const t=M1(n);if(!t)return"light";try{return await F1(n,t)>=L1?"light":"dark"}catch{return"light"}}function M1(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(N1(o))return s}return null}function N1(n){return Yv(n.backgroundImage)?!0:U1(n.backgroundColor)>0}function U1(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===O1?parseFloat(e[Wv]):e.length===Vv?1:0}async function F1(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:Ua((e.left-r.left)/r.width),y:Ua((e.top-r.top)/r.height),width:Ua(e.width/r.width),height:Ua(e.height/r.height)},s=window.getComputedStyle(t),o=Yv(s.backgroundImage);return o?Z1({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):W1(s.backgroundColor)}function Yv(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const mg=new Map;function H1(n){let t=mg.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}),mg.set(n,t),t)}async function Z1(n){const t=await H1(n.url),e=Math.max(gg,Math.ceil(n.surfaceWidth*fg)),r=Math.max(gg,Math.ceil(n.surfaceHeight*fg)),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 y=Math.max(0,Math.floor(n.region.x*e)),m=Math.max(0,Math.floor(n.region.y*r)),E=Math.max(1,Math.min(e-y,Math.floor(n.region.width*e))),x=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),I=s.getImageData(y,m,E,x).data;let P=0,R=0;for(let V=0;V<I.length;V+=z1){const N=I[V]/_r,F=I[V+1]/_r,Y=I[V+2]/_r,B=I[V+Wv]/_r;P+=B*(jv*N+Bv*F+Gv*Y),R+=1}return R>0?P/R:1}function W1(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<Vv)return 1;const r=e[0]/_r,i=e[1]/_r,s=e[2]/_r;return jv*r+Bv*i+Gv*s}function Ua(n){return n<0?0:n>1?1:n}const V1=["ghost","glass"],so=[...V1.map(n=>`[variant="${n}"]`),'[material="glass"]'].join(", "),Fa=new WeakSet,vg=new WeakSet;function Kv(n){if(vg.has(n))return;vg.add(n);for(const e of n.querySelectorAll(so))gu(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)j1(i,gu);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(so)&&gu(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function j1(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(so)&&t(n);for(const e of n.querySelectorAll(so))t(e)}}async function gu(n){var e,r;if(Fa.has(n)||n.hasAttribute("tone")||(e=n.parentElement)!=null&&e.closest("[tone]"))return;Fa.add(n);const t=await qv(n);if(!n.matches(so)){Fa.delete(n);return}if(n.hasAttribute("tone")||(r=n.parentElement)!=null&&r.closest("[tone]")){Fa.delete(n);return}n.setAttribute("tone",t)}const B1="*,*: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)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass-frosted]{background:color-mix(in srgb,var(--black) 70%,transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-50), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-100), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}ui-popover.dropdown-popover::part(panel){min-width:192px;padding:var(--space-4)}.dropdown-list{display:flex;flex-direction:column;gap:2px}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover,dropdown-item[action]:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}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{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)}',Ld=new CSSStyleSheet;Ld.replaceSync(B1);const zd=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,Ld,zd]}catch{}Kv(document);function Jv(n){zd.replaceSync(n)}function Cl(){Jv("")}function Od(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,Ld,zd]}catch{}Kv(n)}const G1=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function q1(n){for(const t of Object.keys(n))if(G1.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function Y1(n,t){q1(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function je(){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}),Y1(this,c)}}return n}class Ot extends globalThis.EventTarget{}function K1(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function wa(n){var e;class t extends n{constructor(...s){super(...s);S(this,e,!1);K1(this,()=>l(this,e),()=>{w(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const J1=je(),X1=je(),Q1=je(),Hs=je(),Xv=je(),e$=je(),mu=je(),qe=4,ft=6,oo=2,Ju=2,Md=8,t$=ft,Nd="auto",Qn="auto",Mn=128,yg=50,ae=16,Br=Mn*qe+ae*(qe-1),ao=Mn*ft+ae*(ft-1),n$=Br+ae*2,r$=200,i$=4,Ha=150,s$=10,bg=2,wg=8,o$=300,a$=4;function Qv(n){return ny(n)}function ey(n,t){return ny(n.flatMap(e=>iy(e,t)))}function ty(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}sy(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function kr(n){const t=Qv(n),e=ty(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(h$)}}function ny(n){const t=[];for(const e of n){const r=ry(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(Tn));continue}t.push(i)}}return t}function ry(n){switch(n.type){case"card":return[Tn(n)];case"row":{const t=n.children.map(Tn);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=ry(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(Xu));continue}if(i.type==="row"){t.push({...i,children:i.children.map(Tn)});continue}t.push(Tn(i))}}return t.length===0?[]:t.length===1?[Xu(t[0])]:[{...n,children:t}]}}}function iy(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[Tn(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(Tn);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>iy(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[Xu(e[0])]:[{...n,children:e}]}}}function sy(n,t,e,r){switch(n.type){case"card":oy(n,t,e,r);return;case"row":l$(n,t,e,r);return;case"stack":c$(n,t,e,r);return}}function oy(n,t,e,r){"id"in n&&e.push(`Card ${Rs(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),u$(n.width)||e.push(`Card ${Rs(n)} width must be an integer in the range ${oo}-${Md}`),ly(n.height)||e.push(`Card ${Rs(n)} height must be an integer in the range 2-6 or "auto"`);const i=Ai(n.width);t==="stack"&&i!==qe&&e.push(`Stack child ${Rs(n)} width must be ${qe}`),t==="row"&&i<oo&&e.push(`Row child ${Rs(n)} must be at least 2 columns wide`)}function Rs(n){return typeof n.artifactID=="string"&&n.artifactID.length>0?n.artifactID:"<missing artifactID>"}function l$(n,t,e,r){if(ay(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),ly(n.height,a$)||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}oy(s,"row",e,r),i+=Ai(s.width)}i!==qe&&e.push(`Row ${n.id} children must sum to 4 columns`)}function c$(n,t,e,r){if(ay(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(sy(a,"stack",e,r),a.height===Qn){s+=1;continue}i+=a.height}if(i>ft&&e.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=ft-i;if(o<s*Ju||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Ju&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function ay(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function u$(n){return n===Nd||Number.isInteger(n)&&n>=oo&&n<=Md}function ly(n,t=t$){return n===Qn||Number.isInteger(n)&&n>=Ju&&n<=t}function Ai(n){return n===Nd?qe:n}function h$(n){if(n.type==="card")return{id:n.artifactID,type:"card",width:Ai(n.width),cards:[{id:n.artifactID,artifactID:n.artifactID,col:1,row:1,width:Ai(n.width),height:cy(n.height,ft)}]};const t=d$(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:qe,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:Ai(c.width),height:o}),a+=Ai(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 d$(n){let t=0,e=0;for(const i of n)i.height===Qn?e+=1:t+=i.height;const r=e>0?(ft-t)/e:0;return n.map(i=>cy(i.height,r))}function cy(n,t){return n===Qn?t:n}function Tn(n){return{...n}}function Xu(n){return n.type==="card"?Tn(n):{...n,children:n.children.map(Tn)}}function uy(n,t={}){return{type:"card",artifactID:n,width:t.width??Nd,height:t.height??Qn}}function sl(n){return n.layout.flatMap(hy)}function hy(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(hy)}}const oe=je(),Qu=je(),pi=je(),Sg=je();function p$(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const Ud=p$("RequestError"),f$=200,g$=300,Za=401;class m${constructor(t,e){g(this,"serverURL");g(this,"token");g(this,"onUnauthorized");this.serverURL=t.replace(/\/$/,""),this.token=e.token,this.onUnauthorized=e.onUnauthorized}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 v$(i);if(!i.ok||i.status<f$||i.status>=g$)throw i.status===Za&&((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===Za&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await vu(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===Za&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await vu(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===Za&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await vu(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new Ud(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}`),Object.keys(e).length>0?e:void 0}}async function v$(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function vu(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 y$(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var jt,jl,dy;class b${constructor(t){S(this,jl);S(this,jt);w(this,jt,t)}list(){return l(this,jt).requestJSON("GET","/screens")}async get(t={}){const e=await p(this,jl,dy).call(this,t.screenID);return l(this,jt).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,jt).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,jt).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,jt).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}jt=new WeakMap,jl=new WeakSet,dy=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,jt).createError(`screenID is required when multiple screens exist. Available screens: ${y$(e)}`)};var wn;class w${constructor(t){S(this,wn);w(this,wn,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,wn).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,wn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,wn).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,wn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return l(this,wn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}wn=new WeakMap;var Li;class S${constructor(t){S(this,Li);w(this,Li,t)}get(t){return l(this,Li).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return l(this,Li).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}Li=new WeakMap;var Ar;class _${constructor(t){S(this,Ar);w(this,Ar,t)}get(){return l(this,Ar).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,Ar).requestVoid("PATCH","/display",e)}focus(t){return l(this,Ar).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}Ar=new WeakMap;var Sn;class k${constructor(t,e={}){g(this,"screens");g(this,"artifacts");g(this,"display");g(this,"markdown");S(this,Sn);w(this,Sn,new m$(t,e)),this.screens=new b$(l(this,Sn)),this.artifacts=new w$(l(this,Sn)),this.display=new _$(l(this,Sn)),this.markdown=new S$(l(this,Sn))}health(){return l(this,Sn).requestJSON("GET","/health")}}Sn=new WeakMap;const x$={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},E$="Local",A$="store-";function he(n){return new URL(n).origin}function $$(n){return{servers:[{url:he(n),name:E$}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{},authTokens:{}}}function T$(n,t){return[...n.tabs[he(t)]??[]]}function I$(n,t,e){const r=he(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function C$(n,t,e){const r=he(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 R$(n,t,e=Date.now()){const r=n.screens[t]??{scrollPosition:0};return{...n,screens:{...n.screens,[t]:{...r,lastActivatedAt:e}}}}var $r,Tr,Ir;class P$ extends Ot{constructor(e,r,i={}){super();S(this,$r);S(this,Tr);S(this,Ir);w(this,$r,`${A$}${e}`),w(this,Tr,i.storage??z$());const s=l(this,Tr).getItem(l(this,$r));s===null?(w(this,Ir,r),l(this,Tr).setItem(l(this,$r),JSON.stringify(r))):w(this,Ir,O$(JSON.parse(s),r))}get(){return l(this,Ir)}set(e){w(this,Ir,e),l(this,Tr).setItem(l(this,$r),JSON.stringify(e)),this.dispatchEvent(new oe("change"))}}$r=new WeakMap,Tr=new WeakMap,Ir=new WeakMap;function yu(n,t){return n.authTokens[he(t)]??null}function D$(n,t,e){return{...n,authTokens:{...n.authTokens,[he(t)]:e}}}function L$(n,t){const e=he(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{...n,authTokens:r}}function z$(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function O$(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}}class M$ extends Event{constructor(){super("theme-changed")}}const N$=wa(Ot);var Cr,Ne,Un,Ge,Fn,_n,fo,ee,mr,py,go,fy,gy,my,vy,eh,th,nh,yy;class U$ extends N${constructor(e){var i;super();S(this,ee);g(this,"id");g(this,"server");S(this,Cr);S(this,Ne,new Map);S(this,Un);S(this,Ge);S(this,Fn);S(this,_n,null);S(this,fo,0);S(this,go,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&p(this,ee,fy).call(this,r.screen);break;case"artifact-created":r.screenID===this.id&&p(this,ee,gy).call(this,r.artifact);break;case"artifact-updated":p(this,ee,my).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&p(this,ee,vy).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Ne).has(r.artifactID)&&this.dispatchEvent(new Sg("artifact-content-changed",{artifactID:r.artifactID}));break;case"theme-changed":this.dispatchEvent(new M$);break}});this.id=e.screen.id,this.server=e.server,w(this,Cr,e.localStore),w(this,Un,e.screen.name),w(this,Ge,structuredClone(e.screen.layout));const r=((i=l(this,Cr).get().screens[this.id])==null?void 0:i.scrollPosition)??0;w(this,Fn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,go)),p(this,ee,py).call(this)}get name(){return l(this,Un)}get layout(){return l(this,Ge)}get scrollPosition(){return l(this,Fn)}get artifacts(){return l(this,Ne)}setScrollPosition(e){p(this,ee,mr).call(this);const r=Math.max(0,e);r!==l(this,Fn)&&(w(this,Fn,r),p(this,ee,yy).call(this),this.dispatchEvent(new oe("change")))}setLayout(e){p(this,ee,mr).call(this);const r=Qv(e);if(!ty(r).valid)return;const s=p(this,ee,th).call(this);w(this,Ge,r),w(this,_n,{layout:r,snapshot:s}),this.dispatchEvent(new oe("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,_n))==null?void 0:o.layout)===r&&(w(this,_n,null),p(this,ee,nh).call(this,s),this.dispatchEvent(new oe("change")))})}rename(e){p(this,ee,mr).call(this),w(this,Un,e),this.dispatchEvent(new oe("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){p(this,ee,mr).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(p(this,ee,mr).call(this),!l(this,Ne).has(e))return;const r=p(this,ee,th).call(this);p(this,ee,eh).call(this,e),this.dispatchEvent(new oe("change")),this.server.client.artifacts.delete({artifactID:e}).catch(()=>{this.disposed||(p(this,ee,nh).call(this,r),this.dispatchEvent(new oe("change")))})}async refreshFromServer(){p(this,ee,mr).call(this);const e=++Zc(this,fo)._;let r;try{r=await this.server.client.screens.get({screenID:this.id})}catch{return}if(this.disposed||e!==l(this,fo))return;const i=new Set([...l(this,Ne).values()].filter(s=>s.kind==="path").map(s=>s.id));w(this,_n,null),w(this,Un,r.screen.name),w(this,Ge,structuredClone(r.screen.layout)),l(this,Ne).clear();for(const s of r.artifacts)l(this,Ne).set(s.id,s);this.dispatchEvent(new oe("change"));for(const s of r.artifacts)s.kind==="path"&&i.has(s.id)&&this.dispatchEvent(new Sg("artifact-content-changed",{artifactID:s.id}))}dispose(){this.server.removeEventListener("server-event",l(this,go))}}Cr=new WeakMap,Ne=new WeakMap,Un=new WeakMap,Ge=new WeakMap,Fn=new WeakMap,_n=new WeakMap,fo=new WeakMap,ee=new WeakSet,mr=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},py=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,Ne).set(r.id,r);this.dispatchEvent(new oe("change"))}catch{}},go=new WeakMap,fy=function(e){l(this,_n)&&w(this,_n,null),w(this,Un,e.name),w(this,Ge,structuredClone(e.layout)),this.dispatchEvent(new oe("change"))},gy=function(e){sl({layout:l(this,Ge)}).includes(e.id)||w(this,Ge,[...l(this,Ge),uy(e.id)]),l(this,Ne).set(e.id,e),this.dispatchEvent(new oe("change"))},my=function(e){const r=l(this,Ne).get(e.id);r&&(l(this,Ne).set(e.id,{...r,...e}),this.dispatchEvent(new oe("change")))},vy=function(e){p(this,ee,eh).call(this,e)&&this.dispatchEvent(new oe("change"))},eh=function(e){const r=l(this,Ne).delete(e),i=sl({layout:l(this,Ge)}).length,s=ey(l(this,Ge),e),o=sl({layout:s}).length;return w(this,Ge,s),r||i!==o},th=function(){return{layout:structuredClone(l(this,Ge)),artifacts:new Map([...l(this,Ne).entries()].map(([e,r])=>[e,structuredClone(r)]))}},nh=function(e){w(this,Ge,structuredClone(e.layout)),l(this,Ne).clear();for(const[r,i]of e.artifacts)l(this,Ne).set(r,structuredClone(i))},yy=function(){const e=l(this,Cr).get();l(this,Cr).set({...e,screens:{...e.screens,[this.id]:{...e.screens[this.id],scrollPosition:l(this,Fn)}}})};const F$=wa(Ot);var Pe,Ue,At,mo,vo,yo,bo,Xe,ol,rh,vi;class H$ extends F${constructor(e){super();S(this,Xe);S(this,Pe);S(this,Ue);S(this,At,null);S(this,mo,()=>{this.disposed||p(this,Xe,ol).call(this)});S(this,vo,()=>{this.disposed||p(this,Xe,ol).call(this)});S(this,yo,e=>{if(this.disposed)return;const r=e.event;if(r.type==="screen-removed"){this.removeTab(e.serverURL,r.screenID);const i=l(this,Pe).get();i.activeServerURL===he(e.serverURL)&&i.activeScreenID===r.screenID&&p(this,Xe,vi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){p(this,Xe,vi).call(this,e.serverURL,null);return}const i=l(this,Ue).servers.get(he(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),p(this,Xe,vi).call(this,e.serverURL,r.screenID)}});S(this,bo,e=>{if(this.disposed)return;const r=l(this,At);r&&he(e.serverURL)===he(r.server.url)&&r.refreshFromServer()});w(this,Pe,e.localStore),w(this,Ue,e.serverManager),l(this,Pe).addEventListener("change",l(this,mo)),l(this,Ue).addEventListener("change",l(this,vo)),l(this,Ue).addEventListener("server-event",l(this,yo)),l(this,Ue).addEventListener("server-reconnected",l(this,bo)),p(this,Xe,ol).call(this)}get activeScreen(){return l(this,At)}get screens(){const e=l(this,Pe).get().screens,r=[];let i=0;for(const s of l(this,Ue).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=he(e),i=T$(l(this,Pe).get(),r),s=l(this,Ue).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=he(e),s=l(this,Ue).servers.get(i);s&&!s.screens.has(r)||p(this,Xe,rh).call(this,I$(l(this,Pe).get(),i,r))}removeTab(e,r){p(this,Xe,rh).call(this,C$(l(this,Pe).get(),e,r))}setActive(e,r){const i=he(e),s=l(this,Ue).servers.get(i);!s||!s.screens.has(r)||p(this,Xe,vi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Pe).get().activeServerURL;if(!e||!p(this,Xe,vi).call(this,e,null))return;const r=l(this,Ue).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Pe).removeEventListener("change",l(this,mo)),l(this,Ue).removeEventListener("change",l(this,vo)),l(this,Ue).removeEventListener("server-event",l(this,yo)),l(this,Ue).removeEventListener("server-reconnected",l(this,bo)),(e=l(this,At))==null||e.dispose(),w(this,At,null)}}Pe=new WeakMap,Ue=new WeakMap,At=new WeakMap,mo=new WeakMap,vo=new WeakMap,yo=new WeakMap,bo=new WeakMap,Xe=new WeakSet,ol=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Pe).get(),i=e?l(this,Ue).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,At))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,At))==null?void 0:u.server)===i||((h=l(this,At))==null||h.dispose(),w(this,At,i&&s?new U$({screen:s,server:i,localStore:l(this,Pe)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new J1("active-screen-changed")))},rh=function(e){e!==l(this,Pe).get()&&(l(this,Pe).set(e),this.dispatchEvent(new X1("tabs-changed")))},vi=function(e,r){const i=he(e),s=l(this,Pe).get();if(s.activeServerURL===i&&s.activeScreenID===r)return!1;const o=r===null?{...s,activeServerURL:i,activeScreenID:r}:R$({...s,activeServerURL:i,activeScreenID:r},r);return l(this,Pe).set(o),!0};const by="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Rl=32,Z$=16,wy=10,_g=0xffffffffffff;var xr;(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"})(xr||(xr={}));class Zs extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function W$(n){const t=Math.floor(n()*Rl)%Rl;return by.charAt(t)}function V$(n){const t=j$(),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 Zs(xr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function j$(){return q$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function B$(n,t){let e="";for(;n>0;n--)e=W$(t)+e;return e}function G$(n,t=wy){if(isNaN(n))throw new Zs(xr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>_g)throw new Zs(xr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${_g}: ${n}`);if(n<0)throw new Zs(xr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Zs(xr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%Rl,r=by.charAt(e)+r,n=(n-e)/Rl;return r}function q$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Fd(n,t){const e=V$(),r=Date.now();return G$(r,wy)+B$(Z$,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 y=h[f];y in a||(a[y]=u[y].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 Ri extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Sy extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const _y={};function er(n){return _y}function ky(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 ih(n,t){return typeof t=="bigint"?t.toString():t}function gc(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hd(n){return n==null}function Zd(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function Y$(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 kg=Symbol("evaluating");function te(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==kg)return r===void 0&&(r=kg,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function ti(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function or(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function xg(n){return JSON.stringify(n)}function K$(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const xy="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function lo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const J$=gc(()=>{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 cs(n){if(lo(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(lo(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function Ey(n){return cs(n)?{...n}:Array.isArray(n)?[...n]:n}const X$=new Set(["string","number","symbol"]);function us(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ar(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 O(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 Q$(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const eT={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 tT(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=or(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 ti(this,"shape",o),o},checks:[]});return ar(n,s)}function nT(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=or(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 ti(this,"shape",o),o},checks:[]});return ar(n,s)}function rT(n,t){if(!cs(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=or(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return ti(this,"shape",s),s}});return ar(n,i)}function iT(n,t){if(!cs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=or(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return ti(this,"shape",r),r}});return ar(n,e)}function sT(n,t){const e=or(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return ti(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ar(n,e)}function oT(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=or(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 ti(this,"shape",c),c},checks:[]});return ar(t,o)}function aT(n,t,e){const r=or(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 ti(this,"shape",s),s}});return ar(t,r)}function $i(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 Ti(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Wa(n){return typeof n=="string"?n:n==null?void 0:n.message}function tr(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Wa((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Wa((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??Wa((c=e.customError)==null?void 0:c.call(e,n))??Wa((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 Wd(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function co(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const Ay=(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,ih,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},$y=A("$ZodError",Ay),Ty=A("$ZodError",Ay,{Parent:Error});function lT(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 cT(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 Vd=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 Ri;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>tr(c,s,er())));throw xy(a,i==null?void 0:i.callee),a}return o.value},jd=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=>tr(c,s,er())));throw xy(a,i==null?void 0:i.callee),a}return o.value},mc=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 Ri;return s.issues.length?{success:!1,error:new(n??$y)(s.issues.map(o=>tr(o,i,er())))}:{success:!0,data:s.value}},uT=mc(Ty),vc=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=>tr(o,i,er())))}:{success:!0,data:s.value}},hT=vc(Ty),dT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vd(n)(t,e,i)},pT=n=>(t,e,r)=>Vd(n)(t,e,r),fT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jd(n)(t,e,i)},gT=n=>async(t,e,r)=>jd(n)(t,e,r),mT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return mc(n)(t,e,i)},vT=n=>(t,e,r)=>mc(n)(t,e,r),yT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vc(n)(t,e,i)},bT=n=>async(t,e,r)=>vc(n)(t,e,r),wT=/^[cC][^\s-]{8,}$/,ST=/^[0-9a-z]+$/,_T=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kT=/^[0-9a-vA-V]{20}$/,xT=/^[A-Za-z0-9]{27}$/,ET=/^[a-zA-Z0-9_-]{21}$/,AT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$T=/^([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})$/,Eg=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)$/,TT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,IT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function CT(){return new RegExp(IT,"u")}const RT=/^(?:(?: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])$/,PT=/^(([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}|:))$/,DT=/^((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])$/,LT=/^(([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])$/,zT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Iy=/^[A-Za-z0-9_-]*$/,OT=/^\+[1-9]\d{6,14}$/,Cy="(?:(?:\\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])))",MT=new RegExp(`^${Cy}$`);function Ry(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 NT(n){return new RegExp(`^${Ry(n)}$`)}function UT(n){const t=Ry({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(`^${Cy}T(?:${r})$`)}const FT=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}$`)},HT=/^-?\d+$/,Py=/^-?\d+(?:\.\d+)?$/,ZT=/^(?:true|false)$/i,WT=/^[^A-Z]*$/,VT=/^[^a-z]*$/,ct=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),Dy={number:"number",bigint:"bigint",object:"date"},Ly=A("$ZodCheckLessThan",(n,t)=>{ct.init(n,t);const e=Dy[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})}}),zy=A("$ZodCheckGreaterThan",(n,t)=>{ct.init(n,t);const e=Dy[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})}}),jT=A("$ZodCheckMultipleOf",(n,t)=>{ct.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):Y$(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})}}),BT=A("$ZodCheckNumberFormat",(n,t)=>{var o;ct.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]=eT[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=HT)}),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})}}),GT=A("$ZodCheckMaxLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Hd(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=Wd(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),qT=A("$ZodCheckMinLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Hd(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=Wd(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),YT=A("$ZodCheckLengthEquals",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Hd(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=Wd(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})}}),yc=A("$ZodCheckStringFormat",(n,t)=>{var e,r;ct.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=()=>{})}),KT=A("$ZodCheckRegex",(n,t)=>{yc.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})}}),JT=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=WT),yc.init(n,t)}),XT=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=VT),yc.init(n,t)}),QT=A("$ZodCheckIncludes",(n,t)=>{ct.init(n,t);const e=us(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})}}),eI=A("$ZodCheckStartsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`^${us(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})}}),tI=A("$ZodCheckEndsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`.*${us(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})}}),nI=A("$ZodCheckOverwrite",(n,t)=>{ct.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class rI{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 nI={major:4,minor:3,patch:6},ve=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=nI;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=$i(a),f;for(const y of c){if(y._zod.def.when){if(!y._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,E=y._zod.check(a);if(E instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ri;if(f||E instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await E,a.issues.length!==m&&(h||(h=$i(a,m)))});else{if(a.issues.length===m)continue;h||(h=$i(a,m))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if($i(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new Ri;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 Ri;return u.then(h=>s(h,r,c))}return s(u,r,c)}}te(n,"~standard",()=>({validate:s=>{var o;try{const a=lT(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return cT(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}))}),jd=A("$ZodString",(n,t)=>{var e;ve.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??NT(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}}),ge=A("$ZodStringFormat",(n,t)=>{yc.init(n,t),jd.init(n,t)}),rI=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=ET),ge.init(n,t)}),iI=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=kg(r))}else t.pattern??(t.pattern=kg());ge.init(n,t)}),sI=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=AT),ge.init(n,t)}),oI=A("$ZodURL",(n,t)=>{ge.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})}}}),aI=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=TT()),ge.init(n,t)}),lI=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=kT),ge.init(n,t)}),cI=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=yT),ge.init(n,t)}),uI=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=bT),ge.init(n,t)}),hI=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=wT),ge.init(n,t)}),dI=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=ST),ge.init(n,t)}),pI=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=_T),ge.init(n,t)}),fI=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=MT(t)),ge.init(n,t)}),gI=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=zT),ge.init(n,t)}),mI=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=OT(t)),ge.init(n,t)}),vI=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=xT),ge.init(n,t)}),yI=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=IT),ge.init(n,t),n._zod.bag.format="ipv4"}),bI=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=CT),ge.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})}}}),wI=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=RT),ge.init(n,t)}),SI=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=PT),ge.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 Ly(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const _I=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=DT),ge.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{Ly(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function kI(n){if(!$y.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ly(e)}const xI=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=$y),ge.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{kI(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),EI=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=LT),ge.init(n,t)});function AI(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 $I=A("$ZodJWT",(n,t)=>{ge.init(n,t),n._zod.check=e=>{AI(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),zy=A("$ZodNumber",(n,t)=>{ve.init(n,t),n._zod.pattern=n._zod.bag.pattern??Cy,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}}),TI=A("$ZodNumberFormat",(n,t)=>{VT.init(n,t),zy.init(n,t)}),II=A("$ZodBoolean",(n,t)=>{ve.init(n,t),n._zod.pattern=FT,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}}),CI=A("$ZodUnknown",(n,t)=>{ve.init(n,t),n._zod.parse=e=>e}),RI=A("$ZodNever",(n,t)=>{ve.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function xg(n,t,e){n.issues.length&&t.issues.push(...Ti(e,n.issues)),t.value[e]=n.value}const PI=A("$ZodArray",(n,t)=>{ve.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=>xg(u,e,o))):xg(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function Pl(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...Ti(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function Oy(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=J$(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function My(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 y=c.run({value:t[f],issues:[]},r);y instanceof Promise?n.push(y.then(m=>Pl(m,e,f,t,h))):Pl(y,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 DI=A("$ZodObject",(n,t)=>{ve.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=gc(()=>Oy(t));te(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=lo,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 y of o.keys){const m=f[y],E=m._zod.optout==="optional",x=m._zod.run({value:u[y],issues:[]},c);x instanceof Promise?h.push(x.then(I=>Pl(I,a,y,u,E))):Pl(x,a,y,u,E)}return s?My(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),LI=A("$ZodObjectJIT",(n,t)=>{DI.init(n,t);const e=n._zod.parse,r=gc(()=>Oy(t)),i=y=>{var V;const m=new tI(["shape","payload","ctx"]),E=r.value,x=N=>{const F=_g(N);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};m.write("const input = payload.value;");const I=Object.create(null);let P=0;for(const N of E.keys)I[N]=`key_${P++}`;m.write("const newResult = {};");for(const N of E.keys){const F=I[N],Y=_g(N),B=y[N],ce=((V=B==null?void 0:B._zod)==null?void 0:V.optout)==="optional";m.write(`const ${F} = ${x(N)};`),ce?m.write(`
6
+ `))}}const iI={major:4,minor:3,patch:6},ve=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=iI;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=$i(a),f;for(const y of c){if(y._zod.def.when){if(!y._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,E=y._zod.check(a);if(E instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ri;if(f||E instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await E,a.issues.length!==m&&(h||(h=$i(a,m)))});else{if(a.issues.length===m)continue;h||(h=$i(a,m))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if($i(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new Ri;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 Ri;return u.then(h=>s(h,r,c))}return s(u,r,c)}}te(n,"~standard",()=>({validate:s=>{var o;try{const a=uT(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return hT(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}))}),Bd=A("$ZodString",(n,t)=>{var e;ve.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??FT(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}}),ge=A("$ZodStringFormat",(n,t)=>{yc.init(n,t),Bd.init(n,t)}),sI=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=$T),ge.init(n,t)}),oI=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=Eg(r))}else t.pattern??(t.pattern=Eg());ge.init(n,t)}),aI=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=TT),ge.init(n,t)}),lI=A("$ZodURL",(n,t)=>{ge.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})}}}),cI=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=CT()),ge.init(n,t)}),uI=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=ET),ge.init(n,t)}),hI=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=wT),ge.init(n,t)}),dI=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=ST),ge.init(n,t)}),pI=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=_T),ge.init(n,t)}),fI=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=kT),ge.init(n,t)}),gI=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=xT),ge.init(n,t)}),mI=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=UT(t)),ge.init(n,t)}),vI=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=MT),ge.init(n,t)}),yI=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=NT(t)),ge.init(n,t)}),bI=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=AT),ge.init(n,t)}),wI=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=RT),ge.init(n,t),n._zod.bag.format="ipv4"}),SI=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=PT),ge.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})}}}),_I=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=DT),ge.init(n,t)}),kI=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=LT),ge.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 Oy(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const xI=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=zT),ge.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{Oy(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function EI(n){if(!Iy.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return Oy(e)}const AI=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=Iy),ge.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{EI(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),$I=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=OT),ge.init(n,t)});function TI(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 II=A("$ZodJWT",(n,t)=>{ge.init(n,t),n._zod.check=e=>{TI(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),My=A("$ZodNumber",(n,t)=>{ve.init(n,t),n._zod.pattern=n._zod.bag.pattern??Py,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}}),CI=A("$ZodNumberFormat",(n,t)=>{BT.init(n,t),My.init(n,t)}),RI=A("$ZodBoolean",(n,t)=>{ve.init(n,t),n._zod.pattern=ZT,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}}),PI=A("$ZodUnknown",(n,t)=>{ve.init(n,t),n._zod.parse=e=>e}),DI=A("$ZodNever",(n,t)=>{ve.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function Ag(n,t,e){n.issues.length&&t.issues.push(...Ti(e,n.issues)),t.value[e]=n.value}const LI=A("$ZodArray",(n,t)=>{ve.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=>Ag(u,e,o))):Ag(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function Pl(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...Ti(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function Ny(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=Q$(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function Uy(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 y=c.run({value:t[f],issues:[]},r);y instanceof Promise?n.push(y.then(m=>Pl(m,e,f,t,h))):Pl(y,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 zI=A("$ZodObject",(n,t)=>{ve.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=gc(()=>Ny(t));te(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=lo,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 y of o.keys){const m=f[y],E=m._zod.optout==="optional",x=m._zod.run({value:u[y],issues:[]},c);x instanceof Promise?h.push(x.then(I=>Pl(I,a,y,u,E))):Pl(x,a,y,u,E)}return s?Uy(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),OI=A("$ZodObjectJIT",(n,t)=>{zI.init(n,t);const e=n._zod.parse,r=gc(()=>Ny(t)),i=y=>{var V;const m=new rI(["shape","payload","ctx"]),E=r.value,x=N=>{const F=xg(N);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};m.write("const input = payload.value;");const I=Object.create(null);let P=0;for(const N of E.keys)I[N]=`key_${P++}`;m.write("const newResult = {};");for(const N of E.keys){const F=I[N],Y=xg(N),B=y[N],ce=((V=B==null?void 0:B._zod)==null?void 0:V.optout)==="optional";m.write(`const ${F} = ${x(N)};`),ce?m.write(`
7
7
  if (${F}.issues.length) {
8
8
  if (${Y} in input) {
9
9
  payload.issues = payload.issues.concat(${F}.issues.map(iss => ({
@@ -37,47 +37,47 @@ var K0=Object.defineProperty;var Op=n=>{throw TypeError(n)};var J0=(n,t,e)=>t in
37
37
  newResult[${Y}] = ${F}.value;
38
38
  }
39
39
 
40
- `)}m.write("payload.value = newResult;"),m.write("return payload;");const R=m.compile();return(N,F)=>R(y,N,F)};let s;const o=lo,a=!wy.jitless,u=a&&Y$.value,h=t.catchall;let f;n._zod.parse=(y,m)=>{f??(f=r.value);const E=y.value;return o(E)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(t.shape)),y=s(y,m),h?My([],E,y,m,f,n):y):e(y,m):(y.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),y)}});function Eg(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=>!$i(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=>tr(o,r,er())))}),t)}const Ny=A("$ZodUnion",(n,t)=>{ve.init(n,t),te(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),te(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),te(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),te(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=>Hd(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=>Eg(c,i,n,s)):Eg(a,i,n,s)}}),zI=A("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,Ny.init(n,t);const e=n._zod.parse;te(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=gc(()=>{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(!lo(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)}}),OI=A("$ZodIntersection",(n,t)=>{ve.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])=>Ag(e,c,u)):Ag(e,s,o)}});function ih(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(cs(n)&&cs(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=ih(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=ih(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 Ag(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}),$i(n))return n;const o=ih(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 MI=A("$ZodRecord",(n,t)=>{ve.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!cs(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(...Ti(u,f.issues)),e.value[u]=f.value})):(h.issues.length&&e.issues.push(...Ti(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"&&Cy.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=>tr(f,r,er())),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(...Ti(a,f.issues)),e.value[c.value]=f.value})):(h.issues.length&&e.issues.push(...Ti(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),NI=A("$ZodEnum",(n,t)=>{ve.init(n,t);const e=Sy(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>K$.has(typeof i)).map(i=>typeof i=="string"?us(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}}),UI=A("$ZodLiteral",(n,t)=>{if(ve.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"?us(r):r?us(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}}),FI=A("$ZodTransform",(n,t)=>{ve.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new by(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 Ri;return e.value=i,e}});function $g(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const Uy=A("$ZodOptional",(n,t)=>{ve.init(n,t),n._zod.optin="optional",n._zod.optout="optional",te(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),te(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Hd(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=>$g(s,e.value)):$g(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),HI=A("$ZodExactOptional",(n,t)=>{Uy.init(n,t),te(n._zod,"values",()=>t.innerType._zod.values),te(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),ZI=A("$ZodNullable",(n,t)=>{ve.init(n,t),te(n._zod,"optin",()=>t.innerType._zod.optin),te(n._zod,"optout",()=>t.innerType._zod.optout),te(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Hd(e.source)}|null)$`):void 0}),te(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)}),WI=A("$ZodDefault",(n,t)=>{ve.init(n,t),n._zod.optin="optional",te(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=>Tg(s,t)):Tg(i,t)}});function Tg(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const VI=A("$ZodPrefault",(n,t)=>{ve.init(n,t),n._zod.optin="optional",te(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))}),jI=A("$ZodNonOptional",(n,t)=>{ve.init(n,t),te(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=>Ig(s,n)):Ig(i,n)}});function Ig(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 BI=A("$ZodCatch",(n,t)=>{ve.init(n,t),te(n._zod,"optin",()=>t.innerType._zod.optin),te(n._zod,"optout",()=>t.innerType._zod.optout),te(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=>tr(o,r,er()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>tr(s,r,er()))},input:e.value}),e.issues=[]),e)}}),GI=A("$ZodPipe",(n,t)=>{ve.init(n,t),te(n._zod,"values",()=>t.in._zod.values),te(n._zod,"optin",()=>t.in._zod.optin),te(n._zod,"optout",()=>t.out._zod.optout),te(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=>Va(o,t.in,r)):Va(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Va(s,t.out,r)):Va(i,t.out,r)}});function Va(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const qI=A("$ZodReadonly",(n,t)=>{ve.init(n,t),te(n._zod,"propValues",()=>t.innerType._zod.propValues),te(n._zod,"values",()=>t.innerType._zod.values),te(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),te(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(Cg):Cg(i)}});function Cg(n){return n.value=Object.freeze(n.value),n}const YI=A("$ZodCustom",(n,t)=>{ct.init(n,t),ve.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=>Rg(s,e,r,n));Rg(i,e,r,n)}});function Rg(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(co(i))}}var Pg;class KI{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 JI(){return new KI}(Pg=globalThis).__zod_globalRegistry??(Pg.__zod_globalRegistry=JI());const Ws=globalThis.__zod_globalRegistry;function XI(n,t){return new n({type:"string",...O(t)})}function QI(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Dg(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function eC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function tC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function nC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function rC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function iC(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function sC(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function oC(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function aC(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function lC(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function cC(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function uC(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function hC(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function dC(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function pC(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function fC(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function gC(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function mC(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function vC(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function yC(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function bC(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function wC(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function SC(n,t){return new n({type:"string",format:"date",check:"string_format",...O(t)})}function _C(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function kC(n,t){return new n({type:"string",format:"duration",check:"string_format",...O(t)})}function xC(n,t){return new n({type:"number",checks:[],...O(t)})}function EC(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function AC(n,t){return new n({type:"boolean",...O(t)})}function $C(n){return new n({type:"unknown"})}function TC(n,t){return new n({type:"never",...O(t)})}function Lg(n,t){return new Py({check:"less_than",...O(t),value:n,inclusive:!1})}function yu(n,t){return new Py({check:"less_than",...O(t),value:n,inclusive:!0})}function zg(n,t){return new Dy({check:"greater_than",...O(t),value:n,inclusive:!1})}function bu(n,t){return new Dy({check:"greater_than",...O(t),value:n,inclusive:!0})}function Og(n,t){return new WT({check:"multiple_of",...O(t),value:n})}function Fy(n,t){return new jT({check:"max_length",...O(t),maximum:n})}function Dl(n,t){return new BT({check:"min_length",...O(t),minimum:n})}function Hy(n,t){return new GT({check:"length_equals",...O(t),length:n})}function IC(n,t){return new qT({check:"string_format",format:"regex",...O(t),pattern:n})}function CC(n){return new YT({check:"string_format",format:"lowercase",...O(n)})}function RC(n){return new KT({check:"string_format",format:"uppercase",...O(n)})}function PC(n,t){return new JT({check:"string_format",format:"includes",...O(t),includes:n})}function DC(n,t){return new XT({check:"string_format",format:"starts_with",...O(t),prefix:n})}function LC(n,t){return new QT({check:"string_format",format:"ends_with",...O(t),suffix:n})}function Ss(n){return new eI({check:"overwrite",tx:n})}function zC(n){return Ss(t=>t.normalize(n))}function OC(){return Ss(n=>n.trim())}function MC(){return Ss(n=>n.toLowerCase())}function NC(){return Ss(n=>n.toUpperCase())}function UC(){return Ss(n=>q$(n))}function FC(n,t,e){return new n({type:"array",element:t,...O(e)})}function HC(n,t,e){return new n({type:"custom",check:"custom",fn:t,...O(e)})}function ZC(n){const t=WC(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(co(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(co(i))}},n(e.value,e)));return t}function WC(n,t){const e=new ct({check:"custom",...O(t)});return e._zod.check=n,e}function Zy(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)??Ws,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 Ee(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 y={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,o.schema,y);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,y)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),Ee(m,t,y),t.seen.get(m).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),t.io==="input"&&Ke(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 Wy(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 y=r.get(f);if(y&&y!==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 I=(x=n.external.registry.get(h[0]))==null?void 0:x.id,P=n.external.uri??(V=>V);if(I)return{ref:P(I)};const R=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=R,{defId:R,ref:`${P("__shared")}#/${f}/${R}`}}if(h[1]===e)return{ref:"#"};const m=`#/${f}/`,E=h[1].schema.id??`__schema${n.counter++}`;return{defId:E,ref:m+E}},s=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:y,defId:m}=i(h);f.def={...f.schema},m&&(f.defId=m);const E=f.schema;for(const x in E)delete E[x];E.$ref=y};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
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");const R=m.compile();return(N,F)=>R(y,N,F)};let s;const o=lo,a=!_y.jitless,u=a&&J$.value,h=t.catchall;let f;n._zod.parse=(y,m)=>{f??(f=r.value);const E=y.value;return o(E)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(t.shape)),y=s(y,m),h?Uy([],E,y,m,f,n):y):e(y,m):(y.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),y)}});function $g(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=>!$i(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=>tr(o,r,er())))}),t)}const Fy=A("$ZodUnion",(n,t)=>{ve.init(n,t),te(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),te(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),te(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),te(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=>Zd(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=>$g(c,i,n,s)):$g(a,i,n,s)}}),MI=A("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,Fy.init(n,t);const e=n._zod.parse;te(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=gc(()=>{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(!lo(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)}}),NI=A("$ZodIntersection",(n,t)=>{ve.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])=>Tg(e,c,u)):Tg(e,s,o)}});function sh(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(cs(n)&&cs(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=sh(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=sh(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 Tg(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}),$i(n))return n;const o=sh(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 UI=A("$ZodRecord",(n,t)=>{ve.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!cs(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(...Ti(u,f.issues)),e.value[u]=f.value})):(h.issues.length&&e.issues.push(...Ti(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"&&Py.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=>tr(f,r,er())),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(...Ti(a,f.issues)),e.value[c.value]=f.value})):(h.issues.length&&e.issues.push(...Ti(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),FI=A("$ZodEnum",(n,t)=>{ve.init(n,t);const e=ky(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>X$.has(typeof i)).map(i=>typeof i=="string"?us(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}}),HI=A("$ZodLiteral",(n,t)=>{if(ve.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"?us(r):r?us(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}}),ZI=A("$ZodTransform",(n,t)=>{ve.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new Sy(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 Ri;return e.value=i,e}});function Ig(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const Hy=A("$ZodOptional",(n,t)=>{ve.init(n,t),n._zod.optin="optional",n._zod.optout="optional",te(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),te(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Zd(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=>Ig(s,e.value)):Ig(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),WI=A("$ZodExactOptional",(n,t)=>{Hy.init(n,t),te(n._zod,"values",()=>t.innerType._zod.values),te(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),VI=A("$ZodNullable",(n,t)=>{ve.init(n,t),te(n._zod,"optin",()=>t.innerType._zod.optin),te(n._zod,"optout",()=>t.innerType._zod.optout),te(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Zd(e.source)}|null)$`):void 0}),te(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)}),jI=A("$ZodDefault",(n,t)=>{ve.init(n,t),n._zod.optin="optional",te(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=>Cg(s,t)):Cg(i,t)}});function Cg(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const BI=A("$ZodPrefault",(n,t)=>{ve.init(n,t),n._zod.optin="optional",te(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))}),GI=A("$ZodNonOptional",(n,t)=>{ve.init(n,t),te(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=>Rg(s,n)):Rg(i,n)}});function Rg(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 qI=A("$ZodCatch",(n,t)=>{ve.init(n,t),te(n._zod,"optin",()=>t.innerType._zod.optin),te(n._zod,"optout",()=>t.innerType._zod.optout),te(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=>tr(o,r,er()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>tr(s,r,er()))},input:e.value}),e.issues=[]),e)}}),YI=A("$ZodPipe",(n,t)=>{ve.init(n,t),te(n._zod,"values",()=>t.in._zod.values),te(n._zod,"optin",()=>t.in._zod.optin),te(n._zod,"optout",()=>t.out._zod.optout),te(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=>Va(o,t.in,r)):Va(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Va(s,t.out,r)):Va(i,t.out,r)}});function Va(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const KI=A("$ZodReadonly",(n,t)=>{ve.init(n,t),te(n._zod,"propValues",()=>t.innerType._zod.propValues),te(n._zod,"values",()=>t.innerType._zod.values),te(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),te(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(Pg):Pg(i)}});function Pg(n){return n.value=Object.freeze(n.value),n}const JI=A("$ZodCustom",(n,t)=>{ct.init(n,t),ve.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=>Dg(s,e,r,n));Dg(i,e,r,n)}});function Dg(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(co(i))}}var Lg;class XI{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 QI(){return new XI}(Lg=globalThis).__zod_globalRegistry??(Lg.__zod_globalRegistry=QI());const Ws=globalThis.__zod_globalRegistry;function eC(n,t){return new n({type:"string",...O(t)})}function tC(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function zg(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function nC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function rC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function iC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function sC(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function oC(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function aC(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function lC(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function cC(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function uC(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function hC(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function dC(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function pC(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function fC(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function gC(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function mC(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function vC(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function yC(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function bC(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function wC(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function SC(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function _C(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function kC(n,t){return new n({type:"string",format:"date",check:"string_format",...O(t)})}function xC(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function EC(n,t){return new n({type:"string",format:"duration",check:"string_format",...O(t)})}function AC(n,t){return new n({type:"number",checks:[],...O(t)})}function $C(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function TC(n,t){return new n({type:"boolean",...O(t)})}function IC(n){return new n({type:"unknown"})}function CC(n,t){return new n({type:"never",...O(t)})}function Og(n,t){return new Ly({check:"less_than",...O(t),value:n,inclusive:!1})}function bu(n,t){return new Ly({check:"less_than",...O(t),value:n,inclusive:!0})}function Mg(n,t){return new zy({check:"greater_than",...O(t),value:n,inclusive:!1})}function wu(n,t){return new zy({check:"greater_than",...O(t),value:n,inclusive:!0})}function Ng(n,t){return new jT({check:"multiple_of",...O(t),value:n})}function Zy(n,t){return new GT({check:"max_length",...O(t),maximum:n})}function Dl(n,t){return new qT({check:"min_length",...O(t),minimum:n})}function Wy(n,t){return new YT({check:"length_equals",...O(t),length:n})}function RC(n,t){return new KT({check:"string_format",format:"regex",...O(t),pattern:n})}function PC(n){return new JT({check:"string_format",format:"lowercase",...O(n)})}function DC(n){return new XT({check:"string_format",format:"uppercase",...O(n)})}function LC(n,t){return new QT({check:"string_format",format:"includes",...O(t),includes:n})}function zC(n,t){return new eI({check:"string_format",format:"starts_with",...O(t),prefix:n})}function OC(n,t){return new tI({check:"string_format",format:"ends_with",...O(t),suffix:n})}function Ss(n){return new nI({check:"overwrite",tx:n})}function MC(n){return Ss(t=>t.normalize(n))}function NC(){return Ss(n=>n.trim())}function UC(){return Ss(n=>n.toLowerCase())}function FC(){return Ss(n=>n.toUpperCase())}function HC(){return Ss(n=>K$(n))}function ZC(n,t,e){return new n({type:"array",element:t,...O(e)})}function WC(n,t,e){return new n({type:"custom",check:"custom",fn:t,...O(e)})}function VC(n){const t=jC(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(co(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(co(i))}},n(e.value,e)));return t}function jC(n,t){const e=new ct({check:"custom",...O(t)});return e._zod.check=n,e}function Vy(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)??Ws,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 Ee(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 y={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,o.schema,y);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,y)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),Ee(m,t,y),t.seen.get(m).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),t.io==="input"&&Ke(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 jy(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 y=r.get(f);if(y&&y!==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 I=(x=n.external.registry.get(h[0]))==null?void 0:x.id,P=n.external.uri??(V=>V);if(I)return{ref:P(I)};const R=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=R,{defId:R,ref:`${P("__shared")}#/${f}/${R}`}}if(h[1]===e)return{ref:"#"};const m=`#/${f}/`,E=h[1].schema.id??`__schema${n.counter++}`;return{defId:E,ref:m+E}},s=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:y,defId:m}=i(h);f.def={...f.schema},m&&(f.defId=m);const E=f.schema;for(const x in E)delete E[x];E.$ref=y};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 m=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&m){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 Vy(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,y={...f},m=h.ref;if(h.ref=null,m){r(m);const x=n.seen.get(m),I=x.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(I)):Object.assign(f,I),Object.assign(f,y),u._zod.parent===m)for(const R in f)R==="$ref"||R==="allOf"||R in y||delete f[R];if(I.$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!==m){r(E);const x=n.seen.get(E);if(x!=null&&x.schema.$ref&&(f.$ref=x.schema.$ref,x.def))for(const I in f)I==="$ref"||I==="allOf"||I in x.def&&JSON.stringify(f[I])===JSON.stringify(x.def[I])&&delete f[I]}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:Ll(t,"input",n.processors),output:Ll(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Ke(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 Ke(r.element,e);if(r.type==="set")return Ke(r.valueType,e);if(r.type==="lazy")return Ke(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 Ke(r.innerType,e);if(r.type==="intersection")return Ke(r.left,e)||Ke(r.right,e);if(r.type==="record"||r.type==="map")return Ke(r.keyType,e)||Ke(r.valueType,e);if(r.type==="pipe")return Ke(r.in,e)||Ke(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Ke(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Ke(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Ke(i,e))return!0;return!!(r.rest&&Ke(r.rest,e))}return!1}const VC=(n,t={})=>e=>{const r=Zy({...e,processors:t});return Ee(n,r),Wy(r,n),Vy(r,n)},Ll=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Zy({...i??{},target:s,io:t,processors:e});return Ee(n,o),Wy(o,n),Vy(o,n)},jC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},BC=(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=jC[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}))])}},GC=(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)},qC=(n,t,e,r)=>{e.type="boolean"},YC=(n,t,e,r)=>{e.not={}},KC=(n,t,e,r)=>{},JC=(n,t,e,r)=>{const i=n._zod.def,s=Sy(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},XC=(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},QC=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},eR=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},tR=(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=Ee(s.element,t,{...r,path:[...r.path,"items"]})},nR=(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]=Ee(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=Ee(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},rR=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>Ee(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=o:e.anyOf=o},iR=(n,t,e,r)=>{const i=n._zod.def,s=Ee(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=Ee(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},sR=(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=Ee(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=Ee(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Ee(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)}},oR=(n,t,e,r)=>{const i=n._zod.def,s=Ee(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"}]},aR=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},lR=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},cR=(n,t,e,r)=>{const i=n._zod.def;Ee(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)))},uR=(n,t,e,r)=>{const i=n._zod.def;Ee(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},hR=(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;Ee(s,t,r);const o=t.seen.get(n);o.ref=s},dR=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},jy=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},pR=A("ZodISODateTime",(n,t)=>{fI.init(n,t),be.init(n,t)});function fR(n){return wC(pR,n)}const gR=A("ZodISODate",(n,t)=>{gI.init(n,t),be.init(n,t)});function mR(n){return SC(gR,n)}const vR=A("ZodISOTime",(n,t)=>{mI.init(n,t),be.init(n,t)});function yR(n){return _C(vR,n)}const bR=A("ZodISODuration",(n,t)=>{vI.init(n,t),be.init(n,t)});function wR(n){return kC(bR,n)}const By=(n,t)=>{Ey.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>aT(n,e)},flatten:{value:e=>oT(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,rh,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,rh,2)}},isEmpty:{get(){return n.issues.length===0}}})},Mg=A("ZodError",By),xt=A("ZodError",By,{Parent:Error}),SR=Wd(xt),_R=Vd(xt),kR=mc(xt),xR=vc(xt),ER=uT(xt),AR=hT(xt),$R=dT(xt),TR=pT(xt),IR=fT(xt),CR=gT(xt),RR=mT(xt),PR=vT(xt),ye=A("ZodType",(n,t)=>(ve.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Ll(n,"input"),output:Ll(n,"output")}}),n.toJSONSchema=VC(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(or(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)=>ar(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>SR(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>kR(n,e,r),n.parseAsync=async(e,r)=>_R(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>xR(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>ER(n,e,r),n.decode=(e,r)=>AR(n,e,r),n.encodeAsync=async(e,r)=>$R(n,e,r),n.decodeAsync=async(e,r)=>TR(n,e,r),n.safeEncode=(e,r)=>IR(n,e,r),n.safeDecode=(e,r)=>CR(n,e,r),n.safeEncodeAsync=async(e,r)=>RR(n,e,r),n.safeDecodeAsync=async(e,r)=>PR(n,e,r),n.refine=(e,r)=>n.check(xP(e,r)),n.superRefine=e=>n.check(EP(e)),n.overwrite=e=>n.check(Ss(e)),n.optional=()=>Fg(n),n.exactOptional=()=>hP(n),n.nullable=()=>Hg(n),n.nullish=()=>Fg(Hg(n)),n.nonoptional=e=>vP(n,e),n.array=()=>z(n),n.or=e=>j([n,e]),n.and=e=>bc(n,e),n.transform=e=>Zg(n,cP(e)),n.default=e=>fP(n,e),n.prefault=e=>mP(n,e),n.catch=e=>bP(n,e),n.pipe=e=>Zg(n,e),n.readonly=()=>_P(n),n.describe=e=>{const r=n.clone();return Ws.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=Ws.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return Ws.get(n);const r=n.clone();return Ws.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),Gy=A("_ZodString",(n,t)=>{jd.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(r,i,s)=>BC(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(IC(...r)),n.includes=(...r)=>n.check(PC(...r)),n.startsWith=(...r)=>n.check(DC(...r)),n.endsWith=(...r)=>n.check(LC(...r)),n.min=(...r)=>n.check(Dl(...r)),n.max=(...r)=>n.check(Fy(...r)),n.length=(...r)=>n.check(Hy(...r)),n.nonempty=(...r)=>n.check(Dl(1,...r)),n.lowercase=r=>n.check(CC(r)),n.uppercase=r=>n.check(RC(r)),n.trim=()=>n.check(OC()),n.normalize=(...r)=>n.check(zC(...r)),n.toLowerCase=()=>n.check(MC()),n.toUpperCase=()=>n.check(NC()),n.slugify=()=>n.check(UC())}),DR=A("ZodString",(n,t)=>{jd.init(n,t),Gy.init(n,t),n.email=e=>n.check(QI(LR,e)),n.url=e=>n.check(iC(zR,e)),n.jwt=e=>n.check(bC(KR,e)),n.emoji=e=>n.check(sC(OR,e)),n.guid=e=>n.check(Dg(Ng,e)),n.uuid=e=>n.check(eC(ja,e)),n.uuidv4=e=>n.check(tC(ja,e)),n.uuidv6=e=>n.check(nC(ja,e)),n.uuidv7=e=>n.check(rC(ja,e)),n.nanoid=e=>n.check(oC(MR,e)),n.guid=e=>n.check(Dg(Ng,e)),n.cuid=e=>n.check(aC(NR,e)),n.cuid2=e=>n.check(lC(UR,e)),n.ulid=e=>n.check(cC(FR,e)),n.base64=e=>n.check(mC(GR,e)),n.base64url=e=>n.check(vC(qR,e)),n.xid=e=>n.check(uC(HR,e)),n.ksuid=e=>n.check(hC(ZR,e)),n.ipv4=e=>n.check(dC(WR,e)),n.ipv6=e=>n.check(pC(VR,e)),n.cidrv4=e=>n.check(fC(jR,e)),n.cidrv6=e=>n.check(gC(BR,e)),n.e164=e=>n.check(yC(YR,e)),n.datetime=e=>n.check(fR(e)),n.date=e=>n.check(mR(e)),n.time=e=>n.check(yR(e)),n.duration=e=>n.check(wR(e))});function d(n){return XI(DR,n)}const be=A("ZodStringFormat",(n,t)=>{ge.init(n,t),Gy.init(n,t)}),LR=A("ZodEmail",(n,t)=>{sI.init(n,t),be.init(n,t)}),Ng=A("ZodGUID",(n,t)=>{rI.init(n,t),be.init(n,t)}),ja=A("ZodUUID",(n,t)=>{iI.init(n,t),be.init(n,t)}),zR=A("ZodURL",(n,t)=>{oI.init(n,t),be.init(n,t)}),OR=A("ZodEmoji",(n,t)=>{aI.init(n,t),be.init(n,t)}),MR=A("ZodNanoID",(n,t)=>{lI.init(n,t),be.init(n,t)}),NR=A("ZodCUID",(n,t)=>{cI.init(n,t),be.init(n,t)}),UR=A("ZodCUID2",(n,t)=>{uI.init(n,t),be.init(n,t)}),FR=A("ZodULID",(n,t)=>{hI.init(n,t),be.init(n,t)}),HR=A("ZodXID",(n,t)=>{dI.init(n,t),be.init(n,t)}),ZR=A("ZodKSUID",(n,t)=>{pI.init(n,t),be.init(n,t)}),WR=A("ZodIPv4",(n,t)=>{yI.init(n,t),be.init(n,t)}),VR=A("ZodIPv6",(n,t)=>{bI.init(n,t),be.init(n,t)}),jR=A("ZodCIDRv4",(n,t)=>{wI.init(n,t),be.init(n,t)}),BR=A("ZodCIDRv6",(n,t)=>{SI.init(n,t),be.init(n,t)}),GR=A("ZodBase64",(n,t)=>{_I.init(n,t),be.init(n,t)}),qR=A("ZodBase64URL",(n,t)=>{xI.init(n,t),be.init(n,t)}),YR=A("ZodE164",(n,t)=>{EI.init(n,t),be.init(n,t)}),KR=A("ZodJWT",(n,t)=>{$I.init(n,t),be.init(n,t)}),qy=A("ZodNumber",(n,t)=>{zy.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(r,i,s)=>GC(n,r,i),n.gt=(r,i)=>n.check(zg(r,i)),n.gte=(r,i)=>n.check(bu(r,i)),n.min=(r,i)=>n.check(bu(r,i)),n.lt=(r,i)=>n.check(Lg(r,i)),n.lte=(r,i)=>n.check(yu(r,i)),n.max=(r,i)=>n.check(yu(r,i)),n.int=r=>n.check(Ug(r)),n.safe=r=>n.check(Ug(r)),n.positive=r=>n.check(zg(0,r)),n.nonnegative=r=>n.check(bu(0,r)),n.negative=r=>n.check(Lg(0,r)),n.nonpositive=r=>n.check(yu(0,r)),n.multipleOf=(r,i)=>n.check(Og(r,i)),n.step=(r,i)=>n.check(Og(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 H(n){return xC(qy,n)}const JR=A("ZodNumberFormat",(n,t)=>{TI.init(n,t),qy.init(n,t)});function Ug(n){return EC(JR,n)}const XR=A("ZodBoolean",(n,t)=>{II.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>qC(n,e,r)});function Le(n){return AC(XR,n)}const QR=A("ZodUnknown",(n,t)=>{CI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>KC()});function _(){return $C(QR)}const eP=A("ZodNever",(n,t)=>{RI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>YC(n,e,r)});function tP(n){return TC(eP,n)}const nP=A("ZodArray",(n,t)=>{PI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>tR(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Dl(e,r)),n.nonempty=e=>n.check(Dl(1,e)),n.max=(e,r)=>n.check(Fy(e,r)),n.length=(e,r)=>n.check(Hy(e,r)),n.unwrap=()=>n.element});function z(n,t){return FC(nP,n,t)}const Yy=A("ZodObject",(n,t)=>{LI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>nR(n,e,r,i),te(n,"shape",()=>t.shape),n.keyof=()=>Xy(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:tP()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>tT(n,e),n.safeExtend=e=>nT(n,e),n.merge=e=>rT(n,e),n.pick=e=>Q$(n,e),n.omit=e=>eT(n,e),n.partial=(...e)=>iT(Qy,n,e[0]),n.required=(...e)=>sT(eb,n,e[0])});function Ky(n,t){const e={type:"object",shape:n??{},...O(t)};return new Yy(e)}function v(n,t){return new Yy({type:"object",shape:n,catchall:_(),...O(t)})}const Jy=A("ZodUnion",(n,t)=>{Ny.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>rR(n,e,r,i),n.options=t.options});function j(n,t){return new Jy({type:"union",options:n,...O(t)})}const rP=A("ZodDiscriminatedUnion",(n,t)=>{Jy.init(n,t),zI.init(n,t)});function iP(n,t,e){return new rP({type:"union",options:t,discriminator:n,...O(e)})}const sP=A("ZodIntersection",(n,t)=>{OI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>iR(n,e,r,i)});function bc(n,t){return new sP({type:"intersection",left:n,right:t})}const oP=A("ZodRecord",(n,t)=>{MI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>sR(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function k(n,t,e){return new oP({type:"record",keyType:n,valueType:t,...O(e)})}const sh=A("ZodEnum",(n,t)=>{NI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(r,i,s)=>JC(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 sh({...t,checks:[],...O(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 sh({...t,checks:[],...O(i),entries:s})}});function Xy(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new sh({type:"enum",entries:e,...O(t)})}const aP=A("ZodLiteral",(n,t)=>{UI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>XC(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 $(n,t){return new aP({type:"literal",values:Array.isArray(n)?n:[n],...O(t)})}const lP=A("ZodTransform",(n,t)=>{FI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>eR(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new by(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(co(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(co(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function cP(n){return new lP({type:"transform",transform:n})}const Qy=A("ZodOptional",(n,t)=>{Uy.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>jy(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Fg(n){return new Qy({type:"optional",innerType:n})}const uP=A("ZodExactOptional",(n,t)=>{HI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>jy(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function hP(n){return new uP({type:"optional",innerType:n})}const dP=A("ZodNullable",(n,t)=>{ZI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>oR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Hg(n){return new dP({type:"nullable",innerType:n})}const pP=A("ZodDefault",(n,t)=>{WI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>lR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function fP(n,t){return new pP({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():ky(t)}})}const gP=A("ZodPrefault",(n,t)=>{VI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>cR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function mP(n,t){return new gP({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():ky(t)}})}const eb=A("ZodNonOptional",(n,t)=>{jI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>aR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function vP(n,t){return new eb({type:"nonoptional",innerType:n,...O(t)})}const yP=A("ZodCatch",(n,t)=>{BI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>uR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function bP(n,t){return new yP({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const wP=A("ZodPipe",(n,t)=>{GI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>hR(n,e,r,i),n.in=t.in,n.out=t.out});function Zg(n,t){return new wP({type:"pipe",in:n,out:t})}const SP=A("ZodReadonly",(n,t)=>{qI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>dR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function _P(n){return new SP({type:"readonly",innerType:n})}const kP=A("ZodCustom",(n,t)=>{YI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>QC(n,e)});function xP(n,t={}){return HC(kP,n,t)}function EP(n){return ZC(n)}const AP=[".md",".markdown"];function tb(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function nb(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function $P(n){return nb(n).toLowerCase()}function TP(n,t){const e=$P(n);return t.some(r=>e.endsWith(r))}function rb(n){return!tb(n)&&TP(n,AP)}function IP(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function mn(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const CP=Ky({id:d().min(1),kind:$("path"),title:d(),path:d()}).strict(),RP=Ky({id:d().min(1),kind:$("url"),title:d(),url:d().refine(IP,{message:"url must be an http(s) URL"})}).strict();iP("kind",[CP,RP]);function ib(n){return typeof n=="object"&&n!==null}function sb(n){return!ib(n)||n.type!=="ready"?!1:!("id"in n)}function ob(n){return!(!ib(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const PP="/views/markdown/",DP="/views/url-unsupported/";function ab(n){return`/artifact/${encodeURIComponent(n)}`}function LP(n,t){return`${ab(n)}/${encodeURIComponent(t)}`}function zP(n){return`/markdown/${encodeURIComponent(n)}`}function zl(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:mn(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:DP,contentURL:null};if(rb(n.path)){const r={viewURL:PP,contentURL:zP(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=tb(n.path)?`${ab(n.id)}/`:LP(n.id,nb(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const OP="serverURL",MP="token",NP="mode",UP="electron";function lb(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(OP);return r?new URL(r).origin:new URL(t).origin}function FP(n=window.location.search){return new URLSearchParams(n).get(MP)}function ln(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(NP)===UP}const pe={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"},gn={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"},HP=1,ZP=v({_meta:k(d(),_()).nullish(),terminal:Le().optional().default(!1)}),WP=v({_meta:k(d(),_()).nullish(),label:d().nullish(),name:d(),optional:Le().optional().default(!1),secret:Le().optional().default(!0)}),VP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),name:d()}),jP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:z(WP)}),BP=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),description:d().nullish(),env:k(d(),d()).optional(),id:d(),name:d()}),GP=j([jP.and(v({type:$("env_var")})),BP.and(v({type:$("terminal")})),VP]),qP=v({_meta:k(d(),_()).nullish(),methodId:d()}),YP=v({_meta:k(d(),_()).nullish()}),KP=v({_meta:k(d(),_()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),JP=v({default:Le().nullish(),description:d().nullish(),title:d().nullish()}),XP=v({_meta:k(d(),_()).nullish()}),QP=v({_meta:k(d(),_()).nullish()}),eD=v({amount:H(),currency:d()}),tD=v({_meta:k(d(),_()).nullish(),terminalId:d()}),nD=v({_meta:k(d(),_()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),rD=j([d(),H(),H(),Le(),z(d())]),iD=v({content:k(d(),rD).nullish()}),sD=j([iD.and(v({action:$("accept")})),v({action:$("decline")}),v({action:$("cancel")})]),oD=v({_meta:k(d(),_()).nullish()}),cb=d(),aD=v({_meta:k(d(),_()).nullish(),elicitationId:cb}),lD=v({_meta:k(d(),_()).nullish(),action:sD}),cD=$("object"),uD=$("string"),hD=v({_meta:k(d(),_()).nullish()}),dD=v({_meta:k(d(),_()).nullish(),form:oD.nullish(),url:hD.nullish()}),pD=v({elicitationId:cb,url:d().url()}),ub=v({const:d(),title:d()}),hb=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),fD=j([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),db=v({code:fD,data:_().optional(),message:d()}),pb=_(),fb=_(),gb=_(),gD=v({_meta:k(d(),_()).nullish(),readTextFile:Le().optional().default(!1),writeTextFile:Le().optional().default(!1)}),mb=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),vb=v({_meta:k(d(),_()).nullish(),name:d(),title:d().nullish(),version:d()}),mD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),vD=v({_meta:k(d(),_()).nullish()}),yD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),bD=v({_meta:k(d(),_()).nullish()}),wD=v({_meta:k(d(),_()).nullish(),logout:bD.nullish()}),SD=v({_meta:k(d(),_()).nullish()}),_D=v({_meta:k(d(),_()).nullish()}),kD=v({_meta:k(d(),_()).nullish(),http:Le().optional().default(!1),sse:Le().optional().default(!1)}),xD=v({_meta:k(d(),_()).nullish(),headers:z(mb),name:d(),url:d()}),ED=v({_meta:k(d(),_()).nullish(),headers:z(mb),name:d(),url:d()}),AD=v({_meta:k(d(),_()).nullish(),args:z(d()),command:d(),env:z(hb),name:d()}),wc=j([xD.and(v({type:$("http")})),ED.and(v({type:$("sse")})),AD]),Bd=d(),$D=v({_meta:k(d(),_()).nullish(),description:d().nullish(),modelId:Bd,name:d()}),TD=j([$("error"),$("warning"),$("information"),$("hint")]),ID=v({_meta:k(d(),_()).nullish()}),CD=v({_meta:k(d(),_()).nullish()}),RD=v({_meta:k(d(),_()).nullish()}),PD=v({_meta:k(d(),_()).nullish()}),DD=v({_meta:k(d(),_()).nullish()}),LD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),zD=v({diff:d(),uri:d()}),OD=v({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),MD=v({_meta:k(d(),_()).nullish()}),ND=v({_meta:k(d(),_()).nullish()}),UD=v({languageId:d(),text:d(),uri:d()}),FD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),HD=j([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),ZD=v({excerpts:z(OD),uri:d()}),WD=v({_meta:k(d(),_()).nullish()}),VD=v({_meta:k(d(),_()).nullish()}),jD=v({name:d(),owner:d(),remoteUrl:d()}),BD=v({_meta:k(d(),_()).nullish()}),GD=v({_meta:k(d(),_()).nullish(),jump:MD.nullish(),rename:VD.nullish(),searchAndReplace:BD.nullish()}),qD=v({id:d(),isRegex:Le().nullish(),replace:d(),search:d(),uri:d()}),YD=j([$("automatic"),$("diagnostic"),$("manual")]),KD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),JD=v({_meta:k(d(),_()).nullish(),diagnostics:ID.nullish(),editHistory:LD.nullish(),openFiles:ND.nullish(),recentFiles:FD.nullish(),relatedSnippets:WD.nullish(),userActions:KD.nullish()}),XD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc)}),QD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),yb=d(),eL=j([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),tL=v({_meta:k(d(),_()).nullish(),kind:eL,name:d(),optionId:yb}),nL=j([$("high"),$("medium"),$("low")]),rL=j([$("pending"),$("in_progress"),$("completed")]),iL=v({_meta:k(d(),_()).nullish(),content:d(),priority:nL,status:rL}),sL=v({_meta:k(d(),_()).nullish(),entries:z(iL)}),nr=v({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),oL=v({id:d(),position:nr,uri:d()}),aL=v({id:d(),newName:d(),position:nr,uri:d()}),lL=v({action:d(),position:nr,timestampMs:H(),uri:d()}),bb=j([$("utf-16"),$("utf-32"),$("utf-8")]),cL=v({_meta:k(d(),_()).nullish(),auth:ZP.optional().default({terminal:!1}),elicitation:dD.nullish(),fs:gD.optional().default({readTextFile:!1,writeTextFile:!1}),nes:GD.nullish(),positionEncodings:z(bb).optional(),terminal:Le().optional().default(!1)}),uL=v({_meta:k(d(),_()).nullish(),audio:Le().optional().default(!1),embeddedContext:Le().optional().default(!1),image:Le().optional().default(!1)}),wb=H().int().gte(0).lte(65535),hL=v({_meta:k(d(),_()).nullish(),clientCapabilities:cL.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:vb.nullish(),protocolVersion:wb}),_s=v({end:nr,start:nr}),dL=v({message:d(),range:_s,severity:TD,uri:d()}),pL=v({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:_s.nullish()}),fL=v({_meta:k(d(),_()).nullish(),diagnostics:z(dL).nullish(),editHistory:z(zD).nullish(),openFiles:z(pL).nullish(),recentFiles:z(UD).nullish(),relatedSnippets:z(ZD).nullish(),userActions:z(lL).nullish()}),gL=v({newText:d(),range:_s}),mL=v({cursorPosition:nr.nullish(),edits:z(gL),id:d(),uri:d()}),vL=j([mL.and(v({kind:$("edit")})),oL.and(v({kind:$("jump")})),aL.and(v({kind:$("rename")})),qD.and(v({kind:$("searchAndReplace")}))]),yL=v({_meta:k(d(),_()).nullish(),content:d()}),bL=v({_meta:k(d(),_()).nullish()}),Gr=j([H(),d()]).nullable();v({_meta:k(d(),_()).nullish(),requestId:Gr});const wL=Xy(["assistant","user"]),Sa=v({_meta:k(d(),_()).nullish(),audience:z(wL).nullish(),lastModified:d().nullish(),priority:H().nullish()}),SL=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),data:d(),mimeType:d()}),_L=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),kL=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),xL=v({_meta:k(d(),_()).nullish(),optionId:yb}),EL=j([v({outcome:$("cancelled")}),xL.and(v({outcome:$("selected")}))]),AL=v({_meta:k(d(),_()).nullish(),outcome:EL}),$L=v({_meta:k(d(),_()).nullish()}),TL=v({_meta:k(d(),_()).nullish()}),IL=v({currentValue:Le()}),CL=d(),Sb=d(),RL=j([$("mode"),$("model"),$("thought_level"),d()]),Gd=d(),_b=v({_meta:k(d(),_()).nullish(),description:d().nullish(),name:d(),value:Gd}),PL=v({_meta:k(d(),_()).nullish(),group:CL,name:d(),options:z(_b)}),DL=j([z(_b),z(PL)]),LL=v({currentValue:Gd,options:DL}),ks=bc(j([LL.and(v({type:$("select")})),IL.and(v({type:$("boolean")}))]),v({_meta:k(d(),_()).nullish(),category:RL.nullish(),description:d().nullish(),id:Sb,name:d()})),zL=v({_meta:k(d(),_()).nullish(),configOptions:z(ks)}),OL=v({_meta:k(d(),_()).nullish()}),Q=d(),ML=v({_meta:k(d(),_()).nullish(),id:d(),sessionId:Q}),NL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),UL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),FL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),kb=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),command:d(),cwd:d().nullish(),env:z(hb).optional(),outputByteLimit:H().nullish(),sessionId:Q}),HL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),ZL=v({_meta:k(d(),_()).nullish(),position:nr,sessionId:Q,uri:d(),version:H(),visibleRange:_s}),WL=v({_meta:k(d(),_()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),VL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),jL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc).optional(),sessionId:Q}),xb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),BL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc),sessionId:Q}),Eb=v({_meta:k(d(),_()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:Q}),GL=v({_meta:k(d(),_()).nullish(),id:d(),reason:HD.nullish(),sessionId:Q}),Ab=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),qL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc).optional(),sessionId:Q}),YL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),KL=v({_meta:k(d(),_()).nullish(),nextCursor:d().nullish(),sessions:z(YL)}),JL=v({_meta:k(d(),_()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),XL=v({_meta:k(d(),_()).nullish()}),Sc=d(),QL=v({_meta:k(d(),_()).nullish(),currentModeId:Sc}),e2=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:Sc,name:d()}),_c=v({_meta:k(d(),_()).nullish(),availableModes:z(e2),currentModeId:Sc}),kc=v({_meta:k(d(),_()).nullish(),availableModels:z($D),currentModelId:Bd}),t2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish(),sessionId:Q}),n2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish()}),r2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish(),sessionId:Q}),i2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish()}),s2=v({_meta:k(d(),_()).nullish()}),o2=v({_meta:k(d(),_()).nullish(),additionalDirectories:$L.nullish(),close:TL.nullish(),fork:OL.nullish(),list:XL.nullish(),resume:s2.nullish()}),a2=bc(j([v({type:$("boolean"),value:Le()}),v({value:Gd})]),v({_meta:k(d(),_()).nullish(),configId:Sb,sessionId:Q})),l2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks)}),c2=v({_meta:k(d(),_()).nullish(),modeId:Sc,sessionId:Q}),u2=v({_meta:k(d(),_()).nullish()}),h2=v({_meta:k(d(),_()).nullish(),modelId:Bd,sessionId:Q}),d2=v({_meta:k(d(),_()).nullish()}),p2=v({_meta:k(d(),_()).nullish(),sessionId:Q}),f2=j([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),g2=j([$("email"),$("uri"),$("date"),$("date-time")]),m2=v({default:d().nullish(),description:d().nullish(),enum:z(d()).nullish(),format:g2.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:z(ub).nullish(),pattern:d().nullish(),title:d().nullish()}),v2=v({_meta:k(d(),_()).nullish(),context:fL.nullish(),position:nr,selection:_s.nullish(),sessionId:Q,triggerKind:YD,uri:d(),version:H()}),y2=v({_meta:k(d(),_()).nullish(),suggestions:z(vL)}),b2=v({_meta:k(d(),_()).nullish(),terminalId:d()}),w2=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),$b=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),S2=v({_meta:k(d(),_()).nullish(),exitStatus:w2.nullish(),output:d(),truncated:Le()}),_2=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),text:d()}),k2=v({range:_s.nullish(),text:d()}),x2=v({_meta:k(d(),_()).nullish(),contentChanges:z(k2),sessionId:Q,uri:d(),version:H()});v({method:d(),params:j([NL,WL,x2,HL,VL,ZL,ML,GL,pb]).nullish()});const E2=j([$("full"),$("incremental")]),A2=v({_meta:k(d(),_()).nullish(),syncKind:E2}),$2=v({_meta:k(d(),_()).nullish(),didChange:A2.nullish(),didClose:CD.nullish(),didFocus:RD.nullish(),didOpen:PD.nullish(),didSave:DD.nullish()}),T2=v({_meta:k(d(),_()).nullish(),document:$2.nullish()}),I2=v({_meta:k(d(),_()).nullish(),context:JD.nullish(),events:T2.nullish()}),C2=v({_meta:k(d(),_()).nullish(),auth:wD.optional().default({}),loadSession:Le().optional().default(!1),mcpCapabilities:kD.optional().default({http:!1,sse:!1}),nes:I2.nullish(),positionEncoding:bb.nullish(),promptCapabilities:uL.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:o2.optional().default({})}),R2=v({_meta:k(d(),_()).nullish(),agentCapabilities:C2.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:vb.nullish(),authMethods:z(GP).optional().default([]),protocolVersion:wb}),P2=v({_meta:k(d(),_()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),D2=j([P2,KP]),L2=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),resource:D2}),qd=j([_2.and(v({type:$("text")})),_L.and(v({type:$("image")})),SL.and(v({type:$("audio")})),kL.and(v({type:$("resource_link")})),L2.and(v({type:$("resource")}))]),z2=v({_meta:k(d(),_()).nullish(),content:qd}),wu=v({_meta:k(d(),_()).nullish(),content:qd,messageId:d().nullish()}),O2=v({_meta:k(d(),_()).nullish(),messageId:d().nullish(),prompt:z(qd),sessionId:Q}),M2=v({anyOf:z(ub)}),Tb=j([z2.and(v({type:$("content")})),nD.and(v({type:$("diff")})),b2.and(v({type:$("terminal")}))]),Ib=d(),Cb=v({_meta:k(d(),_()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),Rb=j([$("pending"),$("in_progress"),$("completed"),$("failed")]),Pb=j([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),N2=v({_meta:k(d(),_()).nullish(),content:z(Tb).optional(),kind:Pb.optional(),locations:z(Cb).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:Rb.optional(),title:d(),toolCallId:Ib}),Db=v({_meta:k(d(),_()).nullish(),content:z(Tb).nullish(),kind:Pb.nullish(),locations:z(Cb).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:Rb.nullish(),title:d().nullish(),toolCallId:Ib}),Lb=v({_meta:k(d(),_()).nullish(),options:z(tL),sessionId:Q,toolCall:Db}),U2=v({_meta:k(d(),_()).nullish(),hint:d()}),F2=U2,H2=v({_meta:k(d(),_()).nullish(),description:d(),input:F2.nullish(),name:d()}),Z2=v({_meta:k(d(),_()).nullish(),availableCommands:z(H2)}),W2=v({enum:z(d()),type:uD}),V2=j([W2,M2]),j2=v({default:z(d()).nullish(),description:d().nullish(),items:V2,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),B2=j([m2.and(v({type:$("string")})),QD.and(v({type:$("number")})),mD.and(v({type:$("integer")})),JP.and(v({type:$("boolean")})),j2.and(v({type:$("array")}))]),G2=v({description:d().nullish(),properties:k(d(),B2).optional().default({}),required:z(d()).nullish(),title:d().nullish(),type:cD.optional().default("object")}),q2=v({requestedSchema:G2}),Y2=bc(j([q2.and(v({mode:$("form")})),pD.and(v({mode:$("url")}))]),v({_meta:k(d(),_()).nullish(),message:d(),sessionId:Q})),K2=v({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),J2=v({_meta:k(d(),_()).nullish(),stopReason:f2,usage:K2.nullish(),userMessageId:d().nullish()});j([v({id:Gr,result:j([R2,YP,_D,r2,n2,KL,t2,i2,QP,u2,l2,J2,d2,p2,y2,XP,gb])}),v({error:db,id:Gr})]);const X2=v({_meta:k(d(),_()).nullish(),cost:eD.nullish(),size:H(),used:H()}),Q2=j([wu.and(v({sessionUpdate:$("user_message_chunk")})),wu.and(v({sessionUpdate:$("agent_message_chunk")})),wu.and(v({sessionUpdate:$("agent_thought_chunk")})),N2.and(v({sessionUpdate:$("tool_call")})),Db.and(v({sessionUpdate:$("tool_call_update")})),sL.and(v({sessionUpdate:$("plan")})),Z2.and(v({sessionUpdate:$("available_commands_update")})),QL.and(v({sessionUpdate:$("current_mode_update")})),zL.and(v({sessionUpdate:$("config_option_update")})),JL.and(v({sessionUpdate:$("session_info_update")})),X2.and(v({sessionUpdate:$("usage_update")}))]),zb=v({_meta:k(d(),_()).nullish(),sessionId:Q,update:Q2});v({method:d(),params:j([zb,aD,pb]).nullish()});const Ob=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),ez=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),tz=v({name:d(),uri:d()}),nz=v({_meta:k(d(),_()).nullish(),repository:jD.nullish(),workspaceFolders:z(tz).nullish(),workspaceUri:d().nullish()});v({id:Gr,method:d(),params:j([hL,qP,SD,XD,BL,yD,jL,qL,FL,c2,a2,O2,h2,nz,v2,UL,fb]).nullish()});const Mb=v({_meta:k(d(),_()).nullish(),content:d(),path:d(),sessionId:Q});v({id:Gr,method:d(),params:j([Mb,Eb,Lb,kb,$b,Ab,Ob,xb,Y2,fb]).nullish()});const rz=v({_meta:k(d(),_()).nullish()});j([v({id:Gr,result:j([rz,yL,AL,tD,S2,bL,ez,vD,lD,gb])}),v({error:db,id:Gr})]);var X;class iz{constructor(t,e){S(this,X);const r=t(this),i=async(o,a)=>{var c,u,h,f,y,m,E;switch(o){case gn.fs_write_text_file:{const x=Mb.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,x)}case gn.fs_read_text_file:{const x=Eb.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,x)}case gn.session_request_permission:{const x=Lb.parse(a);return r.requestPermission(x)}case gn.terminal_create:{const x=kb.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,x)}case gn.terminal_output:{const x=$b.parse(a);return(f=r.terminalOutput)==null?void 0:f.call(r,x)}case gn.terminal_release:{const x=Ab.parse(a);return await((y=r.releaseTerminal)==null?void 0:y.call(r,x))??{}}case gn.terminal_wait_for_exit:{const x=Ob.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,x)}case gn.terminal_kill:{const x=xb.parse(a);return await((E=r.killTerminal)==null?void 0:E.call(r,x))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ce.methodNotFound(o)}},s=async(o,a)=>{switch(o){case gn.session_update:{const c=zb.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ce.methodNotFound(o)}};w(this,X,new sz(i,s,e))}async initialize(t){return await l(this,X).sendRequest(pe.initialize,t)}async newSession(t){return await l(this,X).sendRequest(pe.session_new,t)}async loadSession(t){return await l(this,X).sendRequest(pe.session_load,t)??{}}async unstable_forkSession(t){return await l(this,X).sendRequest(pe.session_fork,t)}async listSessions(t){return await l(this,X).sendRequest(pe.session_list,t)}async unstable_resumeSession(t){return await l(this,X).sendRequest(pe.session_resume,t)}async unstable_closeSession(t){return await l(this,X).sendRequest(pe.session_close,t)}async setSessionMode(t){return await l(this,X).sendRequest(pe.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,X).sendRequest(pe.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,X).sendRequest(pe.session_set_config_option,t)}async authenticate(t){return await l(this,X).sendRequest(pe.authenticate,t)??{}}async unstable_logout(t){return await l(this,X).sendRequest(pe.logout,t)??{}}async prompt(t){return await l(this,X).sendRequest(pe.session_prompt,t)}async cancel(t){return await l(this,X).sendNotification(pe.session_cancel,t)}async unstable_startNes(t){return await l(this,X).sendRequest(pe.nes_start,t)}async unstable_suggestNes(t){return await l(this,X).sendRequest(pe.nes_suggest,t)}async unstable_closeNes(t){return await l(this,X).sendRequest(pe.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,X).sendNotification(pe.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,X).sendNotification(pe.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,X).sendNotification(pe.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,X).sendNotification(pe.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,X).sendNotification(pe.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,X).sendNotification(pe.nes_accept,t)}async unstable_rejectNes(t){return await l(this,X).sendNotification(pe.nes_reject,t)}async extMethod(t,e){return await l(this,X).sendRequest(t,e)}async extNotification(t,e){return await l(this,X).sendNotification(t,e)}get signal(){return l(this,X).signal}get closed(){return l(this,X).closed}}X=new WeakMap;var Hn,Bl,wo,So,zi,Oi,Bt,_o,me,Nb,oh,Ub,Fb,Hb,Zb,ah,Vs;class sz{constructor(t,e,r){S(this,me);S(this,Hn,new Map);S(this,Bl,0);S(this,wo);S(this,So);S(this,zi);S(this,Oi,Promise.resolve());S(this,Bt,new AbortController);S(this,_o);w(this,wo,t),w(this,So,e),w(this,zi,r),w(this,_o,new Promise(i=>{l(this,Bt).signal.addEventListener("abort",()=>i())})),p(this,me,Nb).call(this)}get signal(){return l(this,Bt).signal}get closed(){return l(this,_o)}async sendRequest(t,e){p(this,me,ah).call(this);const r=Zc(this,Bl)._++,i=new Promise((s,o)=>{l(this,Hn).set(r,{resolve:s,reject:o})});return await p(this,me,Vs).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){p(this,me,ah).call(this),await p(this,me,Vs).call(this,{jsonrpc:"2.0",method:t,params:e})}}Hn=new WeakMap,Bl=new WeakMap,wo=new WeakMap,So=new WeakMap,zi=new WeakMap,Oi=new WeakMap,Bt=new WeakMap,_o=new WeakMap,me=new WeakSet,Nb=async function(){let t;try{const e=l(this,zi).readable.getReader();try{for(;!l(this,Bt).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{p(this,me,Ub).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&p(this,me,Vs).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{p(this,me,oh).call(this,t)}},oh=function(t){if(l(this,Bt).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,Hn).values())r.reject(e);l(this,Hn).clear(),l(this,Bt).abort(e)},Ub=async function(t){if("method"in t&&"id"in t){const e=await p(this,me,Fb).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await p(this,me,Vs).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await p(this,me,Hb).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?p(this,me,Zb).call(this,t):console.error("Invalid message",{message:t})},Fb=async function(t,e){try{return{result:await l(this,wo).call(this,t,e)??null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Mg)return Ce.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 Ce.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ce.internalError({details:i}).toResult()}}},Hb=async function(t,e){try{return await l(this,So).call(this,t,e),{result:null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Mg)return Ce.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 Ce.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ce.internalError({details:i}).toResult()}}},Zb=function(t){const e=l(this,Hn).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 Ce(r,i,s))}l(this,Hn).delete(t.id)}else console.error("Got response to unknown request",t.id)},ah=function(){if(l(this,Bt).signal.aborted)throw l(this,Bt).signal.reason??new Error("ACP connection closed")},Vs=async function(t){return w(this,Oi,l(this,Oi).then(async()=>{const e=l(this,zi).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{p(this,me,oh).call(this,e)})),l(this,Oi)};class Ce 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 Ce(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Ce(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Ce(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Ce(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Ce(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Ce(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Ce(-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 oz=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,az=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,lz=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,cz=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,uz=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,hz="single_session",dz={name:"television-acp-client",version:"0.0.0"},Wb="agent:main:television",pz=wa(Ot);var Mi,Gt,ht,qt,Zn,$t,kn,Yt,Kt,Wn,Tt,Ni,Ui,Jt,Je,xn,Fi,Rr,En,Vn,ko,It,Xt,Gl,Qt,T,lh,Vb,jb,Bb,al,Gb,qb,Yb,Kb,Jb,Xb,Qb,vr,yi,bi,vn,ew,wi,ch,uh,ll,tw,cl,hh,dh,xo,Eo,ul,Si,ph,nw;class fz extends pz{constructor(e){super();S(this,T);S(this,Mi,"disconnected");S(this,Gt,null);S(this,ht,new Map);S(this,qt,null);S(this,Zn,null);S(this,$t,null);S(this,kn,null);S(this,Yt,null);S(this,Kt,null);S(this,Wn);S(this,Tt,null);S(this,Ni,0);S(this,Ui,1);S(this,Jt,null);S(this,Je,null);S(this,xn,!1);S(this,Fi,!1);S(this,Rr,!1);S(this,En,null);S(this,Vn,new Set);S(this,ko);S(this,It);S(this,Xt);S(this,Gl,e=>{p(this,T,jb).call(this,e)});S(this,Qt,null);S(this,xo,()=>{p(this,T,Si).call(this,"ACP bridge websocket closed")});S(this,Eo,()=>{p(this,T,Si).call(this,"ACP bridge websocket error")});w(this,It,e),w(this,Xt,e.sessionMode??hz),w(this,Wn,e.mappedSessionStore??gz()),w(this,ko,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,Mi)}get messages(){return[...l(this,ht).values()]}get enabled(){return l(this,It).enabled??!1}setToken(e){l(this,It).token=e??""}setEnabled(e){l(this,It).enabled=e,e||(p(this,T,ul).call(this),w(this,Gt,null),p(this,T,vn).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,Zn)===null&&(w(this,Gt,null),w(this,Zn,p(this,T,Vb).call(this)));try{await l(this,Zn),await p(this,T,al).call(this)}catch(e){throw p(this,T,Si).call(this,Su(e)),e}}}dispose(){p(this,T,ul).call(this),w(this,Gt,null),p(this,T,vn).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,lh).call(this,"ready")),(l(this,Yt)===null||l(this,Tt)!==p(this,T,cl).call(this))&&await p(this,T,al).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");p(this,T,yi).call(this,{id:p(this,T,wi).call(this,"user"),kind:"user",text:r,status:"final"}),p(this,T,vn).call(this,"running");try{const i=await p(this,T,ll).call(this).prompt({sessionId:p(this,T,uh).call(this),prompt:[{type:"text",text:p(this,T,ew).call(this,r)}]});p(this,T,vr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),p(this,T,vn).call(this,"ready")}catch(i){throw p(this,T,nw).call(this)||(p(this,T,vr).call(this,"error"),p(this,T,vn).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,lh).call(this,"ready"));const e=p(this,T,cl).call(this);((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,Wn).clearActualSessionId(e):w(this,Ni,l(this,Ni)+1),w(this,$t,null),w(this,kn,null),w(this,Yt,null),w(this,Tt,null),p(this,T,ph).call(this)}async cancel(){this.status==="running"&&(p(this,T,vn).call(this,"cancelling"),await p(this,T,ll).call(this).cancel({sessionId:p(this,T,uh).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,Je)===null)return;w(this,Je,null),w(this,xn,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,Je))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Je))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Je))==null?void 0:a.screenID)??null;if(w(this,Je,r),l(this,Xt)==="single_session"){(!l(this,Tt)||i!==r.screenID)&&w(this,xn,!0);return}l(this,Tt)!==p(this,T,hh).call(this,r.screenID)&&(w(this,$t,null),w(this,kn,null),l(this,qt)&&this.status==="ready"&&p(this,T,al).call(this).catch(c=>{p(this,T,Si).call(this,Su(c))}))}}Mi=new WeakMap,Gt=new WeakMap,ht=new WeakMap,qt=new WeakMap,Zn=new WeakMap,$t=new WeakMap,kn=new WeakMap,Yt=new WeakMap,Kt=new WeakMap,Wn=new WeakMap,Tt=new WeakMap,Ni=new WeakMap,Ui=new WeakMap,Jt=new WeakMap,Je=new WeakMap,xn=new WeakMap,Fi=new WeakMap,Rr=new WeakMap,En=new WeakMap,Vn=new WeakMap,ko=new WeakMap,It=new WeakMap,Xt=new WeakMap,Gl=new WeakMap,Qt=new WeakMap,T=new WeakSet,lh=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,Gt)??"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,Gt)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},Vb=async function(){try{const{stream:e,socket:r,metadata:i}=await bz({serverURL:l(this,It).serverURL,token:l(this,It).token,createSocket:l(this,ko),onDisconnect:l(this,Gl)});w(this,Kt,i),w(this,Qt,r),r.addEventListener("close",l(this,xo)),r.addEventListener("error",l(this,Eo)),w(this,qt,new iz(s=>({connection:s,sessionUpdate:async o=>{await p(this,T,qb).call(this,o)},requestPermission:async o=>p(this,T,Yb).call(this,o)}),e)),await l(this,qt).initialize({protocolVersion:HP,clientCapabilities:{},clientInfo:dz})}catch(e){throw e}},jb=function(e){p(this,T,Si).call(this,Su(e))},Bb=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})`)},al=async function(){const e=p(this,T,cl).call(this);if(l(this,$t)&&l(this,kn)===e){await l(this,$t);return}w(this,kn,e),w(this,$t,p(this,T,Gb).call(this,e)),await l(this,$t)},Gb=async function(e){var c;const r=p(this,T,ll).call(this);p(this,T,ph).call(this);let i,s=!1,o=null;const a={cwd:p(this,T,tw).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(w(this,Rr,!0),w(this,En,null),((c=l(this,Kt))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,Wn).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(mz(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,Wn).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,Wn).setActualSessionId(e,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:e}),i=e,s=l(this,ht).size>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{w(this,Rr,!1),w(this,En,null),p(this,T,vr).call(this,"final")}p(this,T,Bb).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),w(this,Yt,i),w(this,Tt,e),w(this,Fi,!0),s?(l(this,Vn).add(e),l(this,Xt)==="single_session"&&w(this,xn,!1)):(l(this,Vn).delete(e),w(this,xn,l(this,Xt)==="single_session")),w(this,Gt,null),p(this,T,vn).call(this,"ready")},qb=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&p(this,T,Qb).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&p(this,T,Kb).call(this,r.content.text);return;case"tool_call":p(this,T,Jb).call(this,r);return;case"tool_call_update":p(this,T,Xb).call(this,r);return;case"agent_thought_chunk":return;default:return}},Yb=async function(e){return{outcome:{outcome:"cancelled"}}},Kb=function(e){w(this,En,null);const r=yz(e);if(!r)return;if(!l(this,Jt)){const s={id:p(this,T,wi).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};w(this,Jt,s.id),p(this,T,yi).call(this,s);return}const i=l(this,ht).get(l(this,Jt));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");p(this,T,bi).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Jb=function(e){p(this,T,vr).call(this,"final");const r=p(this,T,ch).call(this,e.toolCallId),i=Vg("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??p(this,T,wi).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){p(this,T,bi).call(this,s);return}p(this,T,yi).call(this,s)},Xb=function(e){const r=p(this,T,ch).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=Vg(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??p(this,T,wi).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){p(this,T,bi).call(this,a);return}p(this,T,yi).call(this,a)},Qb=function(e){if(p(this,T,vr).call(this,"final"),!e)return;const r=l(this,Rr)?l(this,En):null;if(!r){const s=Wg(e);if(!s)return;const o={id:p(this,T,wi).call(this,"user"),kind:"user",text:s,status:"final"};p(this,T,yi).call(this,o),l(this,Rr)&&w(this,En,o.id);return}const i=l(this,ht).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");p(this,T,bi).call(this,{...i,text:Wg(`${i.text}${e}`)})},vr=function(e){if(!l(this,Jt))return;const r=l(this,ht).get(l(this,Jt));(r==null?void 0:r.kind)==="assistant"&&p(this,T,bi).call(this,{...r,status:e}),w(this,Jt,null)},yi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new gu("messages-changed"))},bi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new gu("messages-changed"))},vn=function(e){l(this,Mi)!==e&&(w(this,Mi,e),this.dispatchEvent(new X1("status-changed")))},ew=function(e){const r=l(this,Tt);if(!r)return e;const i=l(this,Je)?l(this,Xt)==="single_session"?l(this,xn)||!l(this,Vn).has(r):!l(this,Vn).has(r):!1,s=l(this,Fi)&&(l(this,Je)!==null||cz.test(e));if(!(s||i))return e;s&&w(this,Fi,!1),i&&(w(this,xn,!1),l(this,Vn).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,Je)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,Je).screenID}`),a.push(`screen_name: ${l(this,Je).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
- `)},wi=function(e){const r=`${e}-${l(this,Ui)}`;return w(this,Ui,l(this,Ui)+1),r},ch=function(e){for(const r of l(this,ht).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},uh=function(){if(!l(this,Yt))throw new Error("ACP session is not ready");return l(this,Yt)},ll=function(){if(!l(this,qt))throw new Error("ACP connection is not ready");return l(this,qt)},tw=function(){var r;const e=(r=l(this,Kt))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},cl=function(){var r;if(l(this,Xt)==="single_session")return p(this,T,dh).call(this,`${Wb}-${(l(this,It).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,Je))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return p(this,T,hh).call(this,e)},hh=function(e){return p(this,T,dh).call(this,vz(l(this,Xt),e,l(this,It).clientGUID??"default-client"))},dh=function(e){var r;return((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,Ni)>0?`${e}:epoch-${l(this,Ni)}`:e},xo=new WeakMap,Eo=new WeakMap,ul=function(){w(this,qt,null),w(this,Zn,null),w(this,$t,null),w(this,kn,null),w(this,Yt,null),w(this,Tt,null),w(this,Kt,null),l(this,Qt)&&(l(this,Qt).removeEventListener("close",l(this,xo)),l(this,Qt).removeEventListener("error",l(this,Eo)),l(this,Qt).close(),w(this,Qt,null))},Si=function(e){const r=l(this,qt)!==null||l(this,Zn)!==null||l(this,$t)!==null||l(this,kn)!==null||l(this,Yt)!==null||l(this,Tt)!==null||l(this,Kt)!==null||l(this,Qt)!==null;this.disposed||this.status==="disconnected"&&!r||(p(this,T,vr).call(this,"error"),p(this,T,ul).call(this),w(this,Gt,e??null),p(this,T,vn).call(this,"disconnected"))},ph=function(){const e=l(this,ht).size>0;w(this,Jt,null),w(this,En,null),w(this,Ui,1),l(this,ht).clear(),e&&this.dispatchEvent(new gu("messages-changed"))},nw=function(){return this.status==="disconnected"};function gz(){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 mz(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function vz(n,t,e){return n==="single_session"?`${Wb}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function rw(n){return n.replace(/^(?:\s*\n)+/,"")}function Wg(n){let t=n;return t=t.replace(oz,""),t=t.replace(az,""),t=t.replace(lz,""),t=rw(t),t}function yz(n){let t=n;return t=t.replace(uz,""),t=rw(t),t}function Vg(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function bz(n){const t=n.createSocket(_z(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"}))},y=x=>{const I=Sz(x);if(!I)return;let P;try{P=JSON.parse(I)}catch(R){const V=R instanceof Error?R:new Error(String(R));i(V),u.error(V);return}switch(P.type){case"acp-bridge-status":if(P.status==="ready"){let R;try{R=wz(P)}catch(V){const N=V instanceof Error?V:new Error(String(V));e||i(N),u.error(N);return}e||(e=!0,r(R));return}if(P.status==="error"||P.status==="exited"){const R=new Error(P.error??`ACP bridge ${P.status}`);e||i(R),u.error(R)}return;case"acp-bridge-message":u.enqueue(P.message);return}},m=()=>{var I;if(h)return;h=!0;const x=new Error("ACP bridge websocket closed");e||i(x),(I=n.onDisconnect)==null||I.call(n,x),u.close()},E=()=>{var I;if(h)return;h=!0;const x=new Error("ACP bridge websocket error");e||i(x),(I=n.onDisconnect)==null||I.call(n,x),u.error(x)};t.addEventListener("open",f),t.addEventListener("message",y),t.addEventListener("close",m),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 wz(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 Sz(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 _z(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 Su(n){return n instanceof Error?n.message:String(n)}const jg="television.acpClientGUID",Bg="television.acpMappedSessions",Gg=1;var Hi;class kz{constructor(){S(this,Hi,new Map)}getActualSessionId(t){return l(this,Hi).get(t)??null}setActualSessionId(t,e){l(this,Hi).set(t,e)}clearActualSessionId(t){l(this,Hi).delete(t)}}Hi=new WeakMap;var Zi,Ao,pt,hl,dl,fh;class xz{constructor(t,e){S(this,pt);S(this,Zi);S(this,Ao);w(this,Zi,t),w(this,Ao,e)}getActualSessionId(t){const e=p(this,pt,dl).call(this)[p(this,pt,hl).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=p(this,pt,dl).call(this);r[p(this,pt,hl).call(this,t)]=e,p(this,pt,fh).call(this,r)}clearActualSessionId(t){const e=p(this,pt,dl).call(this);delete e[p(this,pt,hl).call(this,t)],p(this,pt,fh).call(this,e)}}Zi=new WeakMap,Ao=new WeakMap,pt=new WeakSet,hl=function(t){return JSON.stringify([l(this,Ao),t])},dl=function(){const t=l(this,Zi).getItem(Bg);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!==Gg?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},fh=function(t){const e={version:Gg,entries:t};l(this,Zi).setItem(Bg,JSON.stringify(e))};function Ez(){return typeof window>"u"?null:window.localStorage}function Az(n){const t=n.getItem(jg);if(t)return t;const e=Ud().toLowerCase();return n.setItem(jg,e),e}const qg=4401,$z=401,Ba=1e3,Tz=3e4;class to extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class iw extends Ot{constructor(e){var i,s;super();g(this,"url");g(this,"name");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,"createSocket");g(this,"createClient");g(this,"socket",null);g(this,"connectAttempt",0);g(this,"autoReconnect",!1);g(this,"retryTimer",null);g(this,"retryDelay",Ba);g(this,"visibilityEventTarget");g(this,"networkEventTarget");g(this,"onVisibilityChange");g(this,"onNetworkOnline");this.url=he(e.url),this.name=e.name,this._token=e.token??null,this.createSocket=e.createSocket??(o=>new WebSocket(o)),this.createClient=e.createClient??((o,a)=>new S$(o,{token:a??void 0,onUnauthorized:()=>this.handleAuthRejected()})),this.client=this.createClient(this.url,this._token);const r=e.mappedSessionStore??(e.acpStorage?new xz(e.acpStorage,this.url):new kz);this.acpClient=new fz({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()},(i=this.visibilityEventTarget)==null||i.addEventListener("visibilitychange",this.onVisibilityChange),(s=this.networkEventTarget)==null||s.addEventListener("online",this.onNetworkOnline)}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null)}async connect(e){this._token=e,this.hasAuthRejected=!1,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Ba,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i;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),this.acpClient.dispose()}getViewURL(e){const r=zl(e,{electron:ln()});return ln()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(e){const r=zl(e,{electron:ln()}).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 Hs("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new Hs("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new Hs("screens-changed"));break;case"artifact-created":{const r=this.screens.get(e.screenID);r&&!sl(r).includes(e.artifact.id)&&(r.layout=[...r.layout,ly(e.artifact.id)]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=Xv(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return Iz(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1;const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token),this.setStatus("disconnected"),this.dispatchEvent(new oe("change"));const r=this.createSocket(Cz(this.url,this._token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==e||(a=!0,this.retryDelay=Ba,this.hasEverConnected=!0,this.setStatus("connected"),s())},u=f=>{a||this.connectAttempt!==e||(a=!0,o(f))},h=async()=>{const f=this.hasEverConnected;try{const[{screens:y},m]=await Promise.all([this.client.screens.list(),this.client.display.get()]);this.screens=new Map(y.map(E=>[E.id,structuredClone(E)])),this.acpClient.setEnabled(m.acpEnabled),this.dispatchEvent(new oe("change")),f&&this.dispatchEvent(new Hs("screens-changed")),this.dispatchEvent(new Xu("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:m.activeScreenID}})),c(),f&&this.connectAttempt===e&&this.dispatchEvent(new Kv("server-reconnected",{serverURL:this.url}))}catch(y){if(Dz(y)){u(new to);return}u(y instanceof Error?y:new Error(String(y)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",f=>{const y=Pz(f);y&&(this.applyServerEvent(y),this.dispatchEvent(new Xu("server-event",{serverURL:this.url,event:y})))}),r.addEventListener("close",f=>{if(this.connectAttempt!==e)return;this.socket=null;const y=Rz(f);if(!a){u(y===qg?new to:new Error("Connection closed before initialization"));return}if(y===qg){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 to){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,Tz),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new oe("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new oe("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Ba,this.attempt().catch(()=>{})))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new oe("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function Iz(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function Cz(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/events",e.search="",t&&e.searchParams.set("token",t),e.hash="",e.toString()}function Rz(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function Pz(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;try{return JSON.parse(t)}catch{return null}}function Dz(n){return n instanceof Nd&&n.status===$z}const Lz="Local";var $o,gh;class zz extends Ot{constructor(e){super();S(this,$o);g(this,"servers",new Map);g(this,"localServerURL");g(this,"clientGUID");g(this,"acpStorage");g(this,"localStore");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 oe("change")))});this.localStore=e.localStore,this.localServerURL=e.localServerURL?he(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?Ez():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?Az(r):Ud().toLowerCase()),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=he(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e);const s=()=>{this.dispatchEvent(new oe("change"))},o=u=>{this.dispatchEvent(new Xu("server-event",{serverURL:u.serverURL,event:u.event}))},a=()=>{this.dispatchEvent(new Hs("screens-changed"))},c=u=>{this.dispatchEvent(new Kv("server-reconnected",{serverURL:u.serverURL}))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),e.addEventListener("server-reconnected",c),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a,onServerReconnected:c}),this.dispatchEvent(new oe("change"))}remove(e){const r=he(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),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 oe("change"))}getStoredAuthToken(e){return vu(this.localStore.get(),e)}setStoredAuthToken(e,r){this.localStore.set(R$(this.localStore.get(),e,r))}clearStoredAuthToken(e){const r=this.localStore.get(),i=P$(r,e);i!==r&&this.localStore.set(i)}setActive(e){const r=this.localStore.get(),i=e?he(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?he(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>he(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:Lz}]})}const s=this.localStore.get().servers;for(const a of s){const c=he(a.url),h=i!==null&&c===i?r??vu(this.localStore.get(),c):vu(this.localStore.get(),c),f=p(this,$o,gh).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=he(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>he(a.url)!==i),{url:i,name:r}]});const o=p(this,$o,gh).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)}}$o=new WeakSet,gh=function(e){return new iw({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var To;class Oz extends Ot{constructor(){super();S(this,To,e=>{const r=Mz(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new J1("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,To))}dispose(){document.removeEventListener("keydown",l(this,To))}}To=new WeakMap;function Mz(n){for(const[t,e]of Object.entries(_$))if(Nz(n,e.trigger))return t;return null}function Nz(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 mh="tv-nav:",Ol="tv-reload",Yg=100,Uz=1e3,Fz=60,Hz=60,Zz=24,Wz=30,Vz=Wz*Zz*Hz*Fz*Uz;function In(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Ol);return t.searchParams.delete(Ol),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Io,Wi,ue,re,Pr,ke,sw,On,ow,vh,yh;class jz extends Ot{constructor(e,r){super();S(this,ke);S(this,Io);S(this,Wi);S(this,ue,[]);S(this,re,-1);S(this,Pr,0);w(this,Io,e),w(this,Wi,In(r)),p(this,ke,sw).call(this)}get currentURL(){var e;return l(this,re)===-1?null:((e=l(this,ue)[l(this,re)])==null?void 0:e.url)??null}get canGoBack(){return l(this,re)>-1}get canGoForward(){return l(this,re)<l(this,ue).length-1}get entries(){return l(this,ue).map(e=>({...e}))}get cursor(){return l(this,re)}navigate(e){const r=In(e);if(r===l(this,Wi)){if(l(this,re)===-1)return;w(this,re,-1),p(this,ke,On).call(this);return}l(this,re)<l(this,ue).length-1&&w(this,ue,l(this,ue).slice(0,l(this,re)+1)),l(this,ue).push({url:r}),w(this,re,l(this,ue).length-1),p(this,ke,vh).call(this),p(this,ke,On).call(this)}replace(e){var i;if(l(this,re)===-1){this.navigate(e);return}const r=In(e);if(r===l(this,Wi)){w(this,ue,l(this,ue).filter((s,o)=>o!==l(this,re))),w(this,re,-1),p(this,ke,On).call(this);return}((i=l(this,ue)[l(this,re)])==null?void 0:i.url)!==r&&(w(this,ue,l(this,ue).map((s,o)=>o===l(this,re)?{url:r}:s)),p(this,ke,On).call(this))}back(){l(this,re)!==-1&&(w(this,re,l(this,re)-1),p(this,ke,On).call(this))}forward(){this.canGoForward&&(w(this,re,l(this,re)+1),p(this,ke,On).call(this))}reset(){l(this,re)===-1&&l(this,ue).length===0||(w(this,ue,[]),w(this,re,-1),p(this,ke,On).call(this))}}Io=new WeakMap,Wi=new WeakMap,ue=new WeakMap,re=new WeakMap,Pr=new WeakMap,ke=new WeakSet,sw=function(){const e=localStorage.getItem(l(this,ke,yh));if(e!==null)try{const r=JSON.parse(e);if(!aw(r))return;w(this,ue,r.entries.map(i=>({url:i.url}))),w(this,re,r.cursor),w(this,Pr,r.lastWritten),p(this,ke,vh).call(this)}catch{w(this,ue,[]),w(this,re,-1),w(this,Pr,0)}},On=function(){w(this,Pr,Date.now());try{localStorage.setItem(l(this,ke,yh),JSON.stringify(p(this,ke,ow).call(this)))}catch(e){if(!qz(e))throw e}this.dispatchEvent(new oe("change"))},ow=function(){return{v:1,entries:l(this,ue).map(e=>({...e})),cursor:l(this,re),lastWritten:l(this,Pr)}},vh=function(){if(l(this,ue).length<=Yg)return;const e=l(this,ue).length-Yg;w(this,ue,l(this,ue).slice(e)),w(this,re,Math.max(-1,l(this,re)-e))},yh=function(){return Bz(l(this,Io))};function Bz(n){return`${mh}${n}`}function Gz(n){const t=Date.now()-Vz,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(mh)))continue;const s=i.slice(mh.length),o=localStorage.getItem(i);if(o===null)continue;let a;try{a=JSON.parse(o)}catch{e.push(i);continue}if(!aw(a)){e.push(i);continue}!n.has(s)&&a.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function qz(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function aw(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")}let zn=null;async function lw(n,t){if(zn==null||zn.abort(),n===null){zn=null,Cl();return}const e=new AbortController;zn=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(zn!==e)return;Yv(o)}catch(r){if(r.name==="AbortError")return;Cl();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{zn===e&&(zn=null)}}/**
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 m=(c=n.external.registry.get(h[0]))==null?void 0:c.id;if(t!==h[0]&&m){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 By(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,y={...f},m=h.ref;if(h.ref=null,m){r(m);const x=n.seen.get(m),I=x.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(I)):Object.assign(f,I),Object.assign(f,y),u._zod.parent===m)for(const R in f)R==="$ref"||R==="allOf"||R in y||delete f[R];if(I.$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!==m){r(E);const x=n.seen.get(E);if(x!=null&&x.schema.$ref&&(f.$ref=x.schema.$ref,x.def))for(const I in f)I==="$ref"||I==="allOf"||I in x.def&&JSON.stringify(f[I])===JSON.stringify(x.def[I])&&delete f[I]}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:Ll(t,"input",n.processors),output:Ll(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Ke(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 Ke(r.element,e);if(r.type==="set")return Ke(r.valueType,e);if(r.type==="lazy")return Ke(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 Ke(r.innerType,e);if(r.type==="intersection")return Ke(r.left,e)||Ke(r.right,e);if(r.type==="record"||r.type==="map")return Ke(r.keyType,e)||Ke(r.valueType,e);if(r.type==="pipe")return Ke(r.in,e)||Ke(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Ke(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Ke(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Ke(i,e))return!0;return!!(r.rest&&Ke(r.rest,e))}return!1}const BC=(n,t={})=>e=>{const r=Vy({...e,processors:t});return Ee(n,r),jy(r,n),By(r,n)},Ll=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Vy({...i??{},target:s,io:t,processors:e});return Ee(n,o),jy(o,n),By(o,n)},GC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qC=(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=GC[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}))])}},YC=(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)},KC=(n,t,e,r)=>{e.type="boolean"},JC=(n,t,e,r)=>{e.not={}},XC=(n,t,e,r)=>{},QC=(n,t,e,r)=>{const i=n._zod.def,s=ky(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},eR=(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},tR=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},nR=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},rR=(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=Ee(s.element,t,{...r,path:[...r.path,"items"]})},iR=(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]=Ee(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=Ee(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},sR=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>Ee(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=o:e.anyOf=o},oR=(n,t,e,r)=>{const i=n._zod.def,s=Ee(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=Ee(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},aR=(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=Ee(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=Ee(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Ee(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)}},lR=(n,t,e,r)=>{const i=n._zod.def,s=Ee(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"}]},cR=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},uR=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},hR=(n,t,e,r)=>{const i=n._zod.def;Ee(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)))},dR=(n,t,e,r)=>{const i=n._zod.def;Ee(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},pR=(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;Ee(s,t,r);const o=t.seen.get(n);o.ref=s},fR=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},Gy=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},gR=A("ZodISODateTime",(n,t)=>{mI.init(n,t),be.init(n,t)});function mR(n){return _C(gR,n)}const vR=A("ZodISODate",(n,t)=>{vI.init(n,t),be.init(n,t)});function yR(n){return kC(vR,n)}const bR=A("ZodISOTime",(n,t)=>{yI.init(n,t),be.init(n,t)});function wR(n){return xC(bR,n)}const SR=A("ZodISODuration",(n,t)=>{bI.init(n,t),be.init(n,t)});function _R(n){return EC(SR,n)}const qy=(n,t)=>{$y.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>cT(n,e)},flatten:{value:e=>lT(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,ih,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,ih,2)}},isEmpty:{get(){return n.issues.length===0}}})},Ug=A("ZodError",qy),xt=A("ZodError",qy,{Parent:Error}),kR=Vd(xt),xR=jd(xt),ER=mc(xt),AR=vc(xt),$R=dT(xt),TR=pT(xt),IR=fT(xt),CR=gT(xt),RR=mT(xt),PR=vT(xt),DR=yT(xt),LR=bT(xt),ye=A("ZodType",(n,t)=>(ve.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Ll(n,"input"),output:Ll(n,"output")}}),n.toJSONSchema=BC(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(or(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)=>ar(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>kR(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>ER(n,e,r),n.parseAsync=async(e,r)=>xR(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>AR(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>$R(n,e,r),n.decode=(e,r)=>TR(n,e,r),n.encodeAsync=async(e,r)=>IR(n,e,r),n.decodeAsync=async(e,r)=>CR(n,e,r),n.safeEncode=(e,r)=>RR(n,e,r),n.safeDecode=(e,r)=>PR(n,e,r),n.safeEncodeAsync=async(e,r)=>DR(n,e,r),n.safeDecodeAsync=async(e,r)=>LR(n,e,r),n.refine=(e,r)=>n.check(AP(e,r)),n.superRefine=e=>n.check($P(e)),n.overwrite=e=>n.check(Ss(e)),n.optional=()=>Zg(n),n.exactOptional=()=>pP(n),n.nullable=()=>Wg(n),n.nullish=()=>Zg(Wg(n)),n.nonoptional=e=>bP(n,e),n.array=()=>z(n),n.or=e=>j([n,e]),n.and=e=>bc(n,e),n.transform=e=>Vg(n,hP(e)),n.default=e=>mP(n,e),n.prefault=e=>yP(n,e),n.catch=e=>SP(n,e),n.pipe=e=>Vg(n,e),n.readonly=()=>xP(n),n.describe=e=>{const r=n.clone();return Ws.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=Ws.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return Ws.get(n);const r=n.clone();return Ws.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),Yy=A("_ZodString",(n,t)=>{Bd.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(r,i,s)=>qC(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(RC(...r)),n.includes=(...r)=>n.check(LC(...r)),n.startsWith=(...r)=>n.check(zC(...r)),n.endsWith=(...r)=>n.check(OC(...r)),n.min=(...r)=>n.check(Dl(...r)),n.max=(...r)=>n.check(Zy(...r)),n.length=(...r)=>n.check(Wy(...r)),n.nonempty=(...r)=>n.check(Dl(1,...r)),n.lowercase=r=>n.check(PC(r)),n.uppercase=r=>n.check(DC(r)),n.trim=()=>n.check(NC()),n.normalize=(...r)=>n.check(MC(...r)),n.toLowerCase=()=>n.check(UC()),n.toUpperCase=()=>n.check(FC()),n.slugify=()=>n.check(HC())}),zR=A("ZodString",(n,t)=>{Bd.init(n,t),Yy.init(n,t),n.email=e=>n.check(tC(OR,e)),n.url=e=>n.check(oC(MR,e)),n.jwt=e=>n.check(SC(XR,e)),n.emoji=e=>n.check(aC(NR,e)),n.guid=e=>n.check(zg(Fg,e)),n.uuid=e=>n.check(nC(ja,e)),n.uuidv4=e=>n.check(rC(ja,e)),n.uuidv6=e=>n.check(iC(ja,e)),n.uuidv7=e=>n.check(sC(ja,e)),n.nanoid=e=>n.check(lC(UR,e)),n.guid=e=>n.check(zg(Fg,e)),n.cuid=e=>n.check(cC(FR,e)),n.cuid2=e=>n.check(uC(HR,e)),n.ulid=e=>n.check(hC(ZR,e)),n.base64=e=>n.check(yC(YR,e)),n.base64url=e=>n.check(bC(KR,e)),n.xid=e=>n.check(dC(WR,e)),n.ksuid=e=>n.check(pC(VR,e)),n.ipv4=e=>n.check(fC(jR,e)),n.ipv6=e=>n.check(gC(BR,e)),n.cidrv4=e=>n.check(mC(GR,e)),n.cidrv6=e=>n.check(vC(qR,e)),n.e164=e=>n.check(wC(JR,e)),n.datetime=e=>n.check(mR(e)),n.date=e=>n.check(yR(e)),n.time=e=>n.check(wR(e)),n.duration=e=>n.check(_R(e))});function d(n){return eC(zR,n)}const be=A("ZodStringFormat",(n,t)=>{ge.init(n,t),Yy.init(n,t)}),OR=A("ZodEmail",(n,t)=>{aI.init(n,t),be.init(n,t)}),Fg=A("ZodGUID",(n,t)=>{sI.init(n,t),be.init(n,t)}),ja=A("ZodUUID",(n,t)=>{oI.init(n,t),be.init(n,t)}),MR=A("ZodURL",(n,t)=>{lI.init(n,t),be.init(n,t)}),NR=A("ZodEmoji",(n,t)=>{cI.init(n,t),be.init(n,t)}),UR=A("ZodNanoID",(n,t)=>{uI.init(n,t),be.init(n,t)}),FR=A("ZodCUID",(n,t)=>{hI.init(n,t),be.init(n,t)}),HR=A("ZodCUID2",(n,t)=>{dI.init(n,t),be.init(n,t)}),ZR=A("ZodULID",(n,t)=>{pI.init(n,t),be.init(n,t)}),WR=A("ZodXID",(n,t)=>{fI.init(n,t),be.init(n,t)}),VR=A("ZodKSUID",(n,t)=>{gI.init(n,t),be.init(n,t)}),jR=A("ZodIPv4",(n,t)=>{wI.init(n,t),be.init(n,t)}),BR=A("ZodIPv6",(n,t)=>{SI.init(n,t),be.init(n,t)}),GR=A("ZodCIDRv4",(n,t)=>{_I.init(n,t),be.init(n,t)}),qR=A("ZodCIDRv6",(n,t)=>{kI.init(n,t),be.init(n,t)}),YR=A("ZodBase64",(n,t)=>{xI.init(n,t),be.init(n,t)}),KR=A("ZodBase64URL",(n,t)=>{AI.init(n,t),be.init(n,t)}),JR=A("ZodE164",(n,t)=>{$I.init(n,t),be.init(n,t)}),XR=A("ZodJWT",(n,t)=>{II.init(n,t),be.init(n,t)}),Ky=A("ZodNumber",(n,t)=>{My.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(r,i,s)=>YC(n,r,i),n.gt=(r,i)=>n.check(Mg(r,i)),n.gte=(r,i)=>n.check(wu(r,i)),n.min=(r,i)=>n.check(wu(r,i)),n.lt=(r,i)=>n.check(Og(r,i)),n.lte=(r,i)=>n.check(bu(r,i)),n.max=(r,i)=>n.check(bu(r,i)),n.int=r=>n.check(Hg(r)),n.safe=r=>n.check(Hg(r)),n.positive=r=>n.check(Mg(0,r)),n.nonnegative=r=>n.check(wu(0,r)),n.negative=r=>n.check(Og(0,r)),n.nonpositive=r=>n.check(bu(0,r)),n.multipleOf=(r,i)=>n.check(Ng(r,i)),n.step=(r,i)=>n.check(Ng(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 H(n){return AC(Ky,n)}const QR=A("ZodNumberFormat",(n,t)=>{CI.init(n,t),Ky.init(n,t)});function Hg(n){return $C(QR,n)}const eP=A("ZodBoolean",(n,t)=>{RI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>KC(n,e,r)});function Le(n){return TC(eP,n)}const tP=A("ZodUnknown",(n,t)=>{PI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>XC()});function _(){return IC(tP)}const nP=A("ZodNever",(n,t)=>{DI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>JC(n,e,r)});function rP(n){return CC(nP,n)}const iP=A("ZodArray",(n,t)=>{LI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>rR(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Dl(e,r)),n.nonempty=e=>n.check(Dl(1,e)),n.max=(e,r)=>n.check(Zy(e,r)),n.length=(e,r)=>n.check(Wy(e,r)),n.unwrap=()=>n.element});function z(n,t){return ZC(iP,n,t)}const Jy=A("ZodObject",(n,t)=>{OI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>iR(n,e,r,i),te(n,"shape",()=>t.shape),n.keyof=()=>eb(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:rP()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>rT(n,e),n.safeExtend=e=>iT(n,e),n.merge=e=>sT(n,e),n.pick=e=>tT(n,e),n.omit=e=>nT(n,e),n.partial=(...e)=>oT(tb,n,e[0]),n.required=(...e)=>aT(nb,n,e[0])});function Xy(n,t){const e={type:"object",shape:n??{},...O(t)};return new Jy(e)}function v(n,t){return new Jy({type:"object",shape:n,catchall:_(),...O(t)})}const Qy=A("ZodUnion",(n,t)=>{Fy.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>sR(n,e,r,i),n.options=t.options});function j(n,t){return new Qy({type:"union",options:n,...O(t)})}const sP=A("ZodDiscriminatedUnion",(n,t)=>{Qy.init(n,t),MI.init(n,t)});function oP(n,t,e){return new sP({type:"union",options:t,discriminator:n,...O(e)})}const aP=A("ZodIntersection",(n,t)=>{NI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>oR(n,e,r,i)});function bc(n,t){return new aP({type:"intersection",left:n,right:t})}const lP=A("ZodRecord",(n,t)=>{UI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>aR(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function k(n,t,e){return new lP({type:"record",keyType:n,valueType:t,...O(e)})}const oh=A("ZodEnum",(n,t)=>{FI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(r,i,s)=>QC(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 oh({...t,checks:[],...O(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 oh({...t,checks:[],...O(i),entries:s})}});function eb(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new oh({type:"enum",entries:e,...O(t)})}const cP=A("ZodLiteral",(n,t)=>{HI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>eR(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 $(n,t){return new cP({type:"literal",values:Array.isArray(n)?n:[n],...O(t)})}const uP=A("ZodTransform",(n,t)=>{ZI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>nR(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new Sy(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(co(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(co(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function hP(n){return new uP({type:"transform",transform:n})}const tb=A("ZodOptional",(n,t)=>{Hy.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Gy(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Zg(n){return new tb({type:"optional",innerType:n})}const dP=A("ZodExactOptional",(n,t)=>{WI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Gy(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function pP(n){return new dP({type:"optional",innerType:n})}const fP=A("ZodNullable",(n,t)=>{VI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>lR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Wg(n){return new fP({type:"nullable",innerType:n})}const gP=A("ZodDefault",(n,t)=>{jI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>uR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function mP(n,t){return new gP({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():Ey(t)}})}const vP=A("ZodPrefault",(n,t)=>{BI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>hR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function yP(n,t){return new vP({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():Ey(t)}})}const nb=A("ZodNonOptional",(n,t)=>{GI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>cR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function bP(n,t){return new nb({type:"nonoptional",innerType:n,...O(t)})}const wP=A("ZodCatch",(n,t)=>{qI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>dR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function SP(n,t){return new wP({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const _P=A("ZodPipe",(n,t)=>{YI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>pR(n,e,r,i),n.in=t.in,n.out=t.out});function Vg(n,t){return new _P({type:"pipe",in:n,out:t})}const kP=A("ZodReadonly",(n,t)=>{KI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>fR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function xP(n){return new kP({type:"readonly",innerType:n})}const EP=A("ZodCustom",(n,t)=>{JI.init(n,t),ye.init(n,t),n._zod.processJSONSchema=(e,r,i)=>tR(n,e)});function AP(n,t={}){return WC(EP,n,t)}function $P(n){return VC(n)}const TP=[".md",".markdown"];function rb(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function ib(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function IP(n){return ib(n).toLowerCase()}function CP(n,t){const e=IP(n);return t.some(r=>e.endsWith(r))}function sb(n){return!rb(n)&&CP(n,TP)}function RP(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function mn(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const PP=Xy({id:d().min(1),kind:$("path"),title:d(),path:d()}).strict(),DP=Xy({id:d().min(1),kind:$("url"),title:d(),url:d().refine(RP,{message:"url must be an http(s) URL"})}).strict();oP("kind",[PP,DP]);function ob(n){return typeof n=="object"&&n!==null}function ab(n){return!ob(n)||n.type!=="ready"?!1:!("id"in n)}function lb(n){return!(!ob(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const LP="/views/markdown/",zP="/views/url-unsupported/";function cb(n){return`/artifact/${encodeURIComponent(n)}`}function OP(n,t){return`${cb(n)}/${encodeURIComponent(t)}`}function MP(n){return`/markdown/${encodeURIComponent(n)}`}function zl(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:mn(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:zP,contentURL:null};if(sb(n.path)){const r={viewURL:LP,contentURL:MP(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=rb(n.path)?`${cb(n.id)}/`:OP(n.id,ib(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const NP="serverURL",UP="token",FP="mode",HP="electron";function ub(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(NP);return r?new URL(r).origin:new URL(t).origin}function ZP(n=window.location.search){return new URLSearchParams(n).get(UP)}function ln(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(FP)===HP}const pe={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"},gn={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"},WP=1,VP=v({_meta:k(d(),_()).nullish(),terminal:Le().optional().default(!1)}),jP=v({_meta:k(d(),_()).nullish(),label:d().nullish(),name:d(),optional:Le().optional().default(!1),secret:Le().optional().default(!0)}),BP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),name:d()}),GP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:z(jP)}),qP=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),description:d().nullish(),env:k(d(),d()).optional(),id:d(),name:d()}),YP=j([GP.and(v({type:$("env_var")})),qP.and(v({type:$("terminal")})),BP]),KP=v({_meta:k(d(),_()).nullish(),methodId:d()}),JP=v({_meta:k(d(),_()).nullish()}),XP=v({_meta:k(d(),_()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),QP=v({default:Le().nullish(),description:d().nullish(),title:d().nullish()}),eD=v({_meta:k(d(),_()).nullish()}),tD=v({_meta:k(d(),_()).nullish()}),nD=v({amount:H(),currency:d()}),rD=v({_meta:k(d(),_()).nullish(),terminalId:d()}),iD=v({_meta:k(d(),_()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),sD=j([d(),H(),H(),Le(),z(d())]),oD=v({content:k(d(),sD).nullish()}),aD=j([oD.and(v({action:$("accept")})),v({action:$("decline")}),v({action:$("cancel")})]),lD=v({_meta:k(d(),_()).nullish()}),hb=d(),cD=v({_meta:k(d(),_()).nullish(),elicitationId:hb}),uD=v({_meta:k(d(),_()).nullish(),action:aD}),hD=$("object"),dD=$("string"),pD=v({_meta:k(d(),_()).nullish()}),fD=v({_meta:k(d(),_()).nullish(),form:lD.nullish(),url:pD.nullish()}),gD=v({elicitationId:hb,url:d().url()}),db=v({const:d(),title:d()}),pb=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),mD=j([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),H().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),fb=v({code:mD,data:_().optional(),message:d()}),gb=_(),mb=_(),vb=_(),vD=v({_meta:k(d(),_()).nullish(),readTextFile:Le().optional().default(!1),writeTextFile:Le().optional().default(!1)}),yb=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),bb=v({_meta:k(d(),_()).nullish(),name:d(),title:d().nullish(),version:d()}),yD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),bD=v({_meta:k(d(),_()).nullish()}),wD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),SD=v({_meta:k(d(),_()).nullish()}),_D=v({_meta:k(d(),_()).nullish(),logout:SD.nullish()}),kD=v({_meta:k(d(),_()).nullish()}),xD=v({_meta:k(d(),_()).nullish()}),ED=v({_meta:k(d(),_()).nullish(),http:Le().optional().default(!1),sse:Le().optional().default(!1)}),AD=v({_meta:k(d(),_()).nullish(),headers:z(yb),name:d(),url:d()}),$D=v({_meta:k(d(),_()).nullish(),headers:z(yb),name:d(),url:d()}),TD=v({_meta:k(d(),_()).nullish(),args:z(d()),command:d(),env:z(pb),name:d()}),wc=j([AD.and(v({type:$("http")})),$D.and(v({type:$("sse")})),TD]),Gd=d(),ID=v({_meta:k(d(),_()).nullish(),description:d().nullish(),modelId:Gd,name:d()}),CD=j([$("error"),$("warning"),$("information"),$("hint")]),RD=v({_meta:k(d(),_()).nullish()}),PD=v({_meta:k(d(),_()).nullish()}),DD=v({_meta:k(d(),_()).nullish()}),LD=v({_meta:k(d(),_()).nullish()}),zD=v({_meta:k(d(),_()).nullish()}),OD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),MD=v({diff:d(),uri:d()}),ND=v({endLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),UD=v({_meta:k(d(),_()).nullish()}),FD=v({_meta:k(d(),_()).nullish()}),HD=v({languageId:d(),text:d(),uri:d()}),ZD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),WD=j([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),VD=v({excerpts:z(ND),uri:d()}),jD=v({_meta:k(d(),_()).nullish()}),BD=v({_meta:k(d(),_()).nullish()}),GD=v({name:d(),owner:d(),remoteUrl:d()}),qD=v({_meta:k(d(),_()).nullish()}),YD=v({_meta:k(d(),_()).nullish(),jump:UD.nullish(),rename:BD.nullish(),searchAndReplace:qD.nullish()}),KD=v({id:d(),isRegex:Le().nullish(),replace:d(),search:d(),uri:d()}),JD=j([$("automatic"),$("diagnostic"),$("manual")]),XD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),QD=v({_meta:k(d(),_()).nullish(),diagnostics:RD.nullish(),editHistory:OD.nullish(),openFiles:FD.nullish(),recentFiles:ZD.nullish(),relatedSnippets:jD.nullish(),userActions:XD.nullish()}),eL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc)}),tL=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),wb=d(),nL=j([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),rL=v({_meta:k(d(),_()).nullish(),kind:nL,name:d(),optionId:wb}),iL=j([$("high"),$("medium"),$("low")]),sL=j([$("pending"),$("in_progress"),$("completed")]),oL=v({_meta:k(d(),_()).nullish(),content:d(),priority:iL,status:sL}),aL=v({_meta:k(d(),_()).nullish(),entries:z(oL)}),nr=v({character:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),lL=v({id:d(),position:nr,uri:d()}),cL=v({id:d(),newName:d(),position:nr,uri:d()}),uL=v({action:d(),position:nr,timestampMs:H(),uri:d()}),Sb=j([$("utf-16"),$("utf-32"),$("utf-8")]),hL=v({_meta:k(d(),_()).nullish(),auth:VP.optional().default({terminal:!1}),elicitation:fD.nullish(),fs:vD.optional().default({readTextFile:!1,writeTextFile:!1}),nes:YD.nullish(),positionEncodings:z(Sb).optional(),terminal:Le().optional().default(!1)}),dL=v({_meta:k(d(),_()).nullish(),audio:Le().optional().default(!1),embeddedContext:Le().optional().default(!1),image:Le().optional().default(!1)}),_b=H().int().gte(0).lte(65535),pL=v({_meta:k(d(),_()).nullish(),clientCapabilities:hL.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:bb.nullish(),protocolVersion:_b}),_s=v({end:nr,start:nr}),fL=v({message:d(),range:_s,severity:CD,uri:d()}),gL=v({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:_s.nullish()}),mL=v({_meta:k(d(),_()).nullish(),diagnostics:z(fL).nullish(),editHistory:z(MD).nullish(),openFiles:z(gL).nullish(),recentFiles:z(HD).nullish(),relatedSnippets:z(VD).nullish(),userActions:z(uL).nullish()}),vL=v({newText:d(),range:_s}),yL=v({cursorPosition:nr.nullish(),edits:z(vL),id:d(),uri:d()}),bL=j([yL.and(v({kind:$("edit")})),lL.and(v({kind:$("jump")})),cL.and(v({kind:$("rename")})),KD.and(v({kind:$("searchAndReplace")}))]),wL=v({_meta:k(d(),_()).nullish(),content:d()}),SL=v({_meta:k(d(),_()).nullish()}),Gr=j([H(),d()]).nullable();v({_meta:k(d(),_()).nullish(),requestId:Gr});const _L=eb(["assistant","user"]),Sa=v({_meta:k(d(),_()).nullish(),audience:z(_L).nullish(),lastModified:d().nullish(),priority:H().nullish()}),kL=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),data:d(),mimeType:d()}),xL=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),EL=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),AL=v({_meta:k(d(),_()).nullish(),optionId:wb}),$L=j([v({outcome:$("cancelled")}),AL.and(v({outcome:$("selected")}))]),TL=v({_meta:k(d(),_()).nullish(),outcome:$L}),IL=v({_meta:k(d(),_()).nullish()}),CL=v({_meta:k(d(),_()).nullish()}),RL=v({currentValue:Le()}),PL=d(),kb=d(),DL=j([$("mode"),$("model"),$("thought_level"),d()]),qd=d(),xb=v({_meta:k(d(),_()).nullish(),description:d().nullish(),name:d(),value:qd}),LL=v({_meta:k(d(),_()).nullish(),group:PL,name:d(),options:z(xb)}),zL=j([z(xb),z(LL)]),OL=v({currentValue:qd,options:zL}),ks=bc(j([OL.and(v({type:$("select")})),RL.and(v({type:$("boolean")}))]),v({_meta:k(d(),_()).nullish(),category:DL.nullish(),description:d().nullish(),id:kb,name:d()})),ML=v({_meta:k(d(),_()).nullish(),configOptions:z(ks)}),NL=v({_meta:k(d(),_()).nullish()}),Q=d(),UL=v({_meta:k(d(),_()).nullish(),id:d(),sessionId:Q}),FL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),HL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),ZL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),Eb=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),command:d(),cwd:d().nullish(),env:z(pb).optional(),outputByteLimit:H().nullish(),sessionId:Q}),WL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),VL=v({_meta:k(d(),_()).nullish(),position:nr,sessionId:Q,uri:d(),version:H(),visibleRange:_s}),jL=v({_meta:k(d(),_()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),BL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),GL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc).optional(),sessionId:Q}),Ab=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),qL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc),sessionId:Q}),$b=v({_meta:k(d(),_()).nullish(),limit:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:Q}),YL=v({_meta:k(d(),_()).nullish(),id:d(),reason:WD.nullish(),sessionId:Q}),Tb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),KL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(wc).optional(),sessionId:Q}),JL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),XL=v({_meta:k(d(),_()).nullish(),nextCursor:d().nullish(),sessions:z(JL)}),QL=v({_meta:k(d(),_()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),e2=v({_meta:k(d(),_()).nullish()}),Sc=d(),t2=v({_meta:k(d(),_()).nullish(),currentModeId:Sc}),n2=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:Sc,name:d()}),_c=v({_meta:k(d(),_()).nullish(),availableModes:z(n2),currentModeId:Sc}),kc=v({_meta:k(d(),_()).nullish(),availableModels:z(ID),currentModelId:Gd}),r2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish(),sessionId:Q}),i2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish()}),s2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish(),sessionId:Q}),o2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks).nullish(),models:kc.nullish(),modes:_c.nullish()}),a2=v({_meta:k(d(),_()).nullish()}),l2=v({_meta:k(d(),_()).nullish(),additionalDirectories:IL.nullish(),close:CL.nullish(),fork:NL.nullish(),list:e2.nullish(),resume:a2.nullish()}),c2=bc(j([v({type:$("boolean"),value:Le()}),v({value:qd})]),v({_meta:k(d(),_()).nullish(),configId:kb,sessionId:Q})),u2=v({_meta:k(d(),_()).nullish(),configOptions:z(ks)}),h2=v({_meta:k(d(),_()).nullish(),modeId:Sc,sessionId:Q}),d2=v({_meta:k(d(),_()).nullish()}),p2=v({_meta:k(d(),_()).nullish(),modelId:Gd,sessionId:Q}),f2=v({_meta:k(d(),_()).nullish()}),g2=v({_meta:k(d(),_()).nullish(),sessionId:Q}),m2=j([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),v2=j([$("email"),$("uri"),$("date"),$("date-time")]),y2=v({default:d().nullish(),description:d().nullish(),enum:z(d()).nullish(),format:v2.nullish(),maxLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:z(db).nullish(),pattern:d().nullish(),title:d().nullish()}),b2=v({_meta:k(d(),_()).nullish(),context:mL.nullish(),position:nr,selection:_s.nullish(),sessionId:Q,triggerKind:JD,uri:d(),version:H()}),w2=v({_meta:k(d(),_()).nullish(),suggestions:z(bL)}),S2=v({_meta:k(d(),_()).nullish(),terminalId:d()}),_2=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),Ib=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),k2=v({_meta:k(d(),_()).nullish(),exitStatus:_2.nullish(),output:d(),truncated:Le()}),x2=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),text:d()}),E2=v({range:_s.nullish(),text:d()}),A2=v({_meta:k(d(),_()).nullish(),contentChanges:z(E2),sessionId:Q,uri:d(),version:H()});v({method:d(),params:j([FL,jL,A2,WL,BL,VL,UL,YL,gb]).nullish()});const $2=j([$("full"),$("incremental")]),T2=v({_meta:k(d(),_()).nullish(),syncKind:$2}),I2=v({_meta:k(d(),_()).nullish(),didChange:T2.nullish(),didClose:PD.nullish(),didFocus:DD.nullish(),didOpen:LD.nullish(),didSave:zD.nullish()}),C2=v({_meta:k(d(),_()).nullish(),document:I2.nullish()}),R2=v({_meta:k(d(),_()).nullish(),context:QD.nullish(),events:C2.nullish()}),P2=v({_meta:k(d(),_()).nullish(),auth:_D.optional().default({}),loadSession:Le().optional().default(!1),mcpCapabilities:ED.optional().default({http:!1,sse:!1}),nes:R2.nullish(),positionEncoding:Sb.nullish(),promptCapabilities:dL.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:l2.optional().default({})}),D2=v({_meta:k(d(),_()).nullish(),agentCapabilities:P2.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:bb.nullish(),authMethods:z(YP).optional().default([]),protocolVersion:_b}),L2=v({_meta:k(d(),_()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),z2=j([L2,XP]),O2=v({_meta:k(d(),_()).nullish(),annotations:Sa.nullish(),resource:z2}),Yd=j([x2.and(v({type:$("text")})),xL.and(v({type:$("image")})),kL.and(v({type:$("audio")})),EL.and(v({type:$("resource_link")})),O2.and(v({type:$("resource")}))]),M2=v({_meta:k(d(),_()).nullish(),content:Yd}),Su=v({_meta:k(d(),_()).nullish(),content:Yd,messageId:d().nullish()}),N2=v({_meta:k(d(),_()).nullish(),messageId:d().nullish(),prompt:z(Yd),sessionId:Q}),U2=v({anyOf:z(db)}),Cb=j([M2.and(v({type:$("content")})),iD.and(v({type:$("diff")})),S2.and(v({type:$("terminal")}))]),Rb=d(),Pb=v({_meta:k(d(),_()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),Db=j([$("pending"),$("in_progress"),$("completed"),$("failed")]),Lb=j([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),F2=v({_meta:k(d(),_()).nullish(),content:z(Cb).optional(),kind:Lb.optional(),locations:z(Pb).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:Db.optional(),title:d(),toolCallId:Rb}),zb=v({_meta:k(d(),_()).nullish(),content:z(Cb).nullish(),kind:Lb.nullish(),locations:z(Pb).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:Db.nullish(),title:d().nullish(),toolCallId:Rb}),Ob=v({_meta:k(d(),_()).nullish(),options:z(rL),sessionId:Q,toolCall:zb}),H2=v({_meta:k(d(),_()).nullish(),hint:d()}),Z2=H2,W2=v({_meta:k(d(),_()).nullish(),description:d(),input:Z2.nullish(),name:d()}),V2=v({_meta:k(d(),_()).nullish(),availableCommands:z(W2)}),j2=v({enum:z(d()),type:dD}),B2=j([j2,U2]),G2=v({default:z(d()).nullish(),description:d().nullish(),items:B2,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),q2=j([y2.and(v({type:$("string")})),tL.and(v({type:$("number")})),yD.and(v({type:$("integer")})),QP.and(v({type:$("boolean")})),G2.and(v({type:$("array")}))]),Y2=v({description:d().nullish(),properties:k(d(),q2).optional().default({}),required:z(d()).nullish(),title:d().nullish(),type:hD.optional().default("object")}),K2=v({requestedSchema:Y2}),J2=bc(j([K2.and(v({mode:$("form")})),gD.and(v({mode:$("url")}))]),v({_meta:k(d(),_()).nullish(),message:d(),sessionId:Q})),X2=v({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),Q2=v({_meta:k(d(),_()).nullish(),stopReason:m2,usage:X2.nullish(),userMessageId:d().nullish()});j([v({id:Gr,result:j([D2,JP,xD,s2,i2,XL,r2,o2,tD,d2,u2,Q2,f2,g2,w2,eD,vb])}),v({error:fb,id:Gr})]);const ez=v({_meta:k(d(),_()).nullish(),cost:nD.nullish(),size:H(),used:H()}),tz=j([Su.and(v({sessionUpdate:$("user_message_chunk")})),Su.and(v({sessionUpdate:$("agent_message_chunk")})),Su.and(v({sessionUpdate:$("agent_thought_chunk")})),F2.and(v({sessionUpdate:$("tool_call")})),zb.and(v({sessionUpdate:$("tool_call_update")})),aL.and(v({sessionUpdate:$("plan")})),V2.and(v({sessionUpdate:$("available_commands_update")})),t2.and(v({sessionUpdate:$("current_mode_update")})),ML.and(v({sessionUpdate:$("config_option_update")})),QL.and(v({sessionUpdate:$("session_info_update")})),ez.and(v({sessionUpdate:$("usage_update")}))]),Mb=v({_meta:k(d(),_()).nullish(),sessionId:Q,update:tz});v({method:d(),params:j([Mb,cD,gb]).nullish()});const Nb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),nz=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),rz=v({name:d(),uri:d()}),iz=v({_meta:k(d(),_()).nullish(),repository:GD.nullish(),workspaceFolders:z(rz).nullish(),workspaceUri:d().nullish()});v({id:Gr,method:d(),params:j([pL,KP,kD,eL,qL,wD,GL,KL,ZL,h2,c2,N2,p2,iz,b2,HL,mb]).nullish()});const Ub=v({_meta:k(d(),_()).nullish(),content:d(),path:d(),sessionId:Q});v({id:Gr,method:d(),params:j([Ub,$b,Ob,Eb,Ib,Tb,Nb,Ab,J2,mb]).nullish()});const sz=v({_meta:k(d(),_()).nullish()});j([v({id:Gr,result:j([sz,wL,TL,rD,k2,SL,nz,bD,uD,vb])}),v({error:fb,id:Gr})]);var X;class oz{constructor(t,e){S(this,X);const r=t(this),i=async(o,a)=>{var c,u,h,f,y,m,E;switch(o){case gn.fs_write_text_file:{const x=Ub.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,x)}case gn.fs_read_text_file:{const x=$b.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,x)}case gn.session_request_permission:{const x=Ob.parse(a);return r.requestPermission(x)}case gn.terminal_create:{const x=Eb.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,x)}case gn.terminal_output:{const x=Ib.parse(a);return(f=r.terminalOutput)==null?void 0:f.call(r,x)}case gn.terminal_release:{const x=Tb.parse(a);return await((y=r.releaseTerminal)==null?void 0:y.call(r,x))??{}}case gn.terminal_wait_for_exit:{const x=Nb.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,x)}case gn.terminal_kill:{const x=Ab.parse(a);return await((E=r.killTerminal)==null?void 0:E.call(r,x))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Ce.methodNotFound(o)}},s=async(o,a)=>{switch(o){case gn.session_update:{const c=Mb.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ce.methodNotFound(o)}};w(this,X,new az(i,s,e))}async initialize(t){return await l(this,X).sendRequest(pe.initialize,t)}async newSession(t){return await l(this,X).sendRequest(pe.session_new,t)}async loadSession(t){return await l(this,X).sendRequest(pe.session_load,t)??{}}async unstable_forkSession(t){return await l(this,X).sendRequest(pe.session_fork,t)}async listSessions(t){return await l(this,X).sendRequest(pe.session_list,t)}async unstable_resumeSession(t){return await l(this,X).sendRequest(pe.session_resume,t)}async unstable_closeSession(t){return await l(this,X).sendRequest(pe.session_close,t)}async setSessionMode(t){return await l(this,X).sendRequest(pe.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,X).sendRequest(pe.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,X).sendRequest(pe.session_set_config_option,t)}async authenticate(t){return await l(this,X).sendRequest(pe.authenticate,t)??{}}async unstable_logout(t){return await l(this,X).sendRequest(pe.logout,t)??{}}async prompt(t){return await l(this,X).sendRequest(pe.session_prompt,t)}async cancel(t){return await l(this,X).sendNotification(pe.session_cancel,t)}async unstable_startNes(t){return await l(this,X).sendRequest(pe.nes_start,t)}async unstable_suggestNes(t){return await l(this,X).sendRequest(pe.nes_suggest,t)}async unstable_closeNes(t){return await l(this,X).sendRequest(pe.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,X).sendNotification(pe.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,X).sendNotification(pe.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,X).sendNotification(pe.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,X).sendNotification(pe.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,X).sendNotification(pe.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,X).sendNotification(pe.nes_accept,t)}async unstable_rejectNes(t){return await l(this,X).sendNotification(pe.nes_reject,t)}async extMethod(t,e){return await l(this,X).sendRequest(t,e)}async extNotification(t,e){return await l(this,X).sendNotification(t,e)}get signal(){return l(this,X).signal}get closed(){return l(this,X).closed}}X=new WeakMap;var Hn,Bl,wo,So,zi,Oi,Bt,_o,me,Fb,ah,Hb,Zb,Wb,Vb,lh,Vs;class az{constructor(t,e,r){S(this,me);S(this,Hn,new Map);S(this,Bl,0);S(this,wo);S(this,So);S(this,zi);S(this,Oi,Promise.resolve());S(this,Bt,new AbortController);S(this,_o);w(this,wo,t),w(this,So,e),w(this,zi,r),w(this,_o,new Promise(i=>{l(this,Bt).signal.addEventListener("abort",()=>i())})),p(this,me,Fb).call(this)}get signal(){return l(this,Bt).signal}get closed(){return l(this,_o)}async sendRequest(t,e){p(this,me,lh).call(this);const r=Zc(this,Bl)._++,i=new Promise((s,o)=>{l(this,Hn).set(r,{resolve:s,reject:o})});return await p(this,me,Vs).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){p(this,me,lh).call(this),await p(this,me,Vs).call(this,{jsonrpc:"2.0",method:t,params:e})}}Hn=new WeakMap,Bl=new WeakMap,wo=new WeakMap,So=new WeakMap,zi=new WeakMap,Oi=new WeakMap,Bt=new WeakMap,_o=new WeakMap,me=new WeakSet,Fb=async function(){let t;try{const e=l(this,zi).readable.getReader();try{for(;!l(this,Bt).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{p(this,me,Hb).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&p(this,me,Vs).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{p(this,me,ah).call(this,t)}},ah=function(t){if(l(this,Bt).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,Hn).values())r.reject(e);l(this,Hn).clear(),l(this,Bt).abort(e)},Hb=async function(t){if("method"in t&&"id"in t){const e=await p(this,me,Zb).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await p(this,me,Vs).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await p(this,me,Wb).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?p(this,me,Vb).call(this,t):console.error("Invalid message",{message:t})},Zb=async function(t,e){try{return{result:await l(this,wo).call(this,t,e)??null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Ug)return Ce.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 Ce.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ce.internalError({details:i}).toResult()}}},Wb=async function(t,e){try{return await l(this,So).call(this,t,e),{result:null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Ug)return Ce.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 Ce.internalError(i?JSON.parse(i):{}).toResult()}catch{return Ce.internalError({details:i}).toResult()}}},Vb=function(t){const e=l(this,Hn).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 Ce(r,i,s))}l(this,Hn).delete(t.id)}else console.error("Got response to unknown request",t.id)},lh=function(){if(l(this,Bt).signal.aborted)throw l(this,Bt).signal.reason??new Error("ACP connection closed")},Vs=async function(t){return w(this,Oi,l(this,Oi).then(async()=>{const e=l(this,zi).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{p(this,me,ah).call(this,e)})),l(this,Oi)};class Ce 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 Ce(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new Ce(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new Ce(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new Ce(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new Ce(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new Ce(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new Ce(-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 lz=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,cz=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,uz=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,hz=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,dz=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,pz="single_session",fz={name:"television-acp-client",version:"0.0.0"},jb="agent:main:television",gz=wa(Ot);var Mi,Gt,ht,qt,Zn,$t,kn,Yt,Kt,Wn,Tt,Ni,Ui,Jt,Je,xn,Fi,Rr,En,Vn,ko,It,Xt,Gl,Qt,T,ch,Bb,Gb,qb,al,Yb,Kb,Jb,Xb,Qb,ew,tw,vr,yi,bi,vn,nw,wi,uh,hh,ll,rw,cl,dh,ph,xo,Eo,ul,Si,fh,iw;class mz extends gz{constructor(e){super();S(this,T);S(this,Mi,"disconnected");S(this,Gt,null);S(this,ht,new Map);S(this,qt,null);S(this,Zn,null);S(this,$t,null);S(this,kn,null);S(this,Yt,null);S(this,Kt,null);S(this,Wn);S(this,Tt,null);S(this,Ni,0);S(this,Ui,1);S(this,Jt,null);S(this,Je,null);S(this,xn,!1);S(this,Fi,!1);S(this,Rr,!1);S(this,En,null);S(this,Vn,new Set);S(this,ko);S(this,It);S(this,Xt);S(this,Gl,e=>{p(this,T,Gb).call(this,e)});S(this,Qt,null);S(this,xo,()=>{p(this,T,Si).call(this,"ACP bridge websocket closed")});S(this,Eo,()=>{p(this,T,Si).call(this,"ACP bridge websocket error")});w(this,It,e),w(this,Xt,e.sessionMode??pz),w(this,Wn,e.mappedSessionStore??vz()),w(this,ko,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,Mi)}get messages(){return[...l(this,ht).values()]}get enabled(){return l(this,It).enabled??!1}setToken(e){l(this,It).token=e??""}setEnabled(e){l(this,It).enabled=e,e||(p(this,T,ul).call(this),w(this,Gt,null),p(this,T,vn).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,Zn)===null&&(w(this,Gt,null),w(this,Zn,p(this,T,Bb).call(this)));try{await l(this,Zn),await p(this,T,al).call(this)}catch(e){throw p(this,T,Si).call(this,_u(e)),e}}}dispose(){p(this,T,ul).call(this),w(this,Gt,null),p(this,T,vn).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,ch).call(this,"ready")),(l(this,Yt)===null||l(this,Tt)!==p(this,T,cl).call(this))&&await p(this,T,al).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");p(this,T,yi).call(this,{id:p(this,T,wi).call(this,"user"),kind:"user",text:r,status:"final"}),p(this,T,vn).call(this,"running");try{const i=await p(this,T,ll).call(this).prompt({sessionId:p(this,T,hh).call(this),prompt:[{type:"text",text:p(this,T,nw).call(this,r)}]});p(this,T,vr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),p(this,T,vn).call(this,"ready")}catch(i){throw p(this,T,iw).call(this)||(p(this,T,vr).call(this,"error"),p(this,T,vn).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,ch).call(this,"ready"));const e=p(this,T,cl).call(this);((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,Wn).clearActualSessionId(e):w(this,Ni,l(this,Ni)+1),w(this,$t,null),w(this,kn,null),w(this,Yt,null),w(this,Tt,null),p(this,T,fh).call(this)}async cancel(){this.status==="running"&&(p(this,T,vn).call(this,"cancelling"),await p(this,T,ll).call(this).cancel({sessionId:p(this,T,hh).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,Je)===null)return;w(this,Je,null),w(this,xn,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,Je))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Je))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Je))==null?void 0:a.screenID)??null;if(w(this,Je,r),l(this,Xt)==="single_session"){(!l(this,Tt)||i!==r.screenID)&&w(this,xn,!0);return}l(this,Tt)!==p(this,T,dh).call(this,r.screenID)&&(w(this,$t,null),w(this,kn,null),l(this,qt)&&this.status==="ready"&&p(this,T,al).call(this).catch(c=>{p(this,T,Si).call(this,_u(c))}))}}Mi=new WeakMap,Gt=new WeakMap,ht=new WeakMap,qt=new WeakMap,Zn=new WeakMap,$t=new WeakMap,kn=new WeakMap,Yt=new WeakMap,Kt=new WeakMap,Wn=new WeakMap,Tt=new WeakMap,Ni=new WeakMap,Ui=new WeakMap,Jt=new WeakMap,Je=new WeakMap,xn=new WeakMap,Fi=new WeakMap,Rr=new WeakMap,En=new WeakMap,Vn=new WeakMap,ko=new WeakMap,It=new WeakMap,Xt=new WeakMap,Gl=new WeakMap,Qt=new WeakMap,T=new WeakSet,ch=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,Gt)??"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,Gt)??"ACPClient is disconnected")))};this.addEventListener("status-changed",o)})}},Bb=async function(){try{const{stream:e,socket:r,metadata:i}=await Sz({serverURL:l(this,It).serverURL,token:l(this,It).token,createSocket:l(this,ko),onDisconnect:l(this,Gl)});w(this,Kt,i),w(this,Qt,r),r.addEventListener("close",l(this,xo)),r.addEventListener("error",l(this,Eo)),w(this,qt,new oz(s=>({connection:s,sessionUpdate:async o=>{await p(this,T,Kb).call(this,o)},requestPermission:async o=>p(this,T,Jb).call(this,o)}),e)),await l(this,qt).initialize({protocolVersion:WP,clientCapabilities:{},clientInfo:fz})}catch(e){throw e}},Gb=function(e){p(this,T,Si).call(this,_u(e))},qb=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})`)},al=async function(){const e=p(this,T,cl).call(this);if(l(this,$t)&&l(this,kn)===e){await l(this,$t);return}w(this,kn,e),w(this,$t,p(this,T,Yb).call(this,e)),await l(this,$t)},Yb=async function(e){var c;const r=p(this,T,ll).call(this);p(this,T,fh).call(this);let i,s=!1,o=null;const a={cwd:p(this,T,rw).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(w(this,Rr,!0),w(this,En,null),((c=l(this,Kt))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,Wn).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(yz(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,Wn).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,Wn).setActualSessionId(e,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:e}),i=e,s=l(this,ht).size>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{w(this,Rr,!1),w(this,En,null),p(this,T,vr).call(this,"final")}p(this,T,qb).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),w(this,Yt,i),w(this,Tt,e),w(this,Fi,!0),s?(l(this,Vn).add(e),l(this,Xt)==="single_session"&&w(this,xn,!1)):(l(this,Vn).delete(e),w(this,xn,l(this,Xt)==="single_session")),w(this,Gt,null),p(this,T,vn).call(this,"ready")},Kb=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&p(this,T,tw).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&p(this,T,Xb).call(this,r.content.text);return;case"tool_call":p(this,T,Qb).call(this,r);return;case"tool_call_update":p(this,T,ew).call(this,r);return;case"agent_thought_chunk":return;default:return}},Jb=async function(e){return{outcome:{outcome:"cancelled"}}},Xb=function(e){w(this,En,null);const r=wz(e);if(!r)return;if(!l(this,Jt)){const s={id:p(this,T,wi).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};w(this,Jt,s.id),p(this,T,yi).call(this,s);return}const i=l(this,ht).get(l(this,Jt));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");p(this,T,bi).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Qb=function(e){p(this,T,vr).call(this,"final");const r=p(this,T,uh).call(this,e.toolCallId),i=Bg("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??p(this,T,wi).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){p(this,T,bi).call(this,s);return}p(this,T,yi).call(this,s)},ew=function(e){const r=p(this,T,uh).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=Bg(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??p(this,T,wi).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){p(this,T,bi).call(this,a);return}p(this,T,yi).call(this,a)},tw=function(e){if(p(this,T,vr).call(this,"final"),!e)return;const r=l(this,Rr)?l(this,En):null;if(!r){const s=jg(e);if(!s)return;const o={id:p(this,T,wi).call(this,"user"),kind:"user",text:s,status:"final"};p(this,T,yi).call(this,o),l(this,Rr)&&w(this,En,o.id);return}const i=l(this,ht).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");p(this,T,bi).call(this,{...i,text:jg(`${i.text}${e}`)})},vr=function(e){if(!l(this,Jt))return;const r=l(this,ht).get(l(this,Jt));(r==null?void 0:r.kind)==="assistant"&&p(this,T,bi).call(this,{...r,status:e}),w(this,Jt,null)},yi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new mu("messages-changed"))},bi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new mu("messages-changed"))},vn=function(e){l(this,Mi)!==e&&(w(this,Mi,e),this.dispatchEvent(new e$("status-changed")))},nw=function(e){const r=l(this,Tt);if(!r)return e;const i=l(this,Je)?l(this,Xt)==="single_session"?l(this,xn)||!l(this,Vn).has(r):!l(this,Vn).has(r):!1,s=l(this,Fi)&&(l(this,Je)!==null||hz.test(e));if(!(s||i))return e;s&&w(this,Fi,!1),i&&(w(this,xn,!1),l(this,Vn).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,Je)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,Je).screenID}`),a.push(`screen_name: ${l(this,Je).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
+ `)},wi=function(e){const r=`${e}-${l(this,Ui)}`;return w(this,Ui,l(this,Ui)+1),r},uh=function(e){for(const r of l(this,ht).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},hh=function(){if(!l(this,Yt))throw new Error("ACP session is not ready");return l(this,Yt)},ll=function(){if(!l(this,qt))throw new Error("ACP connection is not ready");return l(this,qt)},rw=function(){var r;const e=(r=l(this,Kt))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},cl=function(){var r;if(l(this,Xt)==="single_session")return p(this,T,ph).call(this,`${jb}-${(l(this,It).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,Je))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return p(this,T,dh).call(this,e)},dh=function(e){return p(this,T,ph).call(this,bz(l(this,Xt),e,l(this,It).clientGUID??"default-client"))},ph=function(e){var r;return((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,Ni)>0?`${e}:epoch-${l(this,Ni)}`:e},xo=new WeakMap,Eo=new WeakMap,ul=function(){w(this,qt,null),w(this,Zn,null),w(this,$t,null),w(this,kn,null),w(this,Yt,null),w(this,Tt,null),w(this,Kt,null),l(this,Qt)&&(l(this,Qt).removeEventListener("close",l(this,xo)),l(this,Qt).removeEventListener("error",l(this,Eo)),l(this,Qt).close(),w(this,Qt,null))},Si=function(e){const r=l(this,qt)!==null||l(this,Zn)!==null||l(this,$t)!==null||l(this,kn)!==null||l(this,Yt)!==null||l(this,Tt)!==null||l(this,Kt)!==null||l(this,Qt)!==null;this.disposed||this.status==="disconnected"&&!r||(p(this,T,vr).call(this,"error"),p(this,T,ul).call(this),w(this,Gt,e??null),p(this,T,vn).call(this,"disconnected"))},fh=function(){const e=l(this,ht).size>0;w(this,Jt,null),w(this,En,null),w(this,Ui,1),l(this,ht).clear(),e&&this.dispatchEvent(new mu("messages-changed"))},iw=function(){return this.status==="disconnected"};function vz(){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 yz(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function bz(n,t,e){return n==="single_session"?`${jb}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function sw(n){return n.replace(/^(?:\s*\n)+/,"")}function jg(n){let t=n;return t=t.replace(lz,""),t=t.replace(cz,""),t=t.replace(uz,""),t=sw(t),t}function wz(n){let t=n;return t=t.replace(dz,""),t=sw(t),t}function Bg(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function Sz(n){const t=n.createSocket(xz(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"}))},y=x=>{const I=kz(x);if(!I)return;let P;try{P=JSON.parse(I)}catch(R){const V=R instanceof Error?R:new Error(String(R));i(V),u.error(V);return}switch(P.type){case"acp-bridge-status":if(P.status==="ready"){let R;try{R=_z(P)}catch(V){const N=V instanceof Error?V:new Error(String(V));e||i(N),u.error(N);return}e||(e=!0,r(R));return}if(P.status==="error"||P.status==="exited"){const R=new Error(P.error??`ACP bridge ${P.status}`);e||i(R),u.error(R)}return;case"acp-bridge-message":u.enqueue(P.message);return}},m=()=>{var I;if(h)return;h=!0;const x=new Error("ACP bridge websocket closed");e||i(x),(I=n.onDisconnect)==null||I.call(n,x),u.close()},E=()=>{var I;if(h)return;h=!0;const x=new Error("ACP bridge websocket error");e||i(x),(I=n.onDisconnect)==null||I.call(n,x),u.error(x)};t.addEventListener("open",f),t.addEventListener("message",y),t.addEventListener("close",m),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 _z(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 kz(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 xz(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 _u(n){return n instanceof Error?n.message:String(n)}const Gg="television.acpClientGUID",qg="television.acpMappedSessions",Yg=1;var Hi;class Ez{constructor(){S(this,Hi,new Map)}getActualSessionId(t){return l(this,Hi).get(t)??null}setActualSessionId(t,e){l(this,Hi).set(t,e)}clearActualSessionId(t){l(this,Hi).delete(t)}}Hi=new WeakMap;var Zi,Ao,pt,hl,dl,gh;class Az{constructor(t,e){S(this,pt);S(this,Zi);S(this,Ao);w(this,Zi,t),w(this,Ao,e)}getActualSessionId(t){const e=p(this,pt,dl).call(this)[p(this,pt,hl).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=p(this,pt,dl).call(this);r[p(this,pt,hl).call(this,t)]=e,p(this,pt,gh).call(this,r)}clearActualSessionId(t){const e=p(this,pt,dl).call(this);delete e[p(this,pt,hl).call(this,t)],p(this,pt,gh).call(this,e)}}Zi=new WeakMap,Ao=new WeakMap,pt=new WeakSet,hl=function(t){return JSON.stringify([l(this,Ao),t])},dl=function(){const t=l(this,Zi).getItem(qg);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!==Yg?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},gh=function(t){const e={version:Yg,entries:t};l(this,Zi).setItem(qg,JSON.stringify(e))};function $z(){return typeof window>"u"?null:window.localStorage}function Tz(n){const t=n.getItem(Gg);if(t)return t;const e=Fd().toLowerCase();return n.setItem(Gg,e),e}const Kg=4401,Iz=401,Ba=1e3,Cz=3e4;class to extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class ow extends Ot{constructor(e){var i,s;super();g(this,"url");g(this,"name");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,"createSocket");g(this,"createClient");g(this,"socket",null);g(this,"connectAttempt",0);g(this,"autoReconnect",!1);g(this,"retryTimer",null);g(this,"retryDelay",Ba);g(this,"visibilityEventTarget");g(this,"networkEventTarget");g(this,"onVisibilityChange");g(this,"onNetworkOnline");this.url=he(e.url),this.name=e.name,this._token=e.token??null,this.createSocket=e.createSocket??(o=>new WebSocket(o)),this.createClient=e.createClient??((o,a)=>new k$(o,{token:a??void 0,onUnauthorized:()=>this.handleAuthRejected()})),this.client=this.createClient(this.url,this._token);const r=e.mappedSessionStore??(e.acpStorage?new Az(e.acpStorage,this.url):new Ez);this.acpClient=new mz({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()},(i=this.visibilityEventTarget)==null||i.addEventListener("visibilitychange",this.onVisibilityChange),(s=this.networkEventTarget)==null||s.addEventListener("online",this.onNetworkOnline)}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null)}async connect(e){this._token=e,this.hasAuthRejected=!1,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Ba,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i;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),this.acpClient.dispose()}getViewURL(e){const r=zl(e,{electron:ln()});return ln()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(e){const r=zl(e,{electron:ln()}).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 Hs("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new Hs("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new Hs("screens-changed"));break;case"artifact-created":{const r=this.screens.get(e.screenID);r&&!sl(r).includes(e.artifact.id)&&(r.layout=[...r.layout,uy(e.artifact.id)]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=ey(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return Rz(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1;const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token),this.setStatus("disconnected"),this.dispatchEvent(new oe("change"));const r=this.createSocket(Pz(this.url,this._token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==e||(a=!0,this.retryDelay=Ba,this.hasEverConnected=!0,this.setStatus("connected"),s())},u=f=>{a||this.connectAttempt!==e||(a=!0,o(f))},h=async()=>{const f=this.hasEverConnected;try{const[{screens:y},m]=await Promise.all([this.client.screens.list(),this.client.display.get()]);this.screens=new Map(y.map(E=>[E.id,structuredClone(E)])),this.acpClient.setEnabled(m.acpEnabled),this.dispatchEvent(new oe("change")),f&&this.dispatchEvent(new Hs("screens-changed")),this.dispatchEvent(new Qu("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:m.activeScreenID}})),c(),f&&this.connectAttempt===e&&this.dispatchEvent(new Xv("server-reconnected",{serverURL:this.url}))}catch(y){if(zz(y)){u(new to);return}u(y instanceof Error?y:new Error(String(y)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",f=>{const y=Lz(f);y&&(this.applyServerEvent(y),this.dispatchEvent(new Qu("server-event",{serverURL:this.url,event:y})))}),r.addEventListener("close",f=>{if(this.connectAttempt!==e)return;this.socket=null;const y=Dz(f);if(!a){u(y===Kg?new to:new Error("Connection closed before initialization"));return}if(y===Kg){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 to){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,Cz),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new oe("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new oe("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=Ba,this.attempt().catch(()=>{})))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new oe("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function Rz(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function Pz(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/events",e.search="",t&&e.searchParams.set("token",t),e.hash="",e.toString()}function Dz(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function Lz(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;try{return JSON.parse(t)}catch{return null}}function zz(n){return n instanceof Ud&&n.status===Iz}const Oz="Local";var $o,mh;class Mz extends Ot{constructor(e){super();S(this,$o);g(this,"servers",new Map);g(this,"localServerURL");g(this,"clientGUID");g(this,"acpStorage");g(this,"localStore");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 oe("change")))});this.localStore=e.localStore,this.localServerURL=e.localServerURL?he(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?$z():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?Tz(r):Fd().toLowerCase()),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=he(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e);const s=()=>{this.dispatchEvent(new oe("change"))},o=u=>{this.dispatchEvent(new Qu("server-event",{serverURL:u.serverURL,event:u.event}))},a=()=>{this.dispatchEvent(new Hs("screens-changed"))},c=u=>{this.dispatchEvent(new Xv("server-reconnected",{serverURL:u.serverURL}))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),e.addEventListener("server-reconnected",c),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a,onServerReconnected:c}),this.dispatchEvent(new oe("change"))}remove(e){const r=he(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),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 oe("change"))}getStoredAuthToken(e){return yu(this.localStore.get(),e)}setStoredAuthToken(e,r){this.localStore.set(D$(this.localStore.get(),e,r))}clearStoredAuthToken(e){const r=this.localStore.get(),i=L$(r,e);i!==r&&this.localStore.set(i)}setActive(e){const r=this.localStore.get(),i=e?he(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?he(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>he(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:Oz}]})}const s=this.localStore.get().servers;for(const a of s){const c=he(a.url),h=i!==null&&c===i?r??yu(this.localStore.get(),c):yu(this.localStore.get(),c),f=p(this,$o,mh).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=he(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>he(a.url)!==i),{url:i,name:r}]});const o=p(this,$o,mh).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)}}$o=new WeakSet,mh=function(e){return new ow({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var To;class Nz extends Ot{constructor(){super();S(this,To,e=>{const r=Uz(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new Q1("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,To))}dispose(){document.removeEventListener("keydown",l(this,To))}}To=new WeakMap;function Uz(n){for(const[t,e]of Object.entries(x$))if(Fz(n,e.trigger))return t;return null}function Fz(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 vh="tv-nav:",Ol="tv-reload",Jg=100,Hz=1e3,Zz=60,Wz=60,Vz=24,jz=30,Bz=jz*Vz*Wz*Zz*Hz;function In(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Ol);return t.searchParams.delete(Ol),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Io,Wi,ue,re,Pr,ke,aw,On,lw,yh,bh;class Gz extends Ot{constructor(e,r){super();S(this,ke);S(this,Io);S(this,Wi);S(this,ue,[]);S(this,re,-1);S(this,Pr,0);w(this,Io,e),w(this,Wi,In(r)),p(this,ke,aw).call(this)}get currentURL(){var e;return l(this,re)===-1?null:((e=l(this,ue)[l(this,re)])==null?void 0:e.url)??null}get canGoBack(){return l(this,re)>-1}get canGoForward(){return l(this,re)<l(this,ue).length-1}get entries(){return l(this,ue).map(e=>({...e}))}get cursor(){return l(this,re)}navigate(e){const r=In(e);if(r===l(this,Wi)){if(l(this,re)===-1)return;w(this,re,-1),p(this,ke,On).call(this);return}l(this,re)<l(this,ue).length-1&&w(this,ue,l(this,ue).slice(0,l(this,re)+1)),l(this,ue).push({url:r}),w(this,re,l(this,ue).length-1),p(this,ke,yh).call(this),p(this,ke,On).call(this)}replace(e){var i;if(l(this,re)===-1){this.navigate(e);return}const r=In(e);if(r===l(this,Wi)){w(this,ue,l(this,ue).filter((s,o)=>o!==l(this,re))),w(this,re,-1),p(this,ke,On).call(this);return}((i=l(this,ue)[l(this,re)])==null?void 0:i.url)!==r&&(w(this,ue,l(this,ue).map((s,o)=>o===l(this,re)?{url:r}:s)),p(this,ke,On).call(this))}back(){l(this,re)!==-1&&(w(this,re,l(this,re)-1),p(this,ke,On).call(this))}forward(){this.canGoForward&&(w(this,re,l(this,re)+1),p(this,ke,On).call(this))}reset(){l(this,re)===-1&&l(this,ue).length===0||(w(this,ue,[]),w(this,re,-1),p(this,ke,On).call(this))}}Io=new WeakMap,Wi=new WeakMap,ue=new WeakMap,re=new WeakMap,Pr=new WeakMap,ke=new WeakSet,aw=function(){const e=localStorage.getItem(l(this,ke,bh));if(e!==null)try{const r=JSON.parse(e);if(!cw(r))return;w(this,ue,r.entries.map(i=>({url:i.url}))),w(this,re,r.cursor),w(this,Pr,r.lastWritten),p(this,ke,yh).call(this)}catch{w(this,ue,[]),w(this,re,-1),w(this,Pr,0)}},On=function(){w(this,Pr,Date.now());try{localStorage.setItem(l(this,ke,bh),JSON.stringify(p(this,ke,lw).call(this)))}catch(e){if(!Kz(e))throw e}this.dispatchEvent(new oe("change"))},lw=function(){return{v:1,entries:l(this,ue).map(e=>({...e})),cursor:l(this,re),lastWritten:l(this,Pr)}},yh=function(){if(l(this,ue).length<=Jg)return;const e=l(this,ue).length-Jg;w(this,ue,l(this,ue).slice(e)),w(this,re,Math.max(-1,l(this,re)-e))},bh=function(){return qz(l(this,Io))};function qz(n){return`${vh}${n}`}function Yz(n){const t=Date.now()-Bz,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(vh)))continue;const s=i.slice(vh.length),o=localStorage.getItem(i);if(o===null)continue;let a;try{a=JSON.parse(o)}catch{e.push(i);continue}if(!cw(a)){e.push(i);continue}!n.has(s)&&a.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function Kz(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function cw(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")}let zn=null;async function uw(n,t){if(zn==null||zn.abort(),n===null){zn=null,Cl();return}const e=new AbortController;zn=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(zn!==e)return;Jv(o)}catch(r){if(r.name==="AbortError")return;Cl();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{zn===e&&(zn=null)}}/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const no=globalThis,Kg=n=>n,Ml=no.trustedTypes,Jg=Ml?Ml.createPolicy("lit-html",{createHTML:n=>n}):void 0,cw="$lit$",Nn=`lit$${Math.random().toFixed(9).slice(2)}$`,uw="?"+Nn,Yz=`<${uw}>`,qr=document,uo=()=>qr.createComment(""),ho=n=>n===null||typeof n!="object"&&typeof n!="function",Yd=Array.isArray,Kz=n=>Yd(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",_u=`[
48
- \f\r]`,Ps=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xg=/-->/g,Qg=/>/g,dr=RegExp(`>|${_u}(?:([^\\s"'>=/]+)(${_u}*=${_u}*(?:[^
49
- \f\r"'\`<>=]|("|')|))|$)`,"g"),em=/'/g,tm=/"/g,hw=/^(?:script|style|textarea|title)$/i,Jz=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),L=Jz(1),Yr=Symbol.for("lit-noChange"),le=Symbol.for("lit-nothing"),nm=new WeakMap,Er=qr.createTreeWalker(qr,129);function dw(n,t){if(!Yd(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jg!==void 0?Jg.createHTML(t):t}const Xz=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=Ps;for(let a=0;a<e;a++){const c=n[a];let u,h,f=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Ps?h[1]==="!--"?o=Xg:h[1]!==void 0?o=Qg:h[2]!==void 0?(hw.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=dr):h[3]!==void 0&&(o=dr):o===dr?h[0]===">"?(o=i??Ps,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?dr:h[3]==='"'?tm:em):o===tm||o===em?o=dr:o===Xg||o===Qg?o=Ps:(o=dr,i=void 0);const m=o===dr&&n[a+1].startsWith("/>")?" ":"";s+=o===Ps?c+Yz:f>=0?(r.push(u),c.slice(0,f)+cw+c.slice(f)+Nn+m):c+Nn+(f===-2?a:m)}return[dw(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class po{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]=Xz(t,e);if(this.el=po.createElement(u,r),Er.currentNode=this.el.content,e===2||e===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Er.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const f of i.getAttributeNames())if(f.endsWith(cw)){const y=h[o++],m=i.getAttribute(f).split(Nn),E=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:E[2],strings:m,ctor:E[1]==="."?eO:E[1]==="?"?tO:E[1]==="@"?nO:Ec}),i.removeAttribute(f)}else f.startsWith(Nn)&&(c.push({type:6,index:s}),i.removeAttribute(f));if(hw.test(i.tagName)){const f=i.textContent.split(Nn),y=f.length-1;if(y>0){i.textContent=Ml?Ml.emptyScript:"";for(let m=0;m<y;m++)i.append(f[m],uo()),Er.nextNode(),c.push({type:2,index:++s});i.append(f[y],uo())}}}else if(i.nodeType===8)if(i.data===uw)c.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(Nn,f+1))!==-1;)c.push({type:7,index:s}),f+=Nn.length-1}s++}}static createElement(t,e){const r=qr.createElement("template");return r.innerHTML=t,r}}function hs(n,t,e=n,r){var o,a;if(t===Yr)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=ho(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=hs(n,i._$AS(n,t.values),i,r)),t}class Qz{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)??qr).importNode(e,!0);Er.currentNode=i;let s=Er.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new xc(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new rO(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Er.nextNode(),o++)}return Er.currentNode=qr,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 xc=class pw{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=le,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=hs(this,t,e),ho(t)?t===le||t==null||t===""?(this._$AH!==le&&this._$AR(),this._$AH=le):t!==this._$AH&&t!==Yr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Kz(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!==le&&ho(this._$AH)?this._$AA.nextSibling.data=t:this.T(qr.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=po.createElement(dw(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 Qz(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=nm.get(t.strings);return e===void 0&&nm.set(t.strings,e=new po(t)),e}k(t){Yd(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 pw(this.O(uo()),this.O(uo()),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=Kg(t).nextSibling;Kg(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Ec=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=le,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=le}_$AI(t,e=this,r,i){const s=this.strings;let o=!1;if(s===void 0)t=hs(this,t,e,0),o=!ho(t)||t!==this._$AH&&t!==Yr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=hs(this,a[r+c],e,c),u===Yr&&(u=this._$AH[c]),o||(o=!ho(u)||u!==this._$AH[c]),u===le?t=le:t!==le&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===le?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},eO=class extends Ec{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===le?void 0:t}},tO=class extends Ec{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==le)}},nO=class extends Ec{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=hs(this,t,e,0)??le)===Yr)return;const r=this._$AH,i=t===le&&r!==le||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==le&&(r===le||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 rO{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){hs(this,t)}}const iO={I:xc},ku=no.litHtmlPolyfillSupport;ku==null||ku(po,xc),(no.litHtmlVersions??(no.litHtmlVersions=[])).push("3.3.2");const Ve=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new xc(t.insertBefore(uo(),null),null,void 0,{})),i._$AI(n),i};/**
47
+ */const no=globalThis,Xg=n=>n,Ml=no.trustedTypes,Qg=Ml?Ml.createPolicy("lit-html",{createHTML:n=>n}):void 0,hw="$lit$",Nn=`lit$${Math.random().toFixed(9).slice(2)}$`,dw="?"+Nn,Jz=`<${dw}>`,qr=document,uo=()=>qr.createComment(""),ho=n=>n===null||typeof n!="object"&&typeof n!="function",Kd=Array.isArray,Xz=n=>Kd(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",ku=`[
48
+ \f\r]`,Ps=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,em=/-->/g,tm=/>/g,dr=RegExp(`>|${ku}(?:([^\\s"'>=/]+)(${ku}*=${ku}*(?:[^
49
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),nm=/'/g,rm=/"/g,pw=/^(?:script|style|textarea|title)$/i,Qz=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),L=Qz(1),Yr=Symbol.for("lit-noChange"),le=Symbol.for("lit-nothing"),im=new WeakMap,Er=qr.createTreeWalker(qr,129);function fw(n,t){if(!Kd(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qg!==void 0?Qg.createHTML(t):t}const eO=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=Ps;for(let a=0;a<e;a++){const c=n[a];let u,h,f=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Ps?h[1]==="!--"?o=em:h[1]!==void 0?o=tm:h[2]!==void 0?(pw.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=dr):h[3]!==void 0&&(o=dr):o===dr?h[0]===">"?(o=i??Ps,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?dr:h[3]==='"'?rm:nm):o===rm||o===nm?o=dr:o===em||o===tm?o=Ps:(o=dr,i=void 0);const m=o===dr&&n[a+1].startsWith("/>")?" ":"";s+=o===Ps?c+Jz:f>=0?(r.push(u),c.slice(0,f)+hw+c.slice(f)+Nn+m):c+Nn+(f===-2?a:m)}return[fw(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class po{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]=eO(t,e);if(this.el=po.createElement(u,r),Er.currentNode=this.el.content,e===2||e===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Er.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const f of i.getAttributeNames())if(f.endsWith(hw)){const y=h[o++],m=i.getAttribute(f).split(Nn),E=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:E[2],strings:m,ctor:E[1]==="."?nO:E[1]==="?"?rO:E[1]==="@"?iO:Ec}),i.removeAttribute(f)}else f.startsWith(Nn)&&(c.push({type:6,index:s}),i.removeAttribute(f));if(pw.test(i.tagName)){const f=i.textContent.split(Nn),y=f.length-1;if(y>0){i.textContent=Ml?Ml.emptyScript:"";for(let m=0;m<y;m++)i.append(f[m],uo()),Er.nextNode(),c.push({type:2,index:++s});i.append(f[y],uo())}}}else if(i.nodeType===8)if(i.data===dw)c.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(Nn,f+1))!==-1;)c.push({type:7,index:s}),f+=Nn.length-1}s++}}static createElement(t,e){const r=qr.createElement("template");return r.innerHTML=t,r}}function hs(n,t,e=n,r){var o,a;if(t===Yr)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=ho(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=hs(n,i._$AS(n,t.values),i,r)),t}class tO{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)??qr).importNode(e,!0);Er.currentNode=i;let s=Er.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new xc(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new sO(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Er.nextNode(),o++)}return Er.currentNode=qr,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 xc=class gw{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=le,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=hs(this,t,e),ho(t)?t===le||t==null||t===""?(this._$AH!==le&&this._$AR(),this._$AH=le):t!==this._$AH&&t!==Yr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Xz(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!==le&&ho(this._$AH)?this._$AA.nextSibling.data=t:this.T(qr.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=po.createElement(fw(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 tO(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=im.get(t.strings);return e===void 0&&im.set(t.strings,e=new po(t)),e}k(t){Kd(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 gw(this.O(uo()),this.O(uo()),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=Xg(t).nextSibling;Xg(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Ec=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=le,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=le}_$AI(t,e=this,r,i){const s=this.strings;let o=!1;if(s===void 0)t=hs(this,t,e,0),o=!ho(t)||t!==this._$AH&&t!==Yr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=hs(this,a[r+c],e,c),u===Yr&&(u=this._$AH[c]),o||(o=!ho(u)||u!==this._$AH[c]),u===le?t=le:t!==le&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===le?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},nO=class extends Ec{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===le?void 0:t}},rO=class extends Ec{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==le)}},iO=class extends Ec{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=hs(this,t,e,0)??le)===Yr)return;const r=this._$AH,i=t===le&&r!==le||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==le&&(r===le||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 sO{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){hs(this,t)}}const oO={I:xc},xu=no.litHtmlPolyfillSupport;xu==null||xu(po,xc),(no.litHtmlVersions??(no.litHtmlVersions=[])).push("3.3.2");const Ve=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new xc(t.insertBefore(uo(),null),null,void 0,{})),i._$AI(n),i};/**
50
50
  * @license
51
51
  * Copyright 2017 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */const Kd={CHILD:2},Ac=n=>(...t)=>({_$litDirective$:n,values:t});let Jd=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)}};/**
53
+ */const Jd={CHILD:2},Ac=n=>(...t)=>({_$litDirective$:n,values:t});let Xd=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)}};/**
54
54
  * @license
55
55
  * Copyright 2017 Google LLC
56
56
  * SPDX-License-Identifier: BSD-3-Clause
57
- */let Nl=class extends Jd{constructor(t){if(super(t),this.it=le,t.type!==Kd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===le||t==null)return this._t=void 0,this.it=t;if(t===Yr)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:[]}}};Nl.directiveName="unsafeHTML",Nl.resultType=1;const sO=Ac(Nl);/**
57
+ */let Nl=class extends Xd{constructor(t){if(super(t),this.it=le,t.type!==Jd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===le||t==null)return this._t=void 0,this.it=t;if(t===Yr)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:[]}}};Nl.directiveName="unsafeHTML",Nl.resultType=1;const aO=Ac(Nl);/**
58
58
  * @license
59
59
  * Copyright 2017 Google LLC
60
60
  * SPDX-License-Identifier: BSD-3-Clause
61
- */let bh=class extends Nl{};bh.directiveName="unsafeSVG",bh.resultType=2;const fw=Ac(bh),oO={size:16,color:"currentColor",weight:"regular"};function aO(n){return typeof n=="string"?{regular:n}:n}function Mt(n,t="0 0 256 256"){const e=aO(n);return r=>{const{size:i,color:s,weight:o}={...oO,...r},a=e[o]??e.regular;return L`<svg
61
+ */let wh=class extends Nl{};wh.directiveName="unsafeSVG",wh.resultType=2;const mw=Ac(wh),lO={size:16,color:"currentColor",weight:"regular"};function cO(n){return typeof n=="string"?{regular:n}:n}function Mt(n,t="0 0 256 256"){const e=cO(n);return r=>{const{size:i,color:s,weight:o}={...lO,...r},a=e[o]??e.regular;return L`<svg
62
62
  xmlns="http://www.w3.org/2000/svg"
63
63
  data-ui-icon=""
64
64
  width="${i}"
65
65
  height="${i}"
66
66
  viewBox="${t}"
67
67
  fill="${s}"
68
- >${fw(a)}</svg>`}}/**
68
+ >${mw(a)}</svg>`}}/**
69
69
  * @license
70
70
  * Copyright 2020 Google LLC
71
71
  * SPDX-License-Identifier: BSD-3-Clause
72
- */const{I:lO}=iO,rm=n=>n,cO=n=>n.strings===void 0,im=()=>document.createComment(""),Ds=(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(im(),i),a=r.insertBefore(im(),i);e=new lO(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=rm(u).nextSibling;rm(r).insertBefore(u,i),u=h}}}return e},pr=(n,t,e=n)=>(n._$AI(t,e),n),uO={},hO=(n,t=uO)=>n._$AH=t,dO=n=>n._$AH,xu=n=>{n._$AR(),n._$AA.remove()};/**
72
+ */const{I:uO}=oO,sm=n=>n,hO=n=>n.strings===void 0,om=()=>document.createComment(""),Ds=(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(om(),i),a=r.insertBefore(om(),i);e=new uO(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=sm(u).nextSibling;sm(r).insertBefore(u,i),u=h}}}return e},pr=(n,t,e=n)=>(n._$AI(t,e),n),dO={},pO=(n,t=dO)=>n._$AH=t,fO=n=>n._$AH,Eu=n=>{n._$AR(),n._$AA.remove()};/**
73
73
  * @license
74
74
  * Copyright 2017 Google LLC
75
75
  * SPDX-License-Identifier: BSD-3-Clause
76
- */const ro=(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),ro(i,t);return!0},Ul=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)},gw=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 pO(n){this._$AN!==void 0?(Ul(this),this._$AM=n,gw(this)):this._$AM=n}function fO(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++)ro(r[s],!1),Ul(r[s]);else r!=null&&(ro(r,!1),Ul(r));else ro(this,n)}const gO=n=>{n.type==Kd.CHILD&&(n._$AP??(n._$AP=fO),n._$AQ??(n._$AQ=pO))};class mO extends Jd{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),gw(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&&(ro(this,t),Ul(this))}setValue(t){if(cO(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(){}}/**
76
+ */const ro=(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),ro(i,t);return!0},Ul=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)},vw=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),vO(t)}};function gO(n){this._$AN!==void 0?(Ul(this),this._$AM=n,vw(this)):this._$AM=n}function mO(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++)ro(r[s],!1),Ul(r[s]);else r!=null&&(ro(r,!1),Ul(r));else ro(this,n)}const vO=n=>{n.type==Jd.CHILD&&(n._$AP??(n._$AP=mO),n._$AQ??(n._$AQ=gO))};class yO extends Xd{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),vw(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&&(ro(this,t),Ul(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(){}}/**
77
77
  * @license
78
78
  * Copyright 2020 Google LLC
79
79
  * SPDX-License-Identifier: BSD-3-Clause
80
- */const pl=()=>new vO;class vO{}const Eu=new WeakMap,fl=Ac(class extends mO{render(n){return le}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)),le}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=Eu.get(t);e===void 0&&(e=new WeakMap,Eu.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=Eu.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)}}),Xd=Mt('<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"/>'),yO=Mt('<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"/>'),bO=Mt('<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"/>'),Fl=Mt('<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"/>'),wO=Mt('<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"/>'),SO=Mt({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"/>'}),_O=Mt({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"/>'}),kO=Mt({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"/>'}),xO=Mt('<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"/>'),mw=Mt({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"/>'}),EO=Mt('<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 AO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const sm='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Au=4;var Fe,it,Dr,st,Co,Vi,ji,W,wh,Sh,yw,gl,bw,_h,kh,Ro,Po,Lr,ww,xh,Sw,_w,ml,_i;class vw extends HTMLElement{constructor(){super();S(this,W);S(this,Fe,!1);S(this,it,null);S(this,Dr);S(this,st,null);S(this,Co,"bottom-start");S(this,Vi,!1);S(this,ji,!1);S(this,Ro,e=>{l(this,Fe)&&(l(this,Vi)||e.composedPath().includes(this)||(this.open=!1))});S(this,Po,e=>{if(l(this,Fe)){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&p(this,W,ww).call(this,e)}});S(this,Lr,()=>{l(this,Fe)&&p(this,W,ml).call(this)});w(this,Dr,this.attachShadow({mode:"open"})),zd(l(this,Dr)),p(this,W,Sh).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),p(this,W,Sh).call(this,"open"),p(this,W,_i).call(this),l(this,Fe)&&(p(this,W,_h).call(this),p(this,W,gl).call(this))}disconnectedCallback(){var e;p(this,W,kh).call(this),(e=l(this,it))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?p(this,W,yw).call(this,this.hasAttribute("open")):e==="material"&&l(this,Fe)&&(p(this,W,_i).call(this),p(this,W,gl).call(this))}get open(){return l(this,Fe)}set open(e){this.toggleAttribute("open",e)}get anchor(){return l(this,it)}set anchor(e){l(this,it)!==e&&(l(this,it)&&l(this,it).removeAttribute("aria-expanded"),w(this,it,e),p(this,W,wh).call(this),l(this,Fe)&&p(this,W,ml).call(this))}}Fe=new WeakMap,it=new WeakMap,Dr=new WeakMap,st=new WeakMap,Co=new WeakMap,Vi=new WeakMap,ji=new WeakMap,W=new WeakSet,wh=function(){l(this,it)&&l(this,it).setAttribute("aria-expanded",l(this,Fe)?"true":"false")},Sh=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},yw=function(e){var r,i,s;if(l(this,Fe)!==e){if(w(this,Fe,e),p(this,W,wh).call(this),!this.isConnected){p(this,W,_i).call(this);return}e?(w(this,Vi,!0),setTimeout(()=>{w(this,Vi,!1)},0),p(this,W,_i).call(this),p(this,W,_h).call(this),p(this,W,gl).call(this)):(p(this,W,kh).call(this),(i=(r=l(this,st))==null?void 0:r.hidePopover)==null||i.call(r),p(this,W,_i).call(this),(s=l(this,it))==null||s.focus(),this.dispatchEvent(new AO))}},gl=function(){l(this,ji)||(w(this,ji,!0),queueMicrotask(()=>{w(this,ji,!1),!(!l(this,Fe)||!this.isConnected)&&(p(this,W,bw).call(this),p(this,W,_w).call(this))}))},bw=function(){var e,r;if(l(this,st)){try{(r=(e=l(this,st)).showPopover)==null||r.call(e)}catch{}p(this,W,ml).call(this)}},_h=function(){document.addEventListener("click",l(this,Ro)),document.addEventListener("keydown",l(this,Po),!0),window.addEventListener("resize",l(this,Lr)),window.addEventListener("scroll",l(this,Lr),!0)},kh=function(){document.removeEventListener("click",l(this,Ro)),document.removeEventListener("keydown",l(this,Po),!0),window.removeEventListener("resize",l(this,Lr)),window.removeEventListener("scroll",l(this,Lr),!0)},Ro=new WeakMap,Po=new WeakMap,Lr=new WeakMap,ww=function(e){const r=p(this,W,xh).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=p(this,W,Sw).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())},xh=function(){if(!l(this,st))return[];const e=l(this,st).querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const r=[];for(const i of e.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(sm)&&r.push(i);for(const s of i.querySelectorAll(sm))r.push(s)}return r},Sw=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},_w=function(){var r;const e=p(this,W,xh).call(this);e.length>0?e[0].focus():(r=l(this,st))==null||r.focus()},ml=function(){if(!l(this,Fe)||!l(this,it)||!l(this,st))return;const e=l(this,it).getBoundingClientRect(),r=l(this,st).getBoundingClientRect(),s=window.innerHeight-e.bottom,o=r.height+Au,a=s<o&&e.top>o?"top-start":"bottom-start";w(this,Co,a);const c=a==="bottom-start"?e.bottom+Au:e.top-r.height-Au,u=e.left;l(this,st).style.transform=`translate(${u}px, ${c}px)`,l(this,st).setAttribute("data-placement",a)},_i=function(){this.toggleAttribute("open",l(this,Fe));const e=this.getAttribute("material")??"paper";Ve(l(this,Fe)?L`<div
80
+ */const pl=()=>new bO;class bO{}const Au=new WeakMap,fl=Ac(class extends yO{render(n){return le}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)),le}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=Au.get(t);e===void 0&&(e=new WeakMap,Au.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=Au.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)}}),Qd=Mt('<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"/>'),wO=Mt('<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"/>'),SO=Mt('<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"/>'),Fl=Mt('<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"/>'),_O=Mt('<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"/>'),kO=Mt({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=Mt({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"/>'}),EO=Mt({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"/>'}),AO=Mt('<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"/>'),yw=Mt({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"/>'}),$O=Mt('<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 TO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const am='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',$u=4;var Fe,it,Dr,st,Co,Vi,ji,W,Sh,_h,ww,gl,Sw,kh,xh,Ro,Po,Lr,_w,Eh,kw,xw,ml,_i;class bw extends HTMLElement{constructor(){super();S(this,W);S(this,Fe,!1);S(this,it,null);S(this,Dr);S(this,st,null);S(this,Co,"bottom-start");S(this,Vi,!1);S(this,ji,!1);S(this,Ro,e=>{l(this,Fe)&&(l(this,Vi)||e.composedPath().includes(this)||(this.open=!1))});S(this,Po,e=>{if(l(this,Fe)){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&p(this,W,_w).call(this,e)}});S(this,Lr,()=>{l(this,Fe)&&p(this,W,ml).call(this)});w(this,Dr,this.attachShadow({mode:"open"})),Od(l(this,Dr)),p(this,W,_h).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),p(this,W,_h).call(this,"open"),p(this,W,_i).call(this),l(this,Fe)&&(p(this,W,kh).call(this),p(this,W,gl).call(this))}disconnectedCallback(){var e;p(this,W,xh).call(this),(e=l(this,it))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?p(this,W,ww).call(this,this.hasAttribute("open")):e==="material"&&l(this,Fe)&&(p(this,W,_i).call(this),p(this,W,gl).call(this))}get open(){return l(this,Fe)}set open(e){this.toggleAttribute("open",e)}get anchor(){return l(this,it)}set anchor(e){l(this,it)!==e&&(l(this,it)&&l(this,it).removeAttribute("aria-expanded"),w(this,it,e),p(this,W,Sh).call(this),l(this,Fe)&&p(this,W,ml).call(this))}}Fe=new WeakMap,it=new WeakMap,Dr=new WeakMap,st=new WeakMap,Co=new WeakMap,Vi=new WeakMap,ji=new WeakMap,W=new WeakSet,Sh=function(){l(this,it)&&l(this,it).setAttribute("aria-expanded",l(this,Fe)?"true":"false")},_h=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},ww=function(e){var r,i,s;if(l(this,Fe)!==e){if(w(this,Fe,e),p(this,W,Sh).call(this),!this.isConnected){p(this,W,_i).call(this);return}e?(w(this,Vi,!0),setTimeout(()=>{w(this,Vi,!1)},0),p(this,W,_i).call(this),p(this,W,kh).call(this),p(this,W,gl).call(this)):(p(this,W,xh).call(this),(i=(r=l(this,st))==null?void 0:r.hidePopover)==null||i.call(r),p(this,W,_i).call(this),(s=l(this,it))==null||s.focus(),this.dispatchEvent(new TO))}},gl=function(){l(this,ji)||(w(this,ji,!0),queueMicrotask(()=>{w(this,ji,!1),!(!l(this,Fe)||!this.isConnected)&&(p(this,W,Sw).call(this),p(this,W,xw).call(this))}))},Sw=function(){var e,r;if(l(this,st)){try{(r=(e=l(this,st)).showPopover)==null||r.call(e)}catch{}p(this,W,ml).call(this)}},kh=function(){document.addEventListener("click",l(this,Ro)),document.addEventListener("keydown",l(this,Po),!0),window.addEventListener("resize",l(this,Lr)),window.addEventListener("scroll",l(this,Lr),!0)},xh=function(){document.removeEventListener("click",l(this,Ro)),document.removeEventListener("keydown",l(this,Po),!0),window.removeEventListener("resize",l(this,Lr)),window.removeEventListener("scroll",l(this,Lr),!0)},Ro=new WeakMap,Po=new WeakMap,Lr=new WeakMap,_w=function(e){const r=p(this,W,Eh).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=p(this,W,kw).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())},Eh=function(){if(!l(this,st))return[];const e=l(this,st).querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const r=[];for(const i of e.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(am)&&r.push(i);for(const s of i.querySelectorAll(am))r.push(s)}return r},kw=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},xw=function(){var r;const e=p(this,W,Eh).call(this);e.length>0?e[0].focus():(r=l(this,st))==null||r.focus()},ml=function(){if(!l(this,Fe)||!l(this,it)||!l(this,st))return;const e=l(this,it).getBoundingClientRect(),r=l(this,st).getBoundingClientRect(),s=window.innerHeight-e.bottom,o=r.height+$u,a=s<o&&e.top>o?"top-start":"bottom-start";w(this,Co,a);const c=a==="bottom-start"?e.bottom+$u:e.top-r.height-$u,u=e.left;l(this,st).style.transform=`translate(${u}px, ${c}px)`,l(this,st).setAttribute("data-placement",a)},_i=function(){this.toggleAttribute("open",l(this,Fe));const e=this.getAttribute("material")??"paper";Ve(l(this,Fe)?L`<div
81
81
  class="panel"
82
82
  part="panel"
83
83
  popover="manual"
@@ -88,7 +88,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
88
88
  level="1"
89
89
  >
90
90
  <slot></slot>
91
- </div>`:le,l(this,Dr)),w(this,st,l(this,Dr).querySelector(".panel"))},g(vw,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",vw);class kw extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}class $O extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var ot,Ct,jn,Bn,se,Do,Lo,M,Ew,js,Aw,$w,Eh,Tw,Bs,yr,zr,zo,ql,Oo,Yl,Iw,Cw,Ah,Gs,$h,Th,yn;class xw extends HTMLElement{constructor(){super();S(this,M);S(this,ot,!1);S(this,Ct,null);S(this,jn,null);S(this,Bn);S(this,se,null);S(this,Do,pl());S(this,Lo,new MutationObserver(e=>p(this,M,Iw).call(this,e)));S(this,zr,()=>{p(this,M,Bs).call(this,!l(this,ot))});S(this,zo,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,zr).call(this))});S(this,ql,()=>{l(this,ot)&&p(this,M,Bs).call(this,!1)});S(this,Oo,e=>{e instanceof kw&&(e.stopPropagation(),w(this,ot,!1),p(this,M,js).call(this,e.value),p(this,M,yn).call(this),this.dispatchEvent(new $O(e.value)))});S(this,Yl,()=>{p(this,M,Ah).call(this)});w(this,Bn,this.attachShadow({mode:"open"})),zd(l(this,Bn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Oo)),p(this,M,Ew).call(this),l(this,Lo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),p(this,M,yn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Oo)),l(this,Lo).disconnect(),p(this,M,Th).call(this)}attributeChangedCallback(e){if(e==="open"){p(this,M,Bs).call(this,this.hasAttribute("open"));return}p(this,M,yn).call(this)}get open(){return l(this,ot)}set open(e){this.toggleAttribute("open",e)}get title(){return this.getAttribute("title")??""}get value(){return l(this,Ct)}set value(e){e===null?(p(this,M,yr).call(this,null,null),p(this,M,Aw).call(this)):p(this,M,js).call(this,e),p(this,M,yn).call(this)}close(){p(this,M,Bs).call(this,!1)}}ot=new WeakMap,Ct=new WeakMap,jn=new WeakMap,Bn=new WeakMap,se=new WeakMap,Do=new WeakMap,Lo=new WeakMap,M=new WeakSet,Ew=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&p(this,M,yr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},js=function(e){var r;for(const i of l(this,M,Eh))i.value===e?(p(this,M,yr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},Aw=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},$w=function(e){for(const r of l(this,M,Eh))if(r.value===e)return r;return null},Eh=function(){return this.querySelectorAll("dropdown-item")},Tw=function(){return l(this,jn)??this.title},Bs=function(e){l(this,ot)!==e&&(w(this,ot,e),p(this,M,yn).call(this))},yr=function(e,r){w(this,Ct,e),w(this,jn,r)},zr=new WeakMap,zo=new WeakMap,ql=new WeakMap,Oo=new WeakMap,Yl=new WeakMap,Iw=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||p(this,M,Cw).call(this)},Cw=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,Ct)!==s||l(this,jn)!==o;p(this,M,yr).call(this,s,o),p(this,M,js).call(this,s),a?p(this,M,yn).call(this):p(this,M,Gs).call(this);return}if(l(this,Ct)!==null){const s=p(this,M,$w).call(this,l(this,Ct));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,jn)!==o;p(this,M,yr).call(this,l(this,Ct),o),p(this,M,js).call(this,l(this,Ct)),a?p(this,M,yn).call(this):p(this,M,Gs).call(this);return}}if(l(this,Ct)!==null||l(this,jn)!==null){p(this,M,yr).call(this,null,null),p(this,M,yn).call(this);return}p(this,M,Gs).call(this)},Ah=function(){const e=l(this,Bn).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,se)!==r&&(p(this,M,Th).call(this),w(this,se,r),l(this,se)&&(l(this,se).addEventListener("click",l(this,zr)),l(this,se)instanceof HTMLButtonElement?l(this,se).hasAttribute("type")||(l(this,se).type="button"):(l(this,se).hasAttribute("role")||l(this,se).setAttribute("role","button"),l(this,se).hasAttribute("tabindex")||(l(this,se).tabIndex=0),l(this,se).addEventListener("keydown",l(this,zo))))),p(this,M,Gs).call(this),p(this,M,$h).call(this)},Gs=function(){l(this,se)&&(l(this,se).setAttribute("data-dropdown-trigger",""),l(this,se).setAttribute("aria-haspopup","listbox"),l(this,se).setAttribute("aria-expanded",l(this,ot)?"true":"false"))},$h=function(){const e=l(this,Do).value;if(!e)return;const r=l(this,Bn).querySelector("button.fallback-trigger");e.anchor=l(this,se)??r??null},Th=function(){l(this,se)&&(l(this,se).removeEventListener("click",l(this,zr)),l(this,se).removeEventListener("keydown",l(this,zo)),l(this,se).removeAttribute("data-dropdown-trigger"),l(this,se).removeAttribute("aria-haspopup"),l(this,se).removeAttribute("aria-expanded"),w(this,se,null))},yn=function(){this.toggleAttribute("open",l(this,ot)),Ve(L`
91
+ </div>`:le,l(this,Dr)),w(this,st,l(this,Dr).querySelector(".panel"))},g(bw,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",bw);class Ew extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}class IO extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var ot,Ct,jn,Bn,se,Do,Lo,M,$w,js,Tw,Iw,Ah,Cw,Bs,yr,zr,zo,ql,Oo,Yl,Rw,Pw,$h,Gs,Th,Ih,yn;class Aw extends HTMLElement{constructor(){super();S(this,M);S(this,ot,!1);S(this,Ct,null);S(this,jn,null);S(this,Bn);S(this,se,null);S(this,Do,pl());S(this,Lo,new MutationObserver(e=>p(this,M,Rw).call(this,e)));S(this,zr,()=>{p(this,M,Bs).call(this,!l(this,ot))});S(this,zo,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,zr).call(this))});S(this,ql,()=>{l(this,ot)&&p(this,M,Bs).call(this,!1)});S(this,Oo,e=>{e instanceof Ew&&(e.stopPropagation(),w(this,ot,!1),p(this,M,js).call(this,e.value),p(this,M,yn).call(this),this.dispatchEvent(new IO(e.value)))});S(this,Yl,()=>{p(this,M,$h).call(this)});w(this,Bn,this.attachShadow({mode:"open"})),Od(l(this,Bn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Oo)),p(this,M,$w).call(this),l(this,Lo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),p(this,M,yn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Oo)),l(this,Lo).disconnect(),p(this,M,Ih).call(this)}attributeChangedCallback(e){if(e==="open"){p(this,M,Bs).call(this,this.hasAttribute("open"));return}p(this,M,yn).call(this)}get open(){return l(this,ot)}set open(e){this.toggleAttribute("open",e)}get title(){return this.getAttribute("title")??""}get value(){return l(this,Ct)}set value(e){e===null?(p(this,M,yr).call(this,null,null),p(this,M,Tw).call(this)):p(this,M,js).call(this,e),p(this,M,yn).call(this)}close(){p(this,M,Bs).call(this,!1)}}ot=new WeakMap,Ct=new WeakMap,jn=new WeakMap,Bn=new WeakMap,se=new WeakMap,Do=new WeakMap,Lo=new WeakMap,M=new WeakSet,$w=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&p(this,M,yr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},js=function(e){var r;for(const i of l(this,M,Ah))i.value===e?(p(this,M,yr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},Tw=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},Iw=function(e){for(const r of l(this,M,Ah))if(r.value===e)return r;return null},Ah=function(){return this.querySelectorAll("dropdown-item")},Cw=function(){return l(this,jn)??this.title},Bs=function(e){l(this,ot)!==e&&(w(this,ot,e),p(this,M,yn).call(this))},yr=function(e,r){w(this,Ct,e),w(this,jn,r)},zr=new WeakMap,zo=new WeakMap,ql=new WeakMap,Oo=new WeakMap,Yl=new WeakMap,Rw=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||p(this,M,Pw).call(this)},Pw=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,Ct)!==s||l(this,jn)!==o;p(this,M,yr).call(this,s,o),p(this,M,js).call(this,s),a?p(this,M,yn).call(this):p(this,M,Gs).call(this);return}if(l(this,Ct)!==null){const s=p(this,M,Iw).call(this,l(this,Ct));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,jn)!==o;p(this,M,yr).call(this,l(this,Ct),o),p(this,M,js).call(this,l(this,Ct)),a?p(this,M,yn).call(this):p(this,M,Gs).call(this);return}}if(l(this,Ct)!==null||l(this,jn)!==null){p(this,M,yr).call(this,null,null),p(this,M,yn).call(this);return}p(this,M,Gs).call(this)},$h=function(){const e=l(this,Bn).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,se)!==r&&(p(this,M,Ih).call(this),w(this,se,r),l(this,se)&&(l(this,se).addEventListener("click",l(this,zr)),l(this,se)instanceof HTMLButtonElement?l(this,se).hasAttribute("type")||(l(this,se).type="button"):(l(this,se).hasAttribute("role")||l(this,se).setAttribute("role","button"),l(this,se).hasAttribute("tabindex")||(l(this,se).tabIndex=0),l(this,se).addEventListener("keydown",l(this,zo))))),p(this,M,Gs).call(this),p(this,M,Th).call(this)},Gs=function(){l(this,se)&&(l(this,se).setAttribute("data-dropdown-trigger",""),l(this,se).setAttribute("aria-haspopup","listbox"),l(this,se).setAttribute("aria-expanded",l(this,ot)?"true":"false"))},Th=function(){const e=l(this,Do).value;if(!e)return;const r=l(this,Bn).querySelector("button.fallback-trigger");e.anchor=l(this,se)??r??null},Ih=function(){l(this,se)&&(l(this,se).removeEventListener("click",l(this,zr)),l(this,se).removeEventListener("keydown",l(this,zo)),l(this,se).removeAttribute("data-dropdown-trigger"),l(this,se).removeAttribute("aria-haspopup"),l(this,se).removeAttribute("aria-expanded"),w(this,se,null))},yn=function(){this.toggleAttribute("open",l(this,ot)),Ve(L`
92
92
  <slot name="trigger" @slotchange=${l(this,Yl)}>
93
93
  <button
94
94
  class="fallback-trigger"
@@ -98,7 +98,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
98
98
  aria-expanded=${l(this,ot)?"true":"false"}
99
99
  @click=${l(this,zr)}
100
100
  >
101
- <span class="trigger-label" part="trigger-label">${l(this,M,Tw)}</span>
101
+ <span class="trigger-label" part="trigger-label">${l(this,M,Cw)}</span>
102
102
  <span class="trigger-icon" part="trigger-icon" aria-hidden="true">
103
103
  ${Fl({size:16})}
104
104
  </span>
@@ -115,13 +115,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
115
115
  <slot></slot>
116
116
  </div>`:le}
117
117
  </ui-popover>
118
- `,l(this,Bn)),p(this,M,$h).call(this),queueMicrotask(()=>p(this,M,Ah).call(this))},g(xw,"observedAttributes",["title","open"]);class TO extends HTMLElement{}class IO extends HTMLElement{}class CO extends HTMLElement{}var Xr,Ih,Pw,Mo,No;class Rw extends HTMLElement{constructor(){super(...arguments);S(this,Xr);S(this,Mo,()=>{this.action||p(this,Xr,Pw).call(this)});S(this,No,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,Mo)),this.addEventListener("keydown",l(this,No)),p(this,Xr,Ih).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Mo)),this.removeEventListener("keydown",l(this,No))}attributeChangedCallback(){p(this,Xr,Ih).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Xr=new WeakSet,Ih=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")},Pw=function(){this.dispatchEvent(new kw(this.value))},Mo=new WeakMap,No=new WeakMap,g(Rw,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",xw);customElements.get("dropdown-group")||customElements.define("dropdown-group",TO);customElements.get("dropdown-label")||customElements.define("dropdown-label",IO);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",CO);customElements.get("dropdown-item")||customElements.define("dropdown-item",Rw);class RO extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var en,Rt,ie,He,qs,Uo,Ch,vl,Rh,Fo,Ho,Zo;class Dw extends HTMLElement{constructor(){super(...arguments);S(this,He);S(this,en,"");S(this,Rt,!1);S(this,ie,null);S(this,Uo,e=>{l(this,Rt)||(e.preventDefault(),p(this,He,Ch).call(this))});S(this,Fo,e=>{e.stopPropagation()});S(this,Ho,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),p(this,He,vl).call(this,!0),(r=l(this,ie))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),p(this,He,vl).call(this,!1),(i=l(this,ie))==null||i.blur())});S(this,Zo,()=>{p(this,He,vl).call(this,!0)})}connectedCallback(){l(this,ie)||(w(this,ie,document.createElement("span")),l(this,ie).className="editable-text-span",this.append(l(this,ie)));const e=this.getAttribute("value");e!==null&&w(this,en,e),p(this,He,qs).call(this),this.addEventListener("dblclick",l(this,Uo))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,Uo)),l(this,Rt)&&p(this,He,Rh).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";w(this,en,r),l(this,Rt)||p(this,He,qs).call(this)}}get value(){return l(this,en)}set value(e){w(this,en,e),l(this,Rt)||p(this,He,qs).call(this)}startEditing(){l(this,Rt)||p(this,He,Ch).call(this)}}en=new WeakMap,Rt=new WeakMap,ie=new WeakMap,He=new WeakSet,qs=function(){l(this,ie)&&(l(this,ie).textContent=l(this,en),l(this,ie).scrollLeft=0)},Uo=new WeakMap,Ch=function(){l(this,ie)&&(w(this,Rt,!0),l(this,ie).setAttribute("contenteditable","plaintext-only"),l(this,ie).setAttribute("spellcheck","false"),l(this,ie).addEventListener("keydown",l(this,Ho)),l(this,ie).addEventListener("blur",l(this,Zo)),l(this,ie).addEventListener("mousedown",l(this,Fo)),this.toggleAttribute("data-editing",!0),queueMicrotask(()=>{var r;if(!l(this,ie))return;l(this,ie).focus();const e=(r=this.ownerDocument.defaultView)==null?void 0:r.getSelection();e==null||e.selectAllChildren(l(this,ie))}))},vl=function(e){if(!l(this,Rt)||!l(this,ie))return;const r=(l(this,ie).textContent??"").trim();w(this,Rt,!1),l(this,ie).removeAttribute("contenteditable"),l(this,ie).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),p(this,He,Rh).call(this),e&&r.length>0&&r!==l(this,en)&&(w(this,en,r),this.dispatchEvent(new RO(r))),p(this,He,qs).call(this)},Rh=function(){var e,r,i;(e=l(this,ie))==null||e.removeEventListener("keydown",l(this,Ho)),(r=l(this,ie))==null||r.removeEventListener("blur",l(this,Zo)),(i=l(this,ie))==null||i.removeEventListener("mousedown",l(this,Fo))},Fo=new WeakMap,Ho=new WeakMap,Zo=new WeakMap,g(Dw,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",Dw);class PO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Wo,rr,Ph,Kl,Vo,Dh;class Lw extends HTMLElement{constructor(){super();S(this,rr);S(this,Wo);S(this,Kl,e=>{e.target===e.currentTarget&&p(this,rr,Ph).call(this)});S(this,Vo,e=>{this.open&&e.key==="Escape"&&p(this,rr,Ph).call(this)});w(this,Wo,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Vo)),p(this,rr,Dh).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Vo))}attributeChangedCallback(){p(this,rr,Dh).call(this)}get open(){return this.hasAttribute("open")}}Wo=new WeakMap,rr=new WeakSet,Ph=function(){this.dispatchEvent(new PO)},Kl=new WeakMap,Vo=new WeakMap,Dh=function(){Ve(L`
118
+ `,l(this,Bn)),p(this,M,Th).call(this),queueMicrotask(()=>p(this,M,$h).call(this))},g(Aw,"observedAttributes",["title","open"]);class CO extends HTMLElement{}class RO extends HTMLElement{}class PO extends HTMLElement{}var Xr,Ch,Lw,Mo,No;class Dw extends HTMLElement{constructor(){super(...arguments);S(this,Xr);S(this,Mo,()=>{this.action||p(this,Xr,Lw).call(this)});S(this,No,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,Mo)),this.addEventListener("keydown",l(this,No)),p(this,Xr,Ch).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Mo)),this.removeEventListener("keydown",l(this,No))}attributeChangedCallback(){p(this,Xr,Ch).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Xr=new WeakSet,Ch=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")},Lw=function(){this.dispatchEvent(new Ew(this.value))},Mo=new WeakMap,No=new WeakMap,g(Dw,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",Aw);customElements.get("dropdown-group")||customElements.define("dropdown-group",CO);customElements.get("dropdown-label")||customElements.define("dropdown-label",RO);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",PO);customElements.get("dropdown-item")||customElements.define("dropdown-item",Dw);class DO extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var en,Rt,ie,He,qs,Uo,Rh,vl,Ph,Fo,Ho,Zo;class zw extends HTMLElement{constructor(){super(...arguments);S(this,He);S(this,en,"");S(this,Rt,!1);S(this,ie,null);S(this,Uo,e=>{l(this,Rt)||(e.preventDefault(),p(this,He,Rh).call(this))});S(this,Fo,e=>{e.stopPropagation()});S(this,Ho,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),p(this,He,vl).call(this,!0),(r=l(this,ie))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),p(this,He,vl).call(this,!1),(i=l(this,ie))==null||i.blur())});S(this,Zo,()=>{p(this,He,vl).call(this,!0)})}connectedCallback(){l(this,ie)||(w(this,ie,document.createElement("span")),l(this,ie).className="editable-text-span",this.append(l(this,ie)));const e=this.getAttribute("value");e!==null&&w(this,en,e),p(this,He,qs).call(this),this.addEventListener("dblclick",l(this,Uo))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,Uo)),l(this,Rt)&&p(this,He,Ph).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";w(this,en,r),l(this,Rt)||p(this,He,qs).call(this)}}get value(){return l(this,en)}set value(e){w(this,en,e),l(this,Rt)||p(this,He,qs).call(this)}startEditing(){l(this,Rt)||p(this,He,Rh).call(this)}}en=new WeakMap,Rt=new WeakMap,ie=new WeakMap,He=new WeakSet,qs=function(){l(this,ie)&&(l(this,ie).textContent=l(this,en),l(this,ie).scrollLeft=0)},Uo=new WeakMap,Rh=function(){l(this,ie)&&(w(this,Rt,!0),l(this,ie).setAttribute("contenteditable","plaintext-only"),l(this,ie).setAttribute("spellcheck","false"),l(this,ie).addEventListener("keydown",l(this,Ho)),l(this,ie).addEventListener("blur",l(this,Zo)),l(this,ie).addEventListener("mousedown",l(this,Fo)),this.toggleAttribute("data-editing",!0),queueMicrotask(()=>{var r;if(!l(this,ie))return;l(this,ie).focus();const e=(r=this.ownerDocument.defaultView)==null?void 0:r.getSelection();e==null||e.selectAllChildren(l(this,ie))}))},vl=function(e){if(!l(this,Rt)||!l(this,ie))return;const r=(l(this,ie).textContent??"").trim();w(this,Rt,!1),l(this,ie).removeAttribute("contenteditable"),l(this,ie).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),p(this,He,Ph).call(this),e&&r.length>0&&r!==l(this,en)&&(w(this,en,r),this.dispatchEvent(new DO(r))),p(this,He,qs).call(this)},Ph=function(){var e,r,i;(e=l(this,ie))==null||e.removeEventListener("keydown",l(this,Ho)),(r=l(this,ie))==null||r.removeEventListener("blur",l(this,Zo)),(i=l(this,ie))==null||i.removeEventListener("mousedown",l(this,Fo))},Fo=new WeakMap,Ho=new WeakMap,Zo=new WeakMap,g(zw,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",zw);class LO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Wo,rr,Dh,Kl,Vo,Lh;class Ow extends HTMLElement{constructor(){super();S(this,rr);S(this,Wo);S(this,Kl,e=>{e.target===e.currentTarget&&p(this,rr,Dh).call(this)});S(this,Vo,e=>{this.open&&e.key==="Escape"&&p(this,rr,Dh).call(this)});w(this,Wo,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Vo)),p(this,rr,Lh).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Vo))}attributeChangedCallback(){p(this,rr,Lh).call(this)}get open(){return this.hasAttribute("open")}}Wo=new WeakMap,rr=new WeakSet,Dh=function(){this.dispatchEvent(new LO)},Kl=new WeakMap,Vo=new WeakMap,Lh=function(){Ve(L`
119
119
  ${this.open?L`
120
120
  <div class="backdrop" part="backdrop" @click=${l(this,Kl)}>
121
121
  <slot></slot>
122
122
  </div>
123
123
  `:null}
124
- `,l(this,Wo))},g(Lw,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Lw);const DO=16,$u=24,LO=32;var Bi;class zw extends HTMLElement{constructor(){super();S(this,Bi);w(this,Bi,this.attachShadow({mode:"open"})),zd(l(this,Bi))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return $u;const r=Number(e);return r===DO||r===$u||r===LO?r:$u}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ve(L`<span class="spin">${mw({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,Bi))}}Bi=new WeakMap,g(zw,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",zw);class zO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class OO extends HTMLElement{}var jo,Bo,Lh;class Ow extends HTMLElement{constructor(){super();S(this,Bo);S(this,jo);w(this,jo,this.attachShadow({mode:"open"}))}connectedCallback(){p(this,Bo,Lh).call(this)}attributeChangedCallback(){p(this,Bo,Lh).call(this)}get closable(){return this.hasAttribute("closable")}}jo=new WeakMap,Bo=new WeakSet,Lh=function(){const e=this.querySelector("panel-page");Ve(L`
124
+ `,l(this,Wo))},g(Ow,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Ow);const zO=16,Tu=24,OO=32;var Bi;class Mw extends HTMLElement{constructor(){super();S(this,Bi);w(this,Bi,this.attachShadow({mode:"open"})),Od(l(this,Bi))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return Tu;const r=Number(e);return r===zO||r===Tu||r===OO?r:Tu}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ve(L`<span class="spin">${yw({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,Bi))}}Bi=new WeakMap,g(Mw,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",Mw);class MO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class NO extends HTMLElement{}var jo,Bo,zh;class Nw extends HTMLElement{constructor(){super();S(this,Bo);S(this,jo);w(this,jo,this.attachShadow({mode:"open"}))}connectedCallback(){p(this,Bo,zh).call(this)}attributeChangedCallback(){p(this,Bo,zh).call(this)}get closable(){return this.hasAttribute("closable")}}jo=new WeakMap,Bo=new WeakSet,zh=function(){const e=this.querySelector("panel-page");Ve(L`
125
125
  <section class="panel" part="panel">
126
126
  <header class="title-bar" part="header">
127
127
  <h2 class="title" part="title">${(e==null?void 0:e.getAttribute("title"))??""}</h2>
@@ -131,19 +131,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
131
131
  class="title-button"
132
132
  part="button close-button"
133
133
  aria-label="Close"
134
- @click=${()=>this.dispatchEvent(new zO)}
134
+ @click=${()=>this.dispatchEvent(new MO)}
135
135
  >
136
- <span class="close-icon" part="icon close-icon">${Xd({size:16})}</span>
136
+ <span class="close-icon" part="icon close-icon">${Qd({size:16})}</span>
137
137
  </button>
138
138
  `:null}
139
139
  </header>
140
140
  <slot></slot>
141
141
  </section>
142
- `,l(this,jo))},g(Ow,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Ow);customElements.get("panel-page")||customElements.define("panel-page",OO);const MO=`
142
+ `,l(this,jo))},g(Nw,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Nw);customElements.get("panel-page")||customElements.define("panel-page",NO);const UO=`
143
143
  <svg viewBox="0 0 12 12" aria-hidden="true" focusable="false">
144
144
  <path d="M10.2 3.1 5.1 8.2 2.4 5.5" />
145
145
  </svg>
146
- `,NO=`
146
+ `,FO=`
147
147
  :host {
148
148
  display: block;
149
149
  margin: var(--checkbox-list-margin, var(--space-12) 0);
@@ -153,7 +153,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
153
153
  display: grid;
154
154
  gap: var(--checkbox-list-gap, var(--space-6));
155
155
  }
156
- `,UO=`
156
+ `,HO=`
157
157
  :host {
158
158
  display: block;
159
159
  --checkbox-size: 1em;
@@ -234,26 +234,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
234
234
  text-decoration-line: var(--checkbox-checked-decoration);
235
235
  text-decoration-thickness: var(--checkbox-checked-decoration-thickness);
236
236
  }
237
- `;var Go;class FO extends HTMLElement{constructor(){super();S(this,Go);w(this,Go,this.attachShadow({mode:"open"})),l(this,Go).innerHTML=`<style>${NO}</style><div part="list"><slot></slot></div>`}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","list")}}Go=new WeakMap;var Gi,qo,Yo,zh;class Mw extends HTMLElement{constructor(){super();S(this,Yo);S(this,Gi);S(this,qo);w(this,Gi,this.attachShadow({mode:"open"})),l(this,Gi).innerHTML=`
238
- <style>${UO}</style>
237
+ `;var Go;class ZO extends HTMLElement{constructor(){super();S(this,Go);w(this,Go,this.attachShadow({mode:"open"})),l(this,Go).innerHTML=`<style>${FO}</style><div part="list"><slot></slot></div>`}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","list")}}Go=new WeakMap;var Gi,qo,Yo,Oh;class Uw extends HTMLElement{constructor(){super();S(this,Yo);S(this,Gi);S(this,qo);w(this,Gi,this.attachShadow({mode:"open"})),l(this,Gi).innerHTML=`
238
+ <style>${HO}</style>
239
239
  <label part="label">
240
240
  <input type="checkbox" disabled tabindex="-1">
241
- <span part="box"><span part="check">${MO}</span></span>
241
+ <span part="box"><span part="check">${UO}</span></span>
242
242
  <span part="content"><slot></slot></span>
243
243
  </label>
244
- `;const e=l(this,Gi).querySelector("input");if(!(e instanceof HTMLInputElement))throw new Error("checkbox-item failed to initialize input");w(this,qo,e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","listitem"),this.setAttribute("aria-disabled","true"),p(this,Yo,zh).call(this)}attributeChangedCallback(){p(this,Yo,zh).call(this)}}Gi=new WeakMap,qo=new WeakMap,Yo=new WeakSet,zh=function(){const e=this.hasAttribute("checked");l(this,qo).checked=e,this.setAttribute("aria-checked",e?"true":"false")},g(Mw,"observedAttributes",["checked"]);customElements.get("checkbox-list")||customElements.define("checkbox-list",FO);customElements.get("checkbox-item")||customElements.define("checkbox-item",Mw);const Nw=je(),Uw="No handler registered for update-content",Fw="handleUpdateContent: handler already registered",om="television-artifact-bridge";function Hw(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const Zw=wa(Ot);var qi,Yi,Ki,Or,Mr,Ko,Ze,Oh,Ww,Vw,Ys,Mh,Zm;let HO=(Zm=class extends Zw{constructor(e){super();S(this,Ze);S(this,qi);S(this,Yi);S(this,Ki);S(this,Or,null);S(this,Mr,null);S(this,Ko,!1);w(this,qi,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");w(this,Yi,r),w(this,Ki,i=>p(this,Ze,Ww).call(this,i)),l(this,Yi).addEventListener("message",l(this,Ki))}get content(){return l(this,Mr)}set content(e){p(this,Ze,Mh).call(this),w(this,Mr,e),l(this,Ko)&&p(this,Ze,Oh).call(this,e)}handleUpdateContent(e){if(p(this,Ze,Mh).call(this),l(this,Or)!==null)throw new Error(Fw);w(this,Or,e)}dispose(){l(this,Yi).removeEventListener("message",l(this,Ki)),w(this,Or,null)}},qi=new WeakMap,Yi=new WeakMap,Ki=new WeakMap,Or=new WeakMap,Mr=new WeakMap,Ko=new WeakMap,Ze=new WeakSet,Oh=function(e){const r={type:"content-updated",content:e};p(this,Ze,Ys).call(this,r)},Ww=function(e){if(this.disposed||e.source!==l(this,qi).contentWindow)return;const r=e.data;if(sb(r)){w(this,Ko,!0),this.dispatchEvent(new Nw("ready")),l(this,Mr)!==null&&p(this,Ze,Oh).call(this,l(this,Mr));return}if(ob(r)){p(this,Ze,Vw).call(this,r);return}},Vw=async function(e){const r=l(this,Or);if(r===null){p(this,Ze,Ys).call(this,{type:"response",id:e.id,error:{message:Uw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,Ze,Ys).call(this,{type:"response",id:e.id,error:{message:Hw(i)}});return}this.disposed||p(this,Ze,Ys).call(this,{type:"response",id:e.id,result:{}})},Ys=function(e){const r=l(this,qi).contentWindow;r&&r.postMessage(e,"*")},Mh=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Zm);var Nr,Ji,Ur,Fr,Jo,We,Nh,jw,Bw,Ks,Uh;class ZO extends Zw{constructor(e){super();S(this,We);S(this,Nr);S(this,Ji);S(this,Ur,null);S(this,Fr,null);S(this,Jo,!1);w(this,Nr,e),w(this,Ji,r=>p(this,We,jw).call(this,r)),l(this,Nr).addEventListener("ipc-message",l(this,Ji))}get content(){return l(this,Fr)}set content(e){p(this,We,Uh).call(this),w(this,Fr,e),l(this,Jo)&&p(this,We,Nh).call(this,e)}handleUpdateContent(e){if(p(this,We,Uh).call(this),l(this,Ur)!==null)throw new Error(Fw);w(this,Ur,e)}dispose(){l(this,Nr).removeEventListener("ipc-message",l(this,Ji)),w(this,Ur,null)}}Nr=new WeakMap,Ji=new WeakMap,Ur=new WeakMap,Fr=new WeakMap,Jo=new WeakMap,We=new WeakSet,Nh=function(e){const r={type:"content-updated",content:e};p(this,We,Ks).call(this,r)},jw=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==om)return;const i=(s=r.args)==null?void 0:s[0];if(sb(i)){w(this,Jo,!0),this.dispatchEvent(new Nw("ready")),l(this,Fr)!==null&&p(this,We,Nh).call(this,l(this,Fr));return}if(ob(i)){p(this,We,Bw).call(this,i);return}},Bw=async function(e){const r=l(this,Ur);if(r===null){p(this,We,Ks).call(this,{type:"response",id:e.id,error:{message:Uw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,We,Ks).call(this,{type:"response",id:e.id,error:{message:Hw(i)}});return}this.disposed||p(this,We,Ks).call(this,{type:"response",id:e.id,result:{}})},Ks=function(e){var r,i;(i=(r=l(this,Nr)).send)==null||i.call(r,om,e)},Uh=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};const am="television-artifact-bridge",lm="/views/url-unsupported/",WO=404,Gw=je(),VO=je(),jO=je();class BO 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,"_markdownFrame",null);g(this,"_markdownHost",null);g(this,"_markdownContentURL",null);g(this,"_proxyReloadVersion",0);g(this,"_navigationState",null);g(this,"_navigationArtifactId",null);g(this,"_navigationCanonicalURL",null);g(this,"_preserveFrameSrcOnNavigationRender",!1);g(this,"_frameMayHaveSameDocumentURL",!1);g(this,"_missingArtifactID",null);g(this,"handleIframeMessage",e=>{var i,s;const r=this.querySelector("iframe.artifact-frame");if(!(!r||r.contentWindow!==e.source)){if(Mp(e.data)){this.dispatchArtifactWheel({deltaX:e.data.deltaX,shiftKey:e.data.shiftKey});return}if(Np(e.data)){this.dispatchArtifactFilmstripKey(e.data.direction);return}if(X0(e.data)){(i=r.contentWindow)==null||i.postMessage({type:Q0,url:this.currentExternalTargetURL()},"*");return}if(Up(e.data)){(s=r.contentWindow)==null||s.postMessage(this.currentMissingArtifactMessage(),"*");return}if(Fp(e.data)){this.handleProxyContentChanged();return}eS(e.data)&&this.handleNavigationRequest(e.data)}});g(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;this.render({preserveFrameSrc:e}),this._preserveFrameSrcOnNavigationRender=!1,r&&(window.setTimeout(()=>this.forceCurrentFrameSrc(),0),this._frameMayHaveSameDocumentURL=!1)});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"&&mn(this._artifact.url)||this.reloadProxyFrame()});g(this,"handleWebviewIpcMessage",e=>{var o,a;const r=e.detail??e;if(!r||r.channel!==am)return;const i=(o=r.args)==null?void 0:o[0];if(!i)return;const s=this._subscribedWebview;if(s){if(Up(i)){const c=this.currentMissingArtifactMessage();c&&((a=s.send)==null||a.call(s,am,c));return}if(Mp(i)){this.dispatchArtifactWheel({deltaX:i.deltaX,shiftKey:i.shiftKey});return}if(Np(i)){this.dispatchArtifactFilmstripKey(i.direction);return}Fp(i)&&this.handleProxyContentChanged()}});g(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});g(this,"handleWebviewDidNavigateInPage",e=>{this.handleWebviewNavigationEvent(e)});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;((r==null?void 0:r.id)!==e.id||r.kind==="path"&&e.kind==="path"&&r.path!==e.path)&&(this._missingArtifactID=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){var r,i,s,o;this._screen!==e&&((r=this._screen)==null||r.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),(i=this._screen)==null||i.removeEventListener("theme-changed",this.handleThemeChanged),this._screen=e,(s=this._screen)==null||s.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),(o=this._screen)==null||o.addEventListener("theme-changed",this.handleThemeChanged),this.syncMarkdownHost())}get screen(){return this._screen}get activeView(){return null}set standaloneScroll(e){this._standaloneScroll=e}get standaloneScroll(){return this._standaloneScroll}connectedCallback(){this.setAttribute("level","2"),this.render(),window.addEventListener("message",this.handleIframeMessage),this.syncWebviewSubscription(),this.syncNavigationState()}disconnectedCallback(){var e,r;window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview(),this.unsubscribeFromEmbedLoad(),this.syncNavigationState(),(e=this._screen)==null||e.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),(r=this._screen)==null||r.removeEventListener("theme-changed",this.handleThemeChanged),this.disposeMarkdownHost()}handleClose(){this._artifact&&this.dispatchEvent(new Gw("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&&Tu(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:tS,title:e.title,path:e.path}}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!mn(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===lm||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0,this._frameMayHaveSameDocumentURL=!0),e.replace?r.replace(i):r.navigate(i)}dispatchArtifactFilmstripKey(e){this._standaloneScroll||this.dispatchEvent(new jO("artifact-filmstrip-key",{bubbles:!0,composed:!0,direction:e}))}dispatchArtifactWheel(e){this._standaloneScroll||this.dispatchEvent(new VO("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 jz(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,this._frameMayHaveSameDocumentURL=!1}canonicalURLForArtifact(e){const r=zl(e,{electron:ln()}),i=this._viewURL??r.viewURL;return e.kind==="url"&&mn(e.url)||r.renderer==="url-webview"?In(i):cm(i,i)}convertIframeNavigationURL(e){var i,s;if(((i=this._artifact)==null?void 0:i.kind)==="url"&&mn(this._artifact.url)&&mn(e))return In(e);const r=(s=this.querySelector(".artifact-frame"))==null?void 0:s.getAttribute("src");return cm(e,r??this._viewURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string")return;this.syncNavigationState();const i=this._navigationState;if(!i)return;const s=In(r);s!==i.currentURL&&i.navigate(s)}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-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-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(){const e=this.querySelector("[data-content-url]"),r=(e==null?void 0:e.dataset.contentUrl)??null;if(!e||!r||!this._artifact||!this._screen){this.disposeMarkdownHost();return}if(e===this._markdownFrame&&r===this._markdownContentURL)return;this.disposeMarkdownHost(),this._markdownFrame=e,this._markdownContentURL=r;const i=e.tagName.toLowerCase()==="webview"?new ZO(e):new HO(e);this._markdownHost=i,i.handleUpdateContent(async s=>{const o=this._artifact,a=this._screen;if(!o||!a)throw new Error("No markdown artifact selected");await a.server.client.markdown.update({artifactID:o.id,content:s}),i.content=s}),this.fetchMarkdownContent()}async fetchMarkdownContent(){const e=this._artifact,r=this._markdownHost,i=this._screen;if(!(!e||!i))try{const s=await i.server.client.markdown.get({artifactID:e.id});if(this._missingArtifactID=null,!r){this.render();return}r.content=s}catch(s){if(s instanceof Nd&&s.status===WO){this._missingArtifactID=e.id,this.disposeMarkdownHost(),this.render();return}}}isCurrentMarkdownMissing(){var e;return this._missingArtifactID===((e=this._artifact)==null?void 0:e.id)&&this._artifact.kind==="path"&&rb(this._artifact.path)}missingArtifactTemplate(e){return L`
244
+ `;const e=l(this,Gi).querySelector("input");if(!(e instanceof HTMLInputElement))throw new Error("checkbox-item failed to initialize input");w(this,qo,e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","listitem"),this.setAttribute("aria-disabled","true"),p(this,Yo,Oh).call(this)}attributeChangedCallback(){p(this,Yo,Oh).call(this)}}Gi=new WeakMap,qo=new WeakMap,Yo=new WeakSet,Oh=function(){const e=this.hasAttribute("checked");l(this,qo).checked=e,this.setAttribute("aria-checked",e?"true":"false")},g(Uw,"observedAttributes",["checked"]);customElements.get("checkbox-list")||customElements.define("checkbox-list",ZO);customElements.get("checkbox-item")||customElements.define("checkbox-item",Uw);const Fw=je(),Hw="No handler registered for update-content",Zw="handleUpdateContent: handler already registered",lm="television-artifact-bridge";function Ww(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const Vw=wa(Ot);var qi,Yi,Ki,Or,Mr,Ko,Ze,Mh,jw,Bw,Ys,Nh,Vm;let WO=(Vm=class extends Vw{constructor(e){super();S(this,Ze);S(this,qi);S(this,Yi);S(this,Ki);S(this,Or,null);S(this,Mr,null);S(this,Ko,!1);w(this,qi,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");w(this,Yi,r),w(this,Ki,i=>p(this,Ze,jw).call(this,i)),l(this,Yi).addEventListener("message",l(this,Ki))}get content(){return l(this,Mr)}set content(e){p(this,Ze,Nh).call(this),w(this,Mr,e),l(this,Ko)&&p(this,Ze,Mh).call(this,e)}handleUpdateContent(e){if(p(this,Ze,Nh).call(this),l(this,Or)!==null)throw new Error(Zw);w(this,Or,e)}dispose(){l(this,Yi).removeEventListener("message",l(this,Ki)),w(this,Or,null)}},qi=new WeakMap,Yi=new WeakMap,Ki=new WeakMap,Or=new WeakMap,Mr=new WeakMap,Ko=new WeakMap,Ze=new WeakSet,Mh=function(e){const r={type:"content-updated",content:e};p(this,Ze,Ys).call(this,r)},jw=function(e){if(this.disposed||e.source!==l(this,qi).contentWindow)return;const r=e.data;if(ab(r)){w(this,Ko,!0),this.dispatchEvent(new Fw("ready")),l(this,Mr)!==null&&p(this,Ze,Mh).call(this,l(this,Mr));return}if(lb(r)){p(this,Ze,Bw).call(this,r);return}},Bw=async function(e){const r=l(this,Or);if(r===null){p(this,Ze,Ys).call(this,{type:"response",id:e.id,error:{message:Hw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,Ze,Ys).call(this,{type:"response",id:e.id,error:{message:Ww(i)}});return}this.disposed||p(this,Ze,Ys).call(this,{type:"response",id:e.id,result:{}})},Ys=function(e){const r=l(this,qi).contentWindow;r&&r.postMessage(e,"*")},Nh=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Vm);var Nr,Ji,Ur,Fr,Jo,We,Uh,Gw,qw,Ks,Fh;class VO extends Vw{constructor(e){super();S(this,We);S(this,Nr);S(this,Ji);S(this,Ur,null);S(this,Fr,null);S(this,Jo,!1);w(this,Nr,e),w(this,Ji,r=>p(this,We,Gw).call(this,r)),l(this,Nr).addEventListener("ipc-message",l(this,Ji))}get content(){return l(this,Fr)}set content(e){p(this,We,Fh).call(this),w(this,Fr,e),l(this,Jo)&&p(this,We,Uh).call(this,e)}handleUpdateContent(e){if(p(this,We,Fh).call(this),l(this,Ur)!==null)throw new Error(Zw);w(this,Ur,e)}dispose(){l(this,Nr).removeEventListener("ipc-message",l(this,Ji)),w(this,Ur,null)}}Nr=new WeakMap,Ji=new WeakMap,Ur=new WeakMap,Fr=new WeakMap,Jo=new WeakMap,We=new WeakSet,Uh=function(e){const r={type:"content-updated",content:e};p(this,We,Ks).call(this,r)},Gw=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==lm)return;const i=(s=r.args)==null?void 0:s[0];if(ab(i)){w(this,Jo,!0),this.dispatchEvent(new Fw("ready")),l(this,Fr)!==null&&p(this,We,Uh).call(this,l(this,Fr));return}if(lb(i)){p(this,We,qw).call(this,i);return}},qw=async function(e){const r=l(this,Ur);if(r===null){p(this,We,Ks).call(this,{type:"response",id:e.id,error:{message:Hw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,We,Ks).call(this,{type:"response",id:e.id,error:{message:Ww(i)}});return}this.disposed||p(this,We,Ks).call(this,{type:"response",id:e.id,result:{}})},Ks=function(e){var r,i;(i=(r=l(this,Nr)).send)==null||i.call(r,lm,e)},Fh=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};const cm="television-artifact-bridge",um="/views/url-unsupported/",jO=404,Yw=je(),BO=je(),GO=je();class qO 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,"_markdownFrame",null);g(this,"_markdownHost",null);g(this,"_markdownContentURL",null);g(this,"_proxyReloadVersion",0);g(this,"_navigationState",null);g(this,"_navigationArtifactId",null);g(this,"_navigationCanonicalURL",null);g(this,"_preserveFrameSrcOnNavigationRender",!1);g(this,"_frameMayHaveSameDocumentURL",!1);g(this,"_missingArtifactID",null);g(this,"handleIframeMessage",e=>{var i,s;const r=this.querySelector("iframe.artifact-frame");if(!(!r||r.contentWindow!==e.source)){if(Np(e.data)){this.dispatchArtifactWheel({deltaX:e.data.deltaX,shiftKey:e.data.shiftKey});return}if(Up(e.data)){this.dispatchArtifactFilmstripKey(e.data.direction);return}if(eS(e.data)){(i=r.contentWindow)==null||i.postMessage({type:tS,url:this.currentExternalTargetURL()},"*");return}if(Fp(e.data)){(s=r.contentWindow)==null||s.postMessage(this.currentMissingArtifactMessage(),"*");return}if(Hp(e.data)){this.handleProxyContentChanged();return}nS(e.data)&&this.handleNavigationRequest(e.data)}});g(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;this.render({preserveFrameSrc:e}),this._preserveFrameSrcOnNavigationRender=!1,r&&(window.setTimeout(()=>this.forceCurrentFrameSrc(),0),this._frameMayHaveSameDocumentURL=!1)});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"&&mn(this._artifact.url)||this.reloadProxyFrame()});g(this,"handleWebviewIpcMessage",e=>{var o,a;const r=e.detail??e;if(!r||r.channel!==cm)return;const i=(o=r.args)==null?void 0:o[0];if(!i)return;const s=this._subscribedWebview;if(s){if(Fp(i)){const c=this.currentMissingArtifactMessage();c&&((a=s.send)==null||a.call(s,cm,c));return}if(Np(i)){this.dispatchArtifactWheel({deltaX:i.deltaX,shiftKey:i.shiftKey});return}if(Up(i)){this.dispatchArtifactFilmstripKey(i.direction);return}Hp(i)&&this.handleProxyContentChanged()}});g(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});g(this,"handleWebviewDidNavigateInPage",e=>{this.handleWebviewNavigationEvent(e)});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;((r==null?void 0:r.id)!==e.id||r.kind==="path"&&e.kind==="path"&&r.path!==e.path)&&(this._missingArtifactID=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){var r,i,s,o;this._screen!==e&&((r=this._screen)==null||r.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),(i=this._screen)==null||i.removeEventListener("theme-changed",this.handleThemeChanged),this._screen=e,(s=this._screen)==null||s.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),(o=this._screen)==null||o.addEventListener("theme-changed",this.handleThemeChanged),this.syncMarkdownHost())}get screen(){return this._screen}get activeView(){return null}set standaloneScroll(e){this._standaloneScroll=e}get standaloneScroll(){return this._standaloneScroll}connectedCallback(){this.setAttribute("level","2"),this.render(),window.addEventListener("message",this.handleIframeMessage),this.syncWebviewSubscription(),this.syncNavigationState()}disconnectedCallback(){var e,r;window.removeEventListener("message",this.handleIframeMessage),this.unsubscribeFromWebview(),this.unsubscribeFromEmbedLoad(),this.syncNavigationState(),(e=this._screen)==null||e.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),(r=this._screen)==null||r.removeEventListener("theme-changed",this.handleThemeChanged),this.disposeMarkdownHost()}handleClose(){this._artifact&&this.dispatchEvent(new Yw("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&&Iu(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:rS,title:e.title,path:e.path}}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!mn(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===um||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0,this._frameMayHaveSameDocumentURL=!0),e.replace?r.replace(i):r.navigate(i)}dispatchArtifactFilmstripKey(e){this._standaloneScroll||this.dispatchEvent(new GO("artifact-filmstrip-key",{bubbles:!0,composed:!0,direction:e}))}dispatchArtifactWheel(e){this._standaloneScroll||this.dispatchEvent(new BO("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 Gz(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,this._frameMayHaveSameDocumentURL=!1}canonicalURLForArtifact(e){const r=zl(e,{electron:ln()}),i=this._viewURL??r.viewURL;return e.kind==="url"&&mn(e.url)||r.renderer==="url-webview"?In(i):hm(i,i)}convertIframeNavigationURL(e){var i,s;if(((i=this._artifact)==null?void 0:i.kind)==="url"&&mn(this._artifact.url)&&mn(e))return In(e);const r=(s=this.querySelector(".artifact-frame"))==null?void 0:s.getAttribute("src");return hm(e,r??this._viewURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string")return;this.syncNavigationState();const i=this._navigationState;if(!i)return;const s=In(r);s!==i.currentURL&&i.navigate(s)}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-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-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(){const e=this.querySelector("[data-content-url]"),r=(e==null?void 0:e.dataset.contentUrl)??null;if(!e||!r||!this._artifact||!this._screen){this.disposeMarkdownHost();return}if(e===this._markdownFrame&&r===this._markdownContentURL)return;this.disposeMarkdownHost(),this._markdownFrame=e,this._markdownContentURL=r;const i=e.tagName.toLowerCase()==="webview"?new VO(e):new WO(e);this._markdownHost=i,i.handleUpdateContent(async s=>{const o=this._artifact,a=this._screen;if(!o||!a)throw new Error("No markdown artifact selected");await a.server.client.markdown.update({artifactID:o.id,content:s}),i.content=s}),this.fetchMarkdownContent()}async fetchMarkdownContent(){const e=this._artifact,r=this._markdownHost,i=this._screen;if(!(!e||!i))try{const s=await i.server.client.markdown.get({artifactID:e.id});if(this._missingArtifactID=null,!r){this.render();return}r.content=s}catch(s){if(s instanceof Ud&&s.status===jO){this._missingArtifactID=e.id,this.disposeMarkdownHost(),this.render();return}}}isCurrentMarkdownMissing(){var e;return this._missingArtifactID===((e=this._artifact)==null?void 0:e.id)&&this._artifact.kind==="path"&&sb(this._artifact.path)}missingArtifactTemplate(e){return L`
245
245
  <section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
246
246
  <div class="artifact-missing-wrapper">
247
- <h1>${iS()}</h1>
248
- <p>${sS()}</p>
247
+ <h1>${oS()}</h1>
248
+ <p>${aS()}</p>
249
249
  <section class="artifact-missing-path" aria-label="Missing artifact path">
250
250
  <p class="artifact-missing-path-label">Registered path:</p>
251
251
  <p><code>${e.path}</code></p>
252
252
  </section>
253
- <p>${oS()}</p>
253
+ <p>${lS()}</p>
254
254
  </div>
255
255
  </section>
256
- `}disposeMarkdownHost(){var e;(e=this._markdownHost)==null||e.dispose(),this._markdownHost=null,this._markdownFrame=null,this._markdownContentURL=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"&&mn(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&mn(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??e.getAttribute("src"):e.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(Ol,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this.removeAttribute("data-embed-loaded"),e.setAttribute("src",s),this.syncEmbedLoadState()}contentTemplate(e,r){var c;if(e.kind==="path"&&this.isCurrentMarkdownMissing())return this.missingArtifactTemplate(e);const i=this.routeForCurrentNavigation(e),s=(c=this.querySelector(".artifact-frame"))==null?void 0:c.getAttribute("src"),o=r.preserveFrameSrc&&s?s:i.viewURL,a=this._contentURL??i.contentURL;return i.renderer==="url-webview"?i.contentURL?L`<webview allowpopups class="artifact-frame artifact-content" src=${o} data-content-url=${a}></webview>`:L`<webview allowpopups class="artifact-frame artifact-content" src=${o}></webview>`:i.renderer==="markdown"?L`<iframe class="artifact-frame artifact-content" src=${o} data-content-url=${a}></iframe>`:L`<iframe class="artifact-frame artifact-content" src=${o}></iframe>`}routeForCurrentNavigation(e){var s;const r=zl(e,{electron:ln()}),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 Tu(i)&&!ln()?mn(i)?{renderer:"proxy-iframe",viewURL:i,contentURL:null}:{renderer:"proxy-iframe",viewURL:lm,contentURL:null}:Tu(i)&&ln()?{renderer:"url-webview",viewURL:i,contentURL:null}:ln()?{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.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?L`
256
+ `}disposeMarkdownHost(){var e;(e=this._markdownHost)==null||e.dispose(),this._markdownHost=null,this._markdownFrame=null,this._markdownContentURL=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"&&mn(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&mn(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??e.getAttribute("src"):e.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(Ol,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this.removeAttribute("data-embed-loaded"),e.setAttribute("src",s),this.syncEmbedLoadState()}contentTemplate(e,r){var c;if(e.kind==="path"&&this.isCurrentMarkdownMissing())return this.missingArtifactTemplate(e);const i=this.routeForCurrentNavigation(e),s=(c=this.querySelector(".artifact-frame"))==null?void 0:c.getAttribute("src"),o=r.preserveFrameSrc&&s?s:i.viewURL,a=this._contentURL??i.contentURL;return i.renderer==="url-webview"?i.contentURL?L`<webview allowpopups class="artifact-frame artifact-content" src=${o} data-content-url=${a}></webview>`:L`<webview allowpopups class="artifact-frame artifact-content" src=${o}></webview>`:i.renderer==="markdown"?L`<iframe class="artifact-frame artifact-content" src=${o} data-content-url=${a}></iframe>`:L`<iframe class="artifact-frame artifact-content" src=${o}></iframe>`}routeForCurrentNavigation(e){var s;const r=zl(e,{electron:ln()}),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 Iu(i)&&!ln()?mn(i)?{renderer:"proxy-iframe",viewURL:i,contentURL:null}:{renderer:"proxy-iframe",viewURL:um,contentURL:null}:Iu(i)&&ln()?{renderer:"url-webview",viewURL:i,contentURL:null}:ln()?{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.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?L`
257
257
  <button
258
258
  icon-only
259
259
  size="sm"
@@ -262,7 +262,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
262
262
  @click=${()=>e.back()}
263
263
  aria-label="Back"
264
264
  >
265
- ${yO({size:16})}
265
+ ${wO({size:16})}
266
266
  </button>
267
267
  `:L`
268
268
  <button
@@ -273,7 +273,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
273
273
  disabled
274
274
  aria-label="No history"
275
275
  >
276
- ${_O({size:16,weight:"duotone"})}
276
+ ${xO({size:16,weight:"duotone"})}
277
277
  </button>
278
278
  `}template(e={preserveFrameSrc:!1}){const r=this._artifact;return L`
279
279
  ${this.contentTemplate(r,e)}
@@ -291,15 +291,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
291
291
  @click=${()=>this.handleClose()}
292
292
  aria-label="Close"
293
293
  >
294
- ${Xd({size:16})}
294
+ ${Qd({size:16})}
295
295
  </button>
296
296
  </div>
297
297
  </footer>
298
- `}render(e={}){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ve(this.template({preserveFrameSrc:e.preserveFrameSrc??!1}),this),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncWebviewSubscription(),this.syncEmbedLoadState(),this.syncMarkdownHost())}}function Tu(n){return n.startsWith("http://")||n.startsWith("https://")}function cm(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(Ol),`${e.pathname}${e.search}${e.hash}`}}catch{return In(n)}return In(n)}customElements.define("artifact-view",BO);/**
298
+ `}render(e={}){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ve(this.template({preserveFrameSrc:e.preserveFrameSrc??!1}),this),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncWebviewSubscription(),this.syncEmbedLoadState(),this.syncMarkdownHost())}}function Iu(n){return n.startsWith("http://")||n.startsWith("https://")}function hm(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(Ol),`${e.pathname}${e.search}${e.hash}`}}catch{return In(n)}return In(n)}customElements.define("artifact-view",qO);/**
299
299
  * @license
300
300
  * Copyright 2017 Google LLC
301
301
  * SPDX-License-Identifier: BSD-3-Clause
302
- */const um=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},hm=Ac(class extends Jd{constructor(n){if(super(n),n.type!==Kd.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=dO(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,y=i.length-1,m=0,E=s.length-1;for(;f<=y&&m<=E;)if(i[f]===null)f++;else if(i[y]===null)y--;else if(a[f]===o[m])c[m]=pr(i[f],s[m]),f++,m++;else if(a[y]===o[E])c[E]=pr(i[y],s[E]),y--,E--;else if(a[f]===o[E])c[E]=pr(i[f],s[E]),Ds(n,c[E+1],i[f]),f++,E--;else if(a[y]===o[m])c[m]=pr(i[y],s[m]),Ds(n,i[f],i[y]),y--,m++;else if(u===void 0&&(u=um(o,m,E),h=um(a,f,y)),u.has(a[f]))if(u.has(a[y])){const x=h.get(o[m]),I=x!==void 0?i[x]:null;if(I===null){const P=Ds(n,i[f]);pr(P,s[m]),c[m]=P}else c[m]=pr(I,s[m]),Ds(n,i[f],I),i[x]=null;m++}else xu(i[y]),y--;else xu(i[f]),f++;for(;m<=E;){const x=Ds(n,c[E+1]);pr(x,s[m]),c[m++]=x}for(;f<=y;){const x=i[f++];x!==null&&xu(x)}return this.ut=o,hO(n,c),Yr}}),Ie=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Ga=2;class GO{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??Ie({x:ae,y:ae});const e=this._viewport.x??Br,r=this._viewport.y??ao,i=this._gap.x??ae,s=this._gap.y??ae,o=e<=e$,a=o?e-i*Ga:Math.min(Br,e-i*Ga),c=o?r-s*Ga:Math.min(ao,r-s*Ga),u=(a-i*(qe-1))/qe,h=(c-s*(ft-1))/ft,f=this.basis.x??0,y=this.basis.y??0,m=this.min.x??0,E=this.min.y??0;this._unit=Ie(o?{x:Math.max(m,u),y:Math.max(E,h)}:{x:Math.max(m,Math.min(f,u)),y:Math.max(E,Math.min(y,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(t){return Te({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??ae,s=this._gap.y??ae,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 Ie({x:o,y:a})}}const Kr=1e-4,Dt=1e-6,qO=40,YO=24;function qw(n,t){return Math.max(0,n-t*2)}function Yw(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function Kw(n){const t=[0];for(let e=0;e<n.length;e+=1){const r=t[e]??0;t.push(r+n[e]+ae)}return t}function Jw(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+ae+o;if(a>e+Kr)break;r=a,i+=1}return Math.max(1,i)}function KO(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+ae+o;if(a>e+Kr)break;r=a,i+=1}return Math.max(1,i)}function JO(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+ae+s;if(o>t+Kr)break;e=o,r+=1}return Math.max(1,r)}function Qd(n,t){if(n.length===0)return 0;const e=JO(n,t);return Math.max(0,n.length-e)}function dm(n,t,e){if(n.length===0)return 0;const r=Jw(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)*ae}function Fh(n,t,e){const r=n[t]??0;return e-r}function ki(n,t,e,r,i){if(n.length===0)return 0;const s=Qd(n,i),o=t[s]??0,a=Math.max(0,Math.min(o,e));let c=0;for(let F=0;F<s;F+=1){const Y=t[F]??0,B=t[F+1]??Y;if(a>=Y&&a<=B+Kr){c=F;break}c=F+1}const u=Math.min(c+1,s),h=t[c]??0,f=t[u]??h,y=Math.max(f-h,Kr),m=u===c?0:(a-h)/y,E=Kw(n),x=dm(n,c,i),I=dm(n,u,i),P=(r-x)/2,R=(r-I)/2,V=Fh(E,c,P),N=Fh(E,u,R);return V+(N-V)*m}function XO(n,t,e,r,i){const s=Qd(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<qO;u+=1){const h=(a+c)/2;ki(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function QO(n,t,e){const r=Kw(n),[i,s]=t,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ae,c=(e-a)/2;return Fh(r,i,c)}function eM(n,t,e){const r=Jw(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function tM(n,t,e){const r=KO(n,t,e);return[Math.max(0,t-r+1),t]}function nM(n,t){return n[0]===t[0]&&n[1]===t[1]}function rM(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??ae,o=qw(r,s),a=Yw(t),c=Qd(e,o),u=a[c]??0;function h(I){const P=QO(e,I,r),R=XO(e,a,r,o,P);return{nodeRange:I,anchor:Math.max(0,Math.min(u,R))}}const f=[];for(let I=0;I<i;){const P=eM(e,I,o);f.push(h(P)),I=P[1]+1}const y=h(tM(e,i-1,o)),m=f.filter(I=>I.nodeRange[0]<y.nodeRange[0]),E=m[m.length-1];return{viewspans:E&&nM(E.nodeRange,y.nodeRange)?m:[...m,y],minScroll:0,maxScroll:u}}function fi(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+Dt<r){r=o,e=s;continue}Math.abs(o-r)<=Dt&&s<e&&(e=s)}return e}function iM(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function fr(n,t,e){return Math.max(t,Math.min(e,n))}function sM(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)<=Dt)return r;return-1}function oM(n,t,e){var i,s;if(n.length===0)return t;const r=sM(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+Dt)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-Dt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class aM extends Ot{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 Te({x:this._scroll})}get translate(){return Ie({x:ki(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=fr(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Dt||(this._scroll=r,this._activeViewspanIndex=fi(this._viewspans,this._scroll),this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}rebuild(e){var y;const r=e.nodeWidths.map(m=>Math.max(0,m.x??0)),i=r.map(m=>e.grid.toPixels(Te({x:m})).x??0),s=e.grid.viewport.x??0,o=e.grid.gap.x??ae,a=rM({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=Yw(r),this._viewportWidthPx=s,this._framedViewportWidthPx=qw(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=fr(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=fi(this._viewspans,c);const h=e.snap!==!1?((y=this._viewspans[this._activeViewspanIndex])==null?void 0:y.anchor)??c:c,f=fr(h,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)>Dt&&(this._scroll=f,this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=iM(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=fr(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=Dt)&&(this._scroll=s,this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[fi(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:oM(this._viewspans,this._scroll,e),i=fr(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=fi(this._viewspans,i),!(Math.abs(i-this._scroll)<=Dt)&&(this._scroll=i,this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=fr(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Dt||(this._scroll=r,this._activeViewspanIndex=fi(this._viewspans,this._scroll),this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=Kr)return;const i=ki(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=ki(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=ki(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=Kr)return;let u=this._minScroll,h=this._maxScroll;for(let y=0;y<YO;y+=1){const m=(u+h)/2;ki(this._nodeWidthsPx,this._boundaryCols,m,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=m:h=m}const f=fr((u+h)/2,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)<=Dt||(this._scroll=f,this._activeViewspanIndex=fi(this._viewspans,this._scroll),this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}}const Iu={"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}},lM=["stack-above","stack-below","reorder-before","reorder-after"];function Cu(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 gr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function Pi(n){return n.artifactID}function Hh(n){return Number.isFinite(n)?Math.max(oo,Math.min(Od,Math.round(n))):oo}function cM(n,t,e){const r=n.findIndex(a=>a.type==="card"&&Pi(a)===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=Hh(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function Xw(n,t){for(const e of n){if(e.type==="card"&&Pi(e)===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&Pi(r)===t)return r;if(r.type==="row"){for(const i of r.children)if(Pi(i)===t)return i}}}return null}function Zh(n){const t=n.height===ft||n.height===Qn?Qn:n.height;return n.width===qe&&n.height===t?n:{...n,width:qe,height:t}}function Wh(n){return n.height===Qn?{...n,height:ft}:n}function uM(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"&&Pi(h)===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.type!=="card"||Pi(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"?Wh(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,Wh(o)),c}const hM=je(),dM=je(),pM=50;function fM(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 Qe(n){return n.artifactID}function pm(n){return n.type==="card"?Qe(n):n.id}function _a(n){return{id:Qe(n),type:"drop-target",width:n.width,height:n.height}}function fm(n){return n.map(mM)}function gM(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function mM(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(gM)}:n}function Qw(n,t){return n.find(r=>r.type==="card"&&Qe(r)===t)??null}function gm(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function vM(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&Qe(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"&&Qe(a)===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function yM(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(y=>y.type==="card"&&Qe(y)===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Qw(r,t.nodeId);if(!a)return null;const c=Zh(a),u=Zh(o),h=_a(c),f=e.position==="above"?[h,u]:[u,h];return i[s]={id:Qe(o),type:"stack",children:f},i}function Ru(n,t){return n.parentStackId?wM(n,t):bM(n,t)}function bM(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,_a(r)),i}if(e.type==="stack"){const r=vM(n,t);return r?yM(r,n,e,t)??[...t]:[...t]}return[...t]}function wM(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return SM(n,t,e.position);case"stack-child-extract":return _M(n,t,e.toIndex);case"stack-child-noop":return kM(n,t);default:return[...t]}}function SM(n,t,e){const r=t.findIndex(y=>y.type==="stack"&&y.id===n.parentStackId);if(r===-1)return[...t];const i=t[r];if(!i||i.type!=="stack")return[...t];if(!i.children.every(y=>y.type==="card"))return[...t];const s=i.children,o=s.findIndex(y=>Qe(y)===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(y=>Qe(y)!==n.nodeId),u=_a(a),h=e==="above"?[u,...c]:[...c,u],f=[...t];return f[r]={...i,children:h},f}function _M(n,t,e){if(!n.parentStackId)return[...t];const r=uM(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&Qe(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]=_a(s),o}function kM(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"&&Qe(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]=_a(s),o[e]={...r,children:a},o}function xM(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Ud()}function EM(n,t,e){if(n.type==="drop-target"){const r=Xw(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Zh(r)}return n}function AM(n,t,e){const r=n.children.map(s=>EM(s,t,e));return{id:xM(n,t),type:"stack",children:r}}function $M(n,t,e){if(n.type==="drop-target"){const r=Xw(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Qw(t,e)!==null?r:Wh(r)}return n.type==="card"||n.type==="row"?n:AM(n,t,e)}function TM(n,t,e){return n.map(r=>$M(r,t,e))}function IM(n,t){return JSON.stringify(n)===JSON.stringify(t)}const CM=wa(Ot);class RM extends CM{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)>=n$&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new oe("change")));return}if(!this.active)return;const o=Ru(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&&fM(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 oe("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const e=this.active.baseLayout;let r=null;try{const i=Ru(this.active,e),s=TM(i,e,this.active.nodeId);IM(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new dM("drop",{layout:r})),this.dispatchEvent(new oe("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new oe("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=Ru(this.active,this.active.baseLayout);this.dispatchEvent(new hM("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:Ie({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:Ie({x:this.active.pointerX,y:this.active.pointerY}),size:Ie({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&&gr(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&&gr(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=gm(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&Qe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===Qe(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=gm(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&Qe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===Qe(s));if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(e,r,i,s){var m,E,x;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((m=this.active)==null?void 0:m.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=pM;for(const I of o){const P=I.rect;if(!gr(e,r,P))continue;const R=this.resolveTopLevelTargetForCard(e,r,I,I.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===I.id?this.active.hitTarget:{type:"reorder",index:e<this.active.pointerX?I.logicalIndex:I.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 y=u.rect.left+u.rect.width/2;return{type:"reorder",index:e<y?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(!gr(e,r,f.rect))continue;const y=Cu(f.rect,Iu["reorder-before"]);if(gr(e,r,y))return f.logicalIndex;const m=Cu(f.rect,Iu["reorder-after"]);if(gr(e,r,m))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=>[pm(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:pm(c),rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of lM){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Iu[c],h=Cu(a,u);if(gr(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 PM=100,DM=1e3;class LM{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(Ie({x:-e})))}end(){if(this._status!=="active")return;const t=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(t)<i$?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-PM;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*DM}}function Ii(n){return n.artifactID}function zM(n){return n.type==="card"?Ii(n):n.id}function OM({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var E;const a=new Map(t.map(x=>[zM(x),x])),c=e.nodes.map((x,I)=>{const P=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 F=r.get(N.artifactID);F&&R.push({key:Ii(F),kind:"card",card:F,placement:N,isTopLevelCard:(P==null?void 0:P.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 F={key:Ii(N),kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},Y=MM(n,s.source.parentId,s.nodeId),B=Y<0?R.length:Math.min(Y,R.length);R.splice(B,0,F)}}const V=!!(s&&(P==null?void 0:P.type)==="card"&&Ii(P)===s.nodeId);return{key:V?`placeholder:${x.id}`:x.id,kind:"visible",nodeId:x.id,widthPx:i.toPixels(Te({x:x.width})).x??0,widthUnits:x.width,layoutIndex:I,isForeground:o(I),isPlaceholder:V,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=kr(n).nodes[s.source.index])==null?void 0:E.width)??qe,y={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:f,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:Ii(u),kind:"card",card:u,placement:null,isTopLevelCard:!s.source.parentId,isDragged:!0,sourceStackId:s.source.parentId??null}]},m=Math.max(0,Math.min(s.source.index,c.length));return c.splice(m,0,y),c}function mm(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 MM(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"&&Ii(i)===e)}const NM=2,vm=1e3,gi=1e-4,UM=120,ym=!1;function bm(n){return n.replace(/["\\]/g,"\\$&")}function we(n){return n.artifactID}function Di(n){return n.type==="card"?we(n):n.id}function wm(n,t,e){if(n===0)return 0;const r=t.toPixels(Te({y:ft})).y??0;return(e-r)/NM}function Pu(n){const t=n.clientWidth>0?n.clientWidth:Br,e=n.clientHeight>0?n.clientHeight:ao;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=ao+ae*2,c=Math.min(o,Math.max(0,s-a));return{width:t,height:s-c,offsetY:r}}function FM(n){return n.shiftKey&&n.deltaX===0&&n.deltaY!==0?n.deltaY:n.deltaX}function HM(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 ZM extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});g(this,"scrollPosition");this.scrollPosition=e}}class e0 extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});g(this,"layout");this.layout=e}}class WM extends HTMLElement{constructor(){super();g(this,"_layout",[]);g(this,"_scrollPosition",0);g(this,"layoutGrid",null);g(this,"layoutScroll",new aM(Te({x:0})));g(this,"scrollModelKey","");g(this,"resizeObserver",null);g(this,"renderPending",!1);g(this,"animateNextRender",!0);g(this,"swipeGesture",new LM(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 RM);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=mm(e),s=jM(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=fm(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)<gi||(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"&&(HM(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=FM(e);Math.abs(r)<gi||(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(nS(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(rS(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)<gi||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 y=f.getAttribute("layout-node");if(y!==null){const m=parseInt(y,10);if(!isNaN(m)){const E=this.findViewspanContainingNode(m);if(E){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=Te({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=BM(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:Ie({x:e.clientX,y:e.clientY}),grabOffset:Ie({x:e.clientX-h.left,y:e.clientY-h.top}),size:Ie({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)??Mn)+ae;if(s<=0)return;const o=e.clientX-r.startClientX,a=Hh(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(cM(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<yg&&a<yg)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)/vm;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>gi?Math.abs(o)/r:0,Math.abs(o)>gi&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(Ie({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=Te({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)<gi||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=kr(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="${bm(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 GO({basis:Ie({x:Mn,y:Mn}),min:Ie({x:mg,y:mg}),viewport:Ie({x:e,y:r}),gap:Ie({x:ae,y:ae})})}syncScrollModel(){const e=Pu(this),i=kr(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=>Te({x:o})),snap:ym}))}emitScrollPositionChanged(e){this.dispatchEvent(new ZM(e))}emitLayoutChanged(){this.dispatchEvent(new e0([...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(Ie({x:e}));this.layoutScroll.wheel(Te({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},UM)}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"&&we(a)===i);if(!s)return;const o=Hh(typeof s.width=="number"?s.width:qe);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):fm(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&we(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,y=h>0?a*(u.width/h):a,m=f>0?c*(u.height/f):c;e.style.left=`${s-y-i.left}px`,e.style.top=`${o-m-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?L`
302
+ */const dm=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},pm=Ac(class extends Xd{constructor(n){if(super(n),n.type!==Jd.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=fO(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,y=i.length-1,m=0,E=s.length-1;for(;f<=y&&m<=E;)if(i[f]===null)f++;else if(i[y]===null)y--;else if(a[f]===o[m])c[m]=pr(i[f],s[m]),f++,m++;else if(a[y]===o[E])c[E]=pr(i[y],s[E]),y--,E--;else if(a[f]===o[E])c[E]=pr(i[f],s[E]),Ds(n,c[E+1],i[f]),f++,E--;else if(a[y]===o[m])c[m]=pr(i[y],s[m]),Ds(n,i[f],i[y]),y--,m++;else if(u===void 0&&(u=dm(o,m,E),h=dm(a,f,y)),u.has(a[f]))if(u.has(a[y])){const x=h.get(o[m]),I=x!==void 0?i[x]:null;if(I===null){const P=Ds(n,i[f]);pr(P,s[m]),c[m]=P}else c[m]=pr(I,s[m]),Ds(n,i[f],I),i[x]=null;m++}else Eu(i[y]),y--;else Eu(i[f]),f++;for(;m<=E;){const x=Ds(n,c[E+1]);pr(x,s[m]),c[m++]=x}for(;f<=y;){const x=i[f++];x!==null&&Eu(x)}return this.ut=o,pO(n,c),Yr}}),Ie=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Ga=2;class YO{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??Ie({x:ae,y:ae});const e=this._viewport.x??Br,r=this._viewport.y??ao,i=this._gap.x??ae,s=this._gap.y??ae,o=e<=n$,a=o?e-i*Ga:Math.min(Br,e-i*Ga),c=o?r-s*Ga:Math.min(ao,r-s*Ga),u=(a-i*(qe-1))/qe,h=(c-s*(ft-1))/ft,f=this.basis.x??0,y=this.basis.y??0,m=this.min.x??0,E=this.min.y??0;this._unit=Ie(o?{x:Math.max(m,u),y:Math.max(E,h)}:{x:Math.max(m,Math.min(f,u)),y:Math.max(E,Math.min(y,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(t){return Te({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??ae,s=this._gap.y??ae,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 Ie({x:o,y:a})}}const Kr=1e-4,Dt=1e-6,KO=40,JO=24;function Kw(n,t){return Math.max(0,n-t*2)}function Jw(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function Xw(n){const t=[0];for(let e=0;e<n.length;e+=1){const r=t[e]??0;t.push(r+n[e]+ae)}return t}function Qw(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+ae+o;if(a>e+Kr)break;r=a,i+=1}return Math.max(1,i)}function XO(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+ae+o;if(a>e+Kr)break;r=a,i+=1}return Math.max(1,i)}function QO(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+ae+s;if(o>t+Kr)break;e=o,r+=1}return Math.max(1,r)}function ep(n,t){if(n.length===0)return 0;const e=QO(n,t);return Math.max(0,n.length-e)}function fm(n,t,e){if(n.length===0)return 0;const r=Qw(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)*ae}function Hh(n,t,e){const r=n[t]??0;return e-r}function ki(n,t,e,r,i){if(n.length===0)return 0;const s=ep(n,i),o=t[s]??0,a=Math.max(0,Math.min(o,e));let c=0;for(let F=0;F<s;F+=1){const Y=t[F]??0,B=t[F+1]??Y;if(a>=Y&&a<=B+Kr){c=F;break}c=F+1}const u=Math.min(c+1,s),h=t[c]??0,f=t[u]??h,y=Math.max(f-h,Kr),m=u===c?0:(a-h)/y,E=Xw(n),x=fm(n,c,i),I=fm(n,u,i),P=(r-x)/2,R=(r-I)/2,V=Hh(E,c,P),N=Hh(E,u,R);return V+(N-V)*m}function eM(n,t,e,r,i){const s=ep(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<KO;u+=1){const h=(a+c)/2;ki(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function tM(n,t,e){const r=Xw(n),[i,s]=t,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*ae,c=(e-a)/2;return Hh(r,i,c)}function nM(n,t,e){const r=Qw(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function rM(n,t,e){const r=XO(n,t,e);return[Math.max(0,t-r+1),t]}function iM(n,t){return n[0]===t[0]&&n[1]===t[1]}function sM(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??ae,o=Kw(r,s),a=Jw(t),c=ep(e,o),u=a[c]??0;function h(I){const P=tM(e,I,r),R=eM(e,a,r,o,P);return{nodeRange:I,anchor:Math.max(0,Math.min(u,R))}}const f=[];for(let I=0;I<i;){const P=nM(e,I,o);f.push(h(P)),I=P[1]+1}const y=h(rM(e,i-1,o)),m=f.filter(I=>I.nodeRange[0]<y.nodeRange[0]),E=m[m.length-1];return{viewspans:E&&iM(E.nodeRange,y.nodeRange)?m:[...m,y],minScroll:0,maxScroll:u}}function fi(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+Dt<r){r=o,e=s;continue}Math.abs(o-r)<=Dt&&s<e&&(e=s)}return e}function oM(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function fr(n,t,e){return Math.max(t,Math.min(e,n))}function aM(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)<=Dt)return r;return-1}function lM(n,t,e){var i,s;if(n.length===0)return t;const r=aM(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+Dt)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-Dt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class cM extends Ot{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 Te({x:this._scroll})}get translate(){return Ie({x:ki(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=fr(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Dt||(this._scroll=r,this._activeViewspanIndex=fi(this._viewspans,this._scroll),this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}rebuild(e){var y;const r=e.nodeWidths.map(m=>Math.max(0,m.x??0)),i=r.map(m=>e.grid.toPixels(Te({x:m})).x??0),s=e.grid.viewport.x??0,o=e.grid.gap.x??ae,a=sM({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=Jw(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Kw(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=fr(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=fi(this._viewspans,c);const h=e.snap!==!1?((y=this._viewspans[this._activeViewspanIndex])==null?void 0:y.anchor)??c:c,f=fr(h,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)>Dt&&(this._scroll=f,this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=oM(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=fr(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=Dt)&&(this._scroll=s,this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[fi(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:lM(this._viewspans,this._scroll,e),i=fr(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=fi(this._viewspans,i),!(Math.abs(i-this._scroll)<=Dt)&&(this._scroll=i,this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=fr(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Dt||(this._scroll=r,this._activeViewspanIndex=fi(this._viewspans,this._scroll),this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=Kr)return;const i=ki(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=ki(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=ki(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=Kr)return;let u=this._minScroll,h=this._maxScroll;for(let y=0;y<JO;y+=1){const m=(u+h)/2;ki(this._nodeWidthsPx,this._boundaryCols,m,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=m:h=m}const f=fr((u+h)/2,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)<=Dt||(this._scroll=f,this._activeViewspanIndex=fi(this._viewspans,this._scroll),this.dispatchEvent(new pi("layout-scroll",{scroll:this.scroll})))}}const Cu={"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}},uM=["stack-above","stack-below","reorder-before","reorder-after"];function Ru(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 gr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function Pi(n){return n.artifactID}function Zh(n){return Number.isFinite(n)?Math.max(oo,Math.min(Md,Math.round(n))):oo}function hM(n,t,e){const r=n.findIndex(a=>a.type==="card"&&Pi(a)===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=Zh(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function e0(n,t){for(const e of n){if(e.type==="card"&&Pi(e)===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&Pi(r)===t)return r;if(r.type==="row"){for(const i of r.children)if(Pi(i)===t)return i}}}return null}function Wh(n){const t=n.height===ft||n.height===Qn?Qn:n.height;return n.width===qe&&n.height===t?n:{...n,width:qe,height:t}}function Vh(n){return n.height===Qn?{...n,height:ft}:n}function dM(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"&&Pi(h)===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.type!=="card"||Pi(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"?Vh(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,Vh(o)),c}const pM=je(),fM=je(),gM=50;function mM(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 Qe(n){return n.artifactID}function gm(n){return n.type==="card"?Qe(n):n.id}function _a(n){return{id:Qe(n),type:"drop-target",width:n.width,height:n.height}}function mm(n){return n.map(yM)}function vM(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function yM(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(vM)}:n}function t0(n,t){return n.find(r=>r.type==="card"&&Qe(r)===t)??null}function vm(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function bM(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&Qe(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"&&Qe(a)===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function wM(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(y=>y.type==="card"&&Qe(y)===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=t0(r,t.nodeId);if(!a)return null;const c=Wh(a),u=Wh(o),h=_a(c),f=e.position==="above"?[h,u]:[u,h];return i[s]={id:Qe(o),type:"stack",children:f},i}function Pu(n,t){return n.parentStackId?_M(n,t):SM(n,t)}function SM(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,_a(r)),i}if(e.type==="stack"){const r=bM(n,t);return r?wM(r,n,e,t)??[...t]:[...t]}return[...t]}function _M(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return kM(n,t,e.position);case"stack-child-extract":return xM(n,t,e.toIndex);case"stack-child-noop":return EM(n,t);default:return[...t]}}function kM(n,t,e){const r=t.findIndex(y=>y.type==="stack"&&y.id===n.parentStackId);if(r===-1)return[...t];const i=t[r];if(!i||i.type!=="stack")return[...t];if(!i.children.every(y=>y.type==="card"))return[...t];const s=i.children,o=s.findIndex(y=>Qe(y)===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(y=>Qe(y)!==n.nodeId),u=_a(a),h=e==="above"?[u,...c]:[...c,u],f=[...t];return f[r]={...i,children:h},f}function xM(n,t,e){if(!n.parentStackId)return[...t];const r=dM(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&Qe(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]=_a(s),o}function EM(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"&&Qe(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]=_a(s),o[e]={...r,children:a},o}function AM(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Fd()}function $M(n,t,e){if(n.type==="drop-target"){const r=e0(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Wh(r)}return n}function TM(n,t,e){const r=n.children.map(s=>$M(s,t,e));return{id:AM(n,t),type:"stack",children:r}}function IM(n,t,e){if(n.type==="drop-target"){const r=e0(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return t0(t,e)!==null?r:Vh(r)}return n.type==="card"||n.type==="row"?n:TM(n,t,e)}function CM(n,t,e){return n.map(r=>IM(r,t,e))}function RM(n,t){return JSON.stringify(n)===JSON.stringify(t)}const PM=wa(Ot);class DM extends PM{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)>=i$&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new oe("change")));return}if(!this.active)return;const o=Pu(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&&mM(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 oe("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const e=this.active.baseLayout;let r=null;try{const i=Pu(this.active,e),s=CM(i,e,this.active.nodeId);RM(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new fM("drop",{layout:r})),this.dispatchEvent(new oe("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new oe("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=Pu(this.active,this.active.baseLayout);this.dispatchEvent(new pM("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:Ie({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:Ie({x:this.active.pointerX,y:this.active.pointerY}),size:Ie({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&&gr(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&&gr(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=vm(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&Qe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===Qe(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=vm(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&Qe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===Qe(s));if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(e,r,i,s){var m,E,x;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((m=this.active)==null?void 0:m.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=gM;for(const I of o){const P=I.rect;if(!gr(e,r,P))continue;const R=this.resolveTopLevelTargetForCard(e,r,I,I.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===I.id?this.active.hitTarget:{type:"reorder",index:e<this.active.pointerX?I.logicalIndex:I.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 y=u.rect.left+u.rect.width/2;return{type:"reorder",index:e<y?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(!gr(e,r,f.rect))continue;const y=Ru(f.rect,Cu["reorder-before"]);if(gr(e,r,y))return f.logicalIndex;const m=Ru(f.rect,Cu["reorder-after"]);if(gr(e,r,m))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=>[gm(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:gm(c),rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of uM){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Cu[c],h=Ru(a,u);if(gr(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 LM=100,zM=1e3;class OM{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(Ie({x:-e})))}end(){if(this._status!=="active")return;const t=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(t)<o$?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-LM;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*zM}}function Ii(n){return n.artifactID}function MM(n){return n.type==="card"?Ii(n):n.id}function NM({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var E;const a=new Map(t.map(x=>[MM(x),x])),c=e.nodes.map((x,I)=>{const P=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 F=r.get(N.artifactID);F&&R.push({key:Ii(F),kind:"card",card:F,placement:N,isTopLevelCard:(P==null?void 0:P.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 F={key:Ii(N),kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},Y=UM(n,s.source.parentId,s.nodeId),B=Y<0?R.length:Math.min(Y,R.length);R.splice(B,0,F)}}const V=!!(s&&(P==null?void 0:P.type)==="card"&&Ii(P)===s.nodeId);return{key:V?`placeholder:${x.id}`:x.id,kind:"visible",nodeId:x.id,widthPx:i.toPixels(Te({x:x.width})).x??0,widthUnits:x.width,layoutIndex:I,isForeground:o(I),isPlaceholder:V,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=kr(n).nodes[s.source.index])==null?void 0:E.width)??qe,y={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:f,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:Ii(u),kind:"card",card:u,placement:null,isTopLevelCard:!s.source.parentId,isDragged:!0,sourceStackId:s.source.parentId??null}]},m=Math.max(0,Math.min(s.source.index,c.length));return c.splice(m,0,y),c}function ym(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 UM(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"&&Ii(i)===e)}const FM=2,bm=1e3,gi=1e-4,HM=120,wm=!1;function Sm(n){return n.replace(/["\\]/g,"\\$&")}function we(n){return n.artifactID}function Di(n){return n.type==="card"?we(n):n.id}function _m(n,t,e){if(n===0)return 0;const r=t.toPixels(Te({y:ft})).y??0;return(e-r)/FM}function Du(n){const t=n.clientWidth>0?n.clientWidth:Br,e=n.clientHeight>0?n.clientHeight:ao;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=ao+ae*2,c=Math.min(o,Math.max(0,s-a));return{width:t,height:s-c,offsetY:r}}function ZM(n){return n.shiftKey&&n.deltaX===0&&n.deltaY!==0?n.deltaY:n.deltaX}function WM(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 VM extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});g(this,"scrollPosition");this.scrollPosition=e}}class n0 extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});g(this,"layout");this.layout=e}}class jM extends HTMLElement{constructor(){super();g(this,"_layout",[]);g(this,"_scrollPosition",0);g(this,"layoutGrid",null);g(this,"layoutScroll",new cM(Te({x:0})));g(this,"scrollModelKey","");g(this,"resizeObserver",null);g(this,"renderPending",!1);g(this,"animateNextRender",!0);g(this,"swipeGesture",new OM(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 DM);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=ym(e),s=GM(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=mm(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)<gi||(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"&&(WM(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=ZM(e);Math.abs(r)<gi||(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(iS(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(sS(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)<gi||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 y=f.getAttribute("layout-node");if(y!==null){const m=parseInt(y,10);if(!isNaN(m)){const E=this.findViewspanContainingNode(m);if(E){this.clearWheelIdleSnap(),this.animateNextRender=!0,this.layoutScroll.scroll=Te({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=qM(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:Ie({x:e.clientX,y:e.clientY}),grabOffset:Ie({x:e.clientX-h.left,y:e.clientY-h.top}),size:Ie({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)??Mn)+ae;if(s<=0)return;const o=e.clientX-r.startClientX,a=Zh(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(hM(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<wg&&a<wg)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)/bm;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>gi?Math.abs(o)/r:0,Math.abs(o)>gi&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(Ie({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=Te({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)<gi||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=kr(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="${Sm(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 YO({basis:Ie({x:Mn,y:Mn}),min:Ie({x:yg,y:yg}),viewport:Ie({x:e,y:r}),gap:Ie({x:ae,y:ae})})}syncScrollModel(){const e=Du(this),i=kr(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=>Te({x:o})),snap:wm}))}emitScrollPositionChanged(e){this.dispatchEvent(new VM(e))}emitLayoutChanged(){this.dispatchEvent(new n0([...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(Ie({x:e}));this.layoutScroll.wheel(Te({x:i.x??0}))}scheduleWheelIdleSnap(){this.clearWheelIdleSnap(),this.wheelIdleSnapTimer=setTimeout(()=>{this.wheelIdleSnapTimer=null,this.animateNextRender=!0,this.layoutScroll.snap()},HM)}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"&&we(a)===i);if(!s)return;const o=Zh(typeof s.width=="number"?s.width:qe);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):mm(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&we(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,y=h>0?a*(u.width/h):a,m=f>0?c*(u.height/f):c;e.style.left=`${s-y-i.left}px`,e.style.top=`${o-m-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?L`
303
303
  <div
304
304
  class="card-slot card-placeholder"
305
305
  data-layout-placeholder-for=${(r==null?void 0:r.nodeId)??""}
@@ -334,14 +334,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
334
334
  style=${e.kind==="visible"?`width: ${e.widthPx}px; --card-width-px: ${e.widthPx};`:""}
335
335
  >
336
336
  <div class="node-inner" style=${`grid-template-columns: repeat(${e.widthUnits}, var(--layout-unit-x));`}>
337
- ${hm(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
337
+ ${pm(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
338
338
  </div>
339
339
  </div>
340
- `}render(){var Y;const e=Pu(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=kr(i),a=o.nodes.map(B=>B.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(B=>Te({x:B})),snap:ym}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=VM(this._layout),h=r.unit.x??Mn,f=r.unit.y??Mn,y=s?this.dragTrackOffsetXPx:0,m=(this.layoutScroll.translate.x??0)+y,E=wm(o.nodes.length,r,e.height),x=this.animateNextRender&&!s,I=[`transform: translate(${m}px, ${E}px);`,`transition-duration: ${x?t$: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",`${ae}px`);const P=this.dragState,R=new Set;{let B=m;for(let ce=0;ce<o.nodes.length;ce+=1){const Et=r.toPixels(Te({x:o.nodes[ce].width})).x??0,lr=B+Et;B>=-1&&lr<=e.width+1&&R.add(ce),B=lr+ae}}const V=B=>R.has(B),N=OM({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:V}),F=mm(this.dragState);if(F?this.setAttribute("data-test-drop-intent",F):this.removeAttribute("data-test-drop-intent"),this.dragState){let B=null;for(const ce of o.nodes){for(const Et of ce.cards)if(Et.artifactID===this.dragState.nodeId){B={width:r.toPixels(Te({x:Et.width})).x??0,height:r.toPixels(Te({y:Et.height})).y??0};break}if(B)break}this.currentDragPreviewSize=B??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ve(L`
340
+ `}render(){var Y;const e=Du(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=kr(i),a=o.nodes.map(B=>B.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(B=>Te({x:B})),snap:wm}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=BM(this._layout),h=r.unit.x??Mn,f=r.unit.y??Mn,y=s?this.dragTrackOffsetXPx:0,m=(this.layoutScroll.translate.x??0)+y,E=_m(o.nodes.length,r,e.height),x=this.animateNextRender&&!s,I=[`transform: translate(${m}px, ${E}px);`,`transition-duration: ${x?r$: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",`${ae}px`);const P=this.dragState,R=new Set;{let B=m;for(let ce=0;ce<o.nodes.length;ce+=1){const Et=r.toPixels(Te({x:o.nodes[ce].width})).x??0,lr=B+Et;B>=-1&&lr<=e.width+1&&R.add(ce),B=lr+ae}}const V=B=>R.has(B),N=NM({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:V}),F=ym(this.dragState);if(F?this.setAttribute("data-test-drop-intent",F):this.removeAttribute("data-test-drop-intent"),this.dragState){let B=null;for(const ce of o.nodes){for(const Et of ce.cards)if(Et.artifactID===this.dragState.nodeId){B={width:r.toPixels(Te({x:Et.width})).x??0,height:r.toPixels(Te({y:Et.height})).y??0};break}if(B)break}this.currentDragPreviewSize=B??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ve(L`
341
341
  <div class="track" style=${I}>
342
- ${hm(N,B=>B.key,B=>this.renderNode(B,P))}
342
+ ${pm(N,B=>B.key,B=>this.renderNode(B,P))}
343
343
  </div>
344
- `,this),this.syncCardElements(u,P?((Y=u.get(P.nodeId))==null?void 0:Y.artifactID)??null:null),this.syncDraggedSlotElement(P)}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(we(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===we(a),`layout-view: mount mismatch for ${we(a)}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${we(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:Ie({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*vm,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+Ha,o=r.left+r.width-Ha,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Mn,c=r$*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/Ha));return-(c*h**vg)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/Ha));return c*h**vg*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=kr(e),o=new Map(s.nodes.map(E=>[E.id,E.width])),a=i.toPixels(Te({y:ft})).y??ao,c=Pu(this),u=(this.layoutScroll.translate.x??0)+r,h=wm(s.nodes.length,i,c.height),f=c.offsetY+h,y=[];let m=u;for(const E of e){const x=Di(E),I=o.get(x)??qe,P=i.toPixels(Te({x:I})).x??Br,R={left:m,top:f,width:P,height:a};y.push({id:x,rect:R}),m+=P+ae}return y}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="${bm(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?_m(e,c,this.layoutGrid):km(e,c,this.layoutGrid),h=s?_m(r,c,this.layoutGrid):km(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=Sm(e),o=new Set(Sm(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(Di));for(const o of e){const a=Di(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"&&we(o)!==r);return s?we(s):null}}function VM(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(we(e),e);continue}for(const r of e.children)if(r.type==="card")t.set(we(r),r);else for(const i of r.children)t.set(we(i),i)}return t}function jM(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 BM(n,t){const e=n.findIndex(r=>r.type==="card"&&we(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"&&we(s)===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function Sm(n){const t=[];for(const e of n){if(e.type==="card"){t.push(we(e));continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(we(r))}}return t}function _m(n,t,e){if(!e)return null;const r=kr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&we(o)===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&we(u)===t))return s;const a=i.get(Di(o))??qe,c=e.toPixels(Te({x:a})).x??Br;s+=c+ae}return null}function km(n,t,e){if(!e)return null;const r=kr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(Di(o)===t)return s;const a=i.get(Di(o))??qe,c=e.toPixels(Te({x:a})).x??Br;s+=c+ae}return null}customElements.get("layout-view")||customElements.define("layout-view",WM);class GM extends HTMLElement{constructor(){super(...arguments);g(this,"screenManager",un.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 Gw&&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 e0&&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){Ve(L``,this);return}Ve(L`
344
+ `,this),this.syncCardElements(u,P?((Y=u.get(P.nodeId))==null?void 0:Y.artifactID)??null:null),this.syncDraggedSlotElement(P)}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(we(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===we(a),`layout-view: mount mismatch for ${we(a)}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${we(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:Ie({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*bm,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+Ha,o=r.left+r.width-Ha,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Mn,c=s$*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/Ha));return-(c*h**bg)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/Ha));return c*h**bg*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=kr(e),o=new Map(s.nodes.map(E=>[E.id,E.width])),a=i.toPixels(Te({y:ft})).y??ao,c=Du(this),u=(this.layoutScroll.translate.x??0)+r,h=_m(s.nodes.length,i,c.height),f=c.offsetY+h,y=[];let m=u;for(const E of e){const x=Di(E),I=o.get(x)??qe,P=i.toPixels(Te({x:I})).x??Br,R={left:m,top:f,width:P,height:a};y.push({id:x,rect:R}),m+=P+ae}return y}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="${Sm(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?xm(e,c,this.layoutGrid):Em(e,c,this.layoutGrid),h=s?xm(r,c,this.layoutGrid):Em(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=km(e),o=new Set(km(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(Di));for(const o of e){const a=Di(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"&&we(o)!==r);return s?we(s):null}}function BM(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(we(e),e);continue}for(const r of e.children)if(r.type==="card")t.set(we(r),r);else for(const i of r.children)t.set(we(i),i)}return t}function GM(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 qM(n,t){const e=n.findIndex(r=>r.type==="card"&&we(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"&&we(s)===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function km(n){const t=[];for(const e of n){if(e.type==="card"){t.push(we(e));continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(we(r))}}return t}function xm(n,t,e){if(!e)return null;const r=kr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&we(o)===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&we(u)===t))return s;const a=i.get(Di(o))??qe,c=e.toPixels(Te({x:a})).x??Br;s+=c+ae}return null}function Em(n,t,e){if(!e)return null;const r=kr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(Di(o)===t)return s;const a=i.get(Di(o))??qe,c=e.toPixels(Te({x:a})).x??Br;s+=c+ae}return null}customElements.get("layout-view")||customElements.define("layout-view",jM);class YM extends HTMLElement{constructor(){super(...arguments);g(this,"screenManager",un.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 Yw&&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 n0&&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){Ve(L``,this);return}Ve(L`
345
345
  <layout-view
346
346
  .layout=${r}
347
347
  .cards=${i}
@@ -350,13 +350,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
350
350
  @layout-change=${this.handleLayoutChanged}
351
351
  @close-artifact=${this.handleCloseArtifact}
352
352
  ></layout-view>
353
- `,this)}}customElements.define("screen-view",GM);function Hl(n){return typeof n=="object"&&n!==null}const Du=new WeakMap,xm=Object.prototype.hasOwnProperty,qM=(()=>{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 YM(n,t){if(Hl(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 KM(n,t){return Hl(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var Xo,Vh,Hr,gt,tn,Xi,Zr,Qi,xe,xi,t0,n0,r0,i0,yl;const Sr=class Sr extends HTMLElement{constructor(){var i;super();S(this,xe);S(this,Hr,new Map);S(this,gt,new Map);S(this,tn,new Map);S(this,Xi,!1);S(this,Zr,!1);S(this,Qi,!1);const e=p(i=Sr,Xo,Vh).call(i,this.constructor),r=this;for(const s of e.properties)xm.call(r,s)&&(l(this,tn).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return p(e=Sr,Xo,Vh).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(p(this,xe,i0).call(this),!l(this,Zr))for(const e of p(this,xe,xi).call(this).properties)l(this,gt).has(e)||l(this,gt).set(e,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),p(this,xe,yl).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=p(this,xe,xi).call(this).byAttr.get(e);s&&(l(this,tn).has(s.property)||(this[s.property]=YM(s.type,i)))}};Xo=new WeakSet,Vh=function(e){const r=Du.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(qM.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(Hl(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 y={attribute:u,property:f,type:h.type};o.set(u,y),a.set(f,y)}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,Hr).get(u)},set(f){p(this,xe,t0).call(this,u,f)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return Du.set(e,c),c},Hr=new WeakMap,gt=new WeakMap,tn=new WeakMap,Xi=new WeakMap,Zr=new WeakMap,Qi=new WeakMap,xe=new WeakSet,xi=function(){return Du.get(this.constructor)},t0=function(e,r){if(!l(this,Qi)&&l(this,tn).has(e))return;const i=l(this,Hr).get(e);p(this,xe,n0).call(this,e,i,r)||(l(this,gt).has(e)||l(this,gt).set(e,i),l(this,Hr).set(e,r),l(this,tn).delete(e),p(this,xe,r0).call(this,e,r),this.isConnected&&p(this,xe,yl).call(this))},n0=function(e,r,i){if(Object.is(r,i))return!0;const s=p(this,xe,xi).call(this).byProp.get(e);if(!s||!Hl(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}},r0=function(e,r){const i=p(this,xe,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=KM(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},i0=function(){const e=this,r=p(this,xe,xi).call(this);for(const i of r.properties){if(!xm.call(e,i))continue;const s=e[i];delete e[i],!(l(this,tn).has(i)||l(this,Hr).has(i))&&(e[i]=s)}w(this,Qi,!0);try{for(const[i,s]of l(this,tn))e[i]=s;l(this,tn).clear()}finally{w(this,Qi,!1)}},yl=function(){l(this,Xi)||!this.isConnected||l(this,Zr)&&l(this,gt).size===0||(w(this,Xi,!0),queueMicrotask(()=>{if(w(this,Xi,!1),!this.isConnected||l(this,Zr)&&l(this,gt).size===0)return;const e=new Map(l(this,gt));l(this,gt).clear(),w(this,Zr,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,gt).size>0&&p(this,xe,yl).call(this)}))},S(Sr,Xo),g(Sr,"properties"),g(Sr,"attributes");let ds=Sr;var fe,Gn,qn,es,ts,An,Qo,$e,ns,nn,Z,s0,ea,ta,na,ra,jh,Bh,Gh,o0,a0,l0,c0,Jl,Xl,Ql,ec,qh,u0,bl,tc,wl,nc,h0,d0,p0,f0,g0,dt;class JM extends ds{constructor(){super(...arguments);S(this,Z);S(this,fe,un.resolve("ScreenManager"));S(this,Gn,un.resolve("ServerManager"));S(this,qn,null);S(this,es,new DisposableStack);S(this,ts,pl());S(this,An,pl());S(this,Qo,pl());S(this,$e,{kind:"none"});S(this,ns,!1);S(this,nn,[]);S(this,ea,()=>{p(this,Z,jh).call(this),w(this,$e,{kind:"none"}),l(this,dt).call(this)});S(this,ta,()=>{l(this,dt).call(this)});S(this,na,()=>{l(this,dt).call(this)});S(this,ra,()=>{l(this,dt).call(this)});S(this,Jl,()=>{var i,s;if(l(this,$e).kind==="picker"){p(this,Z,wl).call(this);return}w(this,nn,p(this,Z,u0).call(this));const e=((i=l(this,fe).activeScreen)==null?void 0:i.id)??null,r=e&&l(this,nn).some(o=>o.screenID===e)?e:((s=l(this,nn)[0])==null?void 0:s.screenID)??null;w(this,$e,{kind:"picker",filter:"",highlightedID:r}),l(this,dt).call(this),queueMicrotask(()=>{var o;(o=l(this,Qo).value)==null||o.focus()})});S(this,Xl,e=>{var u;const r=l(this,$e);if(r.kind!=="picker")return;const i=e.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=p(this,Z,bl).call(this,l(this,nn),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;w(this,$e,{kind:"picker",filter:s,highlightedID:c}),l(this,dt).call(this)});S(this,Ql,e=>{var s;const r=l(this,$e);if(r.kind!=="picker")return;if(e.key==="Escape"){e.preventDefault(),p(this,Z,wl).call(this),(s=l(this,ts).value)==null||s.focus();return}const i=p(this,Z,bl).call(this,l(this,nn),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));w(this,$e,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,dt).call(this);return}if(e.key==="Enter"){e.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&p(this,Z,qh).call(this,o)}});S(this,ec,e=>{p(this,Z,qh).call(this,e)});S(this,tc,e=>{l(this,$e).kind==="picker"&&e.target===l(this,An).value&&(w(this,$e,{kind:"none"}),l(this,dt).call(this))});S(this,nc,async()=>{if(l(this,ns))return;const e=p(this,Z,h0).call(this);if(e){w(this,ns,!0);try{const r=await e.createScreen(XM(new Date));l(this,fe).addTab(e.url,r.id),l(this,fe).setActive(e.url,r.id)}catch{}finally{w(this,ns,!1)}}});S(this,dt,()=>{const e=p(this,Z,l0).call(this);Ve(L`
354
- ${p(this,Z,d0).call(this)}
353
+ `,this)}}customElements.define("screen-view",YM);function Hl(n){return typeof n=="object"&&n!==null}const Lu=new WeakMap,Am=Object.prototype.hasOwnProperty,KM=(()=>{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 JM(n,t){if(Hl(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 XM(n,t){return Hl(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var Xo,jh,Hr,gt,tn,Xi,Zr,Qi,xe,xi,r0,i0,s0,o0,yl;const Sr=class Sr extends HTMLElement{constructor(){var i;super();S(this,xe);S(this,Hr,new Map);S(this,gt,new Map);S(this,tn,new Map);S(this,Xi,!1);S(this,Zr,!1);S(this,Qi,!1);const e=p(i=Sr,Xo,jh).call(i,this.constructor),r=this;for(const s of e.properties)Am.call(r,s)&&(l(this,tn).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return p(e=Sr,Xo,jh).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(p(this,xe,o0).call(this),!l(this,Zr))for(const e of p(this,xe,xi).call(this).properties)l(this,gt).has(e)||l(this,gt).set(e,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),p(this,xe,yl).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=p(this,xe,xi).call(this).byAttr.get(e);s&&(l(this,tn).has(s.property)||(this[s.property]=JM(s.type,i)))}};Xo=new WeakSet,jh=function(e){const r=Lu.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(KM.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(Hl(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 y={attribute:u,property:f,type:h.type};o.set(u,y),a.set(f,y)}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,Hr).get(u)},set(f){p(this,xe,r0).call(this,u,f)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return Lu.set(e,c),c},Hr=new WeakMap,gt=new WeakMap,tn=new WeakMap,Xi=new WeakMap,Zr=new WeakMap,Qi=new WeakMap,xe=new WeakSet,xi=function(){return Lu.get(this.constructor)},r0=function(e,r){if(!l(this,Qi)&&l(this,tn).has(e))return;const i=l(this,Hr).get(e);p(this,xe,i0).call(this,e,i,r)||(l(this,gt).has(e)||l(this,gt).set(e,i),l(this,Hr).set(e,r),l(this,tn).delete(e),p(this,xe,s0).call(this,e,r),this.isConnected&&p(this,xe,yl).call(this))},i0=function(e,r,i){if(Object.is(r,i))return!0;const s=p(this,xe,xi).call(this).byProp.get(e);if(!s||!Hl(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}},s0=function(e,r){const i=p(this,xe,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=XM(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},o0=function(){const e=this,r=p(this,xe,xi).call(this);for(const i of r.properties){if(!Am.call(e,i))continue;const s=e[i];delete e[i],!(l(this,tn).has(i)||l(this,Hr).has(i))&&(e[i]=s)}w(this,Qi,!0);try{for(const[i,s]of l(this,tn))e[i]=s;l(this,tn).clear()}finally{w(this,Qi,!1)}},yl=function(){l(this,Xi)||!this.isConnected||l(this,Zr)&&l(this,gt).size===0||(w(this,Xi,!0),queueMicrotask(()=>{if(w(this,Xi,!1),!this.isConnected||l(this,Zr)&&l(this,gt).size===0)return;const e=new Map(l(this,gt));l(this,gt).clear(),w(this,Zr,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,gt).size>0&&p(this,xe,yl).call(this)}))},S(Sr,Xo),g(Sr,"properties"),g(Sr,"attributes");let ds=Sr;var fe,Gn,qn,es,ts,An,Qo,$e,ns,nn,Z,a0,ea,ta,na,ra,Bh,Gh,qh,l0,c0,u0,h0,Jl,Xl,Ql,ec,Yh,d0,bl,tc,wl,nc,p0,f0,g0,m0,v0,dt;class QM extends ds{constructor(){super(...arguments);S(this,Z);S(this,fe,un.resolve("ScreenManager"));S(this,Gn,un.resolve("ServerManager"));S(this,qn,null);S(this,es,new DisposableStack);S(this,ts,pl());S(this,An,pl());S(this,Qo,pl());S(this,$e,{kind:"none"});S(this,ns,!1);S(this,nn,[]);S(this,ea,()=>{p(this,Z,Bh).call(this),w(this,$e,{kind:"none"}),l(this,dt).call(this)});S(this,ta,()=>{l(this,dt).call(this)});S(this,na,()=>{l(this,dt).call(this)});S(this,ra,()=>{l(this,dt).call(this)});S(this,Jl,()=>{var i,s;if(l(this,$e).kind==="picker"){p(this,Z,wl).call(this);return}w(this,nn,p(this,Z,d0).call(this));const e=((i=l(this,fe).activeScreen)==null?void 0:i.id)??null,r=e&&l(this,nn).some(o=>o.screenID===e)?e:((s=l(this,nn)[0])==null?void 0:s.screenID)??null;w(this,$e,{kind:"picker",filter:"",highlightedID:r}),l(this,dt).call(this),queueMicrotask(()=>{var o;(o=l(this,Qo).value)==null||o.focus()})});S(this,Xl,e=>{var u;const r=l(this,$e);if(r.kind!=="picker")return;const i=e.target;if(!(i instanceof HTMLInputElement))return;const s=i.value,o=p(this,Z,bl).call(this,l(this,nn),s),c=r.highlightedID!==null&&o.some(h=>h.screenID===r.highlightedID)?r.highlightedID:((u=o[0])==null?void 0:u.screenID)??null;w(this,$e,{kind:"picker",filter:s,highlightedID:c}),l(this,dt).call(this)});S(this,Ql,e=>{var s;const r=l(this,$e);if(r.kind!=="picker")return;if(e.key==="Escape"){e.preventDefault(),p(this,Z,wl).call(this),(s=l(this,ts).value)==null||s.focus();return}const i=p(this,Z,bl).call(this,l(this,nn),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));w(this,$e,{kind:"picker",filter:r.filter,highlightedID:i[c].screenID}),l(this,dt).call(this);return}if(e.key==="Enter"){e.preventDefault();const o=i.find(a=>a.screenID===r.highlightedID);o&&p(this,Z,Yh).call(this,o)}});S(this,ec,e=>{p(this,Z,Yh).call(this,e)});S(this,tc,e=>{l(this,$e).kind==="picker"&&e.target===l(this,An).value&&(w(this,$e,{kind:"none"}),l(this,dt).call(this))});S(this,nc,async()=>{if(l(this,ns))return;const e=p(this,Z,p0).call(this);if(e){w(this,ns,!0);try{const r=await e.createScreen(eN(new Date));l(this,fe).addTab(e.url,r.id),l(this,fe).setActive(e.url,r.id)}catch{}finally{w(this,ns,!1)}}});S(this,dt,()=>{const e=p(this,Z,u0).call(this);Ve(L`
354
+ ${p(this,Z,f0).call(this)}
355
355
  <div class="pills" role="group" aria-label="Open tabs">
356
- ${e.map(r=>p(this,Z,p0).call(this,r))}
356
+ ${e.map(r=>p(this,Z,g0).call(this,r))}
357
357
  </div>
358
- ${p(this,Z,f0).call(this)}
359
- `,this),l(this,An).value&&(l(this,An).value.anchor=l(this,ts).value??null)})}connected(){l(this,fe).addEventListener("active-screen-changed",l(this,ea)),l(this,fe).addEventListener("tabs-changed",l(this,ta)),l(this,Gn).addEventListener("screens-changed",l(this,na)),p(this,Z,jh).call(this),l(this,dt).call(this),p(this,Z,s0).call(this),l(this,es).defer(()=>{l(this,fe).removeEventListener("active-screen-changed",l(this,ea)),l(this,fe).removeEventListener("tabs-changed",l(this,ta)),l(this,Gn).removeEventListener("screens-changed",l(this,na)),p(this,Z,Bh).call(this)})}disconnected(){l(this,es).dispose(),w(this,es,new DisposableStack)}}fe=new WeakMap,Gn=new WeakMap,qn=new WeakMap,es=new WeakMap,ts=new WeakMap,An=new WeakMap,Qo=new WeakMap,$e=new WeakMap,ns=new WeakMap,nn=new WeakMap,Z=new WeakSet,s0=async function(){const e=await Bv(this);this.setAttribute("tone",e)},ea=new WeakMap,ta=new WeakMap,na=new WeakMap,ra=new WeakMap,jh=function(){var r;const e=l(this,fe).activeScreen;l(this,qn)!==e&&(p(this,Z,Bh).call(this),w(this,qn,e),(r=l(this,qn))==null||r.addEventListener("change",l(this,ra)))},Bh=function(){var e;(e=l(this,qn))==null||e.removeEventListener("change",l(this,ra)),w(this,qn,null)},Gh=function(e,r){l(this,fe).setActive(e,r)},o0=function(e,r,i){i.stopPropagation();const s=l(this,fe).getTabs(e),o=p(this,Z,c0).call(this,s,r),a=l(this,fe).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,fe).removeTab(e,r),c&&(o?l(this,fe).setActive(e,o):l(this,fe).clearActive())},a0=function(e,r,i){const s=l(this,fe).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,Gn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},l0=function(){const e=l(this,fe).activeScreen,r=[];for(const i of l(this,Gn).servers.values())for(const s of l(this,fe).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},c0=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},Jl=new WeakMap,Xl=new WeakMap,Ql=new WeakMap,ec=new WeakMap,qh=function(e){l(this,fe).addTab(e.serverURL,e.screenID),l(this,fe).setActive(e.serverURL,e.screenID),p(this,Z,wl).call(this)},u0=function(){return l(this,fe).screens.map(e=>({serverURL:e.server.url,screenID:e.screen.id,name:e.screen.name}))},bl=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},tc=new WeakMap,wl=function(){l(this,$e).kind==="picker"&&(l(this,An).value&&(l(this,An).value.open=!1),w(this,$e,{kind:"none"}),l(this,dt).call(this))},nc=new WeakMap,h0=function(){for(const e of l(this,Gn).servers.values())return e;return null},d0=function(){return L`
358
+ ${p(this,Z,m0).call(this)}
359
+ `,this),l(this,An).value&&(l(this,An).value.anchor=l(this,ts).value??null)})}connected(){l(this,fe).addEventListener("active-screen-changed",l(this,ea)),l(this,fe).addEventListener("tabs-changed",l(this,ta)),l(this,Gn).addEventListener("screens-changed",l(this,na)),p(this,Z,Bh).call(this),l(this,dt).call(this),p(this,Z,a0).call(this),l(this,es).defer(()=>{l(this,fe).removeEventListener("active-screen-changed",l(this,ea)),l(this,fe).removeEventListener("tabs-changed",l(this,ta)),l(this,Gn).removeEventListener("screens-changed",l(this,na)),p(this,Z,Gh).call(this)})}disconnected(){l(this,es).dispose(),w(this,es,new DisposableStack)}}fe=new WeakMap,Gn=new WeakMap,qn=new WeakMap,es=new WeakMap,ts=new WeakMap,An=new WeakMap,Qo=new WeakMap,$e=new WeakMap,ns=new WeakMap,nn=new WeakMap,Z=new WeakSet,a0=async function(){const e=await qv(this);this.setAttribute("tone",e)},ea=new WeakMap,ta=new WeakMap,na=new WeakMap,ra=new WeakMap,Bh=function(){var r;const e=l(this,fe).activeScreen;l(this,qn)!==e&&(p(this,Z,Gh).call(this),w(this,qn,e),(r=l(this,qn))==null||r.addEventListener("change",l(this,ra)))},Gh=function(){var e;(e=l(this,qn))==null||e.removeEventListener("change",l(this,ra)),w(this,qn,null)},qh=function(e,r){l(this,fe).setActive(e,r)},l0=function(e,r,i){i.stopPropagation();const s=l(this,fe).getTabs(e),o=p(this,Z,h0).call(this,s,r),a=l(this,fe).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,fe).removeTab(e,r),c&&(o?l(this,fe).setActive(e,o):l(this,fe).clearActive())},c0=function(e,r,i){const s=l(this,fe).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,Gn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},u0=function(){const e=l(this,fe).activeScreen,r=[];for(const i of l(this,Gn).servers.values())for(const s of l(this,fe).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},h0=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},Jl=new WeakMap,Xl=new WeakMap,Ql=new WeakMap,ec=new WeakMap,Yh=function(e){l(this,fe).addTab(e.serverURL,e.screenID),l(this,fe).setActive(e.serverURL,e.screenID),p(this,Z,wl).call(this)},d0=function(){return l(this,fe).screens.map(e=>({serverURL:e.server.url,screenID:e.screen.id,name:e.screen.name}))},bl=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},tc=new WeakMap,wl=function(){l(this,$e).kind==="picker"&&(l(this,An).value&&(l(this,An).value.open=!1),w(this,$e,{kind:"none"}),l(this,dt).call(this))},nc=new WeakMap,p0=function(){for(const e of l(this,Gn).servers.values())return e;return null},f0=function(){return L`
360
360
  <segmented-control variant="glass" role="group" aria-label="Screens">
361
361
  <button
362
362
  type="button"
@@ -365,7 +365,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
365
365
  @click=${l(this,Jl)}
366
366
  ${fl(l(this,ts))}
367
367
  >
368
- ${kO({size:16,weight:"regular"})}
368
+ ${EO({size:16,weight:"regular"})}
369
369
  </button>
370
370
  <button
371
371
  type="button"
@@ -373,10 +373,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
373
373
  aria-label="New screen"
374
374
  @click=${l(this,nc)}
375
375
  >
376
- ${xO({size:16,weight:"regular"})}
376
+ ${AO({size:16,weight:"regular"})}
377
377
  </button>
378
378
  </segmented-control>
379
- `},p0=function(e){return L`
379
+ `},g0=function(e){return L`
380
380
  <span class="tab" ?data-active=${e.isActive}>
381
381
  <button
382
382
  type="button"
@@ -385,16 +385,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
385
385
  aria-pressed=${e.isActive?"true":"false"}
386
386
  aria-current=${e.isActive?"page":le}
387
387
  aria-label=${e.isActive?`Current tab: ${e.name}`:`Switch to ${e.name}`}
388
- @mousedown=${r=>{r.button===0&&p(this,Z,Gh).call(this,e.serverURL,e.screenID)}}
389
- @click=${()=>p(this,Z,Gh).call(this,e.serverURL,e.screenID)}
388
+ @mousedown=${r=>{r.button===0&&p(this,Z,qh).call(this,e.serverURL,e.screenID)}}
389
+ @click=${()=>p(this,Z,qh).call(this,e.serverURL,e.screenID)}
390
390
  >
391
391
  <span class="tab-leading">
392
- ${SO({weight:"bold"})}
392
+ ${kO({weight:"bold"})}
393
393
  </span>
394
394
  <editable-text
395
395
  class="tab-name"
396
396
  .value=${e.name}
397
- @rename=${r=>p(this,Z,a0).call(this,e.serverURL,e.screenID,r)}
397
+ @rename=${r=>p(this,Z,c0).call(this,e.serverURL,e.screenID,r)}
398
398
  ></editable-text>
399
399
  </button>
400
400
  <button
@@ -404,12 +404,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
404
404
  icon-only
405
405
  class="tab-close"
406
406
  aria-label=${`Close ${e.name}`}
407
- @click=${r=>p(this,Z,o0).call(this,e.serverURL,e.screenID,r)}
407
+ @click=${r=>p(this,Z,l0).call(this,e.serverURL,e.screenID,r)}
408
408
  >
409
- ${Xd({weight:"bold"})}
409
+ ${Qd({weight:"bold"})}
410
410
  </button>
411
411
  </span>
412
- `},f0=function(){var o;const e=l(this,$e).kind==="picker"?l(this,$e).filter:"",r=l(this,$e).kind==="picker"?l(this,$e).highlightedID:null,i=((o=l(this,fe).activeScreen)==null?void 0:o.id)??null,s=p(this,Z,bl).call(this,l(this,nn),e);return L`
412
+ `},m0=function(){var o;const e=l(this,$e).kind==="picker"?l(this,$e).filter:"",r=l(this,$e).kind==="picker"?l(this,$e).highlightedID:null,i=((o=l(this,fe).activeScreen)==null?void 0:o.id)??null,s=p(this,Z,bl).call(this,l(this,nn),e);return L`
413
413
  <ui-popover
414
414
  class="picker-popover"
415
415
  material="glass-frosted"
@@ -430,10 +430,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
430
430
  />
431
431
  ${s.length===0?L`<p class="picker-empty">
432
432
  ${l(this,nn).length===0?"No screens":"No matches"}
433
- </p>`:p(this,Z,g0).call(this,s,r,i)}
433
+ </p>`:p(this,Z,v0).call(this,s,r,i)}
434
434
  </div>
435
435
  </ui-popover>
436
- `},g0=function(e,r,i){return L`
436
+ `},v0=function(e,r,i){return L`
437
437
  <ul class="picker-list" role="listbox">
438
438
  <li class="picker-section-label" role="presentation">Recent</li>
439
439
  ${e.map(s=>{const o=s.screenID===i;return L`
@@ -450,12 +450,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
450
450
  </li>
451
451
  `})}
452
452
  </ul>
453
- `},dt=new WeakMap;customElements.define("screen-select",JM);function XM(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}`}/*! @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:m0,setPrototypeOf:Em,isFrozen:QM,getPrototypeOf:eN,getOwnPropertyDescriptor:tN}=Object;let{freeze:tt,seal:St,create:Sl}=Object,{apply:Yh,construct:Kh}=typeof Reflect<"u"&&Reflect;tt||(tt=function(t){return t});St||(St=function(t){return t});Yh||(Yh=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)});Kh||(Kh=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 qa=nt(Array.prototype.forEach),nN=nt(Array.prototype.lastIndexOf),Am=nt(Array.prototype.pop),Ls=nt(Array.prototype.push),rN=nt(Array.prototype.splice),_l=nt(String.prototype.toLowerCase),Lu=nt(String.prototype.toString),zu=nt(String.prototype.match),zs=nt(String.prototype.replace),iN=nt(String.prototype.indexOf),sN=nt(String.prototype.trim),ut=nt(Object.prototype.hasOwnProperty),Ye=nt(RegExp.prototype.test),Os=oN(TypeError);function nt(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 Yh(n,t,r)}}function oN(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Kh(n,e)}}function G(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_l;Em&&Em(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(QM(t)||(t[r]=s),i=s)}n[i]=!0}return n}function aN(n){for(let t=0;t<n.length;t++)ut(n,t)||(n[t]=null);return n}function Wt(n){const t=Sl(null);for(const[e,r]of m0(n))ut(n,e)&&(Array.isArray(r)?t[e]=aN(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Wt(r):t[e]=r);return t}function Ms(n,t){for(;n!==null;){const r=tN(n,t);if(r){if(r.get)return nt(r.get);if(typeof r.value=="function")return nt(r.value)}n=eN(n)}function e(){return null}return e}const $m=tt(["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"]),Ou=tt(["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"]),Mu=tt(["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"]),lN=tt(["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"]),Nu=tt(["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"]),cN=tt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tm=tt(["#text"]),Im=tt(["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"]),Uu=tt(["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"]),Cm=tt(["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"]),Ya=tt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),uN=St(/\{\{[\w\W]*|[\w\W]*\}\}/gm),hN=St(/<%[\w\W]*|[\w\W]*%>/gm),dN=St(/\$\{[\w\W]*/gm),pN=St(/^data-[\-\w.\u00B7-\uFFFF]+$/),fN=St(/^aria-[\-\w]+$/),v0=St(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gN=St(/^(?:\w+script|data):/i),mN=St(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),y0=St(/^html$/i),vN=St(/^[a-z][.\w]*(-[.\w]+)+$/i);var Rm=Object.freeze({__proto__:null,ARIA_ATTR:fN,ATTR_WHITESPACE:mN,CUSTOM_ELEMENT:vN,DATA_ATTR:pN,DOCTYPE_NAME:y0,ERB_EXPR:hN,IS_ALLOWED_URI:v0,IS_SCRIPT_OR_DATA:gN,MUSTACHE_EXPR:uN,TMPLIT_EXPR:dN});const Ns={element:1,text:3,progressingInstruction:7,comment:8,document:9},yN=function(){return typeof window>"u"?null:window},bN=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}},Pm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function b0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yN();const t=U=>b0(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==Ns.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:y,trustedTypes:m}=n,E=c.prototype,x=Ms(E,"cloneNode"),I=Ms(E,"remove"),P=Ms(E,"nextSibling"),R=Ms(E,"childNodes"),V=Ms(E,"parentNode");if(typeof o=="function"){const U=e.createElement("template");U.content&&U.content.ownerDocument&&(e=U.content.ownerDocument)}let N,F="";const{implementation:Y,createNodeIterator:B,createDocumentFragment:ce,getElementsByTagName:Et}=e,{importNode:lr}=r;let ze=Pm();t.isSupported=typeof m0=="function"&&typeof V=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:cr,ERB_EXPR:Nt,TMPLIT_EXPR:Dn,DATA_ATTR:Ic,ARIA_ATTR:xa,IS_SCRIPT_OR_DATA:F0,ATTR_WHITESPACE:dp,CUSTOM_ELEMENT:H0}=Rm;let{IS_ALLOWED_URI:pp}=Rm,Re=null;const fp=G({},[...$m,...Ou,...Mu,...Nu,...Tm]);let Oe=null;const gp=G({},[...Im,...Uu,...Cm,...Ya]);let Se=Object.seal(Sl(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}})),Es=null,Ea=null;const Ln=Object.seal(Sl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let mp=!0,Cc=!0,vp=!1,yp=!0,ri=!1,Aa=!0,ur=!1,Rc=!1,Pc=!1,ii=!1,$a=!1,Ta=!1,bp=!0,wp=!1;const Z0="user-content-";let Dc=!0,As=!1,si={},Ut=null;const Lc=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Sp=null;const _p=G({},["audio","video","img","source","image","track"]);let zc=null;const kp=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ia="http://www.w3.org/1998/Math/MathML",Ca="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml";let oi=hn,Oc=!1,Mc=null;const W0=G({},[Ia,Ca,hn],Lu);let Ra=G({},["mi","mo","mn","ms","mtext"]),Pa=G({},["annotation-xml"]);const V0=G({},["title","style","font","a","script"]);let $s=null;const j0=["application/xhtml+xml","text/html"],B0="text/html";let Ae=null,ai=null;const G0=e.createElement("form"),xp=function(b){return b instanceof RegExp||b instanceof Function},Nc=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ai&&ai===b)){if((!b||typeof b!="object")&&(b={}),b=Wt(b),$s=j0.indexOf(b.PARSER_MEDIA_TYPE)===-1?B0:b.PARSER_MEDIA_TYPE,Ae=$s==="application/xhtml+xml"?Lu:_l,Re=ut(b,"ALLOWED_TAGS")?G({},b.ALLOWED_TAGS,Ae):fp,Oe=ut(b,"ALLOWED_ATTR")?G({},b.ALLOWED_ATTR,Ae):gp,Mc=ut(b,"ALLOWED_NAMESPACES")?G({},b.ALLOWED_NAMESPACES,Lu):W0,zc=ut(b,"ADD_URI_SAFE_ATTR")?G(Wt(kp),b.ADD_URI_SAFE_ATTR,Ae):kp,Sp=ut(b,"ADD_DATA_URI_TAGS")?G(Wt(_p),b.ADD_DATA_URI_TAGS,Ae):_p,Ut=ut(b,"FORBID_CONTENTS")?G({},b.FORBID_CONTENTS,Ae):Lc,Es=ut(b,"FORBID_TAGS")?G({},b.FORBID_TAGS,Ae):Wt({}),Ea=ut(b,"FORBID_ATTR")?G({},b.FORBID_ATTR,Ae):Wt({}),si=ut(b,"USE_PROFILES")?b.USE_PROFILES:!1,mp=b.ALLOW_ARIA_ATTR!==!1,Cc=b.ALLOW_DATA_ATTR!==!1,vp=b.ALLOW_UNKNOWN_PROTOCOLS||!1,yp=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ri=b.SAFE_FOR_TEMPLATES||!1,Aa=b.SAFE_FOR_XML!==!1,ur=b.WHOLE_DOCUMENT||!1,ii=b.RETURN_DOM||!1,$a=b.RETURN_DOM_FRAGMENT||!1,Ta=b.RETURN_TRUSTED_TYPE||!1,Pc=b.FORCE_BODY||!1,bp=b.SANITIZE_DOM!==!1,wp=b.SANITIZE_NAMED_PROPS||!1,Dc=b.KEEP_CONTENT!==!1,As=b.IN_PLACE||!1,pp=b.ALLOWED_URI_REGEXP||v0,oi=b.NAMESPACE||hn,Ra=b.MATHML_TEXT_INTEGRATION_POINTS||Ra,Pa=b.HTML_INTEGRATION_POINTS||Pa,Se=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&xp(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Se.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&xp(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Se.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Se.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ri&&(Cc=!1),$a&&(ii=!0),si&&(Re=G({},Tm),Oe=Sl(null),si.html===!0&&(G(Re,$m),G(Oe,Im)),si.svg===!0&&(G(Re,Ou),G(Oe,Uu),G(Oe,Ya)),si.svgFilters===!0&&(G(Re,Mu),G(Oe,Uu),G(Oe,Ya)),si.mathMl===!0&&(G(Re,Nu),G(Oe,Cm),G(Oe,Ya))),ut(b,"ADD_TAGS")||(Ln.tagCheck=null),ut(b,"ADD_ATTR")||(Ln.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?Ln.tagCheck=b.ADD_TAGS:(Re===fp&&(Re=Wt(Re)),G(Re,b.ADD_TAGS,Ae))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?Ln.attributeCheck=b.ADD_ATTR:(Oe===gp&&(Oe=Wt(Oe)),G(Oe,b.ADD_ATTR,Ae))),b.ADD_URI_SAFE_ATTR&&G(zc,b.ADD_URI_SAFE_ATTR,Ae),b.FORBID_CONTENTS&&(Ut===Lc&&(Ut=Wt(Ut)),G(Ut,b.FORBID_CONTENTS,Ae)),b.ADD_FORBID_CONTENTS&&(Ut===Lc&&(Ut=Wt(Ut)),G(Ut,b.ADD_FORBID_CONTENTS,Ae)),Dc&&(Re["#text"]=!0),ur&&G(Re,["html","head","body"]),Re.table&&(G(Re,["tbody"]),delete Es.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Os('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Os('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=b.TRUSTED_TYPES_POLICY,F=N.createHTML("")}else N===void 0&&(N=bN(m,i)),N!==null&&typeof F=="string"&&(F=N.createHTML(""));tt&&tt(b),ai=b}},Ep=G({},[...Ou,...Mu,...lN]),Ap=G({},[...Nu,...cN]),q0=function(b){let C=V(b);(!C||!C.tagName)&&(C={namespaceURI:oi,tagName:"template"});const D=_l(b.tagName),de=_l(C.tagName);return Mc[b.namespaceURI]?b.namespaceURI===Ca?C.namespaceURI===hn?D==="svg":C.namespaceURI===Ia?D==="svg"&&(de==="annotation-xml"||Ra[de]):!!Ep[D]:b.namespaceURI===Ia?C.namespaceURI===hn?D==="math":C.namespaceURI===Ca?D==="math"&&Pa[de]:!!Ap[D]:b.namespaceURI===hn?C.namespaceURI===Ca&&!Pa[de]||C.namespaceURI===Ia&&!Ra[de]?!1:!Ap[D]&&(V0[D]||!Ep[D]):!!($s==="application/xhtml+xml"&&Mc[b.namespaceURI]):!1},Ft=function(b){Ls(t.removed,{element:b});try{V(b).removeChild(b)}catch{I(b)}},hr=function(b,C){try{Ls(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{Ls(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(ii||$a)try{Ft(C)}catch{}else try{C.setAttribute(b,"")}catch{}},$p=function(b){let C=null,D=null;if(Pc)b="<remove></remove>"+b;else{const _e=zu(b,/^[\r\n\t ]+/);D=_e&&_e[0]}$s==="application/xhtml+xml"&&oi===hn&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const de=N?N.createHTML(b):b;if(oi===hn)try{C=new y().parseFromString(de,$s)}catch{}if(!C||!C.documentElement){C=Y.createDocument(oi,"template",null);try{C.documentElement.innerHTML=Oc?F:de}catch{}}const Be=C.body||C.documentElement;return b&&D&&Be.insertBefore(e.createTextNode(D),Be.childNodes[0]||null),oi===hn?Et.call(C,ur?"html":"body")[0]:ur?C.documentElement:Be},Tp=function(b){return B.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Uc=function(b){return b instanceof f&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof h)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Ip=function(b){return typeof a=="function"&&b instanceof a};function dn(U,b,C){qa(U,D=>{D.call(t,b,C,ai)})}const Cp=function(b){let C=null;if(dn(ze.beforeSanitizeElements,b,null),Uc(b))return Ft(b),!0;const D=Ae(b.nodeName);if(dn(ze.uponSanitizeElement,b,{tagName:D,allowedTags:Re}),Aa&&b.hasChildNodes()&&!Ip(b.firstElementChild)&&Ye(/<[/\w!]/g,b.innerHTML)&&Ye(/<[/\w!]/g,b.textContent)||b.nodeType===Ns.progressingInstruction||Aa&&b.nodeType===Ns.comment&&Ye(/<[/\w]/g,b.data))return Ft(b),!0;if(!(Ln.tagCheck instanceof Function&&Ln.tagCheck(D))&&(!Re[D]||Es[D])){if(!Es[D]&&Pp(D)&&(Se.tagNameCheck instanceof RegExp&&Ye(Se.tagNameCheck,D)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(D)))return!1;if(Dc&&!Ut[D]){const de=V(b)||b.parentNode,Be=R(b)||b.childNodes;if(Be&&de){const _e=Be.length;for(let rt=_e-1;rt>=0;--rt){const pn=x(Be[rt],!0);pn.__removalCount=(b.__removalCount||0)+1,de.insertBefore(pn,P(b))}}}return Ft(b),!0}return b instanceof c&&!q0(b)||(D==="noscript"||D==="noembed"||D==="noframes")&&Ye(/<\/no(script|embed|frames)/i,b.innerHTML)?(Ft(b),!0):(ri&&b.nodeType===Ns.text&&(C=b.textContent,qa([cr,Nt,Dn],de=>{C=zs(C,de," ")}),b.textContent!==C&&(Ls(t.removed,{element:b.cloneNode()}),b.textContent=C)),dn(ze.afterSanitizeElements,b,null),!1)},Rp=function(b,C,D){if(Ea[C]||bp&&(C==="id"||C==="name")&&(D in e||D in G0))return!1;if(!(Cc&&!Ea[C]&&Ye(Ic,C))){if(!(mp&&Ye(xa,C))){if(!(Ln.attributeCheck instanceof Function&&Ln.attributeCheck(C,b))){if(!Oe[C]||Ea[C]){if(!(Pp(b)&&(Se.tagNameCheck instanceof RegExp&&Ye(Se.tagNameCheck,b)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(b))&&(Se.attributeNameCheck instanceof RegExp&&Ye(Se.attributeNameCheck,C)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(C,b))||C==="is"&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&Ye(Se.tagNameCheck,D)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(D))))return!1}else if(!zc[C]){if(!Ye(pp,zs(D,dp,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&iN(D,"data:")===0&&Sp[b])){if(!(vp&&!Ye(F0,zs(D,dp,"")))){if(D)return!1}}}}}}}return!0},Pp=function(b){return b!=="annotation-xml"&&zu(b,H0)},Dp=function(b){dn(ze.beforeSanitizeAttributes,b,null);const{attributes:C}=b;if(!C||Uc(b))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Oe,forceKeepAttr:void 0};let de=C.length;for(;de--;){const Be=C[de],{name:_e,namespaceURI:rt,value:pn}=Be,li=Ae(_e),Fc=pn;let Me=_e==="value"?Fc:sN(Fc);if(D.attrName=li,D.attrValue=Me,D.keepAttr=!0,D.forceKeepAttr=void 0,dn(ze.uponSanitizeAttribute,b,D),Me=D.attrValue,wp&&(li==="id"||li==="name")&&(hr(_e,b),Me=Z0+Me),Aa&&Ye(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Me)){hr(_e,b);continue}if(li==="attributename"&&zu(Me,"href")){hr(_e,b);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){hr(_e,b);continue}if(!yp&&Ye(/\/>/i,Me)){hr(_e,b);continue}ri&&qa([cr,Nt,Dn],zp=>{Me=zs(Me,zp," ")});const Lp=Ae(b.nodeName);if(!Rp(Lp,li,Me)){hr(_e,b);continue}if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!rt)switch(m.getAttributeType(Lp,li)){case"TrustedHTML":{Me=N.createHTML(Me);break}case"TrustedScriptURL":{Me=N.createScriptURL(Me);break}}if(Me!==Fc)try{rt?b.setAttributeNS(rt,_e,Me):b.setAttribute(_e,Me),Uc(b)?Ft(b):Am(t.removed)}catch{hr(_e,b)}}dn(ze.afterSanitizeAttributes,b,null)},Y0=function U(b){let C=null;const D=Tp(b);for(dn(ze.beforeSanitizeShadowDOM,b,null);C=D.nextNode();)dn(ze.uponSanitizeShadowNode,C,null),Cp(C),Dp(C),C.content instanceof s&&U(C.content);dn(ze.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,D=null,de=null,Be=null;if(Oc=!U,Oc&&(U="<!-->"),typeof U!="string"&&!Ip(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Os("dirty is not a string, aborting")}else throw Os("toString is not a function");if(!t.isSupported)return U;if(Rc||Nc(b),t.removed=[],typeof U=="string"&&(As=!1),As){if(U.nodeName){const pn=Ae(U.nodeName);if(!Re[pn]||Es[pn])throw Os("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)C=$p("<!---->"),D=C.ownerDocument.importNode(U,!0),D.nodeType===Ns.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?C=D:C.appendChild(D);else{if(!ii&&!ri&&!ur&&U.indexOf("<")===-1)return N&&Ta?N.createHTML(U):U;if(C=$p(U),!C)return ii?null:Ta?F:""}C&&Pc&&Ft(C.firstChild);const _e=Tp(As?U:C);for(;de=_e.nextNode();)Cp(de),Dp(de),de.content instanceof s&&Y0(de.content);if(As)return U;if(ii){if($a)for(Be=ce.call(C.ownerDocument);C.firstChild;)Be.appendChild(C.firstChild);else Be=C;return(Oe.shadowroot||Oe.shadowrootmode)&&(Be=lr.call(r,Be,!0)),Be}let rt=ur?C.outerHTML:C.innerHTML;return ur&&Re["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Ye(y0,C.ownerDocument.doctype.name)&&(rt="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
454
- `+rt),ri&&qa([cr,Nt,Dn],pn=>{rt=zs(rt,pn," ")}),N&&Ta?N.createHTML(rt):rt},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nc(U),Rc=!0},t.clearConfig=function(){ai=null,Rc=!1},t.isValidAttribute=function(U,b,C){ai||Nc({});const D=Ae(U),de=Ae(b);return Rp(D,de,C)},t.addHook=function(U,b){typeof b=="function"&&Ls(ze[U],b)},t.removeHook=function(U,b){if(b!==void 0){const C=nN(ze[U],b);return C===-1?void 0:rN(ze[U],C,1)[0]}return Am(ze[U])},t.removeHooks=function(U){ze[U]=[]},t.removeAllHooks=function(){ze=Pm()},t}var w0=b0();function ep(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ni=ep();function S0(n){ni=n}var wr={exec:()=>null};function J(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(et.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var wN=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),et={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)}}>`)},SN=/^(?:[ \t]*(?:\n|$))+/,_N=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,kN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ka=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,tp=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,_0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,k0=J(_0).replace(/bull/g,tp).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(),EN=J(_0).replace(/bull/g,tp).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(),np=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,AN=/^[^\n]+/,rp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$N=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",rp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),TN=J(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,tp).getRegex(),$c="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",ip=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,IN=J("^ {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",ip).replace("tag",$c).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x0=J(np).replace("hr",ka).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",$c).getRegex(),CN=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",x0).getRegex(),sp={blockquote:CN,code:_N,def:$N,fences:kN,heading:xN,hr:ka,html:IN,lheading:k0,list:TN,newline:SN,paragraph:x0,table:wr,text:AN},Dm=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ka).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",$c).getRegex(),RN={...sp,lheading:EN,table:Dm,paragraph:J(np).replace("hr",ka).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Dm).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",$c).getRegex()},PN={...sp,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ip).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:wr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(np).replace("hr",ka).replace("heading",` *#{1,6} *[^
455
- ]`).replace("lheading",k0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},DN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,LN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,E0=/^( {2,}|\\)\n(?!\s*$)/,zN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xs=/[\p{P}\p{S}]/u,Tc=/[\s\p{P}\p{S}]/u,op=/[^\s\p{P}\p{S}]/u,ON=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Tc).getRegex(),A0=/(?!~)[\p{P}\p{S}]/u,MN=/(?!~)[\s\p{P}\p{S}]/u,NN=/(?:[^\s\p{P}\p{S}]|~)/u,UN=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",wN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,FN=J($0,"u").replace(/punct/g,xs).getRegex(),HN=J($0,"u").replace(/punct/g,A0).getRegex(),T0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ZN=J(T0,"gu").replace(/notPunctSpace/g,op).replace(/punctSpace/g,Tc).replace(/punct/g,xs).getRegex(),WN=J(T0,"gu").replace(/notPunctSpace/g,NN).replace(/punctSpace/g,MN).replace(/punct/g,A0).getRegex(),VN=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,op).replace(/punctSpace/g,Tc).replace(/punct/g,xs).getRegex(),jN=J(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,xs).getRegex(),BN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",GN=J(BN,"gu").replace(/notPunctSpace/g,op).replace(/punctSpace/g,Tc).replace(/punct/g,xs).getRegex(),qN=J(/\\(punct)/,"gu").replace(/punct/g,xs).getRegex(),YN=J(/^<(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(),KN=J(ip).replace("(?:-->|$)","-->").getRegex(),JN=J("^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",KN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,XN=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Zl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),I0=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Zl).replace("ref",rp).getRegex(),C0=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",rp).getRegex(),QN=J("reflink|nolink(?!\\()","g").replace("reflink",I0).replace("nolink",C0).getRegex(),Lm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ap={_backpedal:wr,anyPunctuation:qN,autolink:YN,blockSkip:UN,br:E0,code:LN,del:wr,delLDelim:wr,delRDelim:wr,emStrongLDelim:FN,emStrongRDelimAst:ZN,emStrongRDelimUnd:VN,escape:DN,link:XN,nolink:C0,punctuation:ON,reflink:I0,reflinkSearch:QN,tag:JN,text:zN,url:wr},e6={...ap,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Zl).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zl).getRegex()},Jh={...ap,emStrongRDelimAst:WN,emStrongLDelim:HN,delLDelim:jN,delRDelim:GN,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Lm).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:J(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Lm).getRegex()},t6={...Jh,br:J(E0).replace("{2,}","*").getRegex(),text:J(Jh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ka={normal:sp,gfm:RN,pedantic:PN},Us={normal:ap,gfm:Jh,breaks:t6,pedantic:e6},n6={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},zm=n=>n6[n];function Vt(n,t){if(t){if(et.escapeTest.test(n))return n.replace(et.escapeReplace,zm)}else if(et.escapeTestNoEncode.test(n))return n.replace(et.escapeReplaceNoEncode,zm);return n}function Om(n){try{n=encodeURI(n).replace(et.percentDecode,"%")}catch{return null}return n}function Mm(n,t){var s;let e=n.replace(et.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(et.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(et.slashPipe,"|");return r}function Fs(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 r6(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 i6(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 Nm(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 s6(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
453
+ `},dt=new WeakMap;customElements.define("screen-select",QM);function eN(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}`}/*! @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:y0,setPrototypeOf:$m,isFrozen:tN,getPrototypeOf:nN,getOwnPropertyDescriptor:rN}=Object;let{freeze:tt,seal:St,create:Sl}=Object,{apply:Kh,construct:Jh}=typeof Reflect<"u"&&Reflect;tt||(tt=function(t){return t});St||(St=function(t){return t});Kh||(Kh=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)});Jh||(Jh=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 qa=nt(Array.prototype.forEach),iN=nt(Array.prototype.lastIndexOf),Tm=nt(Array.prototype.pop),Ls=nt(Array.prototype.push),sN=nt(Array.prototype.splice),_l=nt(String.prototype.toLowerCase),zu=nt(String.prototype.toString),Ou=nt(String.prototype.match),zs=nt(String.prototype.replace),oN=nt(String.prototype.indexOf),aN=nt(String.prototype.trim),ut=nt(Object.prototype.hasOwnProperty),Ye=nt(RegExp.prototype.test),Os=lN(TypeError);function nt(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 Kh(n,t,r)}}function lN(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Jh(n,e)}}function G(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_l;$m&&$m(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(tN(t)||(t[r]=s),i=s)}n[i]=!0}return n}function cN(n){for(let t=0;t<n.length;t++)ut(n,t)||(n[t]=null);return n}function Wt(n){const t=Sl(null);for(const[e,r]of y0(n))ut(n,e)&&(Array.isArray(r)?t[e]=cN(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Wt(r):t[e]=r);return t}function Ms(n,t){for(;n!==null;){const r=rN(n,t);if(r){if(r.get)return nt(r.get);if(typeof r.value=="function")return nt(r.value)}n=nN(n)}function e(){return null}return e}const Im=tt(["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"]),Mu=tt(["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"]),Nu=tt(["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"]),uN=tt(["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"]),Uu=tt(["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"]),hN=tt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cm=tt(["#text"]),Rm=tt(["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"]),Fu=tt(["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"]),Pm=tt(["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"]),Ya=tt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dN=St(/\{\{[\w\W]*|[\w\W]*\}\}/gm),pN=St(/<%[\w\W]*|[\w\W]*%>/gm),fN=St(/\$\{[\w\W]*/gm),gN=St(/^data-[\-\w.\u00B7-\uFFFF]+$/),mN=St(/^aria-[\-\w]+$/),b0=St(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vN=St(/^(?:\w+script|data):/i),yN=St(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),w0=St(/^html$/i),bN=St(/^[a-z][.\w]*(-[.\w]+)+$/i);var Dm=Object.freeze({__proto__:null,ARIA_ATTR:mN,ATTR_WHITESPACE:yN,CUSTOM_ELEMENT:bN,DATA_ATTR:gN,DOCTYPE_NAME:w0,ERB_EXPR:pN,IS_ALLOWED_URI:b0,IS_SCRIPT_OR_DATA:vN,MUSTACHE_EXPR:dN,TMPLIT_EXPR:fN});const Ns={element:1,text:3,progressingInstruction:7,comment:8,document:9},wN=function(){return typeof window>"u"?null:window},SN=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}},Lm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function S0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wN();const t=U=>S0(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==Ns.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:y,trustedTypes:m}=n,E=c.prototype,x=Ms(E,"cloneNode"),I=Ms(E,"remove"),P=Ms(E,"nextSibling"),R=Ms(E,"childNodes"),V=Ms(E,"parentNode");if(typeof o=="function"){const U=e.createElement("template");U.content&&U.content.ownerDocument&&(e=U.content.ownerDocument)}let N,F="";const{implementation:Y,createNodeIterator:B,createDocumentFragment:ce,getElementsByTagName:Et}=e,{importNode:lr}=r;let ze=Lm();t.isSupported=typeof y0=="function"&&typeof V=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:cr,ERB_EXPR:Nt,TMPLIT_EXPR:Dn,DATA_ATTR:Ic,ARIA_ATTR:xa,IS_SCRIPT_OR_DATA:Z0,ATTR_WHITESPACE:pp,CUSTOM_ELEMENT:W0}=Dm;let{IS_ALLOWED_URI:fp}=Dm,Re=null;const gp=G({},[...Im,...Mu,...Nu,...Uu,...Cm]);let Oe=null;const mp=G({},[...Rm,...Fu,...Pm,...Ya]);let Se=Object.seal(Sl(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}})),Es=null,Ea=null;const Ln=Object.seal(Sl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let vp=!0,Cc=!0,yp=!1,bp=!0,ri=!1,Aa=!0,ur=!1,Rc=!1,Pc=!1,ii=!1,$a=!1,Ta=!1,wp=!0,Sp=!1;const V0="user-content-";let Dc=!0,As=!1,si={},Ut=null;const Lc=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let _p=null;const kp=G({},["audio","video","img","source","image","track"]);let zc=null;const xp=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ia="http://www.w3.org/1998/Math/MathML",Ca="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml";let oi=hn,Oc=!1,Mc=null;const j0=G({},[Ia,Ca,hn],zu);let Ra=G({},["mi","mo","mn","ms","mtext"]),Pa=G({},["annotation-xml"]);const B0=G({},["title","style","font","a","script"]);let $s=null;const G0=["application/xhtml+xml","text/html"],q0="text/html";let Ae=null,ai=null;const Y0=e.createElement("form"),Ep=function(b){return b instanceof RegExp||b instanceof Function},Nc=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ai&&ai===b)){if((!b||typeof b!="object")&&(b={}),b=Wt(b),$s=G0.indexOf(b.PARSER_MEDIA_TYPE)===-1?q0:b.PARSER_MEDIA_TYPE,Ae=$s==="application/xhtml+xml"?zu:_l,Re=ut(b,"ALLOWED_TAGS")?G({},b.ALLOWED_TAGS,Ae):gp,Oe=ut(b,"ALLOWED_ATTR")?G({},b.ALLOWED_ATTR,Ae):mp,Mc=ut(b,"ALLOWED_NAMESPACES")?G({},b.ALLOWED_NAMESPACES,zu):j0,zc=ut(b,"ADD_URI_SAFE_ATTR")?G(Wt(xp),b.ADD_URI_SAFE_ATTR,Ae):xp,_p=ut(b,"ADD_DATA_URI_TAGS")?G(Wt(kp),b.ADD_DATA_URI_TAGS,Ae):kp,Ut=ut(b,"FORBID_CONTENTS")?G({},b.FORBID_CONTENTS,Ae):Lc,Es=ut(b,"FORBID_TAGS")?G({},b.FORBID_TAGS,Ae):Wt({}),Ea=ut(b,"FORBID_ATTR")?G({},b.FORBID_ATTR,Ae):Wt({}),si=ut(b,"USE_PROFILES")?b.USE_PROFILES:!1,vp=b.ALLOW_ARIA_ATTR!==!1,Cc=b.ALLOW_DATA_ATTR!==!1,yp=b.ALLOW_UNKNOWN_PROTOCOLS||!1,bp=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ri=b.SAFE_FOR_TEMPLATES||!1,Aa=b.SAFE_FOR_XML!==!1,ur=b.WHOLE_DOCUMENT||!1,ii=b.RETURN_DOM||!1,$a=b.RETURN_DOM_FRAGMENT||!1,Ta=b.RETURN_TRUSTED_TYPE||!1,Pc=b.FORCE_BODY||!1,wp=b.SANITIZE_DOM!==!1,Sp=b.SANITIZE_NAMED_PROPS||!1,Dc=b.KEEP_CONTENT!==!1,As=b.IN_PLACE||!1,fp=b.ALLOWED_URI_REGEXP||b0,oi=b.NAMESPACE||hn,Ra=b.MATHML_TEXT_INTEGRATION_POINTS||Ra,Pa=b.HTML_INTEGRATION_POINTS||Pa,Se=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Ep(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Se.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Ep(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Se.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Se.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ri&&(Cc=!1),$a&&(ii=!0),si&&(Re=G({},Cm),Oe=Sl(null),si.html===!0&&(G(Re,Im),G(Oe,Rm)),si.svg===!0&&(G(Re,Mu),G(Oe,Fu),G(Oe,Ya)),si.svgFilters===!0&&(G(Re,Nu),G(Oe,Fu),G(Oe,Ya)),si.mathMl===!0&&(G(Re,Uu),G(Oe,Pm),G(Oe,Ya))),ut(b,"ADD_TAGS")||(Ln.tagCheck=null),ut(b,"ADD_ATTR")||(Ln.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?Ln.tagCheck=b.ADD_TAGS:(Re===gp&&(Re=Wt(Re)),G(Re,b.ADD_TAGS,Ae))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?Ln.attributeCheck=b.ADD_ATTR:(Oe===mp&&(Oe=Wt(Oe)),G(Oe,b.ADD_ATTR,Ae))),b.ADD_URI_SAFE_ATTR&&G(zc,b.ADD_URI_SAFE_ATTR,Ae),b.FORBID_CONTENTS&&(Ut===Lc&&(Ut=Wt(Ut)),G(Ut,b.FORBID_CONTENTS,Ae)),b.ADD_FORBID_CONTENTS&&(Ut===Lc&&(Ut=Wt(Ut)),G(Ut,b.ADD_FORBID_CONTENTS,Ae)),Dc&&(Re["#text"]=!0),ur&&G(Re,["html","head","body"]),Re.table&&(G(Re,["tbody"]),delete Es.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Os('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Os('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=b.TRUSTED_TYPES_POLICY,F=N.createHTML("")}else N===void 0&&(N=SN(m,i)),N!==null&&typeof F=="string"&&(F=N.createHTML(""));tt&&tt(b),ai=b}},Ap=G({},[...Mu,...Nu,...uN]),$p=G({},[...Uu,...hN]),K0=function(b){let C=V(b);(!C||!C.tagName)&&(C={namespaceURI:oi,tagName:"template"});const D=_l(b.tagName),de=_l(C.tagName);return Mc[b.namespaceURI]?b.namespaceURI===Ca?C.namespaceURI===hn?D==="svg":C.namespaceURI===Ia?D==="svg"&&(de==="annotation-xml"||Ra[de]):!!Ap[D]:b.namespaceURI===Ia?C.namespaceURI===hn?D==="math":C.namespaceURI===Ca?D==="math"&&Pa[de]:!!$p[D]:b.namespaceURI===hn?C.namespaceURI===Ca&&!Pa[de]||C.namespaceURI===Ia&&!Ra[de]?!1:!$p[D]&&(B0[D]||!Ap[D]):!!($s==="application/xhtml+xml"&&Mc[b.namespaceURI]):!1},Ft=function(b){Ls(t.removed,{element:b});try{V(b).removeChild(b)}catch{I(b)}},hr=function(b,C){try{Ls(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{Ls(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(ii||$a)try{Ft(C)}catch{}else try{C.setAttribute(b,"")}catch{}},Tp=function(b){let C=null,D=null;if(Pc)b="<remove></remove>"+b;else{const _e=Ou(b,/^[\r\n\t ]+/);D=_e&&_e[0]}$s==="application/xhtml+xml"&&oi===hn&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const de=N?N.createHTML(b):b;if(oi===hn)try{C=new y().parseFromString(de,$s)}catch{}if(!C||!C.documentElement){C=Y.createDocument(oi,"template",null);try{C.documentElement.innerHTML=Oc?F:de}catch{}}const Be=C.body||C.documentElement;return b&&D&&Be.insertBefore(e.createTextNode(D),Be.childNodes[0]||null),oi===hn?Et.call(C,ur?"html":"body")[0]:ur?C.documentElement:Be},Ip=function(b){return B.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Uc=function(b){return b instanceof f&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof h)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Cp=function(b){return typeof a=="function"&&b instanceof a};function dn(U,b,C){qa(U,D=>{D.call(t,b,C,ai)})}const Rp=function(b){let C=null;if(dn(ze.beforeSanitizeElements,b,null),Uc(b))return Ft(b),!0;const D=Ae(b.nodeName);if(dn(ze.uponSanitizeElement,b,{tagName:D,allowedTags:Re}),Aa&&b.hasChildNodes()&&!Cp(b.firstElementChild)&&Ye(/<[/\w!]/g,b.innerHTML)&&Ye(/<[/\w!]/g,b.textContent)||b.nodeType===Ns.progressingInstruction||Aa&&b.nodeType===Ns.comment&&Ye(/<[/\w]/g,b.data))return Ft(b),!0;if(!(Ln.tagCheck instanceof Function&&Ln.tagCheck(D))&&(!Re[D]||Es[D])){if(!Es[D]&&Dp(D)&&(Se.tagNameCheck instanceof RegExp&&Ye(Se.tagNameCheck,D)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(D)))return!1;if(Dc&&!Ut[D]){const de=V(b)||b.parentNode,Be=R(b)||b.childNodes;if(Be&&de){const _e=Be.length;for(let rt=_e-1;rt>=0;--rt){const pn=x(Be[rt],!0);pn.__removalCount=(b.__removalCount||0)+1,de.insertBefore(pn,P(b))}}}return Ft(b),!0}return b instanceof c&&!K0(b)||(D==="noscript"||D==="noembed"||D==="noframes")&&Ye(/<\/no(script|embed|frames)/i,b.innerHTML)?(Ft(b),!0):(ri&&b.nodeType===Ns.text&&(C=b.textContent,qa([cr,Nt,Dn],de=>{C=zs(C,de," ")}),b.textContent!==C&&(Ls(t.removed,{element:b.cloneNode()}),b.textContent=C)),dn(ze.afterSanitizeElements,b,null),!1)},Pp=function(b,C,D){if(Ea[C]||wp&&(C==="id"||C==="name")&&(D in e||D in Y0))return!1;if(!(Cc&&!Ea[C]&&Ye(Ic,C))){if(!(vp&&Ye(xa,C))){if(!(Ln.attributeCheck instanceof Function&&Ln.attributeCheck(C,b))){if(!Oe[C]||Ea[C]){if(!(Dp(b)&&(Se.tagNameCheck instanceof RegExp&&Ye(Se.tagNameCheck,b)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(b))&&(Se.attributeNameCheck instanceof RegExp&&Ye(Se.attributeNameCheck,C)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(C,b))||C==="is"&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&Ye(Se.tagNameCheck,D)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(D))))return!1}else if(!zc[C]){if(!Ye(fp,zs(D,pp,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&oN(D,"data:")===0&&_p[b])){if(!(yp&&!Ye(Z0,zs(D,pp,"")))){if(D)return!1}}}}}}}return!0},Dp=function(b){return b!=="annotation-xml"&&Ou(b,W0)},Lp=function(b){dn(ze.beforeSanitizeAttributes,b,null);const{attributes:C}=b;if(!C||Uc(b))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Oe,forceKeepAttr:void 0};let de=C.length;for(;de--;){const Be=C[de],{name:_e,namespaceURI:rt,value:pn}=Be,li=Ae(_e),Fc=pn;let Me=_e==="value"?Fc:aN(Fc);if(D.attrName=li,D.attrValue=Me,D.keepAttr=!0,D.forceKeepAttr=void 0,dn(ze.uponSanitizeAttribute,b,D),Me=D.attrValue,Sp&&(li==="id"||li==="name")&&(hr(_e,b),Me=V0+Me),Aa&&Ye(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Me)){hr(_e,b);continue}if(li==="attributename"&&Ou(Me,"href")){hr(_e,b);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){hr(_e,b);continue}if(!bp&&Ye(/\/>/i,Me)){hr(_e,b);continue}ri&&qa([cr,Nt,Dn],Op=>{Me=zs(Me,Op," ")});const zp=Ae(b.nodeName);if(!Pp(zp,li,Me)){hr(_e,b);continue}if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!rt)switch(m.getAttributeType(zp,li)){case"TrustedHTML":{Me=N.createHTML(Me);break}case"TrustedScriptURL":{Me=N.createScriptURL(Me);break}}if(Me!==Fc)try{rt?b.setAttributeNS(rt,_e,Me):b.setAttribute(_e,Me),Uc(b)?Ft(b):Tm(t.removed)}catch{hr(_e,b)}}dn(ze.afterSanitizeAttributes,b,null)},J0=function U(b){let C=null;const D=Ip(b);for(dn(ze.beforeSanitizeShadowDOM,b,null);C=D.nextNode();)dn(ze.uponSanitizeShadowNode,C,null),Rp(C),Lp(C),C.content instanceof s&&U(C.content);dn(ze.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,D=null,de=null,Be=null;if(Oc=!U,Oc&&(U="<!-->"),typeof U!="string"&&!Cp(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Os("dirty is not a string, aborting")}else throw Os("toString is not a function");if(!t.isSupported)return U;if(Rc||Nc(b),t.removed=[],typeof U=="string"&&(As=!1),As){if(U.nodeName){const pn=Ae(U.nodeName);if(!Re[pn]||Es[pn])throw Os("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)C=Tp("<!---->"),D=C.ownerDocument.importNode(U,!0),D.nodeType===Ns.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?C=D:C.appendChild(D);else{if(!ii&&!ri&&!ur&&U.indexOf("<")===-1)return N&&Ta?N.createHTML(U):U;if(C=Tp(U),!C)return ii?null:Ta?F:""}C&&Pc&&Ft(C.firstChild);const _e=Ip(As?U:C);for(;de=_e.nextNode();)Rp(de),Lp(de),de.content instanceof s&&J0(de.content);if(As)return U;if(ii){if($a)for(Be=ce.call(C.ownerDocument);C.firstChild;)Be.appendChild(C.firstChild);else Be=C;return(Oe.shadowroot||Oe.shadowrootmode)&&(Be=lr.call(r,Be,!0)),Be}let rt=ur?C.outerHTML:C.innerHTML;return ur&&Re["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Ye(w0,C.ownerDocument.doctype.name)&&(rt="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
454
+ `+rt),ri&&qa([cr,Nt,Dn],pn=>{rt=zs(rt,pn," ")}),N&&Ta?N.createHTML(rt):rt},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nc(U),Rc=!0},t.clearConfig=function(){ai=null,Rc=!1},t.isValidAttribute=function(U,b,C){ai||Nc({});const D=Ae(U),de=Ae(b);return Pp(D,de,C)},t.addHook=function(U,b){typeof b=="function"&&Ls(ze[U],b)},t.removeHook=function(U,b){if(b!==void 0){const C=iN(ze[U],b);return C===-1?void 0:sN(ze[U],C,1)[0]}return Tm(ze[U])},t.removeHooks=function(U){ze[U]=[]},t.removeAllHooks=function(){ze=Lm()},t}var _0=S0();function tp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ni=tp();function k0(n){ni=n}var wr={exec:()=>null};function J(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(et.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var _N=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),et={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)}}>`)},kN=/^(?:[ \t]*(?:\n|$))+/,xN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,EN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ka=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,AN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,np=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,x0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,E0=J(x0).replace(/bull/g,np).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(),$N=J(x0).replace(/bull/g,np).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(),rp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,TN=/^[^\n]+/,ip=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,IN=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ip).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),CN=J(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,np).getRegex(),$c="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",sp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,RN=J("^ {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",sp).replace("tag",$c).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),A0=J(rp).replace("hr",ka).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",$c).getRegex(),PN=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",A0).getRegex(),op={blockquote:PN,code:xN,def:IN,fences:EN,heading:AN,hr:ka,html:RN,lheading:E0,list:CN,newline:kN,paragraph:A0,table:wr,text:TN},zm=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ka).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",$c).getRegex(),DN={...op,lheading:$N,table:zm,paragraph:J(rp).replace("hr",ka).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",zm).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",$c).getRegex()},LN={...op,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",sp).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:wr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(rp).replace("hr",ka).replace("heading",` *#{1,6} *[^
455
+ ]`).replace("lheading",E0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},zN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ON=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$0=/^( {2,}|\\)\n(?!\s*$)/,MN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xs=/[\p{P}\p{S}]/u,Tc=/[\s\p{P}\p{S}]/u,ap=/[^\s\p{P}\p{S}]/u,NN=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Tc).getRegex(),T0=/(?!~)[\p{P}\p{S}]/u,UN=/(?!~)[\s\p{P}\p{S}]/u,FN=/(?:[^\s\p{P}\p{S}]|~)/u,HN=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",_N?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),I0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ZN=J(I0,"u").replace(/punct/g,xs).getRegex(),WN=J(I0,"u").replace(/punct/g,T0).getRegex(),C0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",VN=J(C0,"gu").replace(/notPunctSpace/g,ap).replace(/punctSpace/g,Tc).replace(/punct/g,xs).getRegex(),jN=J(C0,"gu").replace(/notPunctSpace/g,FN).replace(/punctSpace/g,UN).replace(/punct/g,T0).getRegex(),BN=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ap).replace(/punctSpace/g,Tc).replace(/punct/g,xs).getRegex(),GN=J(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,xs).getRegex(),qN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",YN=J(qN,"gu").replace(/notPunctSpace/g,ap).replace(/punctSpace/g,Tc).replace(/punct/g,xs).getRegex(),KN=J(/\\(punct)/,"gu").replace(/punct/g,xs).getRegex(),JN=J(/^<(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(),XN=J(sp).replace("(?:-->|$)","-->").getRegex(),QN=J("^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",XN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,e6=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Zl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),R0=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Zl).replace("ref",ip).getRegex(),P0=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",ip).getRegex(),t6=J("reflink|nolink(?!\\()","g").replace("reflink",R0).replace("nolink",P0).getRegex(),Om=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,lp={_backpedal:wr,anyPunctuation:KN,autolink:JN,blockSkip:HN,br:$0,code:ON,del:wr,delLDelim:wr,delRDelim:wr,emStrongLDelim:ZN,emStrongRDelimAst:VN,emStrongRDelimUnd:BN,escape:zN,link:e6,nolink:P0,punctuation:NN,reflink:R0,reflinkSearch:t6,tag:QN,text:MN,url:wr},n6={...lp,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Zl).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zl).getRegex()},Xh={...lp,emStrongRDelimAst:jN,emStrongLDelim:WN,delLDelim:GN,delRDelim:YN,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Om).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:J(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Om).getRegex()},r6={...Xh,br:J($0).replace("{2,}","*").getRegex(),text:J(Xh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ka={normal:op,gfm:DN,pedantic:LN},Us={normal:lp,gfm:Xh,breaks:r6,pedantic:n6},i6={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Mm=n=>i6[n];function Vt(n,t){if(t){if(et.escapeTest.test(n))return n.replace(et.escapeReplace,Mm)}else if(et.escapeTestNoEncode.test(n))return n.replace(et.escapeReplaceNoEncode,Mm);return n}function Nm(n){try{n=encodeURI(n).replace(et.percentDecode,"%")}catch{return null}return n}function Um(n,t){var s;let e=n.replace(et.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(et.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(et.slashPipe,"|");return r}function Fs(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 s6(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 o6(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 Fm(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 a6(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
456
456
  `).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(`
457
457
  `)}var Wl=class{constructor(n){g(this,"options");g(this,"rules");g(this,"lexer");this.options=n||ni}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:Fs(e,`
458
- `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=s6(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=Fs(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:Fs(t[0],`
458
+ `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=a6(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=Fs(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:Fs(t[0],`
459
459
  `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=Fs(t[0],`
460
460
  `).split(`
461
461
  `),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(`
@@ -467,16 +467,16 @@ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
467
467
  `),x=this.blockquote(E);s[s.length-1]=x,r=r.substring(0,r.length-m.raw.length)+x.raw,i=i.substring(0,i.length-m.text.length)+x.text;break}else if((y==null?void 0:y.type)==="list"){let m=y,E=m.raw+`
468
468
  `+e.join(`
469
469
  `),x=this.list(E);s[s.length-1]=x,r=r.substring(0,r.length-y.raw.length)+x.raw,i=i.substring(0,i.length-m.raw.length)+x.raw,e=E.substring(s.at(-1).raw.length).split(`
470
- `);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="",y="";if(!(t=a.exec(n))||this.rules.block.hr.test(n))break;f=t[0],n=n.substring(f.length);let m=i6(t[2].split(`
470
+ `);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="",y="";if(!(t=a.exec(n))||this.rules.block.hr.test(n))break;f=t[0],n=n.substring(f.length);let m=o6(t[2].split(`
471
471
  `,1)[0],t[1].length),E=n.split(`
472
472
  `,1)[0],x=!m.trim(),I=0;if(this.options.pedantic?(I=2,y=m.trimStart()):x?I=t[1].length+1:(I=m.search(this.rules.other.nonSpaceChar),I=I>4?1:I,y=m.slice(I),I+=t[1].length),x&&this.rules.other.blankLine.test(E)&&(f+=E+`
473
473
  `,n=n.substring(E.length+1),h=!0),!h){let P=this.rules.other.nextBulletRegex(I),R=this.rules.other.hrRegex(I),V=this.rules.other.fencesBeginRegex(I),N=this.rules.other.headingBeginRegex(I),F=this.rules.other.htmlBeginRegex(I),Y=this.rules.other.blockquoteBeginRegex(I);for(;n;){let B=n.split(`
474
474
  `,1)[0],ce;if(E=B,this.options.pedantic?(E=E.replace(this.rules.other.listReplaceNesting," "),ce=E):ce=E.replace(this.rules.other.tabCharGlobal," "),V.test(E)||N.test(E)||F.test(E)||Y.test(E)||P.test(E)||R.test(E))break;if(ce.search(this.rules.other.nonSpaceChar)>=I||!E.trim())y+=`
475
475
  `+ce.slice(I);else{if(x||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test(m)||N.test(m)||R.test(m))break;y+=`
476
476
  `+E}x=!E.trim(),f+=B+`
477
- `,n=n.substring(B.length+1),m=ce.slice(I)}}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(y),loose:!1,text:y,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 y=this.lexer.inlineQueue.length-1;y>=0;y--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[y].src)){this.lexer.inlineQueue[y].src=this.lexer.inlineQueue[y].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(h.raw);if(f){let y={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};h.checked=y.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=y.raw+h.tokens[0].raw,h.tokens[0].text=y.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(y)):h.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):h.tokens.unshift(y)}}if(!o.loose){let f=h.tokens.filter(m=>m.type==="space"),y=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=y}}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=Mm(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(`
478
- `):[],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(Mm(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)===`
479
- `?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=Fs(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=r6(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)),Nm(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 Nm(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 m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let y=f.slice(2,-2);return{type:"strong",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}}}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}}}},Lt=class Xh{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||ni,this.options.tokenizer=this.options.tokenizer||new Wl,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:et,block:Ka.normal,inline:Us.normal};this.options.pedantic?(e.block=Ka.pedantic,e.inline=Us.pedantic):this.options.gfm&&(e.block=Ka.gfm,this.options.breaks?e.inline=Us.breaks:e.inline=Us.gfm),this.tokenizer.rules=e}static get rules(){return{block:Ka,inline:Us}}static lex(t,e){return new Xh(e).lex(t)}static lexInline(t,e){return new Xh(e).inlineTokens(t)}lex(t){t=t.replace(et.carriageReturn,`
477
+ `,n=n.substring(B.length+1),m=ce.slice(I)}}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(y),loose:!1,text:y,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 y=this.lexer.inlineQueue.length-1;y>=0;y--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[y].src)){this.lexer.inlineQueue[y].src=this.lexer.inlineQueue[y].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(h.raw);if(f){let y={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};h.checked=y.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=y.raw+h.tokens[0].raw,h.tokens[0].text=y.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(y)):h.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):h.tokens.unshift(y)}}if(!o.loose){let f=h.tokens.filter(m=>m.type==="space"),y=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=y}}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=Um(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(`
478
+ `):[],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(Um(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)===`
479
+ `?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=Fs(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=s6(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)),Fm(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 Fm(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 m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let y=f.slice(2,-2);return{type:"strong",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}}}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}}}},Lt=class Qh{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||ni,this.options.tokenizer=this.options.tokenizer||new Wl,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:et,block:Ka.normal,inline:Us.normal};this.options.pedantic?(e.block=Ka.pedantic,e.inline=Us.pedantic):this.options.gfm&&(e.block=Ka.gfm,this.options.breaks?e.inline=Us.breaks:e.inline=Us.gfm),this.tokenizer.rules=e}static get rules(){return{block:Ka,inline:Us}}static lex(t,e){return new Qh(e).lex(t)}static lexInline(t,e){return new Qh(e).inlineTokens(t)}lex(t){t=t.replace(et.carriageReturn,`
480
480
  `),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(et.tabCharGlobal," ").replace(et.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+=`
481
481
  `: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(`
482
482
  `)?"":`
@@ -508,8 +508,8 @@ ${this.parser.parse(n)}</blockquote>
508
508
  `}tablerow({text:n}){return`<tr>
509
509
  ${n}</tr>
510
510
  `}tablecell(n){let t=this.parser.parseInline(n.tokens),e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
511
- `}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>${Vt(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=Om(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+Vt(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=Om(n);if(i===null)return Vt(e);n=i;let s=`<img src="${n}" alt="${Vt(e)}"`;return t&&(s+=` title="${Vt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Vt(n.text)}},lp=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 Qh{constructor(t){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=t||ni,this.options.renderer=this.options.renderer||new Vl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new lp}static parse(t,e){return new Qh(e).parse(t)}static parseInline(t,e){return new Qh(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}},Ja,Js=(Ja=class{constructor(n){g(this,"options");g(this,"block");this.options=n||ni}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Lt.lex:Lt.lexInline}provideParser(){return this.block?zt.parse:zt.parseInline}},g(Ja,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),g(Ja,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ja),o6=class{constructor(...n){g(this,"defaults",ep());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",zt);g(this,"Renderer",Vl);g(this,"TextRenderer",lp);g(this,"Lexer",Lt);g(this,"Tokenizer",Wl);g(this,"Hooks",Js);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 Vl(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 Wl(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 Js;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];Js.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Js.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 Lt.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?Lt.lex:Lt.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?Lt.lex:Lt.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+=`
512
- Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Vt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Jr=new o6;function ne(n,t){return Jr.parse(n,t)}ne.options=ne.setOptions=function(n){return Jr.setOptions(n),ne.defaults=Jr.defaults,S0(ne.defaults),ne};ne.getDefaults=ep;ne.defaults=ni;ne.use=function(...n){return Jr.use(...n),ne.defaults=Jr.defaults,S0(ne.defaults),ne};ne.walkTokens=function(n,t){return Jr.walkTokens(n,t)};ne.parseInline=Jr.parseInline;ne.Parser=zt;ne.parser=zt.parse;ne.Renderer=Vl;ne.TextRenderer=lp;ne.Lexer=Lt;ne.lexer=Lt.lex;ne.Tokenizer=Wl;ne.Hooks=Js;ne.parse=ne;ne.options;ne.setOptions;ne.use;ne.walkTokens;ne.parseInline;zt.parse;Lt.lex;w0.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function a6(n){const t=ne.parse(n,{async:!1});return w0.sanitize(t,{USE_PROFILES:{html:!0}})}var ia,$n,rn,sn,Jn,R0,kl;class ed extends ds{constructor(){super(...arguments);S(this,Jn);g(this,"phase","thinking");g(this,"toolCalls",[]);g(this,"expanded",!1);g(this,"expandedTexts",new Set);S(this,ia,`agent-activity-panel-${++u6}`);g(this,"overflowingTexts",new Set);S(this,$n,null);S(this,rn,null);S(this,sn,null);g(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ve(this.template(),this),p(this,Jn,R0).call(this),l(this,rn)!==null&&cancelAnimationFrame(l(this,rn)),w(this,rn,requestAnimationFrame(()=>{w(this,rn,null),p(this,Jn,kl).call(this)})),e.has("expanded")&&(l(this,sn)!==null&&clearTimeout(l(this,sn)),w(this,sn,window.setTimeout(()=>{w(this,sn,null),p(this,Jn,kl).call(this)},c6)))}disconnected(){var e;(e=l(this,$n))==null||e.disconnect(),w(this,$n,null),l(this,rn)!==null&&(cancelAnimationFrame(l(this,rn)),w(this,rn,null)),l(this,sn)!==null&&(clearTimeout(l(this,sn)),w(this,sn,null))}template(){const e=this.toolCalls.length>0;return L`
511
+ `}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>${Vt(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=Nm(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+Vt(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=Nm(n);if(i===null)return Vt(e);n=i;let s=`<img src="${n}" alt="${Vt(e)}"`;return t&&(s+=` title="${Vt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Vt(n.text)}},cp=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 ed{constructor(t){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=t||ni,this.options.renderer=this.options.renderer||new Vl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new cp}static parse(t,e){return new ed(e).parse(t)}static parseInline(t,e){return new ed(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}},Ja,Js=(Ja=class{constructor(n){g(this,"options");g(this,"block");this.options=n||ni}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Lt.lex:Lt.lexInline}provideParser(){return this.block?zt.parse:zt.parseInline}},g(Ja,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),g(Ja,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ja),l6=class{constructor(...n){g(this,"defaults",tp());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",zt);g(this,"Renderer",Vl);g(this,"TextRenderer",cp);g(this,"Lexer",Lt);g(this,"Tokenizer",Wl);g(this,"Hooks",Js);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 Vl(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 Wl(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 Js;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];Js.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Js.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 Lt.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?Lt.lex:Lt.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?Lt.lex:Lt.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+=`
512
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Vt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Jr=new l6;function ne(n,t){return Jr.parse(n,t)}ne.options=ne.setOptions=function(n){return Jr.setOptions(n),ne.defaults=Jr.defaults,k0(ne.defaults),ne};ne.getDefaults=tp;ne.defaults=ni;ne.use=function(...n){return Jr.use(...n),ne.defaults=Jr.defaults,k0(ne.defaults),ne};ne.walkTokens=function(n,t){return Jr.walkTokens(n,t)};ne.parseInline=Jr.parseInline;ne.Parser=zt;ne.parser=zt.parse;ne.Renderer=Vl;ne.TextRenderer=cp;ne.Lexer=Lt;ne.lexer=Lt.lex;ne.Tokenizer=Wl;ne.Hooks=Js;ne.parse=ne;ne.options;ne.setOptions;ne.use;ne.walkTokens;ne.parseInline;zt.parse;Lt.lex;_0.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function c6(n){const t=ne.parse(n,{async:!1});return _0.sanitize(t,{USE_PROFILES:{html:!0}})}var ia,$n,rn,sn,Jn,D0,kl;class td extends ds{constructor(){super(...arguments);S(this,Jn);g(this,"phase","thinking");g(this,"toolCalls",[]);g(this,"expanded",!1);g(this,"expandedTexts",new Set);S(this,ia,`agent-activity-panel-${++d6}`);g(this,"overflowingTexts",new Set);S(this,$n,null);S(this,rn,null);S(this,sn,null);g(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ve(this.template(),this),p(this,Jn,D0).call(this),l(this,rn)!==null&&cancelAnimationFrame(l(this,rn)),w(this,rn,requestAnimationFrame(()=>{w(this,rn,null),p(this,Jn,kl).call(this)})),e.has("expanded")&&(l(this,sn)!==null&&clearTimeout(l(this,sn)),w(this,sn,window.setTimeout(()=>{w(this,sn,null),p(this,Jn,kl).call(this)},h6)))}disconnected(){var e;(e=l(this,$n))==null||e.disconnect(),w(this,$n,null),l(this,rn)!==null&&(cancelAnimationFrame(l(this,rn)),w(this,rn,null)),l(this,sn)!==null&&(clearTimeout(l(this,sn)),w(this,sn,null))}template(){const e=this.toolCalls.length>0;return L`
513
513
  ${this.barTemplate()}
514
514
  ${e?this.panelTemplate():null}
515
515
  `}barTemplate(){return this.phase==="thinking"?L`<div class="bar bar-static" unselectable>${this.indicator()}${this.label({expanded:this.expanded})}</div>`:L`
@@ -544,7 +544,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
544
544
  class="tool-dot"
545
545
  data-status=${e.status}
546
546
  role="img"
547
- aria-label=${h6(e.status)}
547
+ aria-label=${p6(e.status)}
548
548
  ></span>
549
549
  <span class="tool-title">${e.title}</span>
550
550
  ${e.text?L`
@@ -561,13 +561,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
561
561
  @click=${()=>this.toggleTextExpand(e.toolCallId)}
562
562
  >
563
563
  <span>${s}</span>
564
- ${r?wO({size:16}):Fl({size:16})}
564
+ ${r?_O({size:16}):Fl({size:16})}
565
565
  </button>`:null}
566
566
  </div>
567
567
  `:null}
568
568
  </li>
569
569
  `}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 L`<span class="indicator">${Fl({size:16})}</span>`;const e=this.phase==="thinking"||this.phase==="using";return L`<span class=${e?"indicator indicator-active":"indicator"}
570
- >${e?mw({size:16}):EO({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 l6(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}ia=new WeakMap,$n=new WeakMap,rn=new WeakMap,sn=new WeakMap,Jn=new WeakSet,R0=function(){if(!(typeof ResizeObserver>"u")){l(this,$n)||w(this,$n,new ResizeObserver(()=>p(this,Jn,kl).call(this))),l(this,$n).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,$n).observe(e)}},kl=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)}}d6(this.overflowingTexts,e)||(this.overflowingTexts=e)},g(ed,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),g(ed,"attributes",{expanded:{type:Boolean}});function l6(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 c6=160;let u6=0;function h6(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function d6(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",ed);function p6(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 Um=8,Fm=new WeakMap;function f6(n){const t=Fm.get(n);if(t&&t.text===n.text)return t.html;const e=a6(n.text);return Fm.set(n,{text:n.text,html:e}),e}function Hm(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 mt,vt,Wr,Vr,Yn,_t,D0,td,L0,rc,ic,nd;class P0 extends ds{constructor(){super(...arguments);S(this,_t);g(this,"messages",[]);S(this,mt,!0);S(this,vt,null);S(this,Wr,null);S(this,Vr,null);S(this,Yn,!1);S(this,rc,()=>{if(l(this,Yn))return;const e=l(this,vt);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Um;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))});S(this,ic,()=>{w(this,mt,!0),this.toggleAttribute("data-pinned",!0),p(this,_t,nd).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=Hm(this.messages);r=s!==null&&s!==Hm(i),r&&w(this,mt,!0)}Ve(this.template(),this),l(this,vt)||(w(this,vt,this.querySelector(".history-scroll")),l(this,vt)&&p(this,_t,D0).call(this)),this.toggleAttribute("data-pinned",l(this,mt)),p(this,_t,td).call(this),p(this,_t,nd).call(this,r)}disconnected(){var e,r;(e=l(this,Wr))==null||e.disconnect(),w(this,Wr,null),(r=l(this,Vr))==null||r.disconnect(),w(this,Vr,null)}template(){const e=p6(this.messages);return L`
570
+ >${e?yw({size:16}):$O({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 u6(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}ia=new WeakMap,$n=new WeakMap,rn=new WeakMap,sn=new WeakMap,Jn=new WeakSet,D0=function(){if(!(typeof ResizeObserver>"u")){l(this,$n)||w(this,$n,new ResizeObserver(()=>p(this,Jn,kl).call(this))),l(this,$n).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,$n).observe(e)}},kl=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)}}f6(this.overflowingTexts,e)||(this.overflowingTexts=e)},g(td,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),g(td,"attributes",{expanded:{type:Boolean}});function u6(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 h6=160;let d6=0;function p6(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function f6(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",td);function g6(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 Hm=8,Zm=new WeakMap;function m6(n){const t=Zm.get(n);if(t&&t.text===n.text)return t.html;const e=c6(n.text);return Zm.set(n,{text:n.text,html:e}),e}function Wm(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 mt,vt,Wr,Vr,Yn,_t,z0,nd,O0,rc,ic,rd;class L0 extends ds{constructor(){super(...arguments);S(this,_t);g(this,"messages",[]);S(this,mt,!0);S(this,vt,null);S(this,Wr,null);S(this,Vr,null);S(this,Yn,!1);S(this,rc,()=>{if(l(this,Yn))return;const e=l(this,vt);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Hm;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))});S(this,ic,()=>{w(this,mt,!0),this.toggleAttribute("data-pinned",!0),p(this,_t,rd).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=Wm(this.messages);r=s!==null&&s!==Wm(i),r&&w(this,mt,!0)}Ve(this.template(),this),l(this,vt)||(w(this,vt,this.querySelector(".history-scroll")),l(this,vt)&&p(this,_t,z0).call(this)),this.toggleAttribute("data-pinned",l(this,mt)),p(this,_t,nd).call(this),p(this,_t,rd).call(this,r)}disconnected(){var e,r;(e=l(this,Wr))==null||e.disconnect(),w(this,Wr,null),(r=l(this,Vr))==null||r.disconnect(),w(this,Vr,null)}template(){const e=g6(this.messages);return L`
571
571
  <div class="history-scroll" @scroll=${l(this,rc)}>
572
572
  ${e.map(r=>{if(r.kind==="tool-run")return L`<agent-activity
573
573
  .phase=${r.live?"using":"final"}
@@ -575,7 +575,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
575
575
  ></agent-activity>`;if(r.kind==="thinking")return L`<agent-activity
576
576
  .phase=${"thinking"}
577
577
  .toolCalls=${[]}
578
- ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?sO(f6(i)):i.text;return L`<div
578
+ ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?aO(m6(i)):i.text;return L`<div
579
579
  class="message message-${i.kind}"
580
580
  data-message-id=${i.id}
581
581
  >${s}</div>`})}
@@ -588,7 +588,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
588
588
  >
589
589
  ${Fl({size:16})}
590
590
  </button>
591
- `}}mt=new WeakMap,vt=new WeakMap,Wr=new WeakMap,Vr=new WeakMap,Yn=new WeakMap,_t=new WeakSet,D0=function(){l(this,vt)&&(typeof ResizeObserver>"u"||(w(this,Wr,new ResizeObserver(()=>p(this,_t,L0).call(this))),w(this,Vr,new MutationObserver(()=>p(this,_t,td).call(this))),l(this,Vr).observe(l(this,vt),{childList:!0})))},td=function(){const e=l(this,vt),r=l(this,Wr);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},L0=function(){const e=l(this,vt);if(!e)return;if(l(this,mt)){w(this,Yn,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{w(this,Yn,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Um;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))},rc=new WeakMap,ic=new WeakMap,nd=function(e){requestAnimationFrame(()=>{const r=l(this,vt);r&&(!l(this,mt)&&!e||(w(this,Yn,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{w(this,Yn,!1)})))})},g(P0,"properties",["messages"]);customElements.define("message-history",P0);var Pt,sa,rs,on,is,ss,oa,os,sc,oc,ac,yt,xl,aa,id,sd,la,ca;class rd extends ds{constructor(){super(...arguments);S(this,yt);g(this,"placeholder","What do you want to do?");g(this,"open",!1);g(this,"messages",[]);g(this,"status","disconnected");S(this,Pt,un.resolve("ServerManager"));S(this,sa,un.resolve("ShortcutService"));S(this,rs,null);S(this,on,null);S(this,is,()=>{var e;this.status=((e=l(this,on))==null?void 0:e.status)??"disconnected"});S(this,ss,()=>{var e;this.messages=((e=l(this,on))==null?void 0:e.messages)??[]});S(this,oa,()=>{var e,r;(e=l(this,on))==null||e.removeEventListener("status-changed",l(this,is)),(r=l(this,on))==null||r.removeEventListener("messages-changed",l(this,ss)),w(this,on,null)});S(this,os,()=>{var r;const e=((r=l(this,Pt).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,on)&&(l(this,oa).call(this),w(this,on,e),e==null||e.addEventListener("status-changed",l(this,is)),e==null||e.addEventListener("messages-changed",l(this,ss)),l(this,is).call(this),l(this,ss).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,Pt).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="",p(this,yt,xl).call(this,r);const s=(o=l(this,Pt).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)})}});S(this,sc,e=>{p(this,yt,xl).call(this,e.currentTarget)});S(this,oc,e=>{var i;e.stopPropagation();const r=(i=l(this,Pt).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});S(this,ac,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});S(this,aa,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Pt).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()}});S(this,la,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});S(this,ca,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;w(this,rs,e),l(this,Pt).addEventListener("change",l(this,os)),e.defer(()=>{l(this,Pt).removeEventListener("change",l(this,os)),l(this,oa).call(this)}),l(this,os).call(this),l(this,sa).addEventListener("shortcut-triggered",l(this,aa)),e.defer(()=>l(this,sa).removeEventListener("shortcut-triggered",l(this,aa))),this.open&&p(this,yt,id).call(this)}disconnected(){var e;(e=l(this,rs))==null||e.dispose(),w(this,rs,null),p(this,yt,sd).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")),Ve(this.template(),this),e.has("open"))if(this.open){p(this,yt,id).call(this);const r=this.querySelector("textarea");r&&(p(this,yt,xl).call(this,r),r.focus())}else p(this,yt,sd).call(this)}template(){var i;const e=(i=l(this,Pt).activeServer)==null?void 0:i.acpClient;if(e&&!e.enabled||this.status==="disposed")return null;if(this.status==="disconnected")return L`
591
+ `}}mt=new WeakMap,vt=new WeakMap,Wr=new WeakMap,Vr=new WeakMap,Yn=new WeakMap,_t=new WeakSet,z0=function(){l(this,vt)&&(typeof ResizeObserver>"u"||(w(this,Wr,new ResizeObserver(()=>p(this,_t,O0).call(this))),w(this,Vr,new MutationObserver(()=>p(this,_t,nd).call(this))),l(this,Vr).observe(l(this,vt),{childList:!0})))},nd=function(){const e=l(this,vt),r=l(this,Wr);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},O0=function(){const e=l(this,vt);if(!e)return;if(l(this,mt)){w(this,Yn,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{w(this,Yn,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Hm;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))},rc=new WeakMap,ic=new WeakMap,rd=function(e){requestAnimationFrame(()=>{const r=l(this,vt);r&&(!l(this,mt)&&!e||(w(this,Yn,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{w(this,Yn,!1)})))})},g(L0,"properties",["messages"]);customElements.define("message-history",L0);var Pt,sa,rs,on,is,ss,oa,os,sc,oc,ac,yt,xl,aa,sd,od,la,ca;class id extends ds{constructor(){super(...arguments);S(this,yt);g(this,"placeholder","What do you want to do?");g(this,"open",!1);g(this,"messages",[]);g(this,"status","disconnected");S(this,Pt,un.resolve("ServerManager"));S(this,sa,un.resolve("ShortcutService"));S(this,rs,null);S(this,on,null);S(this,is,()=>{var e;this.status=((e=l(this,on))==null?void 0:e.status)??"disconnected"});S(this,ss,()=>{var e;this.messages=((e=l(this,on))==null?void 0:e.messages)??[]});S(this,oa,()=>{var e,r;(e=l(this,on))==null||e.removeEventListener("status-changed",l(this,is)),(r=l(this,on))==null||r.removeEventListener("messages-changed",l(this,ss)),w(this,on,null)});S(this,os,()=>{var r;const e=((r=l(this,Pt).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,on)&&(l(this,oa).call(this),w(this,on,e),e==null||e.addEventListener("status-changed",l(this,is)),e==null||e.addEventListener("messages-changed",l(this,ss)),l(this,is).call(this),l(this,ss).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,Pt).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="",p(this,yt,xl).call(this,r);const s=(o=l(this,Pt).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)})}});S(this,sc,e=>{p(this,yt,xl).call(this,e.currentTarget)});S(this,oc,e=>{var i;e.stopPropagation();const r=(i=l(this,Pt).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});S(this,ac,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});S(this,aa,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Pt).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()}});S(this,la,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});S(this,ca,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;w(this,rs,e),l(this,Pt).addEventListener("change",l(this,os)),e.defer(()=>{l(this,Pt).removeEventListener("change",l(this,os)),l(this,oa).call(this)}),l(this,os).call(this),l(this,sa).addEventListener("shortcut-triggered",l(this,aa)),e.defer(()=>l(this,sa).removeEventListener("shortcut-triggered",l(this,aa))),this.open&&p(this,yt,sd).call(this)}disconnected(){var e;(e=l(this,rs))==null||e.dispose(),w(this,rs,null),p(this,yt,od).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")),Ve(this.template(),this),e.has("open"))if(this.open){p(this,yt,sd).call(this);const r=this.querySelector("textarea");r&&(p(this,yt,xl).call(this,r),r.focus())}else p(this,yt,od).call(this)}template(){var i;const e=(i=l(this,Pt).activeServer)==null?void 0:i.acpClient;if(e&&!e.enabled||this.status==="disposed")return null;if(this.status==="disconnected")return L`
592
592
  <div class="connecting" aria-disabled="true">
593
593
  <ui-spinner size="16" weight="bold"></ui-spinner>
594
594
  <span class="label">Connecting<span class="dots" aria-hidden="true"></span></span>
@@ -625,7 +625,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
625
625
  ?disabled=${o}
626
626
  @click=${l(this,oc)}
627
627
  >
628
- ${o?L`<ui-spinner size="16" weight="bold"></ui-spinner>`:bO({size:16})}
628
+ ${o?L`<ui-spinner size="16" weight="bold"></ui-spinner>`:SO({size:16})}
629
629
  </button>
630
630
  `:null}
631
631
  </div>
@@ -641,13 +641,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
641
641
  <span class="label">${this.placeholder}</span>
642
642
  <span class="kbd" aria-hidden="true">⌘K</span>
643
643
  </div>
644
- `}}Pt=new WeakMap,sa=new WeakMap,rs=new WeakMap,on=new WeakMap,is=new WeakMap,ss=new WeakMap,oa=new WeakMap,os=new WeakMap,sc=new WeakMap,oc=new WeakMap,ac=new WeakMap,yt=new WeakSet,xl=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},aa=new WeakMap,id=function(){document.addEventListener("mousedown",l(this,la)),document.addEventListener("keydown",l(this,ca))},sd=function(){document.removeEventListener("mousedown",l(this,la)),document.removeEventListener("keydown",l(this,ca))},la=new WeakMap,ca=new WeakMap,g(rd,"properties",["placeholder","open","messages","status"]),g(rd,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",rd);const g6='<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 z0 extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});g(this,"token");this.token=e}}class m6 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 z0(r))}render(){Ve(L`
644
+ `}}Pt=new WeakMap,sa=new WeakMap,rs=new WeakMap,on=new WeakMap,is=new WeakMap,ss=new WeakMap,oa=new WeakMap,os=new WeakMap,sc=new WeakMap,oc=new WeakMap,ac=new WeakMap,yt=new WeakSet,xl=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},aa=new WeakMap,sd=function(){document.addEventListener("mousedown",l(this,la)),document.addEventListener("keydown",l(this,ca))},od=function(){document.removeEventListener("mousedown",l(this,la)),document.removeEventListener("keydown",l(this,ca))},la=new WeakMap,ca=new WeakMap,g(id,"properties",["placeholder","open","messages","status"]),g(id,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",id);const v6='<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 M0 extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});g(this,"token");this.token=e}}class y6 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 M0(r))}render(){Ve(L`
645
645
  <modal-overlay open>
646
646
  <system-modal material="glass-frosted" level="1" class="auth-modal">
647
647
  <form class="auth-form" @submit=${r=>this.handleSubmit(r)}>
648
648
  <header>
649
649
  <span class="auth-modal-icon" aria-hidden="true">
650
- <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${fw(g6)}</svg>
650
+ <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${mw(v6)}</svg>
651
651
  </span>
652
652
  <hgroup>
653
653
  <h2>Enter access token</h2>
@@ -676,7 +676,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
676
676
  </form>
677
677
  </system-modal>
678
678
  </modal-overlay>
679
- `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",m6);const v6=250,y6=1e3;class O0 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()},v6))}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…";Ve(L`
679
+ `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",y6);const b6=250,w6=1e3;class N0 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()},b6))}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…";Ve(L`
680
680
  <modal-overlay open role="status" aria-live="polite">
681
681
  <system-modal material="glass-frosted" level="1" class="connecting-overlay-panel">
682
682
  <header>
@@ -688,7 +688,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
688
688
  </header>
689
689
  </system-modal>
690
690
  </modal-overlay>
691
- `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/y6)}s…`}}g(O0,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",O0);class b6 extends HTMLElement{constructor(){super(...arguments);g(this,"runtimeServerURL",lb());g(this,"electronMode",ln());g(this,"serverManager",un.resolve("ServerManager"));g(this,"screenManager",un.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 z0?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=FP();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 iw({url:this.runtimeServerURL,name:"Server",token:r});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 to)?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 to||(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 h=e;if(!h)return;Ve(L`
691
+ `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/w6)}s…`}}g(N0,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",N0);class S6 extends HTMLElement{constructor(){super(...arguments);g(this,"runtimeServerURL",ub());g(this,"electronMode",ln());g(this,"serverManager",un.resolve("ServerManager"));g(this,"screenManager",un.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 M0?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=ZP();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 ow({url:this.runtimeServerURL,name:"Server",token:r});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 to)?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 to||(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 h=e;if(!h)return;Ve(L`
692
692
  <main class="auth-gate">
693
693
  <auth-modal
694
694
  .invalid=${!!h.token}
@@ -715,4 +715,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
715
715
  .hasEverConnected=${(e==null?void 0:e.hasEverConnected)??!1}
716
716
  ></connecting-overlay>`:null}
717
717
  </main>
718
- `,this),this.updateLayoutChromeBalance()}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",b6);const cp=ln(),up=lb(),M0=new C$(cp?"television-electron":"television-browser",E$(up)),cn=new zz({localStore:M0,localServerURL:up}),N0=new U$({localStore:M0,serverManager:cn}),w6=new Oz,S6=()=>{const n=[...cn.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)));Gz(e)}).catch(()=>{})},U0=()=>{const n=cn.activeServer;if(!n||n.status!=="connected"){Cl();return}S6(),n.client.display.get().then(t=>{if(!(cn.activeServer!==n||n.status!=="connected"))return lw(t.activeThemeName,n)}).catch(()=>{cn.activeServer===n&&Cl()})};U0();cn.addEventListener("change",U0);cn.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=cn.activeServer;!t||t.url!==n.serverURL||lw(n.event.themeName,t)});un.register("ServerManager",()=>cn);un.register("ScreenManager",()=>N0);un.register("ShortcutService",()=>w6);globalThis.__telepath={screenManager:N0,serverManager:cn};const hp=document.createElement("television-app");hp.runtimeServerURL=up;hp.electronMode=cp;cp&&document.body.classList.add("electron");document.body.appendChild(hp);
718
+ `,this),this.updateLayoutChromeBalance()}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",S6);const up=ln(),hp=ub(),U0=new P$(up?"television-electron":"television-browser",$$(hp)),cn=new Mz({localStore:U0,localServerURL:hp}),F0=new H$({localStore:U0,serverManager:cn}),_6=new Nz,k6=()=>{const n=[...cn.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)));Yz(e)}).catch(()=>{})},H0=()=>{const n=cn.activeServer;if(!n||n.status!=="connected"){Cl();return}k6(),n.client.display.get().then(t=>{if(!(cn.activeServer!==n||n.status!=="connected"))return uw(t.activeThemeName,n)}).catch(()=>{cn.activeServer===n&&Cl()})};H0();cn.addEventListener("change",H0);cn.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=cn.activeServer;!t||t.url!==n.serverURL||uw(n.event.themeName,t)});un.register("ServerManager",()=>cn);un.register("ScreenManager",()=>F0);un.register("ShortcutService",()=>_6);globalThis.__telepath={screenManager:F0,serverManager:cn};const dp=document.createElement("television-app");dp.runtimeServerURL=hp;dp.electronMode=up;up&&document.body.classList.add("electron");document.body.appendChild(dp);