@telepath-computer/television 0.1.148 → 0.1.149

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 W0=Object.defineProperty;var Cp=n=>{throw TypeError(n)};var V0=(n,t,e)=>t in n?W0(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>V0(n,typeof t!="symbol"?t+"":t,e),Mc=(n,t,e)=>t.has(n)||Cp("Cannot "+e);var l=(n,t,e)=>(Mc(n,t,"read from private field"),e?e.call(n):t.get(n)),S=(n,t,e)=>t.has(n)?Cp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),w=(n,t,e,r)=>(Mc(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),p=(n,t,e)=>(Mc(n,t,"access private method"),e);var Rp=(n,t,e,r)=>({set _(i){w(n,t,i,e)},get _(){return l(n,t,r)}});import{i as Pp,a as Dp,b as B0,U as j0,c as Lp,d as G0,A as q0,e as Y0,f as K0}from"./artifact-bridge-Ce9BPLXH.js";import{m as J0,a as X0,b as Q0}from"./missing-artifact-page-DVzJ41AE.js";var gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eS(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,Mm=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},Nc,Op;function tS(){if(Op)return Nc;Op=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Mm,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 j=f(m),ce=0;ce<a.length;++ce)!(j&&a[ce]==="constructor")&&t.call(m,a[ce])&&R.push(a[ce]);return R}}return Nc=n,Nc}var nS=Array.prototype.slice,rS=Mm,Mp=Object.keys,Ga=Mp?function(t){return Mp(t)}:tS(),Np=Object.keys;Ga.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 rS(r)?Np(nS.call(r)):Np(r)})}else Object.keys=Ga;return Object.keys||Ga};var iS=Ga,qa=Object.defineProperty||!1;if(qa)try{qa({},"a",{value:1})}catch{qa=!1}var oa=qa,$n=SyntaxError,K=TypeError,sS=Object.getOwnPropertyDescriptor,Ya=sS;if(Ya)try{Ya([],"length")}catch{Ya=null}var ds=Ya,Up=oa,oS=$n,ai=K,Fp=ds,Nm=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new ai("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ai("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ai("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ai("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ai("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ai("`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=!!Fp&&Fp(t,e);if(Up)Up(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 oS("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Lu=oa,Um=function(){return!!Lu};Um.hasArrayLengthDefineBug=function(){if(!Lu)return null;try{return Lu([],"length",{value:1}).length!==1}catch{return!0}};var ic=Um,aS=iS,lS=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",cS=Object.prototype.toString,uS=Array.prototype.concat,Hp=Nm,hS=function(n){return typeof n=="function"&&cS.call(n)==="[object Function]"},Fm=ic(),dS=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!hS(r)||!r())return}Fm?Hp(n,t,e,!0):Hp(n,t,e)},Hm=function(n,t){var e=arguments.length>2?arguments[2]:{},r=aS(t);lS&&(r=uS.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)dS(n,r[i],t[r[i]],e[r[i]])};Hm.supportsDescriptors=!!Fm;var Jr=Hm,Ka={exports:{}};typeof self<"u"?Ka.exports=self:typeof window<"u"?Ka.exports=window:Ka.exports=Function("return this")();var Zm=Ka.exports,pS=Zm,Wm=function(){return typeof gr!="object"||!gr||gr.Math!==Math||gr.Array!==Array?pS:gr},fS=Jr,gS=ds,mS=Wm,vS=function(){var t=mS();if(fS.supportsDescriptors){var e=gS(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},yS=Jr,bS=Zm,Vm=Wm,wS=vS,SS=Vm(),Bm=function(){return SS};yS(Bm,{getPolyfill:Vm,implementation:bS,shim:wS});var ed=Bm,Tn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},td=Object,jm=Error,_S=EvalError,kS=RangeError,nd=ReferenceError,xS=URIError,ES=Math.abs,AS=Math.floor,$S=Math.max,TS=Math.min,IS=Math.pow,CS=Math.round,rd=Number.isNaN||function(t){return t!==t},RS=rd,PS=function(t){return RS(t)||t===0?t:t<0?-1:1},ps=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},Zp=typeof Symbol<"u"&&Symbol,DS=ps,id=function(){return typeof Zp!="function"||typeof Symbol!="function"||typeof Zp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:DS()},Gm=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,LS=td,qm=LS.getPrototypeOf||null,zS="Function.prototype.bind called on incompatible ",OS=Object.prototype.toString,MS=Math.max,NS="[object Function]",Wp=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},US=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},FS=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},HS=function(t){var e=this;if(typeof e!="function"||OS.apply(e)!==NS)throw new TypeError(zS+e);for(var r=US(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,Wp(r,arguments));return Object(h)===h?h:this}return e.apply(t,Wp(r,arguments))},o=MS(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+FS(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},ZS=HS,aa=Function.prototype.bind||ZS,sd=Function.prototype.call,od=Function.prototype.apply,WS=typeof Reflect<"u"&&Reflect&&Reflect.apply,VS=aa,BS=od,jS=sd,GS=WS,Ym=GS||VS.call(jS,BS),qS=aa,YS=K,KS=sd,JS=Ym,sc=function(t){if(t.length<1||typeof t[0]!="function")throw new YS("a function is required");return JS(qS,KS,t)},XS=sc,Vp=ds,Km;try{Km=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Uc=!!Km&&Vp&&Vp(Object.prototype,"__proto__"),Jm=Object,Bp=Jm.getPrototypeOf,QS=Uc&&typeof Uc.get=="function"?XS([Uc.get]):typeof Bp=="function"?function(t){return Bp(t==null?t:Jm(t))}:!1,jp=Gm,Gp=qm,qp=QS,Xm=jp?function(t){return jp(t)}:Gp?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Gp(t)}:qp?function(t){return qp(t)}:null,e_=Function.prototype.call,t_=Object.prototype.hasOwnProperty,n_=aa,In=n_.call(e_,t_),q,r_=td,i_=jm,s_=_S,o_=kS,a_=nd,os=$n,Ii=K,l_=xS,c_=ES,u_=AS,h_=$S,d_=TS,p_=IS,f_=CS,g_=PS,Qm=Function,Fc=function(n){try{return Qm('"use strict"; return ('+n+").constructor;")()}catch{}},no=ds,m_=oa,Hc=function(){throw new Ii},v_=no?function(){try{return arguments.callee,Hc}catch{try{return no(arguments,"callee").get}catch{return Hc}}}():Hc,li=id(),De=Xm,y_=qm,b_=Gm,ev=od,la=sd,fi={},w_=typeof Uint8Array>"u"||!De?q:De(Uint8Array),Zr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":li&&De?De([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":fi,"%AsyncGenerator%":fi,"%AsyncGeneratorFunction%":fi,"%AsyncIteratorPrototype%":fi,"%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%":i_,"%eval%":eval,"%EvalError%":s_,"%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%":Qm,"%GeneratorFunction%":fi,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":li&&De?De(De([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!li||!De?q:De(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r_,"%Object.getOwnPropertyDescriptor%":no,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":o_,"%ReferenceError%":a_,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!li||!De?q:De(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":li&&De?De(""[Symbol.iterator]()):q,"%Symbol%":li?Symbol:q,"%SyntaxError%":os,"%ThrowTypeError%":v_,"%TypedArray%":w_,"%TypeError%":Ii,"%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%":l_,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet,"%Function.prototype.call%":la,"%Function.prototype.apply%":ev,"%Object.defineProperty%":m_,"%Object.getPrototypeOf%":y_,"%Math.abs%":c_,"%Math.floor%":u_,"%Math.max%":h_,"%Math.min%":d_,"%Math.pow%":p_,"%Math.round%":f_,"%Math.sign%":g_,"%Reflect.getPrototypeOf%":b_};if(De)try{null.error}catch(n){var S_=De(De(n));Zr["%Error.prototype%"]=S_}var __=function n(t){var e;if(t==="%AsyncFunction%")e=Fc("async function () {}");else if(t==="%GeneratorFunction%")e=Fc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Fc("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 Zr[t]=e,e},Yp={__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"]},ca=aa,Sl=In,k_=ca.call(la,Array.prototype.concat),x_=ca.call(ev,Array.prototype.splice),Kp=ca.call(la,String.prototype.replace),_l=ca.call(la,String.prototype.slice),E_=ca.call(la,RegExp.prototype.exec),A_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$_=/\\(\\)?/g,T_=function(t){var e=_l(t,0,1),r=_l(t,-1);if(e==="%"&&r!=="%")throw new os("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new os("invalid intrinsic syntax, expected opening `%`");var i=[];return Kp(t,A_,function(s,o,a,c){i[i.length]=a?Kp(c,$_,"$1"):o||s}),i},I_=function(t,e){var r=t,i;if(Sl(Yp,r)&&(i=Yp[r],r="%"+i[0]+"%"),Sl(Zr,r)){var s=Zr[r];if(s===fi&&(s=__(r)),typeof s>"u"&&!e)throw new Ii("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new os("intrinsic "+t+" does not exist!")},kt=function(t,e){if(typeof t!="string"||t.length===0)throw new Ii("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ii('"allowMissing" argument must be a boolean');if(E_(/^%?[^%]*%?$/,t)===null)throw new os("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=T_(t),i=r.length>0?r[0]:"",s=I_("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],x_(r,k_([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var y=r[h],m=_l(y,0,1),E=_l(y,-1);if((m==='"'||m==="'"||m==="`"||E==='"'||E==="'"||E==="`")&&m!==E)throw new os("property names with quotes must have matching quotes");if((y==="constructor"||!f)&&(c=!0),i+="."+y,o="%"+i+"%",Sl(Zr,o))a=Zr[o];else if(a!=null){if(!(y in a)){if(!e)throw new Ii("base intrinsic for "+t+" exists, but the property is not available.");return}if(no&&h+1>=r.length){var x=no(a,y);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[y]}else f=Sl(a,y),a=a[y];f&&!c&&(Zr[o]=a)}}return a},Zc,Jp;function tr(){if(Jp)return Zc;Jp=1;var n=kt,t=sc,e=t([n("%String.prototype.indexOf%")]);return Zc=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},Zc}var Wc,Xp;function ad(){if(Xp)return Wc;Xp=1;var n=kt,t=n("%Array%"),e=!t.isArray&&tr()("Object.prototype.toString");return Wc=t.isArray||function(i){return e(i)==="[object Array]"},Wc}var C_=ic,Qp=oa,tv=C_.hasArrayLengthDefineBug(),R_=tv&&ad(),P_=tr(),D_=P_("Object.prototype.propertyIsEnumerable"),ld=function(t,e,r,i,s,o){if(!Qp){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&D_(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return tv&&s==="length"&&"[[Value]]"in o&&R_(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(Qp(i,s,r(o)),!0)},L_=K,$s=In,z_={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},fs=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if($s(t,e)&&!z_[e])return!1;var r=$s(t,"[[Value]]")||$s(t,"[[Writable]]"),i=$s(t,"[[Get]]")||$s(t,"[[Set]]");if(r&&i)throw new L_("Property Descriptors may not be both accessor and data descriptors");return!0},nv=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},O_=K,M_=fs,N_=nv,rv=function(t){if(typeof t<"u"&&!M_(t))throw new O_("Assertion failed: `Desc` must be a Property Descriptor");return N_(t)},U_=K,ef=In,F_=fs,iv=function(t){if(typeof t>"u")return!1;if(!F_(t))throw new U_("Assertion failed: `Desc` must be a Property Descriptor");return!(!ef(t,"[[Value]]")&&!ef(t,"[[Writable]]"))},gs=function(t){return typeof t=="string"||typeof t=="symbol"},tf=rd,sv=function(t,e){return t===e?t===0?1/t===1/e:!0:tf(t)&&tf(e)},nf=K,H_=Tn,Z_=ld,W_=rv,V_=iv,B_=gs,j_=sv,cd=function(t,e,r){if(!H_(t))throw new nf("Assertion failed: Type(O) is not Object");if(!B_(e))throw new nf("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return Z_(V_,j_,W_,t,e,i)},ov=Function.prototype.toString,xi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,zu,Ja;if(typeof xi=="function"&&typeof Object.defineProperty=="function")try{zu=Object.defineProperty({},"length",{get:function(){throw Ja}}),Ja={},xi(function(){throw 42},null,zu)}catch(n){n!==Ja&&(xi=null)}else xi=null;var G_=/^\s*class\b/,Ou=function(t){try{var e=ov.call(t);return G_.test(e)}catch{return!1}},Vc=function(t){try{return Ou(t)?!1:(ov.call(t),!0)}catch{return!1}},Xa=Object.prototype.toString,q_="[object Object]",Y_="[object Function]",K_="[object GeneratorFunction]",J_="[object HTMLAllCollection]",X_="[object HTML document.all class]",Q_="[object HTMLCollection]",ek=typeof Symbol=="function"&&!!Symbol.toStringTag,tk=!(0 in[,]),Mu=function(){return!1};if(typeof document=="object"){var nk=document.all;Xa.call(nk)===Xa.call(document.all)&&(Mu=function(t){if((tk||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Xa.call(t);return(e===J_||e===X_||e===Q_||e===q_)&&t("")==null}catch{}return!1})}var av=xi?function(t){if(Mu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{xi(t,null,zu)}catch(e){if(e!==Ja)return!1}return!Ou(t)&&Vc(t)}:function(t){if(Mu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(ek)return Vc(t);if(Ou(t))return!1;var e=Xa.call(t);return e!==Y_&&e!==K_&&!/^\[object HTML/.test(e)?!1:Vc(t)},rk=av,ik=function(t){return!!t},Ft=In,Ia=K,sk=Tn,rf=rk,Bc=ik,ok=function(t){if(!sk(t))throw new Ia("ToPropertyDescriptor requires an object");var e={};if(Ft(t,"enumerable")&&(e["[[Enumerable]]"]=Bc(t.enumerable)),Ft(t,"configurable")&&(e["[[Configurable]]"]=Bc(t.configurable)),Ft(t,"value")&&(e["[[Value]]"]=t.value),Ft(t,"writable")&&(e["[[Writable]]"]=Bc(t.writable)),Ft(t,"get")){var r=t.get;if(typeof r<"u"&&!rf(r))throw new Ia("getter must be a function");e["[[Get]]"]=r}if(Ft(t,"set")){var i=t.set;if(typeof i<"u"&&!rf(i))throw new Ia("setter must be a function");e["[[Set]]"]=i}if((Ft(e,"[[Get]]")||Ft(e,"[[Set]]"))&&(Ft(e,"[[Value]]")||Ft(e,"[[Writable]]")))throw new Ia("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},jc=K,ak=Tn,sf=fs,lk=ld,ck=rv,uk=iv,hk=gs,dk=sv,pk=ok,fk=function(t,e,r){if(!ak(t))throw new jc("Assertion failed: Type(O) is not Object");if(!hk(e))throw new jc("Assertion failed: P is not a Property Key");var i=sf(r)?r:pk(r);if(!sf(i))throw new jc("Assertion failed: Desc is not a valid Property Descriptor");return lk(uk,dk,ck,t,e,i)},of=K,gk=Tn,mk=fk,vk=gs,yk=function(t,e,r){if(!gk(t))throw new of("Assertion failed: Type(O) is not Object");if(!vk(e))throw new of("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return mk(t,e,i)},bk=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,wk=td,Sk=wk.setPrototypeOf||null,_k=sc,af=ds,kk=K,lv={};try{lv.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var xk=!("toString"in lv),Gc=af&&af(Object.prototype,"__proto__"),Ek=xk&&(!!Gc&&typeof Gc.set=="function"&&_k([Gc.set])||function(t,e){if(t==null)throw new kk("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),lf=bk,Ak=Sk,cf=Ek,$k=K,Tk=lf?function(t,e){if(lf(t,e))return t;throw new $k("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:Ak||(cf?function(t,e){return cf(t,e),t}:null),uf=K,Ik=Tn,hf=Xm,Ck=function(t){if(!Ik(t))throw new uf("Assertion failed: O must be an Object");if(!hf)throw new uf("This environment does not support fetching prototypes.");return hf(t)},Rk=K,Pk=Tk,Dk=Tn,Lk=Ck,zk=function(t,e){if(e!==null&&!Dk(e))throw new Rk("Assertion failed: V must be Object or Null");try{Pk(t,e)}catch{return!1}return Lk(t)===e},qc=cd,df=yk,cv=zk,Ok=ic(),ud=jm;function ua(n,t,e){var r=new ud(e);return cv(r,Qa),delete r.constructor,df(r,"error",n),df(r,"suppressed",t),r}Ok&&Object.defineProperty(ua,"prototype",{writable:!1});var Qa=ua.prototype;if(!qc(Qa,"constructor",ua)||!qc(Qa,"message","")||!qc(Qa,"name","SuppressedError"))throw new ud("unable to install SuppressedError.prototype properties; please report this!");cv(ua.prototype,ud.prototype);var Mk=ua,Nk=Mk,uv=function(){return typeof SuppressedError=="function"?SuppressedError:Nk},Uk=Jr,pf=ed(),Fk=uv,Hk=function(){var t=Fk();return Uk(pf,{SuppressedError:t},{SuppressedError:function(){return pf.SuppressedError!==t}}),t};Hk();var Zk=K,Wk=fs,Vk=nv,Bk=function(t){if(typeof t<"u"&&!Wk(t))throw new Zk("Assertion failed: `Desc` must be a Property Descriptor");return Vk(t)},jk=K,ff=In,Gk=fs,qk=function(t){if(typeof t>"u")return!1;if(!Gk(t))throw new jk("Assertion failed: `Desc` must be a Property Descriptor");return!(!ff(t,"[[Value]]")&&!ff(t,"[[Writable]]"))},gf=rd,Yk=function(t,e){return t===e?t===0?1/t===1/e:!0:gf(t)&&gf(e)},ms=av,Kk=function(t){return!!t},Ht=In,Ca=K,Jk=Tn,mf=ms,Yc=Kk,Xk=function(t){if(!Jk(t))throw new Ca("ToPropertyDescriptor requires an object");var e={};if(Ht(t,"enumerable")&&(e["[[Enumerable]]"]=Yc(t.enumerable)),Ht(t,"configurable")&&(e["[[Configurable]]"]=Yc(t.configurable)),Ht(t,"value")&&(e["[[Value]]"]=t.value),Ht(t,"writable")&&(e["[[Writable]]"]=Yc(t.writable)),Ht(t,"get")){var r=t.get;if(typeof r<"u"&&!mf(r))throw new Ca("getter must be a function");e["[[Get]]"]=r}if(Ht(t,"set")){var i=t.set;if(typeof i<"u"&&!mf(i))throw new Ca("setter must be a function");e["[[Set]]"]=i}if((Ht(e,"[[Get]]")||Ht(e,"[[Set]]"))&&(Ht(e,"[[Value]]")||Ht(e,"[[Writable]]")))throw new Ca("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Kc=K,Qk=Tn,vf=fs,ex=ld,tx=Bk,nx=qk,rx=gs,ix=Yk,sx=Xk,ha=function(t,e,r){if(!Qk(t))throw new Kc("Assertion failed: Type(O) is not Object");if(!rx(e))throw new Kc("Assertion failed: P is not a Property Key");var i=vf(r)?r:sx(r);if(!vf(i))throw new Kc("Assertion failed: Desc is not a valid Property Descriptor");return ex(nx,ix,tx,t,e,i)},ox=ps(),ax=ox?Symbol.dispose||Symbol("Symbol.dispose"):null,lx=ps,cx=ax,hd=function(){return lx()&&Symbol.dispose||cx},ux=id,hx=ha,dx=hd,px=function(){var t=dx();return ux()&&hx(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},fx=ps(),gx=fx?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,mx=ps,vx=gx,dd=function(){return mx()&&Symbol.asyncDispose||vx},yx=id,bx=ha,wx=dd,Sx=function(){var t=wx();return yx()&&bx(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},_x=ad(),kx=kt,xx=tr(),Ex=K,Ax=_x,$x=kx("%Reflect.apply%",!0)||xx("Function.prototype.apply"),oc=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!Ax(r))throw new Ex("Assertion failed: optional `argumentsList`, if provided, must be a List");return $x(t,e,r)};const Tx={},Ix=Object.freeze(Object.defineProperty({__proto__:null,default:Tx},Symbol.toStringTag,{value:"Module"})),Cx=eS(Ix);var pd=typeof Map=="function"&&Map.prototype,Jc=Object.getOwnPropertyDescriptor&&pd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,kl=pd&&Jc&&typeof Jc.get=="function"?Jc.get:null,yf=pd&&Map.prototype.forEach,fd=typeof Set=="function"&&Set.prototype,Xc=Object.getOwnPropertyDescriptor&&fd?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,xl=fd&&Xc&&typeof Xc.get=="function"?Xc.get:null,bf=fd&&Set.prototype.forEach,Rx=typeof WeakMap=="function"&&WeakMap.prototype,Ks=Rx?WeakMap.prototype.has:null,Px=typeof WeakSet=="function"&&WeakSet.prototype,Js=Px?WeakSet.prototype.has:null,Dx=typeof WeakRef=="function"&&WeakRef.prototype,wf=Dx?WeakRef.prototype.deref:null,Lx=Boolean.prototype.valueOf,zx=Object.prototype.toString,Ox=Function.prototype.toString,Mx=String.prototype.match,gd=String.prototype.slice,Gn=String.prototype.replace,Nx=String.prototype.toUpperCase,Sf=String.prototype.toLowerCase,hv=RegExp.prototype.test,_f=Array.prototype.concat,an=Array.prototype.join,Ux=Array.prototype.slice,kf=Math.floor,Nu=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Qc=Object.getOwnPropertySymbols,Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,as=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Xs=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===as||!0)?Symbol.toStringTag:null,dv=Object.prototype.propertyIsEnumerable,xf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Ef(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||hv.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-kf(-n):kf(n);if(r!==n){var i=String(r),s=gd.call(t,i.length+1);return Gn.call(i,e,"$&_")+"."+Gn.call(Gn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Gn.call(t,e,"$&_")}var Fu=Cx,Af=Fu.custom,$f=gv(Af)?Af:null,pv={__proto__:null,double:'"',single:"'"},Fx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},vs=function n(t,e,r,i){var s=e||{};if(yn(s,"quoteStyle")&&!yn(pv,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(yn(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=yn(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(yn(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(yn(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 vv(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?Ef(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?Ef(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 Hu(t)?"[Array]":"[Object]";var f=iE(s,r);if(typeof i>"u")i=[];else if(mv(i,t)>=0)return"[Circular]";function y(Mt,Cn,Ec){if(Cn&&(i=Ux.call(i),i.push(Cn)),Ec){var wa={depth:s.depth};return yn(s,"quoteStyle")&&(wa.quoteStyle=s.quoteStyle),n(Mt,wa,r+1,i)}return n(Mt,s,r+1,i)}if(typeof t=="function"&&!Tf(t)){var m=Yx(t),E=Ra(t,y);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(E.length>0?" { "+an.call(E,", ")+" }":"")}if(gv(t)){var x=as?Gn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Uu.call(t);return typeof t=="object"&&!as?Ts(x):x}if(tE(t)){for(var I="<"+Sf.call(String(t.nodeName)),P=t.attributes||[],R=0;R<P.length;R++)I+=" "+P[R].name+"="+fv(Hx(P[R].value),"double",s);return I+=">",t.childNodes&&t.childNodes.length&&(I+="..."),I+="</"+Sf.call(String(t.nodeName))+">",I}if(Hu(t)){if(t.length===0)return"[]";var V=Ra(t,y);return f&&!rE(V)?"["+Zu(V,f)+"]":"[ "+an.call(V,", ")+" ]"}if(Wx(t)){var N=Ra(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!dv.call(t,"cause")?"{ ["+String(t)+"] "+an.call(_f.call("[cause]: "+y(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+an.call(N,", ")+" }"}if(typeof t=="object"&&o){if($f&&typeof t[$f]=="function"&&Fu)return Fu(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Kx(t)){var F=[];return yf&&yf.call(t,function(Mt,Cn){F.push(y(Cn,t,!0)+" => "+y(Mt,t))}),If("Map",kl.call(t),F,f)}if(Qx(t)){var Y=[];return bf&&bf.call(t,function(Mt){Y.push(y(Mt,t))}),If("Set",xl.call(t),Y,f)}if(Jx(t))return eu("WeakMap");if(eE(t))return eu("WeakSet");if(Xx(t))return eu("WeakRef");if(Bx(t))return Ts(y(Number(t)));if(Gx(t))return Ts(y(Nu.call(t)));if(jx(t))return Ts(Lx.call(t));if(Vx(t))return Ts(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof gr<"u"&&t===gr)return"{ [object globalThis] }";if(!Zx(t)&&!Tf(t)){var j=Ra(t,y),ce=xf?xf(t)===Object.prototype:t instanceof Object||t.constructor===Object,Et=t instanceof Object?"":"null prototype",sr=!ce&&Xs&&Object(t)===t&&Xs in t?gd.call(nr(t),8,-1):Et?"Object":"",ze=ce||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",or=ze+(sr||Et?"["+an.call(_f.call([],sr||[],Et||[]),": ")+"] ":"");return j.length===0?or+"{}":f?or+"{"+Zu(j,f)+"}":or+"{ "+an.call(j,", ")+" }"}return String(t)};function fv(n,t,e){var r=e.quoteStyle||t,i=pv[r];return i+n+i}function Hx(n){return Gn.call(String(n),/"/g,"&quot;")}function Xr(n){return!Xs||!(typeof n=="object"&&(Xs in n||typeof n[Xs]<"u"))}function Hu(n){return nr(n)==="[object Array]"&&Xr(n)}function Zx(n){return nr(n)==="[object Date]"&&Xr(n)}function Tf(n){return nr(n)==="[object RegExp]"&&Xr(n)}function Wx(n){return nr(n)==="[object Error]"&&Xr(n)}function Vx(n){return nr(n)==="[object String]"&&Xr(n)}function Bx(n){return nr(n)==="[object Number]"&&Xr(n)}function jx(n){return nr(n)==="[object Boolean]"&&Xr(n)}function gv(n){if(as)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Uu)return!1;try{return Uu.call(n),!0}catch{}return!1}function Gx(n){if(!n||typeof n!="object"||!Nu)return!1;try{return Nu.call(n),!0}catch{}return!1}var qx=Object.prototype.hasOwnProperty||function(n){return n in this};function yn(n,t){return qx.call(n,t)}function nr(n){return zx.call(n)}function Yx(n){if(n.name)return n.name;var t=Mx.call(Ox.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function mv(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 Kx(n){if(!kl||!n||typeof n!="object")return!1;try{kl.call(n);try{xl.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function Jx(n){if(!Ks||!n||typeof n!="object")return!1;try{Ks.call(n,Ks);try{Js.call(n,Js)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function Xx(n){if(!wf||!n||typeof n!="object")return!1;try{return wf.call(n),!0}catch{}return!1}function Qx(n){if(!xl||!n||typeof n!="object")return!1;try{xl.call(n);try{kl.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function eE(n){if(!Js||!n||typeof n!="object")return!1;try{Js.call(n,Js);try{Ks.call(n,Ks)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function tE(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function vv(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return vv(gd.call(n,0,t.maxStringLength),t)+r}var i=Fx[t.quoteStyle||"single"];i.lastIndex=0;var s=Gn.call(Gn.call(n,i,"\\$1"),/[\x00-\x1f]/g,nE);return fv(s,"single",t)}function nE(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":"")+Nx.call(t.toString(16))}function Ts(n){return"Object("+n+")"}function eu(n){return n+" { ? }"}function If(n,t,e,r){var i=r?Zu(e,r):an.call(e,", ");return n+" ("+t+") {"+i+"}"}function rE(n){for(var t=0;t<n.length;t++)if(mv(n[t],`
2
- `)>=0)return!1;return!0}function iE(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 Zu(n,t){if(n.length===0)return"";var e=`
1
+ var W0=Object.defineProperty;var Dp=n=>{throw TypeError(n)};var V0=(n,t,e)=>t in n?W0(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>V0(n,typeof t!="symbol"?t+"":t,e),Mc=(n,t,e)=>t.has(n)||Dp("Cannot "+e);var l=(n,t,e)=>(Mc(n,t,"read from private field"),e?e.call(n):t.get(n)),S=(n,t,e)=>t.has(n)?Dp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),w=(n,t,e,r)=>(Mc(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),p=(n,t,e)=>(Mc(n,t,"access private method"),e);var Lp=(n,t,e,r)=>({set _(i){w(n,t,i,e)},get _(){return l(n,t,r)}});import{i as zp,a as Op,b as j0,U as B0,c as Mp,d as G0,A as q0,e as Y0,f as K0}from"./artifact-bridge-Ce9BPLXH.js";import{m as J0,a as X0,b as Q0}from"./missing-artifact-page-DVzJ41AE.js";var gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eS(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 Np=Object.prototype.toString,Um=function(t){var e=Np.call(t),r=e==="[object Arguments]";return r||(r=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Np.call(t.callee)==="[object Function]"),r},Nc,Up;function tS(){if(Up)return Nc;Up=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Um,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 Nc=n,Nc}var nS=Array.prototype.slice,rS=Um,Fp=Object.keys,Ga=Fp?function(t){return Fp(t)}:tS(),Hp=Object.keys;Ga.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 rS(r)?Hp(nS.call(r)):Hp(r)})}else Object.keys=Ga;return Object.keys||Ga};var iS=Ga,qa=Object.defineProperty||!1;if(qa)try{qa({},"a",{value:1})}catch{qa=!1}var oa=qa,$n=SyntaxError,K=TypeError,sS=Object.getOwnPropertyDescriptor,Ya=sS;if(Ya)try{Ya([],"length")}catch{Ya=null}var ds=Ya,Zp=oa,oS=$n,ai=K,Wp=ds,Fm=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new ai("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ai("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ai("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ai("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ai("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ai("`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=!!Wp&&Wp(t,e);if(Zp)Zp(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 oS("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Mu=oa,Hm=function(){return!!Mu};Hm.hasArrayLengthDefineBug=function(){if(!Mu)return null;try{return Mu([],"length",{value:1}).length!==1}catch{return!0}};var ic=Hm,aS=iS,lS=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",cS=Object.prototype.toString,uS=Array.prototype.concat,Vp=Fm,hS=function(n){return typeof n=="function"&&cS.call(n)==="[object Function]"},Zm=ic(),dS=function(n,t,e,r){if(t in n){if(r===!0){if(n[t]===e)return}else if(!hS(r)||!r())return}Zm?Vp(n,t,e,!0):Vp(n,t,e)},Wm=function(n,t){var e=arguments.length>2?arguments[2]:{},r=aS(t);lS&&(r=uS.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i<r.length;i+=1)dS(n,r[i],t[r[i]],e[r[i]])};Wm.supportsDescriptors=!!Zm;var Jr=Wm,Ka={exports:{}};typeof self<"u"?Ka.exports=self:typeof window<"u"?Ka.exports=window:Ka.exports=Function("return this")();var Vm=Ka.exports,pS=Vm,jm=function(){return typeof gr!="object"||!gr||gr.Math!==Math||gr.Array!==Array?pS:gr},fS=Jr,gS=ds,mS=jm,vS=function(){var t=mS();if(fS.supportsDescriptors){var e=gS(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},yS=Jr,bS=Vm,Bm=jm,wS=vS,SS=Bm(),Gm=function(){return SS};yS(Gm,{getPolyfill:Bm,implementation:bS,shim:wS});var rd=Gm,Tn=function(t){return!!t&&(typeof t=="function"||typeof t=="object")},id=Object,qm=Error,_S=EvalError,kS=RangeError,sd=ReferenceError,xS=URIError,ES=Math.abs,AS=Math.floor,$S=Math.max,TS=Math.min,IS=Math.pow,CS=Math.round,od=Number.isNaN||function(t){return t!==t},RS=od,PS=function(t){return RS(t)||t===0?t:t<0?-1:1},ps=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},jp=typeof Symbol<"u"&&Symbol,DS=ps,ad=function(){return typeof jp!="function"||typeof Symbol!="function"||typeof jp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:DS()},Uc,Bp;function Ym(){return Bp||(Bp=1,Uc=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Uc}var Fc,Gp;function Km(){if(Gp)return Fc;Gp=1;var n=id;return Fc=n.getPrototypeOf||null,Fc}var LS="Function.prototype.bind called on incompatible ",zS=Object.prototype.toString,OS=Math.max,MS="[object Function]",qp=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},NS=function(t,e){for(var r=[],i=e,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},US=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},FS=function(t){var e=this;if(typeof e!="function"||zS.apply(e)!==MS)throw new TypeError(LS+e);for(var r=NS(arguments,1),i,s=function(){if(this instanceof i){var h=e.apply(this,qp(r,arguments));return Object(h)===h?h:this}return e.apply(t,qp(r,arguments))},o=OS(0,e.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+US(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},HS=FS,aa=Function.prototype.bind||HS,ld=Function.prototype.call,cd=Function.prototype.apply,ZS=typeof Reflect<"u"&&Reflect&&Reflect.apply,WS=aa,VS=cd,jS=ld,BS=ZS,Jm=BS||WS.call(jS,VS),GS=aa,qS=K,YS=ld,KS=Jm,sc=function(t){if(t.length<1||typeof t[0]!="function")throw new qS("a function is required");return KS(GS,YS,t)},Hc,Yp;function JS(){if(Yp)return Hc;Yp=1;var n=sc,t=ds,e;try{e=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var r=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return Hc=r&&typeof r.get=="function"?n([r.get]):typeof s=="function"?function(a){return s(a==null?a:i(a))}:!1,Hc}var Zc,Kp;function Xm(){if(Kp)return Zc;Kp=1;var n=Ym(),t=Km(),e=JS();return Zc=n?function(i){return n(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:e?function(i){return e(i)}:null,Zc}var XS=Function.prototype.call,QS=Object.prototype.hasOwnProperty,e_=aa,In=e_.call(XS,QS),q,t_=id,n_=qm,r_=_S,i_=kS,s_=sd,os=$n,Ii=K,o_=xS,a_=ES,l_=AS,c_=$S,u_=TS,h_=IS,d_=CS,p_=PS,Qm=Function,Wc=function(n){try{return Qm('"use strict"; return ('+n+").constructor;")()}catch{}},no=ds,f_=oa,Vc=function(){throw new Ii},g_=no?function(){try{return arguments.callee,Vc}catch{try{return no(arguments,"callee").get}catch{return Vc}}}():Vc,li=ad(),De=Xm(),m_=Km(),v_=Ym(),ev=cd,la=ld,fi={},y_=typeof Uint8Array>"u"||!De?q:De(Uint8Array),Zr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":li&&De?De([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":fi,"%AsyncGenerator%":fi,"%AsyncGeneratorFunction%":fi,"%AsyncIteratorPrototype%":fi,"%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%":n_,"%eval%":eval,"%EvalError%":r_,"%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%":Qm,"%GeneratorFunction%":fi,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":li&&De?De(De([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!li||!De?q:De(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t_,"%Object.getOwnPropertyDescriptor%":no,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":i_,"%ReferenceError%":s_,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!li||!De?q:De(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":li&&De?De(""[Symbol.iterator]()):q,"%Symbol%":li?Symbol:q,"%SyntaxError%":os,"%ThrowTypeError%":g_,"%TypedArray%":y_,"%TypeError%":Ii,"%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%":o_,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet,"%Function.prototype.call%":la,"%Function.prototype.apply%":ev,"%Object.defineProperty%":f_,"%Object.getPrototypeOf%":m_,"%Math.abs%":a_,"%Math.floor%":l_,"%Math.max%":c_,"%Math.min%":u_,"%Math.pow%":h_,"%Math.round%":d_,"%Math.sign%":p_,"%Reflect.getPrototypeOf%":v_};if(De)try{null.error}catch(n){var b_=De(De(n));Zr["%Error.prototype%"]=b_}var w_=function n(t){var e;if(t==="%AsyncFunction%")e=Wc("async function () {}");else if(t==="%GeneratorFunction%")e=Wc("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Wc("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 Zr[t]=e,e},Jp={__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"]},ca=aa,Sl=In,S_=ca.call(la,Array.prototype.concat),__=ca.call(ev,Array.prototype.splice),Xp=ca.call(la,String.prototype.replace),_l=ca.call(la,String.prototype.slice),k_=ca.call(la,RegExp.prototype.exec),x_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E_=/\\(\\)?/g,A_=function(t){var e=_l(t,0,1),r=_l(t,-1);if(e==="%"&&r!=="%")throw new os("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new os("invalid intrinsic syntax, expected opening `%`");var i=[];return Xp(t,x_,function(s,o,a,c){i[i.length]=a?Xp(c,E_,"$1"):o||s}),i},$_=function(t,e){var r=t,i;if(Sl(Jp,r)&&(i=Jp[r],r="%"+i[0]+"%"),Sl(Zr,r)){var s=Zr[r];if(s===fi&&(s=w_(r)),typeof s>"u"&&!e)throw new Ii("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new os("intrinsic "+t+" does not exist!")},kt=function(t,e){if(typeof t!="string"||t.length===0)throw new Ii("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ii('"allowMissing" argument must be a boolean');if(k_(/^%?[^%]*%?$/,t)===null)throw new os("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=A_(t),i=r.length>0?r[0]:"",s=$_("%"+i+"%",e),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],__(r,S_([0,1],u)));for(var h=1,f=!0;h<r.length;h+=1){var y=r[h],m=_l(y,0,1),E=_l(y,-1);if((m==='"'||m==="'"||m==="`"||E==='"'||E==="'"||E==="`")&&m!==E)throw new os("property names with quotes must have matching quotes");if((y==="constructor"||!f)&&(c=!0),i+="."+y,o="%"+i+"%",Sl(Zr,o))a=Zr[o];else if(a!=null){if(!(y in a)){if(!e)throw new Ii("base intrinsic for "+t+" exists, but the property is not available.");return}if(no&&h+1>=r.length){var x=no(a,y);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[y]}else f=Sl(a,y),a=a[y];f&&!c&&(Zr[o]=a)}}return a},jc,Qp;function tr(){if(Qp)return jc;Qp=1;var n=kt,t=sc,e=t([n("%String.prototype.indexOf%")]);return jc=function(i,s){var o=n(i,!!s);return typeof o=="function"&&e(i,".prototype.")>-1?t([o]):o},jc}var Bc,ef;function ud(){if(ef)return Bc;ef=1;var n=kt,t=n("%Array%"),e=!t.isArray&&tr()("Object.prototype.toString");return Bc=t.isArray||function(i){return e(i)==="[object Array]"},Bc}var T_=ic,tf=oa,tv=T_.hasArrayLengthDefineBug(),I_=tv&&ud(),C_=tr(),R_=C_("Object.prototype.propertyIsEnumerable"),hd=function(t,e,r,i,s,o){if(!tf){if(!t(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&R_(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,e(i[s],a)}return tv&&s==="length"&&"[[Value]]"in o&&I_(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(tf(i,s,r(o)),!0)},P_=K,$s=In,D_={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},fs=function(t){if(!t||typeof t!="object")return!1;for(var e in t)if($s(t,e)&&!D_[e])return!1;var r=$s(t,"[[Value]]")||$s(t,"[[Writable]]"),i=$s(t,"[[Get]]")||$s(t,"[[Set]]");if(r&&i)throw new P_("Property Descriptors may not be both accessor and data descriptors");return!0},nv=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},L_=K,z_=fs,O_=nv,rv=function(t){if(typeof t<"u"&&!z_(t))throw new L_("Assertion failed: `Desc` must be a Property Descriptor");return O_(t)},M_=K,nf=In,N_=fs,iv=function(t){if(typeof t>"u")return!1;if(!N_(t))throw new M_("Assertion failed: `Desc` must be a Property Descriptor");return!(!nf(t,"[[Value]]")&&!nf(t,"[[Writable]]"))},gs=function(t){return typeof t=="string"||typeof t=="symbol"},rf=od,sv=function(t,e){return t===e?t===0?1/t===1/e:!0:rf(t)&&rf(e)},sf=K,U_=Tn,F_=hd,H_=rv,Z_=iv,W_=gs,V_=sv,dd=function(t,e,r){if(!U_(t))throw new sf("Assertion failed: Type(O) is not Object");if(!W_(e))throw new sf("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return F_(Z_,V_,H_,t,e,i)},ov=Function.prototype.toString,xi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Nu,Ja;if(typeof xi=="function"&&typeof Object.defineProperty=="function")try{Nu=Object.defineProperty({},"length",{get:function(){throw Ja}}),Ja={},xi(function(){throw 42},null,Nu)}catch(n){n!==Ja&&(xi=null)}else xi=null;var j_=/^\s*class\b/,Uu=function(t){try{var e=ov.call(t);return j_.test(e)}catch{return!1}},Gc=function(t){try{return Uu(t)?!1:(ov.call(t),!0)}catch{return!1}},Xa=Object.prototype.toString,B_="[object Object]",G_="[object Function]",q_="[object GeneratorFunction]",Y_="[object HTMLAllCollection]",K_="[object HTML document.all class]",J_="[object HTMLCollection]",X_=typeof Symbol=="function"&&!!Symbol.toStringTag,Q_=!(0 in[,]),Fu=function(){return!1};if(typeof document=="object"){var ek=document.all;Xa.call(ek)===Xa.call(document.all)&&(Fu=function(t){if((Q_||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Xa.call(t);return(e===Y_||e===K_||e===J_||e===B_)&&t("")==null}catch{}return!1})}var av=xi?function(t){if(Fu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{xi(t,null,Nu)}catch(e){if(e!==Ja)return!1}return!Uu(t)&&Gc(t)}:function(t){if(Fu(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(X_)return Gc(t);if(Uu(t))return!1;var e=Xa.call(t);return e!==G_&&e!==q_&&!/^\[object HTML/.test(e)?!1:Gc(t)},tk=av,nk=function(t){return!!t},Ft=In,Ia=K,rk=Tn,of=tk,qc=nk,ik=function(t){if(!rk(t))throw new Ia("ToPropertyDescriptor requires an object");var e={};if(Ft(t,"enumerable")&&(e["[[Enumerable]]"]=qc(t.enumerable)),Ft(t,"configurable")&&(e["[[Configurable]]"]=qc(t.configurable)),Ft(t,"value")&&(e["[[Value]]"]=t.value),Ft(t,"writable")&&(e["[[Writable]]"]=qc(t.writable)),Ft(t,"get")){var r=t.get;if(typeof r<"u"&&!of(r))throw new Ia("getter must be a function");e["[[Get]]"]=r}if(Ft(t,"set")){var i=t.set;if(typeof i<"u"&&!of(i))throw new Ia("setter must be a function");e["[[Set]]"]=i}if((Ft(e,"[[Get]]")||Ft(e,"[[Set]]"))&&(Ft(e,"[[Value]]")||Ft(e,"[[Writable]]")))throw new Ia("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Yc=K,sk=Tn,af=fs,ok=hd,ak=rv,lk=iv,ck=gs,uk=sv,hk=ik,dk=function(t,e,r){if(!sk(t))throw new Yc("Assertion failed: Type(O) is not Object");if(!ck(e))throw new Yc("Assertion failed: P is not a Property Key");var i=af(r)?r:hk(r);if(!af(i))throw new Yc("Assertion failed: Desc is not a valid Property Descriptor");return ok(lk,uk,ak,t,e,i)},lf=K,pk=Tn,fk=dk,gk=gs,mk=function(t,e,r){if(!pk(t))throw new lf("Assertion failed: Type(O) is not Object");if(!gk(e))throw new lf("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return fk(t,e,i)},vk=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,yk=id,bk=yk.setPrototypeOf||null,wk=sc,cf=ds,Sk=K,lv={};try{lv.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var _k=!("toString"in lv),Kc=cf&&cf(Object.prototype,"__proto__"),kk=_k&&(!!Kc&&typeof Kc.set=="function"&&wk([Kc.set])||function(t,e){if(t==null)throw new Sk("set Object.prototype.__proto__ called on null or undefined");return t.__proto__=e,e}),uf=vk,xk=bk,hf=kk,Ek=K,Ak=uf?function(t,e){if(uf(t,e))return t;throw new Ek("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:xk||(hf?function(t,e){return hf(t,e),t}:null),df=K,$k=Tn,pf=Xm(),Tk=function(t){if(!$k(t))throw new df("Assertion failed: O must be an Object");if(!pf)throw new df("This environment does not support fetching prototypes.");return pf(t)},Ik=K,Ck=Ak,Rk=Tn,Pk=Tk,Dk=function(t,e){if(e!==null&&!Rk(e))throw new Ik("Assertion failed: V must be Object or Null");try{Ck(t,e)}catch{return!1}return Pk(t)===e},Jc=dd,ff=mk,cv=Dk,Lk=ic(),pd=qm;function ua(n,t,e){var r=new pd(e);return cv(r,Qa),delete r.constructor,ff(r,"error",n),ff(r,"suppressed",t),r}Lk&&Object.defineProperty(ua,"prototype",{writable:!1});var Qa=ua.prototype;if(!Jc(Qa,"constructor",ua)||!Jc(Qa,"message","")||!Jc(Qa,"name","SuppressedError"))throw new pd("unable to install SuppressedError.prototype properties; please report this!");cv(ua.prototype,pd.prototype);var zk=ua,Ok=zk,uv=function(){return typeof SuppressedError=="function"?SuppressedError:Ok},Mk=Jr,gf=rd(),Nk=uv,Uk=function(){var t=Nk();return Mk(gf,{SuppressedError:t},{SuppressedError:function(){return gf.SuppressedError!==t}}),t};Uk();var Fk=K,Hk=fs,Zk=nv,Wk=function(t){if(typeof t<"u"&&!Hk(t))throw new Fk("Assertion failed: `Desc` must be a Property Descriptor");return Zk(t)},Vk=K,mf=In,jk=fs,Bk=function(t){if(typeof t>"u")return!1;if(!jk(t))throw new Vk("Assertion failed: `Desc` must be a Property Descriptor");return!(!mf(t,"[[Value]]")&&!mf(t,"[[Writable]]"))},vf=od,Gk=function(t,e){return t===e?t===0?1/t===1/e:!0:vf(t)&&vf(e)},ms=av,qk=function(t){return!!t},Ht=In,Ca=K,Yk=Tn,yf=ms,Xc=qk,Kk=function(t){if(!Yk(t))throw new Ca("ToPropertyDescriptor requires an object");var e={};if(Ht(t,"enumerable")&&(e["[[Enumerable]]"]=Xc(t.enumerable)),Ht(t,"configurable")&&(e["[[Configurable]]"]=Xc(t.configurable)),Ht(t,"value")&&(e["[[Value]]"]=t.value),Ht(t,"writable")&&(e["[[Writable]]"]=Xc(t.writable)),Ht(t,"get")){var r=t.get;if(typeof r<"u"&&!yf(r))throw new Ca("getter must be a function");e["[[Get]]"]=r}if(Ht(t,"set")){var i=t.set;if(typeof i<"u"&&!yf(i))throw new Ca("setter must be a function");e["[[Set]]"]=i}if((Ht(e,"[[Get]]")||Ht(e,"[[Set]]"))&&(Ht(e,"[[Value]]")||Ht(e,"[[Writable]]")))throw new Ca("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e},Qc=K,Jk=Tn,bf=fs,Xk=hd,Qk=Wk,ex=Bk,tx=gs,nx=Gk,rx=Kk,ha=function(t,e,r){if(!Jk(t))throw new Qc("Assertion failed: Type(O) is not Object");if(!tx(e))throw new Qc("Assertion failed: P is not a Property Key");var i=bf(r)?r:rx(r);if(!bf(i))throw new Qc("Assertion failed: Desc is not a valid Property Descriptor");return Xk(ex,nx,Qk,t,e,i)},ix=ps(),sx=ix?Symbol.dispose||Symbol("Symbol.dispose"):null,ox=ps,ax=sx,fd=function(){return ox()&&Symbol.dispose||ax},lx=ad,cx=ha,ux=fd,hx=function(){var t=ux();return lx()&&cx(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},dx=ps(),px=dx?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,fx=ps,gx=px,gd=function(){return fx()&&Symbol.asyncDispose||gx},mx=ad,vx=ha,yx=gd,bx=function(){var t=yx();return mx()&&vx(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":t}),t},wx=ud(),Sx=kt,_x=tr(),kx=K,xx=wx,Ex=Sx("%Reflect.apply%",!0)||_x("Function.prototype.apply"),oc=function(t,e){var r=arguments.length>2?arguments[2]:[];if(!xx(r))throw new kx("Assertion failed: optional `argumentsList`, if provided, must be a List");return Ex(t,e,r)};const Ax={},$x=Object.freeze(Object.defineProperty({__proto__:null,default:Ax},Symbol.toStringTag,{value:"Module"})),Tx=eS($x);var md=typeof Map=="function"&&Map.prototype,eu=Object.getOwnPropertyDescriptor&&md?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,kl=md&&eu&&typeof eu.get=="function"?eu.get:null,wf=md&&Map.prototype.forEach,vd=typeof Set=="function"&&Set.prototype,tu=Object.getOwnPropertyDescriptor&&vd?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,xl=vd&&tu&&typeof tu.get=="function"?tu.get:null,Sf=vd&&Set.prototype.forEach,Ix=typeof WeakMap=="function"&&WeakMap.prototype,Ks=Ix?WeakMap.prototype.has:null,Cx=typeof WeakSet=="function"&&WeakSet.prototype,Js=Cx?WeakSet.prototype.has:null,Rx=typeof WeakRef=="function"&&WeakRef.prototype,_f=Rx?WeakRef.prototype.deref:null,Px=Boolean.prototype.valueOf,Dx=Object.prototype.toString,Lx=Function.prototype.toString,zx=String.prototype.match,yd=String.prototype.slice,Gn=String.prototype.replace,Ox=String.prototype.toUpperCase,kf=String.prototype.toLowerCase,hv=RegExp.prototype.test,xf=Array.prototype.concat,an=Array.prototype.join,Mx=Array.prototype.slice,Ef=Math.floor,Hu=typeof BigInt=="function"?BigInt.prototype.valueOf:null,nu=Object.getOwnPropertySymbols,Zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,as=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Xs=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===as||!0)?Symbol.toStringTag:null,dv=Object.prototype.propertyIsEnumerable,Af=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function $f(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||hv.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Ef(-n):Ef(n);if(r!==n){var i=String(r),s=yd.call(t,i.length+1);return Gn.call(i,e,"$&_")+"."+Gn.call(Gn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Gn.call(t,e,"$&_")}var Wu=Tx,Tf=Wu.custom,If=gv(Tf)?Tf:null,pv={__proto__:null,double:'"',single:"'"},Nx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},vs=function n(t,e,r,i){var s=e||{};if(yn(s,"quoteStyle")&&!yn(pv,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(yn(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=yn(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(yn(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(yn(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 vv(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var c=String(t);return a?$f(t,c):c}if(typeof t=="bigint"){var u=String(t)+"n";return a?$f(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 Vu(t)?"[Array]":"[Object]";var f=nE(s,r);if(typeof i>"u")i=[];else if(mv(i,t)>=0)return"[Circular]";function y(Mt,Cn,Ec){if(Cn&&(i=Mx.call(i),i.push(Cn)),Ec){var wa={depth:s.depth};return yn(s,"quoteStyle")&&(wa.quoteStyle=s.quoteStyle),n(Mt,wa,r+1,i)}return n(Mt,s,r+1,i)}if(typeof t=="function"&&!Cf(t)){var m=Gx(t),E=Ra(t,y);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(E.length>0?" { "+an.call(E,", ")+" }":"")}if(gv(t)){var x=as?Gn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zu.call(t);return typeof t=="object"&&!as?Ts(x):x}if(Qx(t)){for(var I="<"+kf.call(String(t.nodeName)),P=t.attributes||[],R=0;R<P.length;R++)I+=" "+P[R].name+"="+fv(Ux(P[R].value),"double",s);return I+=">",t.childNodes&&t.childNodes.length&&(I+="..."),I+="</"+kf.call(String(t.nodeName))+">",I}if(Vu(t)){if(t.length===0)return"[]";var V=Ra(t,y);return f&&!tE(V)?"["+ju(V,f)+"]":"[ "+an.call(V,", ")+" ]"}if(Hx(t)){var N=Ra(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!dv.call(t,"cause")?"{ ["+String(t)+"] "+an.call(xf.call("[cause]: "+y(t.cause),N),", ")+" }":N.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+an.call(N,", ")+" }"}if(typeof t=="object"&&o){if(If&&typeof t[If]=="function"&&Wu)return Wu(t,{depth:h-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(qx(t)){var F=[];return wf&&wf.call(t,function(Mt,Cn){F.push(y(Cn,t,!0)+" => "+y(Mt,t))}),Rf("Map",kl.call(t),F,f)}if(Jx(t)){var Y=[];return Sf&&Sf.call(t,function(Mt){Y.push(y(Mt,t))}),Rf("Set",xl.call(t),Y,f)}if(Yx(t))return ru("WeakMap");if(Xx(t))return ru("WeakSet");if(Kx(t))return ru("WeakRef");if(Wx(t))return Ts(y(Number(t)));if(jx(t))return Ts(y(Hu.call(t)));if(Vx(t))return Ts(Px.call(t));if(Zx(t))return Ts(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof gr<"u"&&t===gr)return"{ [object globalThis] }";if(!Fx(t)&&!Cf(t)){var B=Ra(t,y),ce=Af?Af(t)===Object.prototype:t instanceof Object||t.constructor===Object,Et=t instanceof Object?"":"null prototype",sr=!ce&&Xs&&Object(t)===t&&Xs in t?yd.call(nr(t),8,-1):Et?"Object":"",ze=ce||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",or=ze+(sr||Et?"["+an.call(xf.call([],sr||[],Et||[]),": ")+"] ":"");return B.length===0?or+"{}":f?or+"{"+ju(B,f)+"}":or+"{ "+an.call(B,", ")+" }"}return String(t)};function fv(n,t,e){var r=e.quoteStyle||t,i=pv[r];return i+n+i}function Ux(n){return Gn.call(String(n),/"/g,"&quot;")}function Xr(n){return!Xs||!(typeof n=="object"&&(Xs in n||typeof n[Xs]<"u"))}function Vu(n){return nr(n)==="[object Array]"&&Xr(n)}function Fx(n){return nr(n)==="[object Date]"&&Xr(n)}function Cf(n){return nr(n)==="[object RegExp]"&&Xr(n)}function Hx(n){return nr(n)==="[object Error]"&&Xr(n)}function Zx(n){return nr(n)==="[object String]"&&Xr(n)}function Wx(n){return nr(n)==="[object Number]"&&Xr(n)}function Vx(n){return nr(n)==="[object Boolean]"&&Xr(n)}function gv(n){if(as)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Zu)return!1;try{return Zu.call(n),!0}catch{}return!1}function jx(n){if(!n||typeof n!="object"||!Hu)return!1;try{return Hu.call(n),!0}catch{}return!1}var Bx=Object.prototype.hasOwnProperty||function(n){return n in this};function yn(n,t){return Bx.call(n,t)}function nr(n){return Dx.call(n)}function Gx(n){if(n.name)return n.name;var t=zx.call(Lx.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function mv(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 qx(n){if(!kl||!n||typeof n!="object")return!1;try{kl.call(n);try{xl.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function Yx(n){if(!Ks||!n||typeof n!="object")return!1;try{Ks.call(n,Ks);try{Js.call(n,Js)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function Kx(n){if(!_f||!n||typeof n!="object")return!1;try{return _f.call(n),!0}catch{}return!1}function Jx(n){if(!xl||!n||typeof n!="object")return!1;try{xl.call(n);try{kl.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Xx(n){if(!Js||!n||typeof n!="object")return!1;try{Js.call(n,Js);try{Ks.call(n,Ks)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function Qx(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function vv(n,t){if(n.length>t.maxStringLength){var e=n.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return vv(yd.call(n,0,t.maxStringLength),t)+r}var i=Nx[t.quoteStyle||"single"];i.lastIndex=0;var s=Gn.call(Gn.call(n,i,"\\$1"),/[\x00-\x1f]/g,eE);return fv(s,"single",t)}function eE(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":"")+Ox.call(t.toString(16))}function Ts(n){return"Object("+n+")"}function ru(n){return n+" { ? }"}function Rf(n,t,e,r){var i=r?ju(e,r):an.call(e,", ");return n+" ("+t+") {"+i+"}"}function tE(n){for(var t=0;t<n.length;t++)if(mv(n[t],`
2
+ `)>=0)return!1;return!0}function nE(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 ju(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 Ra(n,t){var e=Hu(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=yn(n,i)?t(n[i],n):""}var s=typeof Qc=="function"?Qc(n):[],o;if(as){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)yn(n,c)&&(e&&String(Number(c))===c&&c<n.length||as&&o["$"+c]instanceof Symbol||(hv.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof Qc=="function")for(var u=0;u<s.length;u++)dv.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var sE=vs,oE=K,ac=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},aE=function(n,t){if(n){var e=ac(n,t);return e&&e.value}},lE=function(n,t,e){var r=ac(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},cE=function(n,t){return n?!!ac(n,t):!1},uE=function(n,t){if(n)return ac(n,t,!0)},hE=function(){var t,e={assert:function(r){if(!e.has(r))throw new oE("Side channel does not contain "+sE(r))},delete:function(r){var i=t&&t.next,s=uE(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return aE(t,r)},has:function(r){return cE(t,r)},set:function(r,i){t||(t={next:void 0}),lE(t,r,i)}};return e},dE=kt,da=tr(),pE=vs,fE=K,Cf=dE("%Map%",!0),gE=da("Map.prototype.get",!0),mE=da("Map.prototype.set",!0),vE=da("Map.prototype.has",!0),yE=da("Map.prototype.delete",!0),bE=da("Map.prototype.size",!0),yv=!!Cf&&function(){var t,e={assert:function(r){if(!e.has(r))throw new fE("Side channel does not contain "+pE(r))},delete:function(r){if(t){var i=yE(t,r);return bE(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return gE(t,r)},has:function(r){return t?vE(t,r):!1},set:function(r,i){t||(t=new Cf),mE(t,r,i)}};return e},wE=kt,lc=tr(),SE=vs,Pa=yv,_E=K,ci=wE("%WeakMap%",!0),kE=lc("WeakMap.prototype.get",!0),xE=lc("WeakMap.prototype.set",!0),EE=lc("WeakMap.prototype.has",!0),AE=lc("WeakMap.prototype.delete",!0),$E=ci?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new _E("Side channel does not contain "+SE(i))},delete:function(i){if(ci&&i&&(typeof i=="object"||typeof i=="function")){if(t)return AE(t,i)}else if(Pa&&e)return e.delete(i);return!1},get:function(i){return ci&&i&&(typeof i=="object"||typeof i=="function")&&t?kE(t,i):e&&e.get(i)},has:function(i){return ci&&i&&(typeof i=="object"||typeof i=="function")&&t?EE(t,i):!!e&&e.has(i)},set:function(i,s){ci&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new ci),xE(t,i,s)):Pa&&(e||(e=Pa()),e.set(i,s))}};return r}:Pa,TE=K,IE=vs,CE=hE,RE=yv,PE=$E,DE=PE||RE||CE,LE=function(){var t,e={assert:function(r){if(!e.has(r))throw new TE("Side channel does not contain "+IE(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=DE()),t.set(r,i)}};return e},zE=In,Is=LE(),fn=K,md={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(Is.assert(n),!md.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=Is.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=Is.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=Is.get(n);r||(r={},Is.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(md);var vd=md,bv=$n,Yn=vd,pa=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 bv('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Yn.set(this,"[[Type]]",t),Yn.set(this,"[[Value]]",e)};pa.prototype.type=function(){return Yn.get(this,"[[Type]]")};pa.prototype.value=function(){return Yn.get(this,"[[Value]]")};pa.prototype["?"]=function(){var t=Yn.get(this,"[[Type]]"),e=Yn.get(this,"[[Value]]");if(t==="throw")throw e;return e};pa.prototype["!"]=function(){var t=Yn.get(this,"[[Type]]");if(t!=="normal")throw new bv('Assertion failed: Completion Record is not of type "normal"');return Yn.get(this,"[[Value]]")};var yd=pa,OE=yd,bd=function(t){return new OE("normal",t)},tu,Rf;function ME(){if(Rf)return tu;Rf=1;var n=ps;return tu=function(){return n()&&!!Symbol.toStringTag},tu}var NE=kt,Pf=NE("%Object.defineProperty%",!0),UE=ME()(),FE=In,HE=K,Da=UE?Symbol.toStringTag:null,wv=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 HE("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Da&&(r||!FE(t,Da))&&(Pf?Pf(t,Da,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Da]=e)},Sv={exports:{}},ZE=kt,Df=Nm,WE=ic(),Lf=ds,zf=K,VE=ZE("%Math.floor%"),BE=function(t,e){if(typeof t!="function")throw new zf("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||VE(e)!==e)throw new zf("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&Lf){var o=Lf(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(WE?Df(t,"length",e,!0,!0):Df(t,"length",e)),t},jE=aa,GE=od,qE=Ym,YE=function(){return qE(jE,GE,arguments)};(function(n){var t=BE,e=oa,r=sc,i=YE;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})(Sv);var wd=Sv.exports,KE=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},JE=Object,XE=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||JE(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},QE=In,e1=ad(),t1=KE,n1=XE,r1=function(t){return t&&typeof t=="object"&&QE(t,"[[DisposableResourceStack]]")&&e1(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||t1(t["[[DisposableResourceStack]]"],n1))},i1=Tn,s1=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(i1(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},o1=s1,Sd=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":o1(t)},a1=K,l1=vs,c1=gs,u1=function(t,e){if(!c1(e))throw new a1("Assertion failed: P is not a Property Key, got "+l1(e));return t[e]},Of=K,h1=u1,d1=ms,p1=gs,Mf=vs,f1=function(t,e){if(!p1(e))throw new Of("Assertion failed: P is not a Property Key");var r=h1(t,e);if(r!=null){if(!d1(r))throw new Of(Mf(e)+" is not a function: "+Mf(r));return r}},Wu={exports:{}},g1=kt,m1=g1,Nf=m1("%Reflect.construct%",!0),El=ha;try{El({},"",{"[[Get]]":function(){}})}catch{El=null}if(El&&Nf){var Uf={},Ff={};El(Ff,"length",{"[[Get]]":function(){throw Uf},"[[Enumerable]]":!0}),Wu.exports=function(t){try{Nf(t,Ff)}catch(e){return e===Uf}}}else Wu.exports=function(t){return typeof t=="function"&&!!t.prototype};var v1=Wu.exports,nu=K,Hf=ms,y1=v1,b1=function(t){if(!y1(t))throw new nu("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 nu("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!Hf(e["[[Resolve]]"])||!Hf(e["[[Reject]]"]))throw new nu("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},Zf=$n,w1=K,ru=oc,Wf=f1,S1=b1,_1=Sd,Vf=hd(),Bf=dd(),k1=function(t,e){if(_1(t)!=="Object")throw new w1("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new Zf("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&Bf&&(r=Wf(t,Bf)),!r){if(!Vf)throw new Zf("`Symbol.dispose` is not supported");if(r=Wf(t,Vf),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=S1(Promise);try{ru(r,i),ru(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}ru(r,i)}}return r},x1=$n,iu=K,E1=ms,A1=Sd,$1=k1,T1=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new x1("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"&&A1(t)!=="Object")throw new iu("`V` must be an Object, or `null` or `undefined`");if(r=$1(t,e),typeof r>"u")throw new iu("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!E1(r))throw new iu("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},I1=$n,La=K,C1=r1,jf=T1,R1=tr(),P1=R1("Array.prototype.push"),_v=function(t,e,r){if(!C1(t))throw new La("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new I1("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 La("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new La("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=jf(e,r)}else{if(typeof e<"u")throw new La("Assertion failed: `V` must be undefined when `method` is present");s=jf(void 0,r,i)}return P1(t["[[DisposableResourceStack]]"],s),"UNUSED"},su,Gf;function _d(){if(Gf)return su;Gf=1;var n=kt,t=wd,e=$n,r=n("%Promise.resolve%",!0),i=r&&t(r);return su=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},su}var ou,qf;function D1(){if(qf)return ou;qf=1;var n=kt,t=$n,e=n("%Promise%",!0),r=oc,i=_d(),s=Sd;return ou=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)},ou}var au,Yf;function L1(){if(Yf)return au;Yf=1;var n=yd;return au=function(e){return new n("throw",e)},au}var z1=kt,lu=$n,Kf=K,O1=z1("%Promise%",!0),M1=tr(),Jf=M1("Promise.prototype.then",!0),N1=yd,Xf=D1(),U1=bd,F1=_d(),Qf=L1(),H1=uv(),kv=function(t,e){if(!(e instanceof N1))throw new Kf("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new Kf("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 lu("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&F1(O1,e),a=function(y){if(e.type()==="throw"){var m=e.value(),E=new H1(y,m);e=Qf(E)}else e=Qf(y)},c=i==="ASYNC-DISPOSE"&&function(m){return Jf(o,function(){var E=Xf(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!E)throw new lu("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return Jf(E,U1)},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=Xf(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(f)throw new lu("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){a(y)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},xv=function(){var t=[];return{"[[DisposableResourceStack]]":t}},cc=nd,kd=K,Z1=oc,ys=cd,W1=ha,Ev=ms,V1=bd,at=vd,B1=wv,Av=Jr.supportsDescriptors,j1=wd,xd=_v,G1=kv,$v=xv,eg=hd(),bt=function n(){if(!(this instanceof n)||at.has(this,"[[DisposableState]]")||at.has(this,"[[DisposeCapability]]"))throw new kd("can only be used with new");at.set(this,"[[DisposableState]]","PENDING"),at.set(this,"[[DisposeCapability]]",$v())},Tv=function(){var t=this;return at.assert(t,"[[DisposableState]]"),at.get(t,"[[DisposableState]]")==="DISPOSED"},fa=j1(Tv);Av?W1(bt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Tv}):bt.prototype.disposed=!1;var Iv=function(t){at.set(t,"[[DisposableState]]","DISPOSED"),Av||(t.disposed=!0)};ys(bt.prototype,"dispose",function(){var t=this;if(!fa(t))return Iv(t),G1(at.get(t,"[[DisposeCapability]]"),V1())["?"]()});ys(bt.prototype,"use",function(t){var e=this;if(fa(e))throw new cc("a disposed stack can not use anything new");return xd(at.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});ys(bt.prototype,"adopt",function(t,e){var r=this;if(fa(r))throw new cc("a disposed stack can not use anything new");if(!Ev(e))throw new kd("`onDispose` must be a function");var i=function(){return Z1(e,void 0,[t])};return xd(at.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});ys(bt.prototype,"defer",function(t){var e=this;if(fa(e))throw new cc("a disposed stack can not defer anything new");if(!Ev(t))throw new kd("`onDispose` must be a function");xd(at.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});ys(bt.prototype,"move",function(){var t=this;if(fa(t))throw new cc("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]]",$v()),Iv(t),e});eg&&ys(bt.prototype,eg,bt.prototype.dispose);B1(bt.prototype,"DisposableStack");var q1=bt,Y1=q1,K1=function(){return typeof DisposableStack=="function"?DisposableStack:Y1},J1=Jr,X1=ed(),Q1=K1,eA=function(){var t=Q1();return J1(X1,{DisposableStack:t},{DisposableStack:!0}),t},tA=kt,uc=nd,Ed=K,tg=tA("%Promise%",!0),Ad=_v,nA=oc,bs=cd,rA=ha,iA=kv,Cv=ms,Rv=xv,sA=bd,ng=_d(),lt=vd,oA=wv,Pv=Jr.supportsDescriptors,aA=wd,lA=tr(),cA=lA("Promise.prototype.then",!0),rg=dd(),wt=function n(){if(!(this instanceof n)||lt.has(this,"[[AsyncDisposableState]]")||lt.has(this,"[[DisposeCapability]]"))throw new Ed("can only be used with new");lt.set(this,"[[AsyncDisposableState]]","pending"),lt.set(this,"[[DisposeCapability]]",Rv())},Dv=function(){var t=this;return lt.assert(t,"[[AsyncDisposableState]]"),lt.get(t,"[[AsyncDisposableState]]")==="disposed"},ga=aA(Dv);Pv?rA(wt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Dv}):wt.prototype.disposed=!1;var Lv=function(t){lt.set(t,"[[AsyncDisposableState]]","disposed"),Pv||(t.disposed=!0)};bs(wt.prototype,"disposeAsync",function(){var t=this;return ga(t)?ng(tg):(Lv(t),cA(ng(tg,iA(lt.get(t,"[[DisposeCapability]]"),sA())),function(e){return e["?"]()}))});bs(wt.prototype,"use",function(t){var e=this;if(ga(e))throw new uc("a disposed stack can not use anything new");return Ad(lt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});bs(wt.prototype,"adopt",function(t,e){var r=this;if(ga(r))throw new uc("a disposed stack can not use anything new");if(!Cv(e))throw new Ed("`onDisposeAsync` must be a function");var i=function(){return nA(e,void 0,[t])};return i.value=t,Ad(lt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});bs(wt.prototype,"defer",function(t){var e=this;if(ga(e))throw new uc("a disposed stack can not defer anything new");if(!Cv(t))throw new Ed("`onDispose` must be a function");Ad(lt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});bs(wt.prototype,"move",function(){var t=this;if(ga(t))throw new uc("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]]",Rv()),Lv(t),e});rg&&bs(wt.prototype,rg,wt.prototype.disposeAsync);oA(wt.prototype,"AsyncDisposableStack");var uA=wt,hA=uA,dA=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:hA},pA=Jr,fA=ed(),gA=dA,mA=function(){var t=gA();return pA(fA,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},vA=px,yA=Sx,bA=eA,wA=mA,SA=function(){vA(),yA(),bA(),wA()};SA();const ig=new WeakMap;function _A(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function ui(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function sg(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function kA(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class xA{constructor(){g(this,"entries",new Map);g(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw sg();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw sg();if(e.constructor.name==="AsyncFunction")throw kA();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=ig.get(t);if(e){if(t.length!==e.length)throw new Error(`${ui(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(`${ui(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=ig.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(`${ui(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=>ui(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(_A(r))throw new Error(`Factory for ${ui(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${ui(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 xA,EA=.5,og=.1,ag=8,AA=4,zv=3,Ov=3,$A=4,yr=255,Mv=.2126,Nv=.7152,Uv=.0722;async function Fv(n){const t=TA(n);if(!t)return"light";try{return await RA(n,t)>=EA?"light":"dark"}catch{return"light"}}function TA(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(IA(o))return s}return null}function IA(n){return Hv(n.backgroundImage)?!0:CA(n.backgroundColor)>0}function CA(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===$A?parseFloat(e[zv]):e.length===Ov?1:0}async function RA(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:za((e.left-r.left)/r.width),y:za((e.top-r.top)/r.height),width:za(e.width/r.width),height:za(e.height/r.height)},s=window.getComputedStyle(t),o=Hv(s.backgroundImage);return o?DA({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):LA(s.backgroundColor)}function Hv(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const lg=new Map;function PA(n){let t=lg.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}),lg.set(n,t),t)}async function DA(n){const t=await PA(n.url),e=Math.max(ag,Math.ceil(n.surfaceWidth*og)),r=Math.max(ag,Math.ceil(n.surfaceHeight*og)),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+=AA){const N=I[V]/yr,F=I[V+1]/yr,Y=I[V+2]/yr,j=I[V+zv]/yr;P+=j*(Mv*N+Nv*F+Uv*Y),R+=1}return R>0?P/R:1}function LA(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<Ov)return 1;const r=e[0]/yr,i=e[1]/yr,s=e[2]/yr;return Mv*r+Nv*i+Uv*s}function za(n){return n<0?0:n>1?1:n}const zA=["ghost","glass"],ro=[...zA.map(n=>`[variant="${n}"]`),'[material="glass"]'].join(", "),Oa=new WeakSet,cg=new WeakSet;function Zv(n){if(cg.has(n))return;cg.add(n);for(const e of n.querySelectorAll(ro))cu(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)OA(i,cu);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(ro)&&cu(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function OA(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(ro)&&t(n);for(const e of n.querySelectorAll(ro))t(e)}}async function cu(n){var e,r;if(Oa.has(n)||n.hasAttribute("tone")||(e=n.parentElement)!=null&&e.closest("[tone]"))return;Oa.add(n);const t=await Fv(n);if(!n.matches(ro)){Oa.delete(n);return}if(n.hasAttribute("tone")||(r=n.parentElement)!=null&&r.closest("[tone]")){Oa.delete(n);return}n.setAttribute("tone",t)}const MA="*,*: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)}',$d=new CSSStyleSheet;$d.replaceSync(MA);const Td=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,$d,Td]}catch{}Zv(document);function Wv(n){Td.replaceSync(n)}function Al(){Wv("")}function Id(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,$d,Td]}catch{}Zv(n)}const NA=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function UA(n){for(const t of Object.keys(n))if(NA.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function FA(n,t){UA(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function Be(){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}),FA(this,c)}}return n}class zt extends globalThis.EventTarget{}function HA(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function ma(n){var e;class t extends n{constructor(...s){super(...s);S(this,e,!1);HA(this,()=>l(this,e),()=>{w(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const ZA=Be(),WA=Be(),VA=Be(),el=Be(),BA=Be(),uu=Be(),Ve=4,ft=6,io=2,Vu=2,Cd=8,jA=ft,Rd="auto",Kn="auto",Ln=128,ug=50,ae=16,Vr=Ln*Ve+ae*(Ve-1),so=Ln*ft+ae*(ft-1),GA=Vr+ae*2,qA=200,YA=4,Ma=150,KA=10,hg=2,dg=8,JA=300,XA=4;function Vv(n){return Gv(n)}function Bv(n,t){return Gv(n.flatMap(e=>Yv(e,t)))}function jv(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}Kv(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function br(n){const t=Vv(n),e=jv(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(n$)}}function Gv(n){const t=[];for(const e of n){const r=qv(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(An));continue}t.push(i)}}return t}function qv(n){switch(n.type){case"card":return[An(n)];case"row":{const t=n.children.map(An);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=qv(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(Bu));continue}if(i.type==="row"){t.push({...i,children:i.children.map(An)});continue}t.push(An(i))}}return t.length===0?[]:t.length===1?[Bu(t[0])]:[{...n,children:t}]}}}function Yv(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[An(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(An);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>Yv(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[Bu(e[0])]:[{...n,children:e}]}}}function Kv(n,t,e,r){switch(n.type){case"card":Jv(n,t,e,r);return;case"row":QA(n,t,e,r);return;case"stack":e$(n,t,e,r);return}}function Jv(n,t,e,r){"id"in n&&e.push(`Card ${Cs(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),t$(n.width)||e.push(`Card ${Cs(n)} width must be an integer in the range ${io}-${Cd}`),Qv(n.height)||e.push(`Card ${Cs(n)} height must be an integer in the range 2-6 or "auto"`);const i=Ei(n.width);t==="stack"&&i!==Ve&&e.push(`Stack child ${Cs(n)} width must be ${Ve}`),t==="row"&&i<io&&e.push(`Row child ${Cs(n)} must be at least 2 columns wide`)}function Cs(n){return typeof n.artifactID=="string"&&n.artifactID.length>0?n.artifactID:"<missing artifactID>"}function QA(n,t,e,r){if(Xv(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),Qv(n.height,XA)||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}Jv(s,"row",e,r),i+=Ei(s.width)}i!==Ve&&e.push(`Row ${n.id} children must sum to 4 columns`)}function e$(n,t,e,r){if(Xv(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(Kv(a,"stack",e,r),a.height===Kn){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*Vu||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Vu&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Xv(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function t$(n){return n===Rd||Number.isInteger(n)&&n>=io&&n<=Cd}function Qv(n,t=jA){return n===Kn||Number.isInteger(n)&&n>=Vu&&n<=t}function Ei(n){return n===Rd?Ve:n}function n$(n){if(n.type==="card")return{id:n.artifactID,type:"card",width:Ei(n.width),cards:[{id:n.artifactID,artifactID:n.artifactID,col:1,row:1,width:Ei(n.width),height:ey(n.height,ft)}]};const t=r$(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:Ve,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:Ei(c.width),height:o}),a+=Ei(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 r$(n){let t=0,e=0;for(const i of n)i.height===Kn?e+=1:t+=i.height;const r=e>0?(ft-t)/e:0;return n.map(i=>ey(i.height,r))}function ey(n,t){return n===Kn?t:n}function An(n){return{...n}}function Bu(n){return n.type==="card"?An(n):{...n,children:n.children.map(An)}}function ty(n,t={}){return{type:"card",artifactID:n,width:t.width??Rd,height:t.height??Kn}}function tl(n){return n.layout.flatMap(ny)}function ny(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(ny)}}const oe=Be(),ju=Be(),hi=Be(),i$=Be();function s$(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const Pd=s$("RequestError"),o$=200,a$=300;class l${constructor(t,e){g(this,"serverURL");g(this,"token");this.serverURL=t.replace(/\/$/,""),this.token=e.token}async requestJSON(t,e,r){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 c$(i);if(!i.ok||i.status<o$||i.status>=a$)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){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 this.createError(await hu(i,i.statusText),i.status)}async requestText(t,e){const r=await this.request(t,e);if(!r.ok)throw this.createError(await hu(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){const i=await this.request(t,e,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw this.createError(await hu(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new Pd(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 c$(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function hu(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 u$(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Vt,Hl,ry;class h${constructor(t){S(this,Hl);S(this,Vt);w(this,Vt,t)}list(){return l(this,Vt).requestJSON("GET","/screens")}async get(t={}){const e=await p(this,Hl,ry).call(this,t.screenID);return l(this,Vt).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,Vt).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,Vt).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,Vt).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}Vt=new WeakMap,Hl=new WeakSet,ry=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,Vt).createError(`screenID is required when multiple screens exist. Available screens: ${u$(e)}`)};var bn;class d${constructor(t){S(this,bn);w(this,bn,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,bn).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,bn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,bn).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,bn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return l(this,bn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}bn=new WeakMap;var Di;class p${constructor(t){S(this,Di);w(this,Di,t)}get(t){return l(this,Di).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return l(this,Di).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}Di=new WeakMap;var _r;class f${constructor(t){S(this,_r);w(this,_r,t)}get(){return l(this,_r).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,_r).requestVoid("PATCH","/display",e)}focus(t){return l(this,_r).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}_r=new WeakMap;var wn;class g${constructor(t,e={}){g(this,"screens");g(this,"artifacts");g(this,"display");g(this,"markdown");S(this,wn);w(this,wn,new l$(t,e)),this.screens=new h$(l(this,wn)),this.artifacts=new d$(l(this,wn)),this.display=new f$(l(this,wn)),this.markdown=new p$(l(this,wn))}health(){return l(this,wn).requestJSON("GET","/health")}}wn=new WeakMap;const m$={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},v$="Local",y$="store-";function _e(n){return new URL(n).origin}function b$(n){return{servers:[{url:_e(n),name:v$}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{}}}function w$(n,t){return[...n.tabs[_e(t)]??[]]}function S$(n,t,e){const r=_e(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function _$(n,t,e){const r=_e(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 k$(n,t,e=Date.now()){const r=n.screens[t]??{scrollPosition:0};return{...n,screens:{...n.screens,[t]:{...r,lastActivatedAt:e}}}}var kr,xr,Er;class x$ extends zt{constructor(e,r,i={}){super();S(this,kr);S(this,xr);S(this,Er);w(this,kr,`${y$}${e}`),w(this,xr,i.storage??E$());const s=l(this,xr).getItem(l(this,kr));s===null?(w(this,Er,r),l(this,xr).setItem(l(this,kr),JSON.stringify(r))):w(this,Er,A$(JSON.parse(s),r))}get(){return l(this,Er)}set(e){w(this,Er,e),l(this,xr).setItem(l(this,kr),JSON.stringify(e)),this.dispatchEvent(new oe("change"))}}kr=new WeakMap,xr=new WeakMap,Er=new WeakMap;function E$(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function A$(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}}class $$ extends Event{constructor(){super("theme-changed")}}const T$=ma(zt);var Ar,rt,$r,qe,On,Mn,ne,gi,iy,ho,sy,oy,ay,ly,Gu,qu,Yu,cy;class I$ extends T${constructor(e){var i;super();S(this,ne);g(this,"id");g(this,"server");S(this,Ar);S(this,rt,new Map);S(this,$r);S(this,qe);S(this,On);S(this,Mn,null);S(this,ho,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&p(this,ne,sy).call(this,r.screen);break;case"artifact-created":r.screenID===this.id&&p(this,ne,oy).call(this,r.artifact);break;case"artifact-updated":p(this,ne,ay).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&p(this,ne,ly).call(this,r.artifactID);break;case"artifact-content-changed":l(this,rt).has(r.artifactID)&&this.dispatchEvent(new i$("artifact-content-changed",{artifactID:r.artifactID}));break;case"theme-changed":this.dispatchEvent(new $$);break}});this.id=e.screen.id,this.server=e.server,w(this,Ar,e.localStore),w(this,$r,e.screen.name),w(this,qe,structuredClone(e.screen.layout));const r=((i=l(this,Ar).get().screens[this.id])==null?void 0:i.scrollPosition)??0;w(this,On,Math.max(0,r)),this.server.addEventListener("server-event",l(this,ho)),p(this,ne,iy).call(this)}get name(){return l(this,$r)}get layout(){return l(this,qe)}get scrollPosition(){return l(this,On)}get artifacts(){return l(this,rt)}setScrollPosition(e){p(this,ne,gi).call(this);const r=Math.max(0,e);r!==l(this,On)&&(w(this,On,r),p(this,ne,cy).call(this),this.dispatchEvent(new oe("change")))}setLayout(e){p(this,ne,gi).call(this);const r=Vv(e);if(!jv(r).valid)return;const s=p(this,ne,qu).call(this);w(this,qe,r),w(this,Mn,{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,Mn))==null?void 0:o.layout)===r&&(w(this,Mn,null),p(this,ne,Yu).call(this,s),this.dispatchEvent(new oe("change")))})}rename(e){p(this,ne,gi).call(this),w(this,$r,e),this.dispatchEvent(new oe("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){p(this,ne,gi).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(p(this,ne,gi).call(this),!l(this,rt).has(e))return;const r=p(this,ne,qu).call(this);p(this,ne,Gu).call(this,e),this.dispatchEvent(new oe("change")),this.server.client.artifacts.delete({artifactID:e}).catch(()=>{this.disposed||(p(this,ne,Yu).call(this,r),this.dispatchEvent(new oe("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,ho))}}Ar=new WeakMap,rt=new WeakMap,$r=new WeakMap,qe=new WeakMap,On=new WeakMap,Mn=new WeakMap,ne=new WeakSet,gi=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},iy=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,rt).set(r.id,r);this.dispatchEvent(new oe("change"))}catch{}},ho=new WeakMap,sy=function(e){l(this,Mn)&&w(this,Mn,null),w(this,$r,e.name),w(this,qe,structuredClone(e.layout)),this.dispatchEvent(new oe("change"))},oy=function(e){tl({layout:l(this,qe)}).includes(e.id)||w(this,qe,[...l(this,qe),ty(e.id)]),l(this,rt).set(e.id,e),this.dispatchEvent(new oe("change"))},ay=function(e){const r=l(this,rt).get(e.id);r&&(l(this,rt).set(e.id,{...r,...e}),this.dispatchEvent(new oe("change")))},ly=function(e){p(this,ne,Gu).call(this,e)&&this.dispatchEvent(new oe("change"))},Gu=function(e){const r=l(this,rt).delete(e),i=tl({layout:l(this,qe)}).length,s=Bv(l(this,qe),e),o=tl({layout:s}).length;return w(this,qe,s),r||i!==o},qu=function(){return{layout:structuredClone(l(this,qe)),artifacts:new Map([...l(this,rt).entries()].map(([e,r])=>[e,structuredClone(r)]))}},Yu=function(e){w(this,qe,structuredClone(e.layout)),l(this,rt).clear();for(const[r,i]of e.artifacts)l(this,rt).set(r,structuredClone(i))},cy=function(){const e=l(this,Ar).get();l(this,Ar).set({...e,screens:{...e.screens,[this.id]:{...e.screens[this.id],scrollPosition:l(this,On)}}})};const C$=ma(zt);var Pe,Ye,Bt,po,fo,go,Je,nl,Ku,mi;class R$ extends C${constructor(e){super();S(this,Je);S(this,Pe);S(this,Ye);S(this,Bt,null);S(this,po,()=>{this.disposed||p(this,Je,nl).call(this)});S(this,fo,()=>{this.disposed||p(this,Je,nl).call(this)});S(this,go,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===_e(e.serverURL)&&i.activeScreenID===r.screenID&&p(this,Je,mi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){p(this,Je,mi).call(this,e.serverURL,null);return}const i=l(this,Ye).servers.get(_e(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),p(this,Je,mi).call(this,e.serverURL,r.screenID)}});w(this,Pe,e.localStore),w(this,Ye,e.serverManager),l(this,Pe).addEventListener("change",l(this,po)),l(this,Ye).addEventListener("change",l(this,fo)),l(this,Ye).addEventListener("server-event",l(this,go)),p(this,Je,nl).call(this)}get activeScreen(){return l(this,Bt)}get screens(){const e=l(this,Pe).get().screens,r=[];let i=0;for(const s of l(this,Ye).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=_e(e),i=w$(l(this,Pe).get(),r),s=l(this,Ye).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=_e(e),s=l(this,Ye).servers.get(i);s&&!s.screens.has(r)||p(this,Je,Ku).call(this,S$(l(this,Pe).get(),i,r))}removeTab(e,r){p(this,Je,Ku).call(this,_$(l(this,Pe).get(),e,r))}setActive(e,r){const i=_e(e),s=l(this,Ye).servers.get(i);!s||!s.screens.has(r)||p(this,Je,mi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Pe).get().activeServerURL;if(!e||!p(this,Je,mi).call(this,e,null))return;const r=l(this,Ye).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Pe).removeEventListener("change",l(this,po)),l(this,Ye).removeEventListener("change",l(this,fo)),l(this,Ye).removeEventListener("server-event",l(this,go)),(e=l(this,Bt))==null||e.dispose(),w(this,Bt,null)}}Pe=new WeakMap,Ye=new WeakMap,Bt=new WeakMap,po=new WeakMap,fo=new WeakMap,go=new WeakMap,Je=new WeakSet,nl=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Pe).get(),i=e?l(this,Ye).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,Bt))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,Bt))==null?void 0:u.server)===i||((h=l(this,Bt))==null||h.dispose(),w(this,Bt,i&&s?new I$({screen:s,server:i,localStore:l(this,Pe)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new ZA("active-screen-changed")))},Ku=function(e){e!==l(this,Pe).get()&&(l(this,Pe).set(e),this.dispatchEvent(new WA("tabs-changed")))},mi=function(e,r){const i=_e(e),s=l(this,Pe).get();if(s.activeServerURL===i&&s.activeScreenID===r)return!1;const o=r===null?{...s,activeServerURL:i,activeScreenID:r}:k$({...s,activeServerURL:i,activeScreenID:r},r);return l(this,Pe).set(o),!0};const uy="0123456789ABCDEFGHJKMNPQRSTVWXYZ",$l=32,P$=16,hy=10,pg=0xffffffffffff;var wr;(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"})(wr||(wr={}));class Fs extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function D$(n){const t=Math.floor(n()*$l)%$l;return uy.charAt(t)}function L$(n){const t=z$(),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 Fs(wr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function z$(){return N$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function O$(n,t){let e="";for(;n>0;n--)e=D$(t)+e;return e}function M$(n,t=hy){if(isNaN(n))throw new Fs(wr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>pg)throw new Fs(wr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${pg}: ${n}`);if(n<0)throw new Fs(wr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Fs(wr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%$l,r=uy.charAt(e)+r,n=(n-e)/$l;return r}function N$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Dd(n,t){const e=L$(),r=Date.now();return M$(r,hy)+O$(P$,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 Ci extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class dy extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const py={};function Jn(n){return py}function fy(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 Ju(n,t){return typeof t=="bigint"?t.toString():t}function hc(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ld(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 U$(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 fg=Symbol("evaluating");function ee(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==fg)return r===void 0&&(r=fg,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Qr(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function rr(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function gg(n){return JSON.stringify(n)}function F$(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const gy="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function oo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const H$=hc(()=>{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 ls(n){if(oo(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(oo(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function my(n){return ls(n)?{...n}:Array.isArray(n)?[...n]:n}const Z$=new Set(["string","number","symbol"]);function cs(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ir(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 W$(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const V$={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 B$(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=rr(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 Qr(this,"shape",o),o},checks:[]});return ir(n,s)}function j$(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=rr(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 Qr(this,"shape",o),o},checks:[]});return ir(n,s)}function G$(n,t){if(!ls(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=rr(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Qr(this,"shape",s),s}});return ir(n,i)}function q$(n,t){if(!ls(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=rr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Qr(this,"shape",r),r}});return ir(n,e)}function Y$(n,t){const e=rr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Qr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ir(n,e)}function K$(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=rr(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 Qr(this,"shape",c),c},checks:[]});return ir(t,o)}function J$(n,t,e){const r=rr(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 Qr(this,"shape",s),s}});return ir(t,r)}function Ai(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 $i(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Na(n){return typeof n=="string"?n:n==null?void 0:n.message}function Xn(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Na((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Na((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??Na((c=e.customError)==null?void 0:c.call(e,n))??Na((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 Od(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ao(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const vy=(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,Ju,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},yy=A("$ZodError",vy),by=A("$ZodError",vy,{Parent:Error});function X$(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 Q$(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 Md=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 Ci;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>Xn(c,s,Jn())));throw gy(a,i==null?void 0:i.callee),a}return o.value},Nd=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=>Xn(c,s,Jn())));throw gy(a,i==null?void 0:i.callee),a}return o.value},dc=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 Ci;return s.issues.length?{success:!1,error:new(n??yy)(s.issues.map(o=>Xn(o,i,Jn())))}:{success:!0,data:s.value}},eT=dc(by),pc=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=>Xn(o,i,Jn())))}:{success:!0,data:s.value}},tT=pc(by),nT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Md(n)(t,e,i)},rT=n=>(t,e,r)=>Md(n)(t,e,r),iT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Nd(n)(t,e,i)},sT=n=>async(t,e,r)=>Nd(n)(t,e,r),oT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return dc(n)(t,e,i)},aT=n=>(t,e,r)=>dc(n)(t,e,r),lT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pc(n)(t,e,i)},cT=n=>async(t,e,r)=>pc(n)(t,e,r),uT=/^[cC][^\s-]{8,}$/,hT=/^[0-9a-z]+$/,dT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pT=/^[0-9a-vA-V]{20}$/,fT=/^[A-Za-z0-9]{27}$/,gT=/^[a-zA-Z0-9_-]{21}$/,mT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vT=/^([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})$/,mg=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)$/,yT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wT(){return new RegExp(bT,"u")}const ST=/^(?:(?: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])$/,_T=/^(([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}|:))$/,kT=/^((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])$/,xT=/^(([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])$/,ET=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wy=/^[A-Za-z0-9_-]*$/,AT=/^\+[1-9]\d{6,14}$/,Sy="(?:(?:\\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])))",$T=new RegExp(`^${Sy}$`);function _y(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 TT(n){return new RegExp(`^${_y(n)}$`)}function IT(n){const t=_y({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(`^${Sy}T(?:${r})$`)}const CT=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}$`)},RT=/^-?\d+$/,ky=/^-?\d+(?:\.\d+)?$/,PT=/^(?:true|false)$/i,DT=/^[^A-Z]*$/,LT=/^[^a-z]*$/,ct=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),xy={number:"number",bigint:"bigint",object:"date"},Ey=A("$ZodCheckLessThan",(n,t)=>{ct.init(n,t);const e=xy[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})}}),Ay=A("$ZodCheckGreaterThan",(n,t)=>{ct.init(n,t);const e=xy[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})}}),zT=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):U$(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})}}),OT=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]=V$[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=RT)}),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})}}),MT=A("$ZodCheckMaxLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Ld(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=Od(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),NT=A("$ZodCheckMinLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Ld(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=Od(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),UT=A("$ZodCheckLengthEquals",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Ld(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=Od(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})}}),fc=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=()=>{})}),FT=A("$ZodCheckRegex",(n,t)=>{fc.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})}}),HT=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=DT),fc.init(n,t)}),ZT=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=LT),fc.init(n,t)}),WT=A("$ZodCheckIncludes",(n,t)=>{ct.init(n,t);const e=cs(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})}}),VT=A("$ZodCheckStartsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`^${cs(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})}}),BT=A("$ZodCheckEndsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`.*${cs(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})}}),jT=A("$ZodCheckOverwrite",(n,t)=>{ct.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class GT{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 Ra(n,t){var e=Vu(n),r=[];if(e){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=yn(n,i)?t(n[i],n):""}var s=typeof nu=="function"?nu(n):[],o;if(as){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)yn(n,c)&&(e&&String(Number(c))===c&&c<n.length||as&&o["$"+c]instanceof Symbol||(hv.call(/[^\w$]/,c)?r.push(t(c,n)+": "+t(n[c],n)):r.push(c+": "+t(n[c],n))));if(typeof nu=="function")for(var u=0;u<s.length;u++)dv.call(n,s[u])&&r.push("["+t(s[u])+"]: "+t(n[s[u]],n));return r}var rE=vs,iE=K,ac=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},sE=function(n,t){if(n){var e=ac(n,t);return e&&e.value}},oE=function(n,t,e){var r=ac(n,t);r?r.value=e:n.next={key:t,next:n.next,value:e}},aE=function(n,t){return n?!!ac(n,t):!1},lE=function(n,t){if(n)return ac(n,t,!0)},cE=function(){var t,e={assert:function(r){if(!e.has(r))throw new iE("Side channel does not contain "+rE(r))},delete:function(r){var i=t&&t.next,s=lE(t,r);return s&&i&&i===s&&(t=void 0),!!s},get:function(r){return sE(t,r)},has:function(r){return aE(t,r)},set:function(r,i){t||(t={next:void 0}),oE(t,r,i)}};return e},uE=kt,da=tr(),hE=vs,dE=K,Pf=uE("%Map%",!0),pE=da("Map.prototype.get",!0),fE=da("Map.prototype.set",!0),gE=da("Map.prototype.has",!0),mE=da("Map.prototype.delete",!0),vE=da("Map.prototype.size",!0),yv=!!Pf&&function(){var t,e={assert:function(r){if(!e.has(r))throw new dE("Side channel does not contain "+hE(r))},delete:function(r){if(t){var i=mE(t,r);return vE(t)===0&&(t=void 0),i}return!1},get:function(r){if(t)return pE(t,r)},has:function(r){return t?gE(t,r):!1},set:function(r,i){t||(t=new Pf),fE(t,r,i)}};return e},yE=kt,lc=tr(),bE=vs,Pa=yv,wE=K,ci=yE("%WeakMap%",!0),SE=lc("WeakMap.prototype.get",!0),_E=lc("WeakMap.prototype.set",!0),kE=lc("WeakMap.prototype.has",!0),xE=lc("WeakMap.prototype.delete",!0),EE=ci?function(){var t,e,r={assert:function(i){if(!r.has(i))throw new wE("Side channel does not contain "+bE(i))},delete:function(i){if(ci&&i&&(typeof i=="object"||typeof i=="function")){if(t)return xE(t,i)}else if(Pa&&e)return e.delete(i);return!1},get:function(i){return ci&&i&&(typeof i=="object"||typeof i=="function")&&t?SE(t,i):e&&e.get(i)},has:function(i){return ci&&i&&(typeof i=="object"||typeof i=="function")&&t?kE(t,i):!!e&&e.has(i)},set:function(i,s){ci&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new ci),_E(t,i,s)):Pa&&(e||(e=Pa()),e.set(i,s))}};return r}:Pa,AE=K,$E=vs,TE=cE,IE=yv,CE=EE,RE=CE||IE||TE,PE=function(){var t,e={assert:function(r){if(!e.has(r))throw new AE("Side channel does not contain "+$E(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=RE()),t.set(r,i)}};return e},DE=In,Is=PE(),fn=K,bd={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(Is.assert(n),!bd.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=Is.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=Is.get(n);return!!e&&DE(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=Is.get(n);r||(r={},Is.set(n,r)),r["$"+t]=e}};Object.freeze&&Object.freeze(bd);var wd=bd,bv=$n,Yn=wd,pa=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 bv('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Yn.set(this,"[[Type]]",t),Yn.set(this,"[[Value]]",e)};pa.prototype.type=function(){return Yn.get(this,"[[Type]]")};pa.prototype.value=function(){return Yn.get(this,"[[Value]]")};pa.prototype["?"]=function(){var t=Yn.get(this,"[[Type]]"),e=Yn.get(this,"[[Value]]");if(t==="throw")throw e;return e};pa.prototype["!"]=function(){var t=Yn.get(this,"[[Type]]");if(t!=="normal")throw new bv('Assertion failed: Completion Record is not of type "normal"');return Yn.get(this,"[[Value]]")};var Sd=pa,LE=Sd,_d=function(t){return new LE("normal",t)},iu,Df;function zE(){if(Df)return iu;Df=1;var n=ps;return iu=function(){return n()&&!!Symbol.toStringTag},iu}var OE=kt,Lf=OE("%Object.defineProperty%",!0),ME=zE()(),NE=In,UE=K,Da=ME?Symbol.toStringTag:null,wv=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 UE("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Da&&(r||!NE(t,Da))&&(Lf?Lf(t,Da,{configurable:!i,enumerable:!1,value:e,writable:!1}):t[Da]=e)},Sv={exports:{}},FE=kt,zf=Fm,HE=ic(),Of=ds,Mf=K,ZE=FE("%Math.floor%"),WE=function(t,e){if(typeof t!="function")throw new Mf("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||ZE(e)!==e)throw new Mf("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in t&&Of){var o=Of(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(HE?zf(t,"length",e,!0,!0):zf(t,"length",e)),t},VE=aa,jE=cd,BE=Jm,GE=function(){return BE(VE,jE,arguments)};(function(n){var t=WE,e=oa,r=sc,i=GE;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})(Sv);var kd=Sv.exports,qE=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0},YE=Object,KE=function(t){return t&&typeof t=="object"&&(typeof t["[[ResourceValue]]"]>"u"||YE(t["[[ResourceValue]]"])===t["[[ResourceValue]]"])&&(t["[[Hint]]"]==="SYNC-DISPOSE"||t["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof t["[[DisposeMethod]]"]=="function"||typeof t["[[DisposeMethod]]"]>"u")},JE=In,XE=ud(),QE=qE,e1=KE,t1=function(t){return t&&typeof t=="object"&&JE(t,"[[DisposableResourceStack]]")&&XE(t["[[DisposableResourceStack]]"])&&(t["[[DisposableResourceStack]]"].length===0||QE(t["[[DisposableResourceStack]]"],e1))},n1=Tn,r1=function(t){if(t===null)return"Null";if(typeof t>"u")return"Undefined";if(n1(t))return"Object";if(typeof t=="number")return"Number";if(typeof t=="boolean")return"Boolean";if(typeof t=="string")return"String"},i1=r1,xd=function(t){return typeof t=="symbol"?"Symbol":typeof t=="bigint"?"BigInt":i1(t)},s1=K,o1=vs,a1=gs,l1=function(t,e){if(!a1(e))throw new s1("Assertion failed: P is not a Property Key, got "+o1(e));return t[e]},Nf=K,c1=l1,u1=ms,h1=gs,Uf=vs,d1=function(t,e){if(!h1(e))throw new Nf("Assertion failed: P is not a Property Key");var r=c1(t,e);if(r!=null){if(!u1(r))throw new Nf(Uf(e)+" is not a function: "+Uf(r));return r}},Bu={exports:{}},p1=kt,f1=p1,Ff=f1("%Reflect.construct%",!0),El=ha;try{El({},"",{"[[Get]]":function(){}})}catch{El=null}if(El&&Ff){var Hf={},Zf={};El(Zf,"length",{"[[Get]]":function(){throw Hf},"[[Enumerable]]":!0}),Bu.exports=function(t){try{Ff(t,Zf)}catch(e){return e===Hf}}}else Bu.exports=function(t){return typeof t=="function"&&!!t.prototype};var g1=Bu.exports,su=K,Wf=ms,m1=g1,v1=function(t){if(!m1(t))throw new su("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 su("executor has already been called");e["[[Resolve]]"]=i,e["[[Reject]]"]=s});if(!Wf(e["[[Resolve]]"])||!Wf(e["[[Reject]]"]))throw new su("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":e["[[Resolve]]"],"[[Reject]]":e["[[Reject]]"]}},Vf=$n,y1=K,ou=oc,jf=d1,b1=v1,w1=xd,Bf=fd(),Gf=gd(),S1=function(t,e){if(w1(t)!=="Object")throw new y1("`V` must be an Object");if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new Vf("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(e==="ASYNC-DISPOSE"&&Gf&&(r=jf(t,Gf)),!r){if(!Bf)throw new Vf("`Symbol.dispose` is not supported");if(r=jf(t,Bf),typeof r<"u")return function(){var i=this;if(e==="ASYNC-DISPOSE"){var s=b1(Promise);try{ou(r,i),ou(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}ou(r,i)}}return r},_1=$n,au=K,k1=ms,x1=xd,E1=S1,A1=function(t,e){if(e!=="SYNC-DISPOSE"&&e!=="ASYNC-DISPOSE")throw new _1("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"&&x1(t)!=="Object")throw new au("`V` must be an Object, or `null` or `undefined`");if(r=E1(t,e),typeof r>"u")throw new au("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!k1(r))throw new au("`method`, when provided, must be a function");return{"[[ResourceValue]]":t,"[[Hint]]":e,"[[DisposeMethod]]":r}},$1=$n,La=K,T1=t1,qf=A1,I1=tr(),C1=I1("Array.prototype.push"),_v=function(t,e,r){if(!T1(t))throw new La("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new $1("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 La("Assertion failed: `method`, when present, must be a function");if(!t["[[DisposableResourceStack]]"])throw new La("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(e==null&&r==="SYNC_DISPOSE")return"UNUSED";s=qf(e,r)}else{if(typeof e<"u")throw new La("Assertion failed: `V` must be undefined when `method` is present");s=qf(void 0,r,i)}return C1(t["[[DisposableResourceStack]]"],s),"UNUSED"},lu,Yf;function Ed(){if(Yf)return lu;Yf=1;var n=kt,t=kd,e=$n,r=n("%Promise.resolve%",!0),i=r&&t(r);return lu=function(o,a){if(!i)throw new e("This environment does not support Promises.");return i(o,a)},lu}var cu,Kf;function R1(){if(Kf)return cu;Kf=1;var n=kt,t=$n,e=n("%Promise%",!0),r=oc,i=Ed(),s=xd;return cu=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)},cu}var uu,Jf;function P1(){if(Jf)return uu;Jf=1;var n=Sd;return uu=function(e){return new n("throw",e)},uu}var D1=kt,hu=$n,Xf=K,L1=D1("%Promise%",!0),z1=tr(),Qf=z1("Promise.prototype.then",!0),O1=Sd,eg=R1(),M1=_d,N1=Ed(),tg=P1(),U1=uv(),kv=function(t,e){if(!(e instanceof O1))throw new Xf("`completion` must be a Completion Record");var r=t["[[DisposableResourceStack]]"];if(!r)throw new Xf("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 hu("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&N1(L1,e),a=function(y){if(e.type()==="throw"){var m=e.value(),E=new U1(y,m);e=tg(E)}else e=tg(y)},c=i==="ASYNC-DISPOSE"&&function(m){return Qf(o,function(){var E=eg(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!E)throw new hu("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return Qf(E,M1)},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=eg(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(f)throw new hu("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){a(y)}}return t["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:e},xv=function(){var t=[];return{"[[DisposableResourceStack]]":t}},cc=sd,Ad=K,F1=oc,ys=dd,H1=ha,Ev=ms,Z1=_d,at=wd,W1=wv,Av=Jr.supportsDescriptors,V1=kd,$d=_v,j1=kv,$v=xv,ng=fd(),bt=function n(){if(!(this instanceof n)||at.has(this,"[[DisposableState]]")||at.has(this,"[[DisposeCapability]]"))throw new Ad("can only be used with new");at.set(this,"[[DisposableState]]","PENDING"),at.set(this,"[[DisposeCapability]]",$v())},Tv=function(){var t=this;return at.assert(t,"[[DisposableState]]"),at.get(t,"[[DisposableState]]")==="DISPOSED"},fa=V1(Tv);Av?H1(bt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Tv}):bt.prototype.disposed=!1;var Iv=function(t){at.set(t,"[[DisposableState]]","DISPOSED"),Av||(t.disposed=!0)};ys(bt.prototype,"dispose",function(){var t=this;if(!fa(t))return Iv(t),j1(at.get(t,"[[DisposeCapability]]"),Z1())["?"]()});ys(bt.prototype,"use",function(t){var e=this;if(fa(e))throw new cc("a disposed stack can not use anything new");return $d(at.get(e,"[[DisposeCapability]]"),t,"SYNC-DISPOSE"),t});ys(bt.prototype,"adopt",function(t,e){var r=this;if(fa(r))throw new cc("a disposed stack can not use anything new");if(!Ev(e))throw new Ad("`onDispose` must be a function");var i=function(){return F1(e,void 0,[t])};return $d(at.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),t});ys(bt.prototype,"defer",function(t){var e=this;if(fa(e))throw new cc("a disposed stack can not defer anything new");if(!Ev(t))throw new Ad("`onDispose` must be a function");$d(at.get(e,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",t)});ys(bt.prototype,"move",function(){var t=this;if(fa(t))throw new cc("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]]",$v()),Iv(t),e});ng&&ys(bt.prototype,ng,bt.prototype.dispose);W1(bt.prototype,"DisposableStack");var B1=bt,G1=B1,q1=function(){return typeof DisposableStack=="function"?DisposableStack:G1},Y1=Jr,K1=rd(),J1=q1,X1=function(){var t=J1();return Y1(K1,{DisposableStack:t},{DisposableStack:!0}),t},Q1=kt,uc=sd,Td=K,rg=Q1("%Promise%",!0),Id=_v,eA=oc,bs=dd,tA=ha,nA=kv,Cv=ms,Rv=xv,rA=_d,ig=Ed(),lt=wd,iA=wv,Pv=Jr.supportsDescriptors,sA=kd,oA=tr(),aA=oA("Promise.prototype.then",!0),sg=gd(),wt=function n(){if(!(this instanceof n)||lt.has(this,"[[AsyncDisposableState]]")||lt.has(this,"[[DisposeCapability]]"))throw new Td("can only be used with new");lt.set(this,"[[AsyncDisposableState]]","pending"),lt.set(this,"[[DisposeCapability]]",Rv())},Dv=function(){var t=this;return lt.assert(t,"[[AsyncDisposableState]]"),lt.get(t,"[[AsyncDisposableState]]")==="disposed"},ga=sA(Dv);Pv?tA(wt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Dv}):wt.prototype.disposed=!1;var Lv=function(t){lt.set(t,"[[AsyncDisposableState]]","disposed"),Pv||(t.disposed=!0)};bs(wt.prototype,"disposeAsync",function(){var t=this;return ga(t)?ig(rg):(Lv(t),aA(ig(rg,nA(lt.get(t,"[[DisposeCapability]]"),rA())),function(e){return e["?"]()}))});bs(wt.prototype,"use",function(t){var e=this;if(ga(e))throw new uc("a disposed stack can not use anything new");return Id(lt.get(e,"[[DisposeCapability]]"),t,"ASYNC-DISPOSE"),t});bs(wt.prototype,"adopt",function(t,e){var r=this;if(ga(r))throw new uc("a disposed stack can not use anything new");if(!Cv(e))throw new Td("`onDisposeAsync` must be a function");var i=function(){return eA(e,void 0,[t])};return i.value=t,Id(lt.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),t});bs(wt.prototype,"defer",function(t){var e=this;if(ga(e))throw new uc("a disposed stack can not defer anything new");if(!Cv(t))throw new Td("`onDispose` must be a function");Id(lt.get(e,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",t)});bs(wt.prototype,"move",function(){var t=this;if(ga(t))throw new uc("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]]",Rv()),Lv(t),e});sg&&bs(wt.prototype,sg,wt.prototype.disposeAsync);iA(wt.prototype,"AsyncDisposableStack");var lA=wt,cA=lA,uA=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:cA},hA=Jr,dA=rd(),pA=uA,fA=function(){var t=pA();return hA(dA,{AsyncDisposableStack:t},{AsyncDisposableStack:!0}),t},gA=hx,mA=bx,vA=X1,yA=fA,bA=function(){gA(),mA(),vA(),yA()};bA();const og=new WeakMap;function wA(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function ui(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function ag(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function SA(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class _A{constructor(){g(this,"entries",new Map);g(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw ag();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw ag();if(e.constructor.name==="AsyncFunction")throw SA();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=og.get(t);if(e){if(t.length!==e.length)throw new Error(`${ui(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(`${ui(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=og.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(`${ui(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=>ui(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(wA(r))throw new Error(`Factory for ${ui(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${ui(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 _A,kA=.5,lg=.1,cg=8,xA=4,zv=3,Ov=3,EA=4,yr=255,Mv=.2126,Nv=.7152,Uv=.0722;async function Fv(n){const t=AA(n);if(!t)return"light";try{return await IA(n,t)>=kA?"light":"dark"}catch{return"light"}}function AA(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($A(o))return s}return null}function $A(n){return Hv(n.backgroundImage)?!0:TA(n.backgroundColor)>0}function TA(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===EA?parseFloat(e[zv]):e.length===Ov?1:0}async function IA(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:za((e.left-r.left)/r.width),y:za((e.top-r.top)/r.height),width:za(e.width/r.width),height:za(e.height/r.height)},s=window.getComputedStyle(t),o=Hv(s.backgroundImage);return o?RA({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):PA(s.backgroundColor)}function Hv(n){const t=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return t?t[1]:null}const ug=new Map;function CA(n){let t=ug.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}),ug.set(n,t),t)}async function RA(n){const t=await CA(n.url),e=Math.max(cg,Math.ceil(n.surfaceWidth*lg)),r=Math.max(cg,Math.ceil(n.surfaceHeight*lg)),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+=xA){const N=I[V]/yr,F=I[V+1]/yr,Y=I[V+2]/yr,B=I[V+zv]/yr;P+=B*(Mv*N+Nv*F+Uv*Y),R+=1}return R>0?P/R:1}function PA(n){const t=n.match(/rgba?\(([^)]+)\)/);if(!t)return 1;const e=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(e.length<Ov)return 1;const r=e[0]/yr,i=e[1]/yr,s=e[2]/yr;return Mv*r+Nv*i+Uv*s}function za(n){return n<0?0:n>1?1:n}const DA=["ghost","glass"],ro=[...DA.map(n=>`[variant="${n}"]`),'[material="glass"]'].join(", "),Oa=new WeakSet,hg=new WeakSet;function Zv(n){if(hg.has(n))return;hg.add(n);for(const e of n.querySelectorAll(ro))du(e);if(typeof MutationObserver!="function")return;new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const i of r.addedNodes)LA(i,du);else r.type==="attributes"&&r.target instanceof HTMLElement&&r.target.matches(ro)&&du(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant","material"]})}function LA(n,t){if(n instanceof Element){n instanceof HTMLElement&&n.matches(ro)&&t(n);for(const e of n.querySelectorAll(ro))t(e)}}async function du(n){var e,r;if(Oa.has(n)||n.hasAttribute("tone")||(e=n.parentElement)!=null&&e.closest("[tone]"))return;Oa.add(n);const t=await Fv(n);if(!n.matches(ro)){Oa.delete(n);return}if(n.hasAttribute("tone")||(r=n.parentElement)!=null&&r.closest("[tone]")){Oa.delete(n);return}n.setAttribute("tone",t)}const zA="*,*: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)}',Cd=new CSSStyleSheet;Cd.replaceSync(zA);const Rd=new CSSStyleSheet;try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,Cd,Rd]}catch{}Zv(document);function Wv(n){Rd.replaceSync(n)}function Al(){Wv("")}function Pd(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,Cd,Rd]}catch{}Zv(n)}const OA=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function MA(n){for(const t of Object.keys(n))if(OA.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function NA(n,t){MA(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}),NA(this,c)}}return n}class zt extends globalThis.EventTarget{}function UA(n,t,e){const r=n.dispose.bind(n);n.dispose=()=>{if(!t())return e(),r()}}function ma(n){var e;class t extends n{constructor(...s){super(...s);S(this,e,!1);UA(this,()=>l(this,e),()=>{w(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,e)}}return e=new WeakMap,t}const FA=je(),HA=je(),ZA=je(),el=je(),WA=je(),pu=je(),Ve=4,ft=6,io=2,Gu=2,Dd=8,VA=ft,Ld="auto",Kn="auto",Ln=128,dg=50,ae=16,Vr=Ln*Ve+ae*(Ve-1),so=Ln*ft+ae*(ft-1),jA=Vr+ae*2,BA=200,GA=4,Ma=150,qA=10,pg=2,fg=8,YA=300,KA=4;function Vv(n){return Gv(n)}function jv(n,t){return Gv(n.flatMap(e=>Yv(e,t)))}function Bv(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}Kv(r,"strip",t,e)}return{valid:t.length===0,errors:t}}function br(n){const t=Vv(n),e=Bv(t);if(!e.valid)throw new Error(`Invalid layout: ${e.errors.join("; ")}`);return{totalNodes:t.length,nodes:t.filter(r=>r.type!=="row").map(e$)}}function Gv(n){const t=[];for(const e of n){const r=qv(e);for(const i of r){if(i.type==="row"){t.push(...i.children.map(An));continue}t.push(i)}}return t}function qv(n){switch(n.type){case"card":return[An(n)];case"row":{const t=n.children.map(An);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=[];for(const e of n.children){const r=qv(e);for(const i of r){if(i.type==="stack"){t.push(...i.children.map(qu));continue}if(i.type==="row"){t.push({...i,children:i.children.map(An)});continue}t.push(An(i))}}return t.length===0?[]:t.length===1?[qu(t[0])]:[{...n,children:t}]}}}function Yv(n,t){switch(n.type){case"card":return n.artifactID===t?[]:[An(n)];case"row":{const e=n.children.filter(r=>r.artifactID!==t).map(An);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=n.children.flatMap(r=>Yv(r,t).filter(s=>s.type!=="stack"));return e.length===0?[]:e.length===1?[qu(e[0])]:[{...n,children:e}]}}}function Kv(n,t,e,r){switch(n.type){case"card":Jv(n,t,e,r);return;case"row":JA(n,t,e,r);return;case"stack":XA(n,t,e,r);return}}function Jv(n,t,e,r){"id"in n&&e.push(`Card ${Cs(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),QA(n.width)||e.push(`Card ${Cs(n)} width must be an integer in the range ${io}-${Dd}`),Qv(n.height)||e.push(`Card ${Cs(n)} height must be an integer in the range 2-6 or "auto"`);const i=Ei(n.width);t==="stack"&&i!==Ve&&e.push(`Stack child ${Cs(n)} width must be ${Ve}`),t==="row"&&i<io&&e.push(`Row child ${Cs(n)} must be at least 2 columns wide`)}function Cs(n){return typeof n.artifactID=="string"&&n.artifactID.length>0?n.artifactID:"<missing artifactID>"}function JA(n,t,e,r){if(Xv(n.id,e),t!=="stack"&&e.push(`Row ${n.id} may only appear inside a stack`),Qv(n.height,KA)||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}Jv(s,"row",e,r),i+=Ei(s.width)}i!==Ve&&e.push(`Row ${n.id} children must sum to 4 columns`)}function XA(n,t,e,r){if(Xv(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(Kv(a,"stack",e,r),a.height===Kn){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*Gu||o%s!==0){e.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Gu&&e.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Xv(n,t){(typeof n!="string"||n.length===0)&&t.push(`Node id must be a non-empty string: ${String(n)}`)}function QA(n){return n===Ld||Number.isInteger(n)&&n>=io&&n<=Dd}function Qv(n,t=VA){return n===Kn||Number.isInteger(n)&&n>=Gu&&n<=t}function Ei(n){return n===Ld?Ve:n}function e$(n){if(n.type==="card")return{id:n.artifactID,type:"card",width:Ei(n.width),cards:[{id:n.artifactID,artifactID:n.artifactID,col:1,row:1,width:Ei(n.width),height:ey(n.height,ft)}]};const t=t$(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:Ve,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:Ei(c.width),height:o}),a+=Ei(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 t$(n){let t=0,e=0;for(const i of n)i.height===Kn?e+=1:t+=i.height;const r=e>0?(ft-t)/e:0;return n.map(i=>ey(i.height,r))}function ey(n,t){return n===Kn?t:n}function An(n){return{...n}}function qu(n){return n.type==="card"?An(n):{...n,children:n.children.map(An)}}function ty(n,t={}){return{type:"card",artifactID:n,width:t.width??Ld,height:t.height??Kn}}function tl(n){return n.layout.flatMap(ny)}function ny(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(t=>t.artifactID);case"stack":return n.children.flatMap(ny)}}const oe=je(),Yu=je(),hi=je(),n$=je();function r$(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const zd=r$("RequestError"),i$=200,s$=300;class o${constructor(t,e){g(this,"serverURL");g(this,"token");this.serverURL=t.replace(/\/$/,""),this.token=e.token}async requestJSON(t,e,r){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 a$(i);if(!i.ok||i.status<i$||i.status>=s$)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){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 this.createError(await fu(i,i.statusText),i.status)}async requestText(t,e){const r=await this.request(t,e);if(!r.ok)throw this.createError(await fu(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){const i=await this.request(t,e,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw this.createError(await fu(i,i.statusText),i.status)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new zd(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 a$(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function fu(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 l$(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Vt,Hl,ry;class c${constructor(t){S(this,Hl);S(this,Vt);w(this,Vt,t)}list(){return l(this,Vt).requestJSON("GET","/screens")}async get(t={}){const e=await p(this,Hl,ry).call(this,t.screenID);return l(this,Vt).requestJSON("GET",`/screens/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),l(this,Vt).requestJSON("POST","/screens",e)}update(t){const{screenID:e,...r}=t;return l(this,Vt).requestJSON("PATCH",`/screens/${encodeURIComponent(e)}`,r)}remove(t){return l(this,Vt).requestJSON("DELETE",`/screens/${encodeURIComponent(t.screenID)}`)}}Vt=new WeakMap,Hl=new WeakSet,ry=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,Vt).createError(`screenID is required when multiple screens exist. Available screens: ${l$(e)}`)};var bn;class u${constructor(t){S(this,bn);w(this,bn,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,bn).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,bn).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return l(this,bn).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,bn).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return l(this,bn).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}}bn=new WeakMap;var Di;class h${constructor(t){S(this,Di);w(this,Di,t)}get(t){return l(this,Di).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return l(this,Di).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}Di=new WeakMap;var _r;class d${constructor(t){S(this,_r);w(this,_r,t)}get(){return l(this,_r).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,_r).requestVoid("PATCH","/display",e)}focus(t){return l(this,_r).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}_r=new WeakMap;var wn;class p${constructor(t,e={}){g(this,"screens");g(this,"artifacts");g(this,"display");g(this,"markdown");S(this,wn);w(this,wn,new o$(t,e)),this.screens=new c$(l(this,wn)),this.artifacts=new u$(l(this,wn)),this.display=new d$(l(this,wn)),this.markdown=new h$(l(this,wn))}health(){return l(this,wn).requestJSON("GET","/health")}}wn=new WeakMap;const f$={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},g$="Local",m$="store-";function _e(n){return new URL(n).origin}function v$(n){return{servers:[{url:_e(n),name:g$}],activeServerURL:null,activeScreenID:null,tabs:{},screens:{}}}function y$(n,t){return[...n.tabs[_e(t)]??[]]}function b$(n,t,e){const r=_e(t),i=n.tabs[r]??[];return i.includes(e)?n:{...n,tabs:{...n.tabs,[r]:[...i,e]}}}function w$(n,t,e){const r=_e(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 S$(n,t,e=Date.now()){const r=n.screens[t]??{scrollPosition:0};return{...n,screens:{...n.screens,[t]:{...r,lastActivatedAt:e}}}}var kr,xr,Er;class _$ extends zt{constructor(e,r,i={}){super();S(this,kr);S(this,xr);S(this,Er);w(this,kr,`${m$}${e}`),w(this,xr,i.storage??k$());const s=l(this,xr).getItem(l(this,kr));s===null?(w(this,Er,r),l(this,xr).setItem(l(this,kr),JSON.stringify(r))):w(this,Er,x$(JSON.parse(s),r))}get(){return l(this,Er)}set(e){w(this,Er,e),l(this,xr).setItem(l(this,kr),JSON.stringify(e)),this.dispatchEvent(new oe("change"))}}kr=new WeakMap,xr=new WeakMap,Er=new WeakMap;function k$(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function x$(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}}class E$ extends Event{constructor(){super("theme-changed")}}const A$=ma(zt);var Ar,rt,$r,qe,On,Mn,ne,gi,iy,ho,sy,oy,ay,ly,Ku,Ju,Xu,cy;class $$ extends A${constructor(e){var i;super();S(this,ne);g(this,"id");g(this,"server");S(this,Ar);S(this,rt,new Map);S(this,$r);S(this,qe);S(this,On);S(this,Mn,null);S(this,ho,e=>{if(this.disposed)return;const r=e.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&p(this,ne,sy).call(this,r.screen);break;case"artifact-created":r.screenID===this.id&&p(this,ne,oy).call(this,r.artifact);break;case"artifact-updated":p(this,ne,ay).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&p(this,ne,ly).call(this,r.artifactID);break;case"artifact-content-changed":l(this,rt).has(r.artifactID)&&this.dispatchEvent(new n$("artifact-content-changed",{artifactID:r.artifactID}));break;case"theme-changed":this.dispatchEvent(new E$);break}});this.id=e.screen.id,this.server=e.server,w(this,Ar,e.localStore),w(this,$r,e.screen.name),w(this,qe,structuredClone(e.screen.layout));const r=((i=l(this,Ar).get().screens[this.id])==null?void 0:i.scrollPosition)??0;w(this,On,Math.max(0,r)),this.server.addEventListener("server-event",l(this,ho)),p(this,ne,iy).call(this)}get name(){return l(this,$r)}get layout(){return l(this,qe)}get scrollPosition(){return l(this,On)}get artifacts(){return l(this,rt)}setScrollPosition(e){p(this,ne,gi).call(this);const r=Math.max(0,e);r!==l(this,On)&&(w(this,On,r),p(this,ne,cy).call(this),this.dispatchEvent(new oe("change")))}setLayout(e){p(this,ne,gi).call(this);const r=Vv(e);if(!Bv(r).valid)return;const s=p(this,ne,Ju).call(this);w(this,qe,r),w(this,Mn,{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,Mn))==null?void 0:o.layout)===r&&(w(this,Mn,null),p(this,ne,Xu).call(this,s),this.dispatchEvent(new oe("change")))})}rename(e){p(this,ne,gi).call(this),w(this,$r,e),this.dispatchEvent(new oe("change")),this.server.client.screens.update({screenID:this.id,name:e}).catch(()=>{})}async remove(){p(this,ne,gi).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(e){if(p(this,ne,gi).call(this),!l(this,rt).has(e))return;const r=p(this,ne,Ju).call(this);p(this,ne,Ku).call(this,e),this.dispatchEvent(new oe("change")),this.server.client.artifacts.delete({artifactID:e}).catch(()=>{this.disposed||(p(this,ne,Xu).call(this,r),this.dispatchEvent(new oe("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,ho))}}Ar=new WeakMap,rt=new WeakMap,$r=new WeakMap,qe=new WeakMap,On=new WeakMap,Mn=new WeakMap,ne=new WeakSet,gi=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},iy=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,rt).set(r.id,r);this.dispatchEvent(new oe("change"))}catch{}},ho=new WeakMap,sy=function(e){l(this,Mn)&&w(this,Mn,null),w(this,$r,e.name),w(this,qe,structuredClone(e.layout)),this.dispatchEvent(new oe("change"))},oy=function(e){tl({layout:l(this,qe)}).includes(e.id)||w(this,qe,[...l(this,qe),ty(e.id)]),l(this,rt).set(e.id,e),this.dispatchEvent(new oe("change"))},ay=function(e){const r=l(this,rt).get(e.id);r&&(l(this,rt).set(e.id,{...r,...e}),this.dispatchEvent(new oe("change")))},ly=function(e){p(this,ne,Ku).call(this,e)&&this.dispatchEvent(new oe("change"))},Ku=function(e){const r=l(this,rt).delete(e),i=tl({layout:l(this,qe)}).length,s=jv(l(this,qe),e),o=tl({layout:s}).length;return w(this,qe,s),r||i!==o},Ju=function(){return{layout:structuredClone(l(this,qe)),artifacts:new Map([...l(this,rt).entries()].map(([e,r])=>[e,structuredClone(r)]))}},Xu=function(e){w(this,qe,structuredClone(e.layout)),l(this,rt).clear();for(const[r,i]of e.artifacts)l(this,rt).set(r,structuredClone(i))},cy=function(){const e=l(this,Ar).get();l(this,Ar).set({...e,screens:{...e.screens,[this.id]:{...e.screens[this.id],scrollPosition:l(this,On)}}})};const T$=ma(zt);var Pe,Ye,jt,po,fo,go,Je,nl,Qu,mi;class I$ extends T${constructor(e){super();S(this,Je);S(this,Pe);S(this,Ye);S(this,jt,null);S(this,po,()=>{this.disposed||p(this,Je,nl).call(this)});S(this,fo,()=>{this.disposed||p(this,Je,nl).call(this)});S(this,go,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===_e(e.serverURL)&&i.activeScreenID===r.screenID&&p(this,Je,mi).call(this,e.serverURL,null);return}if(r.type==="screen-changed"){if(r.screenID===null){p(this,Je,mi).call(this,e.serverURL,null);return}const i=l(this,Ye).servers.get(_e(e.serverURL));if(!i||!i.screens.has(r.screenID))return;this.addTab(e.serverURL,r.screenID),p(this,Je,mi).call(this,e.serverURL,r.screenID)}});w(this,Pe,e.localStore),w(this,Ye,e.serverManager),l(this,Pe).addEventListener("change",l(this,po)),l(this,Ye).addEventListener("change",l(this,fo)),l(this,Ye).addEventListener("server-event",l(this,go)),p(this,Je,nl).call(this)}get activeScreen(){return l(this,jt)}get screens(){const e=l(this,Pe).get().screens,r=[];let i=0;for(const s of l(this,Ye).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=_e(e),i=y$(l(this,Pe).get(),r),s=l(this,Ye).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=_e(e),s=l(this,Ye).servers.get(i);s&&!s.screens.has(r)||p(this,Je,Qu).call(this,b$(l(this,Pe).get(),i,r))}removeTab(e,r){p(this,Je,Qu).call(this,w$(l(this,Pe).get(),e,r))}setActive(e,r){const i=_e(e),s=l(this,Ye).servers.get(i);!s||!s.screens.has(r)||p(this,Je,mi).call(this,i,r)&&s.client.display.patch({activeScreenID:r}).catch(()=>{})}clearActive(){const e=l(this,Pe).get().activeServerURL;if(!e||!p(this,Je,mi).call(this,e,null))return;const r=l(this,Ye).servers.get(e);r==null||r.client.display.patch({activeScreenID:null}).catch(()=>{})}dispose(){var e;l(this,Pe).removeEventListener("change",l(this,po)),l(this,Ye).removeEventListener("change",l(this,fo)),l(this,Ye).removeEventListener("server-event",l(this,go)),(e=l(this,jt))==null||e.dispose(),w(this,jt,null)}}Pe=new WeakMap,Ye=new WeakMap,jt=new WeakMap,po=new WeakMap,fo=new WeakMap,go=new WeakMap,Je=new WeakSet,nl=function(){var c,u,h;const{activeServerURL:e,activeScreenID:r}=l(this,Pe).get(),i=e?l(this,Ye).servers.get(e)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,jt))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,jt))==null?void 0:u.server)===i||((h=l(this,jt))==null||h.dispose(),w(this,jt,i&&s?new $$({screen:s,server:i,localStore:l(this,Pe)}):null),i&&i.acpClient.setScreenContext(s?{screenID:s.id,screenName:s.name}:null),this.dispatchEvent(new FA("active-screen-changed")))},Qu=function(e){e!==l(this,Pe).get()&&(l(this,Pe).set(e),this.dispatchEvent(new HA("tabs-changed")))},mi=function(e,r){const i=_e(e),s=l(this,Pe).get();if(s.activeServerURL===i&&s.activeScreenID===r)return!1;const o=r===null?{...s,activeServerURL:i,activeScreenID:r}:S$({...s,activeServerURL:i,activeScreenID:r},r);return l(this,Pe).set(o),!0};const uy="0123456789ABCDEFGHJKMNPQRSTVWXYZ",$l=32,C$=16,hy=10,gg=0xffffffffffff;var wr;(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"})(wr||(wr={}));class Fs extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function R$(n){const t=Math.floor(n()*$l)%$l;return uy.charAt(t)}function P$(n){const t=D$(),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 Fs(wr.PRNGDetectFailure,"Failed to find a reliable PRNG")}function D$(){return O$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function L$(n,t){let e="";for(;n>0;n--)e=R$(t)+e;return e}function z$(n,t=hy){if(isNaN(n))throw new Fs(wr.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>gg)throw new Fs(wr.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${gg}: ${n}`);if(n<0)throw new Fs(wr.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Fs(wr.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%$l,r=uy.charAt(e)+r,n=(n-e)/$l;return r}function O$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Od(n,t){const e=P$(),r=Date.now();return z$(r,hy)+L$(C$,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 Ci extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class dy extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const py={};function Jn(n){return py}function fy(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 eh(n,t){return typeof t=="bigint"?t.toString():t}function hc(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function Md(n){return n==null}function Nd(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function M$(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 mg=Symbol("evaluating");function ee(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==mg)return r===void 0&&(r=mg,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function Qr(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function rr(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function vg(n){return JSON.stringify(n)}function N$(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const gy="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function oo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const U$=hc(()=>{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 ls(n){if(oo(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(oo(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function my(n){return ls(n)?{...n}:Array.isArray(n)?[...n]:n}const F$=new Set(["string","number","symbol"]);function cs(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ir(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 H$(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const Z$={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 W$(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=rr(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 Qr(this,"shape",o),o},checks:[]});return ir(n,s)}function V$(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=rr(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 Qr(this,"shape",o),o},checks:[]});return ir(n,s)}function j$(n,t){if(!ls(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=rr(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return Qr(this,"shape",s),s}});return ir(n,i)}function B$(n,t){if(!ls(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=rr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return Qr(this,"shape",r),r}});return ir(n,e)}function G$(n,t){const e=rr(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return Qr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ir(n,e)}function q$(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=rr(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 Qr(this,"shape",c),c},checks:[]});return ir(t,o)}function Y$(n,t,e){const r=rr(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 Qr(this,"shape",s),s}});return ir(t,r)}function Ai(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 $i(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Na(n){return typeof n=="string"?n:n==null?void 0:n.message}function Xn(n,t,e){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const h=Na((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??Na((a=t==null?void 0:t.error)==null?void 0:a.call(t,n))??Na((c=e.customError)==null?void 0:c.call(e,n))??Na((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 Ud(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ao(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const vy=(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,eh,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},yy=A("$ZodError",vy),by=A("$ZodError",vy,{Parent:Error});function K$(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 J$(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 Fd=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 Ci;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>Xn(c,s,Jn())));throw gy(a,i==null?void 0:i.callee),a}return o.value},Hd=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=>Xn(c,s,Jn())));throw gy(a,i==null?void 0:i.callee),a}return o.value},dc=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 Ci;return s.issues.length?{success:!1,error:new(n??yy)(s.issues.map(o=>Xn(o,i,Jn())))}:{success:!0,data:s.value}},X$=dc(by),pc=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=>Xn(o,i,Jn())))}:{success:!0,data:s.value}},Q$=pc(by),eT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fd(n)(t,e,i)},tT=n=>(t,e,r)=>Fd(n)(t,e,r),nT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Hd(n)(t,e,i)},rT=n=>async(t,e,r)=>Hd(n)(t,e,r),iT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return dc(n)(t,e,i)},sT=n=>(t,e,r)=>dc(n)(t,e,r),oT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pc(n)(t,e,i)},aT=n=>async(t,e,r)=>pc(n)(t,e,r),lT=/^[cC][^\s-]{8,}$/,cT=/^[0-9a-z]+$/,uT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hT=/^[0-9a-vA-V]{20}$/,dT=/^[A-Za-z0-9]{27}$/,pT=/^[a-zA-Z0-9_-]{21}$/,fT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gT=/^([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})$/,yg=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)$/,mT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function yT(){return new RegExp(vT,"u")}const bT=/^(?:(?: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])$/,wT=/^(([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}|:))$/,ST=/^((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])$/,_T=/^(([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])$/,kT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wy=/^[A-Za-z0-9_-]*$/,xT=/^\+[1-9]\d{6,14}$/,Sy="(?:(?:\\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])))",ET=new RegExp(`^${Sy}$`);function _y(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 AT(n){return new RegExp(`^${_y(n)}$`)}function $T(n){const t=_y({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(`^${Sy}T(?:${r})$`)}const TT=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}$`)},IT=/^-?\d+$/,ky=/^-?\d+(?:\.\d+)?$/,CT=/^(?:true|false)$/i,RT=/^[^A-Z]*$/,PT=/^[^a-z]*$/,ct=A("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),xy={number:"number",bigint:"bigint",object:"date"},Ey=A("$ZodCheckLessThan",(n,t)=>{ct.init(n,t);const e=xy[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})}}),Ay=A("$ZodCheckGreaterThan",(n,t)=>{ct.init(n,t);const e=xy[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})}}),DT=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):M$(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})}}),LT=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]=Z$[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=IT)}),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})}}),zT=A("$ZodCheckMaxLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Md(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=Ud(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),OT=A("$ZodCheckMinLength",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Md(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=Ud(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),MT=A("$ZodCheckLengthEquals",(n,t)=>{var e;ct.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!Md(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=Ud(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})}}),fc=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=()=>{})}),NT=A("$ZodCheckRegex",(n,t)=>{fc.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})}}),UT=A("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=RT),fc.init(n,t)}),FT=A("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=PT),fc.init(n,t)}),HT=A("$ZodCheckIncludes",(n,t)=>{ct.init(n,t);const e=cs(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})}}),ZT=A("$ZodCheckStartsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`^${cs(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})}}),WT=A("$ZodCheckEndsWith",(n,t)=>{ct.init(n,t);const e=new RegExp(`.*${cs(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})}}),VT=A("$ZodCheckOverwrite",(n,t)=>{ct.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class jT{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 qT={major:4,minor:3,patch:6},me=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=qT;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=Ai(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 Ci;if(f||E instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await E,a.issues.length!==m&&(h||(h=Ai(a,m)))});else{if(a.issues.length===m)continue;h||(h=Ai(a,m))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if(Ai(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new Ci;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 Ci;return u.then(h=>s(h,r,c))}return s(u,r,c)}}ee(n,"~standard",()=>({validate:s=>{var o;try{const a=eT(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return tT(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}))}),Ud=A("$ZodString",(n,t)=>{var e;me.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??CT(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}}),fe=A("$ZodStringFormat",(n,t)=>{fc.init(n,t),Ud.init(n,t)}),YT=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=vT),fe.init(n,t)}),KT=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=mg(r))}else t.pattern??(t.pattern=mg());fe.init(n,t)}),JT=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=yT),fe.init(n,t)}),XT=A("$ZodURL",(n,t)=>{fe.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})}}}),QT=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=wT()),fe.init(n,t)}),eI=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=gT),fe.init(n,t)}),tI=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=uT),fe.init(n,t)}),nI=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=hT),fe.init(n,t)}),rI=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=dT),fe.init(n,t)}),iI=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=pT),fe.init(n,t)}),sI=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=fT),fe.init(n,t)}),oI=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=IT(t)),fe.init(n,t)}),aI=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=$T),fe.init(n,t)}),lI=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=TT(t)),fe.init(n,t)}),cI=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=mT),fe.init(n,t)}),uI=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=ST),fe.init(n,t),n._zod.bag.format="ipv4"}),hI=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=_T),fe.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})}}}),dI=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=kT),fe.init(n,t)}),pI=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=xT),fe.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 $y(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const fI=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=ET),fe.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{$y(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function gI(n){if(!wy.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return $y(e)}const mI=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=wy),fe.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{gI(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),vI=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=AT),fe.init(n,t)});function yI(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 bI=A("$ZodJWT",(n,t)=>{fe.init(n,t),n._zod.check=e=>{yI(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),Ty=A("$ZodNumber",(n,t)=>{me.init(n,t),n._zod.pattern=n._zod.bag.pattern??ky,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}}),wI=A("$ZodNumberFormat",(n,t)=>{OT.init(n,t),Ty.init(n,t)}),SI=A("$ZodBoolean",(n,t)=>{me.init(n,t),n._zod.pattern=PT,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}}),_I=A("$ZodUnknown",(n,t)=>{me.init(n,t),n._zod.parse=e=>e}),kI=A("$ZodNever",(n,t)=>{me.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function vg(n,t,e){n.issues.length&&t.issues.push(...$i(e,n.issues)),t.value[e]=n.value}const xI=A("$ZodArray",(n,t)=>{me.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=>vg(u,e,o))):vg(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function Tl(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...$i(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function Iy(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=W$(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function Cy(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=>Tl(m,e,f,t,h))):Tl(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 EI=A("$ZodObject",(n,t)=>{me.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=hc(()=>Iy(t));ee(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=oo,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=>Tl(I,a,y,u,E))):Tl(x,a,y,u,E)}return s?Cy(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),AI=A("$ZodObjectJIT",(n,t)=>{EI.init(n,t);const e=n._zod.parse,r=hc(()=>Iy(t)),i=y=>{var V;const m=new GT(["shape","payload","ctx"]),E=r.value,x=N=>{const F=gg(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=gg(N),j=y[N],ce=((V=j==null?void 0:j._zod)==null?void 0:V.optout)==="optional";m.write(`const ${F} = ${x(N)};`),ce?m.write(`
6
+ `))}}const BT={major:4,minor:3,patch:6},me=A("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=BT;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=Ai(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 Ci;if(f||E instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await E,a.issues.length!==m&&(h||(h=Ai(a,m)))});else{if(a.issues.length===m)continue;h||(h=Ai(a,m))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if(Ai(a))return a.aborted=!0,a;const h=s(c,r,u);if(h instanceof Promise){if(u.async===!1)throw new Ci;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 Ci;return u.then(h=>s(h,r,c))}return s(u,r,c)}}ee(n,"~standard",()=>({validate:s=>{var o;try{const a=X$(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Q$(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}))}),Zd=A("$ZodString",(n,t)=>{var e;me.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??TT(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}}),fe=A("$ZodStringFormat",(n,t)=>{fc.init(n,t),Zd.init(n,t)}),GT=A("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=gT),fe.init(n,t)}),qT=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=yg(r))}else t.pattern??(t.pattern=yg());fe.init(n,t)}),YT=A("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=mT),fe.init(n,t)}),KT=A("$ZodURL",(n,t)=>{fe.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})}}}),JT=A("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=yT()),fe.init(n,t)}),XT=A("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=pT),fe.init(n,t)}),QT=A("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=lT),fe.init(n,t)}),eI=A("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=cT),fe.init(n,t)}),tI=A("$ZodULID",(n,t)=>{t.pattern??(t.pattern=uT),fe.init(n,t)}),nI=A("$ZodXID",(n,t)=>{t.pattern??(t.pattern=hT),fe.init(n,t)}),rI=A("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=dT),fe.init(n,t)}),iI=A("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=$T(t)),fe.init(n,t)}),sI=A("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=ET),fe.init(n,t)}),oI=A("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=AT(t)),fe.init(n,t)}),aI=A("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=fT),fe.init(n,t)}),lI=A("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=bT),fe.init(n,t),n._zod.bag.format="ipv4"}),cI=A("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=wT),fe.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})}}}),uI=A("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=ST),fe.init(n,t)}),hI=A("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=_T),fe.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 $y(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const dI=A("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=kT),fe.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{$y(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function pI(n){if(!wy.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return $y(e)}const fI=A("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=wy),fe.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{pI(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),gI=A("$ZodE164",(n,t)=>{t.pattern??(t.pattern=xT),fe.init(n,t)});function mI(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 vI=A("$ZodJWT",(n,t)=>{fe.init(n,t),n._zod.check=e=>{mI(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),Ty=A("$ZodNumber",(n,t)=>{me.init(n,t),n._zod.pattern=n._zod.bag.pattern??ky,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}}),yI=A("$ZodNumberFormat",(n,t)=>{LT.init(n,t),Ty.init(n,t)}),bI=A("$ZodBoolean",(n,t)=>{me.init(n,t),n._zod.pattern=CT,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}}),wI=A("$ZodUnknown",(n,t)=>{me.init(n,t),n._zod.parse=e=>e}),SI=A("$ZodNever",(n,t)=>{me.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function bg(n,t,e){n.issues.length&&t.issues.push(...$i(e,n.issues)),t.value[e]=n.value}const _I=A("$ZodArray",(n,t)=>{me.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=>bg(u,e,o))):bg(c,e,o)}return s.length?Promise.all(s).then(()=>e):e}});function Tl(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...$i(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function Iy(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=H$(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function Cy(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=>Tl(m,e,f,t,h))):Tl(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 kI=A("$ZodObject",(n,t)=>{me.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=hc(()=>Iy(t));ee(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=oo,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=>Tl(I,a,y,u,E))):Tl(x,a,y,u,E)}return s?Cy(h,u,a,c,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),xI=A("$ZodObjectJIT",(n,t)=>{kI.init(n,t);const e=n._zod.parse,r=hc(()=>Iy(t)),i=y=>{var V;const m=new jT(["shape","payload","ctx"]),E=r.value,x=N=>{const F=vg(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=vg(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,28 +37,28 @@ var W0=Object.defineProperty;var Cp=n=>{throw TypeError(n)};var V0=(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=oo,a=!py.jitless,u=a&&H$.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?Cy([],E,y,m,f,n):y):e(y,m):(y.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),y)}});function yg(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=>!Ai(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=>Xn(o,r,Jn())))}),t)}const Ry=A("$ZodUnion",(n,t)=>{me.init(n,t),ee(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ee(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ee(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ee(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=>yg(c,i,n,s)):yg(a,i,n,s)}}),$I=A("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,Ry.init(n,t);const e=n._zod.parse;ee(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=hc(()=>{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(!oo(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)}}),TI=A("$ZodIntersection",(n,t)=>{me.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])=>bg(e,c,u)):bg(e,s,o)}});function Xu(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(ls(n)&&ls(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=Xu(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=Xu(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 bg(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}),Ai(n))return n;const o=Xu(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 II=A("$ZodRecord",(n,t)=>{me.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!ls(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(...$i(u,f.issues)),e.value[u]=f.value})):(h.issues.length&&e.issues.push(...$i(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"&&ky.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=>Xn(f,r,Jn())),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(...$i(a,f.issues)),e.value[c.value]=f.value})):(h.issues.length&&e.issues.push(...$i(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),CI=A("$ZodEnum",(n,t)=>{me.init(n,t);const e=fy(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>Z$.has(typeof i)).map(i=>typeof i=="string"?cs(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}}),RI=A("$ZodLiteral",(n,t)=>{if(me.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"?cs(r):r?cs(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}}),PI=A("$ZodTransform",(n,t)=>{me.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new dy(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 Ci;return e.value=i,e}});function wg(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const Py=A("$ZodOptional",(n,t)=>{me.init(n,t),n._zod.optin="optional",n._zod.optout="optional",ee(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(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=>wg(s,e.value)):wg(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),DI=A("$ZodExactOptional",(n,t)=>{Py.init(n,t),ee(n._zod,"values",()=>t.innerType._zod.values),ee(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),LI=A("$ZodNullable",(n,t)=>{me.init(n,t),ee(n._zod,"optin",()=>t.innerType._zod.optin),ee(n._zod,"optout",()=>t.innerType._zod.optout),ee(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${zd(e.source)}|null)$`):void 0}),ee(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)}),zI=A("$ZodDefault",(n,t)=>{me.init(n,t),n._zod.optin="optional",ee(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=>Sg(s,t)):Sg(i,t)}});function Sg(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const OI=A("$ZodPrefault",(n,t)=>{me.init(n,t),n._zod.optin="optional",ee(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))}),MI=A("$ZodNonOptional",(n,t)=>{me.init(n,t),ee(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=>_g(s,n)):_g(i,n)}});function _g(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 NI=A("$ZodCatch",(n,t)=>{me.init(n,t),ee(n._zod,"optin",()=>t.innerType._zod.optin),ee(n._zod,"optout",()=>t.innerType._zod.optout),ee(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=>Xn(o,r,Jn()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>Xn(s,r,Jn()))},input:e.value}),e.issues=[]),e)}}),UI=A("$ZodPipe",(n,t)=>{me.init(n,t),ee(n._zod,"values",()=>t.in._zod.values),ee(n._zod,"optin",()=>t.in._zod.optin),ee(n._zod,"optout",()=>t.out._zod.optout),ee(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=>Ua(o,t.in,r)):Ua(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Ua(s,t.out,r)):Ua(i,t.out,r)}});function Ua(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const FI=A("$ZodReadonly",(n,t)=>{me.init(n,t),ee(n._zod,"propValues",()=>t.innerType._zod.propValues),ee(n._zod,"values",()=>t.innerType._zod.values),ee(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),ee(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(kg):kg(i)}});function kg(n){return n.value=Object.freeze(n.value),n}const HI=A("$ZodCustom",(n,t)=>{ct.init(n,t),me.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=>xg(s,e,r,n));xg(i,e,r,n)}});function xg(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(ao(i))}}var Eg;class ZI{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 WI(){return new ZI}(Eg=globalThis).__zod_globalRegistry??(Eg.__zod_globalRegistry=WI());const Hs=globalThis.__zod_globalRegistry;function VI(n,t){return new n({type:"string",...O(t)})}function BI(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Ag(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function jI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function GI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function qI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function YI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function KI(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function JI(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function XI(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function QI(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function eC(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function tC(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function nC(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function rC(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function iC(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function sC(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function oC(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function aC(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function lC(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function cC(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function uC(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function hC(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function dC(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function pC(n,t){return new n({type:"string",format:"date",check:"string_format",...O(t)})}function fC(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function gC(n,t){return new n({type:"string",format:"duration",check:"string_format",...O(t)})}function mC(n,t){return new n({type:"number",checks:[],...O(t)})}function vC(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function yC(n,t){return new n({type:"boolean",...O(t)})}function bC(n){return new n({type:"unknown"})}function wC(n,t){return new n({type:"never",...O(t)})}function $g(n,t){return new Ey({check:"less_than",...O(t),value:n,inclusive:!1})}function du(n,t){return new Ey({check:"less_than",...O(t),value:n,inclusive:!0})}function Tg(n,t){return new Ay({check:"greater_than",...O(t),value:n,inclusive:!1})}function pu(n,t){return new Ay({check:"greater_than",...O(t),value:n,inclusive:!0})}function Ig(n,t){return new zT({check:"multiple_of",...O(t),value:n})}function Dy(n,t){return new MT({check:"max_length",...O(t),maximum:n})}function Il(n,t){return new NT({check:"min_length",...O(t),minimum:n})}function Ly(n,t){return new UT({check:"length_equals",...O(t),length:n})}function SC(n,t){return new FT({check:"string_format",format:"regex",...O(t),pattern:n})}function _C(n){return new HT({check:"string_format",format:"lowercase",...O(n)})}function kC(n){return new ZT({check:"string_format",format:"uppercase",...O(n)})}function xC(n,t){return new WT({check:"string_format",format:"includes",...O(t),includes:n})}function EC(n,t){return new VT({check:"string_format",format:"starts_with",...O(t),prefix:n})}function AC(n,t){return new BT({check:"string_format",format:"ends_with",...O(t),suffix:n})}function ws(n){return new jT({check:"overwrite",tx:n})}function $C(n){return ws(t=>t.normalize(n))}function TC(){return ws(n=>n.trim())}function IC(){return ws(n=>n.toLowerCase())}function CC(){return ws(n=>n.toUpperCase())}function RC(){return ws(n=>F$(n))}function PC(n,t,e){return new n({type:"array",element:t,...O(e)})}function DC(n,t,e){return new n({type:"custom",check:"custom",fn:t,...O(e)})}function LC(n){const t=zC(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(ao(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(ao(i))}},n(e.value,e)));return t}function zC(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)??Hs,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"&&Ge(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 Oy(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=oo,a=!py.jitless,u=a&&U$.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?Cy([],E,y,m,f,n):y):e(y,m):(y.issues.push({expected:"object",code:"invalid_type",input:E,inst:n}),y)}});function wg(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=>!Ai(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=>Xn(o,r,Jn())))}),t)}const Ry=A("$ZodUnion",(n,t)=>{me.init(n,t),ee(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ee(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ee(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ee(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=>Nd(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=>wg(c,i,n,s)):wg(a,i,n,s)}}),EI=A("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,Ry.init(n,t);const e=n._zod.parse;ee(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=hc(()=>{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(!oo(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)}}),AI=A("$ZodIntersection",(n,t)=>{me.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])=>Sg(e,c,u)):Sg(e,s,o)}});function th(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(ls(n)&&ls(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=th(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=th(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 Sg(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}),Ai(n))return n;const o=th(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 $I=A("$ZodRecord",(n,t)=>{me.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!ls(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(...$i(u,f.issues)),e.value[u]=f.value})):(h.issues.length&&e.issues.push(...$i(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"&&ky.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=>Xn(f,r,Jn())),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(...$i(a,f.issues)),e.value[c.value]=f.value})):(h.issues.length&&e.issues.push(...$i(a,h.issues)),e.value[c.value]=h.value)}}return s.length?Promise.all(s).then(()=>e):e}}),TI=A("$ZodEnum",(n,t)=>{me.init(n,t);const e=fy(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>F$.has(typeof i)).map(i=>typeof i=="string"?cs(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}}),II=A("$ZodLiteral",(n,t)=>{if(me.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"?cs(r):r?cs(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}}),CI=A("$ZodTransform",(n,t)=>{me.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new dy(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 Ci;return e.value=i,e}});function _g(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const Py=A("$ZodOptional",(n,t)=>{me.init(n,t),n._zod.optin="optional",n._zod.optout="optional",ee(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Nd(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)}}),RI=A("$ZodExactOptional",(n,t)=>{Py.init(n,t),ee(n._zod,"values",()=>t.innerType._zod.values),ee(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),PI=A("$ZodNullable",(n,t)=>{me.init(n,t),ee(n._zod,"optin",()=>t.innerType._zod.optin),ee(n._zod,"optout",()=>t.innerType._zod.optout),ee(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Nd(e.source)}|null)$`):void 0}),ee(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)}),DI=A("$ZodDefault",(n,t)=>{me.init(n,t),n._zod.optin="optional",ee(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=>kg(s,t)):kg(i,t)}});function kg(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const LI=A("$ZodPrefault",(n,t)=>{me.init(n,t),n._zod.optin="optional",ee(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))}),zI=A("$ZodNonOptional",(n,t)=>{me.init(n,t),ee(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=>xg(s,n)):xg(i,n)}});function xg(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 OI=A("$ZodCatch",(n,t)=>{me.init(n,t),ee(n._zod,"optin",()=>t.innerType._zod.optin),ee(n._zod,"optout",()=>t.innerType._zod.optout),ee(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=>Xn(o,r,Jn()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>Xn(s,r,Jn()))},input:e.value}),e.issues=[]),e)}}),MI=A("$ZodPipe",(n,t)=>{me.init(n,t),ee(n._zod,"values",()=>t.in._zod.values),ee(n._zod,"optin",()=>t.in._zod.optin),ee(n._zod,"optout",()=>t.out._zod.optout),ee(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=>Ua(o,t.in,r)):Ua(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Ua(s,t.out,r)):Ua(i,t.out,r)}});function Ua(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const NI=A("$ZodReadonly",(n,t)=>{me.init(n,t),ee(n._zod,"propValues",()=>t.innerType._zod.propValues),ee(n._zod,"values",()=>t.innerType._zod.values),ee(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),ee(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(Eg):Eg(i)}});function Eg(n){return n.value=Object.freeze(n.value),n}const UI=A("$ZodCustom",(n,t)=>{ct.init(n,t),me.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=>Ag(s,e,r,n));Ag(i,e,r,n)}});function Ag(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(ao(i))}}var $g;class FI{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 HI(){return new FI}($g=globalThis).__zod_globalRegistry??($g.__zod_globalRegistry=HI());const Hs=globalThis.__zod_globalRegistry;function ZI(n,t){return new n({type:"string",...O(t)})}function WI(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Tg(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function VI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function jI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function BI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function GI(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function qI(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function YI(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function KI(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function JI(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function XI(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function QI(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function eC(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function tC(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function nC(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function rC(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function iC(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function sC(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function oC(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function aC(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function lC(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function cC(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function uC(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function hC(n,t){return new n({type:"string",format:"date",check:"string_format",...O(t)})}function dC(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function pC(n,t){return new n({type:"string",format:"duration",check:"string_format",...O(t)})}function fC(n,t){return new n({type:"number",checks:[],...O(t)})}function gC(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function mC(n,t){return new n({type:"boolean",...O(t)})}function vC(n){return new n({type:"unknown"})}function yC(n,t){return new n({type:"never",...O(t)})}function Ig(n,t){return new Ey({check:"less_than",...O(t),value:n,inclusive:!1})}function gu(n,t){return new Ey({check:"less_than",...O(t),value:n,inclusive:!0})}function Cg(n,t){return new Ay({check:"greater_than",...O(t),value:n,inclusive:!1})}function mu(n,t){return new Ay({check:"greater_than",...O(t),value:n,inclusive:!0})}function Rg(n,t){return new DT({check:"multiple_of",...O(t),value:n})}function Dy(n,t){return new zT({check:"max_length",...O(t),maximum:n})}function Il(n,t){return new OT({check:"min_length",...O(t),minimum:n})}function Ly(n,t){return new MT({check:"length_equals",...O(t),length:n})}function bC(n,t){return new NT({check:"string_format",format:"regex",...O(t),pattern:n})}function wC(n){return new UT({check:"string_format",format:"lowercase",...O(n)})}function SC(n){return new FT({check:"string_format",format:"uppercase",...O(n)})}function _C(n,t){return new HT({check:"string_format",format:"includes",...O(t),includes:n})}function kC(n,t){return new ZT({check:"string_format",format:"starts_with",...O(t),prefix:n})}function xC(n,t){return new WT({check:"string_format",format:"ends_with",...O(t),suffix:n})}function ws(n){return new VT({check:"overwrite",tx:n})}function EC(n){return ws(t=>t.normalize(n))}function AC(){return ws(n=>n.trim())}function $C(){return ws(n=>n.toLowerCase())}function TC(){return ws(n=>n.toUpperCase())}function IC(){return ws(n=>N$(n))}function CC(n,t,e){return new n({type:"array",element:t,...O(e)})}function RC(n,t,e){return new n({type:"custom",check:"custom",fn:t,...O(e)})}function PC(n){const t=DC(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(ao(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(ao(i))}},n(e.value,e)));return t}function DC(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)??Hs,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"&&Ge(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 Oy(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 My(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:Cl(t,"input",n.processors),output:Cl(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Ge(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 Ge(r.element,e);if(r.type==="set")return Ge(r.valueType,e);if(r.type==="lazy")return Ge(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 Ge(r.innerType,e);if(r.type==="intersection")return Ge(r.left,e)||Ge(r.right,e);if(r.type==="record"||r.type==="map")return Ge(r.keyType,e)||Ge(r.valueType,e);if(r.type==="pipe")return Ge(r.in,e)||Ge(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Ge(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Ge(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Ge(i,e))return!0;return!!(r.rest&&Ge(r.rest,e))}return!1}const OC=(n,t={})=>e=>{const r=zy({...e,processors:t});return Ee(n,r),Oy(r,n),My(r,n)},Cl=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=zy({...i??{},target:s,io:t,processors:e});return Ee(n,o),Oy(o,n),My(o,n)},MC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},NC=(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=MC[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}))])}},UC=(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)},FC=(n,t,e,r)=>{e.type="boolean"},HC=(n,t,e,r)=>{e.not={}},ZC=(n,t,e,r)=>{},WC=(n,t,e,r)=>{const i=n._zod.def,s=fy(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},VC=(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},BC=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},jC=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},GC=(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"]})},qC=(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)},YC=(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},KC=(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},JC=(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)}},XC=(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"}]},QC=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},eR=(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))},tR=(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)))},nR=(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},rR=(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},iR=(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},Ny=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},sR=A("ZodISODateTime",(n,t)=>{oI.init(n,t),ye.init(n,t)});function oR(n){return dC(sR,n)}const aR=A("ZodISODate",(n,t)=>{aI.init(n,t),ye.init(n,t)});function lR(n){return pC(aR,n)}const cR=A("ZodISOTime",(n,t)=>{lI.init(n,t),ye.init(n,t)});function uR(n){return fC(cR,n)}const hR=A("ZodISODuration",(n,t)=>{cI.init(n,t),ye.init(n,t)});function dR(n){return gC(hR,n)}const Uy=(n,t)=>{yy.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>Q$(n,e)},flatten:{value:e=>X$(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,Ju,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,Ju,2)}},isEmpty:{get(){return n.issues.length===0}}})},Cg=A("ZodError",Uy),xt=A("ZodError",Uy,{Parent:Error}),pR=Md(xt),fR=Nd(xt),gR=dc(xt),mR=pc(xt),vR=nT(xt),yR=rT(xt),bR=iT(xt),wR=sT(xt),SR=oT(xt),_R=aT(xt),kR=lT(xt),xR=cT(xt),ve=A("ZodType",(n,t)=>(me.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Cl(n,"input"),output:Cl(n,"output")}}),n.toJSONSchema=OC(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(rr(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)=>ir(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>pR(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>gR(n,e,r),n.parseAsync=async(e,r)=>fR(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>mR(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>vR(n,e,r),n.decode=(e,r)=>yR(n,e,r),n.encodeAsync=async(e,r)=>bR(n,e,r),n.decodeAsync=async(e,r)=>wR(n,e,r),n.safeEncode=(e,r)=>SR(n,e,r),n.safeDecode=(e,r)=>_R(n,e,r),n.safeEncodeAsync=async(e,r)=>kR(n,e,r),n.safeDecodeAsync=async(e,r)=>xR(n,e,r),n.refine=(e,r)=>n.check(mP(e,r)),n.superRefine=e=>n.check(vP(e)),n.overwrite=e=>n.check(ws(e)),n.optional=()=>Dg(n),n.exactOptional=()=>rP(n),n.nullable=()=>Lg(n),n.nullish=()=>Dg(Lg(n)),n.nonoptional=e=>cP(n,e),n.array=()=>z(n),n.or=e=>B([n,e]),n.and=e=>gc(n,e),n.transform=e=>zg(n,tP(e)),n.default=e=>oP(n,e),n.prefault=e=>lP(n,e),n.catch=e=>hP(n,e),n.pipe=e=>zg(n,e),n.readonly=()=>fP(n),n.describe=e=>{const r=n.clone();return Hs.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=Hs.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return Hs.get(n);const r=n.clone();return Hs.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),Fy=A("_ZodString",(n,t)=>{Ud.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(r,i,s)=>NC(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(SC(...r)),n.includes=(...r)=>n.check(xC(...r)),n.startsWith=(...r)=>n.check(EC(...r)),n.endsWith=(...r)=>n.check(AC(...r)),n.min=(...r)=>n.check(Il(...r)),n.max=(...r)=>n.check(Dy(...r)),n.length=(...r)=>n.check(Ly(...r)),n.nonempty=(...r)=>n.check(Il(1,...r)),n.lowercase=r=>n.check(_C(r)),n.uppercase=r=>n.check(kC(r)),n.trim=()=>n.check(TC()),n.normalize=(...r)=>n.check($C(...r)),n.toLowerCase=()=>n.check(IC()),n.toUpperCase=()=>n.check(CC()),n.slugify=()=>n.check(RC())}),ER=A("ZodString",(n,t)=>{Ud.init(n,t),Fy.init(n,t),n.email=e=>n.check(BI(AR,e)),n.url=e=>n.check(KI($R,e)),n.jwt=e=>n.check(hC(ZR,e)),n.emoji=e=>n.check(JI(TR,e)),n.guid=e=>n.check(Ag(Rg,e)),n.uuid=e=>n.check(jI(Fa,e)),n.uuidv4=e=>n.check(GI(Fa,e)),n.uuidv6=e=>n.check(qI(Fa,e)),n.uuidv7=e=>n.check(YI(Fa,e)),n.nanoid=e=>n.check(XI(IR,e)),n.guid=e=>n.check(Ag(Rg,e)),n.cuid=e=>n.check(QI(CR,e)),n.cuid2=e=>n.check(eC(RR,e)),n.ulid=e=>n.check(tC(PR,e)),n.base64=e=>n.check(lC(UR,e)),n.base64url=e=>n.check(cC(FR,e)),n.xid=e=>n.check(nC(DR,e)),n.ksuid=e=>n.check(rC(LR,e)),n.ipv4=e=>n.check(iC(zR,e)),n.ipv6=e=>n.check(sC(OR,e)),n.cidrv4=e=>n.check(oC(MR,e)),n.cidrv6=e=>n.check(aC(NR,e)),n.e164=e=>n.check(uC(HR,e)),n.datetime=e=>n.check(oR(e)),n.date=e=>n.check(lR(e)),n.time=e=>n.check(uR(e)),n.duration=e=>n.check(dR(e))});function d(n){return VI(ER,n)}const ye=A("ZodStringFormat",(n,t)=>{fe.init(n,t),Fy.init(n,t)}),AR=A("ZodEmail",(n,t)=>{JT.init(n,t),ye.init(n,t)}),Rg=A("ZodGUID",(n,t)=>{YT.init(n,t),ye.init(n,t)}),Fa=A("ZodUUID",(n,t)=>{KT.init(n,t),ye.init(n,t)}),$R=A("ZodURL",(n,t)=>{XT.init(n,t),ye.init(n,t)}),TR=A("ZodEmoji",(n,t)=>{QT.init(n,t),ye.init(n,t)}),IR=A("ZodNanoID",(n,t)=>{eI.init(n,t),ye.init(n,t)}),CR=A("ZodCUID",(n,t)=>{tI.init(n,t),ye.init(n,t)}),RR=A("ZodCUID2",(n,t)=>{nI.init(n,t),ye.init(n,t)}),PR=A("ZodULID",(n,t)=>{rI.init(n,t),ye.init(n,t)}),DR=A("ZodXID",(n,t)=>{iI.init(n,t),ye.init(n,t)}),LR=A("ZodKSUID",(n,t)=>{sI.init(n,t),ye.init(n,t)}),zR=A("ZodIPv4",(n,t)=>{uI.init(n,t),ye.init(n,t)}),OR=A("ZodIPv6",(n,t)=>{hI.init(n,t),ye.init(n,t)}),MR=A("ZodCIDRv4",(n,t)=>{dI.init(n,t),ye.init(n,t)}),NR=A("ZodCIDRv6",(n,t)=>{pI.init(n,t),ye.init(n,t)}),UR=A("ZodBase64",(n,t)=>{fI.init(n,t),ye.init(n,t)}),FR=A("ZodBase64URL",(n,t)=>{mI.init(n,t),ye.init(n,t)}),HR=A("ZodE164",(n,t)=>{vI.init(n,t),ye.init(n,t)}),ZR=A("ZodJWT",(n,t)=>{bI.init(n,t),ye.init(n,t)}),Hy=A("ZodNumber",(n,t)=>{Ty.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(r,i,s)=>UC(n,r,i),n.gt=(r,i)=>n.check(Tg(r,i)),n.gte=(r,i)=>n.check(pu(r,i)),n.min=(r,i)=>n.check(pu(r,i)),n.lt=(r,i)=>n.check($g(r,i)),n.lte=(r,i)=>n.check(du(r,i)),n.max=(r,i)=>n.check(du(r,i)),n.int=r=>n.check(Pg(r)),n.safe=r=>n.check(Pg(r)),n.positive=r=>n.check(Tg(0,r)),n.nonnegative=r=>n.check(pu(0,r)),n.negative=r=>n.check($g(0,r)),n.nonpositive=r=>n.check(du(0,r)),n.multipleOf=(r,i)=>n.check(Ig(r,i)),n.step=(r,i)=>n.check(Ig(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 mC(Hy,n)}const WR=A("ZodNumberFormat",(n,t)=>{wI.init(n,t),Hy.init(n,t)});function Pg(n){return vC(WR,n)}const VR=A("ZodBoolean",(n,t)=>{SI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>FC(n,e,r)});function Le(n){return yC(VR,n)}const BR=A("ZodUnknown",(n,t)=>{_I.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ZC()});function _(){return bC(BR)}const jR=A("ZodNever",(n,t)=>{kI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>HC(n,e,r)});function GR(n){return wC(jR,n)}const qR=A("ZodArray",(n,t)=>{xI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>GC(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Il(e,r)),n.nonempty=e=>n.check(Il(1,e)),n.max=(e,r)=>n.check(Dy(e,r)),n.length=(e,r)=>n.check(Ly(e,r)),n.unwrap=()=>n.element});function z(n,t){return PC(qR,n,t)}const Zy=A("ZodObject",(n,t)=>{AI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>qC(n,e,r,i),ee(n,"shape",()=>t.shape),n.keyof=()=>By(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:GR()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>G$(n,e),n.safeExtend=e=>q$(n,e),n.merge=e=>Y$(n,e),n.pick=e=>B$(n,e),n.omit=e=>j$(n,e),n.partial=(...e)=>K$(jy,n,e[0]),n.required=(...e)=>J$(Gy,n,e[0])});function Wy(n,t){const e={type:"object",shape:n??{},...O(t)};return new Zy(e)}function v(n,t){return new Zy({type:"object",shape:n,catchall:_(),...O(t)})}const Vy=A("ZodUnion",(n,t)=>{Ry.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>YC(n,e,r,i),n.options=t.options});function B(n,t){return new Vy({type:"union",options:n,...O(t)})}const YR=A("ZodDiscriminatedUnion",(n,t)=>{Vy.init(n,t),$I.init(n,t)});function KR(n,t,e){return new YR({type:"union",options:t,discriminator:n,...O(e)})}const JR=A("ZodIntersection",(n,t)=>{TI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>KC(n,e,r,i)});function gc(n,t){return new JR({type:"intersection",left:n,right:t})}const XR=A("ZodRecord",(n,t)=>{II.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>JC(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function k(n,t,e){return new XR({type:"record",keyType:n,valueType:t,...O(e)})}const Qu=A("ZodEnum",(n,t)=>{CI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(r,i,s)=>WC(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 Qu({...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 Qu({...t,checks:[],...O(i),entries:s})}});function By(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Qu({type:"enum",entries:e,...O(t)})}const QR=A("ZodLiteral",(n,t)=>{RI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>VC(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 QR({type:"literal",values:Array.isArray(n)?n:[n],...O(t)})}const eP=A("ZodTransform",(n,t)=>{PI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>jC(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new dy(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(ao(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(ao(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function tP(n){return new eP({type:"transform",transform:n})}const jy=A("ZodOptional",(n,t)=>{Py.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Ny(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Dg(n){return new jy({type:"optional",innerType:n})}const nP=A("ZodExactOptional",(n,t)=>{DI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Ny(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function rP(n){return new nP({type:"optional",innerType:n})}const iP=A("ZodNullable",(n,t)=>{LI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>XC(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Lg(n){return new iP({type:"nullable",innerType:n})}const sP=A("ZodDefault",(n,t)=>{zI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>eR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function oP(n,t){return new sP({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():my(t)}})}const aP=A("ZodPrefault",(n,t)=>{OI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>tR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function lP(n,t){return new aP({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():my(t)}})}const Gy=A("ZodNonOptional",(n,t)=>{MI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>QC(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function cP(n,t){return new Gy({type:"nonoptional",innerType:n,...O(t)})}const uP=A("ZodCatch",(n,t)=>{NI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>nR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function hP(n,t){return new uP({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const dP=A("ZodPipe",(n,t)=>{UI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>rR(n,e,r,i),n.in=t.in,n.out=t.out});function zg(n,t){return new dP({type:"pipe",in:n,out:t})}const pP=A("ZodReadonly",(n,t)=>{FI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>iR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function fP(n){return new pP({type:"readonly",innerType:n})}const gP=A("ZodCustom",(n,t)=>{HI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>BC(n,e)});function mP(n,t={}){return DC(gP,n,t)}function vP(n){return LC(n)}const yP=[".md",".markdown"];function qy(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function Yy(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function bP(n){return Yy(n).toLowerCase()}function wP(n,t){const e=bP(n);return t.some(r=>e.endsWith(r))}function Ky(n){return!qy(n)&&wP(n,yP)}function SP(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}const _P=Wy({id:d().min(1),kind:$("path"),title:d(),path:d()}).strict(),kP=Wy({id:d().min(1),kind:$("url"),title:d(),url:d().refine(SP,{message:"url must be an http(s) URL"})}).strict();KR("kind",[_P,kP]);function Jy(n){return typeof n=="object"&&n!==null}function Xy(n){return!Jy(n)||n.type!=="ready"?!1:!("id"in n)}function Qy(n){return!(!Jy(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const xP="/views/markdown/",EP="/views/url-unsupported/";function eb(n){return`/artifact/${encodeURIComponent(n)}`}function AP(n,t){return`${eb(n)}/${encodeURIComponent(t)}`}function $P(n){return`/markdown/${encodeURIComponent(n)}`}function Rl(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:EP,contentURL:null};if(Ky(n.path)){const r={viewURL:xP,contentURL:$P(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=qy(n.path)?`${eb(n.id)}/`:AP(n.id,Yy(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const TP="serverURL",IP="token",CP="mode",RP="electron";function tb(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(TP);return r?new URL(r).origin:new URL(t).origin}function Og(n=window.location.search){return new URLSearchParams(n).get(IP)}function ln(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(CP)===RP}const de={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"},PP=1,DP=v({_meta:k(d(),_()).nullish(),terminal:Le().optional().default(!1)}),LP=v({_meta:k(d(),_()).nullish(),label:d().nullish(),name:d(),optional:Le().optional().default(!1),secret:Le().optional().default(!0)}),zP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),name:d()}),OP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:z(LP)}),MP=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),description:d().nullish(),env:k(d(),d()).optional(),id:d(),name:d()}),NP=B([OP.and(v({type:$("env_var")})),MP.and(v({type:$("terminal")})),zP]),UP=v({_meta:k(d(),_()).nullish(),methodId:d()}),FP=v({_meta:k(d(),_()).nullish()}),HP=v({_meta:k(d(),_()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),ZP=v({default:Le().nullish(),description:d().nullish(),title:d().nullish()}),WP=v({_meta:k(d(),_()).nullish()}),VP=v({_meta:k(d(),_()).nullish()}),BP=v({amount:H(),currency:d()}),jP=v({_meta:k(d(),_()).nullish(),terminalId:d()}),GP=v({_meta:k(d(),_()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),qP=B([d(),H(),H(),Le(),z(d())]),YP=v({content:k(d(),qP).nullish()}),KP=B([YP.and(v({action:$("accept")})),v({action:$("decline")}),v({action:$("cancel")})]),JP=v({_meta:k(d(),_()).nullish()}),nb=d(),XP=v({_meta:k(d(),_()).nullish(),elicitationId:nb}),QP=v({_meta:k(d(),_()).nullish(),action:KP}),eD=$("object"),tD=$("string"),nD=v({_meta:k(d(),_()).nullish()}),rD=v({_meta:k(d(),_()).nullish(),form:JP.nullish(),url:nD.nullish()}),iD=v({elicitationId:nb,url:d().url()}),rb=v({const:d(),title:d()}),ib=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),sD=B([$(-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"})]),sb=v({code:sD,data:_().optional(),message:d()}),ob=_(),ab=_(),lb=_(),oD=v({_meta:k(d(),_()).nullish(),readTextFile:Le().optional().default(!1),writeTextFile:Le().optional().default(!1)}),cb=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),ub=v({_meta:k(d(),_()).nullish(),name:d(),title:d().nullish(),version:d()}),aD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),lD=v({_meta:k(d(),_()).nullish()}),cD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),uD=v({_meta:k(d(),_()).nullish()}),hD=v({_meta:k(d(),_()).nullish(),logout:uD.nullish()}),dD=v({_meta:k(d(),_()).nullish()}),pD=v({_meta:k(d(),_()).nullish()}),fD=v({_meta:k(d(),_()).nullish(),http:Le().optional().default(!1),sse:Le().optional().default(!1)}),gD=v({_meta:k(d(),_()).nullish(),headers:z(cb),name:d(),url:d()}),mD=v({_meta:k(d(),_()).nullish(),headers:z(cb),name:d(),url:d()}),vD=v({_meta:k(d(),_()).nullish(),args:z(d()),command:d(),env:z(ib),name:d()}),mc=B([gD.and(v({type:$("http")})),mD.and(v({type:$("sse")})),vD]),Fd=d(),yD=v({_meta:k(d(),_()).nullish(),description:d().nullish(),modelId:Fd,name:d()}),bD=B([$("error"),$("warning"),$("information"),$("hint")]),wD=v({_meta:k(d(),_()).nullish()}),SD=v({_meta:k(d(),_()).nullish()}),_D=v({_meta:k(d(),_()).nullish()}),kD=v({_meta:k(d(),_()).nullish()}),xD=v({_meta:k(d(),_()).nullish()}),ED=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),AD=v({diff:d(),uri:d()}),$D=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()}),TD=v({_meta:k(d(),_()).nullish()}),ID=v({_meta:k(d(),_()).nullish()}),CD=v({languageId:d(),text:d(),uri:d()}),RD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),PD=B([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),DD=v({excerpts:z($D),uri:d()}),LD=v({_meta:k(d(),_()).nullish()}),zD=v({_meta:k(d(),_()).nullish()}),OD=v({name:d(),owner:d(),remoteUrl:d()}),MD=v({_meta:k(d(),_()).nullish()}),ND=v({_meta:k(d(),_()).nullish(),jump:TD.nullish(),rename:zD.nullish(),searchAndReplace:MD.nullish()}),UD=v({id:d(),isRegex:Le().nullish(),replace:d(),search:d(),uri:d()}),FD=B([$("automatic"),$("diagnostic"),$("manual")]),HD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),ZD=v({_meta:k(d(),_()).nullish(),diagnostics:wD.nullish(),editHistory:ED.nullish(),openFiles:ID.nullish(),recentFiles:RD.nullish(),relatedSnippets:LD.nullish(),userActions:HD.nullish()}),WD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc)}),VD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),hb=d(),BD=B([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),jD=v({_meta:k(d(),_()).nullish(),kind:BD,name:d(),optionId:hb}),GD=B([$("high"),$("medium"),$("low")]),qD=B([$("pending"),$("in_progress"),$("completed")]),YD=v({_meta:k(d(),_()).nullish(),content:d(),priority:GD,status:qD}),KD=v({_meta:k(d(),_()).nullish(),entries:z(YD)}),Qn=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"})}),JD=v({id:d(),position:Qn,uri:d()}),XD=v({id:d(),newName:d(),position:Qn,uri:d()}),QD=v({action:d(),position:Qn,timestampMs:H(),uri:d()}),db=B([$("utf-16"),$("utf-32"),$("utf-8")]),eL=v({_meta:k(d(),_()).nullish(),auth:DP.optional().default({terminal:!1}),elicitation:rD.nullish(),fs:oD.optional().default({readTextFile:!1,writeTextFile:!1}),nes:ND.nullish(),positionEncodings:z(db).optional(),terminal:Le().optional().default(!1)}),tL=v({_meta:k(d(),_()).nullish(),audio:Le().optional().default(!1),embeddedContext:Le().optional().default(!1),image:Le().optional().default(!1)}),pb=H().int().gte(0).lte(65535),nL=v({_meta:k(d(),_()).nullish(),clientCapabilities:eL.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:ub.nullish(),protocolVersion:pb}),Ss=v({end:Qn,start:Qn}),rL=v({message:d(),range:Ss,severity:bD,uri:d()}),iL=v({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:Ss.nullish()}),sL=v({_meta:k(d(),_()).nullish(),diagnostics:z(rL).nullish(),editHistory:z(AD).nullish(),openFiles:z(iL).nullish(),recentFiles:z(CD).nullish(),relatedSnippets:z(DD).nullish(),userActions:z(QD).nullish()}),oL=v({newText:d(),range:Ss}),aL=v({cursorPosition:Qn.nullish(),edits:z(oL),id:d(),uri:d()}),lL=B([aL.and(v({kind:$("edit")})),JD.and(v({kind:$("jump")})),XD.and(v({kind:$("rename")})),UD.and(v({kind:$("searchAndReplace")}))]),cL=v({_meta:k(d(),_()).nullish(),content:d()}),uL=v({_meta:k(d(),_()).nullish()}),Br=B([H(),d()]).nullable();v({_meta:k(d(),_()).nullish(),requestId:Br});const hL=By(["assistant","user"]),va=v({_meta:k(d(),_()).nullish(),audience:z(hL).nullish(),lastModified:d().nullish(),priority:H().nullish()}),dL=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),data:d(),mimeType:d()}),pL=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),fL=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),gL=v({_meta:k(d(),_()).nullish(),optionId:hb}),mL=B([v({outcome:$("cancelled")}),gL.and(v({outcome:$("selected")}))]),vL=v({_meta:k(d(),_()).nullish(),outcome:mL}),yL=v({_meta:k(d(),_()).nullish()}),bL=v({_meta:k(d(),_()).nullish()}),wL=v({currentValue:Le()}),SL=d(),fb=d(),_L=B([$("mode"),$("model"),$("thought_level"),d()]),Hd=d(),gb=v({_meta:k(d(),_()).nullish(),description:d().nullish(),name:d(),value:Hd}),kL=v({_meta:k(d(),_()).nullish(),group:SL,name:d(),options:z(gb)}),xL=B([z(gb),z(kL)]),EL=v({currentValue:Hd,options:xL}),_s=gc(B([EL.and(v({type:$("select")})),wL.and(v({type:$("boolean")}))]),v({_meta:k(d(),_()).nullish(),category:_L.nullish(),description:d().nullish(),id:fb,name:d()})),AL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s)}),$L=v({_meta:k(d(),_()).nullish()}),Q=d(),TL=v({_meta:k(d(),_()).nullish(),id:d(),sessionId:Q}),IL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),CL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),RL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),mb=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),command:d(),cwd:d().nullish(),env:z(ib).optional(),outputByteLimit:H().nullish(),sessionId:Q}),PL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),DL=v({_meta:k(d(),_()).nullish(),position:Qn,sessionId:Q,uri:d(),version:H(),visibleRange:Ss}),LL=v({_meta:k(d(),_()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),zL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),OL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc).optional(),sessionId:Q}),vb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),ML=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc),sessionId:Q}),yb=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}),NL=v({_meta:k(d(),_()).nullish(),id:d(),reason:PD.nullish(),sessionId:Q}),bb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),UL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc).optional(),sessionId:Q}),FL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),HL=v({_meta:k(d(),_()).nullish(),nextCursor:d().nullish(),sessions:z(FL)}),ZL=v({_meta:k(d(),_()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),WL=v({_meta:k(d(),_()).nullish()}),vc=d(),VL=v({_meta:k(d(),_()).nullish(),currentModeId:vc}),BL=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:vc,name:d()}),yc=v({_meta:k(d(),_()).nullish(),availableModes:z(BL),currentModeId:vc}),bc=v({_meta:k(d(),_()).nullish(),availableModels:z(yD),currentModelId:Fd}),jL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish(),sessionId:Q}),GL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish()}),qL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish(),sessionId:Q}),YL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish()}),KL=v({_meta:k(d(),_()).nullish()}),JL=v({_meta:k(d(),_()).nullish(),additionalDirectories:yL.nullish(),close:bL.nullish(),fork:$L.nullish(),list:WL.nullish(),resume:KL.nullish()}),XL=gc(B([v({type:$("boolean"),value:Le()}),v({value:Hd})]),v({_meta:k(d(),_()).nullish(),configId:fb,sessionId:Q})),QL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s)}),e2=v({_meta:k(d(),_()).nullish(),modeId:vc,sessionId:Q}),t2=v({_meta:k(d(),_()).nullish()}),n2=v({_meta:k(d(),_()).nullish(),modelId:Fd,sessionId:Q}),r2=v({_meta:k(d(),_()).nullish()}),i2=v({_meta:k(d(),_()).nullish(),sessionId:Q}),s2=B([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),o2=B([$("email"),$("uri"),$("date"),$("date-time")]),a2=v({default:d().nullish(),description:d().nullish(),enum:z(d()).nullish(),format:o2.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(rb).nullish(),pattern:d().nullish(),title:d().nullish()}),l2=v({_meta:k(d(),_()).nullish(),context:sL.nullish(),position:Qn,selection:Ss.nullish(),sessionId:Q,triggerKind:FD,uri:d(),version:H()}),c2=v({_meta:k(d(),_()).nullish(),suggestions:z(lL)}),u2=v({_meta:k(d(),_()).nullish(),terminalId:d()}),h2=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),wb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),d2=v({_meta:k(d(),_()).nullish(),exitStatus:h2.nullish(),output:d(),truncated:Le()}),p2=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),text:d()}),f2=v({range:Ss.nullish(),text:d()}),g2=v({_meta:k(d(),_()).nullish(),contentChanges:z(f2),sessionId:Q,uri:d(),version:H()});v({method:d(),params:B([IL,LL,g2,PL,zL,DL,TL,NL,ob]).nullish()});const m2=B([$("full"),$("incremental")]),v2=v({_meta:k(d(),_()).nullish(),syncKind:m2}),y2=v({_meta:k(d(),_()).nullish(),didChange:v2.nullish(),didClose:SD.nullish(),didFocus:_D.nullish(),didOpen:kD.nullish(),didSave:xD.nullish()}),b2=v({_meta:k(d(),_()).nullish(),document:y2.nullish()}),w2=v({_meta:k(d(),_()).nullish(),context:ZD.nullish(),events:b2.nullish()}),S2=v({_meta:k(d(),_()).nullish(),auth:hD.optional().default({}),loadSession:Le().optional().default(!1),mcpCapabilities:fD.optional().default({http:!1,sse:!1}),nes:w2.nullish(),positionEncoding:db.nullish(),promptCapabilities:tL.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:JL.optional().default({})}),_2=v({_meta:k(d(),_()).nullish(),agentCapabilities:S2.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:ub.nullish(),authMethods:z(NP).optional().default([]),protocolVersion:pb}),k2=v({_meta:k(d(),_()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),x2=B([k2,HP]),E2=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),resource:x2}),Zd=B([p2.and(v({type:$("text")})),pL.and(v({type:$("image")})),dL.and(v({type:$("audio")})),fL.and(v({type:$("resource_link")})),E2.and(v({type:$("resource")}))]),A2=v({_meta:k(d(),_()).nullish(),content:Zd}),fu=v({_meta:k(d(),_()).nullish(),content:Zd,messageId:d().nullish()}),$2=v({_meta:k(d(),_()).nullish(),messageId:d().nullish(),prompt:z(Zd),sessionId:Q}),T2=v({anyOf:z(rb)}),Sb=B([A2.and(v({type:$("content")})),GP.and(v({type:$("diff")})),u2.and(v({type:$("terminal")}))]),_b=d(),kb=v({_meta:k(d(),_()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),xb=B([$("pending"),$("in_progress"),$("completed"),$("failed")]),Eb=B([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),I2=v({_meta:k(d(),_()).nullish(),content:z(Sb).optional(),kind:Eb.optional(),locations:z(kb).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:xb.optional(),title:d(),toolCallId:_b}),Ab=v({_meta:k(d(),_()).nullish(),content:z(Sb).nullish(),kind:Eb.nullish(),locations:z(kb).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:xb.nullish(),title:d().nullish(),toolCallId:_b}),$b=v({_meta:k(d(),_()).nullish(),options:z(jD),sessionId:Q,toolCall:Ab}),C2=v({_meta:k(d(),_()).nullish(),hint:d()}),R2=C2,P2=v({_meta:k(d(),_()).nullish(),description:d(),input:R2.nullish(),name:d()}),D2=v({_meta:k(d(),_()).nullish(),availableCommands:z(P2)}),L2=v({enum:z(d()),type:tD}),z2=B([L2,T2]),O2=v({default:z(d()).nullish(),description:d().nullish(),items:z2,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),M2=B([a2.and(v({type:$("string")})),VD.and(v({type:$("number")})),aD.and(v({type:$("integer")})),ZP.and(v({type:$("boolean")})),O2.and(v({type:$("array")}))]),N2=v({description:d().nullish(),properties:k(d(),M2).optional().default({}),required:z(d()).nullish(),title:d().nullish(),type:eD.optional().default("object")}),U2=v({requestedSchema:N2}),F2=gc(B([U2.and(v({mode:$("form")})),iD.and(v({mode:$("url")}))]),v({_meta:k(d(),_()).nullish(),message:d(),sessionId:Q})),H2=v({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),Z2=v({_meta:k(d(),_()).nullish(),stopReason:s2,usage:H2.nullish(),userMessageId:d().nullish()});B([v({id:Br,result:B([_2,FP,pD,qL,GL,HL,jL,YL,VP,t2,QL,Z2,r2,i2,c2,WP,lb])}),v({error:sb,id:Br})]);const W2=v({_meta:k(d(),_()).nullish(),cost:BP.nullish(),size:H(),used:H()}),V2=B([fu.and(v({sessionUpdate:$("user_message_chunk")})),fu.and(v({sessionUpdate:$("agent_message_chunk")})),fu.and(v({sessionUpdate:$("agent_thought_chunk")})),I2.and(v({sessionUpdate:$("tool_call")})),Ab.and(v({sessionUpdate:$("tool_call_update")})),KD.and(v({sessionUpdate:$("plan")})),D2.and(v({sessionUpdate:$("available_commands_update")})),VL.and(v({sessionUpdate:$("current_mode_update")})),AL.and(v({sessionUpdate:$("config_option_update")})),ZL.and(v({sessionUpdate:$("session_info_update")})),W2.and(v({sessionUpdate:$("usage_update")}))]),Tb=v({_meta:k(d(),_()).nullish(),sessionId:Q,update:V2});v({method:d(),params:B([Tb,XP,ob]).nullish()});const Ib=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),B2=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),j2=v({name:d(),uri:d()}),G2=v({_meta:k(d(),_()).nullish(),repository:OD.nullish(),workspaceFolders:z(j2).nullish(),workspaceUri:d().nullish()});v({id:Br,method:d(),params:B([nL,UP,dD,WD,ML,cD,OL,UL,RL,e2,XL,$2,n2,G2,l2,CL,ab]).nullish()});const Cb=v({_meta:k(d(),_()).nullish(),content:d(),path:d(),sessionId:Q});v({id:Br,method:d(),params:B([Cb,yb,$b,mb,wb,bb,Ib,vb,F2,ab]).nullish()});const q2=v({_meta:k(d(),_()).nullish()});B([v({id:Br,result:B([q2,cL,vL,jP,d2,uL,B2,lD,QP,lb])}),v({error:sb,id:Br})]);var X;class Y2{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=Cb.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,x)}case gn.fs_read_text_file:{const x=yb.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,x)}case gn.session_request_permission:{const x=$b.parse(a);return r.requestPermission(x)}case gn.terminal_create:{const x=mb.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,x)}case gn.terminal_output:{const x=wb.parse(a);return(f=r.terminalOutput)==null?void 0:f.call(r,x)}case gn.terminal_release:{const x=bb.parse(a);return await((y=r.releaseTerminal)==null?void 0:y.call(r,x))??{}}case gn.terminal_wait_for_exit:{const x=Ib.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,x)}case gn.terminal_kill:{const x=vb.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=Tb.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ce.methodNotFound(o)}};w(this,X,new K2(i,s,e))}async initialize(t){return await l(this,X).sendRequest(de.initialize,t)}async newSession(t){return await l(this,X).sendRequest(de.session_new,t)}async loadSession(t){return await l(this,X).sendRequest(de.session_load,t)??{}}async unstable_forkSession(t){return await l(this,X).sendRequest(de.session_fork,t)}async listSessions(t){return await l(this,X).sendRequest(de.session_list,t)}async unstable_resumeSession(t){return await l(this,X).sendRequest(de.session_resume,t)}async unstable_closeSession(t){return await l(this,X).sendRequest(de.session_close,t)}async setSessionMode(t){return await l(this,X).sendRequest(de.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,X).sendRequest(de.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,X).sendRequest(de.session_set_config_option,t)}async authenticate(t){return await l(this,X).sendRequest(de.authenticate,t)??{}}async unstable_logout(t){return await l(this,X).sendRequest(de.logout,t)??{}}async prompt(t){return await l(this,X).sendRequest(de.session_prompt,t)}async cancel(t){return await l(this,X).sendNotification(de.session_cancel,t)}async unstable_startNes(t){return await l(this,X).sendRequest(de.nes_start,t)}async unstable_suggestNes(t){return await l(this,X).sendRequest(de.nes_suggest,t)}async unstable_closeNes(t){return await l(this,X).sendRequest(de.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,X).sendNotification(de.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,X).sendNotification(de.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,X).sendNotification(de.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,X).sendNotification(de.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,X).sendNotification(de.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,X).sendNotification(de.nes_accept,t)}async unstable_rejectNes(t){return await l(this,X).sendNotification(de.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 Nn,Zl,mo,vo,Li,zi,jt,yo,ge,Rb,eh,Pb,Db,Lb,zb,th,Zs;class K2{constructor(t,e,r){S(this,ge);S(this,Nn,new Map);S(this,Zl,0);S(this,mo);S(this,vo);S(this,Li);S(this,zi,Promise.resolve());S(this,jt,new AbortController);S(this,yo);w(this,mo,t),w(this,vo,e),w(this,Li,r),w(this,yo,new Promise(i=>{l(this,jt).signal.addEventListener("abort",()=>i())})),p(this,ge,Rb).call(this)}get signal(){return l(this,jt).signal}get closed(){return l(this,yo)}async sendRequest(t,e){p(this,ge,th).call(this);const r=Rp(this,Zl)._++,i=new Promise((s,o)=>{l(this,Nn).set(r,{resolve:s,reject:o})});return await p(this,ge,Zs).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){p(this,ge,th).call(this),await p(this,ge,Zs).call(this,{jsonrpc:"2.0",method:t,params:e})}}Nn=new WeakMap,Zl=new WeakMap,mo=new WeakMap,vo=new WeakMap,Li=new WeakMap,zi=new WeakMap,jt=new WeakMap,yo=new WeakMap,ge=new WeakSet,Rb=async function(){let t;try{const e=l(this,Li).readable.getReader();try{for(;!l(this,jt).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{p(this,ge,Pb).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&p(this,ge,Zs).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{p(this,ge,eh).call(this,t)}},eh=function(t){if(l(this,jt).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,Nn).values())r.reject(e);l(this,Nn).clear(),l(this,jt).abort(e)},Pb=async function(t){if("method"in t&&"id"in t){const e=await p(this,ge,Db).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await p(this,ge,Zs).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await p(this,ge,Lb).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?p(this,ge,zb).call(this,t):console.error("Invalid message",{message:t})},Db=async function(t,e){try{return{result:await l(this,mo).call(this,t,e)??null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Cg)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()}}},Lb=async function(t,e){try{return await l(this,vo).call(this,t,e),{result:null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Cg)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,Nn).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,Nn).delete(t.id)}else console.error("Got response to unknown request",t.id)},th=function(){if(l(this,jt).signal.aborted)throw l(this,jt).signal.reason??new Error("ACP connection closed")},Zs=async function(t){return w(this,zi,l(this,zi).then(async()=>{const e=l(this,Li).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{p(this,ge,eh).call(this,e)})),l(this,zi)};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 J2=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,X2=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,Q2=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,ez=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,tz=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,nz="single_session",rz={name:"television-acp-client",version:"0.0.0"},Ob="agent:main:television",iz=ma(zt);var Oi,Gt,ht,qt,Un,At,Sn,Yt,Kt,Fn,$t,Mi,Ni,Jt,Ke,_n,Ui,Tr,kn,Hn,bo,Tt,Xt,Wl,Qt,T,nh,Mb,Nb,Ub,rl,Fb,Hb,Zb,Wb,Vb,Bb,jb,pr,vi,yi,mn,Gb,bi,rh,ih,il,qb,sl,sh,oh,wo,So,ol,wi,ah,Yb;class sz extends iz{constructor(e){super();S(this,T);S(this,Oi,"disconnected");S(this,Gt,null);S(this,ht,new Map);S(this,qt,null);S(this,Un,null);S(this,At,null);S(this,Sn,null);S(this,Yt,null);S(this,Kt,null);S(this,Fn);S(this,$t,null);S(this,Mi,0);S(this,Ni,1);S(this,Jt,null);S(this,Ke,null);S(this,_n,!1);S(this,Ui,!1);S(this,Tr,!1);S(this,kn,null);S(this,Hn,new Set);S(this,bo);S(this,Tt);S(this,Xt);S(this,Wl,e=>{p(this,T,Nb).call(this,e)});S(this,Qt,null);S(this,wo,()=>{p(this,T,wi).call(this,"ACP bridge websocket closed")});S(this,So,()=>{p(this,T,wi).call(this,"ACP bridge websocket error")});w(this,Tt,e),w(this,Xt,e.sessionMode??nz),w(this,Fn,e.mappedSessionStore??oz()),w(this,bo,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,Oi)}get messages(){return[...l(this,ht).values()]}get enabled(){return l(this,Tt).enabled??!1}setToken(e){l(this,Tt).token=e??""}setEnabled(e){l(this,Tt).enabled=e,e||(p(this,T,ol).call(this),w(this,Gt,null),p(this,T,mn).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,Un)===null&&(w(this,Gt,null),w(this,Un,p(this,T,Mb).call(this)));try{await l(this,Un),await p(this,T,rl).call(this)}catch(e){throw p(this,T,wi).call(this,gu(e)),e}}}dispose(){p(this,T,ol).call(this),w(this,Gt,null),p(this,T,mn).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,nh).call(this,"ready")),(l(this,Yt)===null||l(this,$t)!==p(this,T,sl).call(this))&&await p(this,T,rl).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,vi).call(this,{id:p(this,T,bi).call(this,"user"),kind:"user",text:r,status:"final"}),p(this,T,mn).call(this,"running");try{const i=await p(this,T,il).call(this).prompt({sessionId:p(this,T,ih).call(this),prompt:[{type:"text",text:p(this,T,Gb).call(this,r)}]});p(this,T,pr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),p(this,T,mn).call(this,"ready")}catch(i){throw p(this,T,Yb).call(this)||(p(this,T,pr).call(this,"error"),p(this,T,mn).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,nh).call(this,"ready"));const e=p(this,T,sl).call(this);((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,Fn).clearActualSessionId(e):w(this,Mi,l(this,Mi)+1),w(this,At,null),w(this,Sn,null),w(this,Yt,null),w(this,$t,null),p(this,T,ah).call(this)}async cancel(){this.status==="running"&&(p(this,T,mn).call(this,"cancelling"),await p(this,T,il).call(this).cancel({sessionId:p(this,T,ih).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,Ke)===null)return;w(this,Ke,null),w(this,_n,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,Ke))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Ke))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Ke))==null?void 0:a.screenID)??null;if(w(this,Ke,r),l(this,Xt)==="single_session"){(!l(this,$t)||i!==r.screenID)&&w(this,_n,!0);return}l(this,$t)!==p(this,T,sh).call(this,r.screenID)&&(w(this,At,null),w(this,Sn,null),l(this,qt)&&this.status==="ready"&&p(this,T,rl).call(this).catch(c=>{p(this,T,wi).call(this,gu(c))}))}}Oi=new WeakMap,Gt=new WeakMap,ht=new WeakMap,qt=new WeakMap,Un=new WeakMap,At=new WeakMap,Sn=new WeakMap,Yt=new WeakMap,Kt=new WeakMap,Fn=new WeakMap,$t=new WeakMap,Mi=new WeakMap,Ni=new WeakMap,Jt=new WeakMap,Ke=new WeakMap,_n=new WeakMap,Ui=new WeakMap,Tr=new WeakMap,kn=new WeakMap,Hn=new WeakMap,bo=new WeakMap,Tt=new WeakMap,Xt=new WeakMap,Wl=new WeakMap,Qt=new WeakMap,T=new WeakSet,nh=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)})}},Mb=async function(){try{const{stream:e,socket:r,metadata:i}=await uz({serverURL:l(this,Tt).serverURL,token:l(this,Tt).token,createSocket:l(this,bo),onDisconnect:l(this,Wl)});w(this,Kt,i),w(this,Qt,r),r.addEventListener("close",l(this,wo)),r.addEventListener("error",l(this,So)),w(this,qt,new Y2(s=>({connection:s,sessionUpdate:async o=>{await p(this,T,Hb).call(this,o)},requestPermission:async o=>p(this,T,Zb).call(this,o)}),e)),await l(this,qt).initialize({protocolVersion:PP,clientCapabilities:{},clientInfo:rz})}catch(e){throw e}},Nb=function(e){p(this,T,wi).call(this,gu(e))},Ub=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})`)},rl=async function(){const e=p(this,T,sl).call(this);if(l(this,At)&&l(this,Sn)===e){await l(this,At);return}w(this,Sn,e),w(this,At,p(this,T,Fb).call(this,e)),await l(this,At)},Fb=async function(e){var c;const r=p(this,T,il).call(this);p(this,T,ah).call(this);let i,s=!1,o=null;const a={cwd:p(this,T,qb).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(w(this,Tr,!0),w(this,kn,null),((c=l(this,Kt))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,Fn).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(az(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,Fn).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,Fn).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,Tr,!1),w(this,kn,null),p(this,T,pr).call(this,"final")}p(this,T,Ub).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),w(this,Yt,i),w(this,$t,e),w(this,Ui,!0),s?(l(this,Hn).add(e),l(this,Xt)==="single_session"&&w(this,_n,!1)):(l(this,Hn).delete(e),w(this,_n,l(this,Xt)==="single_session")),w(this,Gt,null),p(this,T,mn).call(this,"ready")},Hb=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&p(this,T,jb).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&p(this,T,Wb).call(this,r.content.text);return;case"tool_call":p(this,T,Vb).call(this,r);return;case"tool_call_update":p(this,T,Bb).call(this,r);return;case"agent_thought_chunk":return;default:return}},Zb=async function(e){return{outcome:{outcome:"cancelled"}}},Wb=function(e){w(this,kn,null);const r=cz(e);if(!r)return;if(!l(this,Jt)){const s={id:p(this,T,bi).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};w(this,Jt,s.id),p(this,T,vi).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,yi).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Vb=function(e){p(this,T,pr).call(this,"final");const r=p(this,T,rh).call(this,e.toolCallId),i=Ng("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??p(this,T,bi).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,yi).call(this,s);return}p(this,T,vi).call(this,s)},Bb=function(e){const r=p(this,T,rh).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=Ng(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??p(this,T,bi).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,yi).call(this,a);return}p(this,T,vi).call(this,a)},jb=function(e){if(p(this,T,pr).call(this,"final"),!e)return;const r=l(this,Tr)?l(this,kn):null;if(!r){const s=Mg(e);if(!s)return;const o={id:p(this,T,bi).call(this,"user"),kind:"user",text:s,status:"final"};p(this,T,vi).call(this,o),l(this,Tr)&&w(this,kn,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,yi).call(this,{...i,text:Mg(`${i.text}${e}`)})},pr=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,yi).call(this,{...r,status:e}),w(this,Jt,null)},vi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new uu("messages-changed"))},yi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new uu("messages-changed"))},mn=function(e){l(this,Oi)!==e&&(w(this,Oi,e),this.dispatchEvent(new BA("status-changed")))},Gb=function(e){const r=l(this,$t);if(!r)return e;const i=l(this,Ke)?l(this,Xt)==="single_session"?l(this,_n)||!l(this,Hn).has(r):!l(this,Hn).has(r):!1,s=l(this,Ui)&&(l(this,Ke)!==null||ez.test(e));if(!(s||i))return e;s&&w(this,Ui,!1),i&&(w(this,_n,!1),l(this,Hn).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,Ke)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,Ke).screenID}`),a.push(`screen_name: ${l(this,Ke).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
- `)},bi=function(e){const r=`${e}-${l(this,Ni)}`;return w(this,Ni,l(this,Ni)+1),r},rh=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},ih=function(){if(!l(this,Yt))throw new Error("ACP session is not ready");return l(this,Yt)},il=function(){if(!l(this,qt))throw new Error("ACP connection is not ready");return l(this,qt)},qb=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},sl=function(){var r;if(l(this,Xt)==="single_session")return p(this,T,oh).call(this,`${Ob}-${(l(this,Tt).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,Ke))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return p(this,T,sh).call(this,e)},sh=function(e){return p(this,T,oh).call(this,lz(l(this,Xt),e,l(this,Tt).clientGUID??"default-client"))},oh=function(e){var r;return((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,Mi)>0?`${e}:epoch-${l(this,Mi)}`:e},wo=new WeakMap,So=new WeakMap,ol=function(){w(this,qt,null),w(this,Un,null),w(this,At,null),w(this,Sn,null),w(this,Yt,null),w(this,$t,null),w(this,Kt,null),l(this,Qt)&&(l(this,Qt).removeEventListener("close",l(this,wo)),l(this,Qt).removeEventListener("error",l(this,So)),l(this,Qt).close(),w(this,Qt,null))},wi=function(e){const r=l(this,qt)!==null||l(this,Un)!==null||l(this,At)!==null||l(this,Sn)!==null||l(this,Yt)!==null||l(this,$t)!==null||l(this,Kt)!==null||l(this,Qt)!==null;this.disposed||this.status==="disconnected"&&!r||(p(this,T,pr).call(this,"error"),p(this,T,ol).call(this),w(this,Gt,e??null),p(this,T,mn).call(this,"disconnected"))},ah=function(){const e=l(this,ht).size>0;w(this,Jt,null),w(this,kn,null),w(this,Ni,1),l(this,ht).clear(),e&&this.dispatchEvent(new uu("messages-changed"))},Yb=function(){return this.status==="disconnected"};function oz(){const n=new Map;return{getActualSessionId(t){return n.get(t)??null},setActualSessionId(t,e){n.set(t,e)},clearActualSessionId(t){n.delete(t)}}}function az(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function lz(n,t,e){return n==="single_session"?`${Ob}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function Kb(n){return n.replace(/^(?:\s*\n)+/,"")}function Mg(n){let t=n;return t=t.replace(J2,""),t=t.replace(X2,""),t=t.replace(Q2,""),t=Kb(t),t}function cz(n){let t=n;return t=t.replace(tz,""),t=Kb(t),t}function Ng(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function uz(n){const t=n.createSocket(pz(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=dz(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=hz(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 hz(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 dz(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 pz(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 gu(n){return n instanceof Error?n.message:String(n)}const Ug="television.acpClientGUID",Fg="television.acpMappedSessions",Hg=1;var Fi;class fz{constructor(){S(this,Fi,new Map)}getActualSessionId(t){return l(this,Fi).get(t)??null}setActualSessionId(t,e){l(this,Fi).set(t,e)}clearActualSessionId(t){l(this,Fi).delete(t)}}Fi=new WeakMap;var Hi,_o,pt,al,ll,lh;class gz{constructor(t,e){S(this,pt);S(this,Hi);S(this,_o);w(this,Hi,t),w(this,_o,e)}getActualSessionId(t){const e=p(this,pt,ll).call(this)[p(this,pt,al).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=p(this,pt,ll).call(this);r[p(this,pt,al).call(this,t)]=e,p(this,pt,lh).call(this,r)}clearActualSessionId(t){const e=p(this,pt,ll).call(this);delete e[p(this,pt,al).call(this,t)],p(this,pt,lh).call(this,e)}}Hi=new WeakMap,_o=new WeakMap,pt=new WeakSet,al=function(t){return JSON.stringify([l(this,_o),t])},ll=function(){const t=l(this,Hi).getItem(Fg);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!==Hg?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},lh=function(t){const e={version:Hg,entries:t};l(this,Hi).setItem(Fg,JSON.stringify(e))};function mz(){return typeof window>"u"?null:window.localStorage}function vz(n){const t=n.getItem(Ug);if(t)return t;const e=Dd().toLowerCase();return n.setItem(Ug,e),e}const Zg=4401,yz=401,Ha=1e3,bz=3e4;class Qs extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class Jb extends zt{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,"createSocket");g(this,"createClient");g(this,"socket",null);g(this,"connectAttempt",0);g(this,"autoReconnect",!1);g(this,"retryTimer",null);g(this,"retryDelay",Ha);g(this,"visibilityEventTarget");g(this,"networkEventTarget");g(this,"onVisibilityChange");g(this,"onNetworkOnline");this.url=_e(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 g$(o,{token:a??void 0})),this.client=this.createClient(this.url,this._token);const r=e.mappedSessionStore??(e.acpStorage?new gz(e.acpStorage,this.url):new fz);this.acpClient=new sz({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}async connect(e){this._token=e,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Ha,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=Rl(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=Rl(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 el("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new el("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new el("screens-changed"));break;case"artifact-created":{const r=this.screens.get(e.screenID);r&&!tl(r).includes(e.artifact.id)&&(r.layout=[...r.layout,ty(e.artifact.id)]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=Bv(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return wz(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(Sz(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=Ha,this.hasEverConnected=!0,this.setStatus("connected"),s())},u=f=>{a||this.connectAttempt!==e||(a=!0,o(f))},h=async()=>{try{const[{screens:f},y]=await Promise.all([this.client.screens.list(),this.client.display.get()]);this.screens=new Map(f.map(m=>[m.id,structuredClone(m)])),this.acpClient.setEnabled(y.acpEnabled),this.dispatchEvent(new oe("change")),this.dispatchEvent(new ju("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:y.activeScreenID}})),c()}catch(f){if(xz(f)){u(new Qs);return}u(f instanceof Error?f:new Error(String(f)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",f=>{const y=kz(f);y&&(this.applyServerEvent(y),this.dispatchEvent(new ju("server-event",{serverURL:this.url,event:y})))}),r.addEventListener("close",f=>{if(this.connectAttempt!==e)return;this.socket=null;const y=_z(f);if(!a){u(y===Zg?new Qs:new Error("Connection closed before initialization"));return}if(y===Zg){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");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})}handleAttemptFailure(e){if(e instanceof Qs){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");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,bz),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=Ha,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 wz(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function Sz(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 _z(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function kz(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 xz(n){return n instanceof Pd&&n.status===yz}const Ez="Local";var ko,ch;class Az extends zt{constructor(e){super();S(this,ko);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?_e(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?mz():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?vz(r):Dd().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=_e(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e);const s=()=>{this.dispatchEvent(new oe("change"))},o=c=>{this.dispatchEvent(new ju("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new el("screens-changed"))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new oe("change"))}remove(e){const r=_e(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),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"))}setActive(e){const r=this.localStore.get(),i=e?_e(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?_e(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>_e(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:Ez}]})}const s=this.localStore.get().servers;for(const a of s){const c=_e(a.url),h=i!==null&&c===i?r??null:null,f=p(this,ko,ch).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=_e(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>_e(a.url)!==i),{url:i,name:r}]});const o=p(this,ko,ch).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect(null).catch(()=>{})}removeServer(e){this.remove(e)}}ko=new WeakSet,ch=function(e){return new Jb({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var xo;class $z extends zt{constructor(){super();S(this,xo,e=>{const r=Tz(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new VA("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,xo))}dispose(){document.removeEventListener("keydown",l(this,xo))}}xo=new WeakMap;function Tz(n){for(const[t,e]of Object.entries(m$))if(Iz(n,e.trigger))return t;return null}function Iz(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 uh="tv-nav:",Pl="tv-reload",Wg=100,Cz=1e3,Rz=60,Pz=60,Dz=24,Lz=30,zz=Lz*Dz*Pz*Rz*Cz;function Wr(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Pl);return t.searchParams.delete(Pl),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Eo,Zi,ue,re,Ir,ke,Xb,Dn,Qb,hh,dh;class Oz extends zt{constructor(e,r){super();S(this,ke);S(this,Eo);S(this,Zi);S(this,ue,[]);S(this,re,-1);S(this,Ir,0);w(this,Eo,e),w(this,Zi,Wr(r)),p(this,ke,Xb).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=Wr(e);if(r===l(this,Zi)){if(l(this,re)===-1)return;w(this,re,-1),p(this,ke,Dn).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,hh).call(this),p(this,ke,Dn).call(this)}replace(e){var i;if(l(this,re)===-1){this.navigate(e);return}const r=Wr(e);if(r===l(this,Zi)){w(this,ue,l(this,ue).filter((s,o)=>o!==l(this,re))),w(this,re,-1),p(this,ke,Dn).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,Dn).call(this))}back(){l(this,re)!==-1&&(w(this,re,l(this,re)-1),p(this,ke,Dn).call(this))}forward(){this.canGoForward&&(w(this,re,l(this,re)+1),p(this,ke,Dn).call(this))}reset(){l(this,re)===-1&&l(this,ue).length===0||(w(this,ue,[]),w(this,re,-1),p(this,ke,Dn).call(this))}}Eo=new WeakMap,Zi=new WeakMap,ue=new WeakMap,re=new WeakMap,Ir=new WeakMap,ke=new WeakSet,Xb=function(){const e=localStorage.getItem(l(this,ke,dh));if(e!==null)try{const r=JSON.parse(e);if(!ew(r))return;w(this,ue,r.entries.map(i=>({url:i.url}))),w(this,re,r.cursor),w(this,Ir,r.lastWritten),p(this,ke,hh).call(this)}catch{w(this,ue,[]),w(this,re,-1),w(this,Ir,0)}},Dn=function(){w(this,Ir,Date.now());try{localStorage.setItem(l(this,ke,dh),JSON.stringify(p(this,ke,Qb).call(this)))}catch(e){if(!Uz(e))throw e}this.dispatchEvent(new oe("change"))},Qb=function(){return{v:1,entries:l(this,ue).map(e=>({...e})),cursor:l(this,re),lastWritten:l(this,Ir)}},hh=function(){if(l(this,ue).length<=Wg)return;const e=l(this,ue).length-Wg;w(this,ue,l(this,ue).slice(e)),w(this,re,Math.max(-1,l(this,re)-e))},dh=function(){return Mz(l(this,Eo))};function Mz(n){return`${uh}${n}`}function Nz(n){const t=Date.now()-zz,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(uh)))continue;const s=i.slice(uh.length),o=localStorage.getItem(i);if(o===null)continue;let a;try{a=JSON.parse(o)}catch{e.push(i);continue}if(!ew(a)){e.push(i);continue}!n.has(s)&&a.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function Uz(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function ew(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 Pn=null;async function tw(n,t){if(Pn==null||Pn.abort(),n===null){Pn=null,Al();return}const e=new AbortController;Pn=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(Pn!==e)return;Wv(o)}catch(r){if(r.name==="AbortError")return;Al();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{Pn===e&&(Pn=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 My(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:Cl(t,"input",n.processors),output:Cl(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Ge(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 Ge(r.element,e);if(r.type==="set")return Ge(r.valueType,e);if(r.type==="lazy")return Ge(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 Ge(r.innerType,e);if(r.type==="intersection")return Ge(r.left,e)||Ge(r.right,e);if(r.type==="record"||r.type==="map")return Ge(r.keyType,e)||Ge(r.valueType,e);if(r.type==="pipe")return Ge(r.in,e)||Ge(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Ge(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Ge(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Ge(i,e))return!0;return!!(r.rest&&Ge(r.rest,e))}return!1}const LC=(n,t={})=>e=>{const r=zy({...e,processors:t});return Ee(n,r),Oy(r,n),My(r,n)},Cl=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=zy({...i??{},target:s,io:t,processors:e});return Ee(n,o),Oy(o,n),My(o,n)},zC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},OC=(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=zC[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}))])}},MC=(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)},NC=(n,t,e,r)=>{e.type="boolean"},UC=(n,t,e,r)=>{e.not={}},FC=(n,t,e,r)=>{},HC=(n,t,e,r)=>{const i=n._zod.def,s=fy(i.entries);s.every(o=>typeof o=="number")&&(e.type="number"),s.every(o=>typeof o=="string")&&(e.type="string"),e.enum=s},ZC=(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},WC=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},VC=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},jC=(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"]})},BC=(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)},GC=(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},qC=(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},YC=(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)}},KC=(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"}]},JC=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},XC=(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))},QC=(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)))},eR=(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},tR=(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},nR=(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},Ny=(n,t,e,r)=>{const i=n._zod.def;Ee(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},rR=A("ZodISODateTime",(n,t)=>{iI.init(n,t),ye.init(n,t)});function iR(n){return uC(rR,n)}const sR=A("ZodISODate",(n,t)=>{sI.init(n,t),ye.init(n,t)});function oR(n){return hC(sR,n)}const aR=A("ZodISOTime",(n,t)=>{oI.init(n,t),ye.init(n,t)});function lR(n){return dC(aR,n)}const cR=A("ZodISODuration",(n,t)=>{aI.init(n,t),ye.init(n,t)});function uR(n){return pC(cR,n)}const Uy=(n,t)=>{yy.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>J$(n,e)},flatten:{value:e=>K$(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,eh,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,eh,2)}},isEmpty:{get(){return n.issues.length===0}}})},Pg=A("ZodError",Uy),xt=A("ZodError",Uy,{Parent:Error}),hR=Fd(xt),dR=Hd(xt),pR=dc(xt),fR=pc(xt),gR=eT(xt),mR=tT(xt),vR=nT(xt),yR=rT(xt),bR=iT(xt),wR=sT(xt),SR=oT(xt),_R=aT(xt),ve=A("ZodType",(n,t)=>(me.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Cl(n,"input"),output:Cl(n,"output")}}),n.toJSONSchema=LC(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(rr(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)=>ir(n,e,r),n.brand=()=>n,n.register=(e,r)=>(e.add(n,r),n),n.parse=(e,r)=>hR(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>pR(n,e,r),n.parseAsync=async(e,r)=>dR(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>fR(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>gR(n,e,r),n.decode=(e,r)=>mR(n,e,r),n.encodeAsync=async(e,r)=>vR(n,e,r),n.decodeAsync=async(e,r)=>yR(n,e,r),n.safeEncode=(e,r)=>bR(n,e,r),n.safeDecode=(e,r)=>wR(n,e,r),n.safeEncodeAsync=async(e,r)=>SR(n,e,r),n.safeDecodeAsync=async(e,r)=>_R(n,e,r),n.refine=(e,r)=>n.check(fP(e,r)),n.superRefine=e=>n.check(gP(e)),n.overwrite=e=>n.check(ws(e)),n.optional=()=>zg(n),n.exactOptional=()=>tP(n),n.nullable=()=>Og(n),n.nullish=()=>zg(Og(n)),n.nonoptional=e=>aP(n,e),n.array=()=>z(n),n.or=e=>j([n,e]),n.and=e=>gc(n,e),n.transform=e=>Mg(n,QR(e)),n.default=e=>iP(n,e),n.prefault=e=>oP(n,e),n.catch=e=>cP(n,e),n.pipe=e=>Mg(n,e),n.readonly=()=>dP(n),n.describe=e=>{const r=n.clone();return Hs.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=Hs.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return Hs.get(n);const r=n.clone();return Hs.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),Fy=A("_ZodString",(n,t)=>{Zd.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(r,i,s)=>OC(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(bC(...r)),n.includes=(...r)=>n.check(_C(...r)),n.startsWith=(...r)=>n.check(kC(...r)),n.endsWith=(...r)=>n.check(xC(...r)),n.min=(...r)=>n.check(Il(...r)),n.max=(...r)=>n.check(Dy(...r)),n.length=(...r)=>n.check(Ly(...r)),n.nonempty=(...r)=>n.check(Il(1,...r)),n.lowercase=r=>n.check(wC(r)),n.uppercase=r=>n.check(SC(r)),n.trim=()=>n.check(AC()),n.normalize=(...r)=>n.check(EC(...r)),n.toLowerCase=()=>n.check($C()),n.toUpperCase=()=>n.check(TC()),n.slugify=()=>n.check(IC())}),kR=A("ZodString",(n,t)=>{Zd.init(n,t),Fy.init(n,t),n.email=e=>n.check(WI(xR,e)),n.url=e=>n.check(qI(ER,e)),n.jwt=e=>n.check(cC(FR,e)),n.emoji=e=>n.check(YI(AR,e)),n.guid=e=>n.check(Tg(Dg,e)),n.uuid=e=>n.check(VI(Fa,e)),n.uuidv4=e=>n.check(jI(Fa,e)),n.uuidv6=e=>n.check(BI(Fa,e)),n.uuidv7=e=>n.check(GI(Fa,e)),n.nanoid=e=>n.check(KI($R,e)),n.guid=e=>n.check(Tg(Dg,e)),n.cuid=e=>n.check(JI(TR,e)),n.cuid2=e=>n.check(XI(IR,e)),n.ulid=e=>n.check(QI(CR,e)),n.base64=e=>n.check(oC(MR,e)),n.base64url=e=>n.check(aC(NR,e)),n.xid=e=>n.check(eC(RR,e)),n.ksuid=e=>n.check(tC(PR,e)),n.ipv4=e=>n.check(nC(DR,e)),n.ipv6=e=>n.check(rC(LR,e)),n.cidrv4=e=>n.check(iC(zR,e)),n.cidrv6=e=>n.check(sC(OR,e)),n.e164=e=>n.check(lC(UR,e)),n.datetime=e=>n.check(iR(e)),n.date=e=>n.check(oR(e)),n.time=e=>n.check(lR(e)),n.duration=e=>n.check(uR(e))});function d(n){return ZI(kR,n)}const ye=A("ZodStringFormat",(n,t)=>{fe.init(n,t),Fy.init(n,t)}),xR=A("ZodEmail",(n,t)=>{YT.init(n,t),ye.init(n,t)}),Dg=A("ZodGUID",(n,t)=>{GT.init(n,t),ye.init(n,t)}),Fa=A("ZodUUID",(n,t)=>{qT.init(n,t),ye.init(n,t)}),ER=A("ZodURL",(n,t)=>{KT.init(n,t),ye.init(n,t)}),AR=A("ZodEmoji",(n,t)=>{JT.init(n,t),ye.init(n,t)}),$R=A("ZodNanoID",(n,t)=>{XT.init(n,t),ye.init(n,t)}),TR=A("ZodCUID",(n,t)=>{QT.init(n,t),ye.init(n,t)}),IR=A("ZodCUID2",(n,t)=>{eI.init(n,t),ye.init(n,t)}),CR=A("ZodULID",(n,t)=>{tI.init(n,t),ye.init(n,t)}),RR=A("ZodXID",(n,t)=>{nI.init(n,t),ye.init(n,t)}),PR=A("ZodKSUID",(n,t)=>{rI.init(n,t),ye.init(n,t)}),DR=A("ZodIPv4",(n,t)=>{lI.init(n,t),ye.init(n,t)}),LR=A("ZodIPv6",(n,t)=>{cI.init(n,t),ye.init(n,t)}),zR=A("ZodCIDRv4",(n,t)=>{uI.init(n,t),ye.init(n,t)}),OR=A("ZodCIDRv6",(n,t)=>{hI.init(n,t),ye.init(n,t)}),MR=A("ZodBase64",(n,t)=>{dI.init(n,t),ye.init(n,t)}),NR=A("ZodBase64URL",(n,t)=>{fI.init(n,t),ye.init(n,t)}),UR=A("ZodE164",(n,t)=>{gI.init(n,t),ye.init(n,t)}),FR=A("ZodJWT",(n,t)=>{vI.init(n,t),ye.init(n,t)}),Hy=A("ZodNumber",(n,t)=>{Ty.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(r,i,s)=>MC(n,r,i),n.gt=(r,i)=>n.check(Cg(r,i)),n.gte=(r,i)=>n.check(mu(r,i)),n.min=(r,i)=>n.check(mu(r,i)),n.lt=(r,i)=>n.check(Ig(r,i)),n.lte=(r,i)=>n.check(gu(r,i)),n.max=(r,i)=>n.check(gu(r,i)),n.int=r=>n.check(Lg(r)),n.safe=r=>n.check(Lg(r)),n.positive=r=>n.check(Cg(0,r)),n.nonnegative=r=>n.check(mu(0,r)),n.negative=r=>n.check(Ig(0,r)),n.nonpositive=r=>n.check(gu(0,r)),n.multipleOf=(r,i)=>n.check(Rg(r,i)),n.step=(r,i)=>n.check(Rg(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 fC(Hy,n)}const HR=A("ZodNumberFormat",(n,t)=>{yI.init(n,t),Hy.init(n,t)});function Lg(n){return gC(HR,n)}const ZR=A("ZodBoolean",(n,t)=>{bI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>NC(n,e,r)});function Le(n){return mC(ZR,n)}const WR=A("ZodUnknown",(n,t)=>{wI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>FC()});function _(){return vC(WR)}const VR=A("ZodNever",(n,t)=>{SI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>UC(n,e,r)});function jR(n){return yC(VR,n)}const BR=A("ZodArray",(n,t)=>{_I.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>jC(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Il(e,r)),n.nonempty=e=>n.check(Il(1,e)),n.max=(e,r)=>n.check(Dy(e,r)),n.length=(e,r)=>n.check(Ly(e,r)),n.unwrap=()=>n.element});function z(n,t){return CC(BR,n,t)}const Zy=A("ZodObject",(n,t)=>{xI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>BC(n,e,r,i),ee(n,"shape",()=>t.shape),n.keyof=()=>jy(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:jR()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>j$(n,e),n.safeExtend=e=>B$(n,e),n.merge=e=>G$(n,e),n.pick=e=>W$(n,e),n.omit=e=>V$(n,e),n.partial=(...e)=>q$(By,n,e[0]),n.required=(...e)=>Y$(Gy,n,e[0])});function Wy(n,t){const e={type:"object",shape:n??{},...O(t)};return new Zy(e)}function v(n,t){return new Zy({type:"object",shape:n,catchall:_(),...O(t)})}const Vy=A("ZodUnion",(n,t)=>{Ry.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>GC(n,e,r,i),n.options=t.options});function j(n,t){return new Vy({type:"union",options:n,...O(t)})}const GR=A("ZodDiscriminatedUnion",(n,t)=>{Vy.init(n,t),EI.init(n,t)});function qR(n,t,e){return new GR({type:"union",options:t,discriminator:n,...O(e)})}const YR=A("ZodIntersection",(n,t)=>{AI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>qC(n,e,r,i)});function gc(n,t){return new YR({type:"intersection",left:n,right:t})}const KR=A("ZodRecord",(n,t)=>{$I.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>YC(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function k(n,t,e){return new KR({type:"record",keyType:n,valueType:t,...O(e)})}const nh=A("ZodEnum",(n,t)=>{TI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(r,i,s)=>HC(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 nh({...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 nh({...t,checks:[],...O(i),entries:s})}});function jy(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new nh({type:"enum",entries:e,...O(t)})}const JR=A("ZodLiteral",(n,t)=>{II.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>ZC(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 JR({type:"literal",values:Array.isArray(n)?n:[n],...O(t)})}const XR=A("ZodTransform",(n,t)=>{CI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>VC(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new dy(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(ao(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(ao(o))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function QR(n){return new XR({type:"transform",transform:n})}const By=A("ZodOptional",(n,t)=>{Py.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Ny(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function zg(n){return new By({type:"optional",innerType:n})}const eP=A("ZodExactOptional",(n,t)=>{RI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Ny(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function tP(n){return new eP({type:"optional",innerType:n})}const nP=A("ZodNullable",(n,t)=>{PI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>KC(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Og(n){return new nP({type:"nullable",innerType:n})}const rP=A("ZodDefault",(n,t)=>{DI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>XC(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function iP(n,t){return new rP({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():my(t)}})}const sP=A("ZodPrefault",(n,t)=>{LI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>QC(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function oP(n,t){return new sP({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():my(t)}})}const Gy=A("ZodNonOptional",(n,t)=>{zI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>JC(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function aP(n,t){return new Gy({type:"nonoptional",innerType:n,...O(t)})}const lP=A("ZodCatch",(n,t)=>{OI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>eR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function cP(n,t){return new lP({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const uP=A("ZodPipe",(n,t)=>{MI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>tR(n,e,r,i),n.in=t.in,n.out=t.out});function Mg(n,t){return new uP({type:"pipe",in:n,out:t})}const hP=A("ZodReadonly",(n,t)=>{NI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>nR(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function dP(n){return new hP({type:"readonly",innerType:n})}const pP=A("ZodCustom",(n,t)=>{UI.init(n,t),ve.init(n,t),n._zod.processJSONSchema=(e,r,i)=>WC(n,e)});function fP(n,t={}){return RC(pP,n,t)}function gP(n){return PC(n)}const mP=[".md",".markdown"];function qy(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function Yy(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function vP(n){return Yy(n).toLowerCase()}function yP(n,t){const e=vP(n);return t.some(r=>e.endsWith(r))}function Ky(n){return!qy(n)&&yP(n,mP)}function bP(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}const wP=Wy({id:d().min(1),kind:$("path"),title:d(),path:d()}).strict(),SP=Wy({id:d().min(1),kind:$("url"),title:d(),url:d().refine(bP,{message:"url must be an http(s) URL"})}).strict();qR("kind",[wP,SP]);function Jy(n){return typeof n=="object"&&n!==null}function Xy(n){return!Jy(n)||n.type!=="ready"?!1:!("id"in n)}function Qy(n){return!(!Jy(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const _P="/views/markdown/",kP="/views/url-unsupported/";function eb(n){return`/artifact/${encodeURIComponent(n)}`}function xP(n,t){return`${eb(n)}/${encodeURIComponent(t)}`}function EP(n){return`/markdown/${encodeURIComponent(n)}`}function Rl(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:kP,contentURL:null};if(Ky(n.path)){const r={viewURL:_P,contentURL:EP(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=qy(n.path)?`${eb(n.id)}/`:xP(n.id,Yy(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const AP="serverURL",$P="token",TP="mode",IP="electron";function tb(n=window.location.search,t=window.location.origin){const r=new URLSearchParams(n).get(AP);return r?new URL(r).origin:new URL(t).origin}function Ng(n=window.location.search){return new URLSearchParams(n).get($P)}function ln(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(TP)===IP}const de={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"},CP=1,RP=v({_meta:k(d(),_()).nullish(),terminal:Le().optional().default(!1)}),PP=v({_meta:k(d(),_()).nullish(),label:d().nullish(),name:d(),optional:Le().optional().default(!1),secret:Le().optional().default(!0)}),DP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),name:d()}),LP=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:z(PP)}),zP=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),description:d().nullish(),env:k(d(),d()).optional(),id:d(),name:d()}),OP=j([LP.and(v({type:$("env_var")})),zP.and(v({type:$("terminal")})),DP]),MP=v({_meta:k(d(),_()).nullish(),methodId:d()}),NP=v({_meta:k(d(),_()).nullish()}),UP=v({_meta:k(d(),_()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),FP=v({default:Le().nullish(),description:d().nullish(),title:d().nullish()}),HP=v({_meta:k(d(),_()).nullish()}),ZP=v({_meta:k(d(),_()).nullish()}),WP=v({amount:H(),currency:d()}),VP=v({_meta:k(d(),_()).nullish(),terminalId:d()}),jP=v({_meta:k(d(),_()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),BP=j([d(),H(),H(),Le(),z(d())]),GP=v({content:k(d(),BP).nullish()}),qP=j([GP.and(v({action:$("accept")})),v({action:$("decline")}),v({action:$("cancel")})]),YP=v({_meta:k(d(),_()).nullish()}),nb=d(),KP=v({_meta:k(d(),_()).nullish(),elicitationId:nb}),JP=v({_meta:k(d(),_()).nullish(),action:qP}),XP=$("object"),QP=$("string"),eD=v({_meta:k(d(),_()).nullish()}),tD=v({_meta:k(d(),_()).nullish(),form:YP.nullish(),url:eD.nullish()}),nD=v({elicitationId:nb,url:d().url()}),rb=v({const:d(),title:d()}),ib=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),rD=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"})]),sb=v({code:rD,data:_().optional(),message:d()}),ob=_(),ab=_(),lb=_(),iD=v({_meta:k(d(),_()).nullish(),readTextFile:Le().optional().default(!1),writeTextFile:Le().optional().default(!1)}),cb=v({_meta:k(d(),_()).nullish(),name:d(),value:d()}),ub=v({_meta:k(d(),_()).nullish(),name:d(),title:d().nullish(),version:d()}),sD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),oD=v({_meta:k(d(),_()).nullish()}),aD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),lD=v({_meta:k(d(),_()).nullish()}),cD=v({_meta:k(d(),_()).nullish(),logout:lD.nullish()}),uD=v({_meta:k(d(),_()).nullish()}),hD=v({_meta:k(d(),_()).nullish()}),dD=v({_meta:k(d(),_()).nullish(),http:Le().optional().default(!1),sse:Le().optional().default(!1)}),pD=v({_meta:k(d(),_()).nullish(),headers:z(cb),name:d(),url:d()}),fD=v({_meta:k(d(),_()).nullish(),headers:z(cb),name:d(),url:d()}),gD=v({_meta:k(d(),_()).nullish(),args:z(d()),command:d(),env:z(ib),name:d()}),mc=j([pD.and(v({type:$("http")})),fD.and(v({type:$("sse")})),gD]),Wd=d(),mD=v({_meta:k(d(),_()).nullish(),description:d().nullish(),modelId:Wd,name:d()}),vD=j([$("error"),$("warning"),$("information"),$("hint")]),yD=v({_meta:k(d(),_()).nullish()}),bD=v({_meta:k(d(),_()).nullish()}),wD=v({_meta:k(d(),_()).nullish()}),SD=v({_meta:k(d(),_()).nullish()}),_D=v({_meta:k(d(),_()).nullish()}),kD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),xD=v({diff:d(),uri:d()}),ED=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()}),AD=v({_meta:k(d(),_()).nullish()}),$D=v({_meta:k(d(),_()).nullish()}),TD=v({languageId:d(),text:d(),uri:d()}),ID=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),CD=j([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),RD=v({excerpts:z(ED),uri:d()}),PD=v({_meta:k(d(),_()).nullish()}),DD=v({_meta:k(d(),_()).nullish()}),LD=v({name:d(),owner:d(),remoteUrl:d()}),zD=v({_meta:k(d(),_()).nullish()}),OD=v({_meta:k(d(),_()).nullish(),jump:AD.nullish(),rename:DD.nullish(),searchAndReplace:zD.nullish()}),MD=v({id:d(),isRegex:Le().nullish(),replace:d(),search:d(),uri:d()}),ND=j([$("automatic"),$("diagnostic"),$("manual")]),UD=v({_meta:k(d(),_()).nullish(),maxCount:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),FD=v({_meta:k(d(),_()).nullish(),diagnostics:yD.nullish(),editHistory:kD.nullish(),openFiles:$D.nullish(),recentFiles:ID.nullish(),relatedSnippets:PD.nullish(),userActions:UD.nullish()}),HD=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc)}),ZD=v({default:H().nullish(),description:d().nullish(),maximum:H().nullish(),minimum:H().nullish(),title:d().nullish()}),hb=d(),WD=j([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),VD=v({_meta:k(d(),_()).nullish(),kind:WD,name:d(),optionId:hb}),jD=j([$("high"),$("medium"),$("low")]),BD=j([$("pending"),$("in_progress"),$("completed")]),GD=v({_meta:k(d(),_()).nullish(),content:d(),priority:jD,status:BD}),qD=v({_meta:k(d(),_()).nullish(),entries:z(GD)}),Qn=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"})}),YD=v({id:d(),position:Qn,uri:d()}),KD=v({id:d(),newName:d(),position:Qn,uri:d()}),JD=v({action:d(),position:Qn,timestampMs:H(),uri:d()}),db=j([$("utf-16"),$("utf-32"),$("utf-8")]),XD=v({_meta:k(d(),_()).nullish(),auth:RP.optional().default({terminal:!1}),elicitation:tD.nullish(),fs:iD.optional().default({readTextFile:!1,writeTextFile:!1}),nes:OD.nullish(),positionEncodings:z(db).optional(),terminal:Le().optional().default(!1)}),QD=v({_meta:k(d(),_()).nullish(),audio:Le().optional().default(!1),embeddedContext:Le().optional().default(!1),image:Le().optional().default(!1)}),pb=H().int().gte(0).lte(65535),eL=v({_meta:k(d(),_()).nullish(),clientCapabilities:XD.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:ub.nullish(),protocolVersion:pb}),Ss=v({end:Qn,start:Qn}),tL=v({message:d(),range:Ss,severity:vD,uri:d()}),nL=v({languageId:d(),lastFocusedMs:H().nullish(),uri:d(),visibleRange:Ss.nullish()}),rL=v({_meta:k(d(),_()).nullish(),diagnostics:z(tL).nullish(),editHistory:z(xD).nullish(),openFiles:z(nL).nullish(),recentFiles:z(TD).nullish(),relatedSnippets:z(RD).nullish(),userActions:z(JD).nullish()}),iL=v({newText:d(),range:Ss}),sL=v({cursorPosition:Qn.nullish(),edits:z(iL),id:d(),uri:d()}),oL=j([sL.and(v({kind:$("edit")})),YD.and(v({kind:$("jump")})),KD.and(v({kind:$("rename")})),MD.and(v({kind:$("searchAndReplace")}))]),aL=v({_meta:k(d(),_()).nullish(),content:d()}),lL=v({_meta:k(d(),_()).nullish()}),jr=j([H(),d()]).nullable();v({_meta:k(d(),_()).nullish(),requestId:jr});const cL=jy(["assistant","user"]),va=v({_meta:k(d(),_()).nullish(),audience:z(cL).nullish(),lastModified:d().nullish(),priority:H().nullish()}),uL=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),data:d(),mimeType:d()}),hL=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),dL=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:H().nullish(),title:d().nullish(),uri:d()}),pL=v({_meta:k(d(),_()).nullish(),optionId:hb}),fL=j([v({outcome:$("cancelled")}),pL.and(v({outcome:$("selected")}))]),gL=v({_meta:k(d(),_()).nullish(),outcome:fL}),mL=v({_meta:k(d(),_()).nullish()}),vL=v({_meta:k(d(),_()).nullish()}),yL=v({currentValue:Le()}),bL=d(),fb=d(),wL=j([$("mode"),$("model"),$("thought_level"),d()]),Vd=d(),gb=v({_meta:k(d(),_()).nullish(),description:d().nullish(),name:d(),value:Vd}),SL=v({_meta:k(d(),_()).nullish(),group:bL,name:d(),options:z(gb)}),_L=j([z(gb),z(SL)]),kL=v({currentValue:Vd,options:_L}),_s=gc(j([kL.and(v({type:$("select")})),yL.and(v({type:$("boolean")}))]),v({_meta:k(d(),_()).nullish(),category:wL.nullish(),description:d().nullish(),id:fb,name:d()})),xL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s)}),EL=v({_meta:k(d(),_()).nullish()}),Q=d(),AL=v({_meta:k(d(),_()).nullish(),id:d(),sessionId:Q}),$L=v({_meta:k(d(),_()).nullish(),sessionId:Q}),TL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),IL=v({_meta:k(d(),_()).nullish(),sessionId:Q}),mb=v({_meta:k(d(),_()).nullish(),args:z(d()).optional(),command:d(),cwd:d().nullish(),env:z(ib).optional(),outputByteLimit:H().nullish(),sessionId:Q}),CL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),RL=v({_meta:k(d(),_()).nullish(),position:Qn,sessionId:Q,uri:d(),version:H(),visibleRange:Ss}),PL=v({_meta:k(d(),_()).nullish(),languageId:d(),sessionId:Q,text:d(),uri:d(),version:H()}),DL=v({_meta:k(d(),_()).nullish(),sessionId:Q,uri:d()}),LL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc).optional(),sessionId:Q}),vb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),zL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc),sessionId:Q}),yb=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}),OL=v({_meta:k(d(),_()).nullish(),id:d(),reason:CD.nullish(),sessionId:Q}),bb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),ML=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),mcpServers:z(mc).optional(),sessionId:Q}),NL=v({_meta:k(d(),_()).nullish(),additionalDirectories:z(d()).optional(),cwd:d(),sessionId:Q,title:d().nullish(),updatedAt:d().nullish()}),UL=v({_meta:k(d(),_()).nullish(),nextCursor:d().nullish(),sessions:z(NL)}),FL=v({_meta:k(d(),_()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),HL=v({_meta:k(d(),_()).nullish()}),vc=d(),ZL=v({_meta:k(d(),_()).nullish(),currentModeId:vc}),WL=v({_meta:k(d(),_()).nullish(),description:d().nullish(),id:vc,name:d()}),yc=v({_meta:k(d(),_()).nullish(),availableModes:z(WL),currentModeId:vc}),bc=v({_meta:k(d(),_()).nullish(),availableModels:z(mD),currentModelId:Wd}),VL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish(),sessionId:Q}),jL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish()}),BL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish(),sessionId:Q}),GL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s).nullish(),models:bc.nullish(),modes:yc.nullish()}),qL=v({_meta:k(d(),_()).nullish()}),YL=v({_meta:k(d(),_()).nullish(),additionalDirectories:mL.nullish(),close:vL.nullish(),fork:EL.nullish(),list:HL.nullish(),resume:qL.nullish()}),KL=gc(j([v({type:$("boolean"),value:Le()}),v({value:Vd})]),v({_meta:k(d(),_()).nullish(),configId:fb,sessionId:Q})),JL=v({_meta:k(d(),_()).nullish(),configOptions:z(_s)}),XL=v({_meta:k(d(),_()).nullish(),modeId:vc,sessionId:Q}),QL=v({_meta:k(d(),_()).nullish()}),e2=v({_meta:k(d(),_()).nullish(),modelId:Wd,sessionId:Q}),t2=v({_meta:k(d(),_()).nullish()}),n2=v({_meta:k(d(),_()).nullish(),sessionId:Q}),r2=j([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),i2=j([$("email"),$("uri"),$("date"),$("date-time")]),s2=v({default:d().nullish(),description:d().nullish(),enum:z(d()).nullish(),format:i2.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(rb).nullish(),pattern:d().nullish(),title:d().nullish()}),o2=v({_meta:k(d(),_()).nullish(),context:rL.nullish(),position:Qn,selection:Ss.nullish(),sessionId:Q,triggerKind:ND,uri:d(),version:H()}),a2=v({_meta:k(d(),_()).nullish(),suggestions:z(oL)}),l2=v({_meta:k(d(),_()).nullish(),terminalId:d()}),c2=v({_meta:k(d(),_()).nullish(),exitCode:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),wb=v({_meta:k(d(),_()).nullish(),sessionId:Q,terminalId:d()}),u2=v({_meta:k(d(),_()).nullish(),exitStatus:c2.nullish(),output:d(),truncated:Le()}),h2=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),text:d()}),d2=v({range:Ss.nullish(),text:d()}),p2=v({_meta:k(d(),_()).nullish(),contentChanges:z(d2),sessionId:Q,uri:d(),version:H()});v({method:d(),params:j([$L,PL,p2,CL,DL,RL,AL,OL,ob]).nullish()});const f2=j([$("full"),$("incremental")]),g2=v({_meta:k(d(),_()).nullish(),syncKind:f2}),m2=v({_meta:k(d(),_()).nullish(),didChange:g2.nullish(),didClose:bD.nullish(),didFocus:wD.nullish(),didOpen:SD.nullish(),didSave:_D.nullish()}),v2=v({_meta:k(d(),_()).nullish(),document:m2.nullish()}),y2=v({_meta:k(d(),_()).nullish(),context:FD.nullish(),events:v2.nullish()}),b2=v({_meta:k(d(),_()).nullish(),auth:cD.optional().default({}),loadSession:Le().optional().default(!1),mcpCapabilities:dD.optional().default({http:!1,sse:!1}),nes:y2.nullish(),positionEncoding:db.nullish(),promptCapabilities:QD.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:YL.optional().default({})}),w2=v({_meta:k(d(),_()).nullish(),agentCapabilities:b2.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:ub.nullish(),authMethods:z(OP).optional().default([]),protocolVersion:pb}),S2=v({_meta:k(d(),_()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),_2=j([S2,UP]),k2=v({_meta:k(d(),_()).nullish(),annotations:va.nullish(),resource:_2}),jd=j([h2.and(v({type:$("text")})),hL.and(v({type:$("image")})),uL.and(v({type:$("audio")})),dL.and(v({type:$("resource_link")})),k2.and(v({type:$("resource")}))]),x2=v({_meta:k(d(),_()).nullish(),content:jd}),vu=v({_meta:k(d(),_()).nullish(),content:jd,messageId:d().nullish()}),E2=v({_meta:k(d(),_()).nullish(),messageId:d().nullish(),prompt:z(jd),sessionId:Q}),A2=v({anyOf:z(rb)}),Sb=j([x2.and(v({type:$("content")})),jP.and(v({type:$("diff")})),l2.and(v({type:$("terminal")}))]),_b=d(),kb=v({_meta:k(d(),_()).nullish(),line:H().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),xb=j([$("pending"),$("in_progress"),$("completed"),$("failed")]),Eb=j([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),$2=v({_meta:k(d(),_()).nullish(),content:z(Sb).optional(),kind:Eb.optional(),locations:z(kb).optional(),rawInput:_().optional(),rawOutput:_().optional(),status:xb.optional(),title:d(),toolCallId:_b}),Ab=v({_meta:k(d(),_()).nullish(),content:z(Sb).nullish(),kind:Eb.nullish(),locations:z(kb).nullish(),rawInput:_().optional(),rawOutput:_().optional(),status:xb.nullish(),title:d().nullish(),toolCallId:_b}),$b=v({_meta:k(d(),_()).nullish(),options:z(VD),sessionId:Q,toolCall:Ab}),T2=v({_meta:k(d(),_()).nullish(),hint:d()}),I2=T2,C2=v({_meta:k(d(),_()).nullish(),description:d(),input:I2.nullish(),name:d()}),R2=v({_meta:k(d(),_()).nullish(),availableCommands:z(C2)}),P2=v({enum:z(d()),type:QP}),D2=j([P2,A2]),L2=v({default:z(d()).nullish(),description:d().nullish(),items:D2,maxItems:H().nullish(),minItems:H().nullish(),title:d().nullish()}),z2=j([s2.and(v({type:$("string")})),ZD.and(v({type:$("number")})),sD.and(v({type:$("integer")})),FP.and(v({type:$("boolean")})),L2.and(v({type:$("array")}))]),O2=v({description:d().nullish(),properties:k(d(),z2).optional().default({}),required:z(d()).nullish(),title:d().nullish(),type:XP.optional().default("object")}),M2=v({requestedSchema:O2}),N2=gc(j([M2.and(v({mode:$("form")})),nD.and(v({mode:$("url")}))]),v({_meta:k(d(),_()).nullish(),message:d(),sessionId:Q})),U2=v({cachedReadTokens:H().nullish(),cachedWriteTokens:H().nullish(),inputTokens:H(),outputTokens:H(),thoughtTokens:H().nullish(),totalTokens:H()}),F2=v({_meta:k(d(),_()).nullish(),stopReason:r2,usage:U2.nullish(),userMessageId:d().nullish()});j([v({id:jr,result:j([w2,NP,hD,BL,jL,UL,VL,GL,ZP,QL,JL,F2,t2,n2,a2,HP,lb])}),v({error:sb,id:jr})]);const H2=v({_meta:k(d(),_()).nullish(),cost:WP.nullish(),size:H(),used:H()}),Z2=j([vu.and(v({sessionUpdate:$("user_message_chunk")})),vu.and(v({sessionUpdate:$("agent_message_chunk")})),vu.and(v({sessionUpdate:$("agent_thought_chunk")})),$2.and(v({sessionUpdate:$("tool_call")})),Ab.and(v({sessionUpdate:$("tool_call_update")})),qD.and(v({sessionUpdate:$("plan")})),R2.and(v({sessionUpdate:$("available_commands_update")})),ZL.and(v({sessionUpdate:$("current_mode_update")})),xL.and(v({sessionUpdate:$("config_option_update")})),FL.and(v({sessionUpdate:$("session_info_update")})),H2.and(v({sessionUpdate:$("usage_update")}))]),Tb=v({_meta:k(d(),_()).nullish(),sessionId:Q,update:Z2});v({method:d(),params:j([Tb,KP,ob]).nullish()});const Ib=v({_meta:k(d(),_()).nullish(),sessionId:Q,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()}),V2=v({name:d(),uri:d()}),j2=v({_meta:k(d(),_()).nullish(),repository:LD.nullish(),workspaceFolders:z(V2).nullish(),workspaceUri:d().nullish()});v({id:jr,method:d(),params:j([eL,MP,uD,HD,zL,aD,LL,ML,IL,XL,KL,E2,e2,j2,o2,TL,ab]).nullish()});const Cb=v({_meta:k(d(),_()).nullish(),content:d(),path:d(),sessionId:Q});v({id:jr,method:d(),params:j([Cb,yb,$b,mb,wb,bb,Ib,vb,N2,ab]).nullish()});const B2=v({_meta:k(d(),_()).nullish()});j([v({id:jr,result:j([B2,aL,gL,VP,u2,lL,W2,oD,JP,lb])}),v({error:sb,id:jr})]);var X;class G2{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=Cb.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,x)}case gn.fs_read_text_file:{const x=yb.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,x)}case gn.session_request_permission:{const x=$b.parse(a);return r.requestPermission(x)}case gn.terminal_create:{const x=mb.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,x)}case gn.terminal_output:{const x=wb.parse(a);return(f=r.terminalOutput)==null?void 0:f.call(r,x)}case gn.terminal_release:{const x=bb.parse(a);return await((y=r.releaseTerminal)==null?void 0:y.call(r,x))??{}}case gn.terminal_wait_for_exit:{const x=Ib.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,x)}case gn.terminal_kill:{const x=vb.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=Tb.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw Ce.methodNotFound(o)}};w(this,X,new q2(i,s,e))}async initialize(t){return await l(this,X).sendRequest(de.initialize,t)}async newSession(t){return await l(this,X).sendRequest(de.session_new,t)}async loadSession(t){return await l(this,X).sendRequest(de.session_load,t)??{}}async unstable_forkSession(t){return await l(this,X).sendRequest(de.session_fork,t)}async listSessions(t){return await l(this,X).sendRequest(de.session_list,t)}async unstable_resumeSession(t){return await l(this,X).sendRequest(de.session_resume,t)}async unstable_closeSession(t){return await l(this,X).sendRequest(de.session_close,t)}async setSessionMode(t){return await l(this,X).sendRequest(de.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await l(this,X).sendRequest(de.session_set_model,t)??{}}async setSessionConfigOption(t){return await l(this,X).sendRequest(de.session_set_config_option,t)}async authenticate(t){return await l(this,X).sendRequest(de.authenticate,t)??{}}async unstable_logout(t){return await l(this,X).sendRequest(de.logout,t)??{}}async prompt(t){return await l(this,X).sendRequest(de.session_prompt,t)}async cancel(t){return await l(this,X).sendNotification(de.session_cancel,t)}async unstable_startNes(t){return await l(this,X).sendRequest(de.nes_start,t)}async unstable_suggestNes(t){return await l(this,X).sendRequest(de.nes_suggest,t)}async unstable_closeNes(t){return await l(this,X).sendRequest(de.nes_close,t)??{}}async unstable_didOpenDocument(t){return await l(this,X).sendNotification(de.document_did_open,t)}async unstable_didChangeDocument(t){return await l(this,X).sendNotification(de.document_did_change,t)}async unstable_didCloseDocument(t){return await l(this,X).sendNotification(de.document_did_close,t)}async unstable_didSaveDocument(t){return await l(this,X).sendNotification(de.document_did_save,t)}async unstable_didFocusDocument(t){return await l(this,X).sendNotification(de.document_did_focus,t)}async unstable_acceptNes(t){return await l(this,X).sendNotification(de.nes_accept,t)}async unstable_rejectNes(t){return await l(this,X).sendNotification(de.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 Nn,Zl,mo,vo,Li,zi,Bt,yo,ge,Rb,rh,Pb,Db,Lb,zb,ih,Zs;class q2{constructor(t,e,r){S(this,ge);S(this,Nn,new Map);S(this,Zl,0);S(this,mo);S(this,vo);S(this,Li);S(this,zi,Promise.resolve());S(this,Bt,new AbortController);S(this,yo);w(this,mo,t),w(this,vo,e),w(this,Li,r),w(this,yo,new Promise(i=>{l(this,Bt).signal.addEventListener("abort",()=>i())})),p(this,ge,Rb).call(this)}get signal(){return l(this,Bt).signal}get closed(){return l(this,yo)}async sendRequest(t,e){p(this,ge,ih).call(this);const r=Lp(this,Zl)._++,i=new Promise((s,o)=>{l(this,Nn).set(r,{resolve:s,reject:o})});return await p(this,ge,Zs).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){p(this,ge,ih).call(this),await p(this,ge,Zs).call(this,{jsonrpc:"2.0",method:t,params:e})}}Nn=new WeakMap,Zl=new WeakMap,mo=new WeakMap,vo=new WeakMap,Li=new WeakMap,zi=new WeakMap,Bt=new WeakMap,yo=new WeakMap,ge=new WeakSet,Rb=async function(){let t;try{const e=l(this,Li).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,ge,Pb).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&p(this,ge,Zs).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{p(this,ge,rh).call(this,t)}},rh=function(t){if(l(this,Bt).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of l(this,Nn).values())r.reject(e);l(this,Nn).clear(),l(this,Bt).abort(e)},Pb=async function(t){if("method"in t&&"id"in t){const e=await p(this,ge,Db).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await p(this,ge,Zs).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await p(this,ge,Lb).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?p(this,ge,zb).call(this,t):console.error("Invalid message",{message:t})},Db=async function(t,e){try{return{result:await l(this,mo).call(this,t,e)??null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Pg)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()}}},Lb=async function(t,e){try{return await l(this,vo).call(this,t,e),{result:null}}catch(r){if(r instanceof Ce)return r.toResult();if(r instanceof Pg)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,Nn).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,Nn).delete(t.id)}else console.error("Got response to unknown request",t.id)},ih=function(){if(l(this,Bt).signal.aborted)throw l(this,Bt).signal.reason??new Error("ACP connection closed")},Zs=async function(t){return w(this,zi,l(this,zi).then(async()=>{const e=l(this,Li).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{p(this,ge,rh).call(this,e)})),l(this,zi)};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 Y2=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,K2=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,J2=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,X2=/\b(tv|television|screen|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,Q2=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,ez="single_session",tz={name:"television-acp-client",version:"0.0.0"},Ob="agent:main:television",nz=ma(zt);var Oi,Gt,ht,qt,Un,At,Sn,Yt,Kt,Fn,$t,Mi,Ni,Jt,Ke,_n,Ui,Tr,kn,Hn,bo,Tt,Xt,Wl,Qt,T,sh,Mb,Nb,Ub,rl,Fb,Hb,Zb,Wb,Vb,jb,Bb,pr,vi,yi,mn,Gb,bi,oh,ah,il,qb,sl,lh,ch,wo,So,ol,wi,uh,Yb;class rz extends nz{constructor(e){super();S(this,T);S(this,Oi,"disconnected");S(this,Gt,null);S(this,ht,new Map);S(this,qt,null);S(this,Un,null);S(this,At,null);S(this,Sn,null);S(this,Yt,null);S(this,Kt,null);S(this,Fn);S(this,$t,null);S(this,Mi,0);S(this,Ni,1);S(this,Jt,null);S(this,Ke,null);S(this,_n,!1);S(this,Ui,!1);S(this,Tr,!1);S(this,kn,null);S(this,Hn,new Set);S(this,bo);S(this,Tt);S(this,Xt);S(this,Wl,e=>{p(this,T,Nb).call(this,e)});S(this,Qt,null);S(this,wo,()=>{p(this,T,wi).call(this,"ACP bridge websocket closed")});S(this,So,()=>{p(this,T,wi).call(this,"ACP bridge websocket error")});w(this,Tt,e),w(this,Xt,e.sessionMode??ez),w(this,Fn,e.mappedSessionStore??iz()),w(this,bo,e.createSocket??(r=>new WebSocket(r)))}get status(){return l(this,Oi)}get messages(){return[...l(this,ht).values()]}get enabled(){return l(this,Tt).enabled??!1}setToken(e){l(this,Tt).token=e??""}setEnabled(e){l(this,Tt).enabled=e,e||(p(this,T,ol).call(this),w(this,Gt,null),p(this,T,mn).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){l(this,Un)===null&&(w(this,Gt,null),w(this,Un,p(this,T,Mb).call(this)));try{await l(this,Un),await p(this,T,rl).call(this)}catch(e){throw p(this,T,wi).call(this,yu(e)),e}}}dispose(){p(this,T,ol).call(this),w(this,Gt,null),p(this,T,mn).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,sh).call(this,"ready")),(l(this,Yt)===null||l(this,$t)!==p(this,T,sl).call(this))&&await p(this,T,rl).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,vi).call(this,{id:p(this,T,bi).call(this,"user"),kind:"user",text:r,status:"final"}),p(this,T,mn).call(this,"running");try{const i=await p(this,T,il).call(this).prompt({sessionId:p(this,T,ah).call(this),prompt:[{type:"text",text:p(this,T,Gb).call(this,r)}]});p(this,T,pr).call(this,i.stopReason==="cancelled"?"cancelled":"final"),p(this,T,mn).call(this,"ready")}catch(i){throw p(this,T,Yb).call(this)||(p(this,T,pr).call(this,"error"),p(this,T,mn).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await p(this,T,sh).call(this,"ready"));const e=p(this,T,sl).call(this);((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="mapped"?l(this,Fn).clearActualSessionId(e):w(this,Mi,l(this,Mi)+1),w(this,At,null),w(this,Sn,null),w(this,Yt,null),w(this,$t,null),p(this,T,uh).call(this)}async cancel(){this.status==="running"&&(p(this,T,mn).call(this,"cancelling"),await p(this,T,il).call(this).cancel({sessionId:p(this,T,ah).call(this)}))}setScreenContext(e){var s,o,a;if(e===null){if(l(this,Ke)===null)return;w(this,Ke,null),w(this,_n,!1);return}const r={screenID:e.screenID,screenName:e.screenName};if(((s=l(this,Ke))==null?void 0:s.screenID)===r.screenID&&((o=l(this,Ke))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,Ke))==null?void 0:a.screenID)??null;if(w(this,Ke,r),l(this,Xt)==="single_session"){(!l(this,$t)||i!==r.screenID)&&w(this,_n,!0);return}l(this,$t)!==p(this,T,lh).call(this,r.screenID)&&(w(this,At,null),w(this,Sn,null),l(this,qt)&&this.status==="ready"&&p(this,T,rl).call(this).catch(c=>{p(this,T,wi).call(this,yu(c))}))}}Oi=new WeakMap,Gt=new WeakMap,ht=new WeakMap,qt=new WeakMap,Un=new WeakMap,At=new WeakMap,Sn=new WeakMap,Yt=new WeakMap,Kt=new WeakMap,Fn=new WeakMap,$t=new WeakMap,Mi=new WeakMap,Ni=new WeakMap,Jt=new WeakMap,Ke=new WeakMap,_n=new WeakMap,Ui=new WeakMap,Tr=new WeakMap,kn=new WeakMap,Hn=new WeakMap,bo=new WeakMap,Tt=new WeakMap,Xt=new WeakMap,Wl=new WeakMap,Qt=new WeakMap,T=new WeakSet,sh=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)})}},Mb=async function(){try{const{stream:e,socket:r,metadata:i}=await lz({serverURL:l(this,Tt).serverURL,token:l(this,Tt).token,createSocket:l(this,bo),onDisconnect:l(this,Wl)});w(this,Kt,i),w(this,Qt,r),r.addEventListener("close",l(this,wo)),r.addEventListener("error",l(this,So)),w(this,qt,new G2(s=>({connection:s,sessionUpdate:async o=>{await p(this,T,Hb).call(this,o)},requestPermission:async o=>p(this,T,Zb).call(this,o)}),e)),await l(this,qt).initialize({protocolVersion:CP,clientCapabilities:{},clientInfo:tz})}catch(e){throw e}},Nb=function(e){p(this,T,wi).call(this,yu(e))},Ub=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})`)},rl=async function(){const e=p(this,T,sl).call(this);if(l(this,At)&&l(this,Sn)===e){await l(this,At);return}w(this,Sn,e),w(this,At,p(this,T,Fb).call(this,e)),await l(this,At)},Fb=async function(e){var c;const r=p(this,T,il).call(this);p(this,T,uh).call(this);let i,s=!1,o=null;const a={cwd:p(this,T,qb).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(w(this,Tr,!0),w(this,kn,null),((c=l(this,Kt))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=l(this,Fn).getActualSessionId(e);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(sz(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,Fn).setActualSessionId(e,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,l(this,Fn).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,Tr,!1),w(this,kn,null),p(this,T,pr).call(this,"final")}p(this,T,Ub).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),w(this,Yt,i),w(this,$t,e),w(this,Ui,!0),s?(l(this,Hn).add(e),l(this,Xt)==="single_session"&&w(this,_n,!1)):(l(this,Hn).delete(e),w(this,_n,l(this,Xt)==="single_session")),w(this,Gt,null),p(this,T,mn).call(this,"ready")},Hb=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&p(this,T,Bb).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&p(this,T,Wb).call(this,r.content.text);return;case"tool_call":p(this,T,Vb).call(this,r);return;case"tool_call_update":p(this,T,jb).call(this,r);return;case"agent_thought_chunk":return;default:return}},Zb=async function(e){return{outcome:{outcome:"cancelled"}}},Wb=function(e){w(this,kn,null);const r=az(e);if(!r)return;if(!l(this,Jt)){const s={id:p(this,T,bi).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};w(this,Jt,s.id),p(this,T,vi).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,yi).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Vb=function(e){p(this,T,pr).call(this,"final");const r=p(this,T,oh).call(this,e.toolCallId),i=Fg("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??p(this,T,bi).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,yi).call(this,s);return}p(this,T,vi).call(this,s)},jb=function(e){const r=p(this,T,oh).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=Fg(e.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??p(this,T,bi).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,yi).call(this,a);return}p(this,T,vi).call(this,a)},Bb=function(e){if(p(this,T,pr).call(this,"final"),!e)return;const r=l(this,Tr)?l(this,kn):null;if(!r){const s=Ug(e);if(!s)return;const o={id:p(this,T,bi).call(this,"user"),kind:"user",text:s,status:"final"};p(this,T,vi).call(this,o),l(this,Tr)&&w(this,kn,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,yi).call(this,{...i,text:Ug(`${i.text}${e}`)})},pr=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,yi).call(this,{...r,status:e}),w(this,Jt,null)},vi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new pu("messages-changed"))},yi=function(e){l(this,ht).set(e.id,e),this.dispatchEvent(new pu("messages-changed"))},mn=function(e){l(this,Oi)!==e&&(w(this,Oi,e),this.dispatchEvent(new WA("status-changed")))},Gb=function(e){const r=l(this,$t);if(!r)return e;const i=l(this,Ke)?l(this,Xt)==="single_session"?l(this,_n)||!l(this,Hn).has(r):!l(this,Hn).has(r):!1,s=l(this,Ui)&&(l(this,Ke)!==null||X2.test(e));if(!(s||i))return e;s&&w(this,Ui,!1),i&&(w(this,_n,!1),l(this,Hn).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,Ke)?(a.push("This conversation is currently attached to the screen below."),a.push(`screen_id: ${l(this,Ke).screenID}`),a.push(`screen_name: ${l(this,Ke).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
+ `)},bi=function(e){const r=`${e}-${l(this,Ni)}`;return w(this,Ni,l(this,Ni)+1),r},oh=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},ah=function(){if(!l(this,Yt))throw new Error("ACP session is not ready");return l(this,Yt)},il=function(){if(!l(this,qt))throw new Error("ACP connection is not ready");return l(this,qt)},qb=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},sl=function(){var r;if(l(this,Xt)==="single_session")return p(this,T,ch).call(this,`${Ob}-${(l(this,Tt).clientGUID??"default-client").toLowerCase()}`);const e=(r=l(this,Ke))==null?void 0:r.screenID;if(!e)throw new Error("Screen context is required for per-screen session mode");return p(this,T,lh).call(this,e)},lh=function(e){return p(this,T,ch).call(this,oz(l(this,Xt),e,l(this,Tt).clientGUID??"default-client"))},ch=function(e){var r;return((r=l(this,Kt))==null?void 0:r.sessionIdStrategy)==="deterministic"&&l(this,Mi)>0?`${e}:epoch-${l(this,Mi)}`:e},wo=new WeakMap,So=new WeakMap,ol=function(){w(this,qt,null),w(this,Un,null),w(this,At,null),w(this,Sn,null),w(this,Yt,null),w(this,$t,null),w(this,Kt,null),l(this,Qt)&&(l(this,Qt).removeEventListener("close",l(this,wo)),l(this,Qt).removeEventListener("error",l(this,So)),l(this,Qt).close(),w(this,Qt,null))},wi=function(e){const r=l(this,qt)!==null||l(this,Un)!==null||l(this,At)!==null||l(this,Sn)!==null||l(this,Yt)!==null||l(this,$t)!==null||l(this,Kt)!==null||l(this,Qt)!==null;this.disposed||this.status==="disconnected"&&!r||(p(this,T,pr).call(this,"error"),p(this,T,ol).call(this),w(this,Gt,e??null),p(this,T,mn).call(this,"disconnected"))},uh=function(){const e=l(this,ht).size>0;w(this,Jt,null),w(this,kn,null),w(this,Ni,1),l(this,ht).clear(),e&&this.dispatchEvent(new pu("messages-changed"))},Yb=function(){return this.status==="disconnected"};function iz(){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 sz(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function oz(n,t,e){return n==="single_session"?`${Ob}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function Kb(n){return n.replace(/^(?:\s*\n)+/,"")}function Ug(n){let t=n;return t=t.replace(Y2,""),t=t.replace(K2,""),t=t.replace(J2,""),t=Kb(t),t}function az(n){let t=n;return t=t.replace(Q2,""),t=Kb(t),t}function Fg(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function lz(n){const t=n.createSocket(hz(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=uz(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=cz(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 cz(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 uz(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 hz(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 yu(n){return n instanceof Error?n.message:String(n)}const Hg="television.acpClientGUID",Zg="television.acpMappedSessions",Wg=1;var Fi;class dz{constructor(){S(this,Fi,new Map)}getActualSessionId(t){return l(this,Fi).get(t)??null}setActualSessionId(t,e){l(this,Fi).set(t,e)}clearActualSessionId(t){l(this,Fi).delete(t)}}Fi=new WeakMap;var Hi,_o,pt,al,ll,hh;class pz{constructor(t,e){S(this,pt);S(this,Hi);S(this,_o);w(this,Hi,t),w(this,_o,e)}getActualSessionId(t){const e=p(this,pt,ll).call(this)[p(this,pt,al).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=p(this,pt,ll).call(this);r[p(this,pt,al).call(this,t)]=e,p(this,pt,hh).call(this,r)}clearActualSessionId(t){const e=p(this,pt,ll).call(this);delete e[p(this,pt,al).call(this,t)],p(this,pt,hh).call(this,e)}}Hi=new WeakMap,_o=new WeakMap,pt=new WeakSet,al=function(t){return JSON.stringify([l(this,_o),t])},ll=function(){const t=l(this,Hi).getItem(Zg);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!==Wg?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},hh=function(t){const e={version:Wg,entries:t};l(this,Hi).setItem(Zg,JSON.stringify(e))};function fz(){return typeof window>"u"?null:window.localStorage}function gz(n){const t=n.getItem(Hg);if(t)return t;const e=Od().toLowerCase();return n.setItem(Hg,e),e}const Vg=4401,mz=401,Ha=1e3,vz=3e4;class Qs extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class Jb extends zt{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,"createSocket");g(this,"createClient");g(this,"socket",null);g(this,"connectAttempt",0);g(this,"autoReconnect",!1);g(this,"retryTimer",null);g(this,"retryDelay",Ha);g(this,"visibilityEventTarget");g(this,"networkEventTarget");g(this,"onVisibilityChange");g(this,"onNetworkOnline");this.url=_e(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 p$(o,{token:a??void 0})),this.client=this.createClient(this.url,this._token);const r=e.mappedSessionStore??(e.acpStorage?new pz(e.acpStorage,this.url):new dz);this.acpClient=new rz({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}async connect(e){this._token=e,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=Ha,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=Rl(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=Rl(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 el("screens-changed"));break;case"screen-updated":this.screens.set(e.screen.id,structuredClone(e.screen)),this.dispatchEvent(new el("screens-changed"));break;case"screen-removed":this.screens.delete(e.screenID),this.dispatchEvent(new el("screens-changed"));break;case"artifact-created":{const r=this.screens.get(e.screenID);r&&!tl(r).includes(e.artifact.id)&&(r.layout=[...r.layout,ty(e.artifact.id)]);break}case"artifact-removed":{const r=this.screens.get(e.screenID);r&&(r.layout=jv(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"screen-changed":case"theme-changed":case"artifact-focus":break;default:return yz(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(bz(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=Ha,this.hasEverConnected=!0,this.setStatus("connected"),s())},u=f=>{a||this.connectAttempt!==e||(a=!0,o(f))},h=async()=>{try{const[{screens:f},y]=await Promise.all([this.client.screens.list(),this.client.display.get()]);this.screens=new Map(f.map(m=>[m.id,structuredClone(m)])),this.acpClient.setEnabled(y.acpEnabled),this.dispatchEvent(new oe("change")),this.dispatchEvent(new Yu("server-event",{serverURL:this.url,event:{type:"screen-changed",screenID:y.activeScreenID}})),c()}catch(f){if(_z(f)){u(new Qs);return}u(f instanceof Error?f:new Error(String(f)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",f=>{const y=Sz(f);y&&(this.applyServerEvent(y),this.dispatchEvent(new Yu("server-event",{serverURL:this.url,event:y})))}),r.addEventListener("close",f=>{if(this.connectAttempt!==e)return;this.socket=null;const y=wz(f);if(!a){u(y===Vg?new Qs:new Error("Connection closed before initialization"));return}if(y===Vg){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");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})}handleAttemptFailure(e){if(e instanceof Qs){this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized");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,vz),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=Ha,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 yz(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function bz(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 wz(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function Sz(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 _z(n){return n instanceof zd&&n.status===mz}const kz="Local";var ko,dh;class xz extends zt{constructor(e){super();S(this,ko);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?_e(e.localServerURL):null,this.createSocket=e.createSocket??(i=>new WebSocket(i)),this.lastActiveServerURL=this.localStore.get().activeServerURL;const r=e.acpStorage===void 0?fz():e.acpStorage;this.acpStorage=r,this.clientGUID=e.clientGUID??(r?gz(r):Od().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=_e(e.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,e);const s=()=>{this.dispatchEvent(new oe("change"))},o=c=>{this.dispatchEvent(new Yu("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new el("screens-changed"))};e.addEventListener("change",s),e.addEventListener("server-event",o),e.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new oe("change"))}remove(e){const r=_e(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),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"))}setActive(e){const r=this.localStore.get(),i=e?_e(e.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(e,r){const i=e?_e(e):null;if(i){const a=this.localStore.get();a.servers.some(u=>_e(u.url)===i)||this.localStore.set({...a,servers:[...a.servers,{url:i,name:kz}]})}const s=this.localStore.get().servers;for(const a of s){const c=_e(a.url),h=i!==null&&c===i?r??null:null,f=p(this,ko,dh).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=_e(e);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>_e(a.url)!==i),{url:i,name:r}]});const o=p(this,ko,dh).call(this,{url:i,name:r,token:null});this.add(o),this.setActive(o),o.connect(null).catch(()=>{})}removeServer(e){this.remove(e)}}ko=new WeakSet,dh=function(e){return new Jb({url:e.url,name:e.name,token:e.token,createSocket:this.createSocket,clientGUID:this.clientGUID,acpStorage:this.acpStorage})};var xo;class Ez extends zt{constructor(){super();S(this,xo,e=>{const r=Az(e);r!==null&&(e.preventDefault(),this.dispatchEvent(new ZA("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,xo))}dispose(){document.removeEventListener("keydown",l(this,xo))}}xo=new WeakMap;function Az(n){for(const[t,e]of Object.entries(f$))if($z(n,e.trigger))return t;return null}function $z(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 ph="tv-nav:",Pl="tv-reload",jg=100,Tz=1e3,Iz=60,Cz=60,Rz=24,Pz=30,Dz=Pz*Rz*Cz*Iz*Tz;function Wr(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Pl);return t.searchParams.delete(Pl),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Eo,Zi,ue,re,Ir,ke,Xb,Dn,Qb,fh,gh;class Lz extends zt{constructor(e,r){super();S(this,ke);S(this,Eo);S(this,Zi);S(this,ue,[]);S(this,re,-1);S(this,Ir,0);w(this,Eo,e),w(this,Zi,Wr(r)),p(this,ke,Xb).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=Wr(e);if(r===l(this,Zi)){if(l(this,re)===-1)return;w(this,re,-1),p(this,ke,Dn).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,fh).call(this),p(this,ke,Dn).call(this)}replace(e){var i;if(l(this,re)===-1){this.navigate(e);return}const r=Wr(e);if(r===l(this,Zi)){w(this,ue,l(this,ue).filter((s,o)=>o!==l(this,re))),w(this,re,-1),p(this,ke,Dn).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,Dn).call(this))}back(){l(this,re)!==-1&&(w(this,re,l(this,re)-1),p(this,ke,Dn).call(this))}forward(){this.canGoForward&&(w(this,re,l(this,re)+1),p(this,ke,Dn).call(this))}reset(){l(this,re)===-1&&l(this,ue).length===0||(w(this,ue,[]),w(this,re,-1),p(this,ke,Dn).call(this))}}Eo=new WeakMap,Zi=new WeakMap,ue=new WeakMap,re=new WeakMap,Ir=new WeakMap,ke=new WeakSet,Xb=function(){const e=localStorage.getItem(l(this,ke,gh));if(e!==null)try{const r=JSON.parse(e);if(!ew(r))return;w(this,ue,r.entries.map(i=>({url:i.url}))),w(this,re,r.cursor),w(this,Ir,r.lastWritten),p(this,ke,fh).call(this)}catch{w(this,ue,[]),w(this,re,-1),w(this,Ir,0)}},Dn=function(){w(this,Ir,Date.now());try{localStorage.setItem(l(this,ke,gh),JSON.stringify(p(this,ke,Qb).call(this)))}catch(e){if(!Mz(e))throw e}this.dispatchEvent(new oe("change"))},Qb=function(){return{v:1,entries:l(this,ue).map(e=>({...e})),cursor:l(this,re),lastWritten:l(this,Ir)}},fh=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))},gh=function(){return zz(l(this,Eo))};function zz(n){return`${ph}${n}`}function Oz(n){const t=Date.now()-Dz,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(ph)))continue;const s=i.slice(ph.length),o=localStorage.getItem(i);if(o===null)continue;let a;try{a=JSON.parse(o)}catch{e.push(i);continue}if(!ew(a)){e.push(i);continue}!n.has(s)&&a.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function Mz(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function ew(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 Pn=null;async function tw(n,t){if(Pn==null||Pn.abort(),n===null){Pn=null,Al();return}const e=new AbortController;Pn=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(Pn!==e)return;Wv(o)}catch(r){if(r.name==="AbortError")return;Al();const i=r instanceof Error?r.message:String(r);console.warn(`applyTheme: ${i}`)}finally{Pn===e&&(Pn=null)}}/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const eo=globalThis,Vg=n=>n,Dl=eo.trustedTypes,Bg=Dl?Dl.createPolicy("lit-html",{createHTML:n=>n}):void 0,nw="$lit$",zn=`lit$${Math.random().toFixed(9).slice(2)}$`,rw="?"+zn,Fz=`<${rw}>`,jr=document,lo=()=>jr.createComment(""),co=n=>n===null||typeof n!="object"&&typeof n!="function",Wd=Array.isArray,Hz=n=>Wd(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",mu=`[
48
- \f\r]`,Rs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jg=/-->/g,Gg=/>/g,cr=RegExp(`>|${mu}(?:([^\\s"'>=/]+)(${mu}*=${mu}*(?:[^
49
- \f\r"'\`<>=]|("|')|))|$)`,"g"),qg=/'/g,Yg=/"/g,iw=/^(?:script|style|textarea|title)$/i,Zz=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),L=Zz(1),Gr=Symbol.for("lit-noChange"),le=Symbol.for("lit-nothing"),Kg=new WeakMap,Sr=jr.createTreeWalker(jr,129);function sw(n,t){if(!Wd(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bg!==void 0?Bg.createHTML(t):t}const Wz=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=Rs;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===Rs?h[1]==="!--"?o=jg:h[1]!==void 0?o=Gg:h[2]!==void 0?(iw.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=cr):h[3]!==void 0&&(o=cr):o===cr?h[0]===">"?(o=i??Rs,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?cr:h[3]==='"'?Yg:qg):o===Yg||o===qg?o=cr:o===jg||o===Gg?o=Rs:(o=cr,i=void 0);const m=o===cr&&n[a+1].startsWith("/>")?" ":"";s+=o===Rs?c+Fz:f>=0?(r.push(u),c.slice(0,f)+nw+c.slice(f)+zn+m):c+zn+(f===-2?a:m)}return[sw(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class uo{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]=Wz(t,e);if(this.el=uo.createElement(u,r),Sr.currentNode=this.el.content,e===2||e===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Sr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const f of i.getAttributeNames())if(f.endsWith(nw)){const y=h[o++],m=i.getAttribute(f).split(zn),E=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:E[2],strings:m,ctor:E[1]==="."?Bz:E[1]==="?"?jz:E[1]==="@"?Gz:Sc}),i.removeAttribute(f)}else f.startsWith(zn)&&(c.push({type:6,index:s}),i.removeAttribute(f));if(iw.test(i.tagName)){const f=i.textContent.split(zn),y=f.length-1;if(y>0){i.textContent=Dl?Dl.emptyScript:"";for(let m=0;m<y;m++)i.append(f[m],lo()),Sr.nextNode(),c.push({type:2,index:++s});i.append(f[y],lo())}}}else if(i.nodeType===8)if(i.data===rw)c.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(zn,f+1))!==-1;)c.push({type:7,index:s}),f+=zn.length-1}s++}}static createElement(t,e){const r=jr.createElement("template");return r.innerHTML=t,r}}function us(n,t,e=n,r){var o,a;if(t===Gr)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=co(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=us(n,i._$AS(n,t.values),i,r)),t}class Vz{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)??jr).importNode(e,!0);Sr.currentNode=i;let s=Sr.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new wc(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new qz(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Sr.nextNode(),o++)}return Sr.currentNode=jr,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 wc=class ow{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=us(this,t,e),co(t)?t===le||t==null||t===""?(this._$AH!==le&&this._$AR(),this._$AH=le):t!==this._$AH&&t!==Gr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hz(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&&co(this._$AH)?this._$AA.nextSibling.data=t:this.T(jr.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=uo.createElement(sw(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 Vz(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Kg.get(t.strings);return e===void 0&&Kg.set(t.strings,e=new uo(t)),e}k(t){Wd(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 ow(this.O(lo()),this.O(lo()),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=Vg(t).nextSibling;Vg(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Sc=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=us(this,t,e,0),o=!co(t)||t!==this._$AH&&t!==Gr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=us(this,a[r+c],e,c),u===Gr&&(u=this._$AH[c]),o||(o=!co(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??"")}},Bz=class extends Sc{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===le?void 0:t}},jz=class extends Sc{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==le)}},Gz=class extends Sc{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=us(this,t,e,0)??le)===Gr)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 qz{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){us(this,t)}}const Yz={I:wc},vu=eo.litHtmlPolyfillSupport;vu==null||vu(uo,wc),(eo.litHtmlVersions??(eo.litHtmlVersions=[])).push("3.3.2");const Ze=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new wc(t.insertBefore(lo(),null),null,void 0,{})),i._$AI(n),i};/**
47
+ */const eo=globalThis,Bg=n=>n,Dl=eo.trustedTypes,Gg=Dl?Dl.createPolicy("lit-html",{createHTML:n=>n}):void 0,nw="$lit$",zn=`lit$${Math.random().toFixed(9).slice(2)}$`,rw="?"+zn,Nz=`<${rw}>`,Br=document,lo=()=>Br.createComment(""),co=n=>n===null||typeof n!="object"&&typeof n!="function",Bd=Array.isArray,Uz=n=>Bd(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",bu=`[
48
+ \f\r]`,Rs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,qg=/-->/g,Yg=/>/g,cr=RegExp(`>|${bu}(?:([^\\s"'>=/]+)(${bu}*=${bu}*(?:[^
49
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Kg=/'/g,Jg=/"/g,iw=/^(?:script|style|textarea|title)$/i,Fz=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),L=Fz(1),Gr=Symbol.for("lit-noChange"),le=Symbol.for("lit-nothing"),Xg=new WeakMap,Sr=Br.createTreeWalker(Br,129);function sw(n,t){if(!Bd(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gg!==void 0?Gg.createHTML(t):t}const Hz=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",o=Rs;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===Rs?h[1]==="!--"?o=qg:h[1]!==void 0?o=Yg:h[2]!==void 0?(iw.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=cr):h[3]!==void 0&&(o=cr):o===cr?h[0]===">"?(o=i??Rs,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?cr:h[3]==='"'?Jg:Kg):o===Jg||o===Kg?o=cr:o===qg||o===Yg?o=Rs:(o=cr,i=void 0);const m=o===cr&&n[a+1].startsWith("/>")?" ":"";s+=o===Rs?c+Nz:f>=0?(r.push(u),c.slice(0,f)+nw+c.slice(f)+zn+m):c+zn+(f===-2?a:m)}return[sw(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class uo{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]=Hz(t,e);if(this.el=uo.createElement(u,r),Sr.currentNode=this.el.content,e===2||e===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Sr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const f of i.getAttributeNames())if(f.endsWith(nw)){const y=h[o++],m=i.getAttribute(f).split(zn),E=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:E[2],strings:m,ctor:E[1]==="."?Wz:E[1]==="?"?Vz:E[1]==="@"?jz:Sc}),i.removeAttribute(f)}else f.startsWith(zn)&&(c.push({type:6,index:s}),i.removeAttribute(f));if(iw.test(i.tagName)){const f=i.textContent.split(zn),y=f.length-1;if(y>0){i.textContent=Dl?Dl.emptyScript:"";for(let m=0;m<y;m++)i.append(f[m],lo()),Sr.nextNode(),c.push({type:2,index:++s});i.append(f[y],lo())}}}else if(i.nodeType===8)if(i.data===rw)c.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(zn,f+1))!==-1;)c.push({type:7,index:s}),f+=zn.length-1}s++}}static createElement(t,e){const r=Br.createElement("template");return r.innerHTML=t,r}}function us(n,t,e=n,r){var o,a;if(t===Gr)return t;let i=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl;const s=co(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=us(n,i._$AS(n,t.values),i,r)),t}class Zz{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)??Br).importNode(e,!0);Sr.currentNode=i;let s=Sr.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new wc(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new Bz(s,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Sr.nextNode(),o++)}return Sr.currentNode=Br,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 wc=class ow{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=us(this,t,e),co(t)?t===le||t==null||t===""?(this._$AH!==le&&this._$AR(),this._$AH=le):t!==this._$AH&&t!==Gr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Uz(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&&co(this._$AH)?this._$AA.nextSibling.data=t:this.T(Br.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=uo.createElement(sw(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 Zz(i,this),a=o.u(this.options);o.p(e),this.T(a),this._$AH=o}}_$AC(t){let e=Xg.get(t.strings);return e===void 0&&Xg.set(t.strings,e=new uo(t)),e}k(t){Bd(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 ow(this.O(lo()),this.O(lo()),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=Bg(t).nextSibling;Bg(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Sc=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=us(this,t,e,0),o=!co(t)||t!==this._$AH&&t!==Gr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=us(this,a[r+c],e,c),u===Gr&&(u=this._$AH[c]),o||(o=!co(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??"")}},Wz=class extends Sc{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===le?void 0:t}},Vz=class extends Sc{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==le)}},jz=class extends Sc{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=us(this,t,e,0)??le)===Gr)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 Bz{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){us(this,t)}}const Gz={I:wc},wu=eo.litHtmlPolyfillSupport;wu==null||wu(uo,wc),(eo.litHtmlVersions??(eo.litHtmlVersions=[])).push("3.3.2");const Ze=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new wc(t.insertBefore(lo(),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 Vd={CHILD:2},_c=n=>(...t)=>({_$litDirective$:n,values:t});let Bd=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 Gd={CHILD:2},_c=n=>(...t)=>({_$litDirective$:n,values:t});let qd=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 Ll=class extends Bd{constructor(t){if(super(t),this.it=le,t.type!==Vd.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===Gr)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:[]}}};Ll.directiveName="unsafeHTML",Ll.resultType=1;const Kz=_c(Ll);/**
57
+ */let Ll=class extends qd{constructor(t){if(super(t),this.it=le,t.type!==Gd.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===Gr)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:[]}}};Ll.directiveName="unsafeHTML",Ll.resultType=1;const qz=_c(Ll);/**
58
58
  * @license
59
59
  * Copyright 2017 Google LLC
60
60
  * SPDX-License-Identifier: BSD-3-Clause
61
- */let ph=class extends Ll{};ph.directiveName="unsafeSVG",ph.resultType=2;const aw=_c(ph),Jz={size:16,color:"currentColor",weight:"regular"};function Xz(n){return typeof n=="string"?{regular:n}:n}function Ot(n,t="0 0 256 256"){const e=Xz(n);return r=>{const{size:i,color:s,weight:o}={...Jz,...r},a=e[o]??e.regular;return L`<svg
61
+ */let mh=class extends Ll{};mh.directiveName="unsafeSVG",mh.resultType=2;const aw=_c(mh),Yz={size:16,color:"currentColor",weight:"regular"};function Kz(n){return typeof n=="string"?{regular:n}:n}function Ot(n,t="0 0 256 256"){const e=Kz(n);return r=>{const{size:i,color:s,weight:o}={...Yz,...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}"
@@ -69,15 +69,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
69
69
  * @license
70
70
  * Copyright 2020 Google LLC
71
71
  * SPDX-License-Identifier: BSD-3-Clause
72
- */const{I:Qz}=Yz,Jg=n=>n,eO=n=>n.strings===void 0,Xg=()=>document.createComment(""),Ps=(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(Xg(),i),a=r.insertBefore(Xg(),i);e=new Qz(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=Jg(u).nextSibling;Jg(r).insertBefore(u,i),u=h}}}return e},ur=(n,t,e=n)=>(n._$AI(t,e),n),tO={},nO=(n,t=tO)=>n._$AH=t,rO=n=>n._$AH,yu=n=>{n._$AR(),n._$AA.remove()};/**
72
+ */const{I:Jz}=Gz,Qg=n=>n,Xz=n=>n.strings===void 0,em=()=>document.createComment(""),Ps=(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(em(),i),a=r.insertBefore(em(),i);e=new Jz(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=Qg(u).nextSibling;Qg(r).insertBefore(u,i),u=h}}}return e},ur=(n,t,e=n)=>(n._$AI(t,e),n),Qz={},eO=(n,t=Qz)=>n._$AH=t,tO=n=>n._$AH,Su=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 to=(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),to(i,t);return!0},zl=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)},lw=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),oO(t)}};function iO(n){this._$AN!==void 0?(zl(this),this._$AM=n,lw(this)):this._$AM=n}function sO(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++)to(r[s],!1),zl(r[s]);else r!=null&&(to(r,!1),zl(r));else to(this,n)}const oO=n=>{n.type==Vd.CHILD&&(n._$AP??(n._$AP=sO),n._$AQ??(n._$AQ=iO))};class aO extends Bd{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),lw(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&&(to(this,t),zl(this))}setValue(t){if(eO(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 to=(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),to(i,t);return!0},zl=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)},lw=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),iO(t)}};function nO(n){this._$AN!==void 0?(zl(this),this._$AM=n,lw(this)):this._$AM=n}function rO(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++)to(r[s],!1),zl(r[s]);else r!=null&&(to(r,!1),zl(r));else to(this,n)}const iO=n=>{n.type==Gd.CHILD&&(n._$AP??(n._$AP=rO),n._$AQ??(n._$AQ=nO))};class sO extends qd{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),lw(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&&(to(this,t),zl(this))}setValue(t){if(Xz(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 cl=()=>new lO;class lO{}const bu=new WeakMap,ul=_c(class extends aO{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=bu.get(t);e===void 0&&(e=new WeakMap,bu.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=bu.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)}}),jd=Ot('<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"/>'),cO=Ot('<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"/>'),uO=Ot('<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"/>'),Ol=Ot('<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"/>'),hO=Ot('<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"/>'),dO=Ot({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"/>'}),pO=Ot({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"/>'}),fO=Ot({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"/>'}),gO=Ot('<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"/>'),cw=Ot({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"/>'}),mO=Ot('<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 vO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const Qg='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',wu=4;var Ne,it,Cr,st,Ao,Wi,Vi,W,fh,gh,hw,hl,dw,mh,vh,$o,To,Rr,pw,yh,fw,gw,dl,Si;class uw extends HTMLElement{constructor(){super();S(this,W);S(this,Ne,!1);S(this,it,null);S(this,Cr);S(this,st,null);S(this,Ao,"bottom-start");S(this,Wi,!1);S(this,Vi,!1);S(this,$o,e=>{l(this,Ne)&&(l(this,Wi)||e.composedPath().includes(this)||(this.open=!1))});S(this,To,e=>{if(l(this,Ne)){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&p(this,W,pw).call(this,e)}});S(this,Rr,()=>{l(this,Ne)&&p(this,W,dl).call(this)});w(this,Cr,this.attachShadow({mode:"open"})),Id(l(this,Cr)),p(this,W,gh).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),p(this,W,gh).call(this,"open"),p(this,W,Si).call(this),l(this,Ne)&&(p(this,W,mh).call(this),p(this,W,hl).call(this))}disconnectedCallback(){var e;p(this,W,vh).call(this),(e=l(this,it))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?p(this,W,hw).call(this,this.hasAttribute("open")):e==="material"&&l(this,Ne)&&(p(this,W,Si).call(this),p(this,W,hl).call(this))}get open(){return l(this,Ne)}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,fh).call(this),l(this,Ne)&&p(this,W,dl).call(this))}}Ne=new WeakMap,it=new WeakMap,Cr=new WeakMap,st=new WeakMap,Ao=new WeakMap,Wi=new WeakMap,Vi=new WeakMap,W=new WeakSet,fh=function(){l(this,it)&&l(this,it).setAttribute("aria-expanded",l(this,Ne)?"true":"false")},gh=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},hw=function(e){var r,i,s;if(l(this,Ne)!==e){if(w(this,Ne,e),p(this,W,fh).call(this),!this.isConnected){p(this,W,Si).call(this);return}e?(w(this,Wi,!0),setTimeout(()=>{w(this,Wi,!1)},0),p(this,W,Si).call(this),p(this,W,mh).call(this),p(this,W,hl).call(this)):(p(this,W,vh).call(this),(i=(r=l(this,st))==null?void 0:r.hidePopover)==null||i.call(r),p(this,W,Si).call(this),(s=l(this,it))==null||s.focus(),this.dispatchEvent(new vO))}},hl=function(){l(this,Vi)||(w(this,Vi,!0),queueMicrotask(()=>{w(this,Vi,!1),!(!l(this,Ne)||!this.isConnected)&&(p(this,W,dw).call(this),p(this,W,gw).call(this))}))},dw=function(){var e,r;if(l(this,st)){try{(r=(e=l(this,st)).showPopover)==null||r.call(e)}catch{}p(this,W,dl).call(this)}},mh=function(){document.addEventListener("click",l(this,$o)),document.addEventListener("keydown",l(this,To),!0),window.addEventListener("resize",l(this,Rr)),window.addEventListener("scroll",l(this,Rr),!0)},vh=function(){document.removeEventListener("click",l(this,$o)),document.removeEventListener("keydown",l(this,To),!0),window.removeEventListener("resize",l(this,Rr)),window.removeEventListener("scroll",l(this,Rr),!0)},$o=new WeakMap,To=new WeakMap,Rr=new WeakMap,pw=function(e){const r=p(this,W,yh).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=p(this,W,fw).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())},yh=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(Qg)&&r.push(i);for(const s of i.querySelectorAll(Qg))r.push(s)}return r},fw=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},gw=function(){var r;const e=p(this,W,yh).call(this);e.length>0?e[0].focus():(r=l(this,st))==null||r.focus()},dl=function(){if(!l(this,Ne)||!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+wu,a=s<o&&e.top>o?"top-start":"bottom-start";w(this,Ao,a);const c=a==="bottom-start"?e.bottom+wu:e.top-r.height-wu,u=e.left;l(this,st).style.transform=`translate(${u}px, ${c}px)`,l(this,st).setAttribute("data-placement",a)},Si=function(){this.toggleAttribute("open",l(this,Ne));const e=this.getAttribute("material")??"paper";Ze(l(this,Ne)?L`<div
80
+ */const cl=()=>new oO;class oO{}const _u=new WeakMap,ul=_c(class extends sO{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=_u.get(t);e===void 0&&(e=new WeakMap,_u.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=_u.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)}}),Yd=Ot('<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"/>'),aO=Ot('<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"/>'),lO=Ot('<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"/>'),Ol=Ot('<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"/>'),cO=Ot('<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"/>'),uO=Ot({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"/>'}),hO=Ot({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"/>'}),dO=Ot({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"/>'}),pO=Ot('<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"/>'),cw=Ot({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"/>'}),fO=Ot('<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 gO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const tm='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',ku=4;var Ne,it,Cr,st,Ao,Wi,Vi,W,vh,yh,hw,hl,dw,bh,wh,$o,To,Rr,pw,Sh,fw,gw,dl,Si;class uw extends HTMLElement{constructor(){super();S(this,W);S(this,Ne,!1);S(this,it,null);S(this,Cr);S(this,st,null);S(this,Ao,"bottom-start");S(this,Wi,!1);S(this,Vi,!1);S(this,$o,e=>{l(this,Ne)&&(l(this,Wi)||e.composedPath().includes(this)||(this.open=!1))});S(this,To,e=>{if(l(this,Ne)){if(e.key==="Escape"){e.preventDefault(),this.open=!1;return}e.key==="Tab"&&p(this,W,pw).call(this,e)}});S(this,Rr,()=>{l(this,Ne)&&p(this,W,dl).call(this)});w(this,Cr,this.attachShadow({mode:"open"})),Pd(l(this,Cr)),p(this,W,yh).call(this,"anchor")}connectedCallback(){this.removeAttribute("popover"),this.hasAttribute("tone")||this.setAttribute("tone","light"),p(this,W,yh).call(this,"open"),p(this,W,Si).call(this),l(this,Ne)&&(p(this,W,bh).call(this),p(this,W,hl).call(this))}disconnectedCallback(){var e;p(this,W,wh).call(this),(e=l(this,it))==null||e.removeAttribute("aria-expanded")}attributeChangedCallback(e){e==="open"?p(this,W,hw).call(this,this.hasAttribute("open")):e==="material"&&l(this,Ne)&&(p(this,W,Si).call(this),p(this,W,hl).call(this))}get open(){return l(this,Ne)}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,vh).call(this),l(this,Ne)&&p(this,W,dl).call(this))}}Ne=new WeakMap,it=new WeakMap,Cr=new WeakMap,st=new WeakMap,Ao=new WeakMap,Wi=new WeakMap,Vi=new WeakMap,W=new WeakSet,vh=function(){l(this,it)&&l(this,it).setAttribute("aria-expanded",l(this,Ne)?"true":"false")},yh=function(e){if(!Object.prototype.hasOwnProperty.call(this,e))return;const r=this,i=r[e];delete r[e],r[e]=i},hw=function(e){var r,i,s;if(l(this,Ne)!==e){if(w(this,Ne,e),p(this,W,vh).call(this),!this.isConnected){p(this,W,Si).call(this);return}e?(w(this,Wi,!0),setTimeout(()=>{w(this,Wi,!1)},0),p(this,W,Si).call(this),p(this,W,bh).call(this),p(this,W,hl).call(this)):(p(this,W,wh).call(this),(i=(r=l(this,st))==null?void 0:r.hidePopover)==null||i.call(r),p(this,W,Si).call(this),(s=l(this,it))==null||s.focus(),this.dispatchEvent(new gO))}},hl=function(){l(this,Vi)||(w(this,Vi,!0),queueMicrotask(()=>{w(this,Vi,!1),!(!l(this,Ne)||!this.isConnected)&&(p(this,W,dw).call(this),p(this,W,gw).call(this))}))},dw=function(){var e,r;if(l(this,st)){try{(r=(e=l(this,st)).showPopover)==null||r.call(e)}catch{}p(this,W,dl).call(this)}},bh=function(){document.addEventListener("click",l(this,$o)),document.addEventListener("keydown",l(this,To),!0),window.addEventListener("resize",l(this,Rr)),window.addEventListener("scroll",l(this,Rr),!0)},wh=function(){document.removeEventListener("click",l(this,$o)),document.removeEventListener("keydown",l(this,To),!0),window.removeEventListener("resize",l(this,Rr)),window.removeEventListener("scroll",l(this,Rr),!0)},$o=new WeakMap,To=new WeakMap,Rr=new WeakMap,pw=function(e){const r=p(this,W,Sh).call(this);if(r.length===0){e.preventDefault();return}const i=r[0],s=r[r.length-1],o=p(this,W,fw).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())},Sh=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(tm)&&r.push(i);for(const s of i.querySelectorAll(tm))r.push(s)}return r},fw=function(){var r;let e=document.activeElement;for(;e&&((r=e.shadowRoot)!=null&&r.activeElement);)e=e.shadowRoot.activeElement;return e},gw=function(){var r;const e=p(this,W,Sh).call(this);e.length>0?e[0].focus():(r=l(this,st))==null||r.focus()},dl=function(){if(!l(this,Ne)||!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+ku,a=s<o&&e.top>o?"top-start":"bottom-start";w(this,Ao,a);const c=a==="bottom-start"?e.bottom+ku:e.top-r.height-ku,u=e.left;l(this,st).style.transform=`translate(${u}px, ${c}px)`,l(this,st).setAttribute("data-placement",a)},Si=function(){this.toggleAttribute("open",l(this,Ne));const e=this.getAttribute("material")??"paper";Ze(l(this,Ne)?L`<div
81
81
  class="panel"
82
82
  part="panel"
83
83
  popover="manual"
@@ -88,8 +88,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
88
88
  level="1"
89
89
  >
90
90
  <slot></slot>
91
- </div>`:le,l(this,Cr)),w(this,st,l(this,Cr).querySelector(".panel"))},g(uw,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",uw);class mw extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}class yO extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var ot,It,Zn,Wn,se,Io,Co,M,yw,Ws,bw,ww,bh,Sw,Vs,fr,Pr,Ro,Vl,Po,Bl,_w,kw,wh,Bs,Sh,_h,vn;class vw extends HTMLElement{constructor(){super();S(this,M);S(this,ot,!1);S(this,It,null);S(this,Zn,null);S(this,Wn);S(this,se,null);S(this,Io,cl());S(this,Co,new MutationObserver(e=>p(this,M,_w).call(this,e)));S(this,Pr,()=>{p(this,M,Vs).call(this,!l(this,ot))});S(this,Ro,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,Pr).call(this))});S(this,Vl,()=>{l(this,ot)&&p(this,M,Vs).call(this,!1)});S(this,Po,e=>{e instanceof mw&&(e.stopPropagation(),w(this,ot,!1),p(this,M,Ws).call(this,e.value),p(this,M,vn).call(this),this.dispatchEvent(new yO(e.value)))});S(this,Bl,()=>{p(this,M,wh).call(this)});w(this,Wn,this.attachShadow({mode:"open"})),Id(l(this,Wn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Po)),p(this,M,yw).call(this),l(this,Co).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),p(this,M,vn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Po)),l(this,Co).disconnect(),p(this,M,_h).call(this)}attributeChangedCallback(e){if(e==="open"){p(this,M,Vs).call(this,this.hasAttribute("open"));return}p(this,M,vn).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,It)}set value(e){e===null?(p(this,M,fr).call(this,null,null),p(this,M,bw).call(this)):p(this,M,Ws).call(this,e),p(this,M,vn).call(this)}close(){p(this,M,Vs).call(this,!1)}}ot=new WeakMap,It=new WeakMap,Zn=new WeakMap,Wn=new WeakMap,se=new WeakMap,Io=new WeakMap,Co=new WeakMap,M=new WeakSet,yw=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&p(this,M,fr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},Ws=function(e){var r;for(const i of l(this,M,bh))i.value===e?(p(this,M,fr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},bw=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},ww=function(e){for(const r of l(this,M,bh))if(r.value===e)return r;return null},bh=function(){return this.querySelectorAll("dropdown-item")},Sw=function(){return l(this,Zn)??this.title},Vs=function(e){l(this,ot)!==e&&(w(this,ot,e),p(this,M,vn).call(this))},fr=function(e,r){w(this,It,e),w(this,Zn,r)},Pr=new WeakMap,Ro=new WeakMap,Vl=new WeakMap,Po=new WeakMap,Bl=new WeakMap,_w=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||p(this,M,kw).call(this)},kw=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,It)!==s||l(this,Zn)!==o;p(this,M,fr).call(this,s,o),p(this,M,Ws).call(this,s),a?p(this,M,vn).call(this):p(this,M,Bs).call(this);return}if(l(this,It)!==null){const s=p(this,M,ww).call(this,l(this,It));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,Zn)!==o;p(this,M,fr).call(this,l(this,It),o),p(this,M,Ws).call(this,l(this,It)),a?p(this,M,vn).call(this):p(this,M,Bs).call(this);return}}if(l(this,It)!==null||l(this,Zn)!==null){p(this,M,fr).call(this,null,null),p(this,M,vn).call(this);return}p(this,M,Bs).call(this)},wh=function(){const e=l(this,Wn).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,se)!==r&&(p(this,M,_h).call(this),w(this,se,r),l(this,se)&&(l(this,se).addEventListener("click",l(this,Pr)),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,Ro))))),p(this,M,Bs).call(this),p(this,M,Sh).call(this)},Bs=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"))},Sh=function(){const e=l(this,Io).value;if(!e)return;const r=l(this,Wn).querySelector("button.fallback-trigger");e.anchor=l(this,se)??r??null},_h=function(){l(this,se)&&(l(this,se).removeEventListener("click",l(this,Pr)),l(this,se).removeEventListener("keydown",l(this,Ro)),l(this,se).removeAttribute("data-dropdown-trigger"),l(this,se).removeAttribute("aria-haspopup"),l(this,se).removeAttribute("aria-expanded"),w(this,se,null))},vn=function(){this.toggleAttribute("open",l(this,ot)),Ze(L`
92
- <slot name="trigger" @slotchange=${l(this,Bl)}>
91
+ </div>`:le,l(this,Cr)),w(this,st,l(this,Cr).querySelector(".panel"))},g(uw,"observedAttributes",["open","material"]);customElements.get("ui-popover")||customElements.define("ui-popover",uw);class mw extends Event{constructor(e){super("dropdown-item-select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}class mO extends Event{constructor(e){super("select",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var ot,It,Zn,Wn,se,Io,Co,M,yw,Ws,bw,ww,_h,Sw,Vs,fr,Pr,Ro,Vl,Po,jl,_w,kw,kh,js,xh,Eh,vn;class vw extends HTMLElement{constructor(){super();S(this,M);S(this,ot,!1);S(this,It,null);S(this,Zn,null);S(this,Wn);S(this,se,null);S(this,Io,cl());S(this,Co,new MutationObserver(e=>p(this,M,_w).call(this,e)));S(this,Pr,()=>{p(this,M,Vs).call(this,!l(this,ot))});S(this,Ro,e=>{e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),l(this,Pr).call(this))});S(this,Vl,()=>{l(this,ot)&&p(this,M,Vs).call(this,!1)});S(this,Po,e=>{e instanceof mw&&(e.stopPropagation(),w(this,ot,!1),p(this,M,Ws).call(this,e.value),p(this,M,vn).call(this),this.dispatchEvent(new mO(e.value)))});S(this,jl,()=>{p(this,M,kh).call(this)});w(this,Wn,this.attachShadow({mode:"open"})),Pd(l(this,Wn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,Po)),p(this,M,yw).call(this),l(this,Co).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),p(this,M,vn).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,Po)),l(this,Co).disconnect(),p(this,M,Eh).call(this)}attributeChangedCallback(e){if(e==="open"){p(this,M,Vs).call(this,this.hasAttribute("open"));return}p(this,M,vn).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,It)}set value(e){e===null?(p(this,M,fr).call(this,null,null),p(this,M,bw).call(this)):p(this,M,Ws).call(this,e),p(this,M,vn).call(this)}close(){p(this,M,Vs).call(this,!1)}}ot=new WeakMap,It=new WeakMap,Zn=new WeakMap,Wn=new WeakMap,se=new WeakMap,Io=new WeakMap,Co=new WeakMap,M=new WeakSet,yw=function(){var r;const e=this.querySelector("dropdown-item[selected]");e&&p(this,M,fr).call(this,e.value,((r=e.textContent)==null?void 0:r.trim())??null)},Ws=function(e){var r;for(const i of l(this,M,_h))i.value===e?(p(this,M,fr).call(this,e,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},bw=function(){const e=this.querySelectorAll("dropdown-item[selected]");for(const r of e)r.removeAttribute("selected")},ww=function(e){for(const r of l(this,M,_h))if(r.value===e)return r;return null},_h=function(){return this.querySelectorAll("dropdown-item")},Sw=function(){return l(this,Zn)??this.title},Vs=function(e){l(this,ot)!==e&&(w(this,ot,e),p(this,M,vn).call(this))},fr=function(e,r){w(this,It,e),w(this,Zn,r)},Pr=new WeakMap,Ro=new WeakMap,Vl=new WeakMap,Po=new WeakMap,jl=new WeakMap,_w=function(e){e.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||p(this,M,kw).call(this)},kw=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,It)!==s||l(this,Zn)!==o;p(this,M,fr).call(this,s,o),p(this,M,Ws).call(this,s),a?p(this,M,vn).call(this):p(this,M,js).call(this);return}if(l(this,It)!==null){const s=p(this,M,ww).call(this,l(this,It));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,Zn)!==o;p(this,M,fr).call(this,l(this,It),o),p(this,M,Ws).call(this,l(this,It)),a?p(this,M,vn).call(this):p(this,M,js).call(this);return}}if(l(this,It)!==null||l(this,Zn)!==null){p(this,M,fr).call(this,null,null),p(this,M,vn).call(this);return}p(this,M,js).call(this)},kh=function(){const e=l(this,Wn).querySelector('slot[name="trigger"]'),r=e instanceof HTMLSlotElement?e.assignedElements()[0]??null:null;l(this,se)!==r&&(p(this,M,Eh).call(this),w(this,se,r),l(this,se)&&(l(this,se).addEventListener("click",l(this,Pr)),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,Ro))))),p(this,M,js).call(this),p(this,M,xh).call(this)},js=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"))},xh=function(){const e=l(this,Io).value;if(!e)return;const r=l(this,Wn).querySelector("button.fallback-trigger");e.anchor=l(this,se)??r??null},Eh=function(){l(this,se)&&(l(this,se).removeEventListener("click",l(this,Pr)),l(this,se).removeEventListener("keydown",l(this,Ro)),l(this,se).removeAttribute("data-dropdown-trigger"),l(this,se).removeAttribute("aria-haspopup"),l(this,se).removeAttribute("aria-expanded"),w(this,se,null))},vn=function(){this.toggleAttribute("open",l(this,ot)),Ze(L`
92
+ <slot name="trigger" @slotchange=${l(this,jl)}>
93
93
  <button
94
94
  class="fallback-trigger"
95
95
  part="trigger"
@@ -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,Wn)),p(this,M,Sh).call(this),queueMicrotask(()=>p(this,M,wh).call(this))},g(vw,"observedAttributes",["title","open"]);class bO extends HTMLElement{}class wO extends HTMLElement{}class SO extends HTMLElement{}var Kr,kh,Ew,Do,Lo;class xw extends HTMLElement{constructor(){super(...arguments);S(this,Kr);S(this,Do,()=>{this.action||p(this,Kr,Ew).call(this)});S(this,Lo,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,Do)),this.addEventListener("keydown",l(this,Lo)),p(this,Kr,kh).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Do)),this.removeEventListener("keydown",l(this,Lo))}attributeChangedCallback(){p(this,Kr,kh).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Kr=new WeakSet,kh=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")},Ew=function(){this.dispatchEvent(new mw(this.value))},Do=new WeakMap,Lo=new WeakMap,g(xw,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",vw);customElements.get("dropdown-group")||customElements.define("dropdown-group",bO);customElements.get("dropdown-label")||customElements.define("dropdown-label",wO);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",SO);customElements.get("dropdown-item")||customElements.define("dropdown-item",xw);class _O extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var en,Ct,ie,Ue,js,zo,xh,pl,Eh,Oo,Mo,No;class Aw extends HTMLElement{constructor(){super(...arguments);S(this,Ue);S(this,en,"");S(this,Ct,!1);S(this,ie,null);S(this,zo,e=>{l(this,Ct)||(e.preventDefault(),p(this,Ue,xh).call(this))});S(this,Oo,e=>{e.stopPropagation()});S(this,Mo,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),p(this,Ue,pl).call(this,!0),(r=l(this,ie))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),p(this,Ue,pl).call(this,!1),(i=l(this,ie))==null||i.blur())});S(this,No,()=>{p(this,Ue,pl).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,Ue,js).call(this),this.addEventListener("dblclick",l(this,zo))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,zo)),l(this,Ct)&&p(this,Ue,Eh).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";w(this,en,r),l(this,Ct)||p(this,Ue,js).call(this)}}get value(){return l(this,en)}set value(e){w(this,en,e),l(this,Ct)||p(this,Ue,js).call(this)}startEditing(){l(this,Ct)||p(this,Ue,xh).call(this)}}en=new WeakMap,Ct=new WeakMap,ie=new WeakMap,Ue=new WeakSet,js=function(){l(this,ie)&&(l(this,ie).textContent=l(this,en),l(this,ie).scrollLeft=0)},zo=new WeakMap,xh=function(){l(this,ie)&&(w(this,Ct,!0),l(this,ie).setAttribute("contenteditable","plaintext-only"),l(this,ie).setAttribute("spellcheck","false"),l(this,ie).addEventListener("keydown",l(this,Mo)),l(this,ie).addEventListener("blur",l(this,No)),l(this,ie).addEventListener("mousedown",l(this,Oo)),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))}))},pl=function(e){if(!l(this,Ct)||!l(this,ie))return;const r=(l(this,ie).textContent??"").trim();w(this,Ct,!1),l(this,ie).removeAttribute("contenteditable"),l(this,ie).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),p(this,Ue,Eh).call(this),e&&r.length>0&&r!==l(this,en)&&(w(this,en,r),this.dispatchEvent(new _O(r))),p(this,Ue,js).call(this)},Eh=function(){var e,r,i;(e=l(this,ie))==null||e.removeEventListener("keydown",l(this,Mo)),(r=l(this,ie))==null||r.removeEventListener("blur",l(this,No)),(i=l(this,ie))==null||i.removeEventListener("mousedown",l(this,Oo))},Oo=new WeakMap,Mo=new WeakMap,No=new WeakMap,g(Aw,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",Aw);class kO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Uo,er,Ah,jl,Fo,$h;class $w extends HTMLElement{constructor(){super();S(this,er);S(this,Uo);S(this,jl,e=>{e.target===e.currentTarget&&p(this,er,Ah).call(this)});S(this,Fo,e=>{this.open&&e.key==="Escape"&&p(this,er,Ah).call(this)});w(this,Uo,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Fo)),p(this,er,$h).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Fo))}attributeChangedCallback(){p(this,er,$h).call(this)}get open(){return this.hasAttribute("open")}}Uo=new WeakMap,er=new WeakSet,Ah=function(){this.dispatchEvent(new kO)},jl=new WeakMap,Fo=new WeakMap,$h=function(){Ze(L`
118
+ `,l(this,Wn)),p(this,M,xh).call(this),queueMicrotask(()=>p(this,M,kh).call(this))},g(vw,"observedAttributes",["title","open"]);class vO extends HTMLElement{}class yO extends HTMLElement{}class bO extends HTMLElement{}var Kr,Ah,Ew,Do,Lo;class xw extends HTMLElement{constructor(){super(...arguments);S(this,Kr);S(this,Do,()=>{this.action||p(this,Kr,Ew).call(this)});S(this,Lo,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,Do)),this.addEventListener("keydown",l(this,Lo)),p(this,Kr,Ah).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,Do)),this.removeEventListener("keydown",l(this,Lo))}attributeChangedCallback(){p(this,Kr,Ah).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}Kr=new WeakSet,Ah=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")},Ew=function(){this.dispatchEvent(new mw(this.value))},Do=new WeakMap,Lo=new WeakMap,g(xw,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",vw);customElements.get("dropdown-group")||customElements.define("dropdown-group",vO);customElements.get("dropdown-label")||customElements.define("dropdown-label",yO);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",bO);customElements.get("dropdown-item")||customElements.define("dropdown-item",xw);class wO extends Event{constructor(e){super("rename",{bubbles:!0,composed:!0});g(this,"value");this.value=e}}var en,Ct,ie,Ue,Bs,zo,$h,pl,Th,Oo,Mo,No;class Aw extends HTMLElement{constructor(){super(...arguments);S(this,Ue);S(this,en,"");S(this,Ct,!1);S(this,ie,null);S(this,zo,e=>{l(this,Ct)||(e.preventDefault(),p(this,Ue,$h).call(this))});S(this,Oo,e=>{e.stopPropagation()});S(this,Mo,e=>{var r,i;e.key==="Enter"?(e.preventDefault(),p(this,Ue,pl).call(this,!0),(r=l(this,ie))==null||r.blur()):e.key==="Escape"&&(e.preventDefault(),p(this,Ue,pl).call(this,!1),(i=l(this,ie))==null||i.blur())});S(this,No,()=>{p(this,Ue,pl).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,Ue,Bs).call(this),this.addEventListener("dblclick",l(this,zo))}disconnectedCallback(){this.removeEventListener("dblclick",l(this,zo)),l(this,Ct)&&p(this,Ue,Th).call(this)}attributeChangedCallback(e){if(e==="value"){const r=this.getAttribute("value")??"";w(this,en,r),l(this,Ct)||p(this,Ue,Bs).call(this)}}get value(){return l(this,en)}set value(e){w(this,en,e),l(this,Ct)||p(this,Ue,Bs).call(this)}startEditing(){l(this,Ct)||p(this,Ue,$h).call(this)}}en=new WeakMap,Ct=new WeakMap,ie=new WeakMap,Ue=new WeakSet,Bs=function(){l(this,ie)&&(l(this,ie).textContent=l(this,en),l(this,ie).scrollLeft=0)},zo=new WeakMap,$h=function(){l(this,ie)&&(w(this,Ct,!0),l(this,ie).setAttribute("contenteditable","plaintext-only"),l(this,ie).setAttribute("spellcheck","false"),l(this,ie).addEventListener("keydown",l(this,Mo)),l(this,ie).addEventListener("blur",l(this,No)),l(this,ie).addEventListener("mousedown",l(this,Oo)),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))}))},pl=function(e){if(!l(this,Ct)||!l(this,ie))return;const r=(l(this,ie).textContent??"").trim();w(this,Ct,!1),l(this,ie).removeAttribute("contenteditable"),l(this,ie).removeAttribute("spellcheck"),this.toggleAttribute("data-editing",!1),p(this,Ue,Th).call(this),e&&r.length>0&&r!==l(this,en)&&(w(this,en,r),this.dispatchEvent(new wO(r))),p(this,Ue,Bs).call(this)},Th=function(){var e,r,i;(e=l(this,ie))==null||e.removeEventListener("keydown",l(this,Mo)),(r=l(this,ie))==null||r.removeEventListener("blur",l(this,No)),(i=l(this,ie))==null||i.removeEventListener("mousedown",l(this,Oo))},Oo=new WeakMap,Mo=new WeakMap,No=new WeakMap,g(Aw,"observedAttributes",["value"]);customElements.get("editable-text")||customElements.define("editable-text",Aw);class SO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Uo,er,Ih,Bl,Fo,Ch;class $w extends HTMLElement{constructor(){super();S(this,er);S(this,Uo);S(this,Bl,e=>{e.target===e.currentTarget&&p(this,er,Ih).call(this)});S(this,Fo,e=>{this.open&&e.key==="Escape"&&p(this,er,Ih).call(this)});w(this,Uo,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Fo)),p(this,er,Ch).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Fo))}attributeChangedCallback(){p(this,er,Ch).call(this)}get open(){return this.hasAttribute("open")}}Uo=new WeakMap,er=new WeakSet,Ih=function(){this.dispatchEvent(new SO)},Bl=new WeakMap,Fo=new WeakMap,Ch=function(){Ze(L`
119
119
  ${this.open?L`
120
- <div class="backdrop" part="backdrop" @click=${l(this,jl)}>
120
+ <div class="backdrop" part="backdrop" @click=${l(this,Bl)}>
121
121
  <slot></slot>
122
122
  </div>
123
123
  `:null}
124
- `,l(this,Uo))},g($w,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",$w);const xO=16,Su=24,EO=32;var Bi;class Tw extends HTMLElement{constructor(){super();S(this,Bi);w(this,Bi,this.attachShadow({mode:"open"})),Id(l(this,Bi))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return Su;const r=Number(e);return r===xO||r===Su||r===EO?r:Su}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ze(L`<span class="spin">${cw({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,Bi))}}Bi=new WeakMap,g(Tw,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",Tw);class AO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class $O extends HTMLElement{}var Ho,Zo,Th;class Iw extends HTMLElement{constructor(){super();S(this,Zo);S(this,Ho);w(this,Ho,this.attachShadow({mode:"open"}))}connectedCallback(){p(this,Zo,Th).call(this)}attributeChangedCallback(){p(this,Zo,Th).call(this)}get closable(){return this.hasAttribute("closable")}}Ho=new WeakMap,Zo=new WeakSet,Th=function(){const e=this.querySelector("panel-page");Ze(L`
124
+ `,l(this,Uo))},g($w,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",$w);const _O=16,xu=24,kO=32;var ji;class Tw extends HTMLElement{constructor(){super();S(this,ji);w(this,ji,this.attachShadow({mode:"open"})),Pd(l(this,ji))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getSize(){const e=this.getAttribute("size");if(e===null)return xu;const r=Number(e);return r===_O||r===xu||r===kO?r:xu}getWeight(){return this.getAttribute("weight")==="bold"?"bold":"regular"}render(){Ze(L`<span class="spin">${cw({size:this.getSize(),weight:this.getWeight()})}</span>`,l(this,ji))}}ji=new WeakMap,g(Tw,"observedAttributes",["size","weight"]);customElements.get("ui-spinner")||customElements.define("ui-spinner",Tw);class xO extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class EO extends HTMLElement{}var Ho,Zo,Rh;class Iw extends HTMLElement{constructor(){super();S(this,Zo);S(this,Ho);w(this,Ho,this.attachShadow({mode:"open"}))}connectedCallback(){p(this,Zo,Rh).call(this)}attributeChangedCallback(){p(this,Zo,Rh).call(this)}get closable(){return this.hasAttribute("closable")}}Ho=new WeakMap,Zo=new WeakSet,Rh=function(){const e=this.querySelector("panel-page");Ze(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 AO)}
134
+ @click=${()=>this.dispatchEvent(new xO)}
135
135
  >
136
- <span class="close-icon" part="icon close-icon">${jd({size:16})}</span>
136
+ <span class="close-icon" part="icon close-icon">${Yd({size:16})}</span>
137
137
  </button>
138
138
  `:null}
139
139
  </header>
140
140
  <slot></slot>
141
141
  </section>
142
- `,l(this,Ho))},g(Iw,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Iw);customElements.get("panel-page")||customElements.define("panel-page",$O);const TO=`
142
+ `,l(this,Ho))},g(Iw,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",Iw);customElements.get("panel-page")||customElements.define("panel-page",EO);const AO=`
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
- `,IO=`
146
+ `,$O=`
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
- `,CO=`
156
+ `,TO=`
157
157
  :host {
158
158
  display: block;
159
159
  --checkbox-size: 1em;
@@ -234,14 +234,14 @@ 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 Wo;class RO extends HTMLElement{constructor(){super();S(this,Wo);w(this,Wo,this.attachShadow({mode:"open"})),l(this,Wo).innerHTML=`<style>${IO}</style><div part="list"><slot></slot></div>`}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","list")}}Wo=new WeakMap;var ji,Vo,Bo,Ih;class Cw extends HTMLElement{constructor(){super();S(this,Bo);S(this,ji);S(this,Vo);w(this,ji,this.attachShadow({mode:"open"})),l(this,ji).innerHTML=`
238
- <style>${CO}</style>
237
+ `;var Wo;class IO extends HTMLElement{constructor(){super();S(this,Wo);w(this,Wo,this.attachShadow({mode:"open"})),l(this,Wo).innerHTML=`<style>${$O}</style><div part="list"><slot></slot></div>`}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","list")}}Wo=new WeakMap;var Bi,Vo,jo,Ph;class Cw extends HTMLElement{constructor(){super();S(this,jo);S(this,Bi);S(this,Vo);w(this,Bi,this.attachShadow({mode:"open"})),l(this,Bi).innerHTML=`
238
+ <style>${TO}</style>
239
239
  <label part="label">
240
240
  <input type="checkbox" disabled tabindex="-1">
241
- <span part="box"><span part="check">${TO}</span></span>
241
+ <span part="box"><span part="check">${AO}</span></span>
242
242
  <span part="content"><slot></slot></span>
243
243
  </label>
244
- `;const e=l(this,ji).querySelector("input");if(!(e instanceof HTMLInputElement))throw new Error("checkbox-item failed to initialize input");w(this,Vo,e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","listitem"),this.setAttribute("aria-disabled","true"),p(this,Bo,Ih).call(this)}attributeChangedCallback(){p(this,Bo,Ih).call(this)}}ji=new WeakMap,Vo=new WeakMap,Bo=new WeakSet,Ih=function(){const e=this.hasAttribute("checked");l(this,Vo).checked=e,this.setAttribute("aria-checked",e?"true":"false")},g(Cw,"observedAttributes",["checked"]);customElements.get("checkbox-list")||customElements.define("checkbox-list",RO);customElements.get("checkbox-item")||customElements.define("checkbox-item",Cw);const Rw=Be(),Pw="No handler registered for update-content",Dw="handleUpdateContent: handler already registered",em="television-artifact-bridge";function Lw(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const zw=ma(zt);var Gi,qi,Yi,Dr,Lr,jo,Fe,Ch,Ow,Mw,Gs,Rh,Om;let PO=(Om=class extends zw{constructor(e){super();S(this,Fe);S(this,Gi);S(this,qi);S(this,Yi);S(this,Dr,null);S(this,Lr,null);S(this,jo,!1);w(this,Gi,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");w(this,qi,r),w(this,Yi,i=>p(this,Fe,Ow).call(this,i)),l(this,qi).addEventListener("message",l(this,Yi))}get content(){return l(this,Lr)}set content(e){p(this,Fe,Rh).call(this),w(this,Lr,e),l(this,jo)&&p(this,Fe,Ch).call(this,e)}handleUpdateContent(e){if(p(this,Fe,Rh).call(this),l(this,Dr)!==null)throw new Error(Dw);w(this,Dr,e)}dispose(){l(this,qi).removeEventListener("message",l(this,Yi)),w(this,Dr,null)}},Gi=new WeakMap,qi=new WeakMap,Yi=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,jo=new WeakMap,Fe=new WeakSet,Ch=function(e){const r={type:"content-updated",content:e};p(this,Fe,Gs).call(this,r)},Ow=function(e){if(this.disposed||e.source!==l(this,Gi).contentWindow)return;const r=e.data;if(Xy(r)){w(this,jo,!0),this.dispatchEvent(new Rw("ready")),l(this,Lr)!==null&&p(this,Fe,Ch).call(this,l(this,Lr));return}if(Qy(r)){p(this,Fe,Mw).call(this,r);return}},Mw=async function(e){const r=l(this,Dr);if(r===null){p(this,Fe,Gs).call(this,{type:"response",id:e.id,error:{message:Pw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,Fe,Gs).call(this,{type:"response",id:e.id,error:{message:Lw(i)}});return}this.disposed||p(this,Fe,Gs).call(this,{type:"response",id:e.id,result:{}})},Gs=function(e){const r=l(this,Gi).contentWindow;r&&r.postMessage(e,"*")},Rh=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Om);var zr,Ki,Or,Mr,Go,He,Ph,Nw,Uw,qs,Dh;class DO extends zw{constructor(e){super();S(this,He);S(this,zr);S(this,Ki);S(this,Or,null);S(this,Mr,null);S(this,Go,!1);w(this,zr,e),w(this,Ki,r=>p(this,He,Nw).call(this,r)),l(this,zr).addEventListener("ipc-message",l(this,Ki))}get content(){return l(this,Mr)}set content(e){p(this,He,Dh).call(this),w(this,Mr,e),l(this,Go)&&p(this,He,Ph).call(this,e)}handleUpdateContent(e){if(p(this,He,Dh).call(this),l(this,Or)!==null)throw new Error(Dw);w(this,Or,e)}dispose(){l(this,zr).removeEventListener("ipc-message",l(this,Ki)),w(this,Or,null)}}zr=new WeakMap,Ki=new WeakMap,Or=new WeakMap,Mr=new WeakMap,Go=new WeakMap,He=new WeakSet,Ph=function(e){const r={type:"content-updated",content:e};p(this,He,qs).call(this,r)},Nw=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==em)return;const i=(s=r.args)==null?void 0:s[0];if(Xy(i)){w(this,Go,!0),this.dispatchEvent(new Rw("ready")),l(this,Mr)!==null&&p(this,He,Ph).call(this,l(this,Mr));return}if(Qy(i)){p(this,He,Uw).call(this,i);return}},Uw=async function(e){const r=l(this,Or);if(r===null){p(this,He,qs).call(this,{type:"response",id:e.id,error:{message:Pw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,He,qs).call(this,{type:"response",id:e.id,error:{message:Lw(i)}});return}this.disposed||p(this,He,qs).call(this,{type:"response",id:e.id,result:{}})},qs=function(e){var r,i;(i=(r=l(this,zr)).send)==null||i.call(r,em,e)},Dh=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};const tm="television-artifact-bridge",nm="/views/url-unsupported/",LO=404,Fw=Be(),zO=Be(),OO=Be();class MO 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(Pp(e.data)){this.dispatchArtifactWheel({deltaX:e.data.deltaX,shiftKey:e.data.shiftKey});return}if(Dp(e.data)){this.dispatchArtifactFilmstripKey(e.data.direction);return}if(B0(e.data)){(i=r.contentWindow)==null||i.postMessage({type:j0,url:this.currentExternalTargetURL()},"*");return}if(Lp(e.data)){(s=r.contentWindow)==null||s.postMessage(this.currentMissingArtifactMessage(),"*");return}G0(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",()=>{this.reloadProxyFrame()});g(this,"handleWebviewIpcMessage",e=>{var o,a;const r=e.detail??e;if(!r||r.channel!==tm)return;const i=(o=r.args)==null?void 0:o[0];if(!i)return;const s=this._subscribedWebview;if(s){if(Lp(i)){const c=this.currentMissingArtifactMessage();c&&((a=s.send)==null||a.call(s,tm,c));return}if(Pp(i)){this.dispatchArtifactWheel({deltaX:i.deltaX,shiftKey:i.shiftKey});return}Dp(i)&&this.dispatchArtifactFilmstripKey(i.direction)}});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 Fw("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&&_u(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:q0,title:e.title,path:e.path}}handleNavigationRequest(e){this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===nm||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 OO("artifact-filmstrip-key",{bubbles:!0,composed:!0,direction:e}))}dispatchArtifactWheel(e){this._standaloneScroll||this.dispatchEvent(new zO("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 Oz(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=Rl(e,{electron:ln()}),i=this._viewURL??r.viewURL;return r.renderer==="url-webview"?Wr(i):rm(i,i)}convertIframeNavigationURL(e){var i;const r=(i=this.querySelector(".artifact-frame"))==null?void 0:i.getAttribute("src");return rm(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=Wr(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 DO(e):new PO(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 Pd&&s.status===LO){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"&&Ky(this._artifact.path)}missingArtifactTemplate(e){return L`
244
+ `;const e=l(this,Bi).querySelector("input");if(!(e instanceof HTMLInputElement))throw new Error("checkbox-item failed to initialize input");w(this,Vo,e)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","listitem"),this.setAttribute("aria-disabled","true"),p(this,jo,Ph).call(this)}attributeChangedCallback(){p(this,jo,Ph).call(this)}}Bi=new WeakMap,Vo=new WeakMap,jo=new WeakSet,Ph=function(){const e=this.hasAttribute("checked");l(this,Vo).checked=e,this.setAttribute("aria-checked",e?"true":"false")},g(Cw,"observedAttributes",["checked"]);customElements.get("checkbox-list")||customElements.define("checkbox-list",IO);customElements.get("checkbox-item")||customElements.define("checkbox-item",Cw);const Rw=je(),Pw="No handler registered for update-content",Dw="handleUpdateContent: handler already registered",nm="television-artifact-bridge";function Lw(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const zw=ma(zt);var Gi,qi,Yi,Dr,Lr,Bo,Fe,Dh,Ow,Mw,Gs,Lh,Nm;let CO=(Nm=class extends zw{constructor(e){super();S(this,Fe);S(this,Gi);S(this,qi);S(this,Yi);S(this,Dr,null);S(this,Lr,null);S(this,Bo,!1);w(this,Gi,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");w(this,qi,r),w(this,Yi,i=>p(this,Fe,Ow).call(this,i)),l(this,qi).addEventListener("message",l(this,Yi))}get content(){return l(this,Lr)}set content(e){p(this,Fe,Lh).call(this),w(this,Lr,e),l(this,Bo)&&p(this,Fe,Dh).call(this,e)}handleUpdateContent(e){if(p(this,Fe,Lh).call(this),l(this,Dr)!==null)throw new Error(Dw);w(this,Dr,e)}dispose(){l(this,qi).removeEventListener("message",l(this,Yi)),w(this,Dr,null)}},Gi=new WeakMap,qi=new WeakMap,Yi=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,Bo=new WeakMap,Fe=new WeakSet,Dh=function(e){const r={type:"content-updated",content:e};p(this,Fe,Gs).call(this,r)},Ow=function(e){if(this.disposed||e.source!==l(this,Gi).contentWindow)return;const r=e.data;if(Xy(r)){w(this,Bo,!0),this.dispatchEvent(new Rw("ready")),l(this,Lr)!==null&&p(this,Fe,Dh).call(this,l(this,Lr));return}if(Qy(r)){p(this,Fe,Mw).call(this,r);return}},Mw=async function(e){const r=l(this,Dr);if(r===null){p(this,Fe,Gs).call(this,{type:"response",id:e.id,error:{message:Pw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,Fe,Gs).call(this,{type:"response",id:e.id,error:{message:Lw(i)}});return}this.disposed||p(this,Fe,Gs).call(this,{type:"response",id:e.id,result:{}})},Gs=function(e){const r=l(this,Gi).contentWindow;r&&r.postMessage(e,"*")},Lh=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Nm);var zr,Ki,Or,Mr,Go,He,zh,Nw,Uw,qs,Oh;class RO extends zw{constructor(e){super();S(this,He);S(this,zr);S(this,Ki);S(this,Or,null);S(this,Mr,null);S(this,Go,!1);w(this,zr,e),w(this,Ki,r=>p(this,He,Nw).call(this,r)),l(this,zr).addEventListener("ipc-message",l(this,Ki))}get content(){return l(this,Mr)}set content(e){p(this,He,Oh).call(this),w(this,Mr,e),l(this,Go)&&p(this,He,zh).call(this,e)}handleUpdateContent(e){if(p(this,He,Oh).call(this),l(this,Or)!==null)throw new Error(Dw);w(this,Or,e)}dispose(){l(this,zr).removeEventListener("ipc-message",l(this,Ki)),w(this,Or,null)}}zr=new WeakMap,Ki=new WeakMap,Or=new WeakMap,Mr=new WeakMap,Go=new WeakMap,He=new WeakSet,zh=function(e){const r={type:"content-updated",content:e};p(this,He,qs).call(this,r)},Nw=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==nm)return;const i=(s=r.args)==null?void 0:s[0];if(Xy(i)){w(this,Go,!0),this.dispatchEvent(new Rw("ready")),l(this,Mr)!==null&&p(this,He,zh).call(this,l(this,Mr));return}if(Qy(i)){p(this,He,Uw).call(this,i);return}},Uw=async function(e){const r=l(this,Or);if(r===null){p(this,He,qs).call(this,{type:"response",id:e.id,error:{message:Pw}});return}try{await r(e.content)}catch(i){if(this.disposed)return;p(this,He,qs).call(this,{type:"response",id:e.id,error:{message:Lw(i)}});return}this.disposed||p(this,He,qs).call(this,{type:"response",id:e.id,result:{}})},qs=function(e){var r,i;(i=(r=l(this,zr)).send)==null||i.call(r,nm,e)},Oh=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};const rm="television-artifact-bridge",im="/views/url-unsupported/",PO=404,Fw=je(),DO=je(),LO=je();class zO 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(zp(e.data)){this.dispatchArtifactWheel({deltaX:e.data.deltaX,shiftKey:e.data.shiftKey});return}if(Op(e.data)){this.dispatchArtifactFilmstripKey(e.data.direction);return}if(j0(e.data)){(i=r.contentWindow)==null||i.postMessage({type:B0,url:this.currentExternalTargetURL()},"*");return}if(Mp(e.data)){(s=r.contentWindow)==null||s.postMessage(this.currentMissingArtifactMessage(),"*");return}G0(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",()=>{this.reloadProxyFrame()});g(this,"handleWebviewIpcMessage",e=>{var o,a;const r=e.detail??e;if(!r||r.channel!==rm)return;const i=(o=r.args)==null?void 0:o[0];if(!i)return;const s=this._subscribedWebview;if(s){if(Mp(i)){const c=this.currentMissingArtifactMessage();c&&((a=s.send)==null||a.call(s,rm,c));return}if(zp(i)){this.dispatchArtifactWheel({deltaX:i.deltaX,shiftKey:i.shiftKey});return}Op(i)&&this.dispatchArtifactFilmstripKey(i.direction)}});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 Fw("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&&Eu(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:q0,title:e.title,path:e.path}}handleNavigationRequest(e){this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===im||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 LO("artifact-filmstrip-key",{bubbles:!0,composed:!0,direction:e}))}dispatchArtifactWheel(e){this._standaloneScroll||this.dispatchEvent(new DO("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 Lz(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=Rl(e,{electron:ln()}),i=this._viewURL??r.viewURL;return r.renderer==="url-webview"?Wr(i):sm(i,i)}convertIframeNavigationURL(e){var i;const r=(i=this.querySelector(".artifact-frame"))==null?void 0:i.getAttribute("src");return sm(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=Wr(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 RO(e):new CO(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 zd&&s.status===PO){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"&&Ky(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
247
  <h1>${J0()}</h1>
@@ -253,7 +253,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
253
253
  <p>${Q0()}</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;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")return;const r=e.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(Pl,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 class="artifact-frame artifact-content" src=${o} data-content-url=${a}></webview>`:L`<webview 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=Rl(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 _u(i)&&!ln()?{renderer:"proxy-iframe",viewURL:nm,contentURL:null}:_u(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;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")return;const r=e.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(Pl,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 class="artifact-frame artifact-content" src=${o} data-content-url=${a}></webview>`:L`<webview 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=Rl(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 Eu(i)&&!ln()?{renderer:"proxy-iframe",viewURL:im,contentURL:null}:Eu(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
- ${cO({size:16})}
265
+ ${aO({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
- ${pO({size:16,weight:"duotone"})}
276
+ ${hO({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
- ${jd({size:16})}
294
+ ${Yd({size:16})}
295
295
  </button>
296
296
  </div>
297
297
  </footer>
298
- `}render(e={}){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ze(this.template({preserveFrameSrc:e.preserveFrameSrc??!1}),this),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncWebviewSubscription(),this.syncEmbedLoadState(),this.syncMarkdownHost())}}function _u(n){return n.startsWith("http://")||n.startsWith("https://")}function rm(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(Pl),`${e.pathname}${e.search}${e.hash}`}}catch{return Wr(n)}return Wr(n)}customElements.define("artifact-view",MO);/**
298
+ `}render(e={}){this._artifact&&(this.setAttribute("kind",this._artifact.kind),Ze(this.template({preserveFrameSrc:e.preserveFrameSrc??!1}),this),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncWebviewSubscription(),this.syncEmbedLoadState(),this.syncMarkdownHost())}}function Eu(n){return n.startsWith("http://")||n.startsWith("https://")}function sm(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(Pl),`${e.pathname}${e.search}${e.hash}`}}catch{return Wr(n)}return Wr(n)}customElements.define("artifact-view",zO);/**
299
299
  * @license
300
300
  * Copyright 2017 Google LLC
301
301
  * SPDX-License-Identifier: BSD-3-Clause
302
- */const im=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},sm=_c(class extends Bd{constructor(n){if(super(n),n.type!==Vd.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=rO(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]=ur(i[f],s[m]),f++,m++;else if(a[y]===o[E])c[E]=ur(i[y],s[E]),y--,E--;else if(a[f]===o[E])c[E]=ur(i[f],s[E]),Ps(n,c[E+1],i[f]),f++,E--;else if(a[y]===o[m])c[m]=ur(i[y],s[m]),Ps(n,i[f],i[y]),y--,m++;else if(u===void 0&&(u=im(o,m,E),h=im(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=Ps(n,i[f]);ur(P,s[m]),c[m]=P}else c[m]=ur(I,s[m]),Ps(n,i[f],I),i[x]=null;m++}else yu(i[y]),y--;else yu(i[f]),f++;for(;m<=E;){const x=Ps(n,c[E+1]);ur(x,s[m]),c[m++]=x}for(;f<=y;){const x=i[f++];x!==null&&yu(x)}return this.ut=o,nO(n,c),Gr}}),Ie=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Za=2;class NO{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??Vr,r=this._viewport.y??so,i=this._gap.x??ae,s=this._gap.y??ae,o=e<=GA,a=o?e-i*Za:Math.min(Vr,e-i*Za),c=o?r-s*Za:Math.min(so,r-s*Za),u=(a-i*(Ve-1))/Ve,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 qr=1e-4,Pt=1e-6,UO=40,FO=24;function Hw(n,t){return Math.max(0,n-t*2)}function Zw(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function Ww(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 Vw(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+qr)break;r=a,i+=1}return Math.max(1,i)}function HO(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+qr)break;r=a,i+=1}return Math.max(1,i)}function ZO(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+qr)break;e=o,r+=1}return Math.max(1,r)}function Gd(n,t){if(n.length===0)return 0;const e=ZO(n,t);return Math.max(0,n.length-e)}function om(n,t,e){if(n.length===0)return 0;const r=Vw(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 Lh(n,t,e){const r=n[t]??0;return e-r}function _i(n,t,e,r,i){if(n.length===0)return 0;const s=Gd(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,j=t[F+1]??Y;if(a>=Y&&a<=j+qr){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,qr),m=u===c?0:(a-h)/y,E=Ww(n),x=om(n,c,i),I=om(n,u,i),P=(r-x)/2,R=(r-I)/2,V=Lh(E,c,P),N=Lh(E,u,R);return V+(N-V)*m}function WO(n,t,e,r,i){const s=Gd(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<UO;u+=1){const h=(a+c)/2;_i(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function VO(n,t,e){const r=Ww(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 Lh(r,i,c)}function BO(n,t,e){const r=Vw(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function jO(n,t,e){const r=HO(n,t,e);return[Math.max(0,t-r+1),t]}function GO(n,t){return n[0]===t[0]&&n[1]===t[1]}function qO(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=Hw(r,s),a=Zw(t),c=Gd(e,o),u=a[c]??0;function h(I){const P=VO(e,I,r),R=WO(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=BO(e,I,o);f.push(h(P)),I=P[1]+1}const y=h(jO(e,i-1,o)),m=f.filter(I=>I.nodeRange[0]<y.nodeRange[0]),E=m[m.length-1];return{viewspans:E&&GO(E.nodeRange,y.nodeRange)?m:[...m,y],minScroll:0,maxScroll:u}}function di(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+Pt<r){r=o,e=s;continue}Math.abs(o-r)<=Pt&&s<e&&(e=s)}return e}function YO(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function hr(n,t,e){return Math.max(t,Math.min(e,n))}function KO(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)<=Pt)return r;return-1}function JO(n,t,e){var i,s;if(n.length===0)return t;const r=KO(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+Pt)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-Pt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class XO extends zt{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:_i(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=hr(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Pt||(this._scroll=r,this._activeViewspanIndex=di(this._viewspans,this._scroll),this.dispatchEvent(new hi("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=qO({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=Zw(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Hw(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=hr(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=di(this._viewspans,c);const h=e.snap!==!1?((y=this._viewspans[this._activeViewspanIndex])==null?void 0:y.anchor)??c:c,f=hr(h,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)>Pt&&(this._scroll=f,this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=YO(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=hr(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=Pt)&&(this._scroll=s,this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[di(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:JO(this._viewspans,this._scroll,e),i=hr(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=di(this._viewspans,i),!(Math.abs(i-this._scroll)<=Pt)&&(this._scroll=i,this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=hr(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Pt||(this._scroll=r,this._activeViewspanIndex=di(this._viewspans,this._scroll),this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=qr)return;const i=_i(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=_i(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=_i(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=qr)return;let u=this._minScroll,h=this._maxScroll;for(let y=0;y<FO;y+=1){const m=(u+h)/2;_i(this._nodeWidthsPx,this._boundaryCols,m,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=m:h=m}const f=hr((u+h)/2,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)<=Pt||(this._scroll=f,this._activeViewspanIndex=di(this._viewspans,this._scroll),this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}}const ku={"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}},QO=["stack-above","stack-below","reorder-before","reorder-after"];function xu(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 dr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function Ri(n){return n.artifactID}function zh(n){return Number.isFinite(n)?Math.max(io,Math.min(Cd,Math.round(n))):io}function eM(n,t,e){const r=n.findIndex(a=>a.type==="card"&&Ri(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 Bw(n,t){for(const e of n){if(e.type==="card"&&Ri(e)===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&Ri(r)===t)return r;if(r.type==="row"){for(const i of r.children)if(Ri(i)===t)return i}}}return null}function Oh(n){const t=n.height===ft||n.height===Kn?Kn:n.height;return n.width===Ve&&n.height===t?n:{...n,width:Ve,height:t}}function Mh(n){return n.height===Kn?{...n,height:ft}:n}function tM(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"&&Ri(h)===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.type!=="card"||Ri(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"?Mh(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,Mh(o)),c}const nM=Be(),rM=Be(),iM=50;function sM(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 Xe(n){return n.artifactID}function am(n){return n.type==="card"?Xe(n):n.id}function ya(n){return{id:Xe(n),type:"drop-target",width:n.width,height:n.height}}function lm(n){return n.map(aM)}function oM(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function aM(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(oM)}:n}function jw(n,t){return n.find(r=>r.type==="card"&&Xe(r)===t)??null}function cm(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function lM(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&Xe(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"&&Xe(a)===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function cM(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(y=>y.type==="card"&&Xe(y)===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=jw(r,t.nodeId);if(!a)return null;const c=Oh(a),u=Oh(o),h=ya(c),f=e.position==="above"?[h,u]:[u,h];return i[s]={id:Xe(o),type:"stack",children:f},i}function Eu(n,t){return n.parentStackId?hM(n,t):uM(n,t)}function uM(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,ya(r)),i}if(e.type==="stack"){const r=lM(n,t);return r?cM(r,n,e,t)??[...t]:[...t]}return[...t]}function hM(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return dM(n,t,e.position);case"stack-child-extract":return pM(n,t,e.toIndex);case"stack-child-noop":return fM(n,t);default:return[...t]}}function dM(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=>Xe(y)===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(y=>Xe(y)!==n.nodeId),u=ya(a),h=e==="above"?[u,...c]:[...c,u],f=[...t];return f[r]={...i,children:h},f}function pM(n,t,e){if(!n.parentStackId)return[...t];const r=tM(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&Xe(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]=ya(s),o}function fM(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"&&Xe(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]=ya(s),o[e]={...r,children:a},o}function gM(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Dd()}function mM(n,t,e){if(n.type==="drop-target"){const r=Bw(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Oh(r)}return n}function vM(n,t,e){const r=n.children.map(s=>mM(s,t,e));return{id:gM(n,t),type:"stack",children:r}}function yM(n,t,e){if(n.type==="drop-target"){const r=Bw(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return jw(t,e)!==null?r:Mh(r)}return n.type==="card"||n.type==="row"?n:vM(n,t,e)}function bM(n,t,e){return n.map(r=>yM(r,t,e))}function wM(n,t){return JSON.stringify(n)===JSON.stringify(t)}const SM=ma(zt);class _M extends SM{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)>=YA&&(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=Eu(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&&sM(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=Eu(this.active,e),s=bM(i,e,this.active.nodeId);wM(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new rM("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=Eu(this.active,this.active.baseLayout);this.dispatchEvent(new nM("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&&dr(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&&dr(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=cm(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&Xe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===Xe(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=cm(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&Xe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===Xe(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)<=iM;for(const I of o){const P=I.rect;if(!dr(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(!dr(e,r,f.rect))continue;const y=xu(f.rect,ku["reorder-before"]);if(dr(e,r,y))return f.logicalIndex;const m=xu(f.rect,ku["reorder-after"]);if(dr(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=>[am(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:am(c),rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of QO){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=ku[c],h=xu(a,u);if(dr(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 kM=100,xM=1e3;class EM{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)<JA?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-kM;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*xM}}function Ti(n){return n.artifactID}function AM(n){return n.type==="card"?Ti(n):n.id}function $M({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var E;const a=new Map(t.map(x=>[AM(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:Ti(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:Ti(N),kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},Y=TM(n,s.source.parentId,s.nodeId),j=Y<0?R.length:Math.min(Y,R.length);R.splice(j,0,F)}}const V=!!(s&&(P==null?void 0:P.type)==="card"&&Ti(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=br(n).nodes[s.source.index])==null?void 0:E.width)??Ve,y={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:f,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:Ti(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 um(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 TM(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"&&Ti(i)===e)}const IM=2,hm=1e3,pi=1e-4,CM=120,dm=!1;function pm(n){return n.replace(/["\\]/g,"\\$&")}function be(n){return n.artifactID}function Pi(n){return n.type==="card"?be(n):n.id}function fm(n,t,e){if(n===0)return 0;const r=t.toPixels(Te({y:ft})).y??0;return(e-r)/IM}function Au(n){const t=n.clientWidth>0?n.clientWidth:Vr,e=n.clientHeight>0?n.clientHeight:so;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=so+ae*2,c=Math.min(o,Math.max(0,s-a));return{width:t,height:s-c,offsetY:r}}function RM(n){return n.shiftKey&&n.deltaX===0&&n.deltaY!==0?n.deltaY:n.deltaX}function PM(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 DM extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});g(this,"scrollPosition");this.scrollPosition=e}}class Gw extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});g(this,"layout");this.layout=e}}class LM extends HTMLElement{constructor(){super();g(this,"_layout",[]);g(this,"_scrollPosition",0);g(this,"layoutGrid",null);g(this,"layoutScroll",new XO(Te({x:0})));g(this,"scrollModelKey","");g(this,"resizeObserver",null);g(this,"renderPending",!1);g(this,"animateNextRender",!0);g(this,"swipeGesture",new EM(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 _M);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=um(e),s=OM(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=lm(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)<pi||(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"&&(PM(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=RM(e);Math.abs(r)<pi||(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(Y0(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(K0(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)<pi||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=MM(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)??Ln)+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(eM(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<dg&&a<dg)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)/hm;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>pi?Math.abs(o)/r:0,Math.abs(o)>pi&&(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)<pi||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=br(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="${pm(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 NO({basis:Ie({x:Ln,y:Ln}),min:Ie({x:ug,y:ug}),viewport:Ie({x:e,y:r}),gap:Ie({x:ae,y:ae})})}syncScrollModel(){const e=Au(this),i=br(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:dm}))}emitScrollPositionChanged(e){this.dispatchEvent(new DM(e))}emitLayoutChanged(){this.dispatchEvent(new Gw([...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()},CM)}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"&&be(a)===i);if(!s)return;const o=zh(typeof s.width=="number"?s.width:Ve);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):lm(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&be(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 om=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},am=_c(class extends qd{constructor(n){if(super(n),n.type!==Gd.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=tO(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]=ur(i[f],s[m]),f++,m++;else if(a[y]===o[E])c[E]=ur(i[y],s[E]),y--,E--;else if(a[f]===o[E])c[E]=ur(i[f],s[E]),Ps(n,c[E+1],i[f]),f++,E--;else if(a[y]===o[m])c[m]=ur(i[y],s[m]),Ps(n,i[f],i[y]),y--,m++;else if(u===void 0&&(u=om(o,m,E),h=om(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=Ps(n,i[f]);ur(P,s[m]),c[m]=P}else c[m]=ur(I,s[m]),Ps(n,i[f],I),i[x]=null;m++}else Su(i[y]),y--;else Su(i[f]),f++;for(;m<=E;){const x=Ps(n,c[E+1]);ur(x,s[m]),c[m++]=x}for(;f<=y;){const x=i[f++];x!==null&&Su(x)}return this.ut=o,eO(n,c),Gr}}),Ie=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Za=2;class OO{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??Vr,r=this._viewport.y??so,i=this._gap.x??ae,s=this._gap.y??ae,o=e<=jA,a=o?e-i*Za:Math.min(Vr,e-i*Za),c=o?r-s*Za:Math.min(so,r-s*Za),u=(a-i*(Ve-1))/Ve,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 qr=1e-4,Pt=1e-6,MO=40,NO=24;function Hw(n,t){return Math.max(0,n-t*2)}function Zw(n){const t=[0];for(const e of n)t.push((t[t.length-1]??0)+e);return t}function Ww(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 Vw(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+qr)break;r=a,i+=1}return Math.max(1,i)}function UO(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+qr)break;r=a,i+=1}return Math.max(1,i)}function FO(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+qr)break;e=o,r+=1}return Math.max(1,r)}function Kd(n,t){if(n.length===0)return 0;const e=FO(n,t);return Math.max(0,n.length-e)}function lm(n,t,e){if(n.length===0)return 0;const r=Vw(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 Mh(n,t,e){const r=n[t]??0;return e-r}function _i(n,t,e,r,i){if(n.length===0)return 0;const s=Kd(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+qr){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,qr),m=u===c?0:(a-h)/y,E=Ww(n),x=lm(n,c,i),I=lm(n,u,i),P=(r-x)/2,R=(r-I)/2,V=Mh(E,c,P),N=Mh(E,u,R);return V+(N-V)*m}function HO(n,t,e,r,i){const s=Kd(n,r),o=t[s]??0;let a=0,c=o;for(let u=0;u<MO;u+=1){const h=(a+c)/2;_i(n,t,h,e,r)>i?a=h:c=h}return(a+c)/2}function ZO(n,t,e){const r=Ww(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 Mh(r,i,c)}function WO(n,t,e){const r=Vw(n,t,e);return[t,Math.min(n.length-1,t+r-1)]}function VO(n,t,e){const r=UO(n,t,e);return[Math.max(0,t-r+1),t]}function jO(n,t){return n[0]===t[0]&&n[1]===t[1]}function BO(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=Hw(r,s),a=Zw(t),c=Kd(e,o),u=a[c]??0;function h(I){const P=ZO(e,I,r),R=HO(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=WO(e,I,o);f.push(h(P)),I=P[1]+1}const y=h(VO(e,i-1,o)),m=f.filter(I=>I.nodeRange[0]<y.nodeRange[0]),E=m[m.length-1];return{viewspans:E&&jO(E.nodeRange,y.nodeRange)?m:[...m,y],minScroll:0,maxScroll:u}}function di(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+Pt<r){r=o,e=s;continue}Math.abs(o-r)<=Pt&&s<e&&(e=s)}return e}function GO(n,t,e){return e<=0?0:Math.max(0,Math.min(e-1,n+t))}function hr(n,t,e){return Math.max(t,Math.min(e,n))}function qO(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)<=Pt)return r;return-1}function YO(n,t,e){var i,s;if(n.length===0)return t;const r=qO(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+Pt)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-Pt)return a.anchor}return((s=n[0])==null?void 0:s.anchor)??t}class KO extends zt{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:_i(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=hr(e.x??this._scroll,this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Pt||(this._scroll=r,this._activeViewspanIndex=di(this._viewspans,this._scroll),this.dispatchEvent(new hi("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=BO({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this._nodeWidthsPx=i,this._boundaryCols=Zw(r),this._viewportWidthPx=s,this._framedViewportWidthPx=Hw(s,o),this._viewspans=a.viewspans,this._minScroll=a.minScroll,this._maxScroll=a.maxScroll;const c=hr(this._scroll,this._minScroll,this._maxScroll);this._activeViewspanIndex=di(this._viewspans,c);const h=e.snap!==!1?((y=this._viewspans[this._activeViewspanIndex])==null?void 0:y.anchor)??c:c,f=hr(h,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)>Pt&&(this._scroll=f,this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}step(e){var o;if(this._viewspans.length===0)return;const r=GO(this._activeViewspanIndex,e,this._viewspans.length),i=((o=this._viewspans[r])==null?void 0:o.anchor)??this._scroll,s=hr(i,this._minScroll,this._maxScroll);this._activeViewspanIndex=r,!(Math.abs(s-this._scroll)<=Pt)&&(this._scroll=s,this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}snap(e){var s;if(this._viewspans.length===0)return;const r=e===void 0?((s=this._viewspans[di(this._viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:YO(this._viewspans,this._scroll,e),i=hr(r,this._minScroll,this._maxScroll);this._activeViewspanIndex=di(this._viewspans,i),!(Math.abs(i-this._scroll)<=Pt)&&(this._scroll=i,this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}wheel(e){const r=hr(this._scroll+(e.x??0),this._minScroll,this._maxScroll);Math.abs(r-this._scroll)<=Pt||(this._scroll=r,this._activeViewspanIndex=di(this._viewspans,this._scroll),this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}wheelPixels(e){const r=e.x??0;if(Math.abs(r)<=qr)return;const i=_i(this._nodeWidthsPx,this._boundaryCols,this._scroll,this._viewportWidthPx,this._framedViewportWidthPx),s=i-r,o=_i(this._nodeWidthsPx,this._boundaryCols,this._maxScroll,this._viewportWidthPx,this._framedViewportWidthPx),a=_i(this._nodeWidthsPx,this._boundaryCols,this._minScroll,this._viewportWidthPx,this._framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=qr)return;let u=this._minScroll,h=this._maxScroll;for(let y=0;y<NO;y+=1){const m=(u+h)/2;_i(this._nodeWidthsPx,this._boundaryCols,m,this._viewportWidthPx,this._framedViewportWidthPx)>c?u=m:h=m}const f=hr((u+h)/2,this._minScroll,this._maxScroll);Math.abs(f-this._scroll)<=Pt||(this._scroll=f,this._activeViewspanIndex=di(this._viewspans,this._scroll),this.dispatchEvent(new hi("layout-scroll",{scroll:this.scroll})))}}const Au={"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}},JO=["stack-above","stack-below","reorder-before","reorder-after"];function $u(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 dr(n,t,e){return n>=e.left&&n<e.left+e.width&&t>=e.top&&t<e.top+e.height}function Ri(n){return n.artifactID}function Nh(n){return Number.isFinite(n)?Math.max(io,Math.min(Dd,Math.round(n))):io}function XO(n,t,e){const r=n.findIndex(a=>a.type==="card"&&Ri(a)===t);if(r===-1)return n;const i=n[r];if(!i||i.type!=="card")return n;const s=Nh(e);if(i.width===s)return n;const o=[...n];return o[r]={...i,width:s},o}function jw(n,t){for(const e of n){if(e.type==="card"&&Ri(e)===t)return e;if(e.type==="stack")for(const r of e.children){if(r.type==="card"&&Ri(r)===t)return r;if(r.type==="row"){for(const i of r.children)if(Ri(i)===t)return i}}}return null}function Uh(n){const t=n.height===ft||n.height===Kn?Kn:n.height;return n.width===Ve&&n.height===t?n:{...n,width:Ve,height:t}}function Fh(n){return n.height===Kn?{...n,height:ft}:n}function QO(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"&&Ri(h)===e);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.type!=="card"||Ri(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"?Fh(h):h}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,Fh(o)),c}const eM=je(),tM=je(),nM=50;function rM(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 Xe(n){return n.artifactID}function cm(n){return n.type==="card"?Xe(n):n.id}function ya(n){return{id:Xe(n),type:"drop-target",width:n.width,height:n.height}}function um(n){return n.map(sM)}function iM(n){return n.type==="drop-target"?{type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function sM(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(iM)}:n}function Bw(n,t){return n.find(r=>r.type==="card"&&Xe(r)===t)??null}function hm(n,t){return n.find(r=>r.type==="stack"&&r.id===t)??null}function oM(n,t){const e=[...t],r=e.findIndex(a=>a.type==="card"&&Xe(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"&&Xe(a)===n.nodeId);return o===-1?null:{base:e,visualDraggedIndex:o}}function aM(n,t,e,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(y=>y.type==="card"&&Xe(y)===e.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Bw(r,t.nodeId);if(!a)return null;const c=Uh(a),u=Uh(o),h=ya(c),f=e.position==="above"?[h,u]:[u,h];return i[s]={id:Xe(o),type:"stack",children:f},i}function Tu(n,t){return n.parentStackId?cM(n,t):lM(n,t)}function lM(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,ya(r)),i}if(e.type==="stack"){const r=oM(n,t);return r?aM(r,n,e,t)??[...t]:[...t]}return[...t]}function cM(n,t){const e=n.hitTarget;switch(e.type){case"stack-child-reorder":return uM(n,t,e.position);case"stack-child-extract":return hM(n,t,e.toIndex);case"stack-child-noop":return dM(n,t);default:return[...t]}}function uM(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=>Xe(y)===n.nodeId);if(o===-1)return[...t];const a=s[o],c=s.filter(y=>Xe(y)!==n.nodeId),u=ya(a),h=e==="above"?[u,...c]:[...c,u],f=[...t];return f[r]={...i,children:h},f}function hM(n,t,e){if(!n.parentStackId)return[...t];const r=QO(t,n.parentStackId,n.nodeId,e);if(r===t)return[...t];const i=r.findIndex(a=>a.type==="card"&&Xe(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]=ya(s),o}function dM(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"&&Xe(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]=ya(s),o[e]={...r,children:a},o}function pM(n,t){return t.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Od()}function fM(n,t,e){if(n.type==="drop-target"){const r=jw(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Uh(r)}return n}function gM(n,t,e){const r=n.children.map(s=>fM(s,t,e));return{id:pM(n,t),type:"stack",children:r}}function mM(n,t,e){if(n.type==="drop-target"){const r=jw(t,e);if(!r)throw new Error(`finalize: missing dragged card ${e}`);return Bw(t,e)!==null?r:Fh(r)}return n.type==="card"||n.type==="row"?n:gM(n,t,e)}function vM(n,t,e){return n.map(r=>mM(r,t,e))}function yM(n,t){return JSON.stringify(n)===JSON.stringify(t)}const bM=ma(zt);class wM extends bM{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)>=GA&&(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=Tu(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&&rM(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=Tu(this.active,e),s=vM(i,e,this.active.nodeId);yM(s,e)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new tM("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=Tu(this.active,this.active.baseLayout);this.dispatchEvent(new eM("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&&dr(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&&dr(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=hm(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&Xe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=e.find(a=>a.id===Xe(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=hm(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&Xe(a)!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=e.find(c=>c.id===Xe(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)<=nM;for(const I of o){const P=I.rect;if(!dr(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(!dr(e,r,f.rect))continue;const y=$u(f.rect,Au["reorder-before"]);if(dr(e,r,y))return f.logicalIndex;const m=$u(f.rect,Au["reorder-after"]);if(dr(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=>[cm(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:cm(c),rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(e,r,i,s,o){const a=i.rect;for(const c of JO){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Au[c],h=$u(a,u);if(dr(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 SM=100,_M=1e3;class kM{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)<YA?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-SM;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*_M}}function Ti(n){return n.artifactID}function xM(n){return n.type==="card"?Ti(n):n.id}function EM({baseLayout:n,visibleLayout:t,resolved:e,cardsByID:r,grid:i,dragState:s,isForeground:o}){var E;const a=new Map(t.map(x=>[xM(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:Ti(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:Ti(N),kind:"card",card:N,placement:null,isTopLevelCard:!1,isDragged:!0,sourceStackId:s.source.parentId},Y=AM(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"&&Ti(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=br(n).nodes[s.source.index])==null?void 0:E.width)??Ve,y={key:h,kind:"ghost",nodeId:h,widthPx:0,widthUnits:f,layoutIndex:null,isForeground:!1,isPlaceholder:!1,slots:[{key:Ti(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 dm(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 AM(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"&&Ti(i)===e)}const $M=2,pm=1e3,pi=1e-4,TM=120,fm=!1;function gm(n){return n.replace(/["\\]/g,"\\$&")}function be(n){return n.artifactID}function Pi(n){return n.type==="card"?be(n):n.id}function mm(n,t,e){if(n===0)return 0;const r=t.toPixels(Te({y:ft})).y??0;return(e-r)/$M}function Iu(n){const t=n.clientWidth>0?n.clientWidth:Vr,e=n.clientHeight>0?n.clientHeight:so;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=so+ae*2,c=Math.min(o,Math.max(0,s-a));return{width:t,height:s-c,offsetY:r}}function IM(n){return n.shiftKey&&n.deltaX===0&&n.deltaY!==0?n.deltaY:n.deltaX}function CM(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 RM extends Event{constructor(e){super("scroll",{bubbles:!0,composed:!0});g(this,"scrollPosition");this.scrollPosition=e}}class Gw extends Event{constructor(e){super("layout-change",{bubbles:!0,composed:!0});g(this,"layout");this.layout=e}}class PM extends HTMLElement{constructor(){super();g(this,"_layout",[]);g(this,"_scrollPosition",0);g(this,"layoutGrid",null);g(this,"layoutScroll",new KO(Te({x:0})));g(this,"scrollModelKey","");g(this,"resizeObserver",null);g(this,"renderPending",!1);g(this,"animateNextRender",!0);g(this,"swipeGesture",new kM(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 wM);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=dm(e),s=LM(e.projectedLayout);if(r!==this.lastProjectedDragLayoutSignature||i!==this.lastDragDropIntent||s!==this.lastActivePlaceholderId){const u=um(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)<pi||(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"&&(CM(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=IM(e);Math.abs(r)<pi||(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(Y0(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(K0(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)<pi||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=zM(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)??Ln)+ae;if(s<=0)return;const o=e.clientX-r.startClientX,a=Nh(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(XO(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<fg&&a<fg)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)/pm;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>pi?Math.abs(o)/r:0,Math.abs(o)>pi&&(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)<pi||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:e}))}get scrollPosition(){return this._scrollPosition}focusArtifact(e){const r=br(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="${gm(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 OO({basis:Ie({x:Ln,y:Ln}),min:Ie({x:dg,y:dg}),viewport:Ie({x:e,y:r}),gap:Ie({x:ae,y:ae})})}syncScrollModel(){const e=Iu(this),i=br(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:fm}))}emitScrollPositionChanged(e){this.dispatchEvent(new RM(e))}emitLayoutChanged(){this.dispatchEvent(new Gw([...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()},TM)}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"&&be(a)===i);if(!s)return;const o=Nh(typeof s.width=="number"?s.width:Ve);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):um(this.dragState.projectedLayout)}applyResizeOverride(e){const r=this.resizeState;if(!r)return e;const i=e.findIndex(a=>a.type==="card"&&be(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
- ${sm(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
337
+ ${am(e.slots,i=>i.key,i=>this.renderSlot(i,r))}
338
338
  </div>
339
339
  </div>
340
- `}render(){var Y;const e=Au(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=br(i),a=o.nodes.map(j=>j.width),c=`${e.width}x${e.height}:${a.join(",")}`;!s&&c!==this.scrollModelKey&&(this.scrollModelKey=c,this.layoutScroll.rebuild({grid:r,nodeWidths:a.map(j=>Te({x:j})),snap:dm}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=zM(this._layout),h=r.unit.x??Ln,f=r.unit.y??Ln,y=s?this.dragTrackOffsetXPx:0,m=(this.layoutScroll.translate.x??0)+y,E=fm(o.nodes.length,r,e.height),x=this.animateNextRender&&!s,I=[`transform: translate(${m}px, ${E}px);`,`transition-duration: ${x?qA: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 j=m;for(let ce=0;ce<o.nodes.length;ce+=1){const Et=r.toPixels(Te({x:o.nodes[ce].width})).x??0,sr=j+Et;j>=-1&&sr<=e.width+1&&R.add(ce),j=sr+ae}}const V=j=>R.has(j),N=$M({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:V}),F=um(this.dragState);if(F?this.setAttribute("data-test-drop-intent",F):this.removeAttribute("data-test-drop-intent"),this.dragState){let j=null;for(const ce of o.nodes){for(const Et of ce.cards)if(Et.artifactID===this.dragState.nodeId){j={width:r.toPixels(Te({x:Et.width})).x??0,height:r.toPixels(Te({y:Et.height})).y??0};break}if(j)break}this.currentDragPreviewSize=j??{width:this.dragState.size.x??0,height:this.dragState.size.y??0}}else this.currentDragPreviewSize=null;Ze(L`
340
+ `}render(){var Y;const e=Iu(this),r=this.createGrid(e.width,e.height);this.layoutGrid=r;const i=this.getVisibleLayout(),s=this.dragController.status==="active",o=br(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:fm}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const u=DM(this._layout),h=r.unit.x??Ln,f=r.unit.y??Ln,y=s?this.dragTrackOffsetXPx:0,m=(this.layoutScroll.translate.x??0)+y,E=mm(o.nodes.length,r,e.height),x=this.animateNextRender&&!s,I=[`transform: translate(${m}px, ${E}px);`,`transition-duration: ${x?BA: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,sr=B+Et;B>=-1&&sr<=e.width+1&&R.add(ce),B=sr+ae}}const V=B=>R.has(B),N=EM({baseLayout:this._layout,visibleLayout:i,resolved:o,cardsByID:u,grid:r,dragState:this.dragState,isForeground:V}),F=dm(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;Ze(L`
341
341
  <div class="track" style=${I}>
342
- ${sm(N,j=>j.key,j=>this.renderNode(j,P))}
342
+ ${am(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(be(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===be(a),`layout-view: mount mismatch for ${be(a)}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${be(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*hm,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+Ma,o=r.left+r.width-Ma,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Ln,c=KA*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/Ma));return-(c*h**hg)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/Ma));return c*h**hg*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=br(e),o=new Map(s.nodes.map(E=>[E.id,E.width])),a=i.toPixels(Te({y:ft})).y??so,c=Au(this),u=(this.layoutScroll.translate.x??0)+r,h=fm(s.nodes.length,i,c.height),f=c.offsetY+h,y=[];let m=u;for(const E of e){const x=Pi(E),I=o.get(x)??Ve,P=i.toPixels(Te({x:I})).x??Vr,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="${pm(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?mm(e,c,this.layoutGrid):vm(e,c,this.layoutGrid),h=s?mm(r,c,this.layoutGrid):vm(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=gm(e),o=new Set(gm(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(Pi));for(const o of e){const a=Pi(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"&&be(o)!==r);return s?be(s):null}}function zM(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(be(e),e);continue}for(const r of e.children)if(r.type==="card")t.set(be(r),r);else for(const i of r.children)t.set(be(i),i)}return t}function OM(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 MM(n,t){const e=n.findIndex(r=>r.type==="card"&&be(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"&&be(s)===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function gm(n){const t=[];for(const e of n){if(e.type==="card"){t.push(be(e));continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(be(r))}}return t}function mm(n,t,e){if(!e)return null;const r=br(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&be(o)===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&be(u)===t))return s;const a=i.get(Pi(o))??Ve,c=e.toPixels(Te({x:a})).x??Vr;s+=c+ae}return null}function vm(n,t,e){if(!e)return null;const r=br(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(Pi(o)===t)return s;const a=i.get(Pi(o))??Ve,c=e.toPixels(Te({x:a})).x??Vr;s+=c+ae}return null}customElements.get("layout-view")||customElements.define("layout-view",LM);class NM 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 Fw&&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 Gw&&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){Ze(L``,this);return}Ze(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(be(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===be(a),`layout-view: mount mismatch for ${be(a)}`),c.parentElement!==u&&u.appendChild(c),console.assert(u.children.length<=1,`layout-view: multiple children for ${be(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*pm,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+Ma,o=r.left+r.width-Ma,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Ln,c=qA*a;if(e<s){const h=Math.max(0,Math.min(1,(s-e)/Ma));return-(c*h**pg)*i}if(e>o){const h=Math.max(0,Math.min(1,(e-o)/Ma));return c*h**pg*i}return 0}measureLayoutGeometry(e,r=0){const i=this.layoutGrid;if(!i)return[];const s=br(e),o=new Map(s.nodes.map(E=>[E.id,E.width])),a=i.toPixels(Te({y:ft})).y??so,c=Iu(this),u=(this.layoutScroll.translate.x??0)+r,h=mm(s.nodes.length,i,c.height),f=c.offsetY+h,y=[];let m=u;for(const E of e){const x=Pi(E),I=o.get(x)??Ve,P=i.toPixels(Te({x:I})).x??Vr,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="${gm(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?ym(e,c,this.layoutGrid):bm(e,c,this.layoutGrid),h=s?ym(r,c,this.layoutGrid):bm(r,c,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(e,r,i){const s=vm(e),o=new Set(vm(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(Pi));for(const o of e){const a=Pi(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"&&be(o)!==r);return s?be(s):null}}function DM(n){const t=new Map;for(const e of n){if(e.type==="card"){t.set(be(e),e);continue}for(const r of e.children)if(r.type==="card")t.set(be(r),r);else for(const i of r.children)t.set(be(i),i)}return t}function LM(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 zM(n,t){const e=n.findIndex(r=>r.type==="card"&&be(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"&&be(s)===t))return{topLevelIndex:r,sourceStackId:i.id}}return null}function vm(n){const t=[];for(const e of n){if(e.type==="card"){t.push(be(e));continue}if(e.type==="stack"){const r=e.children.find(i=>i.type==="card");r&&t.push(be(r))}}return t}function ym(n,t,e){if(!e)return null;const r=br(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&be(o)===t||o.type==="stack"&&o.children.some(u=>u.type==="card"&&be(u)===t))return s;const a=i.get(Pi(o))??Ve,c=e.toPixels(Te({x:a})).x??Vr;s+=c+ae}return null}function bm(n,t,e){if(!e)return null;const r=br(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(Pi(o)===t)return s;const a=i.get(Pi(o))??Ve,c=e.toPixels(Te({x:a})).x??Vr;s+=c+ae}return null}customElements.get("layout-view")||customElements.define("layout-view",PM);class OM 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 Fw&&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 Gw&&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){Ze(L``,this);return}Ze(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",NM);function Ml(n){return typeof n=="object"&&n!==null}const $u=new WeakMap,ym=Object.prototype.hasOwnProperty,UM=(()=>{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 FM(n,t){if(Ml(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 HM(n,t){return Ml(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var qo,Nh,Nr,gt,tn,Ji,Ur,Xi,xe,ki,qw,Yw,Kw,Jw,fl;const vr=class vr extends HTMLElement{constructor(){var i;super();S(this,xe);S(this,Nr,new Map);S(this,gt,new Map);S(this,tn,new Map);S(this,Ji,!1);S(this,Ur,!1);S(this,Xi,!1);const e=p(i=vr,qo,Nh).call(i,this.constructor),r=this;for(const s of e.properties)ym.call(r,s)&&(l(this,tn).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return p(e=vr,qo,Nh).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(p(this,xe,Jw).call(this),!l(this,Ur))for(const e of p(this,xe,ki).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,fl).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=p(this,xe,ki).call(this).byAttr.get(e);s&&(l(this,tn).has(s.property)||(this[s.property]=FM(s.type,i)))}};qo=new WeakSet,Nh=function(e){const r=$u.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(UM.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(Ml(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,Nr).get(u)},set(f){p(this,xe,qw).call(this,u,f)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return $u.set(e,c),c},Nr=new WeakMap,gt=new WeakMap,tn=new WeakMap,Ji=new WeakMap,Ur=new WeakMap,Xi=new WeakMap,xe=new WeakSet,ki=function(){return $u.get(this.constructor)},qw=function(e,r){if(!l(this,Xi)&&l(this,tn).has(e))return;const i=l(this,Nr).get(e);p(this,xe,Yw).call(this,e,i,r)||(l(this,gt).has(e)||l(this,gt).set(e,i),l(this,Nr).set(e,r),l(this,tn).delete(e),p(this,xe,Kw).call(this,e,r),this.isConnected&&p(this,xe,fl).call(this))},Yw=function(e,r,i){if(Object.is(r,i))return!0;const s=p(this,xe,ki).call(this).byProp.get(e);if(!s||!Ml(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}},Kw=function(e,r){const i=p(this,xe,ki).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=HM(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},Jw=function(){const e=this,r=p(this,xe,ki).call(this);for(const i of r.properties){if(!ym.call(e,i))continue;const s=e[i];delete e[i],!(l(this,tn).has(i)||l(this,Nr).has(i))&&(e[i]=s)}w(this,Xi,!0);try{for(const[i,s]of l(this,tn))e[i]=s;l(this,tn).clear()}finally{w(this,Xi,!1)}},fl=function(){l(this,Ji)||!this.isConnected||l(this,Ur)&&l(this,gt).size===0||(w(this,Ji,!0),queueMicrotask(()=>{if(w(this,Ji,!1),!this.isConnected||l(this,Ur)&&l(this,gt).size===0)return;const e=new Map(l(this,gt));l(this,gt).clear(),w(this,Ur,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,gt).size>0&&p(this,xe,fl).call(this)}))},S(vr,qo),g(vr,"properties"),g(vr,"attributes");let hs=vr;var pe,Vn,Bn,Qi,es,xn,Yo,$e,ts,nn,Z,Xw,Ko,Jo,Xo,Qo,Uh,Fh,Hh,Qw,e0,t0,n0,Gl,ql,Yl,Kl,Zh,r0,gl,Jl,ml,Xl,i0,s0,o0,a0,l0,dt;class ZM extends hs{constructor(){super(...arguments);S(this,Z);S(this,pe,un.resolve("ScreenManager"));S(this,Vn,un.resolve("ServerManager"));S(this,Bn,null);S(this,Qi,new DisposableStack);S(this,es,cl());S(this,xn,cl());S(this,Yo,cl());S(this,$e,{kind:"none"});S(this,ts,!1);S(this,nn,[]);S(this,Ko,()=>{p(this,Z,Uh).call(this),w(this,$e,{kind:"none"}),l(this,dt).call(this)});S(this,Jo,()=>{l(this,dt).call(this)});S(this,Xo,()=>{l(this,dt).call(this)});S(this,Qo,()=>{l(this,dt).call(this)});S(this,Gl,()=>{var i,s;if(l(this,$e).kind==="picker"){p(this,Z,ml).call(this);return}w(this,nn,p(this,Z,r0).call(this));const e=((i=l(this,pe).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,Yo).value)==null||o.focus()})});S(this,ql,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,gl).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,Yl,e=>{var s;const r=l(this,$e);if(r.kind!=="picker")return;if(e.key==="Escape"){e.preventDefault(),p(this,Z,ml).call(this),(s=l(this,es).value)==null||s.focus();return}const i=p(this,Z,gl).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,Zh).call(this,o)}});S(this,Kl,e=>{p(this,Z,Zh).call(this,e)});S(this,Jl,e=>{l(this,$e).kind==="picker"&&e.target===l(this,xn).value&&(w(this,$e,{kind:"none"}),l(this,dt).call(this))});S(this,Xl,async()=>{if(l(this,ts))return;const e=p(this,Z,i0).call(this);if(e){w(this,ts,!0);try{const r=await e.createScreen(WM(new Date));l(this,pe).addTab(e.url,r.id),l(this,pe).setActive(e.url,r.id)}catch{}finally{w(this,ts,!1)}}});S(this,dt,()=>{const e=p(this,Z,t0).call(this);Ze(L`
353
+ `,this)}}customElements.define("screen-view",OM);function Ml(n){return typeof n=="object"&&n!==null}const Cu=new WeakMap,wm=Object.prototype.hasOwnProperty,MM=(()=>{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 NM(n,t){if(Ml(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 UM(n,t){return Ml(n)?t==null?null:n.serialize(t):n===Boolean?t?"":null:t==null?null:String(t)}var qo,Hh,Nr,gt,tn,Ji,Ur,Xi,xe,ki,qw,Yw,Kw,Jw,fl;const vr=class vr extends HTMLElement{constructor(){var i;super();S(this,xe);S(this,Nr,new Map);S(this,gt,new Map);S(this,tn,new Map);S(this,Ji,!1);S(this,Ur,!1);S(this,Xi,!1);const e=p(i=vr,qo,Hh).call(i,this.constructor),r=this;for(const s of e.properties)wm.call(r,s)&&(l(this,tn).set(s,r[s]),delete r[s])}static get observedAttributes(){var e;return p(e=vr,qo,Hh).call(e,this).observedAttributes}connected(){}disconnected(){}changed(e){}connectedCallback(){if(p(this,xe,Jw).call(this),!l(this,Ur))for(const e of p(this,xe,ki).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,fl).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(e,r,i){if(r===i)return;const s=p(this,xe,ki).call(this).byAttr.get(e);s&&(l(this,tn).has(s.property)||(this[s.property]=NM(s.type,i)))}};qo=new WeakSet,Hh=function(e){const r=Cu.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(MM.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(Ml(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,Nr).get(u)},set(f){p(this,xe,qw).call(this,u,f)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return Cu.set(e,c),c},Nr=new WeakMap,gt=new WeakMap,tn=new WeakMap,Ji=new WeakMap,Ur=new WeakMap,Xi=new WeakMap,xe=new WeakSet,ki=function(){return Cu.get(this.constructor)},qw=function(e,r){if(!l(this,Xi)&&l(this,tn).has(e))return;const i=l(this,Nr).get(e);p(this,xe,Yw).call(this,e,i,r)||(l(this,gt).has(e)||l(this,gt).set(e,i),l(this,Nr).set(e,r),l(this,tn).delete(e),p(this,xe,Kw).call(this,e,r),this.isConnected&&p(this,xe,fl).call(this))},Yw=function(e,r,i){if(Object.is(r,i))return!0;const s=p(this,xe,ki).call(this).byProp.get(e);if(!s||!Ml(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}},Kw=function(e,r){const i=p(this,xe,ki).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=UM(o,r);if(a===null){this.hasAttribute(s)&&this.removeAttribute(s);return}this.getAttribute(s)!==a&&this.setAttribute(s,a)},Jw=function(){const e=this,r=p(this,xe,ki).call(this);for(const i of r.properties){if(!wm.call(e,i))continue;const s=e[i];delete e[i],!(l(this,tn).has(i)||l(this,Nr).has(i))&&(e[i]=s)}w(this,Xi,!0);try{for(const[i,s]of l(this,tn))e[i]=s;l(this,tn).clear()}finally{w(this,Xi,!1)}},fl=function(){l(this,Ji)||!this.isConnected||l(this,Ur)&&l(this,gt).size===0||(w(this,Ji,!0),queueMicrotask(()=>{if(w(this,Ji,!1),!this.isConnected||l(this,Ur)&&l(this,gt).size===0)return;const e=new Map(l(this,gt));l(this,gt).clear(),w(this,Ur,!0);try{this.changed(e)}catch(r){console.error(r)}this.isConnected&&l(this,gt).size>0&&p(this,xe,fl).call(this)}))},S(vr,qo),g(vr,"properties"),g(vr,"attributes");let hs=vr;var pe,Vn,jn,Qi,es,xn,Yo,$e,ts,nn,Z,Xw,Ko,Jo,Xo,Qo,Zh,Wh,Vh,Qw,e0,t0,n0,Gl,ql,Yl,Kl,jh,r0,gl,Jl,ml,Xl,i0,s0,o0,a0,l0,dt;class FM extends hs{constructor(){super(...arguments);S(this,Z);S(this,pe,un.resolve("ScreenManager"));S(this,Vn,un.resolve("ServerManager"));S(this,jn,null);S(this,Qi,new DisposableStack);S(this,es,cl());S(this,xn,cl());S(this,Yo,cl());S(this,$e,{kind:"none"});S(this,ts,!1);S(this,nn,[]);S(this,Ko,()=>{p(this,Z,Zh).call(this),w(this,$e,{kind:"none"}),l(this,dt).call(this)});S(this,Jo,()=>{l(this,dt).call(this)});S(this,Xo,()=>{l(this,dt).call(this)});S(this,Qo,()=>{l(this,dt).call(this)});S(this,Gl,()=>{var i,s;if(l(this,$e).kind==="picker"){p(this,Z,ml).call(this);return}w(this,nn,p(this,Z,r0).call(this));const e=((i=l(this,pe).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,Yo).value)==null||o.focus()})});S(this,ql,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,gl).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,Yl,e=>{var s;const r=l(this,$e);if(r.kind!=="picker")return;if(e.key==="Escape"){e.preventDefault(),p(this,Z,ml).call(this),(s=l(this,es).value)==null||s.focus();return}const i=p(this,Z,gl).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,jh).call(this,o)}});S(this,Kl,e=>{p(this,Z,jh).call(this,e)});S(this,Jl,e=>{l(this,$e).kind==="picker"&&e.target===l(this,xn).value&&(w(this,$e,{kind:"none"}),l(this,dt).call(this))});S(this,Xl,async()=>{if(l(this,ts))return;const e=p(this,Z,i0).call(this);if(e){w(this,ts,!0);try{const r=await e.createScreen(HM(new Date));l(this,pe).addTab(e.url,r.id),l(this,pe).setActive(e.url,r.id)}catch{}finally{w(this,ts,!1)}}});S(this,dt,()=>{const e=p(this,Z,t0).call(this);Ze(L`
354
354
  ${p(this,Z,s0).call(this)}
355
355
  <div class="pills" role="group" aria-label="Open tabs">
356
356
  ${e.map(r=>p(this,Z,o0).call(this,r))}
357
357
  </div>
358
358
  ${p(this,Z,a0).call(this)}
359
- `,this),l(this,xn).value&&(l(this,xn).value.anchor=l(this,es).value??null)})}connected(){l(this,pe).addEventListener("active-screen-changed",l(this,Ko)),l(this,pe).addEventListener("tabs-changed",l(this,Jo)),l(this,Vn).addEventListener("screens-changed",l(this,Xo)),p(this,Z,Uh).call(this),l(this,dt).call(this),p(this,Z,Xw).call(this),l(this,Qi).defer(()=>{l(this,pe).removeEventListener("active-screen-changed",l(this,Ko)),l(this,pe).removeEventListener("tabs-changed",l(this,Jo)),l(this,Vn).removeEventListener("screens-changed",l(this,Xo)),p(this,Z,Fh).call(this)})}disconnected(){l(this,Qi).dispose(),w(this,Qi,new DisposableStack)}}pe=new WeakMap,Vn=new WeakMap,Bn=new WeakMap,Qi=new WeakMap,es=new WeakMap,xn=new WeakMap,Yo=new WeakMap,$e=new WeakMap,ts=new WeakMap,nn=new WeakMap,Z=new WeakSet,Xw=async function(){const e=await Fv(this);this.setAttribute("tone",e)},Ko=new WeakMap,Jo=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,Uh=function(){var r;const e=l(this,pe).activeScreen;l(this,Bn)!==e&&(p(this,Z,Fh).call(this),w(this,Bn,e),(r=l(this,Bn))==null||r.addEventListener("change",l(this,Qo)))},Fh=function(){var e;(e=l(this,Bn))==null||e.removeEventListener("change",l(this,Qo)),w(this,Bn,null)},Hh=function(e,r){l(this,pe).setActive(e,r)},Qw=function(e,r,i){i.stopPropagation();const s=l(this,pe).getTabs(e),o=p(this,Z,n0).call(this,s,r),a=l(this,pe).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,pe).removeTab(e,r),c&&(o?l(this,pe).setActive(e,o):l(this,pe).clearActive())},e0=function(e,r,i){const s=l(this,pe).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,Vn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},t0=function(){const e=l(this,pe).activeScreen,r=[];for(const i of l(this,Vn).servers.values())for(const s of l(this,pe).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},n0=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},Gl=new WeakMap,ql=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,Zh=function(e){l(this,pe).addTab(e.serverURL,e.screenID),l(this,pe).setActive(e.serverURL,e.screenID),p(this,Z,ml).call(this)},r0=function(){return l(this,pe).screens.map(e=>({serverURL:e.server.url,screenID:e.screen.id,name:e.screen.name}))},gl=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},Jl=new WeakMap,ml=function(){l(this,$e).kind==="picker"&&(l(this,xn).value&&(l(this,xn).value.open=!1),w(this,$e,{kind:"none"}),l(this,dt).call(this))},Xl=new WeakMap,i0=function(){for(const e of l(this,Vn).servers.values())return e;return null},s0=function(){return L`
359
+ `,this),l(this,xn).value&&(l(this,xn).value.anchor=l(this,es).value??null)})}connected(){l(this,pe).addEventListener("active-screen-changed",l(this,Ko)),l(this,pe).addEventListener("tabs-changed",l(this,Jo)),l(this,Vn).addEventListener("screens-changed",l(this,Xo)),p(this,Z,Zh).call(this),l(this,dt).call(this),p(this,Z,Xw).call(this),l(this,Qi).defer(()=>{l(this,pe).removeEventListener("active-screen-changed",l(this,Ko)),l(this,pe).removeEventListener("tabs-changed",l(this,Jo)),l(this,Vn).removeEventListener("screens-changed",l(this,Xo)),p(this,Z,Wh).call(this)})}disconnected(){l(this,Qi).dispose(),w(this,Qi,new DisposableStack)}}pe=new WeakMap,Vn=new WeakMap,jn=new WeakMap,Qi=new WeakMap,es=new WeakMap,xn=new WeakMap,Yo=new WeakMap,$e=new WeakMap,ts=new WeakMap,nn=new WeakMap,Z=new WeakSet,Xw=async function(){const e=await Fv(this);this.setAttribute("tone",e)},Ko=new WeakMap,Jo=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,Zh=function(){var r;const e=l(this,pe).activeScreen;l(this,jn)!==e&&(p(this,Z,Wh).call(this),w(this,jn,e),(r=l(this,jn))==null||r.addEventListener("change",l(this,Qo)))},Wh=function(){var e;(e=l(this,jn))==null||e.removeEventListener("change",l(this,Qo)),w(this,jn,null)},Vh=function(e,r){l(this,pe).setActive(e,r)},Qw=function(e,r,i){i.stopPropagation();const s=l(this,pe).getTabs(e),o=p(this,Z,n0).call(this,s,r),a=l(this,pe).activeScreen,c=(a==null?void 0:a.id)===r&&a.server.url===e;l(this,pe).removeTab(e,r),c&&(o?l(this,pe).setActive(e,o):l(this,pe).clearActive())},e0=function(e,r,i){const s=l(this,pe).activeScreen;if((s==null?void 0:s.id)===r){s.rename(i.value);return}const o=l(this,Vn).servers.get(e),a=o==null?void 0:o.screens.get(r);!o||!a||o.client.screens.update({screenID:r,name:i.value}).catch(()=>{})},t0=function(){const e=l(this,pe).activeScreen,r=[];for(const i of l(this,Vn).servers.values())for(const s of l(this,pe).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},n0=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},Gl=new WeakMap,ql=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,jh=function(e){l(this,pe).addTab(e.serverURL,e.screenID),l(this,pe).setActive(e.serverURL,e.screenID),p(this,Z,ml).call(this)},r0=function(){return l(this,pe).screens.map(e=>({serverURL:e.server.url,screenID:e.screen.id,name:e.screen.name}))},gl=function(e,r){const i=r.trim().toLowerCase();return i.length===0?e:e.filter(s=>s.name.toLowerCase().includes(i))},Jl=new WeakMap,ml=function(){l(this,$e).kind==="picker"&&(l(this,xn).value&&(l(this,xn).value.open=!1),w(this,$e,{kind:"none"}),l(this,dt).call(this))},Xl=new WeakMap,i0=function(){for(const e of l(this,Vn).servers.values())return e;return null},s0=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,Gl)}
366
366
  ${ul(l(this,es))}
367
367
  >
368
- ${fO({size:16,weight:"regular"})}
368
+ ${dO({size:16,weight:"regular"})}
369
369
  </button>
370
370
  <button
371
371
  type="button"
@@ -373,7 +373,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
373
373
  aria-label="New screen"
374
374
  @click=${l(this,Xl)}
375
375
  >
376
- ${gO({size:16,weight:"regular"})}
376
+ ${pO({size:16,weight:"regular"})}
377
377
  </button>
378
378
  </segmented-control>
379
379
  `},o0=function(e){return L`
@@ -385,11 +385,11 @@ 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,Hh).call(this,e.serverURL,e.screenID)}}
389
- @click=${()=>p(this,Z,Hh).call(this,e.serverURL,e.screenID)}
388
+ @mousedown=${r=>{r.button===0&&p(this,Z,Vh).call(this,e.serverURL,e.screenID)}}
389
+ @click=${()=>p(this,Z,Vh).call(this,e.serverURL,e.screenID)}
390
390
  >
391
391
  <span class="tab-leading">
392
- ${dO({weight:"bold"})}
392
+ ${uO({weight:"bold"})}
393
393
  </span>
394
394
  <editable-text
395
395
  class="tab-name"
@@ -406,7 +406,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
406
406
  aria-label=${`Close ${e.name}`}
407
407
  @click=${r=>p(this,Z,Qw).call(this,e.serverURL,e.screenID,r)}
408
408
  >
409
- ${jd({weight:"bold"})}
409
+ ${Yd({weight:"bold"})}
410
410
  </button>
411
411
  </span>
412
412
  `},a0=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,pe).activeScreen)==null?void 0:o.id)??null,s=p(this,Z,gl).call(this,l(this,nn),e);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",ZM);function WM(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:c0,setPrototypeOf:bm,isFrozen:VM,getPrototypeOf:BM,getOwnPropertyDescriptor:jM}=Object;let{freeze:et,seal:St,create:vl}=Object,{apply:Wh,construct:Vh}=typeof Reflect<"u"&&Reflect;et||(et=function(t){return t});St||(St=function(t){return t});Wh||(Wh=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)});Vh||(Vh=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 Wa=tt(Array.prototype.forEach),GM=tt(Array.prototype.lastIndexOf),wm=tt(Array.prototype.pop),Ds=tt(Array.prototype.push),qM=tt(Array.prototype.splice),yl=tt(String.prototype.toLowerCase),Tu=tt(String.prototype.toString),Iu=tt(String.prototype.match),Ls=tt(String.prototype.replace),YM=tt(String.prototype.indexOf),KM=tt(String.prototype.trim),ut=tt(Object.prototype.hasOwnProperty),je=tt(RegExp.prototype.test),zs=JM(TypeError);function tt(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 Wh(n,t,r)}}function JM(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Vh(n,e)}}function G(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yl;bm&&bm(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(VM(t)||(t[r]=s),i=s)}n[i]=!0}return n}function XM(n){for(let t=0;t<n.length;t++)ut(n,t)||(n[t]=null);return n}function Zt(n){const t=vl(null);for(const[e,r]of c0(n))ut(n,e)&&(Array.isArray(r)?t[e]=XM(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Zt(r):t[e]=r);return t}function Os(n,t){for(;n!==null;){const r=jM(n,t);if(r){if(r.get)return tt(r.get);if(typeof r.value=="function")return tt(r.value)}n=BM(n)}function e(){return null}return e}const Sm=et(["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"]),Cu=et(["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"]),Ru=et(["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"]),QM=et(["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"]),Pu=et(["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"]),eN=et(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_m=et(["#text"]),km=et(["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"]),Du=et(["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"]),xm=et(["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"]),Va=et(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tN=St(/\{\{[\w\W]*|[\w\W]*\}\}/gm),nN=St(/<%[\w\W]*|[\w\W]*%>/gm),rN=St(/\$\{[\w\W]*/gm),iN=St(/^data-[\-\w.\u00B7-\uFFFF]+$/),sN=St(/^aria-[\-\w]+$/),u0=St(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),oN=St(/^(?:\w+script|data):/i),aN=St(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),h0=St(/^html$/i),lN=St(/^[a-z][.\w]*(-[.\w]+)+$/i);var Em=Object.freeze({__proto__:null,ARIA_ATTR:sN,ATTR_WHITESPACE:aN,CUSTOM_ELEMENT:lN,DATA_ATTR:iN,DOCTYPE_NAME:h0,ERB_EXPR:nN,IS_ALLOWED_URI:u0,IS_SCRIPT_OR_DATA:oN,MUSTACHE_EXPR:tN,TMPLIT_EXPR:rN});const Ms={element:1,text:3,progressingInstruction:7,comment:8,document:9},cN=function(){return typeof window>"u"?null:window},uN=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}},Am=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function d0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cN();const t=U=>d0(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==Ms.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=Os(E,"cloneNode"),I=Os(E,"remove"),P=Os(E,"nextSibling"),R=Os(E,"childNodes"),V=Os(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:j,createDocumentFragment:ce,getElementsByTagName:Et}=e,{importNode:sr}=r;let ze=Am();t.isSupported=typeof c0=="function"&&typeof V=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:or,ERB_EXPR:Mt,TMPLIT_EXPR:Cn,DATA_ATTR:Ec,ARIA_ATTR:wa,IS_SCRIPT_OR_DATA:D0,ATTR_WHITESPACE:op,CUSTOM_ELEMENT:L0}=Em;let{IS_ALLOWED_URI:ap}=Em,Re=null;const lp=G({},[...Sm,...Cu,...Ru,...Pu,..._m]);let Oe=null;const cp=G({},[...km,...Du,...xm,...Va]);let we=Object.seal(vl(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}})),xs=null,Sa=null;const Rn=Object.seal(vl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let up=!0,Ac=!0,hp=!1,dp=!0,ti=!1,_a=!0,ar=!1,$c=!1,Tc=!1,ni=!1,ka=!1,xa=!1,pp=!0,fp=!1;const z0="user-content-";let Ic=!0,Es=!1,ri={},Nt=null;const Cc=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 gp=null;const mp=G({},["audio","video","img","source","image","track"]);let Rc=null;const vp=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ea="http://www.w3.org/1998/Math/MathML",Aa="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml";let ii=hn,Pc=!1,Dc=null;const O0=G({},[Ea,Aa,hn],Tu);let $a=G({},["mi","mo","mn","ms","mtext"]),Ta=G({},["annotation-xml"]);const M0=G({},["title","style","font","a","script"]);let As=null;const N0=["application/xhtml+xml","text/html"],U0="text/html";let Ae=null,si=null;const F0=e.createElement("form"),yp=function(b){return b instanceof RegExp||b instanceof Function},Lc=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(si&&si===b)){if((!b||typeof b!="object")&&(b={}),b=Zt(b),As=N0.indexOf(b.PARSER_MEDIA_TYPE)===-1?U0:b.PARSER_MEDIA_TYPE,Ae=As==="application/xhtml+xml"?Tu:yl,Re=ut(b,"ALLOWED_TAGS")?G({},b.ALLOWED_TAGS,Ae):lp,Oe=ut(b,"ALLOWED_ATTR")?G({},b.ALLOWED_ATTR,Ae):cp,Dc=ut(b,"ALLOWED_NAMESPACES")?G({},b.ALLOWED_NAMESPACES,Tu):O0,Rc=ut(b,"ADD_URI_SAFE_ATTR")?G(Zt(vp),b.ADD_URI_SAFE_ATTR,Ae):vp,gp=ut(b,"ADD_DATA_URI_TAGS")?G(Zt(mp),b.ADD_DATA_URI_TAGS,Ae):mp,Nt=ut(b,"FORBID_CONTENTS")?G({},b.FORBID_CONTENTS,Ae):Cc,xs=ut(b,"FORBID_TAGS")?G({},b.FORBID_TAGS,Ae):Zt({}),Sa=ut(b,"FORBID_ATTR")?G({},b.FORBID_ATTR,Ae):Zt({}),ri=ut(b,"USE_PROFILES")?b.USE_PROFILES:!1,up=b.ALLOW_ARIA_ATTR!==!1,Ac=b.ALLOW_DATA_ATTR!==!1,hp=b.ALLOW_UNKNOWN_PROTOCOLS||!1,dp=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ti=b.SAFE_FOR_TEMPLATES||!1,_a=b.SAFE_FOR_XML!==!1,ar=b.WHOLE_DOCUMENT||!1,ni=b.RETURN_DOM||!1,ka=b.RETURN_DOM_FRAGMENT||!1,xa=b.RETURN_TRUSTED_TYPE||!1,Tc=b.FORCE_BODY||!1,pp=b.SANITIZE_DOM!==!1,fp=b.SANITIZE_NAMED_PROPS||!1,Ic=b.KEEP_CONTENT!==!1,Es=b.IN_PLACE||!1,ap=b.ALLOWED_URI_REGEXP||u0,ii=b.NAMESPACE||hn,$a=b.MATHML_TEXT_INTEGRATION_POINTS||$a,Ta=b.HTML_INTEGRATION_POINTS||Ta,we=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&yp(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(we.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&yp(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(we.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(we.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ti&&(Ac=!1),ka&&(ni=!0),ri&&(Re=G({},_m),Oe=vl(null),ri.html===!0&&(G(Re,Sm),G(Oe,km)),ri.svg===!0&&(G(Re,Cu),G(Oe,Du),G(Oe,Va)),ri.svgFilters===!0&&(G(Re,Ru),G(Oe,Du),G(Oe,Va)),ri.mathMl===!0&&(G(Re,Pu),G(Oe,xm),G(Oe,Va))),ut(b,"ADD_TAGS")||(Rn.tagCheck=null),ut(b,"ADD_ATTR")||(Rn.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?Rn.tagCheck=b.ADD_TAGS:(Re===lp&&(Re=Zt(Re)),G(Re,b.ADD_TAGS,Ae))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?Rn.attributeCheck=b.ADD_ATTR:(Oe===cp&&(Oe=Zt(Oe)),G(Oe,b.ADD_ATTR,Ae))),b.ADD_URI_SAFE_ATTR&&G(Rc,b.ADD_URI_SAFE_ATTR,Ae),b.FORBID_CONTENTS&&(Nt===Cc&&(Nt=Zt(Nt)),G(Nt,b.FORBID_CONTENTS,Ae)),b.ADD_FORBID_CONTENTS&&(Nt===Cc&&(Nt=Zt(Nt)),G(Nt,b.ADD_FORBID_CONTENTS,Ae)),Ic&&(Re["#text"]=!0),ar&&G(Re,["html","head","body"]),Re.table&&(G(Re,["tbody"]),delete xs.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw zs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=b.TRUSTED_TYPES_POLICY,F=N.createHTML("")}else N===void 0&&(N=uN(m,i)),N!==null&&typeof F=="string"&&(F=N.createHTML(""));et&&et(b),si=b}},bp=G({},[...Cu,...Ru,...QM]),wp=G({},[...Pu,...eN]),H0=function(b){let C=V(b);(!C||!C.tagName)&&(C={namespaceURI:ii,tagName:"template"});const D=yl(b.tagName),he=yl(C.tagName);return Dc[b.namespaceURI]?b.namespaceURI===Aa?C.namespaceURI===hn?D==="svg":C.namespaceURI===Ea?D==="svg"&&(he==="annotation-xml"||$a[he]):!!bp[D]:b.namespaceURI===Ea?C.namespaceURI===hn?D==="math":C.namespaceURI===Aa?D==="math"&&Ta[he]:!!wp[D]:b.namespaceURI===hn?C.namespaceURI===Aa&&!Ta[he]||C.namespaceURI===Ea&&!$a[he]?!1:!wp[D]&&(M0[D]||!bp[D]):!!(As==="application/xhtml+xml"&&Dc[b.namespaceURI]):!1},Ut=function(b){Ds(t.removed,{element:b});try{V(b).removeChild(b)}catch{I(b)}},lr=function(b,C){try{Ds(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{Ds(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(ni||ka)try{Ut(C)}catch{}else try{C.setAttribute(b,"")}catch{}},Sp=function(b){let C=null,D=null;if(Tc)b="<remove></remove>"+b;else{const Se=Iu(b,/^[\r\n\t ]+/);D=Se&&Se[0]}As==="application/xhtml+xml"&&ii===hn&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const he=N?N.createHTML(b):b;if(ii===hn)try{C=new y().parseFromString(he,As)}catch{}if(!C||!C.documentElement){C=Y.createDocument(ii,"template",null);try{C.documentElement.innerHTML=Pc?F:he}catch{}}const We=C.body||C.documentElement;return b&&D&&We.insertBefore(e.createTextNode(D),We.childNodes[0]||null),ii===hn?Et.call(C,ar?"html":"body")[0]:ar?C.documentElement:We},_p=function(b){return j.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},zc=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")},kp=function(b){return typeof a=="function"&&b instanceof a};function dn(U,b,C){Wa(U,D=>{D.call(t,b,C,si)})}const xp=function(b){let C=null;if(dn(ze.beforeSanitizeElements,b,null),zc(b))return Ut(b),!0;const D=Ae(b.nodeName);if(dn(ze.uponSanitizeElement,b,{tagName:D,allowedTags:Re}),_a&&b.hasChildNodes()&&!kp(b.firstElementChild)&&je(/<[/\w!]/g,b.innerHTML)&&je(/<[/\w!]/g,b.textContent)||b.nodeType===Ms.progressingInstruction||_a&&b.nodeType===Ms.comment&&je(/<[/\w]/g,b.data))return Ut(b),!0;if(!(Rn.tagCheck instanceof Function&&Rn.tagCheck(D))&&(!Re[D]||xs[D])){if(!xs[D]&&Ap(D)&&(we.tagNameCheck instanceof RegExp&&je(we.tagNameCheck,D)||we.tagNameCheck instanceof Function&&we.tagNameCheck(D)))return!1;if(Ic&&!Nt[D]){const he=V(b)||b.parentNode,We=R(b)||b.childNodes;if(We&&he){const Se=We.length;for(let nt=Se-1;nt>=0;--nt){const pn=x(We[nt],!0);pn.__removalCount=(b.__removalCount||0)+1,he.insertBefore(pn,P(b))}}}return Ut(b),!0}return b instanceof c&&!H0(b)||(D==="noscript"||D==="noembed"||D==="noframes")&&je(/<\/no(script|embed|frames)/i,b.innerHTML)?(Ut(b),!0):(ti&&b.nodeType===Ms.text&&(C=b.textContent,Wa([or,Mt,Cn],he=>{C=Ls(C,he," ")}),b.textContent!==C&&(Ds(t.removed,{element:b.cloneNode()}),b.textContent=C)),dn(ze.afterSanitizeElements,b,null),!1)},Ep=function(b,C,D){if(Sa[C]||pp&&(C==="id"||C==="name")&&(D in e||D in F0))return!1;if(!(Ac&&!Sa[C]&&je(Ec,C))){if(!(up&&je(wa,C))){if(!(Rn.attributeCheck instanceof Function&&Rn.attributeCheck(C,b))){if(!Oe[C]||Sa[C]){if(!(Ap(b)&&(we.tagNameCheck instanceof RegExp&&je(we.tagNameCheck,b)||we.tagNameCheck instanceof Function&&we.tagNameCheck(b))&&(we.attributeNameCheck instanceof RegExp&&je(we.attributeNameCheck,C)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(C,b))||C==="is"&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&je(we.tagNameCheck,D)||we.tagNameCheck instanceof Function&&we.tagNameCheck(D))))return!1}else if(!Rc[C]){if(!je(ap,Ls(D,op,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&YM(D,"data:")===0&&gp[b])){if(!(hp&&!je(D0,Ls(D,op,"")))){if(D)return!1}}}}}}}return!0},Ap=function(b){return b!=="annotation-xml"&&Iu(b,L0)},$p=function(b){dn(ze.beforeSanitizeAttributes,b,null);const{attributes:C}=b;if(!C||zc(b))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Oe,forceKeepAttr:void 0};let he=C.length;for(;he--;){const We=C[he],{name:Se,namespaceURI:nt,value:pn}=We,oi=Ae(Se),Oc=pn;let Me=Se==="value"?Oc:KM(Oc);if(D.attrName=oi,D.attrValue=Me,D.keepAttr=!0,D.forceKeepAttr=void 0,dn(ze.uponSanitizeAttribute,b,D),Me=D.attrValue,fp&&(oi==="id"||oi==="name")&&(lr(Se,b),Me=z0+Me),_a&&je(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Me)){lr(Se,b);continue}if(oi==="attributename"&&Iu(Me,"href")){lr(Se,b);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){lr(Se,b);continue}if(!dp&&je(/\/>/i,Me)){lr(Se,b);continue}ti&&Wa([or,Mt,Cn],Ip=>{Me=Ls(Me,Ip," ")});const Tp=Ae(b.nodeName);if(!Ep(Tp,oi,Me)){lr(Se,b);continue}if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!nt)switch(m.getAttributeType(Tp,oi)){case"TrustedHTML":{Me=N.createHTML(Me);break}case"TrustedScriptURL":{Me=N.createScriptURL(Me);break}}if(Me!==Oc)try{nt?b.setAttributeNS(nt,Se,Me):b.setAttribute(Se,Me),zc(b)?Ut(b):wm(t.removed)}catch{lr(Se,b)}}dn(ze.afterSanitizeAttributes,b,null)},Z0=function U(b){let C=null;const D=_p(b);for(dn(ze.beforeSanitizeShadowDOM,b,null);C=D.nextNode();)dn(ze.uponSanitizeShadowNode,C,null),xp(C),$p(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,he=null,We=null;if(Pc=!U,Pc&&(U="<!-->"),typeof U!="string"&&!kp(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw zs("dirty is not a string, aborting")}else throw zs("toString is not a function");if(!t.isSupported)return U;if($c||Lc(b),t.removed=[],typeof U=="string"&&(Es=!1),Es){if(U.nodeName){const pn=Ae(U.nodeName);if(!Re[pn]||xs[pn])throw zs("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)C=Sp("<!---->"),D=C.ownerDocument.importNode(U,!0),D.nodeType===Ms.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?C=D:C.appendChild(D);else{if(!ni&&!ti&&!ar&&U.indexOf("<")===-1)return N&&xa?N.createHTML(U):U;if(C=Sp(U),!C)return ni?null:xa?F:""}C&&Tc&&Ut(C.firstChild);const Se=_p(Es?U:C);for(;he=Se.nextNode();)xp(he),$p(he),he.content instanceof s&&Z0(he.content);if(Es)return U;if(ni){if(ka)for(We=ce.call(C.ownerDocument);C.firstChild;)We.appendChild(C.firstChild);else We=C;return(Oe.shadowroot||Oe.shadowrootmode)&&(We=sr.call(r,We,!0)),We}let nt=ar?C.outerHTML:C.innerHTML;return ar&&Re["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&je(h0,C.ownerDocument.doctype.name)&&(nt="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
454
- `+nt),ti&&Wa([or,Mt,Cn],pn=>{nt=Ls(nt,pn," ")}),N&&xa?N.createHTML(nt):nt},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Lc(U),$c=!0},t.clearConfig=function(){si=null,$c=!1},t.isValidAttribute=function(U,b,C){si||Lc({});const D=Ae(U),he=Ae(b);return Ep(D,he,C)},t.addHook=function(U,b){typeof b=="function"&&Ds(ze[U],b)},t.removeHook=function(U,b){if(b!==void 0){const C=GM(ze[U],b);return C===-1?void 0:qM(ze[U],C,1)[0]}return wm(ze[U])},t.removeHooks=function(U){ze[U]=[]},t.removeAllHooks=function(){ze=Am()},t}var p0=d0();function qd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ei=qd();function f0(n){ei=n}var mr={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(Qe.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var hN=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Qe={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)}}>`)},dN=/^(?:[ \t]*(?:\n|$))+/,pN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ba=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Yd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,g0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,m0=J(g0).replace(/bull/g,Yd).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(),mN=J(g0).replace(/bull/g,Yd).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(),Kd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,vN=/^[^\n]+/,Jd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,yN=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Jd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bN=J(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Yd).getRegex(),kc="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",Xd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,wN=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",Xd).replace("tag",kc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),v0=J(Kd).replace("hr",ba).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",kc).getRegex(),SN=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",v0).getRegex(),Qd={blockquote:SN,code:pN,def:yN,fences:fN,heading:gN,hr:ba,html:wN,lheading:m0,list:bN,newline:dN,paragraph:v0,table:mr,text:vN},$m=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ba).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",kc).getRegex(),_N={...Qd,lheading:mN,table:$m,paragraph:J(Kd).replace("hr",ba).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$m).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",kc).getRegex()},kN={...Qd,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Xd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(Kd).replace("hr",ba).replace("heading",` *#{1,6} *[^
455
- ]`).replace("lheading",m0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,EN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,y0=/^( {2,}|\\)\n(?!\s*$)/,AN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ks=/[\p{P}\p{S}]/u,xc=/[\s\p{P}\p{S}]/u,ep=/[^\s\p{P}\p{S}]/u,$N=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xc).getRegex(),b0=/(?!~)[\p{P}\p{S}]/u,TN=/(?!~)[\s\p{P}\p{S}]/u,IN=/(?:[^\s\p{P}\p{S}]|~)/u,CN=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",hN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),w0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,RN=J(w0,"u").replace(/punct/g,ks).getRegex(),PN=J(w0,"u").replace(/punct/g,b0).getRegex(),S0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",DN=J(S0,"gu").replace(/notPunctSpace/g,ep).replace(/punctSpace/g,xc).replace(/punct/g,ks).getRegex(),LN=J(S0,"gu").replace(/notPunctSpace/g,IN).replace(/punctSpace/g,TN).replace(/punct/g,b0).getRegex(),zN=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ep).replace(/punctSpace/g,xc).replace(/punct/g,ks).getRegex(),ON=J(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ks).getRegex(),MN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",NN=J(MN,"gu").replace(/notPunctSpace/g,ep).replace(/punctSpace/g,xc).replace(/punct/g,ks).getRegex(),UN=J(/\\(punct)/,"gu").replace(/punct/g,ks).getRegex(),FN=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(),HN=J(Xd).replace("(?:-->|$)","-->").getRegex(),ZN=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",HN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Nl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,WN=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Nl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_0=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Nl).replace("ref",Jd).getRegex(),k0=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",Jd).getRegex(),VN=J("reflink|nolink(?!\\()","g").replace("reflink",_0).replace("nolink",k0).getRegex(),Tm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tp={_backpedal:mr,anyPunctuation:UN,autolink:FN,blockSkip:CN,br:y0,code:EN,del:mr,delLDelim:mr,delRDelim:mr,emStrongLDelim:RN,emStrongRDelimAst:DN,emStrongRDelimUnd:zN,escape:xN,link:WN,nolink:k0,punctuation:$N,reflink:_0,reflinkSearch:VN,tag:ZN,text:AN,url:mr},BN={...tp,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Nl).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Nl).getRegex()},Bh={...tp,emStrongRDelimAst:LN,emStrongLDelim:PN,delLDelim:ON,delRDelim:NN,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Tm).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",Tm).getRegex()},jN={...Bh,br:J(y0).replace("{2,}","*").getRegex(),text:J(Bh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ba={normal:Qd,gfm:_N,pedantic:kN},Ns={normal:tp,gfm:Bh,breaks:jN,pedantic:BN},GN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Im=n=>GN[n];function Wt(n,t){if(t){if(Qe.escapeTest.test(n))return n.replace(Qe.escapeReplace,Im)}else if(Qe.escapeTestNoEncode.test(n))return n.replace(Qe.escapeReplaceNoEncode,Im);return n}function Cm(n){try{n=encodeURI(n).replace(Qe.percentDecode,"%")}catch{return null}return n}function Rm(n,t){var s;let e=n.replace(Qe.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(Qe.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(Qe.slashPipe,"|");return r}function Us(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 qN(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 YN(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 Pm(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 KN(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",FM);function HM(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:c0,setPrototypeOf:Sm,isFrozen:ZM,getPrototypeOf:WM,getOwnPropertyDescriptor:VM}=Object;let{freeze:et,seal:St,create:vl}=Object,{apply:Bh,construct:Gh}=typeof Reflect<"u"&&Reflect;et||(et=function(t){return t});St||(St=function(t){return t});Bh||(Bh=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)});Gh||(Gh=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 Wa=tt(Array.prototype.forEach),jM=tt(Array.prototype.lastIndexOf),_m=tt(Array.prototype.pop),Ds=tt(Array.prototype.push),BM=tt(Array.prototype.splice),yl=tt(String.prototype.toLowerCase),Ru=tt(String.prototype.toString),Pu=tt(String.prototype.match),Ls=tt(String.prototype.replace),GM=tt(String.prototype.indexOf),qM=tt(String.prototype.trim),ut=tt(Object.prototype.hasOwnProperty),Be=tt(RegExp.prototype.test),zs=YM(TypeError);function tt(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 Bh(n,t,r)}}function YM(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Gh(n,e)}}function G(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yl;Sm&&Sm(n,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(ZM(t)||(t[r]=s),i=s)}n[i]=!0}return n}function KM(n){for(let t=0;t<n.length;t++)ut(n,t)||(n[t]=null);return n}function Zt(n){const t=vl(null);for(const[e,r]of c0(n))ut(n,e)&&(Array.isArray(r)?t[e]=KM(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Zt(r):t[e]=r);return t}function Os(n,t){for(;n!==null;){const r=VM(n,t);if(r){if(r.get)return tt(r.get);if(typeof r.value=="function")return tt(r.value)}n=WM(n)}function e(){return null}return e}const km=et(["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"]),Du=et(["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"]),Lu=et(["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"]),JM=et(["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"]),zu=et(["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"]),XM=et(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xm=et(["#text"]),Em=et(["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"]),Ou=et(["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"]),Am=et(["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"]),Va=et(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),QM=St(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eN=St(/<%[\w\W]*|[\w\W]*%>/gm),tN=St(/\$\{[\w\W]*/gm),nN=St(/^data-[\-\w.\u00B7-\uFFFF]+$/),rN=St(/^aria-[\-\w]+$/),u0=St(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iN=St(/^(?:\w+script|data):/i),sN=St(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),h0=St(/^html$/i),oN=St(/^[a-z][.\w]*(-[.\w]+)+$/i);var $m=Object.freeze({__proto__:null,ARIA_ATTR:rN,ATTR_WHITESPACE:sN,CUSTOM_ELEMENT:oN,DATA_ATTR:nN,DOCTYPE_NAME:h0,ERB_EXPR:eN,IS_ALLOWED_URI:u0,IS_SCRIPT_OR_DATA:iN,MUSTACHE_EXPR:QM,TMPLIT_EXPR:tN});const Ms={element:1,text:3,progressingInstruction:7,comment:8,document:9},aN=function(){return typeof window>"u"?null:window},lN=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}},Tm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function d0(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:aN();const t=U=>d0(U);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==Ms.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=Os(E,"cloneNode"),I=Os(E,"remove"),P=Os(E,"nextSibling"),R=Os(E,"childNodes"),V=Os(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:sr}=r;let ze=Tm();t.isSupported=typeof c0=="function"&&typeof V=="function"&&Y&&Y.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:or,ERB_EXPR:Mt,TMPLIT_EXPR:Cn,DATA_ATTR:Ec,ARIA_ATTR:wa,IS_SCRIPT_OR_DATA:D0,ATTR_WHITESPACE:cp,CUSTOM_ELEMENT:L0}=$m;let{IS_ALLOWED_URI:up}=$m,Re=null;const hp=G({},[...km,...Du,...Lu,...zu,...xm]);let Oe=null;const dp=G({},[...Em,...Ou,...Am,...Va]);let we=Object.seal(vl(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}})),xs=null,Sa=null;const Rn=Object.seal(vl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let pp=!0,Ac=!0,fp=!1,gp=!0,ti=!1,_a=!0,ar=!1,$c=!1,Tc=!1,ni=!1,ka=!1,xa=!1,mp=!0,vp=!1;const z0="user-content-";let Ic=!0,Es=!1,ri={},Nt=null;const Cc=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 yp=null;const bp=G({},["audio","video","img","source","image","track"]);let Rc=null;const wp=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ea="http://www.w3.org/1998/Math/MathML",Aa="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml";let ii=hn,Pc=!1,Dc=null;const O0=G({},[Ea,Aa,hn],Ru);let $a=G({},["mi","mo","mn","ms","mtext"]),Ta=G({},["annotation-xml"]);const M0=G({},["title","style","font","a","script"]);let As=null;const N0=["application/xhtml+xml","text/html"],U0="text/html";let Ae=null,si=null;const F0=e.createElement("form"),Sp=function(b){return b instanceof RegExp||b instanceof Function},Lc=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(si&&si===b)){if((!b||typeof b!="object")&&(b={}),b=Zt(b),As=N0.indexOf(b.PARSER_MEDIA_TYPE)===-1?U0:b.PARSER_MEDIA_TYPE,Ae=As==="application/xhtml+xml"?Ru:yl,Re=ut(b,"ALLOWED_TAGS")?G({},b.ALLOWED_TAGS,Ae):hp,Oe=ut(b,"ALLOWED_ATTR")?G({},b.ALLOWED_ATTR,Ae):dp,Dc=ut(b,"ALLOWED_NAMESPACES")?G({},b.ALLOWED_NAMESPACES,Ru):O0,Rc=ut(b,"ADD_URI_SAFE_ATTR")?G(Zt(wp),b.ADD_URI_SAFE_ATTR,Ae):wp,yp=ut(b,"ADD_DATA_URI_TAGS")?G(Zt(bp),b.ADD_DATA_URI_TAGS,Ae):bp,Nt=ut(b,"FORBID_CONTENTS")?G({},b.FORBID_CONTENTS,Ae):Cc,xs=ut(b,"FORBID_TAGS")?G({},b.FORBID_TAGS,Ae):Zt({}),Sa=ut(b,"FORBID_ATTR")?G({},b.FORBID_ATTR,Ae):Zt({}),ri=ut(b,"USE_PROFILES")?b.USE_PROFILES:!1,pp=b.ALLOW_ARIA_ATTR!==!1,Ac=b.ALLOW_DATA_ATTR!==!1,fp=b.ALLOW_UNKNOWN_PROTOCOLS||!1,gp=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ti=b.SAFE_FOR_TEMPLATES||!1,_a=b.SAFE_FOR_XML!==!1,ar=b.WHOLE_DOCUMENT||!1,ni=b.RETURN_DOM||!1,ka=b.RETURN_DOM_FRAGMENT||!1,xa=b.RETURN_TRUSTED_TYPE||!1,Tc=b.FORCE_BODY||!1,mp=b.SANITIZE_DOM!==!1,vp=b.SANITIZE_NAMED_PROPS||!1,Ic=b.KEEP_CONTENT!==!1,Es=b.IN_PLACE||!1,up=b.ALLOWED_URI_REGEXP||u0,ii=b.NAMESPACE||hn,$a=b.MATHML_TEXT_INTEGRATION_POINTS||$a,Ta=b.HTML_INTEGRATION_POINTS||Ta,we=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Sp(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(we.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Sp(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(we.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(we.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ti&&(Ac=!1),ka&&(ni=!0),ri&&(Re=G({},xm),Oe=vl(null),ri.html===!0&&(G(Re,km),G(Oe,Em)),ri.svg===!0&&(G(Re,Du),G(Oe,Ou),G(Oe,Va)),ri.svgFilters===!0&&(G(Re,Lu),G(Oe,Ou),G(Oe,Va)),ri.mathMl===!0&&(G(Re,zu),G(Oe,Am),G(Oe,Va))),ut(b,"ADD_TAGS")||(Rn.tagCheck=null),ut(b,"ADD_ATTR")||(Rn.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?Rn.tagCheck=b.ADD_TAGS:(Re===hp&&(Re=Zt(Re)),G(Re,b.ADD_TAGS,Ae))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?Rn.attributeCheck=b.ADD_ATTR:(Oe===dp&&(Oe=Zt(Oe)),G(Oe,b.ADD_ATTR,Ae))),b.ADD_URI_SAFE_ATTR&&G(Rc,b.ADD_URI_SAFE_ATTR,Ae),b.FORBID_CONTENTS&&(Nt===Cc&&(Nt=Zt(Nt)),G(Nt,b.FORBID_CONTENTS,Ae)),b.ADD_FORBID_CONTENTS&&(Nt===Cc&&(Nt=Zt(Nt)),G(Nt,b.ADD_FORBID_CONTENTS,Ae)),Ic&&(Re["#text"]=!0),ar&&G(Re,["html","head","body"]),Re.table&&(G(Re,["tbody"]),delete xs.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw zs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=b.TRUSTED_TYPES_POLICY,F=N.createHTML("")}else N===void 0&&(N=lN(m,i)),N!==null&&typeof F=="string"&&(F=N.createHTML(""));et&&et(b),si=b}},_p=G({},[...Du,...Lu,...JM]),kp=G({},[...zu,...XM]),H0=function(b){let C=V(b);(!C||!C.tagName)&&(C={namespaceURI:ii,tagName:"template"});const D=yl(b.tagName),he=yl(C.tagName);return Dc[b.namespaceURI]?b.namespaceURI===Aa?C.namespaceURI===hn?D==="svg":C.namespaceURI===Ea?D==="svg"&&(he==="annotation-xml"||$a[he]):!!_p[D]:b.namespaceURI===Ea?C.namespaceURI===hn?D==="math":C.namespaceURI===Aa?D==="math"&&Ta[he]:!!kp[D]:b.namespaceURI===hn?C.namespaceURI===Aa&&!Ta[he]||C.namespaceURI===Ea&&!$a[he]?!1:!kp[D]&&(M0[D]||!_p[D]):!!(As==="application/xhtml+xml"&&Dc[b.namespaceURI]):!1},Ut=function(b){Ds(t.removed,{element:b});try{V(b).removeChild(b)}catch{I(b)}},lr=function(b,C){try{Ds(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{Ds(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(ni||ka)try{Ut(C)}catch{}else try{C.setAttribute(b,"")}catch{}},xp=function(b){let C=null,D=null;if(Tc)b="<remove></remove>"+b;else{const Se=Pu(b,/^[\r\n\t ]+/);D=Se&&Se[0]}As==="application/xhtml+xml"&&ii===hn&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const he=N?N.createHTML(b):b;if(ii===hn)try{C=new y().parseFromString(he,As)}catch{}if(!C||!C.documentElement){C=Y.createDocument(ii,"template",null);try{C.documentElement.innerHTML=Pc?F:he}catch{}}const We=C.body||C.documentElement;return b&&D&&We.insertBefore(e.createTextNode(D),We.childNodes[0]||null),ii===hn?Et.call(C,ar?"html":"body")[0]:ar?C.documentElement:We},Ep=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)},zc=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")},Ap=function(b){return typeof a=="function"&&b instanceof a};function dn(U,b,C){Wa(U,D=>{D.call(t,b,C,si)})}const $p=function(b){let C=null;if(dn(ze.beforeSanitizeElements,b,null),zc(b))return Ut(b),!0;const D=Ae(b.nodeName);if(dn(ze.uponSanitizeElement,b,{tagName:D,allowedTags:Re}),_a&&b.hasChildNodes()&&!Ap(b.firstElementChild)&&Be(/<[/\w!]/g,b.innerHTML)&&Be(/<[/\w!]/g,b.textContent)||b.nodeType===Ms.progressingInstruction||_a&&b.nodeType===Ms.comment&&Be(/<[/\w]/g,b.data))return Ut(b),!0;if(!(Rn.tagCheck instanceof Function&&Rn.tagCheck(D))&&(!Re[D]||xs[D])){if(!xs[D]&&Ip(D)&&(we.tagNameCheck instanceof RegExp&&Be(we.tagNameCheck,D)||we.tagNameCheck instanceof Function&&we.tagNameCheck(D)))return!1;if(Ic&&!Nt[D]){const he=V(b)||b.parentNode,We=R(b)||b.childNodes;if(We&&he){const Se=We.length;for(let nt=Se-1;nt>=0;--nt){const pn=x(We[nt],!0);pn.__removalCount=(b.__removalCount||0)+1,he.insertBefore(pn,P(b))}}}return Ut(b),!0}return b instanceof c&&!H0(b)||(D==="noscript"||D==="noembed"||D==="noframes")&&Be(/<\/no(script|embed|frames)/i,b.innerHTML)?(Ut(b),!0):(ti&&b.nodeType===Ms.text&&(C=b.textContent,Wa([or,Mt,Cn],he=>{C=Ls(C,he," ")}),b.textContent!==C&&(Ds(t.removed,{element:b.cloneNode()}),b.textContent=C)),dn(ze.afterSanitizeElements,b,null),!1)},Tp=function(b,C,D){if(Sa[C]||mp&&(C==="id"||C==="name")&&(D in e||D in F0))return!1;if(!(Ac&&!Sa[C]&&Be(Ec,C))){if(!(pp&&Be(wa,C))){if(!(Rn.attributeCheck instanceof Function&&Rn.attributeCheck(C,b))){if(!Oe[C]||Sa[C]){if(!(Ip(b)&&(we.tagNameCheck instanceof RegExp&&Be(we.tagNameCheck,b)||we.tagNameCheck instanceof Function&&we.tagNameCheck(b))&&(we.attributeNameCheck instanceof RegExp&&Be(we.attributeNameCheck,C)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(C,b))||C==="is"&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&Be(we.tagNameCheck,D)||we.tagNameCheck instanceof Function&&we.tagNameCheck(D))))return!1}else if(!Rc[C]){if(!Be(up,Ls(D,cp,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&GM(D,"data:")===0&&yp[b])){if(!(fp&&!Be(D0,Ls(D,cp,"")))){if(D)return!1}}}}}}}return!0},Ip=function(b){return b!=="annotation-xml"&&Pu(b,L0)},Cp=function(b){dn(ze.beforeSanitizeAttributes,b,null);const{attributes:C}=b;if(!C||zc(b))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Oe,forceKeepAttr:void 0};let he=C.length;for(;he--;){const We=C[he],{name:Se,namespaceURI:nt,value:pn}=We,oi=Ae(Se),Oc=pn;let Me=Se==="value"?Oc:qM(Oc);if(D.attrName=oi,D.attrValue=Me,D.keepAttr=!0,D.forceKeepAttr=void 0,dn(ze.uponSanitizeAttribute,b,D),Me=D.attrValue,vp&&(oi==="id"||oi==="name")&&(lr(Se,b),Me=z0+Me),_a&&Be(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Me)){lr(Se,b);continue}if(oi==="attributename"&&Pu(Me,"href")){lr(Se,b);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){lr(Se,b);continue}if(!gp&&Be(/\/>/i,Me)){lr(Se,b);continue}ti&&Wa([or,Mt,Cn],Pp=>{Me=Ls(Me,Pp," ")});const Rp=Ae(b.nodeName);if(!Tp(Rp,oi,Me)){lr(Se,b);continue}if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!nt)switch(m.getAttributeType(Rp,oi)){case"TrustedHTML":{Me=N.createHTML(Me);break}case"TrustedScriptURL":{Me=N.createScriptURL(Me);break}}if(Me!==Oc)try{nt?b.setAttributeNS(nt,Se,Me):b.setAttribute(Se,Me),zc(b)?Ut(b):_m(t.removed)}catch{lr(Se,b)}}dn(ze.afterSanitizeAttributes,b,null)},Z0=function U(b){let C=null;const D=Ep(b);for(dn(ze.beforeSanitizeShadowDOM,b,null);C=D.nextNode();)dn(ze.uponSanitizeShadowNode,C,null),$p(C),Cp(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,he=null,We=null;if(Pc=!U,Pc&&(U="<!-->"),typeof U!="string"&&!Ap(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw zs("dirty is not a string, aborting")}else throw zs("toString is not a function");if(!t.isSupported)return U;if($c||Lc(b),t.removed=[],typeof U=="string"&&(Es=!1),Es){if(U.nodeName){const pn=Ae(U.nodeName);if(!Re[pn]||xs[pn])throw zs("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof a)C=xp("<!---->"),D=C.ownerDocument.importNode(U,!0),D.nodeType===Ms.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?C=D:C.appendChild(D);else{if(!ni&&!ti&&!ar&&U.indexOf("<")===-1)return N&&xa?N.createHTML(U):U;if(C=xp(U),!C)return ni?null:xa?F:""}C&&Tc&&Ut(C.firstChild);const Se=Ep(Es?U:C);for(;he=Se.nextNode();)$p(he),Cp(he),he.content instanceof s&&Z0(he.content);if(Es)return U;if(ni){if(ka)for(We=ce.call(C.ownerDocument);C.firstChild;)We.appendChild(C.firstChild);else We=C;return(Oe.shadowroot||Oe.shadowrootmode)&&(We=sr.call(r,We,!0)),We}let nt=ar?C.outerHTML:C.innerHTML;return ar&&Re["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Be(h0,C.ownerDocument.doctype.name)&&(nt="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
454
+ `+nt),ti&&Wa([or,Mt,Cn],pn=>{nt=Ls(nt,pn," ")}),N&&xa?N.createHTML(nt):nt},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Lc(U),$c=!0},t.clearConfig=function(){si=null,$c=!1},t.isValidAttribute=function(U,b,C){si||Lc({});const D=Ae(U),he=Ae(b);return Tp(D,he,C)},t.addHook=function(U,b){typeof b=="function"&&Ds(ze[U],b)},t.removeHook=function(U,b){if(b!==void 0){const C=jM(ze[U],b);return C===-1?void 0:BM(ze[U],C,1)[0]}return _m(ze[U])},t.removeHooks=function(U){ze[U]=[]},t.removeAllHooks=function(){ze=Tm()},t}var p0=d0();function Jd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ei=Jd();function f0(n){ei=n}var mr={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(Qe.caret,"$1"),e=e.replace(i,o),r},getRegex:()=>new RegExp(e,t)};return r}var cN=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Qe={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)}}>`)},uN=/^(?:[ \t]*(?:\n|$))+/,hN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,dN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ba=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,g0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,m0=J(g0).replace(/bull/g,Xd).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(),fN=J(g0).replace(/bull/g,Xd).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(),Qd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gN=/^[^\n]+/,ep=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mN=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ep).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),vN=J(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xd).getRegex(),kc="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",tp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,yN=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",tp).replace("tag",kc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),v0=J(Qd).replace("hr",ba).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",kc).getRegex(),bN=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",v0).getRegex(),np={blockquote:bN,code:hN,def:mN,fences:dN,heading:pN,hr:ba,html:yN,lheading:m0,list:vN,newline:uN,paragraph:v0,table:mr,text:gN},Im=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ba).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",kc).getRegex(),wN={...np,lheading:fN,table:Im,paragraph:J(Qd).replace("hr",ba).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Im).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",kc).getRegex()},SN={...np,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",tp).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(Qd).replace("hr",ba).replace("heading",` *#{1,6} *[^
455
+ ]`).replace("lheading",m0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},_N=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,y0=/^( {2,}|\\)\n(?!\s*$)/,xN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ks=/[\p{P}\p{S}]/u,xc=/[\s\p{P}\p{S}]/u,rp=/[^\s\p{P}\p{S}]/u,EN=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xc).getRegex(),b0=/(?!~)[\p{P}\p{S}]/u,AN=/(?!~)[\s\p{P}\p{S}]/u,$N=/(?:[^\s\p{P}\p{S}]|~)/u,TN=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",cN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),w0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,IN=J(w0,"u").replace(/punct/g,ks).getRegex(),CN=J(w0,"u").replace(/punct/g,b0).getRegex(),S0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",RN=J(S0,"gu").replace(/notPunctSpace/g,rp).replace(/punctSpace/g,xc).replace(/punct/g,ks).getRegex(),PN=J(S0,"gu").replace(/notPunctSpace/g,$N).replace(/punctSpace/g,AN).replace(/punct/g,b0).getRegex(),DN=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,rp).replace(/punctSpace/g,xc).replace(/punct/g,ks).getRegex(),LN=J(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ks).getRegex(),zN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ON=J(zN,"gu").replace(/notPunctSpace/g,rp).replace(/punctSpace/g,xc).replace(/punct/g,ks).getRegex(),MN=J(/\\(punct)/,"gu").replace(/punct/g,ks).getRegex(),NN=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(),UN=J(tp).replace("(?:-->|$)","-->").getRegex(),FN=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",UN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Nl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,HN=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Nl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_0=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Nl).replace("ref",ep).getRegex(),k0=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",ep).getRegex(),ZN=J("reflink|nolink(?!\\()","g").replace("reflink",_0).replace("nolink",k0).getRegex(),Cm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ip={_backpedal:mr,anyPunctuation:MN,autolink:NN,blockSkip:TN,br:y0,code:kN,del:mr,delLDelim:mr,delRDelim:mr,emStrongLDelim:IN,emStrongRDelimAst:RN,emStrongRDelimUnd:DN,escape:_N,link:HN,nolink:k0,punctuation:EN,reflink:_0,reflinkSearch:ZN,tag:FN,text:xN,url:mr},WN={...ip,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Nl).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Nl).getRegex()},qh={...ip,emStrongRDelimAst:PN,emStrongLDelim:CN,delLDelim:LN,delRDelim:ON,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Cm).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",Cm).getRegex()},VN={...qh,br:J(y0).replace("{2,}","*").getRegex(),text:J(qh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ja={normal:np,gfm:wN,pedantic:SN},Ns={normal:ip,gfm:qh,breaks:VN,pedantic:WN},jN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Rm=n=>jN[n];function Wt(n,t){if(t){if(Qe.escapeTest.test(n))return n.replace(Qe.escapeReplace,Rm)}else if(Qe.escapeTestNoEncode.test(n))return n.replace(Qe.escapeReplaceNoEncode,Rm);return n}function Pm(n){try{n=encodeURI(n).replace(Qe.percentDecode,"%")}catch{return null}return n}function Dm(n,t){var s;let e=n.replace(Qe.findPipe,(o,a,c)=>{let u=!1,h=a;for(;--h>=0&&c[h]==="\\";)u=!u;return u?"|":" |"}),r=e.split(Qe.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(Qe.slashPipe,"|");return r}function Us(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 BN(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 GN(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 Lm(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 qN(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 Ul=class{constructor(n){g(this,"options");g(this,"rules");g(this,"lexer");this.options=n||ei}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:Us(e,`
458
- `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=KN(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=Us(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:Us(t[0],`
458
+ `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=qN(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=Us(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:Us(t[0],`
459
459
  `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=Us(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=YN(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=GN(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
- `,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 j=n.split(`
474
- `,1)[0],ce;if(E=j,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+=`
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
+ `,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
- `+E}x=!E.trim(),f+=j+`
477
- `,n=n.substring(j.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=Rm(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(Rm(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=Us(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=qN(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)),Pm(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 Pm(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}}}},Dt=class jh{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||ei,this.options.tokenizer=this.options.tokenizer||new Ul,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:Qe,block:Ba.normal,inline:Ns.normal};this.options.pedantic?(e.block=Ba.pedantic,e.inline=Ns.pedantic):this.options.gfm&&(e.block=Ba.gfm,this.options.breaks?e.inline=Ns.breaks:e.inline=Ns.gfm),this.tokenizer.rules=e}static get rules(){return{block:Ba,inline:Ns}}static lex(t,e){return new jh(e).lex(t)}static lexInline(t,e){return new jh(e).inlineTokens(t)}lex(t){t=t.replace(Qe.carriageReturn,`
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=Dm(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(Dm(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=Us(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=BN(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)),Lm(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 Lm(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}}}},Dt=class Yh{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||ei,this.options.tokenizer=this.options.tokenizer||new Ul,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:Qe,block:ja.normal,inline:Ns.normal};this.options.pedantic?(e.block=ja.pedantic,e.inline=Ns.pedantic):this.options.gfm&&(e.block=ja.gfm,this.options.breaks?e.inline=Ns.breaks:e.inline=Ns.gfm),this.tokenizer.rules=e}static get rules(){return{block:ja,inline:Ns}}static lex(t,e){return new Yh(e).lex(t)}static lexInline(t,e){return new Yh(e).inlineTokens(t)}lex(t){t=t.replace(Qe.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(Qe.tabCharGlobal," ").replace(Qe.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>${Wt(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=Cm(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+Wt(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=Cm(n);if(i===null)return Wt(e);n=i;let s=`<img src="${n}" alt="${Wt(e)}"`;return t&&(s+=` title="${Wt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Wt(n.text)}},np=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}},Lt=class Gh{constructor(t){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=t||ei,this.options.renderer=this.options.renderer||new Fl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new np}static parse(t,e){return new Gh(e).parse(t)}static parseInline(t,e){return new Gh(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,Ys=(ja=class{constructor(n){g(this,"options");g(this,"block");this.options=n||ei}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Dt.lex:Dt.lexInline}provideParser(){return this.block?Lt.parse:Lt.parseInline}},g(ja,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),g(ja,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ja),JN=class{constructor(...n){g(this,"defaults",qd());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",Lt);g(this,"Renderer",Fl);g(this,"TextRenderer",np);g(this,"Lexer",Dt);g(this,"Tokenizer",Ul);g(this,"Hooks",Ys);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 Fl(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 Ul(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 Ys;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];Ys.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Ys.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 Dt.lex(n,t??this.defaults)}parser(n,t){return Lt.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?Dt.lex:Dt.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?Lt.parse:Lt.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?Dt.lex:Dt.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?Lt.parse:Lt.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>"+Wt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Yr=new JN;function te(n,t){return Yr.parse(n,t)}te.options=te.setOptions=function(n){return Yr.setOptions(n),te.defaults=Yr.defaults,f0(te.defaults),te};te.getDefaults=qd;te.defaults=ei;te.use=function(...n){return Yr.use(...n),te.defaults=Yr.defaults,f0(te.defaults),te};te.walkTokens=function(n,t){return Yr.walkTokens(n,t)};te.parseInline=Yr.parseInline;te.Parser=Lt;te.parser=Lt.parse;te.Renderer=Fl;te.TextRenderer=np;te.Lexer=Dt;te.lexer=Dt.lex;te.Tokenizer=Ul;te.Hooks=Ys;te.parse=te;te.options;te.setOptions;te.use;te.walkTokens;te.parseInline;Lt.parse;Dt.lex;p0.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function XN(n){const t=te.parse(n,{async:!1});return p0.sanitize(t,{USE_PROFILES:{html:!0}})}var ea,En,rn,sn,qn,x0,bl;class qh extends hs{constructor(){super(...arguments);S(this,qn);g(this,"phase","thinking");g(this,"toolCalls",[]);g(this,"expanded",!1);g(this,"expandedTexts",new Set);S(this,ea,`agent-activity-panel-${++t6}`);g(this,"overflowingTexts",new Set);S(this,En,null);S(this,rn,null);S(this,sn,null);g(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ze(this.template(),this),p(this,qn,x0).call(this),l(this,rn)!==null&&cancelAnimationFrame(l(this,rn)),w(this,rn,requestAnimationFrame(()=>{w(this,rn,null),p(this,qn,bl).call(this)})),e.has("expanded")&&(l(this,sn)!==null&&clearTimeout(l(this,sn)),w(this,sn,window.setTimeout(()=>{w(this,sn,null),p(this,qn,bl).call(this)},e6)))}disconnected(){var e;(e=l(this,En))==null||e.disconnect(),w(this,En,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>${Wt(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=Pm(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+Wt(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=Pm(n);if(i===null)return Wt(e);n=i;let s=`<img src="${n}" alt="${Wt(e)}"`;return t&&(s+=` title="${Wt(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Wt(n.text)}},sp=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}},Lt=class Kh{constructor(t){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=t||ei,this.options.renderer=this.options.renderer||new Fl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new sp}static parse(t,e){return new Kh(e).parse(t)}static parseInline(t,e){return new Kh(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}},Ba,Ys=(Ba=class{constructor(n){g(this,"options");g(this,"block");this.options=n||ei}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Dt.lex:Dt.lexInline}provideParser(){return this.block?Lt.parse:Lt.parseInline}},g(Ba,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),g(Ba,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ba),YN=class{constructor(...n){g(this,"defaults",Jd());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",Lt);g(this,"Renderer",Fl);g(this,"TextRenderer",sp);g(this,"Lexer",Dt);g(this,"Tokenizer",Ul);g(this,"Hooks",Ys);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 Fl(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 Ul(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 Ys;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];Ys.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Ys.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 Dt.lex(n,t??this.defaults)}parser(n,t){return Lt.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?Dt.lex:Dt.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?Lt.parse:Lt.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?Dt.lex:Dt.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?Lt.parse:Lt.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>"+Wt(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Yr=new YN;function te(n,t){return Yr.parse(n,t)}te.options=te.setOptions=function(n){return Yr.setOptions(n),te.defaults=Yr.defaults,f0(te.defaults),te};te.getDefaults=Jd;te.defaults=ei;te.use=function(...n){return Yr.use(...n),te.defaults=Yr.defaults,f0(te.defaults),te};te.walkTokens=function(n,t){return Yr.walkTokens(n,t)};te.parseInline=Yr.parseInline;te.Parser=Lt;te.parser=Lt.parse;te.Renderer=Fl;te.TextRenderer=sp;te.Lexer=Dt;te.lexer=Dt.lex;te.Tokenizer=Ul;te.Hooks=Ys;te.parse=te;te.options;te.setOptions;te.use;te.walkTokens;te.parseInline;Lt.parse;Dt.lex;p0.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function KN(n){const t=te.parse(n,{async:!1});return p0.sanitize(t,{USE_PROFILES:{html:!0}})}var ea,En,rn,sn,qn,x0,bl;class Jh extends hs{constructor(){super(...arguments);S(this,qn);g(this,"phase","thinking");g(this,"toolCalls",[]);g(this,"expanded",!1);g(this,"expandedTexts",new Set);S(this,ea,`agent-activity-panel-${++QN}`);g(this,"overflowingTexts",new Set);S(this,En,null);S(this,rn,null);S(this,sn,null);g(this,"handleToggle",()=>{this.toolCalls.length!==0&&(this.expanded=!this.expanded)})}changed(e){Ze(this.template(),this),p(this,qn,x0).call(this),l(this,rn)!==null&&cancelAnimationFrame(l(this,rn)),w(this,rn,requestAnimationFrame(()=>{w(this,rn,null),p(this,qn,bl).call(this)})),e.has("expanded")&&(l(this,sn)!==null&&clearTimeout(l(this,sn)),w(this,sn,window.setTimeout(()=>{w(this,sn,null),p(this,qn,bl).call(this)},XN)))}disconnected(){var e;(e=l(this,En))==null||e.disconnect(),w(this,En,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=${n6(e.status)}
547
+ aria-label=${e6(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?hO({size:16}):Ol({size:16})}
564
+ ${r?cO({size:16}):Ol({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">${Ol({size:16})}</span>`;const e=this.phase==="thinking"||this.phase==="using";return L`<span class=${e?"indicator indicator-active":"indicator"}
570
- >${e?cw({size:16}):mO({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 QN(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}ea=new WeakMap,En=new WeakMap,rn=new WeakMap,sn=new WeakMap,qn=new WeakSet,x0=function(){if(!(typeof ResizeObserver>"u")){l(this,En)||w(this,En,new ResizeObserver(()=>p(this,qn,bl).call(this))),l(this,En).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,En).observe(e)}},bl=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)}}r6(this.overflowingTexts,e)||(this.overflowingTexts=e)},g(qh,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),g(qh,"attributes",{expanded:{type:Boolean}});function QN(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 e6=160;let t6=0;function n6(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function r6(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",qh);function i6(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 Dm=8,Lm=new WeakMap;function s6(n){const t=Lm.get(n);if(t&&t.text===n.text)return t.html;const e=XN(n.text);return Lm.set(n,{text:n.text,html:e}),e}function zm(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,Fr,Hr,jn,_t,A0,Yh,$0,Ql,ec,Kh;class E0 extends hs{constructor(){super(...arguments);S(this,_t);g(this,"messages",[]);S(this,mt,!0);S(this,vt,null);S(this,Fr,null);S(this,Hr,null);S(this,jn,!1);S(this,Ql,()=>{if(l(this,jn))return;const e=l(this,vt);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Dm;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))});S(this,ec,()=>{w(this,mt,!0),this.toggleAttribute("data-pinned",!0),p(this,_t,Kh).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=zm(this.messages);r=s!==null&&s!==zm(i),r&&w(this,mt,!0)}Ze(this.template(),this),l(this,vt)||(w(this,vt,this.querySelector(".history-scroll")),l(this,vt)&&p(this,_t,A0).call(this)),this.toggleAttribute("data-pinned",l(this,mt)),p(this,_t,Yh).call(this),p(this,_t,Kh).call(this,r)}disconnected(){var e,r;(e=l(this,Fr))==null||e.disconnect(),w(this,Fr,null),(r=l(this,Hr))==null||r.disconnect(),w(this,Hr,null)}template(){const e=i6(this.messages);return L`
570
+ >${e?cw({size:16}):fO({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 JN(a)}return`${e.expanded?"Showing":"Used"} ${r} ${r===1?"tool":"tools"}`}}ea=new WeakMap,En=new WeakMap,rn=new WeakMap,sn=new WeakMap,qn=new WeakSet,x0=function(){if(!(typeof ResizeObserver>"u")){l(this,En)||w(this,En,new ResizeObserver(()=>p(this,qn,bl).call(this))),l(this,En).disconnect();for(const e of this.querySelectorAll(".tool-text"))l(this,En).observe(e)}},bl=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)}}t6(this.overflowingTexts,e)||(this.overflowingTexts=e)},g(Jh,"properties",["phase","toolCalls","expanded","expandedTexts","overflowingTexts"]),g(Jh,"attributes",{expanded:{type:Boolean}});function JN(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 XN=160;let QN=0;function e6(n){switch(n){case"completed":return"Completed";case"failed":return"Failed";case"in_progress":return"In progress";default:return"Pending"}}function t6(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",Jh);function n6(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 zm=8,Om=new WeakMap;function r6(n){const t=Om.get(n);if(t&&t.text===n.text)return t.html;const e=KN(n.text);return Om.set(n,{text:n.text,html:e}),e}function Mm(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,Fr,Hr,Bn,_t,A0,Xh,$0,Ql,ec,Qh;class E0 extends hs{constructor(){super(...arguments);S(this,_t);g(this,"messages",[]);S(this,mt,!0);S(this,vt,null);S(this,Fr,null);S(this,Hr,null);S(this,Bn,!1);S(this,Ql,()=>{if(l(this,Bn))return;const e=l(this,vt);if(!e)return;const i=e.scrollHeight-e.clientHeight-e.scrollTop<=zm;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))});S(this,ec,()=>{w(this,mt,!0),this.toggleAttribute("data-pinned",!0),p(this,_t,Qh).call(this,!0)})}changed(e){let r=!1;if(e.has("messages")){const i=e.get("messages")??[],s=Mm(this.messages);r=s!==null&&s!==Mm(i),r&&w(this,mt,!0)}Ze(this.template(),this),l(this,vt)||(w(this,vt,this.querySelector(".history-scroll")),l(this,vt)&&p(this,_t,A0).call(this)),this.toggleAttribute("data-pinned",l(this,mt)),p(this,_t,Xh).call(this),p(this,_t,Qh).call(this,r)}disconnected(){var e,r;(e=l(this,Fr))==null||e.disconnect(),w(this,Fr,null),(r=l(this,Hr))==null||r.disconnect(),w(this,Hr,null)}template(){const e=n6(this.messages);return L`
571
571
  <div class="history-scroll" @scroll=${l(this,Ql)}>
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"?Kz(s6(i)):i.text;return L`<div
578
+ ></agent-activity>`;const i=r.message,s=i.kind==="assistant"?qz(r6(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
  ${Ol({size:16})}
590
590
  </button>
591
- `}}mt=new WeakMap,vt=new WeakMap,Fr=new WeakMap,Hr=new WeakMap,jn=new WeakMap,_t=new WeakSet,A0=function(){l(this,vt)&&(typeof ResizeObserver>"u"||(w(this,Fr,new ResizeObserver(()=>p(this,_t,$0).call(this))),w(this,Hr,new MutationObserver(()=>p(this,_t,Yh).call(this))),l(this,Hr).observe(l(this,vt),{childList:!0})))},Yh=function(){const e=l(this,vt),r=l(this,Fr);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},$0=function(){const e=l(this,vt);if(!e)return;if(l(this,mt)){w(this,jn,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{w(this,jn,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=Dm;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))},Ql=new WeakMap,ec=new WeakMap,Kh=function(e){requestAnimationFrame(()=>{const r=l(this,vt);r&&(!l(this,mt)&&!e||(w(this,jn,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{w(this,jn,!1)})))})},g(E0,"properties",["messages"]);customElements.define("message-history",E0);var Rt,ta,ns,on,rs,is,na,ss,tc,nc,rc,yt,wl,ra,Xh,Qh,ia,sa;class Jh extends hs{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,Rt,un.resolve("ServerManager"));S(this,ta,un.resolve("ShortcutService"));S(this,ns,null);S(this,on,null);S(this,rs,()=>{var e;this.status=((e=l(this,on))==null?void 0:e.status)??"disconnected"});S(this,is,()=>{var e;this.messages=((e=l(this,on))==null?void 0:e.messages)??[]});S(this,na,()=>{var e,r;(e=l(this,on))==null||e.removeEventListener("status-changed",l(this,rs)),(r=l(this,on))==null||r.removeEventListener("messages-changed",l(this,is)),w(this,on,null)});S(this,ss,()=>{var r;const e=((r=l(this,Rt).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,on)&&(l(this,na).call(this),w(this,on,e),e==null||e.addEventListener("status-changed",l(this,rs)),e==null||e.addEventListener("messages-changed",l(this,is)),l(this,rs).call(this),l(this,is).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,Rt).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,wl).call(this,r);const s=(o=l(this,Rt).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,tc,e=>{p(this,yt,wl).call(this,e.currentTarget)});S(this,nc,e=>{var i;e.stopPropagation();const r=(i=l(this,Rt).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});S(this,rc,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});S(this,ra,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Rt).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,ia,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});S(this,sa,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;w(this,ns,e),l(this,Rt).addEventListener("change",l(this,ss)),e.defer(()=>{l(this,Rt).removeEventListener("change",l(this,ss)),l(this,na).call(this)}),l(this,ss).call(this),l(this,ta).addEventListener("shortcut-triggered",l(this,ra)),e.defer(()=>l(this,ta).removeEventListener("shortcut-triggered",l(this,ra))),this.open&&p(this,yt,Xh).call(this)}disconnected(){var e;(e=l(this,ns))==null||e.dispose(),w(this,ns,null),p(this,yt,Qh).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")),Ze(this.template(),this),e.has("open"))if(this.open){p(this,yt,Xh).call(this);const r=this.querySelector("textarea");r&&(p(this,yt,wl).call(this,r),r.focus())}else p(this,yt,Qh).call(this)}template(){var i;const e=(i=l(this,Rt).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,Fr=new WeakMap,Hr=new WeakMap,Bn=new WeakMap,_t=new WeakSet,A0=function(){l(this,vt)&&(typeof ResizeObserver>"u"||(w(this,Fr,new ResizeObserver(()=>p(this,_t,$0).call(this))),w(this,Hr,new MutationObserver(()=>p(this,_t,Xh).call(this))),l(this,Hr).observe(l(this,vt),{childList:!0})))},Xh=function(){const e=l(this,vt),r=l(this,Fr);if(!(!e||!r)){r.disconnect();for(const i of Array.from(e.children))r.observe(i)}},$0=function(){const e=l(this,vt);if(!e)return;if(l(this,mt)){w(this,Bn,!0),e.scrollTop=e.scrollHeight-e.clientHeight,requestAnimationFrame(()=>{w(this,Bn,!1)});return}const i=e.scrollHeight-e.clientHeight-e.scrollTop<=zm;i!==l(this,mt)&&(w(this,mt,i),this.toggleAttribute("data-pinned",i))},Ql=new WeakMap,ec=new WeakMap,Qh=function(e){requestAnimationFrame(()=>{const r=l(this,vt);r&&(!l(this,mt)&&!e||(w(this,Bn,!0),r.scrollTop=r.scrollHeight-r.clientHeight,requestAnimationFrame(()=>{w(this,Bn,!1)})))})},g(E0,"properties",["messages"]);customElements.define("message-history",E0);var Rt,ta,ns,on,rs,is,na,ss,tc,nc,rc,yt,wl,ra,td,nd,ia,sa;class ed extends hs{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,Rt,un.resolve("ServerManager"));S(this,ta,un.resolve("ShortcutService"));S(this,ns,null);S(this,on,null);S(this,rs,()=>{var e;this.status=((e=l(this,on))==null?void 0:e.status)??"disconnected"});S(this,is,()=>{var e;this.messages=((e=l(this,on))==null?void 0:e.messages)??[]});S(this,na,()=>{var e,r;(e=l(this,on))==null||e.removeEventListener("status-changed",l(this,rs)),(r=l(this,on))==null||r.removeEventListener("messages-changed",l(this,is)),w(this,on,null)});S(this,ss,()=>{var r;const e=((r=l(this,Rt).activeServer)==null?void 0:r.acpClient)??null;e!==l(this,on)&&(l(this,na).call(this),w(this,on,e),e==null||e.addEventListener("status-changed",l(this,rs)),e==null||e.addEventListener("messages-changed",l(this,is)),l(this,rs).call(this),l(this,is).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,Rt).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,wl).call(this,r);const s=(o=l(this,Rt).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,tc,e=>{p(this,yt,wl).call(this,e.currentTarget)});S(this,nc,e=>{var i;e.stopPropagation();const r=(i=l(this,Rt).activeServer)==null?void 0:i.acpClient;r&&r.cancel().catch(s=>{console.error("ACPClient.cancel() failed",s)})});S(this,rc,e=>{if(e.target instanceof HTMLTextAreaElement)return;const r=e.currentTarget.querySelector("textarea");r==null||r.focus()});S(this,ra,e=>{var s;if(e.shortcut!=="focusCommandInput")return;const r=(s=l(this,Rt).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,ia,e=>{e.target instanceof Node&&(this.contains(e.target)||(this.open=!1))});S(this,sa,e=>{e.key==="Escape"&&(this.open=!1)})}connected(){const e=new DisposableStack;w(this,ns,e),l(this,Rt).addEventListener("change",l(this,ss)),e.defer(()=>{l(this,Rt).removeEventListener("change",l(this,ss)),l(this,na).call(this)}),l(this,ss).call(this),l(this,ta).addEventListener("shortcut-triggered",l(this,ra)),e.defer(()=>l(this,ta).removeEventListener("shortcut-triggered",l(this,ra))),this.open&&p(this,yt,td).call(this)}disconnected(){var e;(e=l(this,ns))==null||e.dispose(),w(this,ns,null),p(this,yt,nd).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")),Ze(this.template(),this),e.has("open"))if(this.open){p(this,yt,td).call(this);const r=this.querySelector("textarea");r&&(p(this,yt,wl).call(this,r),r.focus())}else p(this,yt,nd).call(this)}template(){var i;const e=(i=l(this,Rt).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,nc)}
627
627
  >
628
- ${o?L`<ui-spinner size="16" weight="bold"></ui-spinner>`:uO({size:16})}
628
+ ${o?L`<ui-spinner size="16" weight="bold"></ui-spinner>`:lO({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
- `}}Rt=new WeakMap,ta=new WeakMap,ns=new WeakMap,on=new WeakMap,rs=new WeakMap,is=new WeakMap,na=new WeakMap,ss=new WeakMap,tc=new WeakMap,nc=new WeakMap,rc=new WeakMap,yt=new WeakSet,wl=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},ra=new WeakMap,Xh=function(){document.addEventListener("mousedown",l(this,ia)),document.addEventListener("keydown",l(this,sa))},Qh=function(){document.removeEventListener("mousedown",l(this,ia)),document.removeEventListener("keydown",l(this,sa))},ia=new WeakMap,sa=new WeakMap,g(Jh,"properties",["placeholder","open","messages","status"]),g(Jh,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",Jh);const o6='<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 T0 extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});g(this,"token");this.token=e}}class a6 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 T0(r))}render(){Ze(L`
644
+ `}}Rt=new WeakMap,ta=new WeakMap,ns=new WeakMap,on=new WeakMap,rs=new WeakMap,is=new WeakMap,na=new WeakMap,ss=new WeakMap,tc=new WeakMap,nc=new WeakMap,rc=new WeakMap,yt=new WeakSet,wl=function(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`},ra=new WeakMap,td=function(){document.addEventListener("mousedown",l(this,ia)),document.addEventListener("keydown",l(this,sa))},nd=function(){document.removeEventListener("mousedown",l(this,ia)),document.removeEventListener("keydown",l(this,sa))},ia=new WeakMap,sa=new WeakMap,g(ed,"properties",["placeholder","open","messages","status"]),g(ed,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",ed);const i6='<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 T0 extends Event{constructor(e){super("auth-submit",{bubbles:!0,composed:!0});g(this,"token");this.token=e}}class s6 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 T0(r))}render(){Ze(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">${aw(o6)}</svg>
650
+ <svg width="32" height="32" viewBox="0 0 256 256" fill="currentColor">${aw(i6)}</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",a6);const l6=250,c6=1e3;class I0 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()},l6))}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…";Ze(L`
679
+ `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",s6);const o6=250,a6=1e3;class I0 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()},o6))}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…";Ze(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/c6)}s…`}}g(I0,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",I0);class u6 extends HTMLElement{constructor(){super(...arguments);g(this,"runtimeServerURL",tb());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.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 T0?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(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,Og());return}if(this.serverManager.activeServer)return;const e=Og(),r=new Jb({url:this.runtimeServerURL,name:"Server",token:e});this.serverManager.add(r),this.serverManager.setActive(r);try{await r.connect(e),this.connectError=null}catch(i){this.connectError=i instanceof Error&&!(i instanceof Qs)?i.message:null}this.render()}async handleAuthSubmit(e){const r=this.serverManager.activeServer;if(r){this.connectError=null,this.updateTokenQueryParam(e);try{await r.connect(e)}catch(i){i instanceof Qs||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(e){const r=new URL(window.location.href);r.searchParams.set("token",e),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}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;Ze(L`
691
+ `,this)}formatCountdown(e){const r=e-Date.now();return r<=0?"Reattempting now…":`Reattempting in ${Math.ceil(r/a6)}s…`}}g(I0,"observedAttributes",["next-retry-at","has-ever-connected"]);customElements.get("connecting-overlay")||customElements.define("connecting-overlay",I0);class l6 extends HTMLElement{constructor(){super(...arguments);g(this,"runtimeServerURL",tb());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.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 T0?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(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,Ng());return}if(this.serverManager.activeServer)return;const e=Ng(),r=new Jb({url:this.runtimeServerURL,name:"Server",token:e});this.serverManager.add(r),this.serverManager.setActive(r);try{await r.connect(e),this.connectError=null}catch(i){this.connectError=i instanceof Error&&!(i instanceof Qs)?i.message:null}this.render()}async handleAuthSubmit(e){const r=this.serverManager.activeServer;if(r){this.connectError=null,this.updateTokenQueryParam(e);try{await r.connect(e)}catch(i){i instanceof Qs||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(e){const r=new URL(window.location.href);r.searchParams.set("token",e),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}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;Ze(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",u6);const rp=ln(),ip=tb(),C0=new x$(rp?"television-electron":"television-browser",b$(ip)),cn=new Az({localStore:C0,localServerURL:ip}),R0=new R$({localStore:C0,serverManager:cn}),h6=new $z,d6=()=>{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)));Nz(e)}).catch(()=>{})},P0=()=>{const n=cn.activeServer;if(!n||n.status!=="connected"){Al();return}d6(),n.client.display.get().then(t=>{if(!(cn.activeServer!==n||n.status!=="connected"))return tw(t.activeThemeName,n)}).catch(()=>{cn.activeServer===n&&Al()})};P0();cn.addEventListener("change",P0);cn.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=cn.activeServer;!t||t.url!==n.serverURL||tw(n.event.themeName,t)});un.register("ServerManager",()=>cn);un.register("ScreenManager",()=>R0);un.register("ShortcutService",()=>h6);globalThis.__telepath={screenManager:R0,serverManager:cn};const sp=document.createElement("television-app");sp.runtimeServerURL=ip;sp.electronMode=rp;rp&&document.body.classList.add("electron");document.body.appendChild(sp);
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",l6);const op=ln(),ap=tb(),C0=new _$(op?"television-electron":"television-browser",v$(ap)),cn=new xz({localStore:C0,localServerURL:ap}),R0=new I$({localStore:C0,serverManager:cn}),c6=new Ez,u6=()=>{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)));Oz(e)}).catch(()=>{})},P0=()=>{const n=cn.activeServer;if(!n||n.status!=="connected"){Al();return}u6(),n.client.display.get().then(t=>{if(!(cn.activeServer!==n||n.status!=="connected"))return tw(t.activeThemeName,n)}).catch(()=>{cn.activeServer===n&&Al()})};P0();cn.addEventListener("change",P0);cn.addEventListener("server-event",n=>{if(n.event.type!=="theme-changed")return;const t=cn.activeServer;!t||t.url!==n.serverURL||tw(n.event.themeName,t)});un.register("ServerManager",()=>cn);un.register("ScreenManager",()=>R0);un.register("ShortcutService",()=>c6);globalThis.__telepath={screenManager:R0,serverManager:cn};const lp=document.createElement("television-app");lp.runtimeServerURL=ap;lp.electronMode=op;op&&document.body.classList.add("electron");document.body.appendChild(lp);