@telepath-computer/television 0.1.57 → 0.1.58
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 pb=Object.defineProperty;var Hh=n=>{throw TypeError(n)};var fb=(n,e,t)=>e in n?pb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>fb(n,typeof e!="symbol"?e+"":e,t),vl=(n,e,t)=>e.has(n)||Hh("Cannot "+t);var l=(n,e,t)=>(vl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?Hh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),k=(n,e,t,r)=>(vl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),g=(n,e,t)=>(vl(n,e,"access private method"),t);var Bh=(n,e,t,r)=>({set _(i){k(n,e,i,t)},get _(){return l(n,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gb(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var jh=Object.prototype.toString,Lf=function(e){var t=jh.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&jh.call(e.callee)==="[object Function]"),r},yl,Vh;function mb(){if(Vh)return yl;Vh=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Lf,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 v=y.constructor;return v&&v.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},d=function(){if(typeof window>"u")return!1;for(var y in window)try{if(!u["$"+y]&&e.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1}(),p=function(y){if(typeof window>"u"||!d)return c(y);try{return c(y)}catch{return!1}};n=function(v){var $=v!==null&&typeof v=="object",E=t.call(v)==="[object Function]",I=r(v),Z=$&&t.call(v)==="[object String]",P=[];if(!$&&!E&&!I)throw new TypeError("Object.keys called on a non-object");var V=o&&E;if(Z&&v.length>0&&!e.call(v,0))for(var O=0;O<v.length;++O)P.push(String(O));if(I&&v.length>0)for(var H=0;H<v.length;++H)P.push(String(H));else for(var U in v)!(V&&U==="prototype")&&e.call(v,U)&&P.push(String(U));if(s)for(var ce=p(v),ue=0;ue<a.length;++ue)!(ce&&a[ue]==="constructor")&&e.call(v,a[ue])&&P.push(a[ue]);return P}}return yl=n,yl}var vb=Array.prototype.slice,yb=Lf,Gh=Object.keys,Fo=Gh?function(e){return Gh(e)}:mb(),Wh=Object.keys;Fo.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return yb(r)?Wh(vb.call(r)):Wh(r)})}else Object.keys=Fo;return Object.keys||Fo};var bb=Fo,Zo=Object.defineProperty||!1;if(Zo)try{Zo({},"a",{value:1})}catch{Zo=!1}var Ks=Zo,Xt=SyntaxError,W=TypeError,wb=Object.getOwnPropertyDescriptor,Ho=wb;if(Ho)try{Ho([],"length")}catch{Ho=null}var pi=Ho,qh=Ks,Sb=Xt,$r=W,Yh=pi,Mf=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new $r("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new $r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $r("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!Yh&&Yh(e,t);if(qh)qh(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new Sb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},uc=Ks,Nf=function(){return!!uc};Nf.hasArrayLengthDefineBug=function(){if(!uc)return null;try{return uc([],"length",{value:1}).length!==1}catch{return!0}};var Fa=Nf,_b=bb,kb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Eb=Object.prototype.toString,xb=Array.prototype.concat,Kh=Mf,Ab=function(n){return typeof n=="function"&&Eb.call(n)==="[object Function]"},Uf=Fa(),$b=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Ab(r)||!r())return}Uf?Kh(n,e,t,!0):Kh(n,e,t)},Ff=function(n,e){var t=arguments.length>2?arguments[2]:{},r=_b(e);kb&&(r=xb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)$b(n,r[i],e[r[i]],t[r[i]])};Ff.supportsDescriptors=!!Uf;var vr=Ff,Bo={exports:{}};typeof self<"u"?Bo.exports=self:typeof window<"u"?Bo.exports=window:Bo.exports=Function("return this")();var Zf=Bo.exports,Tb=Zf,Hf=function(){return typeof On!="object"||!On||On.Math!==Math||On.Array!==Array?Tb:On},Cb=vr,Ib=pi,Pb=Hf,Rb=function(){var e=Pb();if(Cb.supportsDescriptors){var t=Ib(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},Db=vr,Ob=Zf,Bf=Hf,zb=Rb,Lb=Bf(),jf=function(){return Lb};Db(jf,{getPolyfill:Bf,implementation:Ob,shim:zb});var pu=jf,Qt=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},fu=Object,Vf=Error,Mb=EvalError,Nb=RangeError,gu=ReferenceError,Ub=URIError,Fb=Math.abs,Zb=Math.floor,Hb=Math.max,Bb=Math.min,jb=Math.pow,Vb=Math.round,mu=Number.isNaN||function(e){return e!==e},Gb=mu,Wb=function(e){return Gb(e)||e===0?e:e<0?-1:1},fi=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0},Jh=typeof Symbol<"u"&&Symbol,qb=fi,vu=function(){return typeof Jh!="function"||typeof Symbol!="function"||typeof Jh("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:qb()},Gf=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,Yb=fu,Wf=Yb.getPrototypeOf||null,Kb="Function.prototype.bind called on incompatible ",Jb=Object.prototype.toString,Xb=Math.max,Qb="[object Function]",Xh=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},ew=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},tw=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},nw=function(e){var t=this;if(typeof t!="function"||Jb.apply(t)!==Qb)throw new TypeError(Kb+t);for(var r=ew(arguments,1),i,s=function(){if(this instanceof i){var d=t.apply(this,Xh(r,arguments));return Object(d)===d?d:this}return t.apply(e,Xh(r,arguments))},o=Xb(0,t.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+tw(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},rw=nw,Js=Function.prototype.bind||rw,yu=Function.prototype.call,bu=Function.prototype.apply,iw=typeof Reflect<"u"&&Reflect&&Reflect.apply,sw=Js,ow=bu,aw=yu,lw=iw,qf=lw||sw.call(aw,ow),cw=Js,uw=W,hw=yu,dw=qf,Za=function(e){if(e.length<1||typeof e[0]!="function")throw new uw("a function is required");return dw(cw,hw,e)},pw=Za,Qh=pi,Yf;try{Yf=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var bl=!!Yf&&Qh&&Qh(Object.prototype,"__proto__"),Kf=Object,ed=Kf.getPrototypeOf,fw=bl&&typeof bl.get=="function"?pw([bl.get]):typeof ed=="function"?function(e){return ed(e==null?e:Kf(e))}:!1,td=Gf,nd=Wf,rd=fw,Jf=td?function(e){return td(e)}:nd?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return nd(e)}:rd?function(e){return rd(e)}:null,gw=Function.prototype.call,mw=Object.prototype.hasOwnProperty,vw=Js,en=vw.call(gw,mw),G,yw=fu,bw=Vf,ww=Mb,Sw=Nb,_w=gu,ai=Xt,Zr=W,kw=Ub,Ew=Fb,xw=Zb,Aw=Hb,$w=Bb,Tw=jb,Cw=Vb,Iw=Wb,Xf=Function,wl=function(n){try{return Xf('"use strict"; return ('+n+").constructor;")()}catch{}},is=pi,Pw=Ks,Sl=function(){throw new Zr},Rw=is?function(){try{return arguments.callee,Sl}catch{try{return is(arguments,"callee").get}catch{return Sl}}}():Sl,Tr=vu(),_e=Jf,Dw=Wf,Ow=Gf,Qf=bu,Xs=yu,Pr={},zw=typeof Uint8Array>"u"||!_e?G:_e(Uint8Array),ur={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":Tr&&_e?_e([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":Pr,"%AsyncGenerator%":Pr,"%AsyncGeneratorFunction%":Pr,"%AsyncIteratorPrototype%":Pr,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":bw,"%eval%":eval,"%EvalError%":ww,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":Xf,"%GeneratorFunction%":Pr,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tr&&_e?_e(_e([][Symbol.iterator]())):G,"%JSON%":typeof JSON=="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tr||!_e?G:_e(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":yw,"%Object.getOwnPropertyDescriptor%":is,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Sw,"%ReferenceError%":_w,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tr||!_e?G:_e(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tr&&_e?_e(""[Symbol.iterator]()):G,"%Symbol%":Tr?Symbol:G,"%SyntaxError%":ai,"%ThrowTypeError%":Rw,"%TypedArray%":zw,"%TypeError%":Zr,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":kw,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":Xs,"%Function.prototype.apply%":Qf,"%Object.defineProperty%":Pw,"%Object.getPrototypeOf%":Dw,"%Math.abs%":Ew,"%Math.floor%":xw,"%Math.max%":Aw,"%Math.min%":$w,"%Math.pow%":Tw,"%Math.round%":Cw,"%Math.sign%":Iw,"%Reflect.getPrototypeOf%":Ow};if(_e)try{null.error}catch(n){var Lw=_e(_e(n));ur["%Error.prototype%"]=Lw}var Mw=function n(e){var t;if(e==="%AsyncFunction%")t=wl("async function () {}");else if(e==="%GeneratorFunction%")t=wl("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=wl("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&_e&&(t=_e(i.prototype))}return ur[e]=t,t},id={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qs=Js,ra=en,Nw=Qs.call(Xs,Array.prototype.concat),Uw=Qs.call(Qf,Array.prototype.splice),sd=Qs.call(Xs,String.prototype.replace),ia=Qs.call(Xs,String.prototype.slice),Fw=Qs.call(Xs,RegExp.prototype.exec),Zw=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Hw=/\\(\\)?/g,Bw=function(e){var t=ia(e,0,1),r=ia(e,-1);if(t==="%"&&r!=="%")throw new ai("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new ai("invalid intrinsic syntax, expected opening `%`");var i=[];return sd(e,Zw,function(s,o,a,c){i[i.length]=a?sd(c,Hw,"$1"):o||s}),i},jw=function(e,t){var r=e,i;if(ra(id,r)&&(i=id[r],r="%"+i[0]+"%"),ra(ur,r)){var s=ur[r];if(s===Pr&&(s=Mw(r)),typeof s>"u"&&!t)throw new Zr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new ai("intrinsic "+e+" does not exist!")},ot=function(e,t){if(typeof e!="string"||e.length===0)throw new Zr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Zr('"allowMissing" argument must be a boolean');if(Fw(/^%?[^%]*%?$/,e)===null)throw new ai("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Bw(e),i=r.length>0?r[0]:"",s=jw("%"+i+"%",t),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],Uw(r,Nw([0,1],u)));for(var d=1,p=!0;d<r.length;d+=1){var y=r[d],v=ia(y,0,1),$=ia(y,-1);if((v==='"'||v==="'"||v==="`"||$==='"'||$==="'"||$==="`")&&v!==$)throw new ai("property names with quotes must have matching quotes");if((y==="constructor"||!p)&&(c=!0),i+="."+y,o="%"+i+"%",ra(ur,o))a=ur[o];else if(a!=null){if(!(y in a)){if(!t)throw new Zr("base intrinsic for "+e+" exists, but the property is not available.");return}if(is&&d+1>=r.length){var E=is(a,y);p=!!E,p&&"get"in E&&!("originalValue"in E.get)?a=E.get:a=a[y]}else p=ra(a,y),a=a[y];p&&!c&&(ur[o]=a)}}return a},_l,od;function _n(){if(od)return _l;od=1;var n=ot,e=Za,t=e([n("%String.prototype.indexOf%")]);return _l=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},_l}var kl,ad;function wu(){if(ad)return kl;ad=1;var n=ot,e=n("%Array%"),t=!e.isArray&&_n()("Object.prototype.toString");return kl=e.isArray||function(i){return t(i)==="[object Array]"},kl}var Vw=Fa,ld=Ks,eg=Vw.hasArrayLengthDefineBug(),Gw=eg&&wu(),Ww=_n(),qw=Ww("Object.prototype.propertyIsEnumerable"),Su=function(e,t,r,i,s,o){if(!ld){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&qw(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return eg&&s==="length"&&"[[Value]]"in o&&Gw(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(ld(i,s,r(o)),!0)},Yw=W,Ii=en,Kw={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},gi=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Ii(e,t)&&!Kw[t])return!1;var r=Ii(e,"[[Value]]")||Ii(e,"[[Writable]]"),i=Ii(e,"[[Get]]")||Ii(e,"[[Set]]");if(r&&i)throw new Yw("Property Descriptors may not be both accessor and data descriptors");return!0},tg=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},Jw=W,Xw=gi,Qw=tg,ng=function(e){if(typeof e<"u"&&!Xw(e))throw new Jw("Assertion failed: `Desc` must be a Property Descriptor");return Qw(e)},e0=W,cd=en,t0=gi,rg=function(e){if(typeof e>"u")return!1;if(!t0(e))throw new e0("Assertion failed: `Desc` must be a Property Descriptor");return!(!cd(e,"[[Value]]")&&!cd(e,"[[Writable]]"))},mi=function(e){return typeof e=="string"||typeof e=="symbol"},ud=mu,ig=function(e,t){return e===t?e===0?1/e===1/t:!0:ud(e)&&ud(t)},hd=W,n0=Qt,r0=Su,i0=ng,s0=rg,o0=mi,a0=ig,_u=function(e,t,r){if(!n0(e))throw new hd("Assertion failed: Type(O) is not Object");if(!o0(t))throw new hd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return r0(s0,a0,i0,e,t,i)},sg=Function.prototype.toString,Mr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,hc,jo;if(typeof Mr=="function"&&typeof Object.defineProperty=="function")try{hc=Object.defineProperty({},"length",{get:function(){throw jo}}),jo={},Mr(function(){throw 42},null,hc)}catch(n){n!==jo&&(Mr=null)}else Mr=null;var l0=/^\s*class\b/,dc=function(e){try{var t=sg.call(e);return l0.test(t)}catch{return!1}},El=function(e){try{return dc(e)?!1:(sg.call(e),!0)}catch{return!1}},Vo=Object.prototype.toString,c0="[object Object]",u0="[object Function]",h0="[object GeneratorFunction]",d0="[object HTMLAllCollection]",p0="[object HTML document.all class]",f0="[object HTMLCollection]",g0=typeof Symbol=="function"&&!!Symbol.toStringTag,m0=!(0 in[,]),pc=function(){return!1};if(typeof document=="object"){var v0=document.all;Vo.call(v0)===Vo.call(document.all)&&(pc=function(e){if((m0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Vo.call(e);return(t===d0||t===p0||t===f0||t===c0)&&e("")==null}catch{}return!1})}var og=Mr?function(e){if(pc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Mr(e,null,hc)}catch(t){if(t!==jo)return!1}return!dc(e)&&El(e)}:function(e){if(pc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(g0)return El(e);if(dc(e))return!1;var t=Vo.call(e);return t!==u0&&t!==h0&&!/^\[object HTML/.test(t)?!1:El(e)},y0=og,b0=function(e){return!!e},St=en,wo=W,w0=Qt,dd=y0,xl=b0,S0=function(e){if(!w0(e))throw new wo("ToPropertyDescriptor requires an object");var t={};if(St(e,"enumerable")&&(t["[[Enumerable]]"]=xl(e.enumerable)),St(e,"configurable")&&(t["[[Configurable]]"]=xl(e.configurable)),St(e,"value")&&(t["[[Value]]"]=e.value),St(e,"writable")&&(t["[[Writable]]"]=xl(e.writable)),St(e,"get")){var r=e.get;if(typeof r<"u"&&!dd(r))throw new wo("getter must be a function");t["[[Get]]"]=r}if(St(e,"set")){var i=e.set;if(typeof i<"u"&&!dd(i))throw new wo("setter must be a function");t["[[Set]]"]=i}if((St(t,"[[Get]]")||St(t,"[[Set]]"))&&(St(t,"[[Value]]")||St(t,"[[Writable]]")))throw new wo("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Al=W,_0=Qt,pd=gi,k0=Su,E0=ng,x0=rg,A0=mi,$0=ig,T0=S0,C0=function(e,t,r){if(!_0(e))throw new Al("Assertion failed: Type(O) is not Object");if(!A0(t))throw new Al("Assertion failed: P is not a Property Key");var i=pd(r)?r:T0(r);if(!pd(i))throw new Al("Assertion failed: Desc is not a valid Property Descriptor");return k0(x0,$0,E0,e,t,i)},fd=W,I0=Qt,P0=C0,R0=mi,D0=function(e,t,r){if(!I0(e))throw new fd("Assertion failed: Type(O) is not Object");if(!R0(t))throw new fd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return P0(e,t,i)},O0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,z0=fu,L0=z0.setPrototypeOf||null,M0=Za,gd=pi,N0=W,ag={};try{ag.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var U0=!("toString"in ag),$l=gd&&gd(Object.prototype,"__proto__"),F0=U0&&(!!$l&&typeof $l.set=="function"&&M0([$l.set])||function(e,t){if(e==null)throw new N0("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),md=O0,Z0=L0,vd=F0,H0=W,B0=md?function(e,t){if(md(e,t))return e;throw new H0("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:Z0||(vd?function(e,t){return vd(e,t),e}:null),yd=W,j0=Qt,bd=Jf,V0=function(e){if(!j0(e))throw new yd("Assertion failed: O must be an Object");if(!bd)throw new yd("This environment does not support fetching prototypes.");return bd(e)},G0=W,W0=B0,q0=Qt,Y0=V0,K0=function(e,t){if(t!==null&&!q0(t))throw new G0("Assertion failed: V must be Object or Null");try{W0(e,t)}catch{return!1}return Y0(e)===t},Tl=_u,wd=D0,lg=K0,J0=Fa(),ku=Vf;function eo(n,e,t){var r=new ku(t);return lg(r,Go),delete r.constructor,wd(r,"error",n),wd(r,"suppressed",e),r}J0&&Object.defineProperty(eo,"prototype",{writable:!1});var Go=eo.prototype;if(!Tl(Go,"constructor",eo)||!Tl(Go,"message","")||!Tl(Go,"name","SuppressedError"))throw new ku("unable to install SuppressedError.prototype properties; please report this!");lg(eo.prototype,ku.prototype);var X0=eo,Q0=X0,cg=function(){return typeof SuppressedError=="function"?SuppressedError:Q0},eS=vr,Sd=pu(),tS=cg,nS=function(){var e=tS();return eS(Sd,{SuppressedError:e},{SuppressedError:function(){return Sd.SuppressedError!==e}}),e};nS();var rS=W,iS=gi,sS=tg,oS=function(e){if(typeof e<"u"&&!iS(e))throw new rS("Assertion failed: `Desc` must be a Property Descriptor");return sS(e)},aS=W,_d=en,lS=gi,cS=function(e){if(typeof e>"u")return!1;if(!lS(e))throw new aS("Assertion failed: `Desc` must be a Property Descriptor");return!(!_d(e,"[[Value]]")&&!_d(e,"[[Writable]]"))},kd=mu,uS=function(e,t){return e===t?e===0?1/e===1/t:!0:kd(e)&&kd(t)},vi=og,hS=function(e){return!!e},_t=en,So=W,dS=Qt,Ed=vi,Cl=hS,pS=function(e){if(!dS(e))throw new So("ToPropertyDescriptor requires an object");var t={};if(_t(e,"enumerable")&&(t["[[Enumerable]]"]=Cl(e.enumerable)),_t(e,"configurable")&&(t["[[Configurable]]"]=Cl(e.configurable)),_t(e,"value")&&(t["[[Value]]"]=e.value),_t(e,"writable")&&(t["[[Writable]]"]=Cl(e.writable)),_t(e,"get")){var r=e.get;if(typeof r<"u"&&!Ed(r))throw new So("getter must be a function");t["[[Get]]"]=r}if(_t(e,"set")){var i=e.set;if(typeof i<"u"&&!Ed(i))throw new So("setter must be a function");t["[[Set]]"]=i}if((_t(t,"[[Get]]")||_t(t,"[[Set]]"))&&(_t(t,"[[Value]]")||_t(t,"[[Writable]]")))throw new So("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Il=W,fS=Qt,xd=gi,gS=Su,mS=oS,vS=cS,yS=mi,bS=uS,wS=pS,to=function(e,t,r){if(!fS(e))throw new Il("Assertion failed: Type(O) is not Object");if(!yS(t))throw new Il("Assertion failed: P is not a Property Key");var i=xd(r)?r:wS(r);if(!xd(i))throw new Il("Assertion failed: Desc is not a valid Property Descriptor");return gS(vS,bS,mS,e,t,i)},SS=fi(),_S=SS?Symbol.dispose||Symbol("Symbol.dispose"):null,kS=fi,ES=_S,Eu=function(){return kS()&&Symbol.dispose||ES},xS=vu,AS=to,$S=Eu,TS=function(){var e=$S();return xS()&&AS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},CS=fi(),IS=CS?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,PS=fi,RS=IS,xu=function(){return PS()&&Symbol.asyncDispose||RS},DS=vu,OS=to,zS=xu,LS=function(){var e=zS();return DS()&&OS(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},MS=wu(),NS=ot,US=_n(),FS=W,ZS=MS,HS=NS("%Reflect.apply%",!0)||US("Function.prototype.apply"),Ha=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!ZS(r))throw new FS("Assertion failed: optional `argumentsList`, if provided, must be a List");return HS(e,t,r)};const BS={},jS=Object.freeze(Object.defineProperty({__proto__:null,default:BS},Symbol.toStringTag,{value:"Module"})),VS=gb(jS);var Au=typeof Map=="function"&&Map.prototype,Pl=Object.getOwnPropertyDescriptor&&Au?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,sa=Au&&Pl&&typeof Pl.get=="function"?Pl.get:null,Ad=Au&&Map.prototype.forEach,$u=typeof Set=="function"&&Set.prototype,Rl=Object.getOwnPropertyDescriptor&&$u?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,oa=$u&&Rl&&typeof Rl.get=="function"?Rl.get:null,$d=$u&&Set.prototype.forEach,GS=typeof WeakMap=="function"&&WeakMap.prototype,Qi=GS?WeakMap.prototype.has:null,WS=typeof WeakSet=="function"&&WeakSet.prototype,es=WS?WeakSet.prototype.has:null,qS=typeof WeakRef=="function"&&WeakRef.prototype,Td=qS?WeakRef.prototype.deref:null,YS=Boolean.prototype.valueOf,KS=Object.prototype.toString,JS=Function.prototype.toString,XS=String.prototype.match,Tu=String.prototype.slice,pn=String.prototype.replace,QS=String.prototype.toUpperCase,Cd=String.prototype.toLowerCase,ug=RegExp.prototype.test,Id=Array.prototype.concat,Pt=Array.prototype.join,e_=Array.prototype.slice,Pd=Math.floor,fc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Dl=Object.getOwnPropertySymbols,gc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,li=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ts=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===li||!0)?Symbol.toStringTag:null,hg=Object.prototype.propertyIsEnumerable,Rd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Dd(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||ug.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Pd(-n):Pd(n);if(r!==n){var i=String(r),s=Tu.call(e,i.length+1);return pn.call(i,t,"$&_")+"."+pn.call(pn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return pn.call(e,t,"$&_")}var mc=VS,Od=mc.custom,zd=fg(Od)?Od:null,dg={__proto__:null,double:'"',single:"'"},t_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},yi=function n(e,t,r,i){var s=t||{};if(Ft(s,"quoteStyle")&&!Ft(dg,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ft(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=Ft(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(Ft(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(Ft(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return mg(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?Dd(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?Dd(e,u):u}var d=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=d&&d>0&&typeof e=="object")return vc(e)?"[Array]":"[Object]";var p=b_(s,r);if(typeof i>"u")i=[];else if(gg(i,e)>=0)return"[Circular]";function y(yt,tn,sl){if(tn&&(i=e_.call(i),i.push(tn)),sl){var uo={depth:s.depth};return Ft(s,"quoteStyle")&&(uo.quoteStyle=s.quoteStyle),n(yt,uo,r+1,i)}return n(yt,s,r+1,i)}if(typeof e=="function"&&!Ld(e)){var v=u_(e),$=_o(e,y);return"[Function"+(v?": "+v:" (anonymous)")+"]"+($.length>0?" { "+Pt.call($,", ")+" }":"")}if(fg(e)){var E=li?pn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):gc.call(e);return typeof e=="object"&&!li?Pi(E):E}if(m_(e)){for(var I="<"+Cd.call(String(e.nodeName)),Z=e.attributes||[],P=0;P<Z.length;P++)I+=" "+Z[P].name+"="+pg(n_(Z[P].value),"double",s);return I+=">",e.childNodes&&e.childNodes.length&&(I+="..."),I+="</"+Cd.call(String(e.nodeName))+">",I}if(vc(e)){if(e.length===0)return"[]";var V=_o(e,y);return p&&!y_(V)?"["+yc(V,p)+"]":"[ "+Pt.call(V,", ")+" ]"}if(i_(e)){var O=_o(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!hg.call(e,"cause")?"{ ["+String(e)+"] "+Pt.call(Id.call("[cause]: "+y(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Pt.call(O,", ")+" }"}if(typeof e=="object"&&o){if(zd&&typeof e[zd]=="function"&&mc)return mc(e,{depth:d-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(h_(e)){var H=[];return Ad&&Ad.call(e,function(yt,tn){H.push(y(tn,e,!0)+" => "+y(yt,e))}),Md("Map",sa.call(e),H,p)}if(f_(e)){var U=[];return $d&&$d.call(e,function(yt){U.push(y(yt,e))}),Md("Set",oa.call(e),U,p)}if(d_(e))return Ol("WeakMap");if(g_(e))return Ol("WeakSet");if(p_(e))return Ol("WeakRef");if(o_(e))return Pi(y(Number(e)));if(l_(e))return Pi(y(fc.call(e)));if(a_(e))return Pi(YS.call(e));if(s_(e))return Pi(y(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof On<"u"&&e===On)return"{ [object globalThis] }";if(!r_(e)&&!Ld(e)){var ce=_o(e,y),ue=Rd?Rd(e)===Object.prototype:e instanceof Object||e.constructor===Object,Ai=e instanceof Object?"":"null prototype",co=!ue&&ts&&Object(e)===e&&ts in e?Tu.call(kn(e),8,-1):Ai?"Object":"",xe=ue||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",An=xe+(co||Ai?"["+Pt.call(Id.call([],co||[],Ai||[]),": ")+"] ":"");return ce.length===0?An+"{}":p?An+"{"+yc(ce,p)+"}":An+"{ "+Pt.call(ce,", ")+" }"}return String(e)};function pg(n,e,t){var r=t.quoteStyle||e,i=dg[r];return i+n+i}function n_(n){return pn.call(String(n),/"/g,""")}function yr(n){return!ts||!(typeof n=="object"&&(ts in n||typeof n[ts]<"u"))}function vc(n){return kn(n)==="[object Array]"&&yr(n)}function r_(n){return kn(n)==="[object Date]"&&yr(n)}function Ld(n){return kn(n)==="[object RegExp]"&&yr(n)}function i_(n){return kn(n)==="[object Error]"&&yr(n)}function s_(n){return kn(n)==="[object String]"&&yr(n)}function o_(n){return kn(n)==="[object Number]"&&yr(n)}function a_(n){return kn(n)==="[object Boolean]"&&yr(n)}function fg(n){if(li)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!gc)return!1;try{return gc.call(n),!0}catch{}return!1}function l_(n){if(!n||typeof n!="object"||!fc)return!1;try{return fc.call(n),!0}catch{}return!1}var c_=Object.prototype.hasOwnProperty||function(n){return n in this};function Ft(n,e){return c_.call(n,e)}function kn(n){return KS.call(n)}function u_(n){if(n.name)return n.name;var e=XS.call(JS.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function gg(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function h_(n){if(!sa||!n||typeof n!="object")return!1;try{sa.call(n);try{oa.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function d_(n){if(!Qi||!n||typeof n!="object")return!1;try{Qi.call(n,Qi);try{es.call(n,es)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function p_(n){if(!Td||!n||typeof n!="object")return!1;try{return Td.call(n),!0}catch{}return!1}function f_(n){if(!oa||!n||typeof n!="object")return!1;try{oa.call(n);try{sa.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function g_(n){if(!es||!n||typeof n!="object")return!1;try{es.call(n,es);try{Qi.call(n,Qi)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function m_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function mg(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return mg(Tu.call(n,0,e.maxStringLength),e)+r}var i=t_[e.quoteStyle||"single"];i.lastIndex=0;var s=pn.call(pn.call(n,i,"\\$1"),/[\x00-\x1f]/g,v_);return pg(s,"single",e)}function v_(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+QS.call(e.toString(16))}function Pi(n){return"Object("+n+")"}function Ol(n){return n+" { ? }"}function Md(n,e,t,r){var i=r?yc(t,r):Pt.call(t,", ");return n+" ("+e+") {"+i+"}"}function y_(n){for(var e=0;e<n.length;e++)if(gg(n[e],`
|
|
2
|
-
`)>=0)return!1;return!0}function
|
|
1
|
+
var gb=Object.defineProperty;var Bh=n=>{throw TypeError(n)};var mb=(n,e,t)=>e in n?gb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>mb(n,typeof e!="symbol"?e+"":e,t),vl=(n,e,t)=>e.has(n)||Bh("Cannot "+t);var l=(n,e,t)=>(vl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?Bh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),k=(n,e,t,r)=>(vl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),g=(n,e,t)=>(vl(n,e,"access private method"),t);var jh=(n,e,t,r)=>({set _(i){k(n,e,i,t)},get _(){return l(n,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vb(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Vh=Object.prototype.toString,Nf=function(e){var t=Vh.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Vh.call(e.callee)==="[object Function]"),r},yl,Gh;function yb(){if(Gh)return yl;Gh=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Nf,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 v=y.constructor;return v&&v.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},d=function(){if(typeof window>"u")return!1;for(var y in window)try{if(!u["$"+y]&&e.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1}(),p=function(y){if(typeof window>"u"||!d)return c(y);try{return c(y)}catch{return!1}};n=function(v){var $=v!==null&&typeof v=="object",E=t.call(v)==="[object Function]",I=r(v),Z=$&&t.call(v)==="[object String]",P=[];if(!$&&!E&&!I)throw new TypeError("Object.keys called on a non-object");var V=o&&E;if(Z&&v.length>0&&!e.call(v,0))for(var O=0;O<v.length;++O)P.push(String(O));if(I&&v.length>0)for(var H=0;H<v.length;++H)P.push(String(H));else for(var U in v)!(V&&U==="prototype")&&e.call(v,U)&&P.push(String(U));if(s)for(var ce=p(v),ue=0;ue<a.length;++ue)!(ce&&a[ue]==="constructor")&&e.call(v,a[ue])&&P.push(a[ue]);return P}}return yl=n,yl}var bb=Array.prototype.slice,wb=Nf,Wh=Object.keys,Fo=Wh?function(e){return Wh(e)}:yb(),qh=Object.keys;Fo.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return wb(r)?qh(bb.call(r)):qh(r)})}else Object.keys=Fo;return Object.keys||Fo};var Sb=Fo,Zo=Object.defineProperty||!1;if(Zo)try{Zo({},"a",{value:1})}catch{Zo=!1}var Ks=Zo,Xt=SyntaxError,W=TypeError,_b=Object.getOwnPropertyDescriptor,Ho=_b;if(Ho)try{Ho([],"length")}catch{Ho=null}var pi=Ho,Yh=Ks,kb=Xt,$r=W,Kh=pi,Uf=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new $r("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new $r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $r("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!Kh&&Kh(e,t);if(Yh)Yh(e,t,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new kb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},hc=Ks,Ff=function(){return!!hc};Ff.hasArrayLengthDefineBug=function(){if(!hc)return null;try{return hc([],"length",{value:1}).length!==1}catch{return!0}};var Fa=Ff,Eb=Sb,xb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Ab=Object.prototype.toString,$b=Array.prototype.concat,Jh=Uf,Tb=function(n){return typeof n=="function"&&Ab.call(n)==="[object Function]"},Zf=Fa(),Cb=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Tb(r)||!r())return}Zf?Jh(n,e,t,!0):Jh(n,e,t)},Hf=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Eb(e);xb&&(r=$b.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)Cb(n,r[i],e[r[i]],t[r[i]])};Hf.supportsDescriptors=!!Zf;var vr=Hf,Bo={exports:{}};typeof self<"u"?Bo.exports=self:typeof window<"u"?Bo.exports=window:Bo.exports=Function("return this")();var Bf=Bo.exports,Ib=Bf,jf=function(){return typeof On!="object"||!On||On.Math!==Math||On.Array!==Array?Ib:On},Pb=vr,Rb=pi,Db=jf,Ob=function(){var e=Db();if(Pb.supportsDescriptors){var t=Rb(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},zb=vr,Lb=Bf,Vf=jf,Mb=Ob,Nb=Vf(),Gf=function(){return Nb};zb(Gf,{getPolyfill:Vf,implementation:Lb,shim:Mb});var fu=Gf,Qt=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},gu=Object,Wf=Error,Ub=EvalError,Fb=RangeError,mu=ReferenceError,Zb=URIError,Hb=Math.abs,Bb=Math.floor,jb=Math.max,Vb=Math.min,Gb=Math.pow,Wb=Math.round,vu=Number.isNaN||function(e){return e!==e},qb=vu,Yb=function(e){return qb(e)||e===0?e:e<0?-1:1},fi=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0},Xh=typeof Symbol<"u"&&Symbol,Kb=fi,yu=function(){return typeof Xh!="function"||typeof Symbol!="function"||typeof Xh("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Kb()},qf=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,Jb=gu,Yf=Jb.getPrototypeOf||null,Xb="Function.prototype.bind called on incompatible ",Qb=Object.prototype.toString,ew=Math.max,tw="[object Function]",Qh=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},nw=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},rw=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},iw=function(e){var t=this;if(typeof t!="function"||Qb.apply(t)!==tw)throw new TypeError(Xb+t);for(var r=nw(arguments,1),i,s=function(){if(this instanceof i){var d=t.apply(this,Qh(r,arguments));return Object(d)===d?d:this}return t.apply(e,Qh(r,arguments))},o=ew(0,t.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+rw(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},sw=iw,Js=Function.prototype.bind||sw,bu=Function.prototype.call,bl,ed;function wu(){return ed||(ed=1,bl=Function.prototype.apply),bl}var ow=typeof Reflect<"u"&&Reflect&&Reflect.apply,aw=Js,lw=wu(),cw=bu,uw=ow,Kf=uw||aw.call(cw,lw),hw=Js,dw=W,pw=bu,fw=Kf,Za=function(e){if(e.length<1||typeof e[0]!="function")throw new dw("a function is required");return fw(hw,pw,e)},gw=Za,td=pi,Jf;try{Jf=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var wl=!!Jf&&td&&td(Object.prototype,"__proto__"),Xf=Object,nd=Xf.getPrototypeOf,mw=wl&&typeof wl.get=="function"?gw([wl.get]):typeof nd=="function"?function(e){return nd(e==null?e:Xf(e))}:!1,rd=qf,id=Yf,sd=mw,Qf=rd?function(e){return rd(e)}:id?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return id(e)}:sd?function(e){return sd(e)}:null,vw=Function.prototype.call,yw=Object.prototype.hasOwnProperty,bw=Js,en=bw.call(vw,yw),G,ww=gu,Sw=Wf,_w=Ub,kw=Fb,Ew=mu,ai=Xt,Zr=W,xw=Zb,Aw=Hb,$w=Bb,Tw=jb,Cw=Vb,Iw=Gb,Pw=Wb,Rw=Yb,eg=Function,Sl=function(n){try{return eg('"use strict"; return ('+n+").constructor;")()}catch{}},is=pi,Dw=Ks,_l=function(){throw new Zr},Ow=is?function(){try{return arguments.callee,_l}catch{try{return is(arguments,"callee").get}catch{return _l}}}():_l,Tr=yu(),_e=Qf,zw=Yf,Lw=qf,tg=wu(),Xs=bu,Pr={},Mw=typeof Uint8Array>"u"||!_e?G:_e(Uint8Array),ur={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":Tr&&_e?_e([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":Pr,"%AsyncGenerator%":Pr,"%AsyncGeneratorFunction%":Pr,"%AsyncIteratorPrototype%":Pr,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Sw,"%eval%":eval,"%EvalError%":_w,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":eg,"%GeneratorFunction%":Pr,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tr&&_e?_e(_e([][Symbol.iterator]())):G,"%JSON%":typeof JSON=="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tr||!_e?G:_e(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":ww,"%Object.getOwnPropertyDescriptor%":is,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":kw,"%ReferenceError%":Ew,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tr||!_e?G:_e(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tr&&_e?_e(""[Symbol.iterator]()):G,"%Symbol%":Tr?Symbol:G,"%SyntaxError%":ai,"%ThrowTypeError%":Ow,"%TypedArray%":Mw,"%TypeError%":Zr,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":xw,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":Xs,"%Function.prototype.apply%":tg,"%Object.defineProperty%":Dw,"%Object.getPrototypeOf%":zw,"%Math.abs%":Aw,"%Math.floor%":$w,"%Math.max%":Tw,"%Math.min%":Cw,"%Math.pow%":Iw,"%Math.round%":Pw,"%Math.sign%":Rw,"%Reflect.getPrototypeOf%":Lw};if(_e)try{null.error}catch(n){var Nw=_e(_e(n));ur["%Error.prototype%"]=Nw}var Uw=function n(e){var t;if(e==="%AsyncFunction%")t=Sl("async function () {}");else if(e==="%GeneratorFunction%")t=Sl("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Sl("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&_e&&(t=_e(i.prototype))}return ur[e]=t,t},od={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qs=Js,ra=en,Fw=Qs.call(Xs,Array.prototype.concat),Zw=Qs.call(tg,Array.prototype.splice),ad=Qs.call(Xs,String.prototype.replace),ia=Qs.call(Xs,String.prototype.slice),Hw=Qs.call(Xs,RegExp.prototype.exec),Bw=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,jw=/\\(\\)?/g,Vw=function(e){var t=ia(e,0,1),r=ia(e,-1);if(t==="%"&&r!=="%")throw new ai("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new ai("invalid intrinsic syntax, expected opening `%`");var i=[];return ad(e,Bw,function(s,o,a,c){i[i.length]=a?ad(c,jw,"$1"):o||s}),i},Gw=function(e,t){var r=e,i;if(ra(od,r)&&(i=od[r],r="%"+i[0]+"%"),ra(ur,r)){var s=ur[r];if(s===Pr&&(s=Uw(r)),typeof s>"u"&&!t)throw new Zr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new ai("intrinsic "+e+" does not exist!")},ot=function(e,t){if(typeof e!="string"||e.length===0)throw new Zr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Zr('"allowMissing" argument must be a boolean');if(Hw(/^%?[^%]*%?$/,e)===null)throw new ai("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Vw(e),i=r.length>0?r[0]:"",s=Gw("%"+i+"%",t),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],Zw(r,Fw([0,1],u)));for(var d=1,p=!0;d<r.length;d+=1){var y=r[d],v=ia(y,0,1),$=ia(y,-1);if((v==='"'||v==="'"||v==="`"||$==='"'||$==="'"||$==="`")&&v!==$)throw new ai("property names with quotes must have matching quotes");if((y==="constructor"||!p)&&(c=!0),i+="."+y,o="%"+i+"%",ra(ur,o))a=ur[o];else if(a!=null){if(!(y in a)){if(!t)throw new Zr("base intrinsic for "+e+" exists, but the property is not available.");return}if(is&&d+1>=r.length){var E=is(a,y);p=!!E,p&&"get"in E&&!("originalValue"in E.get)?a=E.get:a=a[y]}else p=ra(a,y),a=a[y];p&&!c&&(ur[o]=a)}}return a},kl,ld;function _n(){if(ld)return kl;ld=1;var n=ot,e=Za,t=e([n("%String.prototype.indexOf%")]);return kl=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},kl}var El,cd;function Su(){if(cd)return El;cd=1;var n=ot,e=n("%Array%"),t=!e.isArray&&_n()("Object.prototype.toString");return El=e.isArray||function(i){return t(i)==="[object Array]"},El}var Ww=Fa,ud=Ks,ng=Ww.hasArrayLengthDefineBug(),qw=ng&&Su(),Yw=_n(),Kw=Yw("Object.prototype.propertyIsEnumerable"),_u=function(e,t,r,i,s,o){if(!ud){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&Kw(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return ng&&s==="length"&&"[[Value]]"in o&&qw(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(ud(i,s,r(o)),!0)},Jw=W,Ii=en,Xw={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},gi=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Ii(e,t)&&!Xw[t])return!1;var r=Ii(e,"[[Value]]")||Ii(e,"[[Writable]]"),i=Ii(e,"[[Get]]")||Ii(e,"[[Set]]");if(r&&i)throw new Jw("Property Descriptors may not be both accessor and data descriptors");return!0},rg=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},Qw=W,e0=gi,t0=rg,ig=function(e){if(typeof e<"u"&&!e0(e))throw new Qw("Assertion failed: `Desc` must be a Property Descriptor");return t0(e)},n0=W,hd=en,r0=gi,sg=function(e){if(typeof e>"u")return!1;if(!r0(e))throw new n0("Assertion failed: `Desc` must be a Property Descriptor");return!(!hd(e,"[[Value]]")&&!hd(e,"[[Writable]]"))},mi=function(e){return typeof e=="string"||typeof e=="symbol"},dd=vu,og=function(e,t){return e===t?e===0?1/e===1/t:!0:dd(e)&&dd(t)},pd=W,i0=Qt,s0=_u,o0=ig,a0=sg,l0=mi,c0=og,ku=function(e,t,r){if(!i0(e))throw new pd("Assertion failed: Type(O) is not Object");if(!l0(t))throw new pd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return s0(a0,c0,o0,e,t,i)},ag=Function.prototype.toString,Mr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,dc,jo;if(typeof Mr=="function"&&typeof Object.defineProperty=="function")try{dc=Object.defineProperty({},"length",{get:function(){throw jo}}),jo={},Mr(function(){throw 42},null,dc)}catch(n){n!==jo&&(Mr=null)}else Mr=null;var u0=/^\s*class\b/,pc=function(e){try{var t=ag.call(e);return u0.test(t)}catch{return!1}},xl=function(e){try{return pc(e)?!1:(ag.call(e),!0)}catch{return!1}},Vo=Object.prototype.toString,h0="[object Object]",d0="[object Function]",p0="[object GeneratorFunction]",f0="[object HTMLAllCollection]",g0="[object HTML document.all class]",m0="[object HTMLCollection]",v0=typeof Symbol=="function"&&!!Symbol.toStringTag,y0=!(0 in[,]),fc=function(){return!1};if(typeof document=="object"){var b0=document.all;Vo.call(b0)===Vo.call(document.all)&&(fc=function(e){if((y0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Vo.call(e);return(t===f0||t===g0||t===m0||t===h0)&&e("")==null}catch{}return!1})}var lg=Mr?function(e){if(fc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Mr(e,null,dc)}catch(t){if(t!==jo)return!1}return!pc(e)&&xl(e)}:function(e){if(fc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(v0)return xl(e);if(pc(e))return!1;var t=Vo.call(e);return t!==d0&&t!==p0&&!/^\[object HTML/.test(t)?!1:xl(e)},w0=lg,S0=function(e){return!!e},St=en,wo=W,_0=Qt,fd=w0,Al=S0,k0=function(e){if(!_0(e))throw new wo("ToPropertyDescriptor requires an object");var t={};if(St(e,"enumerable")&&(t["[[Enumerable]]"]=Al(e.enumerable)),St(e,"configurable")&&(t["[[Configurable]]"]=Al(e.configurable)),St(e,"value")&&(t["[[Value]]"]=e.value),St(e,"writable")&&(t["[[Writable]]"]=Al(e.writable)),St(e,"get")){var r=e.get;if(typeof r<"u"&&!fd(r))throw new wo("getter must be a function");t["[[Get]]"]=r}if(St(e,"set")){var i=e.set;if(typeof i<"u"&&!fd(i))throw new wo("setter must be a function");t["[[Set]]"]=i}if((St(t,"[[Get]]")||St(t,"[[Set]]"))&&(St(t,"[[Value]]")||St(t,"[[Writable]]")))throw new wo("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},$l=W,E0=Qt,gd=gi,x0=_u,A0=ig,$0=sg,T0=mi,C0=og,I0=k0,P0=function(e,t,r){if(!E0(e))throw new $l("Assertion failed: Type(O) is not Object");if(!T0(t))throw new $l("Assertion failed: P is not a Property Key");var i=gd(r)?r:I0(r);if(!gd(i))throw new $l("Assertion failed: Desc is not a valid Property Descriptor");return x0($0,C0,A0,e,t,i)},md=W,R0=Qt,D0=P0,O0=mi,z0=function(e,t,r){if(!R0(e))throw new md("Assertion failed: Type(O) is not Object");if(!O0(t))throw new md("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return D0(e,t,i)},L0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,M0=gu,N0=M0.setPrototypeOf||null,U0=Za,vd=pi,F0=W,cg={};try{cg.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Z0=!("toString"in cg),Tl=vd&&vd(Object.prototype,"__proto__"),H0=Z0&&(!!Tl&&typeof Tl.set=="function"&&U0([Tl.set])||function(e,t){if(e==null)throw new F0("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),yd=L0,B0=N0,bd=H0,j0=W,V0=yd?function(e,t){if(yd(e,t))return e;throw new j0("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:B0||(bd?function(e,t){return bd(e,t),e}:null),wd=W,G0=Qt,Sd=Qf,W0=function(e){if(!G0(e))throw new wd("Assertion failed: O must be an Object");if(!Sd)throw new wd("This environment does not support fetching prototypes.");return Sd(e)},q0=W,Y0=V0,K0=Qt,J0=W0,X0=function(e,t){if(t!==null&&!K0(t))throw new q0("Assertion failed: V must be Object or Null");try{Y0(e,t)}catch{return!1}return J0(e)===t},Cl=ku,_d=z0,ug=X0,Q0=Fa(),Eu=Wf;function eo(n,e,t){var r=new Eu(t);return ug(r,Go),delete r.constructor,_d(r,"error",n),_d(r,"suppressed",e),r}Q0&&Object.defineProperty(eo,"prototype",{writable:!1});var Go=eo.prototype;if(!Cl(Go,"constructor",eo)||!Cl(Go,"message","")||!Cl(Go,"name","SuppressedError"))throw new Eu("unable to install SuppressedError.prototype properties; please report this!");ug(eo.prototype,Eu.prototype);var eS=eo,tS=eS,hg=function(){return typeof SuppressedError=="function"?SuppressedError:tS},nS=vr,kd=fu(),rS=hg,iS=function(){var e=rS();return nS(kd,{SuppressedError:e},{SuppressedError:function(){return kd.SuppressedError!==e}}),e};iS();var sS=W,oS=gi,aS=rg,lS=function(e){if(typeof e<"u"&&!oS(e))throw new sS("Assertion failed: `Desc` must be a Property Descriptor");return aS(e)},cS=W,Ed=en,uS=gi,hS=function(e){if(typeof e>"u")return!1;if(!uS(e))throw new cS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Ed(e,"[[Value]]")&&!Ed(e,"[[Writable]]"))},xd=vu,dS=function(e,t){return e===t?e===0?1/e===1/t:!0:xd(e)&&xd(t)},vi=lg,pS=function(e){return!!e},_t=en,So=W,fS=Qt,Ad=vi,Il=pS,gS=function(e){if(!fS(e))throw new So("ToPropertyDescriptor requires an object");var t={};if(_t(e,"enumerable")&&(t["[[Enumerable]]"]=Il(e.enumerable)),_t(e,"configurable")&&(t["[[Configurable]]"]=Il(e.configurable)),_t(e,"value")&&(t["[[Value]]"]=e.value),_t(e,"writable")&&(t["[[Writable]]"]=Il(e.writable)),_t(e,"get")){var r=e.get;if(typeof r<"u"&&!Ad(r))throw new So("getter must be a function");t["[[Get]]"]=r}if(_t(e,"set")){var i=e.set;if(typeof i<"u"&&!Ad(i))throw new So("setter must be a function");t["[[Set]]"]=i}if((_t(t,"[[Get]]")||_t(t,"[[Set]]"))&&(_t(t,"[[Value]]")||_t(t,"[[Writable]]")))throw new So("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Pl=W,mS=Qt,$d=gi,vS=_u,yS=lS,bS=hS,wS=mi,SS=dS,_S=gS,to=function(e,t,r){if(!mS(e))throw new Pl("Assertion failed: Type(O) is not Object");if(!wS(t))throw new Pl("Assertion failed: P is not a Property Key");var i=$d(r)?r:_S(r);if(!$d(i))throw new Pl("Assertion failed: Desc is not a valid Property Descriptor");return vS(bS,SS,yS,e,t,i)},kS=fi(),ES=kS?Symbol.dispose||Symbol("Symbol.dispose"):null,xS=fi,AS=ES,xu=function(){return xS()&&Symbol.dispose||AS},$S=yu,TS=to,CS=xu,IS=function(){var e=CS();return $S()&&TS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},PS=fi(),RS=PS?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,DS=fi,OS=RS,Au=function(){return DS()&&Symbol.asyncDispose||OS},zS=yu,LS=to,MS=Au,NS=function(){var e=MS();return zS()&&LS(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},US=Su(),FS=ot,ZS=_n(),HS=W,BS=US,jS=FS("%Reflect.apply%",!0)||ZS("Function.prototype.apply"),Ha=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!BS(r))throw new HS("Assertion failed: optional `argumentsList`, if provided, must be a List");return jS(e,t,r)};const VS={},GS=Object.freeze(Object.defineProperty({__proto__:null,default:VS},Symbol.toStringTag,{value:"Module"})),WS=vb(GS);var $u=typeof Map=="function"&&Map.prototype,Rl=Object.getOwnPropertyDescriptor&&$u?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,sa=$u&&Rl&&typeof Rl.get=="function"?Rl.get:null,Td=$u&&Map.prototype.forEach,Tu=typeof Set=="function"&&Set.prototype,Dl=Object.getOwnPropertyDescriptor&&Tu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,oa=Tu&&Dl&&typeof Dl.get=="function"?Dl.get:null,Cd=Tu&&Set.prototype.forEach,qS=typeof WeakMap=="function"&&WeakMap.prototype,Qi=qS?WeakMap.prototype.has:null,YS=typeof WeakSet=="function"&&WeakSet.prototype,es=YS?WeakSet.prototype.has:null,KS=typeof WeakRef=="function"&&WeakRef.prototype,Id=KS?WeakRef.prototype.deref:null,JS=Boolean.prototype.valueOf,XS=Object.prototype.toString,QS=Function.prototype.toString,e_=String.prototype.match,Cu=String.prototype.slice,pn=String.prototype.replace,t_=String.prototype.toUpperCase,Pd=String.prototype.toLowerCase,dg=RegExp.prototype.test,Rd=Array.prototype.concat,Pt=Array.prototype.join,n_=Array.prototype.slice,Dd=Math.floor,gc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ol=Object.getOwnPropertySymbols,mc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,li=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ts=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===li||!0)?Symbol.toStringTag:null,pg=Object.prototype.propertyIsEnumerable,Od=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function zd(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||dg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Dd(-n):Dd(n);if(r!==n){var i=String(r),s=Cu.call(e,i.length+1);return pn.call(i,t,"$&_")+"."+pn.call(pn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return pn.call(e,t,"$&_")}var vc=WS,Ld=vc.custom,Md=mg(Ld)?Ld:null,fg={__proto__:null,double:'"',single:"'"},r_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},yi=function n(e,t,r,i){var s=t||{};if(Ft(s,"quoteStyle")&&!Ft(fg,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ft(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=Ft(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(Ft(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(Ft(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return yg(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?zd(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?zd(e,u):u}var d=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=d&&d>0&&typeof e=="object")return yc(e)?"[Array]":"[Object]";var p=S_(s,r);if(typeof i>"u")i=[];else if(vg(i,e)>=0)return"[Circular]";function y(yt,tn,sl){if(tn&&(i=n_.call(i),i.push(tn)),sl){var uo={depth:s.depth};return Ft(s,"quoteStyle")&&(uo.quoteStyle=s.quoteStyle),n(yt,uo,r+1,i)}return n(yt,s,r+1,i)}if(typeof e=="function"&&!Nd(e)){var v=d_(e),$=_o(e,y);return"[Function"+(v?": "+v:" (anonymous)")+"]"+($.length>0?" { "+Pt.call($,", ")+" }":"")}if(mg(e)){var E=li?pn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):mc.call(e);return typeof e=="object"&&!li?Pi(E):E}if(y_(e)){for(var I="<"+Pd.call(String(e.nodeName)),Z=e.attributes||[],P=0;P<Z.length;P++)I+=" "+Z[P].name+"="+gg(i_(Z[P].value),"double",s);return I+=">",e.childNodes&&e.childNodes.length&&(I+="..."),I+="</"+Pd.call(String(e.nodeName))+">",I}if(yc(e)){if(e.length===0)return"[]";var V=_o(e,y);return p&&!w_(V)?"["+bc(V,p)+"]":"[ "+Pt.call(V,", ")+" ]"}if(o_(e)){var O=_o(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!pg.call(e,"cause")?"{ ["+String(e)+"] "+Pt.call(Rd.call("[cause]: "+y(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Pt.call(O,", ")+" }"}if(typeof e=="object"&&o){if(Md&&typeof e[Md]=="function"&&vc)return vc(e,{depth:d-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(p_(e)){var H=[];return Td&&Td.call(e,function(yt,tn){H.push(y(tn,e,!0)+" => "+y(yt,e))}),Ud("Map",sa.call(e),H,p)}if(m_(e)){var U=[];return Cd&&Cd.call(e,function(yt){U.push(y(yt,e))}),Ud("Set",oa.call(e),U,p)}if(f_(e))return zl("WeakMap");if(v_(e))return zl("WeakSet");if(g_(e))return zl("WeakRef");if(l_(e))return Pi(y(Number(e)));if(u_(e))return Pi(y(gc.call(e)));if(c_(e))return Pi(JS.call(e));if(a_(e))return Pi(y(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof On<"u"&&e===On)return"{ [object globalThis] }";if(!s_(e)&&!Nd(e)){var ce=_o(e,y),ue=Od?Od(e)===Object.prototype:e instanceof Object||e.constructor===Object,Ai=e instanceof Object?"":"null prototype",co=!ue&&ts&&Object(e)===e&&ts in e?Cu.call(kn(e),8,-1):Ai?"Object":"",xe=ue||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",An=xe+(co||Ai?"["+Pt.call(Rd.call([],co||[],Ai||[]),": ")+"] ":"");return ce.length===0?An+"{}":p?An+"{"+bc(ce,p)+"}":An+"{ "+Pt.call(ce,", ")+" }"}return String(e)};function gg(n,e,t){var r=t.quoteStyle||e,i=fg[r];return i+n+i}function i_(n){return pn.call(String(n),/"/g,""")}function yr(n){return!ts||!(typeof n=="object"&&(ts in n||typeof n[ts]<"u"))}function yc(n){return kn(n)==="[object Array]"&&yr(n)}function s_(n){return kn(n)==="[object Date]"&&yr(n)}function Nd(n){return kn(n)==="[object RegExp]"&&yr(n)}function o_(n){return kn(n)==="[object Error]"&&yr(n)}function a_(n){return kn(n)==="[object String]"&&yr(n)}function l_(n){return kn(n)==="[object Number]"&&yr(n)}function c_(n){return kn(n)==="[object Boolean]"&&yr(n)}function mg(n){if(li)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!mc)return!1;try{return mc.call(n),!0}catch{}return!1}function u_(n){if(!n||typeof n!="object"||!gc)return!1;try{return gc.call(n),!0}catch{}return!1}var h_=Object.prototype.hasOwnProperty||function(n){return n in this};function Ft(n,e){return h_.call(n,e)}function kn(n){return XS.call(n)}function d_(n){if(n.name)return n.name;var e=e_.call(QS.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function vg(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function p_(n){if(!sa||!n||typeof n!="object")return!1;try{sa.call(n);try{oa.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function f_(n){if(!Qi||!n||typeof n!="object")return!1;try{Qi.call(n,Qi);try{es.call(n,es)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function g_(n){if(!Id||!n||typeof n!="object")return!1;try{return Id.call(n),!0}catch{}return!1}function m_(n){if(!oa||!n||typeof n!="object")return!1;try{oa.call(n);try{sa.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function v_(n){if(!es||!n||typeof n!="object")return!1;try{es.call(n,es);try{Qi.call(n,Qi)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function y_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function yg(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return yg(Cu.call(n,0,e.maxStringLength),e)+r}var i=r_[e.quoteStyle||"single"];i.lastIndex=0;var s=pn.call(pn.call(n,i,"\\$1"),/[\x00-\x1f]/g,b_);return gg(s,"single",e)}function b_(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+t_.call(e.toString(16))}function Pi(n){return"Object("+n+")"}function zl(n){return n+" { ? }"}function Ud(n,e,t,r){var i=r?bc(t,r):Pt.call(t,", ");return n+" ("+e+") {"+i+"}"}function w_(n){for(var e=0;e<n.length;e++)if(vg(n[e],`
|
|
2
|
+
`)>=0)return!1;return!0}function S_(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Pt.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Pt.call(Array(e+1),t)}}function bc(n,e){if(n.length===0)return"";var t=`
|
|
3
3
|
`+e.prev+e.base;return t+Pt.call(n,","+t)+`
|
|
4
|
-
`+e.prev}function _o(n,e){var t=vc(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Ft(n,i)?e(n[i],n):""}var s=typeof Dl=="function"?Dl(n):[],o;if(li){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)Ft(n,c)&&(t&&String(Number(c))===c&&c<n.length||li&&o["$"+c]instanceof Symbol||(ug.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof Dl=="function")for(var u=0;u<s.length;u++)hg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var w_=yi,S_=W,Ba=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},__=function(n,e){if(n){var t=Ba(n,e);return t&&t.value}},k_=function(n,e,t){var r=Ba(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},E_=function(n,e){return n?!!Ba(n,e):!1},x_=function(n,e){if(n)return Ba(n,e,!0)},A_=function(){var e,t={assert:function(r){if(!t.has(r))throw new S_("Side channel does not contain "+w_(r))},delete:function(r){var i=e&&e.next,s=x_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return __(e,r)},has:function(r){return E_(e,r)},set:function(r,i){e||(e={next:void 0}),k_(e,r,i)}};return t},$_=ot,no=_n(),T_=yi,C_=W,Nd=$_("%Map%",!0),I_=no("Map.prototype.get",!0),P_=no("Map.prototype.set",!0),R_=no("Map.prototype.has",!0),D_=no("Map.prototype.delete",!0),O_=no("Map.prototype.size",!0),vg=!!Nd&&function(){var e,t={assert:function(r){if(!t.has(r))throw new C_("Side channel does not contain "+T_(r))},delete:function(r){if(e){var i=D_(e,r);return O_(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return I_(e,r)},has:function(r){return e?R_(e,r):!1},set:function(r,i){e||(e=new Nd),P_(e,r,i)}};return t},z_=ot,ja=_n(),L_=yi,ko=vg,M_=W,Cr=z_("%WeakMap%",!0),N_=ja("WeakMap.prototype.get",!0),U_=ja("WeakMap.prototype.set",!0),F_=ja("WeakMap.prototype.has",!0),Z_=ja("WeakMap.prototype.delete",!0),H_=Cr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new M_("Side channel does not contain "+L_(i))},delete:function(i){if(Cr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Z_(e,i)}else if(ko&&t)return t.delete(i);return!1},get:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?N_(e,i):t&&t.get(i)},has:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?F_(e,i):!!t&&t.has(i)},set:function(i,s){Cr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Cr),U_(e,i,s)):ko&&(t||(t=ko()),t.set(i,s))}};return r}:ko,B_=W,j_=yi,V_=A_,G_=vg,W_=H_,q_=W_||G_||V_,Y_=function(){var e,t={assert:function(r){if(!t.has(r))throw new B_("Side channel does not contain "+j_(r))},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=q_()),e.set(r,i)}};return t},K_=en,Ri=Y_(),Mt=W,Cu={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");if(Ri.assert(n),!Cu.has(n,e))throw new Mt("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");var t=Ri.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");var t=Ri.get(n);return!!t&&K_(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");var r=Ri.get(n);r||(r={},Ri.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Cu);var Iu=Cu,yg=Xt,fn=Iu,ro=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new yg('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');fn.set(this,"[[Type]]",e),fn.set(this,"[[Value]]",t)};ro.prototype.type=function(){return fn.get(this,"[[Type]]")};ro.prototype.value=function(){return fn.get(this,"[[Value]]")};ro.prototype["?"]=function(){var e=fn.get(this,"[[Type]]"),t=fn.get(this,"[[Value]]");if(e==="throw")throw t;return t};ro.prototype["!"]=function(){var e=fn.get(this,"[[Type]]");if(e!=="normal")throw new yg('Assertion failed: Completion Record is not of type "normal"');return fn.get(this,"[[Value]]")};var Pu=ro,J_=Pu,Ru=function(e){return new J_("normal",e)},zl,Ud;function X_(){if(Ud)return zl;Ud=1;var n=fi;return zl=function(){return n()&&!!Symbol.toStringTag},zl}var Q_=ot,Fd=Q_("%Object.defineProperty%",!0),ek=X_()(),tk=en,nk=W,Eo=ek?Symbol.toStringTag:null,bg=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new nk("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Eo&&(r||!tk(e,Eo))&&(Fd?Fd(e,Eo,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Eo]=t)},wg={exports:{}},rk=ot,Zd=Mf,ik=Fa(),Hd=pi,Bd=W,sk=rk("%Math.floor%"),ok=function(e,t){if(typeof e!="function")throw new Bd("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||sk(t)!==t)throw new Bd("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Hd){var o=Hd(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(ik?Zd(e,"length",t,!0,!0):Zd(e,"length",t)),e},ak=Js,lk=bu,ck=qf,uk=function(){return ck(ak,lk,arguments)};(function(n){var e=ok,t=Ks,r=Za,i=uk;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return e(a,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(wg);var Du=wg.exports,hk=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},dk=Object,pk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||dk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},fk=en,gk=wu(),mk=hk,vk=pk,yk=function(e){return e&&typeof e=="object"&&fk(e,"[[DisposableResourceStack]]")&&gk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||mk(e["[[DisposableResourceStack]]"],vk))},bk=Qt,wk=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(bk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},Sk=wk,Ou=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":Sk(e)},_k=W,kk=yi,Ek=mi,xk=function(e,t){if(!Ek(t))throw new _k("Assertion failed: P is not a Property Key, got "+kk(t));return e[t]},jd=W,Ak=xk,$k=vi,Tk=mi,Vd=yi,Ck=function(e,t){if(!Tk(t))throw new jd("Assertion failed: P is not a Property Key");var r=Ak(e,t);if(r!=null){if(!$k(r))throw new jd(Vd(t)+" is not a function: "+Vd(r));return r}},bc={exports:{}},Ik=ot,Pk=Ik,Gd=Pk("%Reflect.construct%",!0),aa=to;try{aa({},"",{"[[Get]]":function(){}})}catch{aa=null}if(aa&&Gd){var Wd={},qd={};aa(qd,"length",{"[[Get]]":function(){throw Wd},"[[Enumerable]]":!0}),bc.exports=function(e){try{Gd(e,qd)}catch(t){return t===Wd}}}else bc.exports=function(e){return typeof e=="function"&&!!e.prototype};var Rk=bc.exports,Ll=W,Yd=vi,Dk=Rk,Ok=function(e){if(!Dk(e))throw new Ll("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new Ll("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!Yd(t["[[Resolve]]"])||!Yd(t["[[Reject]]"]))throw new Ll("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},Kd=Xt,zk=W,Ml=Ha,Jd=Ck,Lk=Ok,Mk=Ou,Xd=Eu(),Qd=xu(),Nk=function(e,t){if(Mk(e)!=="Object")throw new zk("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new Kd("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&Qd&&(r=Jd(e,Qd)),!r){if(!Xd)throw new Kd("`Symbol.dispose` is not supported");if(r=Jd(e,Xd),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=Lk(Promise);try{Ml(r,i),Ml(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Ml(r,i)}}return r},Uk=Xt,Nl=W,Fk=vi,Zk=Ou,Hk=Nk,Bk=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new Uk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&Zk(e)!=="Object")throw new Nl("`V` must be an Object, or `null` or `undefined`");if(r=Hk(e,t),typeof r>"u")throw new Nl("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!Fk(r))throw new Nl("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},jk=Xt,xo=W,Vk=yk,ep=Bk,Gk=_n(),Wk=Gk("Array.prototype.push"),Sg=function(e,t,r){if(!Vk(e))throw new xo("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new jk("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 xo("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new xo("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=ep(t,r)}else{if(typeof t<"u")throw new xo("Assertion failed: `V` must be undefined when `method` is present");s=ep(void 0,r,i)}return Wk(e["[[DisposableResourceStack]]"],s),"UNUSED"},Ul,tp;function zu(){if(tp)return Ul;tp=1;var n=ot,e=Du,t=Xt,r=n("%Promise.resolve%",!0),i=r&&e(r);return Ul=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},Ul}var Fl,np;function qk(){if(np)return Fl;np=1;var n=ot,e=Xt,t=n("%Promise%",!0),r=Ha,i=zu(),s=Ou;return Fl=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var d=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(t,d)},Fl}var Zl,rp;function Yk(){if(rp)return Zl;rp=1;var n=Pu;return Zl=function(t){return new n("throw",t)},Zl}var Kk=ot,Hl=Xt,ip=W,Jk=Kk("%Promise%",!0),Xk=_n(),sp=Xk("Promise.prototype.then",!0),Qk=Pu,op=qk(),eE=Ru,tE=zu(),ap=Yk(),nE=cg(),_g=function(e,t){if(!(t instanceof Qk))throw new ip("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new ip("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 Hl("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&tE(Jk,t),a=function(y){if(t.type()==="throw"){var v=t.value(),$=new nE(y,v);t=ap($)}else t=ap(y)},c=i==="ASYNC-DISPOSE"&&function(v){return sp(o,function(){var $=op(v["[[ResourceValue]]"],v["[[Hint]]"],v["[[DisposeMethod]]"]);if(!$)throw new Hl("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return sp($,eE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var d=r[u];try{var p=op(d["[[ResourceValue]]"],d["[[Hint]]"],d["[[DisposeMethod]]"]);if(p)throw new Hl("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){a(y)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},kg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},Va=gu,Lu=W,rE=Ha,bi=_u,iE=to,Eg=vi,sE=Ru,Ge=Iu,oE=bg,xg=vr.supportsDescriptors,aE=Du,Mu=Sg,lE=_g,Ag=kg,lp=Eu(),rt=function n(){if(!(this instanceof n)||Ge.has(this,"[[DisposableState]]")||Ge.has(this,"[[DisposeCapability]]"))throw new Lu("can only be used with new");Ge.set(this,"[[DisposableState]]","PENDING"),Ge.set(this,"[[DisposeCapability]]",Ag())},$g=function(){var e=this;return Ge.assert(e,"[[DisposableState]]"),Ge.get(e,"[[DisposableState]]")==="DISPOSED"},io=aE($g);xg?iE(rt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":$g}):rt.prototype.disposed=!1;var Tg=function(e){Ge.set(e,"[[DisposableState]]","DISPOSED"),xg||(e.disposed=!0)};bi(rt.prototype,"dispose",function(){var e=this;if(!io(e))return Tg(e),lE(Ge.get(e,"[[DisposeCapability]]"),sE())["?"]()});bi(rt.prototype,"use",function(e){var t=this;if(io(t))throw new Va("a disposed stack can not use anything new");return Mu(Ge.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});bi(rt.prototype,"adopt",function(e,t){var r=this;if(io(r))throw new Va("a disposed stack can not use anything new");if(!Eg(t))throw new Lu("`onDispose` must be a function");var i=function(){return rE(t,void 0,[e])};return Mu(Ge.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});bi(rt.prototype,"defer",function(e){var t=this;if(io(t))throw new Va("a disposed stack can not defer anything new");if(!Eg(e))throw new Lu("`onDispose` must be a function");Mu(Ge.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});bi(rt.prototype,"move",function(){var e=this;if(io(e))throw new Va("a disposed stack can not use anything new");var t=new rt;return Ge.set(t,"[[DisposeCapability]]",Ge.get(e,"[[DisposeCapability]]")),Ge.set(e,"[[DisposeCapability]]",Ag()),Tg(e),t});lp&&bi(rt.prototype,lp,rt.prototype.dispose);oE(rt.prototype,"DisposableStack");var cE=rt,uE=cE,hE=function(){return typeof DisposableStack=="function"?DisposableStack:uE},dE=vr,pE=pu(),fE=hE,gE=function(){var e=fE();return dE(pE,{DisposableStack:e},{DisposableStack:!0}),e},mE=ot,Ga=gu,Nu=W,cp=mE("%Promise%",!0),Uu=Sg,vE=Ha,wi=_u,yE=to,bE=_g,Cg=vi,Ig=kg,wE=Ru,up=zu(),We=Iu,SE=bg,Pg=vr.supportsDescriptors,_E=Du,kE=_n(),EE=kE("Promise.prototype.then",!0),hp=xu(),it=function n(){if(!(this instanceof n)||We.has(this,"[[AsyncDisposableState]]")||We.has(this,"[[DisposeCapability]]"))throw new Nu("can only be used with new");We.set(this,"[[AsyncDisposableState]]","pending"),We.set(this,"[[DisposeCapability]]",Ig())},Rg=function(){var e=this;return We.assert(e,"[[AsyncDisposableState]]"),We.get(e,"[[AsyncDisposableState]]")==="disposed"},so=_E(Rg);Pg?yE(it.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Rg}):it.prototype.disposed=!1;var Dg=function(e){We.set(e,"[[AsyncDisposableState]]","disposed"),Pg||(e.disposed=!0)};wi(it.prototype,"disposeAsync",function(){var e=this;return so(e)?up(cp):(Dg(e),EE(up(cp,bE(We.get(e,"[[DisposeCapability]]"),wE())),function(t){return t["?"]()}))});wi(it.prototype,"use",function(e){var t=this;if(so(t))throw new Ga("a disposed stack can not use anything new");return Uu(We.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});wi(it.prototype,"adopt",function(e,t){var r=this;if(so(r))throw new Ga("a disposed stack can not use anything new");if(!Cg(t))throw new Nu("`onDisposeAsync` must be a function");var i=function(){return vE(t,void 0,[e])};return i.value=e,Uu(We.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});wi(it.prototype,"defer",function(e){var t=this;if(so(t))throw new Ga("a disposed stack can not defer anything new");if(!Cg(e))throw new Nu("`onDispose` must be a function");Uu(We.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});wi(it.prototype,"move",function(){var e=this;if(so(e))throw new Ga("a disposed stack can not use anything new");var t=new it;return We.set(t,"[[DisposeCapability]]",We.get(e,"[[DisposeCapability]]")),We.set(e,"[[DisposeCapability]]",Ig()),Dg(e),t});hp&&wi(it.prototype,hp,it.prototype.disposeAsync);SE(it.prototype,"AsyncDisposableStack");var xE=it,AE=xE,$E=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:AE},TE=vr,CE=pu(),IE=$E,PE=function(){var e=IE();return TE(CE,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},RE=TS,DE=LS,OE=gE,zE=PE,LE=function(){RE(),DE(),OE(),zE()};LE();const dp=new WeakMap;function ME(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Ir(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function pp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function NE(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class UE{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw pp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw pp();if(t.constructor.name==="AsyncFunction")throw NE();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=dp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Ir(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${Ir(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=dp.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${Ir(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>Ir(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(ME(r))throw new Error(`Factory for ${Ir(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Ir(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const qe=new UE,FE=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function ZE(n){for(const e of Object.keys(n))if(FE.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function HE(n,e){ZE(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function mt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:a,...c}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(t,{bubbles:s,cancelable:o,composed:a}),HE(this,c)}}return n}class vt extends globalThis.EventTarget{}function BE(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function Si(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);BE(this,()=>l(this,t),()=>{k(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,t)}}return t=new WeakMap,e}const jE=mt(),VE=mt(),Wo=mt(),Og="0123456789ABCDEFGHJKMNPQRSTVWXYZ",la=32,GE=16,zg=10,fp=0xffffffffffff;var Un;(function(n){n.Base32IncorrectEncoding="B32_ENC_INVALID",n.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",n.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",n.EncodeTimeNegative="ENC_TIME_NEG",n.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",n.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",n.PRNGDetectFailure="PRNG_DETECT",n.ULIDInvalid="ULID_INVALID",n.Unexpected="UNEXPECTED",n.UUIDInvalid="UUID_INVALID"})(Un||(Un={}));class Bi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function WE(n){const e=Math.floor(n()*la)%la;return Og.charAt(e)}function qE(n){const e=YE(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new Bi(Un.PRNGDetectFailure,"Failed to find a reliable PRNG")}function YE(){return XE()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function KE(n,e){let t="";for(;n>0;n--)t=WE(e)+t;return t}function JE(n,e=zg){if(isNaN(n))throw new Bi(Un.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>fp)throw new Bi(Un.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${fp}: ${n}`);if(n<0)throw new Bi(Un.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Bi(Un.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%la,r=Og.charAt(t)+r,n=(n-t)/la;return r}function XE(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Fu(n,e){const t=qE(),r=Date.now();return JE(r,zg)+KE(GE,t)}const Rt=4,Qe=6,Lg=2,wc=2,QE=Rt,ex=Qe,Zu="auto",gn="auto",zn=120,gp=75,ge=16,hr=zn*Rt+ge*(Rt-1),ca=zn*Qe+ge*(Qe-1),tx=200,nx=4,Ao=150,rx=10,mp=2,ix=4;function Mg(n){return Fg(n)}function Ng(n,e){return Fg(n.flatMap(t=>Hg(t,e)))}function Ug(n){const e=[],t=new Set;for(const r of n){if(r.type==="row"){e.push(`Top-level rows are invalid: ${r.id}`);continue}Bg(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function Nr(n){const e=Mg(n),t=Ug(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(lx)}}function Fg(n){const e=[];for(const t of n){const r=Zg(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(Kt));continue}e.push(i)}}return e}function Zg(n){switch(n.type){case"card":return[Kt(n)];case"row":{const e=n.children.map(Kt);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=Zg(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(Sc));continue}if(i.type==="row"){e.push({...i,children:i.children.map(Kt)});continue}e.push(Kt(i))}}return e.length===0?[]:e.length===1?[Sc(e[0])]:[{...n,children:e}]}}}function Hg(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[Kt(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(Kt);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>Hg(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[Sc(t[0])]:[{...n,children:t}]}}}function Bg(n,e,t,r){switch(n.type){case"card":jg(n,e,t,r);return;case"row":sx(n,e,t,r);return;case"stack":ox(n,e,t,r);return}}function jg(n,e,t,r){Hu(n.id,t),typeof n.artifactID!="string"||n.artifactID.length===0?t.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?t.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),ax(n.width)||t.push(`Card ${n.id} width must be an integer in the range 2-4`),Vg(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=Ln(n.width);e==="row"&&i<Lg&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function sx(n,e,t,r){if(Hu(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),Vg(n.height,ix)||t.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){t.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){t.push(`Row ${n.id} must contain only card nodes`);continue}jg(s,"row",t,r),i+=Ln(s.width)}i!==Rt&&t.push(`Row ${n.id} children must sum to 4 columns`)}function ox(n,e,t,r){if(Hu(n.id,t),e!=="strip"&&t.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){t.push(`Stack ${n.id} must contain at least one child`);return}let i=0,s=0;for(const a of n.children){if(a.type==="stack"){t.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(Bg(a,"stack",t,r),a.height===gn){s+=1;continue}i+=a.height}if(i>Qe&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=Qe-i;if(o<s*wc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<wc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Hu(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function ax(n){return n===Zu||Number.isInteger(n)&&n>=Lg&&n<=QE}function Vg(n,e=ex){return n===gn||Number.isInteger(n)&&n>=wc&&n<=e}function Ln(n){return n===Zu?Rt:n}function lx(n){if(n.type==="card")return{id:n.id,type:"card",width:Ln(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:Ln(n.width),height:Gg(n.height,Qe)}]};const e=cx(n.children),t=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=e[i];if(s.type==="card")t.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:Ln(s.width),height:o});else{let a=1;for(const c of s.children)t.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:Ln(c.width),height:o}),a+=Ln(c.width)}r+=o}return{id:n.id,type:"stack",width:t.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:t}}function cx(n){let e=0,t=0;for(const i of n)i.height===gn?t+=1:e+=i.height;const r=t>0?(Qe-e)/t:0;return n.map(i=>Gg(i.height,r))}function Gg(n,e){return n===gn?e:n}function Kt(n){return{...n}}function Sc(n){return n.type==="card"?Kt(n):{...n,children:n.children.map(Kt)}}function Wg(n,e={}){return{id:e.id??Fu(),type:"card",artifactID:n,width:e.width??Zu,height:e.height??gn}}function qg(n,e){return n.some(t=>Yg(t,e))}function Yg(n,e){switch(n.type){case"card":return n.artifactID===e;case"row":return n.children.some(t=>t.artifactID===e);case"stack":return n.children.some(t=>Yg(t,e))}}function vp(n){return n.layout.flatMap(Kg)}function Kg(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(Kg)}}const J=mt(),Jg=mt(),Di=mt(),ux=mt();function hx(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const dx=hx("RequestError"),px=200,fx=300;class gx{constructor(e,t){b(this,"serverURL");b(this,"token");this.serverURL=e.replace(/\/$/,""),this.token=t.token}async requestJSON(e,t,r){const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await mx(i);if(!i.ok||i.status<px||i.status>=fx)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await Bl(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await Bl(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){const i=await this.request(e,t,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await Bl(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new dx(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),Object.keys(t).length>0?t:void 0}}async function mx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function Bl(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function vx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var At,Sa,Xg;class yx{constructor(e){w(this,Sa);w(this,At);k(this,At,e)}list(){return l(this,At).requestJSON("GET","/screens")}async get(e={}){const t=await g(this,Sa,Xg).call(this,e.screenID);return l(this,At).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),l(this,At).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return l(this,At).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return l(this,At).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}At=new WeakMap,Sa=new WeakSet,Xg=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw l(this,At).createError(`screenID is required when multiple screens exist. Available screens: ${vx(t)}`)};var Oe;class bx{constructor(e){w(this,Oe);k(this,Oe,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Oe).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.screenID!==void 0&&t.set("screenID",e.screenID),e.unplaced&&t.set("unplaced","true");const r=t.toString();return l(this,Oe).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return l(this,Oe).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),l(this,Oe).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return l(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return l(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return l(this,Oe).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return l(this,Oe).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return l(this,Oe).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return l(this,Oe).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return l(this,Oe).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return l(this,Oe).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Oe=new WeakMap;var Hn;class wx{constructor(e){w(this,Hn);k(this,Hn,e)}state(){return l(this,Hn).requestJSON("GET","/viewer/state")}setActive(e){return l(this,Hn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Hn).requestJSON("POST","/viewer/focus",t)}}Hn=new WeakMap;var us;class Sx{constructor(e){w(this,us);k(this,us,e)}async list(){const{views:e}=await l(this,us).requestJSON("GET","/views");return e}}us=new WeakMap;var Zt;class _x{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Zt);k(this,Zt,new gx(e,t)),this.screens=new yx(l(this,Zt)),this.artifacts=new bx(l(this,Zt)),this.viewer=new wx(l(this,Zt)),this.views=new Sx(l(this,Zt))}health(){return l(this,Zt).requestJSON("GET","/health")}}Zt=new WeakMap;const kx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Ex=Si(vt);var Bn,Be,jn,Me,lt,sn,on,X,Pn,Qg,hs,em,tm,nm,rm,_c,kc,Ec,im;class xx extends Ex{constructor(t){var i;super();w(this,X);b(this,"id");b(this,"server");w(this,Bn);w(this,Be,new Map);w(this,jn);w(this,Me);w(this,lt);w(this,sn);w(this,on,null);w(this,hs,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&g(this,X,em).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&g(this,X,tm).call(this,r.cardID,r.artifact);break;case"artifact-updated":g(this,X,nm).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&g(this,X,rm).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new ux("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,k(this,Bn,t.localStore),k(this,jn,t.screen.name),k(this,Me,structuredClone(t.screen.layout)),k(this,lt,t.screen.starred);const r=((i=l(this,Bn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;k(this,sn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,hs)),g(this,X,Qg).call(this)}get name(){return l(this,jn)}get layout(){return l(this,Me)}get starred(){return l(this,lt)}get scrollPosition(){return l(this,sn)}get artifacts(){return l(this,Be)}setScrollPosition(t){g(this,X,Pn).call(this);const r=Math.max(0,t);r!==l(this,sn)&&(k(this,sn,r),g(this,X,im).call(this),this.dispatchEvent(new J("change")))}setLayout(t){g(this,X,Pn).call(this);const r=Mg(t);if(!Ug(r).valid)return;const s=g(this,X,kc).call(this);k(this,Me,r),k(this,on,{layout:r,snapshot:s}),this.dispatchEvent(new J("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,on))==null?void 0:o.layout)===r&&(k(this,on,null),g(this,X,Ec).call(this,s),this.dispatchEvent(new J("change")))})}rename(t){g(this,X,Pn).call(this),k(this,jn,t),this.dispatchEvent(new J("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setStarred(t){if(g(this,X,Pn).call(this),l(this,lt)===t)return;const r=l(this,lt);k(this,lt,t),this.dispatchEvent(new J("change")),this.server.client.screens.update({screenID:this.id,starred:t}).catch(()=>{this.disposed||l(this,lt)===t&&(k(this,lt,r),this.dispatchEvent(new J("change")))})}async remove(){g(this,X,Pn).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(g(this,X,Pn).call(this),!l(this,Be).has(t))return;const r=g(this,X,kc).call(this);g(this,X,_c).call(this,t),this.dispatchEvent(new J("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(g(this,X,Ec).call(this,r),this.dispatchEvent(new J("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,hs))}}Bn=new WeakMap,Be=new WeakMap,jn=new WeakMap,Me=new WeakMap,lt=new WeakMap,sn=new WeakMap,on=new WeakMap,X=new WeakSet,Pn=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},Qg=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new J("change"))}catch{}},hs=new WeakMap,em=function(t){l(this,on)&&k(this,on,null),k(this,jn,t.name),k(this,Me,structuredClone(t.layout)),k(this,lt,t.starred),this.dispatchEvent(new J("change"))},tm=function(t,r){qg(l(this,Me),r.id)||k(this,Me,[...l(this,Me),Wg(r.id,{id:t})]),l(this,Be).set(r.id,r),this.dispatchEvent(new J("change"))},nm=function(t){const r=l(this,Be).get(t.id);r&&(l(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new J("change")))},rm=function(t){g(this,X,_c).call(this,t)&&this.dispatchEvent(new J("change"))},_c=function(t){const r=l(this,Be).delete(t),i=vp({layout:l(this,Me)}).length,s=Ng(l(this,Me),t),o=vp({layout:s}).length;return k(this,Me,s),r||i!==o},kc=function(){return{layout:structuredClone(l(this,Me)),artifacts:new Map([...l(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Ec=function(t){k(this,Me,structuredClone(t.layout)),l(this,Be).clear();for(const[r,i]of t.artifacts)l(this,Be).set(r,structuredClone(i))},im=function(){const t=l(this,Bn).get();l(this,Bn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:l(this,sn)}}})};const Ax=Si(vt);var et,$t,ct,ds,ps,fs,Br,qo;class $x extends Ax{constructor(t){super();w(this,Br);w(this,et);w(this,$t);w(this,ct,null);w(this,ds,()=>{this.disposed||g(this,Br,qo).call(this)});w(this,ps,()=>{this.disposed||g(this,Br,qo).call(this)});w(this,fs,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=l(this,ct))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=l(this,$t).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});k(this,et,t.localStore),k(this,$t,t.serverManager),l(this,et).addEventListener("change",l(this,ds)),l(this,$t).addEventListener("change",l(this,ps)),l(this,$t).addEventListener("server-event",l(this,fs)),g(this,Br,qo).call(this)}get activeScreen(){return l(this,ct)}setActive(t,r){const i=l(this,et).get();i.activeServerURL===t&&i.activeScreenID===r||l(this,et).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=l(this,et).get();t.activeScreenID!==null&&l(this,et).set({...t,activeScreenID:null})}dispose(){var t;l(this,et).removeEventListener("change",l(this,ds)),l(this,$t).removeEventListener("change",l(this,ps)),l(this,$t).removeEventListener("server-event",l(this,fs)),(t=l(this,ct))==null||t.dispose(),k(this,ct,null)}}et=new WeakMap,$t=new WeakMap,ct=new WeakMap,ds=new WeakMap,ps=new WeakMap,fs=new WeakMap,Br=new WeakSet,qo=function(){var c,u,d;const{activeServerURL:t,activeScreenID:r}=l(this,et).get(),i=t?l(this,$t).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,ct))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,ct))==null?void 0:u.server)===i||((d=l(this,ct))==null||d.dispose(),k(this,ct,i&&s?new xx({screen:s,server:i,localStore:l(this,et)}):null),this.dispatchEvent(new jE("active-screen-changed")))};const Tx="Local",Cx="store-";function xt(n){return new URL(n).origin}function Ix(n){return{servers:[{url:xt(n),name:Tx}],activeServerURL:null,activeScreenID:null,screens:{}}}var Vn,Gn,Wn;class Px extends vt{constructor(t,r,i={}){super();w(this,Vn);w(this,Gn);w(this,Wn);k(this,Vn,`${Cx}${t}`),k(this,Gn,i.storage??Rx());const s=l(this,Gn).getItem(l(this,Vn));s===null?(k(this,Wn,r),l(this,Gn).setItem(l(this,Vn),JSON.stringify(r))):k(this,Wn,JSON.parse(s))}get(){return l(this,Wn)}set(t){k(this,Wn,t),l(this,Gn).setItem(l(this,Vn),JSON.stringify(t)),this.dispatchEvent(new J("change"))}}Vn=new WeakMap,Gn=new WeakMap,Wn=new WeakMap;function Rx(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function x(n,e,t){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),e(a,c);const u=o.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){const y=d[p];y in a||(a[y]=u[y].bind(a))}}const i=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=t!=null&&t.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,u;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class Hr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const om={};function mn(n){return om}function am(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function xc(n,e){return typeof e=="bigint"?e.toString():e}function Bu(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function ju(n){return n==null}function Vu(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function Dx(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const yp=Symbol("evaluating");function ee(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==yp)return r===void 0&&(r=yp,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function br(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function En(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function bp(n){return JSON.stringify(n)}function Ox(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const lm="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ua(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const zx=Bu(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ci(n){if(ua(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(ua(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function cm(n){return ci(n)?{...n}:Array.isArray(n)?[...n]:n}const Lx=new Set(["string","number","symbol"]);function ui(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xn(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function z(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Mx(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const Nx={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 Ux(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=t.shape[a])}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function Fx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function Zx(n,e){if(!ci(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=En(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return br(this,"shape",s),s}});return xn(n,i)}function Hx(n,e){if(!ci(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return br(this,"shape",r),r}});return xn(n,t)}function Bx(n,e){const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return br(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return xn(n,t)}function jx(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=En(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return br(this,"shape",c),c},checks:[]});return xn(e,o)}function Vx(n,e,t){const r=En(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return br(this,"shape",s),s}});return xn(e,r)}function Ur(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function Fr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function $o(n){return typeof n=="string"?n:n==null?void 0:n.message}function vn(n,e,t){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const d=$o((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??$o((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??$o((c=t.customError)==null?void 0:c.call(t,n))??$o((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=d}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Gu(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ss(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const um=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,xc,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},hm=x("$ZodError",um),dm=x("$ZodError",um,{Parent:Error});function Gx(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function Wx(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),t}const Wu=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new Hr;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>vn(c,s,mn())));throw lm(a,i==null?void 0:i.callee),a}return o.value},qu=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>vn(c,s,mn())));throw lm(a,i==null?void 0:i.callee),a}return o.value},Wa=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new Hr;return s.issues.length?{success:!1,error:new(n??hm)(s.issues.map(o=>vn(o,i,mn())))}:{success:!0,data:s.value}},qx=Wa(dm),qa=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>vn(o,i,mn())))}:{success:!0,data:s.value}},Yx=qa(dm),Kx=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wu(n)(e,t,i)},Jx=n=>(e,t,r)=>Wu(n)(e,t,r),Xx=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qu(n)(e,t,i)},Qx=n=>async(e,t,r)=>qu(n)(e,t,r),e1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wa(n)(e,t,i)},t1=n=>(e,t,r)=>Wa(n)(e,t,r),n1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qa(n)(e,t,i)},r1=n=>async(e,t,r)=>qa(n)(e,t,r),i1=/^[cC][^\s-]{8,}$/,s1=/^[0-9a-z]+$/,o1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a1=/^[0-9a-vA-V]{20}$/,l1=/^[A-Za-z0-9]{27}$/,c1=/^[a-zA-Z0-9_-]{21}$/,u1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,h1=/^([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})$/,wp=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)$/,d1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,p1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function f1(){return new RegExp(p1,"u")}const g1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,m1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,v1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,y1=/^(([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])$/,b1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pm=/^[A-Za-z0-9_-]*$/,w1=/^\+[1-9]\d{6,14}$/,fm="(?:(?:\\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])))",S1=new RegExp(`^${fm}$`);function gm(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _1(n){return new RegExp(`^${gm(n)}$`)}function k1(n){const e=gm({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${fm}T(?:${r})$`)}const E1=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},x1=/^-?\d+$/,mm=/^-?\d+(?:\.\d+)?$/,A1=/^(?:true|false)$/i,$1=/^[^A-Z]*$/,T1=/^[^a-z]*$/,Ye=x("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),vm={number:"number",bigint:"bigint",object:"date"},ym=x("$ZodCheckLessThan",(n,e)=>{Ye.init(n,e);const t=vm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),bm=x("$ZodCheckGreaterThan",(n,e)=>{Ye.init(n,e);const t=vm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),C1=x("$ZodCheckMultipleOf",(n,e)=>{Ye.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):Dx(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),I1=x("$ZodCheckNumberFormat",(n,e)=>{var o;Ye.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=Nx[e.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=x1)}),n._zod.check=a=>{const c=a.value;if(t){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),P1=x("$ZodCheckMaxLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!ju(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=Gu(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),R1=x("$ZodCheckMinLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!ju(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=Gu(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),D1=x("$ZodCheckLengthEquals",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!ju(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=Gu(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Ya=x("$ZodCheckStringFormat",(n,e)=>{var t,r;Ye.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),O1=x("$ZodCheckRegex",(n,e)=>{Ya.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),z1=x("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=$1),Ya.init(n,e)}),L1=x("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=T1),Ya.init(n,e)}),M1=x("$ZodCheckIncludes",(n,e)=>{Ye.init(n,e);const t=ui(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),N1=x("$ZodCheckStartsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`^${ui(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),U1=x("$ZodCheckEndsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`.*${ui(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),F1=x("$ZodCheckOverwrite",(n,e)=>{Ye.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class Z1{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
4
|
+
`+e.prev}function _o(n,e){var t=yc(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Ft(n,i)?e(n[i],n):""}var s=typeof Ol=="function"?Ol(n):[],o;if(li){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var c in n)Ft(n,c)&&(t&&String(Number(c))===c&&c<n.length||li&&o["$"+c]instanceof Symbol||(dg.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof Ol=="function")for(var u=0;u<s.length;u++)pg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var __=yi,k_=W,Ba=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},E_=function(n,e){if(n){var t=Ba(n,e);return t&&t.value}},x_=function(n,e,t){var r=Ba(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},A_=function(n,e){return n?!!Ba(n,e):!1},$_=function(n,e){if(n)return Ba(n,e,!0)},T_=function(){var e,t={assert:function(r){if(!t.has(r))throw new k_("Side channel does not contain "+__(r))},delete:function(r){var i=e&&e.next,s=$_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return E_(e,r)},has:function(r){return A_(e,r)},set:function(r,i){e||(e={next:void 0}),x_(e,r,i)}};return t},C_=ot,no=_n(),I_=yi,P_=W,Fd=C_("%Map%",!0),R_=no("Map.prototype.get",!0),D_=no("Map.prototype.set",!0),O_=no("Map.prototype.has",!0),z_=no("Map.prototype.delete",!0),L_=no("Map.prototype.size",!0),bg=!!Fd&&function(){var e,t={assert:function(r){if(!t.has(r))throw new P_("Side channel does not contain "+I_(r))},delete:function(r){if(e){var i=z_(e,r);return L_(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return R_(e,r)},has:function(r){return e?O_(e,r):!1},set:function(r,i){e||(e=new Fd),D_(e,r,i)}};return t},M_=ot,ja=_n(),N_=yi,ko=bg,U_=W,Cr=M_("%WeakMap%",!0),F_=ja("WeakMap.prototype.get",!0),Z_=ja("WeakMap.prototype.set",!0),H_=ja("WeakMap.prototype.has",!0),B_=ja("WeakMap.prototype.delete",!0),j_=Cr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new U_("Side channel does not contain "+N_(i))},delete:function(i){if(Cr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return B_(e,i)}else if(ko&&t)return t.delete(i);return!1},get:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?F_(e,i):t&&t.get(i)},has:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?H_(e,i):!!t&&t.has(i)},set:function(i,s){Cr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Cr),Z_(e,i,s)):ko&&(t||(t=ko()),t.set(i,s))}};return r}:ko,V_=W,G_=yi,W_=T_,q_=bg,Y_=j_,K_=Y_||q_||W_,J_=function(){var e,t={assert:function(r){if(!t.has(r))throw new V_("Side channel does not contain "+G_(r))},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=K_()),e.set(r,i)}};return t},X_=en,Ri=J_(),Mt=W,Iu={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");if(Ri.assert(n),!Iu.has(n,e))throw new Mt("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");var t=Ri.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");var t=Ri.get(n);return!!t&&X_(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Mt("`O` is not an object");if(typeof e!="string")throw new Mt("`slot` must be a string");var r=Ri.get(n);r||(r={},Ri.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Iu);var Pu=Iu,wg=Xt,fn=Pu,ro=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new wg('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');fn.set(this,"[[Type]]",e),fn.set(this,"[[Value]]",t)};ro.prototype.type=function(){return fn.get(this,"[[Type]]")};ro.prototype.value=function(){return fn.get(this,"[[Value]]")};ro.prototype["?"]=function(){var e=fn.get(this,"[[Type]]"),t=fn.get(this,"[[Value]]");if(e==="throw")throw t;return t};ro.prototype["!"]=function(){var e=fn.get(this,"[[Type]]");if(e!=="normal")throw new wg('Assertion failed: Completion Record is not of type "normal"');return fn.get(this,"[[Value]]")};var Ru=ro,Q_=Ru,Du=function(e){return new Q_("normal",e)},Ll,Zd;function ek(){if(Zd)return Ll;Zd=1;var n=fi;return Ll=function(){return n()&&!!Symbol.toStringTag},Ll}var tk=ot,Hd=tk("%Object.defineProperty%",!0),nk=ek()(),rk=en,ik=W,Eo=nk?Symbol.toStringTag:null,Sg=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new ik("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Eo&&(r||!rk(e,Eo))&&(Hd?Hd(e,Eo,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Eo]=t)},_g={exports:{}},sk=ot,Bd=Uf,ok=Fa(),jd=pi,Vd=W,ak=sk("%Math.floor%"),lk=function(e,t){if(typeof e!="function")throw new Vd("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||ak(t)!==t)throw new Vd("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&jd){var o=jd(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(ok?Bd(e,"length",t,!0,!0):Bd(e,"length",t)),e},ck=Js,uk=wu(),hk=Kf,dk=function(){return hk(ck,uk,arguments)};(function(n){var e=lk,t=Ks,r=Za,i=dk;n.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return e(a,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(_g);var Ou=_g.exports,pk=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},fk=Object,gk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||fk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},mk=en,vk=Su(),yk=pk,bk=gk,wk=function(e){return e&&typeof e=="object"&&mk(e,"[[DisposableResourceStack]]")&&vk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||yk(e["[[DisposableResourceStack]]"],bk))},Sk=Qt,_k=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(Sk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},kk=_k,zu=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":kk(e)},Ek=W,xk=yi,Ak=mi,$k=function(e,t){if(!Ak(t))throw new Ek("Assertion failed: P is not a Property Key, got "+xk(t));return e[t]},Gd=W,Tk=$k,Ck=vi,Ik=mi,Wd=yi,Pk=function(e,t){if(!Ik(t))throw new Gd("Assertion failed: P is not a Property Key");var r=Tk(e,t);if(r!=null){if(!Ck(r))throw new Gd(Wd(t)+" is not a function: "+Wd(r));return r}},wc={exports:{}},Rk=ot,Dk=Rk,qd=Dk("%Reflect.construct%",!0),aa=to;try{aa({},"",{"[[Get]]":function(){}})}catch{aa=null}if(aa&&qd){var Yd={},Kd={};aa(Kd,"length",{"[[Get]]":function(){throw Yd},"[[Enumerable]]":!0}),wc.exports=function(e){try{qd(e,Kd)}catch(t){return t===Yd}}}else wc.exports=function(e){return typeof e=="function"&&!!e.prototype};var Ok=wc.exports,Ml=W,Jd=vi,zk=Ok,Lk=function(e){if(!zk(e))throw new Ml("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new Ml("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!Jd(t["[[Resolve]]"])||!Jd(t["[[Reject]]"]))throw new Ml("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},Xd=Xt,Mk=W,Nl=Ha,Qd=Pk,Nk=Lk,Uk=zu,ep=xu(),tp=Au(),Fk=function(e,t){if(Uk(e)!=="Object")throw new Mk("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new Xd("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&tp&&(r=Qd(e,tp)),!r){if(!ep)throw new Xd("`Symbol.dispose` is not supported");if(r=Qd(e,ep),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=Nk(Promise);try{Nl(r,i),Nl(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Nl(r,i)}}return r},Zk=Xt,Ul=W,Hk=vi,Bk=zu,jk=Fk,Vk=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new Zk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&Bk(e)!=="Object")throw new Ul("`V` must be an Object, or `null` or `undefined`");if(r=jk(e,t),typeof r>"u")throw new Ul("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!Hk(r))throw new Ul("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},Gk=Xt,xo=W,Wk=wk,np=Vk,qk=_n(),Yk=qk("Array.prototype.push"),kg=function(e,t,r){if(!Wk(e))throw new xo("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new Gk("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 xo("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new xo("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=np(t,r)}else{if(typeof t<"u")throw new xo("Assertion failed: `V` must be undefined when `method` is present");s=np(void 0,r,i)}return Yk(e["[[DisposableResourceStack]]"],s),"UNUSED"},Fl,rp;function Lu(){if(rp)return Fl;rp=1;var n=ot,e=Ou,t=Xt,r=n("%Promise.resolve%",!0),i=r&&e(r);return Fl=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},Fl}var Zl,ip;function Kk(){if(ip)return Zl;ip=1;var n=ot,e=Xt,t=n("%Promise%",!0),r=Ha,i=Lu(),s=zu;return Zl=function(a,c,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var d=typeof u>"u"?u:r(u,a);if(c==="ASYNC-DISPOSE")return i(t,d)},Zl}var Hl,sp;function Jk(){if(sp)return Hl;sp=1;var n=Ru;return Hl=function(t){return new n("throw",t)},Hl}var Xk=ot,Bl=Xt,op=W,Qk=Xk("%Promise%",!0),eE=_n(),ap=eE("Promise.prototype.then",!0),tE=Ru,lp=Kk(),nE=Du,rE=Lu(),cp=Jk(),iE=hg(),Eg=function(e,t){if(!(t instanceof tE))throw new op("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new op("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 Bl("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&rE(Qk,t),a=function(y){if(t.type()==="throw"){var v=t.value(),$=new iE(y,v);t=cp($)}else t=cp(y)},c=i==="ASYNC-DISPOSE"&&function(v){return ap(o,function(){var $=lp(v["[[ResourceValue]]"],v["[[Hint]]"],v["[[DisposeMethod]]"]);if(!$)throw new Bl("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return ap($,nE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=c(r[u]);else{var d=r[u];try{var p=lp(d["[[ResourceValue]]"],d["[[Hint]]"],d["[[DisposeMethod]]"]);if(p)throw new Bl("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){a(y)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},xg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},Va=mu,Mu=W,sE=Ha,bi=ku,oE=to,Ag=vi,aE=Du,Ge=Pu,lE=Sg,$g=vr.supportsDescriptors,cE=Ou,Nu=kg,uE=Eg,Tg=xg,up=xu(),rt=function n(){if(!(this instanceof n)||Ge.has(this,"[[DisposableState]]")||Ge.has(this,"[[DisposeCapability]]"))throw new Mu("can only be used with new");Ge.set(this,"[[DisposableState]]","PENDING"),Ge.set(this,"[[DisposeCapability]]",Tg())},Cg=function(){var e=this;return Ge.assert(e,"[[DisposableState]]"),Ge.get(e,"[[DisposableState]]")==="DISPOSED"},io=cE(Cg);$g?oE(rt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Cg}):rt.prototype.disposed=!1;var Ig=function(e){Ge.set(e,"[[DisposableState]]","DISPOSED"),$g||(e.disposed=!0)};bi(rt.prototype,"dispose",function(){var e=this;if(!io(e))return Ig(e),uE(Ge.get(e,"[[DisposeCapability]]"),aE())["?"]()});bi(rt.prototype,"use",function(e){var t=this;if(io(t))throw new Va("a disposed stack can not use anything new");return Nu(Ge.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});bi(rt.prototype,"adopt",function(e,t){var r=this;if(io(r))throw new Va("a disposed stack can not use anything new");if(!Ag(t))throw new Mu("`onDispose` must be a function");var i=function(){return sE(t,void 0,[e])};return Nu(Ge.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});bi(rt.prototype,"defer",function(e){var t=this;if(io(t))throw new Va("a disposed stack can not defer anything new");if(!Ag(e))throw new Mu("`onDispose` must be a function");Nu(Ge.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});bi(rt.prototype,"move",function(){var e=this;if(io(e))throw new Va("a disposed stack can not use anything new");var t=new rt;return Ge.set(t,"[[DisposeCapability]]",Ge.get(e,"[[DisposeCapability]]")),Ge.set(e,"[[DisposeCapability]]",Tg()),Ig(e),t});up&&bi(rt.prototype,up,rt.prototype.dispose);lE(rt.prototype,"DisposableStack");var hE=rt,dE=hE,pE=function(){return typeof DisposableStack=="function"?DisposableStack:dE},fE=vr,gE=fu(),mE=pE,vE=function(){var e=mE();return fE(gE,{DisposableStack:e},{DisposableStack:!0}),e},yE=ot,Ga=mu,Uu=W,hp=yE("%Promise%",!0),Fu=kg,bE=Ha,wi=ku,wE=to,SE=Eg,Pg=vi,Rg=xg,_E=Du,dp=Lu(),We=Pu,kE=Sg,Dg=vr.supportsDescriptors,EE=Ou,xE=_n(),AE=xE("Promise.prototype.then",!0),pp=Au(),it=function n(){if(!(this instanceof n)||We.has(this,"[[AsyncDisposableState]]")||We.has(this,"[[DisposeCapability]]"))throw new Uu("can only be used with new");We.set(this,"[[AsyncDisposableState]]","pending"),We.set(this,"[[DisposeCapability]]",Rg())},Og=function(){var e=this;return We.assert(e,"[[AsyncDisposableState]]"),We.get(e,"[[AsyncDisposableState]]")==="disposed"},so=EE(Og);Dg?wE(it.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Og}):it.prototype.disposed=!1;var zg=function(e){We.set(e,"[[AsyncDisposableState]]","disposed"),Dg||(e.disposed=!0)};wi(it.prototype,"disposeAsync",function(){var e=this;return so(e)?dp(hp):(zg(e),AE(dp(hp,SE(We.get(e,"[[DisposeCapability]]"),_E())),function(t){return t["?"]()}))});wi(it.prototype,"use",function(e){var t=this;if(so(t))throw new Ga("a disposed stack can not use anything new");return Fu(We.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});wi(it.prototype,"adopt",function(e,t){var r=this;if(so(r))throw new Ga("a disposed stack can not use anything new");if(!Pg(t))throw new Uu("`onDisposeAsync` must be a function");var i=function(){return bE(t,void 0,[e])};return i.value=e,Fu(We.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});wi(it.prototype,"defer",function(e){var t=this;if(so(t))throw new Ga("a disposed stack can not defer anything new");if(!Pg(e))throw new Uu("`onDispose` must be a function");Fu(We.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});wi(it.prototype,"move",function(){var e=this;if(so(e))throw new Ga("a disposed stack can not use anything new");var t=new it;return We.set(t,"[[DisposeCapability]]",We.get(e,"[[DisposeCapability]]")),We.set(e,"[[DisposeCapability]]",Rg()),zg(e),t});pp&&wi(it.prototype,pp,it.prototype.disposeAsync);kE(it.prototype,"AsyncDisposableStack");var $E=it,TE=$E,CE=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:TE},IE=vr,PE=fu(),RE=CE,DE=function(){var e=RE();return IE(PE,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},OE=IS,zE=NS,LE=vE,ME=DE,NE=function(){OE(),zE(),LE(),ME()};NE();const fp=new WeakMap;function UE(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Ir(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function gp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function FE(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class ZE{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw gp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw gp();if(t.constructor.name==="AsyncFunction")throw FE();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=fp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Ir(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${Ir(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=fp.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${Ir(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>Ir(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(UE(r))throw new Error(`Factory for ${Ir(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Ir(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const qe=new ZE,HE=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function BE(n){for(const e of Object.keys(n))if(HE.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function jE(n,e){BE(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function mt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:a,...c}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(t,{bubbles:s,cancelable:o,composed:a}),jE(this,c)}}return n}class vt extends globalThis.EventTarget{}function VE(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function Si(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);VE(this,()=>l(this,t),()=>{k(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return l(this,t)}}return t=new WeakMap,e}const GE=mt(),WE=mt(),Wo=mt(),Lg="0123456789ABCDEFGHJKMNPQRSTVWXYZ",la=32,qE=16,Mg=10,mp=0xffffffffffff;var Un;(function(n){n.Base32IncorrectEncoding="B32_ENC_INVALID",n.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",n.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",n.EncodeTimeNegative="ENC_TIME_NEG",n.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",n.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",n.PRNGDetectFailure="PRNG_DETECT",n.ULIDInvalid="ULID_INVALID",n.Unexpected="UNEXPECTED",n.UUIDInvalid="UUID_INVALID"})(Un||(Un={}));class Bi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function YE(n){const e=Math.floor(n()*la)%la;return Lg.charAt(e)}function KE(n){const e=JE(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new Bi(Un.PRNGDetectFailure,"Failed to find a reliable PRNG")}function JE(){return ex()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function XE(n,e){let t="";for(;n>0;n--)t=YE(e)+t;return t}function QE(n,e=Mg){if(isNaN(n))throw new Bi(Un.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>mp)throw new Bi(Un.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${mp}: ${n}`);if(n<0)throw new Bi(Un.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Bi(Un.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%la,r=Lg.charAt(t)+r,n=(n-t)/la;return r}function ex(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Zu(n,e){const t=KE(),r=Date.now();return QE(r,Mg)+XE(qE,t)}const Rt=4,Qe=6,Ng=2,Sc=2,tx=Rt,nx=Qe,Hu="auto",gn="auto",zn=120,vp=75,ge=16,hr=zn*Rt+ge*(Rt-1),ca=zn*Qe+ge*(Qe-1),rx=200,ix=4,Ao=150,sx=10,yp=2,ox=4;function Ug(n){return Hg(n)}function Fg(n,e){return Hg(n.flatMap(t=>jg(t,e)))}function Zg(n){const e=[],t=new Set;for(const r of n){if(r.type==="row"){e.push(`Top-level rows are invalid: ${r.id}`);continue}Vg(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function Nr(n){const e=Ug(n),t=Zg(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(ux)}}function Hg(n){const e=[];for(const t of n){const r=Bg(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(Kt));continue}e.push(i)}}return e}function Bg(n){switch(n.type){case"card":return[Kt(n)];case"row":{const e=n.children.map(Kt);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=Bg(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(_c));continue}if(i.type==="row"){e.push({...i,children:i.children.map(Kt)});continue}e.push(Kt(i))}}return e.length===0?[]:e.length===1?[_c(e[0])]:[{...n,children:e}]}}}function jg(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[Kt(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(Kt);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>jg(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[_c(t[0])]:[{...n,children:t}]}}}function Vg(n,e,t,r){switch(n.type){case"card":Gg(n,e,t,r);return;case"row":ax(n,e,t,r);return;case"stack":lx(n,e,t,r);return}}function Gg(n,e,t,r){Bu(n.id,t),typeof n.artifactID!="string"||n.artifactID.length===0?t.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?t.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),cx(n.width)||t.push(`Card ${n.id} width must be an integer in the range 2-4`),Wg(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=Ln(n.width);e==="row"&&i<Ng&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function ax(n,e,t,r){if(Bu(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),Wg(n.height,ox)||t.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){t.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){t.push(`Row ${n.id} must contain only card nodes`);continue}Gg(s,"row",t,r),i+=Ln(s.width)}i!==Rt&&t.push(`Row ${n.id} children must sum to 4 columns`)}function lx(n,e,t,r){if(Bu(n.id,t),e!=="strip"&&t.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){t.push(`Stack ${n.id} must contain at least one child`);return}let i=0,s=0;for(const a of n.children){if(a.type==="stack"){t.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(Vg(a,"stack",t,r),a.height===gn){s+=1;continue}i+=a.height}if(i>Qe&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=Qe-i;if(o<s*Sc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Sc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Bu(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function cx(n){return n===Hu||Number.isInteger(n)&&n>=Ng&&n<=tx}function Wg(n,e=nx){return n===gn||Number.isInteger(n)&&n>=Sc&&n<=e}function Ln(n){return n===Hu?Rt:n}function ux(n){if(n.type==="card")return{id:n.id,type:"card",width:Ln(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:Ln(n.width),height:qg(n.height,Qe)}]};const e=hx(n.children),t=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=e[i];if(s.type==="card")t.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:Ln(s.width),height:o});else{let a=1;for(const c of s.children)t.push({id:c.id,artifactID:c.artifactID,col:a,row:r,width:Ln(c.width),height:o}),a+=Ln(c.width)}r+=o}return{id:n.id,type:"stack",width:t.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:t}}function hx(n){let e=0,t=0;for(const i of n)i.height===gn?t+=1:e+=i.height;const r=t>0?(Qe-e)/t:0;return n.map(i=>qg(i.height,r))}function qg(n,e){return n===gn?e:n}function Kt(n){return{...n}}function _c(n){return n.type==="card"?Kt(n):{...n,children:n.children.map(Kt)}}function Yg(n,e={}){return{id:e.id??Zu(),type:"card",artifactID:n,width:e.width??Hu,height:e.height??gn}}function Kg(n,e){return n.some(t=>Jg(t,e))}function Jg(n,e){switch(n.type){case"card":return n.artifactID===e;case"row":return n.children.some(t=>t.artifactID===e);case"stack":return n.children.some(t=>Jg(t,e))}}function bp(n){return n.layout.flatMap(Xg)}function Xg(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(Xg)}}const J=mt(),Qg=mt(),Di=mt(),dx=mt();function px(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const fx=px("RequestError"),gx=200,mx=300;class vx{constructor(e,t){b(this,"serverURL");b(this,"token");this.serverURL=e.replace(/\/$/,""),this.token=t.token}async requestJSON(e,t,r){const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await yx(i);if(!i.ok||i.status<gx||i.status>=mx)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await jl(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await jl(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){const i=await this.request(e,t,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await jl(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new fx(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),Object.keys(t).length>0?t:void 0}}async function yx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function jl(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function bx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var At,Sa,em;class wx{constructor(e){w(this,Sa);w(this,At);k(this,At,e)}list(){return l(this,At).requestJSON("GET","/screens")}async get(e={}){const t=await g(this,Sa,em).call(this,e.screenID);return l(this,At).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),l(this,At).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return l(this,At).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return l(this,At).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}At=new WeakMap,Sa=new WeakSet,em=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw l(this,At).createError(`screenID is required when multiple screens exist. Available screens: ${bx(t)}`)};var Oe;class Sx{constructor(e){w(this,Oe);k(this,Oe,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Oe).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.screenID!==void 0&&t.set("screenID",e.screenID),e.unplaced&&t.set("unplaced","true");const r=t.toString();return l(this,Oe).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return l(this,Oe).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),l(this,Oe).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return l(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return l(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return l(this,Oe).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return l(this,Oe).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return l(this,Oe).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return l(this,Oe).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return l(this,Oe).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return l(this,Oe).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Oe=new WeakMap;var Hn;class _x{constructor(e){w(this,Hn);k(this,Hn,e)}state(){return l(this,Hn).requestJSON("GET","/viewer/state")}setActive(e){return l(this,Hn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),l(this,Hn).requestJSON("POST","/viewer/focus",t)}}Hn=new WeakMap;var us;class kx{constructor(e){w(this,us);k(this,us,e)}async list(){const{views:e}=await l(this,us).requestJSON("GET","/views");return e}}us=new WeakMap;var Zt;class Ex{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Zt);k(this,Zt,new vx(e,t)),this.screens=new wx(l(this,Zt)),this.artifacts=new Sx(l(this,Zt)),this.viewer=new _x(l(this,Zt)),this.views=new kx(l(this,Zt))}health(){return l(this,Zt).requestJSON("GET","/health")}}Zt=new WeakMap;const xx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Ax=Si(vt);var Bn,Be,jn,Me,lt,sn,on,X,Pn,tm,hs,nm,rm,im,sm,kc,Ec,xc,om;class $x extends Ax{constructor(t){var i;super();w(this,X);b(this,"id");b(this,"server");w(this,Bn);w(this,Be,new Map);w(this,jn);w(this,Me);w(this,lt);w(this,sn);w(this,on,null);w(this,hs,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&g(this,X,nm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&g(this,X,rm).call(this,r.cardID,r.artifact);break;case"artifact-updated":g(this,X,im).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&g(this,X,sm).call(this,r.artifactID);break;case"artifact-content-changed":l(this,Be).has(r.artifactID)&&this.dispatchEvent(new dx("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,k(this,Bn,t.localStore),k(this,jn,t.screen.name),k(this,Me,structuredClone(t.screen.layout)),k(this,lt,t.screen.starred);const r=((i=l(this,Bn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;k(this,sn,Math.max(0,r)),this.server.addEventListener("server-event",l(this,hs)),g(this,X,tm).call(this)}get name(){return l(this,jn)}get layout(){return l(this,Me)}get starred(){return l(this,lt)}get scrollPosition(){return l(this,sn)}get artifacts(){return l(this,Be)}setScrollPosition(t){g(this,X,Pn).call(this);const r=Math.max(0,t);r!==l(this,sn)&&(k(this,sn,r),g(this,X,om).call(this),this.dispatchEvent(new J("change")))}setLayout(t){g(this,X,Pn).call(this);const r=Ug(t);if(!Zg(r).valid)return;const s=g(this,X,Ec).call(this);k(this,Me,r),k(this,on,{layout:r,snapshot:s}),this.dispatchEvent(new J("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=l(this,on))==null?void 0:o.layout)===r&&(k(this,on,null),g(this,X,xc).call(this,s),this.dispatchEvent(new J("change")))})}rename(t){g(this,X,Pn).call(this),k(this,jn,t),this.dispatchEvent(new J("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setStarred(t){if(g(this,X,Pn).call(this),l(this,lt)===t)return;const r=l(this,lt);k(this,lt,t),this.dispatchEvent(new J("change")),this.server.client.screens.update({screenID:this.id,starred:t}).catch(()=>{this.disposed||l(this,lt)===t&&(k(this,lt,r),this.dispatchEvent(new J("change")))})}async remove(){g(this,X,Pn).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(g(this,X,Pn).call(this),!l(this,Be).has(t))return;const r=g(this,X,Ec).call(this);g(this,X,kc).call(this,t),this.dispatchEvent(new J("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(g(this,X,xc).call(this,r),this.dispatchEvent(new J("change")))})}dispose(){this.server.removeEventListener("server-event",l(this,hs))}}Bn=new WeakMap,Be=new WeakMap,jn=new WeakMap,Me=new WeakMap,lt=new WeakMap,sn=new WeakMap,on=new WeakMap,X=new WeakSet,Pn=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},tm=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)l(this,Be).set(r.id,r);this.dispatchEvent(new J("change"))}catch{}},hs=new WeakMap,nm=function(t){l(this,on)&&k(this,on,null),k(this,jn,t.name),k(this,Me,structuredClone(t.layout)),k(this,lt,t.starred),this.dispatchEvent(new J("change"))},rm=function(t,r){Kg(l(this,Me),r.id)||k(this,Me,[...l(this,Me),Yg(r.id,{id:t})]),l(this,Be).set(r.id,r),this.dispatchEvent(new J("change"))},im=function(t){const r=l(this,Be).get(t.id);r&&(l(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new J("change")))},sm=function(t){g(this,X,kc).call(this,t)&&this.dispatchEvent(new J("change"))},kc=function(t){const r=l(this,Be).delete(t),i=bp({layout:l(this,Me)}).length,s=Fg(l(this,Me),t),o=bp({layout:s}).length;return k(this,Me,s),r||i!==o},Ec=function(){return{layout:structuredClone(l(this,Me)),artifacts:new Map([...l(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},xc=function(t){k(this,Me,structuredClone(t.layout)),l(this,Be).clear();for(const[r,i]of t.artifacts)l(this,Be).set(r,structuredClone(i))},om=function(){const t=l(this,Bn).get();l(this,Bn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:l(this,sn)}}})};const Tx=Si(vt);var et,$t,ct,ds,ps,fs,Br,qo;class Cx extends Tx{constructor(t){super();w(this,Br);w(this,et);w(this,$t);w(this,ct,null);w(this,ds,()=>{this.disposed||g(this,Br,qo).call(this)});w(this,ps,()=>{this.disposed||g(this,Br,qo).call(this)});w(this,fs,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=l(this,ct))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=l(this,$t).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});k(this,et,t.localStore),k(this,$t,t.serverManager),l(this,et).addEventListener("change",l(this,ds)),l(this,$t).addEventListener("change",l(this,ps)),l(this,$t).addEventListener("server-event",l(this,fs)),g(this,Br,qo).call(this)}get activeScreen(){return l(this,ct)}setActive(t,r){const i=l(this,et).get();i.activeServerURL===t&&i.activeScreenID===r||l(this,et).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=l(this,et).get();t.activeScreenID!==null&&l(this,et).set({...t,activeScreenID:null})}dispose(){var t;l(this,et).removeEventListener("change",l(this,ds)),l(this,$t).removeEventListener("change",l(this,ps)),l(this,$t).removeEventListener("server-event",l(this,fs)),(t=l(this,ct))==null||t.dispose(),k(this,ct,null)}}et=new WeakMap,$t=new WeakMap,ct=new WeakMap,ds=new WeakMap,ps=new WeakMap,fs=new WeakMap,Br=new WeakSet,qo=function(){var c,u,d;const{activeServerURL:t,activeScreenID:r}=l(this,et).get(),i=t?l(this,$t).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((c=l(this,ct))==null?void 0:c.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=l(this,ct))==null?void 0:u.server)===i||((d=l(this,ct))==null||d.dispose(),k(this,ct,i&&s?new $x({screen:s,server:i,localStore:l(this,et)}):null),this.dispatchEvent(new GE("active-screen-changed")))};const Ix="Local",Px="store-";function xt(n){return new URL(n).origin}function Rx(n){return{servers:[{url:xt(n),name:Ix}],activeServerURL:null,activeScreenID:null,screens:{}}}var Vn,Gn,Wn;class Dx extends vt{constructor(t,r,i={}){super();w(this,Vn);w(this,Gn);w(this,Wn);k(this,Vn,`${Px}${t}`),k(this,Gn,i.storage??Ox());const s=l(this,Gn).getItem(l(this,Vn));s===null?(k(this,Wn,r),l(this,Gn).setItem(l(this,Vn),JSON.stringify(r))):k(this,Wn,JSON.parse(s))}get(){return l(this,Wn)}set(t){k(this,Wn,t),l(this,Gn).setItem(l(this,Vn),JSON.stringify(t)),this.dispatchEvent(new J("change"))}}Vn=new WeakMap,Gn=new WeakMap,Wn=new WeakMap;function Ox(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function x(n,e,t){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),e(a,c);const u=o.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){const y=d[p];y in a||(a[y]=u[y].bind(a))}}const i=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var c;const u=t!=null&&t.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,u;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class Hr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class am extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const lm={};function mn(n){return lm}function cm(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Ac(n,e){return typeof e=="bigint"?e.toString():e}function ju(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function Vu(n){return n==null}function Gu(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function zx(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const wp=Symbol("evaluating");function ee(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==wp)return r===void 0&&(r=wp,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function br(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function En(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Sp(n){return JSON.stringify(n)}function Lx(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const um="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ua(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const Mx=ju(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ci(n){if(ua(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(ua(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function hm(n){return ci(n)?{...n}:Array.isArray(n)?[...n]:n}const Nx=new Set(["string","number","symbol"]);function ui(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xn(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function z(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ux(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const Fx={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 Zx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=t.shape[a])}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function Hx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function Bx(n,e){if(!ci(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=En(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return br(this,"shape",s),s}});return xn(n,i)}function jx(n,e){if(!ci(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return br(this,"shape",r),r}});return xn(n,t)}function Vx(n,e){const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return br(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return xn(n,t)}function Gx(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=En(e._zod.def,{get shape(){const a=e._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return br(this,"shape",c),c},checks:[]});return xn(e,o)}function Wx(n,e,t){const r=En(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return br(this,"shape",s),s}});return xn(e,r)}function Ur(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function Fr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function $o(n){return typeof n=="string"?n:n==null?void 0:n.message}function vn(n,e,t){var i,s,o,a,c,u;const r={...n,path:n.path??[]};if(!n.message){const d=$o((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??$o((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??$o((c=t.customError)==null?void 0:c.call(t,n))??$o((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=d}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Wu(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ss(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const dm=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Ac,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},pm=x("$ZodError",dm),fm=x("$ZodError",dm,{Parent:Error});function qx(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function Yx(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(e(s))):o[c]=o[c]||{_errors:[]},o=o[c],a++}}};return r(n),t}const qu=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new Hr;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>vn(c,s,mn())));throw um(a,i==null?void 0:i.callee),a}return o.value},Yu=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(c=>vn(c,s,mn())));throw um(a,i==null?void 0:i.callee),a}return o.value},Wa=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new Hr;return s.issues.length?{success:!1,error:new(n??pm)(s.issues.map(o=>vn(o,i,mn())))}:{success:!0,data:s.value}},Kx=Wa(fm),qa=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>vn(o,i,mn())))}:{success:!0,data:s.value}},Jx=qa(fm),Xx=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qu(n)(e,t,i)},Qx=n=>(e,t,r)=>qu(n)(e,t,r),e1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yu(n)(e,t,i)},t1=n=>async(e,t,r)=>Yu(n)(e,t,r),n1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wa(n)(e,t,i)},r1=n=>(e,t,r)=>Wa(n)(e,t,r),i1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qa(n)(e,t,i)},s1=n=>async(e,t,r)=>qa(n)(e,t,r),o1=/^[cC][^\s-]{8,}$/,a1=/^[0-9a-z]+$/,l1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,c1=/^[0-9a-vA-V]{20}$/,u1=/^[A-Za-z0-9]{27}$/,h1=/^[a-zA-Z0-9_-]{21}$/,d1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,p1=/^([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})$/,_p=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)$/,f1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,g1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function m1(){return new RegExp(g1,"u")}const v1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,y1=/^(([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}|:))$/,b1=/^((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])$/,w1=/^(([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])$/,S1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gm=/^[A-Za-z0-9_-]*$/,_1=/^\+[1-9]\d{6,14}$/,mm="(?:(?:\\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])))",k1=new RegExp(`^${mm}$`);function vm(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function E1(n){return new RegExp(`^${vm(n)}$`)}function x1(n){const e=vm({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${mm}T(?:${r})$`)}const A1=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},$1=/^-?\d+$/,ym=/^-?\d+(?:\.\d+)?$/,T1=/^(?:true|false)$/i,C1=/^[^A-Z]*$/,I1=/^[^a-z]*$/,Ye=x("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),bm={number:"number",bigint:"bigint",object:"date"},wm=x("$ZodCheckLessThan",(n,e)=>{Ye.init(n,e);const t=bm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),Sm=x("$ZodCheckGreaterThan",(n,e)=>{Ye.init(n,e);const t=bm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),P1=x("$ZodCheckMultipleOf",(n,e)=>{Ye.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):zx(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),R1=x("$ZodCheckNumberFormat",(n,e)=>{var o;Ye.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=Fx[e.format];n._zod.onattach.push(a=>{const c=a._zod.bag;c.format=e.format,c.minimum=i,c.maximum=s,t&&(c.pattern=$1)}),n._zod.check=a=>{const c=a.value;if(t){if(!Number.isInteger(c)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),D1=x("$ZodCheckMaxLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Vu(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=Wu(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),O1=x("$ZodCheckMinLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Vu(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=Wu(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),z1=x("$ZodCheckLengthEquals",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Vu(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=Wu(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Ya=x("$ZodCheckStringFormat",(n,e)=>{var t,r;Ye.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),L1=x("$ZodCheckRegex",(n,e)=>{Ya.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),M1=x("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=C1),Ya.init(n,e)}),N1=x("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=I1),Ya.init(n,e)}),U1=x("$ZodCheckIncludes",(n,e)=>{Ye.init(n,e);const t=ui(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),F1=x("$ZodCheckStartsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`^${ui(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),Z1=x("$ZodCheckEndsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`.*${ui(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),H1=x("$ZodCheckOverwrite",(n,e)=>{Ye.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class B1{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
5
5
|
`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...t,i.join(`
|
|
6
|
-
`))}}const
|
|
6
|
+
`))}}const j1={major:4,minor:3,patch:6},de=x("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=j1;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(t=n._zod).deferred??(t.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,c,u)=>{let d=Ur(a),p;for(const y of c){if(y._zod.def.when){if(!y._zod.def.when(a))continue}else if(d)continue;const v=a.issues.length,$=y._zod.check(a);if($ instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Hr;if(p||$ instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await $,a.issues.length!==v&&(d||(d=Ur(a,v)))});else{if(a.issues.length===v)continue;d||(d=Ur(a,v))}}return p?p.then(()=>a):a},o=(a,c,u)=>{if(Ur(a))return a.aborted=!0,a;const d=s(c,r,u);if(d instanceof Promise){if(u.async===!1)throw new Hr;return d.then(p=>n._zod.parse(p,u))}return n._zod.parse(d,u)};n._zod.run=(a,c)=>{if(c.skipChecks)return n._zod.parse(a,c);if(c.direction==="backward"){const d=n._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(p=>o(p,a,c)):o(d,a,c)}const u=n._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Hr;return u.then(d=>s(d,r,c))}return s(u,r,c)}}ee(n,"~standard",()=>({validate:s=>{var o;try{const a=Kx(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Jx(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}))}),Ku=x("$ZodString",(n,e)=>{var t;de.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??A1(n._zod.bag),n._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),le=x("$ZodStringFormat",(n,e)=>{Ya.init(n,e),Ku.init(n,e)}),V1=x("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=p1),le.init(n,e)}),G1=x("$ZodUUID",(n,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=_p(r))}else e.pattern??(e.pattern=_p());le.init(n,e)}),W1=x("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=f1),le.init(n,e)}),q1=x("$ZodURL",(n,e)=>{le.init(n,e),n._zod.check=t=>{try{const r=t.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=i.href:t.value=r;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),Y1=x("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=m1()),le.init(n,e)}),K1=x("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=h1),le.init(n,e)}),J1=x("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=o1),le.init(n,e)}),X1=x("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=a1),le.init(n,e)}),Q1=x("$ZodULID",(n,e)=>{e.pattern??(e.pattern=l1),le.init(n,e)}),eA=x("$ZodXID",(n,e)=>{e.pattern??(e.pattern=c1),le.init(n,e)}),tA=x("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=u1),le.init(n,e)}),nA=x("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=x1(e)),le.init(n,e)}),rA=x("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=k1),le.init(n,e)}),iA=x("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=E1(e)),le.init(n,e)}),sA=x("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=d1),le.init(n,e)}),oA=x("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=v1),le.init(n,e),n._zod.bag.format="ipv4"}),aA=x("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=y1),le.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),lA=x("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=b1),le.init(n,e)}),cA=x("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=w1),le.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function _m(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const uA=x("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=S1),le.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{_m(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function hA(n){if(!gm.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return _m(t)}const dA=x("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=gm),le.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{hA(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),pA=x("$ZodE164",(n,e)=>{e.pattern??(e.pattern=_1),le.init(n,e)});function fA(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[r]=t;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const gA=x("$ZodJWT",(n,e)=>{le.init(n,e),n._zod.check=t=>{fA(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),km=x("$ZodNumber",(n,e)=>{de.init(n,e),n._zod.pattern=n._zod.bag.pattern??ym,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),t}}),mA=x("$ZodNumberFormat",(n,e)=>{R1.init(n,e),km.init(n,e)}),vA=x("$ZodBoolean",(n,e)=>{de.init(n,e),n._zod.pattern=T1,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch{}const i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),t}}),yA=x("$ZodUnknown",(n,e)=>{de.init(n,e),n._zod.parse=t=>t}),bA=x("$ZodNever",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function kp(n,e,t){n.issues.length&&e.issues.push(...Fr(t,n.issues)),e.value[t]=n.value}const wA=x("$ZodArray",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),t;t.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],c=e.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>kp(u,t,o))):kp(c,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function ha(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Fr(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function Em(n){var r,i,s,o;const e=Object.keys(n.shape);for(const a of e)if(!((o=(s=(i=(r=n.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const t=Ux(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function xm(n,e,t,r,i,s){const o=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const p in e){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const y=c.run({value:e[p],issues:[]},r);y instanceof Promise?n.push(y.then(v=>ha(v,t,p,e,d))):ha(y,t,p,e,d)}return o.length&&t.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),n.length?Promise.all(n).then(()=>t):t}const SA=x("$ZodObject",(n,e)=>{de.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=ju(()=>Em(e));ee(n._zod,"propValues",()=>{const a=e.shape,c={};for(const u in a){const d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const p of d.values)c[u].add(p)}}return c});const i=ua,s=e.catchall;let o;n._zod.parse=(a,c)=>{o??(o=r.value);const u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),a;a.value={};const d=[],p=o.shape;for(const y of o.keys){const v=p[y],$=v._zod.optout==="optional",E=v._zod.run({value:u[y],issues:[]},c);E instanceof Promise?d.push(E.then(I=>ha(I,a,y,u,$))):ha(E,a,y,u,$)}return s?xm(d,u,a,c,r.value,n):d.length?Promise.all(d).then(()=>a):a}}),_A=x("$ZodObjectJIT",(n,e)=>{SA.init(n,e);const t=n._zod.parse,r=ju(()=>Em(e)),i=y=>{var V;const v=new B1(["shape","payload","ctx"]),$=r.value,E=O=>{const H=Sp(O);return`shape[${H}]._zod.run({ value: input[${H}], issues: [] }, ctx)`};v.write("const input = payload.value;");const I=Object.create(null);let Z=0;for(const O of $.keys)I[O]=`key_${Z++}`;v.write("const newResult = {};");for(const O of $.keys){const H=I[O],U=Sp(O),ce=y[O],ue=((V=ce==null?void 0:ce._zod)==null?void 0:V.optout)==="optional";v.write(`const ${H} = ${E(O)};`),ue?v.write(`
|
|
7
7
|
if (${H}.issues.length) {
|
|
8
8
|
if (${U} in input) {
|
|
9
9
|
payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
|
|
@@ -37,35 +37,35 @@ var pb=Object.defineProperty;var Hh=n=>{throw TypeError(n)};var fb=(n,e,t)=>e in
|
|
|
37
37
|
newResult[${U}] = ${H}.value;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
`)}v.write("payload.value = newResult;"),v.write("return payload;");const P=v.compile();return(O,H)=>P(y,O,H)};let s;const o=ua,a=!om.jitless,u=a&&zx.value,d=e.catchall;let p;n._zod.parse=(y,v)=>{p??(p=r.value);const $=y.value;return o($)?a&&u&&(v==null?void 0:v.async)===!1&&v.jitless!==!0?(s||(s=i(e.shape)),y=s(y,v),d?km([],$,y,v,p,n):y):t(y,v):(y.issues.push({expected:"object",code:"invalid_type",input:$,inst:n}),y)}});function _p(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!Ur(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>vn(o,r,mn())))}),e)}const SA=x("$ZodUnion",(n,e)=>{de.init(n,e),ee(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ee(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ee(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ee(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Vu(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const a=[];for(const c of e.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(c=>_p(c,i,n,s)):_p(a,i,n,s)}}),_A=x("$ZodIntersection",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>kp(t,c,u)):kp(t,s,o)}});function Ac(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(ci(n)&&ci(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=Ac(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=Ac(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function kp(n,e,t){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&n.issues.push({...i,keys:s}),Ur(n))return n;const o=Ac(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const kA=x("$ZodRecord",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!ci(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const d=e.valueType._zod.run({value:i[u],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&t.issues.push(...Fr(u,p.issues)),t.value[u]=p.value})):(d.issues.length&&t.issues.push(...Fr(u,d.issues)),t.value[u]=d.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&mm.test(a)&&c.issues.length){const p=e.keyType._zod.run({value:Number(a),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>vn(p,r,mn())),input:a,path:[a],inst:n});continue}const d=e.valueType._zod.run({value:i[a],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&t.issues.push(...Fr(a,p.issues)),t.value[c.value]=p.value})):(d.issues.length&&t.issues.push(...Fr(a,d.issues)),t.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>t):t}}),EA=x("$ZodEnum",(n,e)=>{de.init(n,e);const t=am(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>Lx.has(typeof i)).map(i=>typeof i=="string"?ui(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),xA=x("$ZodLiteral",(n,e)=>{if(de.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?ui(r):r?ui(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),AA=x("$ZodTransform",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new sm(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new Hr;return t.value=i,t}});function Ep(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Em=x("$ZodOptional",(n,e)=>{de.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Vu(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Ep(s,t.value)):Ep(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),$A=x("$ZodExactOptional",(n,e)=>{Em.init(n,e),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),TA=x("$ZodNullable",(n,e)=>{de.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Vu(t.source)}|null)$`):void 0}),ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),CA=x("$ZodDefault",(n,e)=>{de.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>xp(s,e)):xp(i,e)}});function xp(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const IA=x("$ZodPrefault",(n,e)=>{de.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),PA=x("$ZodNonOptional",(n,e)=>{de.init(n,e),ee(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Ap(s,n)):Ap(i,n)}});function Ap(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const RA=x("$ZodCatch",(n,e)=>{de.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>vn(o,r,mn()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>vn(s,r,mn()))},input:t.value}),t.issues=[]),t)}}),DA=x("$ZodPipe",(n,e)=>{de.init(n,e),ee(n._zod,"values",()=>e.in._zod.values),ee(n._zod,"optin",()=>e.in._zod.optin),ee(n._zod,"optout",()=>e.out._zod.optout),ee(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>To(o,e.in,r)):To(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>To(s,e.out,r)):To(i,e.out,r)}});function To(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const OA=x("$ZodReadonly",(n,e)=>{de.init(n,e),ee(n._zod,"propValues",()=>e.innerType._zod.propValues),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ee(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then($p):$p(i)}});function $p(n){return n.value=Object.freeze(n.value),n}const zA=x("$ZodCustom",(n,e)=>{Ye.init(n,e),de.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Tp(s,t,r,n));Tp(i,t,r,n)}});function Tp(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ss(i))}}var Cp;class LA{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function MA(){return new LA}(Cp=globalThis).__zod_globalRegistry??(Cp.__zod_globalRegistry=MA());const ji=globalThis.__zod_globalRegistry;function NA(n,e){return new n({type:"string",...z(e)})}function UA(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...z(e)})}function Ip(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...z(e)})}function FA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...z(e)})}function ZA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(e)})}function HA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(e)})}function BA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(e)})}function jA(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...z(e)})}function VA(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...z(e)})}function GA(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(e)})}function WA(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...z(e)})}function qA(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(e)})}function YA(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...z(e)})}function KA(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...z(e)})}function JA(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(e)})}function XA(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(e)})}function QA(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(e)})}function e$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(e)})}function t$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(e)})}function n$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...z(e)})}function r$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...z(e)})}function i$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...z(e)})}function s$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...z(e)})}function o$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(e)})}function a$(n,e){return new n({type:"string",format:"date",check:"string_format",...z(e)})}function l$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...z(e)})}function c$(n,e){return new n({type:"string",format:"duration",check:"string_format",...z(e)})}function u$(n,e){return new n({type:"number",checks:[],...z(e)})}function h$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...z(e)})}function d$(n,e){return new n({type:"boolean",...z(e)})}function p$(n){return new n({type:"unknown"})}function f$(n,e){return new n({type:"never",...z(e)})}function Pp(n,e){return new ym({check:"less_than",...z(e),value:n,inclusive:!1})}function jl(n,e){return new ym({check:"less_than",...z(e),value:n,inclusive:!0})}function Rp(n,e){return new bm({check:"greater_than",...z(e),value:n,inclusive:!1})}function Vl(n,e){return new bm({check:"greater_than",...z(e),value:n,inclusive:!0})}function Dp(n,e){return new C1({check:"multiple_of",...z(e),value:n})}function xm(n,e){return new P1({check:"max_length",...z(e),maximum:n})}function da(n,e){return new R1({check:"min_length",...z(e),minimum:n})}function Am(n,e){return new D1({check:"length_equals",...z(e),length:n})}function g$(n,e){return new O1({check:"string_format",format:"regex",...z(e),pattern:n})}function m$(n){return new z1({check:"string_format",format:"lowercase",...z(n)})}function v$(n){return new L1({check:"string_format",format:"uppercase",...z(n)})}function y$(n,e){return new M1({check:"string_format",format:"includes",...z(e),includes:n})}function b$(n,e){return new N1({check:"string_format",format:"starts_with",...z(e),prefix:n})}function w$(n,e){return new U1({check:"string_format",format:"ends_with",...z(e),suffix:n})}function _i(n){return new F1({check:"overwrite",tx:n})}function S$(n){return _i(e=>e.normalize(n))}function _$(){return _i(n=>n.trim())}function k$(){return _i(n=>n.toLowerCase())}function E$(){return _i(n=>n.toUpperCase())}function x$(){return _i(n=>Ox(n))}function A$(n,e,t){return new n({type:"array",element:e,...z(t)})}function $$(n,e,t){return new n({type:"custom",check:"custom",fn:e,...z(t)})}function T$(n){const e=C$(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(ss(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(ss(i))}},n(t.value,t)));return e}function C$(n,e){const t=new Ye({check:"custom",...z(e)});return t._zod.check=n,t}function $m(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??ji,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function ye(n,e,t={path:[],schemaPath:[]}){var d,p;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const a=(p=(d=n._zod).toJSONSchema)==null?void 0:p.call(d);if(a)o.schema=a;else{const y={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,y);else{const $=o.schema,E=e.processors[i.type];if(!E)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);E(n,e,$,y)}const v=n._zod.parent;v&&(o.ref||(o.ref=v),ye(v,e,y),e.seen.get(v).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Le(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function Tm(n,e){var o,a,c,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of n.seen.entries()){const p=(o=n.metadataRegistry.get(d[0]))==null?void 0:o.id;if(p){const y=r.get(p);if(y&&y!==d[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,d[0])}}const i=d=>{var E;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(E=n.external.registry.get(d[0]))==null?void 0:E.id,Z=n.external.uri??(V=>V);if(I)return{ref:Z(I)};const P=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=P,{defId:P,ref:`${Z("__shared")}#/${p}/${P}`}}if(d[1]===t)return{ref:"#"};const v=`#/${p}/`,$=d[1].schema.id??`__schema${n.counter++}`;return{defId:$,ref:v+$}},s=d=>{if(d[1].schema.$ref)return;const p=d[1],{ref:y,defId:v}=i(d);p.def={...p.schema},v&&(p.defId=v);const $=p.schema;for(const E in $)delete $[E];$.$ref=y};if(n.cycles==="throw")for(const d of n.seen.entries()){const p=d[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
|
|
40
|
+
`)}v.write("payload.value = newResult;"),v.write("return payload;");const P=v.compile();return(O,H)=>P(y,O,H)};let s;const o=ua,a=!lm.jitless,u=a&&Mx.value,d=e.catchall;let p;n._zod.parse=(y,v)=>{p??(p=r.value);const $=y.value;return o($)?a&&u&&(v==null?void 0:v.async)===!1&&v.jitless!==!0?(s||(s=i(e.shape)),y=s(y,v),d?xm([],$,y,v,p,n):y):t(y,v):(y.issues.push({expected:"object",code:"invalid_type",input:$,inst:n}),y)}});function Ep(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!Ur(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>vn(o,r,mn())))}),e)}const kA=x("$ZodUnion",(n,e)=>{de.init(n,e),ee(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ee(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ee(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ee(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Gu(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const a=[];for(const c of e.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(c=>Ep(c,i,n,s)):Ep(a,i,n,s)}}),EA=x("$ZodIntersection",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,u])=>xp(t,c,u)):xp(t,s,o)}});function $c(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(ci(n)&&ci(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=$c(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=$c(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function xp(n,e,t){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&n.issues.push({...i,keys:s}),Ur(n))return n;const o=$c(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const xA=x("$ZodRecord",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!ci(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const d=e.valueType._zod.run({value:i[u],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&t.issues.push(...Fr(u,p.issues)),t.value[u]=p.value})):(d.issues.length&&t.issues.push(...Fr(u,d.issues)),t.value[u]=d.value)}let c;for(const u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let c=e.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&ym.test(a)&&c.issues.length){const p=e.keyType._zod.run({value:Number(a),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>vn(p,r,mn())),input:a,path:[a],inst:n});continue}const d=e.valueType._zod.run({value:i[a],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&t.issues.push(...Fr(a,p.issues)),t.value[c.value]=p.value})):(d.issues.length&&t.issues.push(...Fr(a,d.issues)),t.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>t):t}}),AA=x("$ZodEnum",(n,e)=>{de.init(n,e);const t=cm(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>Nx.has(typeof i)).map(i=>typeof i=="string"?ui(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),$A=x("$ZodLiteral",(n,e)=>{if(de.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?ui(r):r?ui(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),TA=x("$ZodTransform",(n,e)=>{de.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new am(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new Hr;return t.value=i,t}});function Ap(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Am=x("$ZodOptional",(n,e)=>{de.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Gu(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Ap(s,t.value)):Ap(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),CA=x("$ZodExactOptional",(n,e)=>{Am.init(n,e),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),IA=x("$ZodNullable",(n,e)=>{de.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Gu(t.source)}|null)$`):void 0}),ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),PA=x("$ZodDefault",(n,e)=>{de.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>$p(s,e)):$p(i,e)}});function $p(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const RA=x("$ZodPrefault",(n,e)=>{de.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),DA=x("$ZodNonOptional",(n,e)=>{de.init(n,e),ee(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Tp(s,n)):Tp(i,n)}});function Tp(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const OA=x("$ZodCatch",(n,e)=>{de.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>vn(o,r,mn()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>vn(s,r,mn()))},input:t.value}),t.issues=[]),t)}}),zA=x("$ZodPipe",(n,e)=>{de.init(n,e),ee(n._zod,"values",()=>e.in._zod.values),ee(n._zod,"optin",()=>e.in._zod.optin),ee(n._zod,"optout",()=>e.out._zod.optout),ee(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>To(o,e.in,r)):To(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>To(s,e.out,r)):To(i,e.out,r)}});function To(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const LA=x("$ZodReadonly",(n,e)=>{de.init(n,e),ee(n._zod,"propValues",()=>e.innerType._zod.propValues),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ee(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(Cp):Cp(i)}});function Cp(n){return n.value=Object.freeze(n.value),n}const MA=x("$ZodCustom",(n,e)=>{Ye.init(n,e),de.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Ip(s,t,r,n));Ip(i,t,r,n)}});function Ip(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ss(i))}}var Pp;class NA{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function UA(){return new NA}(Pp=globalThis).__zod_globalRegistry??(Pp.__zod_globalRegistry=UA());const ji=globalThis.__zod_globalRegistry;function FA(n,e){return new n({type:"string",...z(e)})}function ZA(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...z(e)})}function Rp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...z(e)})}function HA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...z(e)})}function BA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(e)})}function jA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(e)})}function VA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(e)})}function GA(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...z(e)})}function WA(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...z(e)})}function qA(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(e)})}function YA(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...z(e)})}function KA(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(e)})}function JA(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...z(e)})}function XA(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...z(e)})}function QA(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(e)})}function e$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(e)})}function t$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(e)})}function n$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(e)})}function r$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(e)})}function i$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...z(e)})}function s$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...z(e)})}function o$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...z(e)})}function a$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...z(e)})}function l$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(e)})}function c$(n,e){return new n({type:"string",format:"date",check:"string_format",...z(e)})}function u$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...z(e)})}function h$(n,e){return new n({type:"string",format:"duration",check:"string_format",...z(e)})}function d$(n,e){return new n({type:"number",checks:[],...z(e)})}function p$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...z(e)})}function f$(n,e){return new n({type:"boolean",...z(e)})}function g$(n){return new n({type:"unknown"})}function m$(n,e){return new n({type:"never",...z(e)})}function Dp(n,e){return new wm({check:"less_than",...z(e),value:n,inclusive:!1})}function Vl(n,e){return new wm({check:"less_than",...z(e),value:n,inclusive:!0})}function Op(n,e){return new Sm({check:"greater_than",...z(e),value:n,inclusive:!1})}function Gl(n,e){return new Sm({check:"greater_than",...z(e),value:n,inclusive:!0})}function zp(n,e){return new P1({check:"multiple_of",...z(e),value:n})}function $m(n,e){return new D1({check:"max_length",...z(e),maximum:n})}function da(n,e){return new O1({check:"min_length",...z(e),minimum:n})}function Tm(n,e){return new z1({check:"length_equals",...z(e),length:n})}function v$(n,e){return new L1({check:"string_format",format:"regex",...z(e),pattern:n})}function y$(n){return new M1({check:"string_format",format:"lowercase",...z(n)})}function b$(n){return new N1({check:"string_format",format:"uppercase",...z(n)})}function w$(n,e){return new U1({check:"string_format",format:"includes",...z(e),includes:n})}function S$(n,e){return new F1({check:"string_format",format:"starts_with",...z(e),prefix:n})}function _$(n,e){return new Z1({check:"string_format",format:"ends_with",...z(e),suffix:n})}function _i(n){return new H1({check:"overwrite",tx:n})}function k$(n){return _i(e=>e.normalize(n))}function E$(){return _i(n=>n.trim())}function x$(){return _i(n=>n.toLowerCase())}function A$(){return _i(n=>n.toUpperCase())}function $$(){return _i(n=>Lx(n))}function T$(n,e,t){return new n({type:"array",element:e,...z(t)})}function C$(n,e,t){return new n({type:"custom",check:"custom",fn:e,...z(t)})}function I$(n){const e=P$(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(ss(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(ss(i))}},n(t.value,t)));return e}function P$(n,e){const t=new Ye({check:"custom",...z(e)});return t._zod.check=n,t}function Cm(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??ji,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function ye(n,e,t={path:[],schemaPath:[]}){var d,p;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const a=(p=(d=n._zod).toJSONSchema)==null?void 0:p.call(d);if(a)o.schema=a;else{const y={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,y);else{const $=o.schema,E=e.processors[i.type];if(!E)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);E(n,e,$,y)}const v=n._zod.parent;v&&(o.ref||(o.ref=v),ye(v,e,y),e.seen.get(v).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(o.schema,c),e.io==="input"&&Le(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function Im(n,e){var o,a,c,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of n.seen.entries()){const p=(o=n.metadataRegistry.get(d[0]))==null?void 0:o.id;if(p){const y=r.get(p);if(y&&y!==d[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,d[0])}}const i=d=>{var E;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(E=n.external.registry.get(d[0]))==null?void 0:E.id,Z=n.external.uri??(V=>V);if(I)return{ref:Z(I)};const P=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=P,{defId:P,ref:`${Z("__shared")}#/${p}/${P}`}}if(d[1]===t)return{ref:"#"};const v=`#/${p}/`,$=d[1].schema.id??`__schema${n.counter++}`;return{defId:$,ref:v+$}},s=d=>{if(d[1].schema.$ref)return;const p=d[1],{ref:y,defId:v}=i(d);p.def={...p.schema},v&&(p.defId=v);const $=p.schema;for(const E in $)delete $[E];$.$ref=y};if(n.cycles==="throw")for(const d of n.seen.entries()){const p=d[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
|
|
41
41
|
|
|
42
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const p=d[1];if(e===d[0]){s(d);continue}if(n.external){const v=(c=n.external.registry.get(d[0]))==null?void 0:c.id;if(e!==d[0]&&v){s(d);continue}}if((u=n.metadataRegistry.get(d[0]))==null?void 0:u.id){s(d);continue}if(p.cycle){s(d);continue}if(p.count>1&&n.reused==="ref"){s(d);continue}}}function Cm(n,e){var o,a,c;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const d=n.seen.get(u);if(d.ref===null)return;const p=d.def??d.schema,y={...p},v=d.ref;if(d.ref=null,v){r(v);const E=n.seen.get(v),I=E.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(I)):Object.assign(p,I),Object.assign(p,y),u._zod.parent===v)for(const P in p)P==="$ref"||P==="allOf"||P in y||delete p[P];if(I.$ref&&E.def)for(const P in p)P==="$ref"||P==="allOf"||P in E.def&&JSON.stringify(p[P])===JSON.stringify(E.def[P])&&delete p[P]}const $=u._zod.parent;if($&&$!==v){r($);const E=n.seen.get($);if(E!=null&&E.schema.$ref&&(p.$ref=E.schema.$ref,E.def))for(const I in p)I==="$ref"||I==="allOf"||I in E.def&&JSON.stringify(p[I])===JSON.stringify(E.def[I])&&delete p[I]}n.override({zodSchema:u,jsonSchema:p,path:d.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(a=n.external.registry.get(e))==null?void 0:a.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(u)}Object.assign(i,t.def??t.schema);const s=((c=n.external)==null?void 0:c.defs)??{};for(const u of n.seen.entries()){const d=u[1];d.def&&d.defId&&(s[d.defId]=d.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...e["~standard"],jsonSchema:{input:pa(e,"input",n.processors),output:pa(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Le(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Le(r.element,t);if(r.type==="set")return Le(r.valueType,t);if(r.type==="lazy")return Le(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Le(r.innerType,t);if(r.type==="intersection")return Le(r.left,t)||Le(r.right,t);if(r.type==="record"||r.type==="map")return Le(r.keyType,t)||Le(r.valueType,t);if(r.type==="pipe")return Le(r.in,t)||Le(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Le(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Le(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Le(i,t))return!0;return!!(r.rest&&Le(r.rest,t))}return!1}const I$=(n,e={})=>t=>{const r=$m({...t,processors:e});return ye(n,r),Tm(r,n),Cm(r,n)},pa=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=$m({...i??{},target:s,io:e,processors:t});return ye(n,o),Tm(o,n),Cm(o,n)},P$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},R$=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=P$[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},D$=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=n._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof d=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d),typeof s=="number"&&(i.minimum=s,typeof d=="number"&&e.target!=="draft-04"&&(d>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},O$=(n,e,t,r)=>{t.type="boolean"},z$=(n,e,t,r)=>{t.not={}},L$=(n,e,t,r)=>{},M$=(n,e,t,r)=>{const i=n._zod.def,s=am(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},N$=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},U$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},F$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Z$=(n,e,t,r)=>{const i=t,s=n._zod.def,{minimum:o,maximum:a}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=ye(s.element,e,{...r,path:[...r.path,"items"]})},H$=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const d in o)i.properties[d]=ye(o[d],e,{...r,path:[...r.path,"properties",d]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(d=>{const p=s.shape[d]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=ye(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},B$=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>ye(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},j$=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=ye(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=c},V$=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=ye(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=d}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=ye(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ye(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(i.required=d)}},G$=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},W$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},q$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},Y$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},K$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},J$=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;ye(s,e,r);const o=e.seen.get(n);o.ref=s},X$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Im=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},Q$=x("ZodISODateTime",(n,e)=>{eA.init(n,e),fe.init(n,e)});function eT(n){return o$(Q$,n)}const tT=x("ZodISODate",(n,e)=>{tA.init(n,e),fe.init(n,e)});function nT(n){return a$(tT,n)}const rT=x("ZodISOTime",(n,e)=>{nA.init(n,e),fe.init(n,e)});function iT(n){return l$(rT,n)}const sT=x("ZodISODuration",(n,e)=>{rA.init(n,e),fe.init(n,e)});function oT(n){return c$(sT,n)}const Pm=(n,e)=>{hm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>Wx(n,t)},flatten:{value:t=>Gx(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,xc,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,xc,2)}},isEmpty:{get(){return n.issues.length===0}}})},Op=x("ZodError",Pm),at=x("ZodError",Pm,{Parent:Error}),aT=Wu(at),lT=qu(at),cT=Wa(at),uT=qa(at),hT=Kx(at),dT=Jx(at),pT=Xx(at),fT=Qx(at),gT=e1(at),mT=t1(at),vT=n1(at),yT=r1(at),pe=x("ZodType",(n,e)=>(de.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:pa(n,"input"),output:pa(n,"output")}}),n.toJSONSchema=I$(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(En(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>xn(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>aT(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>cT(n,t,r),n.parseAsync=async(t,r)=>lT(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>uT(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>hT(n,t,r),n.decode=(t,r)=>dT(n,t,r),n.encodeAsync=async(t,r)=>pT(n,t,r),n.decodeAsync=async(t,r)=>fT(n,t,r),n.safeEncode=(t,r)=>gT(n,t,r),n.safeDecode=(t,r)=>mT(n,t,r),n.safeEncodeAsync=async(t,r)=>vT(n,t,r),n.safeDecodeAsync=async(t,r)=>yT(n,t,r),n.refine=(t,r)=>n.check(cC(t,r)),n.superRefine=t=>n.check(uC(t)),n.overwrite=t=>n.check(_i(t)),n.optional=()=>Mp(n),n.exactOptional=()=>KT(n),n.nullable=()=>Np(n),n.nullish=()=>Mp(Np(n)),n.nonoptional=t=>nC(n,t),n.array=()=>D(n),n.or=t=>B([n,t]),n.and=t=>Ka(n,t),n.transform=t=>Up(n,qT(t)),n.default=t=>QT(n,t),n.prefault=t=>tC(n,t),n.catch=t=>iC(n,t),n.pipe=t=>Up(n,t),n.readonly=()=>aC(n),n.describe=t=>{const r=n.clone();return ji.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=ji.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return ji.get(n);const r=n.clone();return ji.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Rm=x("_ZodString",(n,e)=>{Yu.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>R$(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(g$(...r)),n.includes=(...r)=>n.check(y$(...r)),n.startsWith=(...r)=>n.check(b$(...r)),n.endsWith=(...r)=>n.check(w$(...r)),n.min=(...r)=>n.check(da(...r)),n.max=(...r)=>n.check(xm(...r)),n.length=(...r)=>n.check(Am(...r)),n.nonempty=(...r)=>n.check(da(1,...r)),n.lowercase=r=>n.check(m$(r)),n.uppercase=r=>n.check(v$(r)),n.trim=()=>n.check(_$()),n.normalize=(...r)=>n.check(S$(...r)),n.toLowerCase=()=>n.check(k$()),n.toUpperCase=()=>n.check(E$()),n.slugify=()=>n.check(x$())}),bT=x("ZodString",(n,e)=>{Yu.init(n,e),Rm.init(n,e),n.email=t=>n.check(UA(wT,t)),n.url=t=>n.check(jA(ST,t)),n.jwt=t=>n.check(s$(LT,t)),n.emoji=t=>n.check(VA(_T,t)),n.guid=t=>n.check(Ip(zp,t)),n.uuid=t=>n.check(FA(Co,t)),n.uuidv4=t=>n.check(ZA(Co,t)),n.uuidv6=t=>n.check(HA(Co,t)),n.uuidv7=t=>n.check(BA(Co,t)),n.nanoid=t=>n.check(GA(kT,t)),n.guid=t=>n.check(Ip(zp,t)),n.cuid=t=>n.check(WA(ET,t)),n.cuid2=t=>n.check(qA(xT,t)),n.ulid=t=>n.check(YA(AT,t)),n.base64=t=>n.check(n$(DT,t)),n.base64url=t=>n.check(r$(OT,t)),n.xid=t=>n.check(KA($T,t)),n.ksuid=t=>n.check(JA(TT,t)),n.ipv4=t=>n.check(XA(CT,t)),n.ipv6=t=>n.check(QA(IT,t)),n.cidrv4=t=>n.check(e$(PT,t)),n.cidrv6=t=>n.check(t$(RT,t)),n.e164=t=>n.check(i$(zT,t)),n.datetime=t=>n.check(eT(t)),n.date=t=>n.check(nT(t)),n.time=t=>n.check(iT(t)),n.duration=t=>n.check(oT(t))});function h(n){return NA(bT,n)}const fe=x("ZodStringFormat",(n,e)=>{le.init(n,e),Rm.init(n,e)}),wT=x("ZodEmail",(n,e)=>{V1.init(n,e),fe.init(n,e)}),zp=x("ZodGUID",(n,e)=>{B1.init(n,e),fe.init(n,e)}),Co=x("ZodUUID",(n,e)=>{j1.init(n,e),fe.init(n,e)}),ST=x("ZodURL",(n,e)=>{G1.init(n,e),fe.init(n,e)}),_T=x("ZodEmoji",(n,e)=>{W1.init(n,e),fe.init(n,e)}),kT=x("ZodNanoID",(n,e)=>{q1.init(n,e),fe.init(n,e)}),ET=x("ZodCUID",(n,e)=>{Y1.init(n,e),fe.init(n,e)}),xT=x("ZodCUID2",(n,e)=>{K1.init(n,e),fe.init(n,e)}),AT=x("ZodULID",(n,e)=>{J1.init(n,e),fe.init(n,e)}),$T=x("ZodXID",(n,e)=>{X1.init(n,e),fe.init(n,e)}),TT=x("ZodKSUID",(n,e)=>{Q1.init(n,e),fe.init(n,e)}),CT=x("ZodIPv4",(n,e)=>{iA.init(n,e),fe.init(n,e)}),IT=x("ZodIPv6",(n,e)=>{sA.init(n,e),fe.init(n,e)}),PT=x("ZodCIDRv4",(n,e)=>{oA.init(n,e),fe.init(n,e)}),RT=x("ZodCIDRv6",(n,e)=>{aA.init(n,e),fe.init(n,e)}),DT=x("ZodBase64",(n,e)=>{lA.init(n,e),fe.init(n,e)}),OT=x("ZodBase64URL",(n,e)=>{uA.init(n,e),fe.init(n,e)}),zT=x("ZodE164",(n,e)=>{hA.init(n,e),fe.init(n,e)}),LT=x("ZodJWT",(n,e)=>{pA.init(n,e),fe.init(n,e)}),Dm=x("ZodNumber",(n,e)=>{Sm.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>D$(n,r,i),n.gt=(r,i)=>n.check(Rp(r,i)),n.gte=(r,i)=>n.check(Vl(r,i)),n.min=(r,i)=>n.check(Vl(r,i)),n.lt=(r,i)=>n.check(Pp(r,i)),n.lte=(r,i)=>n.check(jl(r,i)),n.max=(r,i)=>n.check(jl(r,i)),n.int=r=>n.check(Lp(r)),n.safe=r=>n.check(Lp(r)),n.positive=r=>n.check(Rp(0,r)),n.nonnegative=r=>n.check(Vl(0,r)),n.negative=r=>n.check(Pp(0,r)),n.nonpositive=r=>n.check(jl(0,r)),n.multipleOf=(r,i)=>n.check(Dp(r,i)),n.step=(r,i)=>n.check(Dp(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function F(n){return u$(Dm,n)}const MT=x("ZodNumberFormat",(n,e)=>{fA.init(n,e),Dm.init(n,e)});function Lp(n){return h$(MT,n)}const NT=x("ZodBoolean",(n,e)=>{gA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>O$(n,t,r)});function Ee(n){return d$(NT,n)}const UT=x("ZodUnknown",(n,e)=>{mA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>L$()});function S(){return p$(UT)}const FT=x("ZodNever",(n,e)=>{vA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>z$(n,t,r)});function ZT(n){return f$(FT,n)}const HT=x("ZodArray",(n,e)=>{yA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Z$(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(da(t,r)),n.nonempty=t=>n.check(da(1,t)),n.max=(t,r)=>n.check(xm(t,r)),n.length=(t,r)=>n.check(Am(t,r)),n.unwrap=()=>n.element});function D(n,e){return A$(HT,n,e)}const Om=x("ZodObject",(n,e)=>{wA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>H$(n,t,r,i),ee(n,"shape",()=>e.shape),n.keyof=()=>fa(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:ZT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>Zx(n,t),n.safeExtend=t=>Hx(n,t),n.merge=t=>Bx(n,t),n.pick=t=>Ux(n,t),n.omit=t=>Fx(n,t),n.partial=(...t)=>jx(Lm,n,t[0]),n.required=(...t)=>Vx(Mm,n,t[0])});function zm(n,e){const t={type:"object",shape:n??{},...z(e)};return new Om(t)}function f(n,e){return new Om({type:"object",shape:n,catchall:S(),...z(e)})}const BT=x("ZodUnion",(n,e)=>{SA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>B$(n,t,r,i),n.options=e.options});function B(n,e){return new BT({type:"union",options:n,...z(e)})}const jT=x("ZodIntersection",(n,e)=>{_A.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>j$(n,t,r,i)});function Ka(n,e){return new jT({type:"intersection",left:n,right:e})}const VT=x("ZodRecord",(n,e)=>{kA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>V$(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new VT({type:"record",keyType:n,valueType:e,...z(t)})}const $c=x("ZodEnum",(n,e)=>{EA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>M$(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new $c({...e,checks:[],...z(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new $c({...e,checks:[],...z(i),entries:s})}});function fa(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new $c({type:"enum",entries:t,...z(e)})}const GT=x("ZodLiteral",(n,e)=>{xA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>N$(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function A(n,e){return new GT({type:"literal",values:Array.isArray(n)?n:[n],...z(e)})}const WT=x("ZodTransform",(n,e)=>{AA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>F$(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new sm(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ss(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(ss(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function qT(n){return new WT({type:"transform",transform:n})}const Lm=x("ZodOptional",(n,e)=>{Em.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Im(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Mp(n){return new Lm({type:"optional",innerType:n})}const YT=x("ZodExactOptional",(n,e)=>{$A.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Im(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function KT(n){return new YT({type:"optional",innerType:n})}const JT=x("ZodNullable",(n,e)=>{TA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>G$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Np(n){return new JT({type:"nullable",innerType:n})}const XT=x("ZodDefault",(n,e)=>{CA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>q$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function QT(n,e){return new XT({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():cm(e)}})}const eC=x("ZodPrefault",(n,e)=>{IA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Y$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function tC(n,e){return new eC({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():cm(e)}})}const Mm=x("ZodNonOptional",(n,e)=>{PA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>W$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function nC(n,e){return new Mm({type:"nonoptional",innerType:n,...z(e)})}const rC=x("ZodCatch",(n,e)=>{RA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>K$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function iC(n,e){return new rC({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const sC=x("ZodPipe",(n,e)=>{DA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>J$(n,t,r,i),n.in=e.in,n.out=e.out});function Up(n,e){return new sC({type:"pipe",in:n,out:e})}const oC=x("ZodReadonly",(n,e)=>{OA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>X$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function aC(n){return new oC({type:"readonly",innerType:n})}const lC=x("ZodCustom",(n,e)=>{zA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>U$(n,t)});function cC(n,e={}){return $$(lC,n,e)}function uC(n){return T$(n)}const hC=["text/markdown","text/html"],dC=["committed","pending"];zm({id:h().min(1),type:fa(hC),title:h(),status:fa(dC),externalFilePath:h().optional()});zm({name:h().min(1),description:h(),accepts:D(h().min(1)).min(1)});function Ku(n){return typeof n=="object"&&n!==null}function pC(n){return!Ku(n)||n.type!=="ready"?!1:!("id"in n)}function fC(n){return!(!Ku(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function gC(n){return!Ku(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function mC(n,e){if(n===e)return 2;if(n==="*/*")return 0;const t=n.indexOf("/");if(t>0&&n.slice(t+1)==="*"){const r=n.slice(0,t),i=e.indexOf("/");if(i>0&&e.slice(0,i)===r)return 1}return null}function vC(n,e){let t=null;for(const r of n.accepts){const i=mC(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function yC(n,e){let t=-1,r=null;for(const i of e){const s=vC(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const bC=4401;class Tc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class Cc extends vt{constructor(t){super();b(this,"url");b(this,"name");b(this,"token");b(this,"status","disconnected");b(this,"screens",new Map);b(this,"views",[]);b(this,"client");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=xt(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.createClient=t.createClient??((r,i)=>new _x(r,{token:i??void 0})),this.client=this.createClient(this.url,this.token)}async connect(){var i;this.connectAttempt+=1;const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this.token),this.status="connecting",this.dispatchEvent(new J("change"));const r=this.createSocket(wC(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new J("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new J("change")),o(p))},d=async()=>{try{const[{screens:p},y]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(v=>[v.id,structuredClone(v)])),this.views=y,this.dispatchEvent(new J("change")),c()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{d()}),r.addEventListener("message",p=>{const y=_C(p);y&&(this.applyServerEvent(y),this.dispatchEvent(new Jg("server-event",{serverURL:this.url,event:y})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,SC(p)===bC){u(new Tc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new J("change"))}}),r.addEventListener("error",()=>{u(new Error("WebSocket connection failed"))})})}disconnect(){var t;this.connectAttempt+=1,(t=this.socket)==null||t.close(),this.socket=null,this.status="disconnected",this.dispatchEvent(new J("change"))}getViewURL(t){const r=yC(t.type,this.views);if(!r)return null;const i=`${this.url}/views/${encodeURIComponent(r.id)}/`;return this.token===null?i:`${i}?token=${encodeURIComponent(this.token)}`}getContentURL(t){const r=`${this.url}/artifacts/${encodeURIComponent(t)}/content`;return this.token===null?r:`${r}?token=${encodeURIComponent(this.token)}`}async createScreen(t){const{screen:r}=await this.client.screens.create({name:t});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"screen-created":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new Wo("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new Wo("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new Wo("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!qg(r.layout,t.artifact.id)&&(r.layout=[...r.layout,Wg(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=Ng(r.layout,t.artifactID));break}}}}function wC(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/events",t.search="",e&&t.searchParams.set("token",e),t.hash="",t.toString()}function SC(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function _C(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;try{return JSON.parse(e)}catch{return null}}class kC extends vt{constructor(t){super();b(this,"servers",new Map);b(this,"localServerURL");b(this,"localStore");b(this,"createSocket");b(this,"lastActiveServerURL");b(this,"serverListeners",new Map);b(this,"handleLocalStoreChange",()=>{const t=this.localStore.get().activeServerURL;t!==this.lastActiveServerURL&&(this.lastActiveServerURL=t,this.dispatchEvent(new J("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?xt(t.localServerURL):null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.lastActiveServerURL=this.localStore.get().activeServerURL,this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const t=this.localStore.get().activeServerURL;return t===null?null:this.servers.get(t)??null}add(t){const r=xt(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new J("change"))},o=c=>{this.dispatchEvent(new Jg("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new Wo("screens-changed"))};t.addEventListener("change",s),t.addEventListener("server-event",o),t.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new J("change"))}remove(t){const r=xt(t);if(this.localServerURL&&r===this.localServerURL)return;const i=this.servers.get(r);if(!i)return;const s=this.serverListeners.get(r);s&&(i.removeEventListener("change",s.onServerChange),i.removeEventListener("server-event",s.onServerEvent),i.removeEventListener("screens-changed",s.onScreensChanged),this.serverListeners.delete(r)),i.disconnect(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(c=>c.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new J("change"))}setActive(t){const r=this.localStore.get(),i=t?xt(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=this.localStore.get().servers,s=t?xt(t):null;for(const a of i){const c=xt(a.url),u=s!==null&&c===s,d=new Cc({url:a.url,name:a.name,token:u?r??null:null,createSocket:this.createSocket});this.add(d),d.connect().catch(()=>{})}const o=s?this.servers.get(s)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=xt(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>xt(a.url)!==i),{url:i,name:r}]});const o=new Cc({url:i,name:r,createSocket:this.createSocket});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}const ae={authenticate:"authenticate",document_did_change:"document/didChange",document_did_close:"document/didClose",document_did_focus:"document/didFocus",document_did_open:"document/didOpen",document_did_save:"document/didSave",initialize:"initialize",logout:"logout",nes_accept:"nes/accept",nes_close:"nes/close",nes_reject:"nes/reject",nes_start:"nes/start",nes_suggest:"nes/suggest",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},Nt={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"},EC=1,xC=f({_meta:_(h(),S()).nullish(),terminal:Ee().optional().default(!1)}),AC=f({_meta:_(h(),S()).nullish(),label:h().nullish(),name:h(),optional:Ee().optional().default(!1),secret:Ee().optional().default(!0)}),$C=f({_meta:_(h(),S()).nullish(),description:h().nullish(),id:h(),name:h()}),TC=f({_meta:_(h(),S()).nullish(),description:h().nullish(),id:h(),link:h().nullish(),name:h(),vars:D(AC)}),CC=f({_meta:_(h(),S()).nullish(),args:D(h()).optional(),description:h().nullish(),env:_(h(),h()).optional(),id:h(),name:h()}),IC=B([TC.and(f({type:A("env_var")})),CC.and(f({type:A("terminal")})),$C]),PC=f({_meta:_(h(),S()).nullish(),methodId:h()}),RC=f({_meta:_(h(),S()).nullish()}),DC=f({_meta:_(h(),S()).nullish(),blob:h(),mimeType:h().nullish(),uri:h()}),OC=f({default:Ee().nullish(),description:h().nullish(),title:h().nullish()}),zC=f({_meta:_(h(),S()).nullish()}),LC=f({_meta:_(h(),S()).nullish()}),MC=f({amount:F(),currency:h()}),NC=f({_meta:_(h(),S()).nullish(),terminalId:h()}),UC=f({_meta:_(h(),S()).nullish(),newText:h(),oldText:h().nullish(),path:h()}),FC=B([h(),F(),F(),Ee(),D(h())]),ZC=f({content:_(h(),FC).nullish()}),HC=B([ZC.and(f({action:A("accept")})),f({action:A("decline")}),f({action:A("cancel")})]),BC=f({_meta:_(h(),S()).nullish()}),Nm=h(),jC=f({_meta:_(h(),S()).nullish(),elicitationId:Nm}),VC=f({_meta:_(h(),S()).nullish(),action:HC}),GC=A("object"),WC=A("string"),qC=f({_meta:_(h(),S()).nullish()}),YC=f({_meta:_(h(),S()).nullish(),form:BC.nullish(),url:qC.nullish()}),KC=f({elicitationId:Nm,url:h().url()}),Um=f({const:h(),title:h()}),Fm=f({_meta:_(h(),S()).nullish(),name:h(),value:h()}),JC=B([A(-32700),A(-32600),A(-32601),A(-32602),A(-32603),A(-32800),A(-32e3),A(-32002),A(-32042),F().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),Zm=f({code:JC,data:S().optional(),message:h()}),Hm=S(),Bm=S(),jm=S(),XC=f({_meta:_(h(),S()).nullish(),readTextFile:Ee().optional().default(!1),writeTextFile:Ee().optional().default(!1)}),Vm=f({_meta:_(h(),S()).nullish(),name:h(),value:h()}),Gm=f({_meta:_(h(),S()).nullish(),name:h(),title:h().nullish(),version:h()}),QC=f({default:F().nullish(),description:h().nullish(),maximum:F().nullish(),minimum:F().nullish(),title:h().nullish()}),eI=f({_meta:_(h(),S()).nullish()}),tI=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cursor:h().nullish(),cwd:h().nullish()}),nI=f({_meta:_(h(),S()).nullish()}),rI=f({_meta:_(h(),S()).nullish(),logout:nI.nullish()}),iI=f({_meta:_(h(),S()).nullish()}),sI=f({_meta:_(h(),S()).nullish()}),oI=f({_meta:_(h(),S()).nullish(),http:Ee().optional().default(!1),sse:Ee().optional().default(!1)}),aI=f({_meta:_(h(),S()).nullish(),headers:D(Vm),name:h(),url:h()}),lI=f({_meta:_(h(),S()).nullish(),headers:D(Vm),name:h(),url:h()}),cI=f({_meta:_(h(),S()).nullish(),args:D(h()),command:h(),env:D(Fm),name:h()}),Ja=B([aI.and(f({type:A("http")})),lI.and(f({type:A("sse")})),cI]),Ju=h(),uI=f({_meta:_(h(),S()).nullish(),description:h().nullish(),modelId:Ju,name:h()}),hI=B([A("error"),A("warning"),A("information"),A("hint")]),dI=f({_meta:_(h(),S()).nullish()}),pI=f({_meta:_(h(),S()).nullish()}),fI=f({_meta:_(h(),S()).nullish()}),gI=f({_meta:_(h(),S()).nullish()}),mI=f({_meta:_(h(),S()).nullish()}),vI=f({_meta:_(h(),S()).nullish(),maxCount:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),yI=f({diff:h(),uri:h()}),bI=f({endLine:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:h()}),wI=f({_meta:_(h(),S()).nullish()}),SI=f({_meta:_(h(),S()).nullish()}),_I=f({languageId:h(),text:h(),uri:h()}),kI=f({_meta:_(h(),S()).nullish(),maxCount:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),EI=B([A("rejected"),A("ignored"),A("replaced"),A("cancelled")]),xI=f({excerpts:D(bI),uri:h()}),AI=f({_meta:_(h(),S()).nullish()}),$I=f({_meta:_(h(),S()).nullish()}),TI=f({name:h(),owner:h(),remoteUrl:h()}),CI=f({_meta:_(h(),S()).nullish()}),II=f({_meta:_(h(),S()).nullish(),jump:wI.nullish(),rename:$I.nullish(),searchAndReplace:CI.nullish()}),PI=f({id:h(),isRegex:Ee().nullish(),replace:h(),search:h(),uri:h()}),RI=B([A("automatic"),A("diagnostic"),A("manual")]),DI=f({_meta:_(h(),S()).nullish(),maxCount:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),OI=f({_meta:_(h(),S()).nullish(),diagnostics:dI.nullish(),editHistory:vI.nullish(),openFiles:SI.nullish(),recentFiles:kI.nullish(),relatedSnippets:AI.nullish(),userActions:DI.nullish()}),zI=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja)}),LI=f({default:F().nullish(),description:h().nullish(),maximum:F().nullish(),minimum:F().nullish(),title:h().nullish()}),Wm=h(),MI=B([A("allow_once"),A("allow_always"),A("reject_once"),A("reject_always")]),NI=f({_meta:_(h(),S()).nullish(),kind:MI,name:h(),optionId:Wm}),UI=B([A("high"),A("medium"),A("low")]),FI=B([A("pending"),A("in_progress"),A("completed")]),ZI=f({_meta:_(h(),S()).nullish(),content:h(),priority:UI,status:FI}),HI=f({_meta:_(h(),S()).nullish(),entries:D(ZI)}),yn=f({character:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),BI=f({id:h(),position:yn,uri:h()}),jI=f({id:h(),newName:h(),position:yn,uri:h()}),VI=f({action:h(),position:yn,timestampMs:F(),uri:h()}),qm=B([A("utf-16"),A("utf-32"),A("utf-8")]),GI=f({_meta:_(h(),S()).nullish(),auth:xC.optional().default({terminal:!1}),elicitation:YC.nullish(),fs:XC.optional().default({readTextFile:!1,writeTextFile:!1}),nes:II.nullish(),positionEncodings:D(qm).optional(),terminal:Ee().optional().default(!1)}),WI=f({_meta:_(h(),S()).nullish(),audio:Ee().optional().default(!1),embeddedContext:Ee().optional().default(!1),image:Ee().optional().default(!1)}),Ym=F().int().gte(0).lte(65535),qI=f({_meta:_(h(),S()).nullish(),clientCapabilities:GI.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:Gm.nullish(),protocolVersion:Ym}),ki=f({end:yn,start:yn}),YI=f({message:h(),range:ki,severity:hI,uri:h()}),KI=f({languageId:h(),lastFocusedMs:F().nullish(),uri:h(),visibleRange:ki.nullish()}),JI=f({_meta:_(h(),S()).nullish(),diagnostics:D(YI).nullish(),editHistory:D(yI).nullish(),openFiles:D(KI).nullish(),recentFiles:D(_I).nullish(),relatedSnippets:D(xI).nullish(),userActions:D(VI).nullish()}),XI=f({newText:h(),range:ki}),QI=f({cursorPosition:yn.nullish(),edits:D(XI),id:h(),uri:h()}),eP=B([QI.and(f({kind:A("edit")})),BI.and(f({kind:A("jump")})),jI.and(f({kind:A("rename")})),PI.and(f({kind:A("searchAndReplace")}))]),tP=f({_meta:_(h(),S()).nullish(),content:h()}),nP=f({_meta:_(h(),S()).nullish()}),dr=B([F(),h()]).nullable();f({_meta:_(h(),S()).nullish(),requestId:dr});const rP=fa(["assistant","user"]),oo=f({_meta:_(h(),S()).nullish(),audience:D(rP).nullish(),lastModified:h().nullish(),priority:F().nullish()}),iP=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),data:h(),mimeType:h()}),sP=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),data:h(),mimeType:h(),uri:h().nullish()}),oP=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),description:h().nullish(),mimeType:h().nullish(),name:h(),size:F().nullish(),title:h().nullish(),uri:h()}),aP=f({_meta:_(h(),S()).nullish(),optionId:Wm}),lP=B([f({outcome:A("cancelled")}),aP.and(f({outcome:A("selected")}))]),cP=f({_meta:_(h(),S()).nullish(),outcome:lP}),uP=f({_meta:_(h(),S()).nullish()}),hP=f({_meta:_(h(),S()).nullish()}),dP=f({currentValue:Ee()}),pP=h(),Km=h(),fP=B([A("mode"),A("model"),A("thought_level"),h()]),Xu=h(),Jm=f({_meta:_(h(),S()).nullish(),description:h().nullish(),name:h(),value:Xu}),gP=f({_meta:_(h(),S()).nullish(),group:pP,name:h(),options:D(Jm)}),mP=B([D(Jm),D(gP)]),vP=f({currentValue:Xu,options:mP}),Ei=Ka(B([vP.and(f({type:A("select")})),dP.and(f({type:A("boolean")}))]),f({_meta:_(h(),S()).nullish(),category:fP.nullish(),description:h().nullish(),id:Km,name:h()})),yP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei)}),bP=f({_meta:_(h(),S()).nullish()}),K=h(),wP=f({_meta:_(h(),S()).nullish(),id:h(),sessionId:K}),SP=f({_meta:_(h(),S()).nullish(),sessionId:K}),_P=f({_meta:_(h(),S()).nullish(),sessionId:K}),kP=f({_meta:_(h(),S()).nullish(),sessionId:K}),Xm=f({_meta:_(h(),S()).nullish(),args:D(h()).optional(),command:h(),cwd:h().nullish(),env:D(Fm).optional(),outputByteLimit:F().nullish(),sessionId:K}),EP=f({_meta:_(h(),S()).nullish(),sessionId:K,uri:h()}),xP=f({_meta:_(h(),S()).nullish(),position:yn,sessionId:K,uri:h(),version:F(),visibleRange:ki}),AP=f({_meta:_(h(),S()).nullish(),languageId:h(),sessionId:K,text:h(),uri:h(),version:F()}),$P=f({_meta:_(h(),S()).nullish(),sessionId:K,uri:h()}),TP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja).optional(),sessionId:K}),Qm=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),CP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja),sessionId:K}),ev=f({_meta:_(h(),S()).nullish(),limit:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:h(),sessionId:K}),IP=f({_meta:_(h(),S()).nullish(),id:h(),reason:EI.nullish(),sessionId:K}),tv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),PP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja).optional(),sessionId:K}),RP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),sessionId:K,title:h().nullish(),updatedAt:h().nullish()}),DP=f({_meta:_(h(),S()).nullish(),nextCursor:h().nullish(),sessions:D(RP)}),OP=f({_meta:_(h(),S()).nullish(),title:h().nullish(),updatedAt:h().nullish()}),zP=f({_meta:_(h(),S()).nullish()}),Xa=h(),LP=f({_meta:_(h(),S()).nullish(),currentModeId:Xa}),MP=f({_meta:_(h(),S()).nullish(),description:h().nullish(),id:Xa,name:h()}),Qa=f({_meta:_(h(),S()).nullish(),availableModes:D(MP),currentModeId:Xa}),el=f({_meta:_(h(),S()).nullish(),availableModels:D(uI),currentModelId:Ju}),NP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish(),sessionId:K}),UP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish()}),FP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish(),sessionId:K}),ZP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish()}),HP=f({_meta:_(h(),S()).nullish()}),BP=f({_meta:_(h(),S()).nullish(),additionalDirectories:uP.nullish(),close:hP.nullish(),fork:bP.nullish(),list:zP.nullish(),resume:HP.nullish()}),jP=Ka(B([f({type:A("boolean"),value:Ee()}),f({value:Xu})]),f({_meta:_(h(),S()).nullish(),configId:Km,sessionId:K})),VP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei)}),GP=f({_meta:_(h(),S()).nullish(),modeId:Xa,sessionId:K}),WP=f({_meta:_(h(),S()).nullish()}),qP=f({_meta:_(h(),S()).nullish(),modelId:Ju,sessionId:K}),YP=f({_meta:_(h(),S()).nullish()}),KP=f({_meta:_(h(),S()).nullish(),sessionId:K}),JP=B([A("end_turn"),A("max_tokens"),A("max_turn_requests"),A("refusal"),A("cancelled")]),XP=B([A("email"),A("uri"),A("date"),A("date-time")]),QP=f({default:h().nullish(),description:h().nullish(),enum:D(h()).nullish(),format:XP.nullish(),maxLength:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(Um).nullish(),pattern:h().nullish(),title:h().nullish()}),eR=f({_meta:_(h(),S()).nullish(),context:JI.nullish(),position:yn,selection:ki.nullish(),sessionId:K,triggerKind:RI,uri:h(),version:F()}),tR=f({_meta:_(h(),S()).nullish(),suggestions:D(eP)}),nR=f({_meta:_(h(),S()).nullish(),terminalId:h()}),rR=f({_meta:_(h(),S()).nullish(),exitCode:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:h().nullish()}),nv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),iR=f({_meta:_(h(),S()).nullish(),exitStatus:rR.nullish(),output:h(),truncated:Ee()}),sR=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),text:h()}),oR=f({range:ki.nullish(),text:h()}),aR=f({_meta:_(h(),S()).nullish(),contentChanges:D(oR),sessionId:K,uri:h(),version:F()});f({method:h(),params:B([SP,AP,aR,EP,$P,xP,wP,IP,Hm]).nullish()});const lR=B([A("full"),A("incremental")]),cR=f({_meta:_(h(),S()).nullish(),syncKind:lR}),uR=f({_meta:_(h(),S()).nullish(),didChange:cR.nullish(),didClose:pI.nullish(),didFocus:fI.nullish(),didOpen:gI.nullish(),didSave:mI.nullish()}),hR=f({_meta:_(h(),S()).nullish(),document:uR.nullish()}),dR=f({_meta:_(h(),S()).nullish(),context:OI.nullish(),events:hR.nullish()}),pR=f({_meta:_(h(),S()).nullish(),auth:rI.optional().default({}),loadSession:Ee().optional().default(!1),mcpCapabilities:oI.optional().default({http:!1,sse:!1}),nes:dR.nullish(),positionEncoding:qm.nullish(),promptCapabilities:WI.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:BP.optional().default({})}),fR=f({_meta:_(h(),S()).nullish(),agentCapabilities:pR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:Gm.nullish(),authMethods:D(IC).optional().default([]),protocolVersion:Ym}),gR=f({_meta:_(h(),S()).nullish(),mimeType:h().nullish(),text:h(),uri:h()}),mR=B([gR,DC]),vR=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),resource:mR}),Qu=B([sR.and(f({type:A("text")})),sP.and(f({type:A("image")})),iP.and(f({type:A("audio")})),oP.and(f({type:A("resource_link")})),vR.and(f({type:A("resource")}))]),yR=f({_meta:_(h(),S()).nullish(),content:Qu}),Gl=f({_meta:_(h(),S()).nullish(),content:Qu,messageId:h().nullish()}),bR=f({_meta:_(h(),S()).nullish(),messageId:h().nullish(),prompt:D(Qu),sessionId:K}),wR=f({anyOf:D(Um)}),rv=B([yR.and(f({type:A("content")})),UC.and(f({type:A("diff")})),nR.and(f({type:A("terminal")}))]),iv=h(),sv=f({_meta:_(h(),S()).nullish(),line:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:h()}),ov=B([A("pending"),A("in_progress"),A("completed"),A("failed")]),av=B([A("read"),A("edit"),A("delete"),A("move"),A("search"),A("execute"),A("think"),A("fetch"),A("switch_mode"),A("other")]),SR=f({_meta:_(h(),S()).nullish(),content:D(rv).optional(),kind:av.optional(),locations:D(sv).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:ov.optional(),title:h(),toolCallId:iv}),lv=f({_meta:_(h(),S()).nullish(),content:D(rv).nullish(),kind:av.nullish(),locations:D(sv).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:ov.nullish(),title:h().nullish(),toolCallId:iv}),cv=f({_meta:_(h(),S()).nullish(),options:D(NI),sessionId:K,toolCall:lv}),_R=f({_meta:_(h(),S()).nullish(),hint:h()}),kR=_R,ER=f({_meta:_(h(),S()).nullish(),description:h(),input:kR.nullish(),name:h()}),xR=f({_meta:_(h(),S()).nullish(),availableCommands:D(ER)}),AR=f({enum:D(h()),type:WC}),$R=B([AR,wR]),TR=f({default:D(h()).nullish(),description:h().nullish(),items:$R,maxItems:F().nullish(),minItems:F().nullish(),title:h().nullish()}),CR=B([QP.and(f({type:A("string")})),LI.and(f({type:A("number")})),QC.and(f({type:A("integer")})),OC.and(f({type:A("boolean")})),TR.and(f({type:A("array")}))]),IR=f({description:h().nullish(),properties:_(h(),CR).optional().default({}),required:D(h()).nullish(),title:h().nullish(),type:GC.optional().default("object")}),PR=f({requestedSchema:IR}),RR=Ka(B([PR.and(f({mode:A("form")})),KC.and(f({mode:A("url")}))]),f({_meta:_(h(),S()).nullish(),message:h(),sessionId:K})),DR=f({cachedReadTokens:F().nullish(),cachedWriteTokens:F().nullish(),inputTokens:F(),outputTokens:F(),thoughtTokens:F().nullish(),totalTokens:F()}),OR=f({_meta:_(h(),S()).nullish(),stopReason:JP,usage:DR.nullish(),userMessageId:h().nullish()});B([f({id:dr,result:B([fR,RC,sI,FP,UP,DP,NP,ZP,LC,WP,VP,OR,YP,KP,tR,zC,jm])}),f({error:Zm,id:dr})]);const zR=f({_meta:_(h(),S()).nullish(),cost:MC.nullish(),size:F(),used:F()}),LR=B([Gl.and(f({sessionUpdate:A("user_message_chunk")})),Gl.and(f({sessionUpdate:A("agent_message_chunk")})),Gl.and(f({sessionUpdate:A("agent_thought_chunk")})),SR.and(f({sessionUpdate:A("tool_call")})),lv.and(f({sessionUpdate:A("tool_call_update")})),HI.and(f({sessionUpdate:A("plan")})),xR.and(f({sessionUpdate:A("available_commands_update")})),LP.and(f({sessionUpdate:A("current_mode_update")})),yP.and(f({sessionUpdate:A("config_option_update")})),OP.and(f({sessionUpdate:A("session_info_update")})),zR.and(f({sessionUpdate:A("usage_update")}))]),uv=f({_meta:_(h(),S()).nullish(),sessionId:K,update:LR});f({method:h(),params:B([uv,jC,Hm]).nullish()});const hv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),MR=f({_meta:_(h(),S()).nullish(),exitCode:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:h().nullish()}),NR=f({name:h(),uri:h()}),UR=f({_meta:_(h(),S()).nullish(),repository:TI.nullish(),workspaceFolders:D(NR).nullish(),workspaceUri:h().nullish()});f({id:dr,method:h(),params:B([qI,PC,iI,zI,CP,tI,TP,PP,kP,GP,jP,bR,qP,UR,eR,_P,Bm]).nullish()});const dv=f({_meta:_(h(),S()).nullish(),content:h(),path:h(),sessionId:K});f({id:dr,method:h(),params:B([dv,ev,cv,Xm,nv,tv,hv,Qm,RR,Bm]).nullish()});const FR=f({_meta:_(h(),S()).nullish()});B([f({id:dr,result:B([FR,tP,cP,NC,iR,nP,MR,eI,VC,jm])}),f({error:Zm,id:dr})]);var Y;class ZR{constructor(e,t){w(this,Y);const r=e(this),i=async(o,a)=>{var c,u,d,p,y,v,$;switch(o){case Nt.fs_write_text_file:{const E=dv.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,E)}case Nt.fs_read_text_file:{const E=ev.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,E)}case Nt.session_request_permission:{const E=cv.parse(a);return r.requestPermission(E)}case Nt.terminal_create:{const E=Xm.parse(a);return(d=r.createTerminal)==null?void 0:d.call(r,E)}case Nt.terminal_output:{const E=nv.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,E)}case Nt.terminal_release:{const E=tv.parse(a);return await((y=r.releaseTerminal)==null?void 0:y.call(r,E))??{}}case Nt.terminal_wait_for_exit:{const E=hv.parse(a);return(v=r.waitForTerminalExit)==null?void 0:v.call(r,E)}case Nt.terminal_kill:{const E=Qm.parse(a);return await(($=r.killTerminal)==null?void 0:$.call(r,E))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw we.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Nt.session_update:{const c=uv.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw we.methodNotFound(o)}};k(this,Y,new HR(i,s,t))}async initialize(e){return await l(this,Y).sendRequest(ae.initialize,e)}async newSession(e){return await l(this,Y).sendRequest(ae.session_new,e)}async loadSession(e){return await l(this,Y).sendRequest(ae.session_load,e)??{}}async unstable_forkSession(e){return await l(this,Y).sendRequest(ae.session_fork,e)}async listSessions(e){return await l(this,Y).sendRequest(ae.session_list,e)}async unstable_resumeSession(e){return await l(this,Y).sendRequest(ae.session_resume,e)}async unstable_closeSession(e){return await l(this,Y).sendRequest(ae.session_close,e)}async setSessionMode(e){return await l(this,Y).sendRequest(ae.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await l(this,Y).sendRequest(ae.session_set_model,e)??{}}async setSessionConfigOption(e){return await l(this,Y).sendRequest(ae.session_set_config_option,e)}async authenticate(e){return await l(this,Y).sendRequest(ae.authenticate,e)??{}}async unstable_logout(e){return await l(this,Y).sendRequest(ae.logout,e)??{}}async prompt(e){return await l(this,Y).sendRequest(ae.session_prompt,e)}async cancel(e){return await l(this,Y).sendNotification(ae.session_cancel,e)}async unstable_startNes(e){return await l(this,Y).sendRequest(ae.nes_start,e)}async unstable_suggestNes(e){return await l(this,Y).sendRequest(ae.nes_suggest,e)}async unstable_closeNes(e){return await l(this,Y).sendRequest(ae.nes_close,e)??{}}async unstable_didOpenDocument(e){return await l(this,Y).sendNotification(ae.document_did_open,e)}async unstable_didChangeDocument(e){return await l(this,Y).sendNotification(ae.document_did_change,e)}async unstable_didCloseDocument(e){return await l(this,Y).sendNotification(ae.document_did_close,e)}async unstable_didSaveDocument(e){return await l(this,Y).sendNotification(ae.document_did_save,e)}async unstable_didFocusDocument(e){return await l(this,Y).sendNotification(ae.document_did_focus,e)}async unstable_acceptNes(e){return await l(this,Y).sendNotification(ae.nes_accept,e)}async unstable_rejectNes(e){return await l(this,Y).sendNotification(ae.nes_reject,e)}async extMethod(e,t){return await l(this,Y).sendRequest(e,t)}async extNotification(e,t){return await l(this,Y).sendNotification(e,t)}get signal(){return l(this,Y).signal}get closed(){return l(this,Y).closed}}Y=new WeakMap;var an,_a,gs,ms,jr,Vr,Tt,vs,he,pv,Ic,fv,gv,mv,vv,Pc,Vi;class HR{constructor(e,t,r){w(this,he);w(this,an,new Map);w(this,_a,0);w(this,gs);w(this,ms);w(this,jr);w(this,Vr,Promise.resolve());w(this,Tt,new AbortController);w(this,vs);k(this,gs,e),k(this,ms,t),k(this,jr,r),k(this,vs,new Promise(i=>{l(this,Tt).signal.addEventListener("abort",()=>i())})),g(this,he,pv).call(this)}get signal(){return l(this,Tt).signal}get closed(){return l(this,vs)}async sendRequest(e,t){g(this,he,Pc).call(this);const r=Bh(this,_a)._++,i=new Promise((s,o)=>{l(this,an).set(r,{resolve:s,reject:o})});return await g(this,he,Vi).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){g(this,he,Pc).call(this),await g(this,he,Vi).call(this,{jsonrpc:"2.0",method:e,params:t})}}an=new WeakMap,_a=new WeakMap,gs=new WeakMap,ms=new WeakMap,jr=new WeakMap,Vr=new WeakMap,Tt=new WeakMap,vs=new WeakMap,he=new WeakSet,pv=async function(){let e;try{const t=l(this,jr).readable.getReader();try{for(;!l(this,Tt).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{g(this,he,fv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&g(this,he,Vi).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{g(this,he,Ic).call(this,e)}},Ic=function(e){if(l(this,Tt).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of l(this,an).values())r.reject(t);l(this,an).clear(),l(this,Tt).abort(t)},fv=async function(e){if("method"in e&&"id"in e){const t=await g(this,he,gv).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await g(this,he,Vi).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await g(this,he,mv).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?g(this,he,vv).call(this,e):console.error("Invalid message",{message:e})},gv=async function(e,t){try{return{result:await l(this,gs).call(this,e,t)??null}}catch(r){if(r instanceof we)return r.toResult();if(r instanceof Op)return we.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 we.internalError(i?JSON.parse(i):{}).toResult()}catch{return we.internalError({details:i}).toResult()}}},mv=async function(e,t){try{return await l(this,ms).call(this,e,t),{result:null}}catch(r){if(r instanceof we)return r.toResult();if(r instanceof Op)return we.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 we.internalError(i?JSON.parse(i):{}).toResult()}catch{return we.internalError({details:i}).toResult()}}},vv=function(e){const t=l(this,an).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new we(r,i,s))}l(this,an).delete(e.id)}else console.error("Got response to unknown request",e.id)},Pc=function(){if(l(this,Tt).signal.aborted)throw l(this,Tt).signal.reason??new Error("ACP connection closed")},Vi=async function(e){return k(this,Vr,l(this,Vr).then(async()=>{const t=l(this,jr).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{g(this,he,Ic).call(this,t)})),l(this,Vr)};class we extends Error{constructor(t,r,i){super(r);b(this,"code");b(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new we(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new we(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new we(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new we(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new we(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new we(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new we(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const BR=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,jR=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,VR=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,GR=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,WR="single_session",qR={name:"television-acp-client",version:"0.0.0"},yv="agent:main:television",YR=Si(vt);var te,Ht,Gr,Bt,qn,Yn,Kn,Jn,ln,Wr,Ct,ut,cn,Xn,jt,un,ys,Vt,ht,ka,Gt,C,bv,wv,Rc,Sv,_v,kv,Ev,xv,Av,$v,Rn,Rr,Dr,He,Tv,Or,Dc,Oc,Yo,Cv,Iv,bs,ws,zc,zr,Pv,Rv;class KR extends YR{constructor(t){super();w(this,C);w(this,te,XR());w(this,Ht,null);w(this,Gr,null);w(this,Bt,null);w(this,qn,null);w(this,Yn,null);w(this,Kn,null);w(this,Jn);w(this,ln,null);w(this,Wr,1);w(this,Ct,null);w(this,ut,null);w(this,cn,!1);w(this,Xn,!1);w(this,jt,null);w(this,un,new Set);w(this,ys);w(this,Vt);w(this,ht);w(this,ka,t=>{g(this,C,wv).call(this,t)});w(this,Gt,null);w(this,bs,()=>{g(this,C,zr).call(this,"ACP bridge websocket closed")});w(this,ws,()=>{g(this,C,zr).call(this,"ACP bridge websocket error")});k(this,Vt,t),k(this,ht,t.sessionMode??WR),k(this,Jn,t.mappedSessionStore??JR()),k(this,ys,t.createSocket??(r=>new WebSocket(r)))}getState(){return l(this,te)}get messages(){return l(this,te).messageOrder.map(t=>l(this,te).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(l(this,te).lifecycle.status!=="ready"){g(this,C,He).call(this,{lifecycle:{status:"connecting"}}),l(this,Gr)??k(this,Gr,g(this,C,bv).call(this));try{await l(this,Gr),await g(this,C,Rc).call(this)}catch(t){throw g(this,C,zr).call(this,Io(t)),t}}}dispose(){g(this,C,zc).call(this),g(this,C,He).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),l(this,te).lifecycle.status!=="ready"||l(this,te).run.status==="running"||l(this,te).run.status==="cancelling")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");g(this,C,Rr).call(this,{id:g(this,C,Or).call(this,"user"),kind:"user",text:r,status:"final"}),g(this,C,He).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await g(this,C,Yo).call(this).prompt({sessionId:g(this,C,Oc).call(this),prompt:[{type:"text",text:g(this,C,Tv).call(this,r)}]});g(this,C,Rn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),g(this,C,He).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw g(this,C,Rv).call(this)||(g(this,C,Rn).call(this,"error"),g(this,C,He).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:Io(i)}})),i}}async cancel(){if(await this.connect(),!l(this,te).run.canCancel||l(this,te).run.status!=="running")throw new Error("No active cancellable run");g(this,C,He).call(this,{run:{...l(this,te).run,status:"cancelling"}}),await g(this,C,Yo).call(this).cancel({sessionId:g(this,C,Oc).call(this)})}setScreenContext(t){var s,o,a;const r={screenID:t.screenID,screenName:t.screenName};if(((s=l(this,ut))==null?void 0:s.screenID)===r.screenID&&((o=l(this,ut))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,ut))==null?void 0:a.screenID)??null;if(k(this,ut,r),l(this,ht)==="single_session"){(!l(this,ln)||i!==r.screenID)&&k(this,cn,!0);return}l(this,ln)!==Fp(l(this,ht),r.screenID,l(this,Vt).clientGUID??"default-client")&&(k(this,Bt,null),k(this,qn,null),l(this,Ht)&&l(this,te).run.status==="idle"&&g(this,C,Rc).call(this).catch(c=>{g(this,C,zr).call(this,Io(c))}))}}te=new WeakMap,Ht=new WeakMap,Gr=new WeakMap,Bt=new WeakMap,qn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,Jn=new WeakMap,ln=new WeakMap,Wr=new WeakMap,Ct=new WeakMap,ut=new WeakMap,cn=new WeakMap,Xn=new WeakMap,jt=new WeakMap,un=new WeakMap,ys=new WeakMap,Vt=new WeakMap,ht=new WeakMap,ka=new WeakMap,Gt=new WeakMap,C=new WeakSet,bv=async function(){try{g(this,C,He).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await t2({serverURL:l(this,Vt).serverURL,token:l(this,Vt).token,createSocket:l(this,ys),onDisconnect:l(this,ka)});k(this,Kn,i),g(this,C,He).call(this,{bridge:i}),k(this,Gt,r),r.addEventListener("close",l(this,bs)),r.addEventListener("error",l(this,ws)),k(this,Ht,new ZR(s=>({connection:s,sessionUpdate:async o=>{await g(this,C,_v).call(this,o)},requestPermission:async o=>g(this,C,kv).call(this,o)}),t)),await l(this,Ht).initialize({protocolVersion:EC,clientCapabilities:{},clientInfo:qR})}catch(t){throw t}},wv=function(t){g(this,C,zr).call(this,Io(t))},Rc=async function(){const t=g(this,C,Iv).call(this);if(l(this,Bt)&&l(this,qn)===t){await l(this,Bt);return}k(this,qn,t),k(this,Bt,g(this,C,Sv).call(this,t)),await l(this,Bt)},Sv=async function(t){var a;const r=g(this,C,Yo).call(this);g(this,C,Pv).call(this);let i,s=!1;const o={cwd:g(this,C,Cv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(k(this,Xn,!0),k(this,jt,null),((a=l(this,Kn))==null?void 0:a.sessionIdStrategy)==="mapped"){const c=l(this,Jn).getActualSessionId(t);if(c)try{const u=await r.loadSession({...o,sessionId:c});if(QR(u))throw new Error("Mapped ACP session was not found");i=c,s=!0}catch{i=(await r.newSession(o)).sessionId,l(this,Jn).setActualSessionId(t,i),s=!1}else i=(await r.newSession(o)).sessionId,l(this,Jn).setActualSessionId(t,i),s=!1}else try{await r.loadSession({...o,sessionId:t}),i=t,s=l(this,te).messageOrder.length>0}catch{i=(await r.newSession(o)).sessionId,s=!1}}finally{k(this,Xn,!1),k(this,jt,null),g(this,C,Rn).call(this,"final")}await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),k(this,Yn,i),k(this,ln,t),s?(l(this,un).add(t),l(this,ht)==="single_session"&&k(this,cn,!1)):(l(this,un).delete(t),k(this,cn,l(this,ht)==="single_session")),g(this,C,He).call(this,{lifecycle:{status:"ready"}})},_v=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&g(this,C,$v).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&g(this,C,Ev).call(this,r.content.text);return;case"tool_call":g(this,C,xv).call(this,r);return;case"tool_call_update":g(this,C,Av).call(this,r);return;case"agent_thought_chunk":return;default:return}},kv=async function(t){return{outcome:{outcome:"cancelled"}}},Ev=function(t){k(this,jt,null);const r=e2(t);if(!r)return;if(!l(this,Ct)){const s={id:g(this,C,Or).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};k(this,Ct,s.id),g(this,C,Rr).call(this,s);return}const i=l(this,te).messagesById[l(this,Ct)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");g(this,C,Dr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},xv=function(t){g(this,C,Rn).call(this,"final");const r=g(this,C,Dc).call(this,t.toolCallId),i=Hp("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??g(this,C,Or).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){g(this,C,Dr).call(this,s);return}g(this,C,Rr).call(this,s)},Av=function(t){const r=g(this,C,Dc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=Hp(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??g(this,C,Or).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){g(this,C,Dr).call(this,a);return}g(this,C,Rr).call(this,a)},$v=function(t){if(g(this,C,Rn).call(this,"final"),!t)return;const r=l(this,Xn)?l(this,jt):null;if(!r){const s=Zp(t);if(!s)return;const o={id:g(this,C,Or).call(this,"user"),kind:"user",text:s,status:"final"};g(this,C,Rr).call(this,o),l(this,Xn)&&k(this,jt,o.id);return}const i=l(this,te).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");g(this,C,Dr).call(this,{...i,text:Zp(`${i.text}${t}`)})},Rn=function(t){if(!l(this,Ct))return;const r=l(this,te).messagesById[l(this,Ct)];(r==null?void 0:r.kind)==="assistant"&&g(this,C,Dr).call(this,{...r,status:t}),k(this,Ct,null)},Rr=function(t){g(this,C,He).call(this,{messagesById:{...l(this,te).messagesById,[t.id]:t},messageOrder:[...l(this,te).messageOrder,t.id]})},Dr=function(t){g(this,C,He).call(this,{messagesById:{...l(this,te).messagesById,[t.id]:t}})},He=function(t){const r={...l(this,te),...t};k(this,te,{...r,sendDisabled:r.lifecycle.status!=="ready"||r.run.status==="running"||r.run.status==="cancelling",cancelDisabled:!(r.run.status==="running"||r.run.status==="cancelling")||!r.run.canCancel}),this.dispatchEvent(new J("change"))},Tv=function(t){const r=l(this,ln);return!l(this,ut)||!r||!(l(this,ht)==="single_session"?l(this,cn)||!l(this,un).has(r):!l(this,un).has(r))?t:(k(this,cn,!1),l(this,un).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${l(this,ut).screenID}`,`screen_name: ${l(this,ut).screenName??""}`,"When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.","[/Television screen context]","",t].join(`
|
|
43
|
-
`))},Or=function(t){const r=`${t}-${l(this,Wr)}`;return k(this,Wr,l(this,Wr)+1),r},
|
|
42
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const p=d[1];if(e===d[0]){s(d);continue}if(n.external){const v=(c=n.external.registry.get(d[0]))==null?void 0:c.id;if(e!==d[0]&&v){s(d);continue}}if((u=n.metadataRegistry.get(d[0]))==null?void 0:u.id){s(d);continue}if(p.cycle){s(d);continue}if(p.count>1&&n.reused==="ref"){s(d);continue}}}function Pm(n,e){var o,a,c;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const d=n.seen.get(u);if(d.ref===null)return;const p=d.def??d.schema,y={...p},v=d.ref;if(d.ref=null,v){r(v);const E=n.seen.get(v),I=E.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(I)):Object.assign(p,I),Object.assign(p,y),u._zod.parent===v)for(const P in p)P==="$ref"||P==="allOf"||P in y||delete p[P];if(I.$ref&&E.def)for(const P in p)P==="$ref"||P==="allOf"||P in E.def&&JSON.stringify(p[P])===JSON.stringify(E.def[P])&&delete p[P]}const $=u._zod.parent;if($&&$!==v){r($);const E=n.seen.get($);if(E!=null&&E.schema.$ref&&(p.$ref=E.schema.$ref,E.def))for(const I in p)I==="$ref"||I==="allOf"||I in E.def&&JSON.stringify(p[I])===JSON.stringify(E.def[I])&&delete p[I]}n.override({zodSchema:u,jsonSchema:p,path:d.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(a=n.external.registry.get(e))==null?void 0:a.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(u)}Object.assign(i,t.def??t.schema);const s=((c=n.external)==null?void 0:c.defs)??{};for(const u of n.seen.entries()){const d=u[1];d.def&&d.defId&&(s[d.defId]=d.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...e["~standard"],jsonSchema:{input:pa(e,"input",n.processors),output:pa(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Le(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Le(r.element,t);if(r.type==="set")return Le(r.valueType,t);if(r.type==="lazy")return Le(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Le(r.innerType,t);if(r.type==="intersection")return Le(r.left,t)||Le(r.right,t);if(r.type==="record"||r.type==="map")return Le(r.keyType,t)||Le(r.valueType,t);if(r.type==="pipe")return Le(r.in,t)||Le(r.out,t);if(r.type==="object"){for(const i in r.shape)if(Le(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Le(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Le(i,t))return!0;return!!(r.rest&&Le(r.rest,t))}return!1}const R$=(n,e={})=>t=>{const r=Cm({...t,processors:e});return ye(n,r),Im(r,n),Pm(r,n)},pa=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Cm({...i??{},target:s,io:e,processors:t});return ye(n,o),Im(o,n),Pm(o,n)},D$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},O$=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=D$[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},z$=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=n._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof d=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d),typeof s=="number"&&(i.minimum=s,typeof d=="number"&&e.target!=="draft-04"&&(d>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},L$=(n,e,t,r)=>{t.type="boolean"},M$=(n,e,t,r)=>{t.not={}},N$=(n,e,t,r)=>{},U$=(n,e,t,r)=>{const i=n._zod.def,s=cm(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},F$=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},Z$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},H$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},B$=(n,e,t,r)=>{const i=t,s=n._zod.def,{minimum:o,maximum:a}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=ye(s.element,e,{...r,path:[...r.path,"items"]})},j$=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const d in o)i.properties[d]=ye(o[d],e,{...r,path:[...r.path,"properties",d]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(d=>{const p=s.shape[d]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=ye(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},V$=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>ye(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},G$=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=ye(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=c},W$=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=ye(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=d}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=ye(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ye(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(i.required=d)}},q$=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},Y$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},K$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},J$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},X$=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},Q$=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;ye(s,e,r);const o=e.seen.get(n);o.ref=s},eT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Rm=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},tT=x("ZodISODateTime",(n,e)=>{nA.init(n,e),fe.init(n,e)});function nT(n){return l$(tT,n)}const rT=x("ZodISODate",(n,e)=>{rA.init(n,e),fe.init(n,e)});function iT(n){return c$(rT,n)}const sT=x("ZodISOTime",(n,e)=>{iA.init(n,e),fe.init(n,e)});function oT(n){return u$(sT,n)}const aT=x("ZodISODuration",(n,e)=>{sA.init(n,e),fe.init(n,e)});function lT(n){return h$(aT,n)}const Dm=(n,e)=>{pm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>Yx(n,t)},flatten:{value:t=>qx(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Ac,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Ac,2)}},isEmpty:{get(){return n.issues.length===0}}})},Lp=x("ZodError",Dm),at=x("ZodError",Dm,{Parent:Error}),cT=qu(at),uT=Yu(at),hT=Wa(at),dT=qa(at),pT=Xx(at),fT=Qx(at),gT=e1(at),mT=t1(at),vT=n1(at),yT=r1(at),bT=i1(at),wT=s1(at),pe=x("ZodType",(n,e)=>(de.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:pa(n,"input"),output:pa(n,"output")}}),n.toJSONSchema=R$(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(En(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>xn(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>cT(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>hT(n,t,r),n.parseAsync=async(t,r)=>uT(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>dT(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>pT(n,t,r),n.decode=(t,r)=>fT(n,t,r),n.encodeAsync=async(t,r)=>gT(n,t,r),n.decodeAsync=async(t,r)=>mT(n,t,r),n.safeEncode=(t,r)=>vT(n,t,r),n.safeDecode=(t,r)=>yT(n,t,r),n.safeEncodeAsync=async(t,r)=>bT(n,t,r),n.safeDecodeAsync=async(t,r)=>wT(n,t,r),n.refine=(t,r)=>n.check(hC(t,r)),n.superRefine=t=>n.check(dC(t)),n.overwrite=t=>n.check(_i(t)),n.optional=()=>Up(n),n.exactOptional=()=>XT(n),n.nullable=()=>Fp(n),n.nullish=()=>Up(Fp(n)),n.nonoptional=t=>iC(n,t),n.array=()=>D(n),n.or=t=>B([n,t]),n.and=t=>Ka(n,t),n.transform=t=>Zp(n,KT(t)),n.default=t=>tC(n,t),n.prefault=t=>rC(n,t),n.catch=t=>oC(n,t),n.pipe=t=>Zp(n,t),n.readonly=()=>cC(n),n.describe=t=>{const r=n.clone();return ji.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=ji.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return ji.get(n);const r=n.clone();return ji.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Om=x("_ZodString",(n,e)=>{Ku.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>O$(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(v$(...r)),n.includes=(...r)=>n.check(w$(...r)),n.startsWith=(...r)=>n.check(S$(...r)),n.endsWith=(...r)=>n.check(_$(...r)),n.min=(...r)=>n.check(da(...r)),n.max=(...r)=>n.check($m(...r)),n.length=(...r)=>n.check(Tm(...r)),n.nonempty=(...r)=>n.check(da(1,...r)),n.lowercase=r=>n.check(y$(r)),n.uppercase=r=>n.check(b$(r)),n.trim=()=>n.check(E$()),n.normalize=(...r)=>n.check(k$(...r)),n.toLowerCase=()=>n.check(x$()),n.toUpperCase=()=>n.check(A$()),n.slugify=()=>n.check($$())}),ST=x("ZodString",(n,e)=>{Ku.init(n,e),Om.init(n,e),n.email=t=>n.check(ZA(_T,t)),n.url=t=>n.check(GA(kT,t)),n.jwt=t=>n.check(a$(NT,t)),n.emoji=t=>n.check(WA(ET,t)),n.guid=t=>n.check(Rp(Mp,t)),n.uuid=t=>n.check(HA(Co,t)),n.uuidv4=t=>n.check(BA(Co,t)),n.uuidv6=t=>n.check(jA(Co,t)),n.uuidv7=t=>n.check(VA(Co,t)),n.nanoid=t=>n.check(qA(xT,t)),n.guid=t=>n.check(Rp(Mp,t)),n.cuid=t=>n.check(YA(AT,t)),n.cuid2=t=>n.check(KA($T,t)),n.ulid=t=>n.check(JA(TT,t)),n.base64=t=>n.check(i$(zT,t)),n.base64url=t=>n.check(s$(LT,t)),n.xid=t=>n.check(XA(CT,t)),n.ksuid=t=>n.check(QA(IT,t)),n.ipv4=t=>n.check(e$(PT,t)),n.ipv6=t=>n.check(t$(RT,t)),n.cidrv4=t=>n.check(n$(DT,t)),n.cidrv6=t=>n.check(r$(OT,t)),n.e164=t=>n.check(o$(MT,t)),n.datetime=t=>n.check(nT(t)),n.date=t=>n.check(iT(t)),n.time=t=>n.check(oT(t)),n.duration=t=>n.check(lT(t))});function h(n){return FA(ST,n)}const fe=x("ZodStringFormat",(n,e)=>{le.init(n,e),Om.init(n,e)}),_T=x("ZodEmail",(n,e)=>{W1.init(n,e),fe.init(n,e)}),Mp=x("ZodGUID",(n,e)=>{V1.init(n,e),fe.init(n,e)}),Co=x("ZodUUID",(n,e)=>{G1.init(n,e),fe.init(n,e)}),kT=x("ZodURL",(n,e)=>{q1.init(n,e),fe.init(n,e)}),ET=x("ZodEmoji",(n,e)=>{Y1.init(n,e),fe.init(n,e)}),xT=x("ZodNanoID",(n,e)=>{K1.init(n,e),fe.init(n,e)}),AT=x("ZodCUID",(n,e)=>{J1.init(n,e),fe.init(n,e)}),$T=x("ZodCUID2",(n,e)=>{X1.init(n,e),fe.init(n,e)}),TT=x("ZodULID",(n,e)=>{Q1.init(n,e),fe.init(n,e)}),CT=x("ZodXID",(n,e)=>{eA.init(n,e),fe.init(n,e)}),IT=x("ZodKSUID",(n,e)=>{tA.init(n,e),fe.init(n,e)}),PT=x("ZodIPv4",(n,e)=>{oA.init(n,e),fe.init(n,e)}),RT=x("ZodIPv6",(n,e)=>{aA.init(n,e),fe.init(n,e)}),DT=x("ZodCIDRv4",(n,e)=>{lA.init(n,e),fe.init(n,e)}),OT=x("ZodCIDRv6",(n,e)=>{cA.init(n,e),fe.init(n,e)}),zT=x("ZodBase64",(n,e)=>{uA.init(n,e),fe.init(n,e)}),LT=x("ZodBase64URL",(n,e)=>{dA.init(n,e),fe.init(n,e)}),MT=x("ZodE164",(n,e)=>{pA.init(n,e),fe.init(n,e)}),NT=x("ZodJWT",(n,e)=>{gA.init(n,e),fe.init(n,e)}),zm=x("ZodNumber",(n,e)=>{km.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>z$(n,r,i),n.gt=(r,i)=>n.check(Op(r,i)),n.gte=(r,i)=>n.check(Gl(r,i)),n.min=(r,i)=>n.check(Gl(r,i)),n.lt=(r,i)=>n.check(Dp(r,i)),n.lte=(r,i)=>n.check(Vl(r,i)),n.max=(r,i)=>n.check(Vl(r,i)),n.int=r=>n.check(Np(r)),n.safe=r=>n.check(Np(r)),n.positive=r=>n.check(Op(0,r)),n.nonnegative=r=>n.check(Gl(0,r)),n.negative=r=>n.check(Dp(0,r)),n.nonpositive=r=>n.check(Vl(0,r)),n.multipleOf=(r,i)=>n.check(zp(r,i)),n.step=(r,i)=>n.check(zp(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function F(n){return d$(zm,n)}const UT=x("ZodNumberFormat",(n,e)=>{mA.init(n,e),zm.init(n,e)});function Np(n){return p$(UT,n)}const FT=x("ZodBoolean",(n,e)=>{vA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>L$(n,t,r)});function Ee(n){return f$(FT,n)}const ZT=x("ZodUnknown",(n,e)=>{yA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>N$()});function S(){return g$(ZT)}const HT=x("ZodNever",(n,e)=>{bA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>M$(n,t,r)});function BT(n){return m$(HT,n)}const jT=x("ZodArray",(n,e)=>{wA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>B$(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(da(t,r)),n.nonempty=t=>n.check(da(1,t)),n.max=(t,r)=>n.check($m(t,r)),n.length=(t,r)=>n.check(Tm(t,r)),n.unwrap=()=>n.element});function D(n,e){return T$(jT,n,e)}const Lm=x("ZodObject",(n,e)=>{_A.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>j$(n,t,r,i),ee(n,"shape",()=>e.shape),n.keyof=()=>fa(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:BT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>Bx(n,t),n.safeExtend=t=>jx(n,t),n.merge=t=>Vx(n,t),n.pick=t=>Zx(n,t),n.omit=t=>Hx(n,t),n.partial=(...t)=>Gx(Nm,n,t[0]),n.required=(...t)=>Wx(Um,n,t[0])});function Mm(n,e){const t={type:"object",shape:n??{},...z(e)};return new Lm(t)}function f(n,e){return new Lm({type:"object",shape:n,catchall:S(),...z(e)})}const VT=x("ZodUnion",(n,e)=>{kA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>V$(n,t,r,i),n.options=e.options});function B(n,e){return new VT({type:"union",options:n,...z(e)})}const GT=x("ZodIntersection",(n,e)=>{EA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>G$(n,t,r,i)});function Ka(n,e){return new GT({type:"intersection",left:n,right:e})}const WT=x("ZodRecord",(n,e)=>{xA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>W$(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new WT({type:"record",keyType:n,valueType:e,...z(t)})}const Tc=x("ZodEnum",(n,e)=>{AA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>U$(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Tc({...e,checks:[],...z(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Tc({...e,checks:[],...z(i),entries:s})}});function fa(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Tc({type:"enum",entries:t,...z(e)})}const qT=x("ZodLiteral",(n,e)=>{$A.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>F$(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function A(n,e){return new qT({type:"literal",values:Array.isArray(n)?n:[n],...z(e)})}const YT=x("ZodTransform",(n,e)=>{TA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>H$(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new am(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ss(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(ss(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function KT(n){return new YT({type:"transform",transform:n})}const Nm=x("ZodOptional",(n,e)=>{Am.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Rm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Up(n){return new Nm({type:"optional",innerType:n})}const JT=x("ZodExactOptional",(n,e)=>{CA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Rm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function XT(n){return new JT({type:"optional",innerType:n})}const QT=x("ZodNullable",(n,e)=>{IA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>q$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Fp(n){return new QT({type:"nullable",innerType:n})}const eC=x("ZodDefault",(n,e)=>{PA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>K$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function tC(n,e){return new eC({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():hm(e)}})}const nC=x("ZodPrefault",(n,e)=>{RA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>J$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function rC(n,e){return new nC({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():hm(e)}})}const Um=x("ZodNonOptional",(n,e)=>{DA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Y$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function iC(n,e){return new Um({type:"nonoptional",innerType:n,...z(e)})}const sC=x("ZodCatch",(n,e)=>{OA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>X$(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function oC(n,e){return new sC({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const aC=x("ZodPipe",(n,e)=>{zA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Q$(n,t,r,i),n.in=e.in,n.out=e.out});function Zp(n,e){return new aC({type:"pipe",in:n,out:e})}const lC=x("ZodReadonly",(n,e)=>{LA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>eT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function cC(n){return new lC({type:"readonly",innerType:n})}const uC=x("ZodCustom",(n,e)=>{MA.init(n,e),pe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Z$(n,t)});function hC(n,e={}){return C$(uC,n,e)}function dC(n){return I$(n)}const pC=["text/markdown","text/html"],fC=["committed","pending"];Mm({id:h().min(1),type:fa(pC),title:h(),status:fa(fC),externalFilePath:h().optional()});Mm({name:h().min(1),description:h(),accepts:D(h().min(1)).min(1)});function Ju(n){return typeof n=="object"&&n!==null}function gC(n){return!Ju(n)||n.type!=="ready"?!1:!("id"in n)}function mC(n){return!(!Ju(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function vC(n){return!Ju(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function yC(n,e){if(n===e)return 2;if(n==="*/*")return 0;const t=n.indexOf("/");if(t>0&&n.slice(t+1)==="*"){const r=n.slice(0,t),i=e.indexOf("/");if(i>0&&e.slice(0,i)===r)return 1}return null}function bC(n,e){let t=null;for(const r of n.accepts){const i=yC(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function wC(n,e){let t=-1,r=null;for(const i of e){const s=bC(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const SC=4401;class Cc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class Ic extends vt{constructor(t){super();b(this,"url");b(this,"name");b(this,"token");b(this,"status","disconnected");b(this,"screens",new Map);b(this,"views",[]);b(this,"client");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=xt(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.createClient=t.createClient??((r,i)=>new Ex(r,{token:i??void 0})),this.client=this.createClient(this.url,this.token)}async connect(){var i;this.connectAttempt+=1;const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this.token),this.status="connecting",this.dispatchEvent(new J("change"));const r=this.createSocket(_C(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const c=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new J("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new J("change")),o(p))},d=async()=>{try{const[{screens:p},y]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(v=>[v.id,structuredClone(v)])),this.views=y,this.dispatchEvent(new J("change")),c()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{d()}),r.addEventListener("message",p=>{const y=EC(p);y&&(this.applyServerEvent(y),this.dispatchEvent(new Qg("server-event",{serverURL:this.url,event:y})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,kC(p)===SC){u(new Cc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new J("change"))}}),r.addEventListener("error",()=>{u(new Error("WebSocket connection failed"))})})}disconnect(){var t;this.connectAttempt+=1,(t=this.socket)==null||t.close(),this.socket=null,this.status="disconnected",this.dispatchEvent(new J("change"))}getViewURL(t){const r=wC(t.type,this.views);if(!r)return null;const i=`${this.url}/views/${encodeURIComponent(r.id)}/`;return this.token===null?i:`${i}?token=${encodeURIComponent(this.token)}`}getContentURL(t){const r=`${this.url}/artifacts/${encodeURIComponent(t)}/content`;return this.token===null?r:`${r}?token=${encodeURIComponent(this.token)}`}async createScreen(t){const{screen:r}=await this.client.screens.create({name:t});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"screen-created":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new Wo("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new Wo("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new Wo("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!Kg(r.layout,t.artifact.id)&&(r.layout=[...r.layout,Yg(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=Fg(r.layout,t.artifactID));break}}}}function _C(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/events",t.search="",e&&t.searchParams.set("token",e),t.hash="",t.toString()}function kC(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function EC(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;try{return JSON.parse(e)}catch{return null}}class xC extends vt{constructor(t){super();b(this,"servers",new Map);b(this,"localServerURL");b(this,"localStore");b(this,"createSocket");b(this,"lastActiveServerURL");b(this,"serverListeners",new Map);b(this,"handleLocalStoreChange",()=>{const t=this.localStore.get().activeServerURL;t!==this.lastActiveServerURL&&(this.lastActiveServerURL=t,this.dispatchEvent(new J("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?xt(t.localServerURL):null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.lastActiveServerURL=this.localStore.get().activeServerURL,this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const t=this.localStore.get().activeServerURL;return t===null?null:this.servers.get(t)??null}add(t){const r=xt(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new J("change"))},o=c=>{this.dispatchEvent(new Qg("server-event",{serverURL:c.serverURL,event:c.event}))},a=()=>{this.dispatchEvent(new Wo("screens-changed"))};t.addEventListener("change",s),t.addEventListener("server-event",o),t.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new J("change"))}remove(t){const r=xt(t);if(this.localServerURL&&r===this.localServerURL)return;const i=this.servers.get(r);if(!i)return;const s=this.serverListeners.get(r);s&&(i.removeEventListener("change",s.onServerChange),i.removeEventListener("server-event",s.onServerEvent),i.removeEventListener("screens-changed",s.onScreensChanged),this.serverListeners.delete(r)),i.disconnect(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(c=>c.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new J("change"))}setActive(t){const r=this.localStore.get(),i=t?xt(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=this.localStore.get().servers,s=t?xt(t):null;for(const a of i){const c=xt(a.url),u=s!==null&&c===s,d=new Ic({url:a.url,name:a.name,token:u?r??null:null,createSocket:this.createSocket});this.add(d),d.connect().catch(()=>{})}const o=s?this.servers.get(s)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=xt(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>xt(a.url)!==i),{url:i,name:r}]});const o=new Ic({url:i,name:r,createSocket:this.createSocket});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}const ae={authenticate:"authenticate",document_did_change:"document/didChange",document_did_close:"document/didClose",document_did_focus:"document/didFocus",document_did_open:"document/didOpen",document_did_save:"document/didSave",initialize:"initialize",logout:"logout",nes_accept:"nes/accept",nes_close:"nes/close",nes_reject:"nes/reject",nes_start:"nes/start",nes_suggest:"nes/suggest",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},Nt={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"},AC=1,$C=f({_meta:_(h(),S()).nullish(),terminal:Ee().optional().default(!1)}),TC=f({_meta:_(h(),S()).nullish(),label:h().nullish(),name:h(),optional:Ee().optional().default(!1),secret:Ee().optional().default(!0)}),CC=f({_meta:_(h(),S()).nullish(),description:h().nullish(),id:h(),name:h()}),IC=f({_meta:_(h(),S()).nullish(),description:h().nullish(),id:h(),link:h().nullish(),name:h(),vars:D(TC)}),PC=f({_meta:_(h(),S()).nullish(),args:D(h()).optional(),description:h().nullish(),env:_(h(),h()).optional(),id:h(),name:h()}),RC=B([IC.and(f({type:A("env_var")})),PC.and(f({type:A("terminal")})),CC]),DC=f({_meta:_(h(),S()).nullish(),methodId:h()}),OC=f({_meta:_(h(),S()).nullish()}),zC=f({_meta:_(h(),S()).nullish(),blob:h(),mimeType:h().nullish(),uri:h()}),LC=f({default:Ee().nullish(),description:h().nullish(),title:h().nullish()}),MC=f({_meta:_(h(),S()).nullish()}),NC=f({_meta:_(h(),S()).nullish()}),UC=f({amount:F(),currency:h()}),FC=f({_meta:_(h(),S()).nullish(),terminalId:h()}),ZC=f({_meta:_(h(),S()).nullish(),newText:h(),oldText:h().nullish(),path:h()}),HC=B([h(),F(),F(),Ee(),D(h())]),BC=f({content:_(h(),HC).nullish()}),jC=B([BC.and(f({action:A("accept")})),f({action:A("decline")}),f({action:A("cancel")})]),VC=f({_meta:_(h(),S()).nullish()}),Fm=h(),GC=f({_meta:_(h(),S()).nullish(),elicitationId:Fm}),WC=f({_meta:_(h(),S()).nullish(),action:jC}),qC=A("object"),YC=A("string"),KC=f({_meta:_(h(),S()).nullish()}),JC=f({_meta:_(h(),S()).nullish(),form:VC.nullish(),url:KC.nullish()}),XC=f({elicitationId:Fm,url:h().url()}),Zm=f({const:h(),title:h()}),Hm=f({_meta:_(h(),S()).nullish(),name:h(),value:h()}),QC=B([A(-32700),A(-32600),A(-32601),A(-32602),A(-32603),A(-32800),A(-32e3),A(-32002),A(-32042),F().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),Bm=f({code:QC,data:S().optional(),message:h()}),jm=S(),Vm=S(),Gm=S(),eI=f({_meta:_(h(),S()).nullish(),readTextFile:Ee().optional().default(!1),writeTextFile:Ee().optional().default(!1)}),Wm=f({_meta:_(h(),S()).nullish(),name:h(),value:h()}),qm=f({_meta:_(h(),S()).nullish(),name:h(),title:h().nullish(),version:h()}),tI=f({default:F().nullish(),description:h().nullish(),maximum:F().nullish(),minimum:F().nullish(),title:h().nullish()}),nI=f({_meta:_(h(),S()).nullish()}),rI=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cursor:h().nullish(),cwd:h().nullish()}),iI=f({_meta:_(h(),S()).nullish()}),sI=f({_meta:_(h(),S()).nullish(),logout:iI.nullish()}),oI=f({_meta:_(h(),S()).nullish()}),aI=f({_meta:_(h(),S()).nullish()}),lI=f({_meta:_(h(),S()).nullish(),http:Ee().optional().default(!1),sse:Ee().optional().default(!1)}),cI=f({_meta:_(h(),S()).nullish(),headers:D(Wm),name:h(),url:h()}),uI=f({_meta:_(h(),S()).nullish(),headers:D(Wm),name:h(),url:h()}),hI=f({_meta:_(h(),S()).nullish(),args:D(h()),command:h(),env:D(Hm),name:h()}),Ja=B([cI.and(f({type:A("http")})),uI.and(f({type:A("sse")})),hI]),Xu=h(),dI=f({_meta:_(h(),S()).nullish(),description:h().nullish(),modelId:Xu,name:h()}),pI=B([A("error"),A("warning"),A("information"),A("hint")]),fI=f({_meta:_(h(),S()).nullish()}),gI=f({_meta:_(h(),S()).nullish()}),mI=f({_meta:_(h(),S()).nullish()}),vI=f({_meta:_(h(),S()).nullish()}),yI=f({_meta:_(h(),S()).nullish()}),bI=f({_meta:_(h(),S()).nullish(),maxCount:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),wI=f({diff:h(),uri:h()}),SI=f({endLine:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:h()}),_I=f({_meta:_(h(),S()).nullish()}),kI=f({_meta:_(h(),S()).nullish()}),EI=f({languageId:h(),text:h(),uri:h()}),xI=f({_meta:_(h(),S()).nullish(),maxCount:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),AI=B([A("rejected"),A("ignored"),A("replaced"),A("cancelled")]),$I=f({excerpts:D(SI),uri:h()}),TI=f({_meta:_(h(),S()).nullish()}),CI=f({_meta:_(h(),S()).nullish()}),II=f({name:h(),owner:h(),remoteUrl:h()}),PI=f({_meta:_(h(),S()).nullish()}),RI=f({_meta:_(h(),S()).nullish(),jump:_I.nullish(),rename:CI.nullish(),searchAndReplace:PI.nullish()}),DI=f({id:h(),isRegex:Ee().nullish(),replace:h(),search:h(),uri:h()}),OI=B([A("automatic"),A("diagnostic"),A("manual")]),zI=f({_meta:_(h(),S()).nullish(),maxCount:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),LI=f({_meta:_(h(),S()).nullish(),diagnostics:fI.nullish(),editHistory:bI.nullish(),openFiles:kI.nullish(),recentFiles:xI.nullish(),relatedSnippets:TI.nullish(),userActions:zI.nullish()}),MI=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja)}),NI=f({default:F().nullish(),description:h().nullish(),maximum:F().nullish(),minimum:F().nullish(),title:h().nullish()}),Ym=h(),UI=B([A("allow_once"),A("allow_always"),A("reject_once"),A("reject_always")]),FI=f({_meta:_(h(),S()).nullish(),kind:UI,name:h(),optionId:Ym}),ZI=B([A("high"),A("medium"),A("low")]),HI=B([A("pending"),A("in_progress"),A("completed")]),BI=f({_meta:_(h(),S()).nullish(),content:h(),priority:ZI,status:HI}),jI=f({_meta:_(h(),S()).nullish(),entries:D(BI)}),yn=f({character:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),VI=f({id:h(),position:yn,uri:h()}),GI=f({id:h(),newName:h(),position:yn,uri:h()}),WI=f({action:h(),position:yn,timestampMs:F(),uri:h()}),Km=B([A("utf-16"),A("utf-32"),A("utf-8")]),qI=f({_meta:_(h(),S()).nullish(),auth:$C.optional().default({terminal:!1}),elicitation:JC.nullish(),fs:eI.optional().default({readTextFile:!1,writeTextFile:!1}),nes:RI.nullish(),positionEncodings:D(Km).optional(),terminal:Ee().optional().default(!1)}),YI=f({_meta:_(h(),S()).nullish(),audio:Ee().optional().default(!1),embeddedContext:Ee().optional().default(!1),image:Ee().optional().default(!1)}),Jm=F().int().gte(0).lte(65535),KI=f({_meta:_(h(),S()).nullish(),clientCapabilities:qI.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:qm.nullish(),protocolVersion:Jm}),ki=f({end:yn,start:yn}),JI=f({message:h(),range:ki,severity:pI,uri:h()}),XI=f({languageId:h(),lastFocusedMs:F().nullish(),uri:h(),visibleRange:ki.nullish()}),QI=f({_meta:_(h(),S()).nullish(),diagnostics:D(JI).nullish(),editHistory:D(wI).nullish(),openFiles:D(XI).nullish(),recentFiles:D(EI).nullish(),relatedSnippets:D($I).nullish(),userActions:D(WI).nullish()}),eP=f({newText:h(),range:ki}),tP=f({cursorPosition:yn.nullish(),edits:D(eP),id:h(),uri:h()}),nP=B([tP.and(f({kind:A("edit")})),VI.and(f({kind:A("jump")})),GI.and(f({kind:A("rename")})),DI.and(f({kind:A("searchAndReplace")}))]),rP=f({_meta:_(h(),S()).nullish(),content:h()}),iP=f({_meta:_(h(),S()).nullish()}),dr=B([F(),h()]).nullable();f({_meta:_(h(),S()).nullish(),requestId:dr});const sP=fa(["assistant","user"]),oo=f({_meta:_(h(),S()).nullish(),audience:D(sP).nullish(),lastModified:h().nullish(),priority:F().nullish()}),oP=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),data:h(),mimeType:h()}),aP=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),data:h(),mimeType:h(),uri:h().nullish()}),lP=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),description:h().nullish(),mimeType:h().nullish(),name:h(),size:F().nullish(),title:h().nullish(),uri:h()}),cP=f({_meta:_(h(),S()).nullish(),optionId:Ym}),uP=B([f({outcome:A("cancelled")}),cP.and(f({outcome:A("selected")}))]),hP=f({_meta:_(h(),S()).nullish(),outcome:uP}),dP=f({_meta:_(h(),S()).nullish()}),pP=f({_meta:_(h(),S()).nullish()}),fP=f({currentValue:Ee()}),gP=h(),Xm=h(),mP=B([A("mode"),A("model"),A("thought_level"),h()]),Qu=h(),Qm=f({_meta:_(h(),S()).nullish(),description:h().nullish(),name:h(),value:Qu}),vP=f({_meta:_(h(),S()).nullish(),group:gP,name:h(),options:D(Qm)}),yP=B([D(Qm),D(vP)]),bP=f({currentValue:Qu,options:yP}),Ei=Ka(B([bP.and(f({type:A("select")})),fP.and(f({type:A("boolean")}))]),f({_meta:_(h(),S()).nullish(),category:mP.nullish(),description:h().nullish(),id:Xm,name:h()})),wP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei)}),SP=f({_meta:_(h(),S()).nullish()}),K=h(),_P=f({_meta:_(h(),S()).nullish(),id:h(),sessionId:K}),kP=f({_meta:_(h(),S()).nullish(),sessionId:K}),EP=f({_meta:_(h(),S()).nullish(),sessionId:K}),xP=f({_meta:_(h(),S()).nullish(),sessionId:K}),ev=f({_meta:_(h(),S()).nullish(),args:D(h()).optional(),command:h(),cwd:h().nullish(),env:D(Hm).optional(),outputByteLimit:F().nullish(),sessionId:K}),AP=f({_meta:_(h(),S()).nullish(),sessionId:K,uri:h()}),$P=f({_meta:_(h(),S()).nullish(),position:yn,sessionId:K,uri:h(),version:F(),visibleRange:ki}),TP=f({_meta:_(h(),S()).nullish(),languageId:h(),sessionId:K,text:h(),uri:h(),version:F()}),CP=f({_meta:_(h(),S()).nullish(),sessionId:K,uri:h()}),IP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja).optional(),sessionId:K}),tv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),PP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja),sessionId:K}),nv=f({_meta:_(h(),S()).nullish(),limit:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:h(),sessionId:K}),RP=f({_meta:_(h(),S()).nullish(),id:h(),reason:AI.nullish(),sessionId:K}),rv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),DP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),mcpServers:D(Ja).optional(),sessionId:K}),OP=f({_meta:_(h(),S()).nullish(),additionalDirectories:D(h()).optional(),cwd:h(),sessionId:K,title:h().nullish(),updatedAt:h().nullish()}),zP=f({_meta:_(h(),S()).nullish(),nextCursor:h().nullish(),sessions:D(OP)}),LP=f({_meta:_(h(),S()).nullish(),title:h().nullish(),updatedAt:h().nullish()}),MP=f({_meta:_(h(),S()).nullish()}),Xa=h(),NP=f({_meta:_(h(),S()).nullish(),currentModeId:Xa}),UP=f({_meta:_(h(),S()).nullish(),description:h().nullish(),id:Xa,name:h()}),Qa=f({_meta:_(h(),S()).nullish(),availableModes:D(UP),currentModeId:Xa}),el=f({_meta:_(h(),S()).nullish(),availableModels:D(dI),currentModelId:Xu}),FP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish(),sessionId:K}),ZP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish()}),HP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish(),sessionId:K}),BP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei).nullish(),models:el.nullish(),modes:Qa.nullish()}),jP=f({_meta:_(h(),S()).nullish()}),VP=f({_meta:_(h(),S()).nullish(),additionalDirectories:dP.nullish(),close:pP.nullish(),fork:SP.nullish(),list:MP.nullish(),resume:jP.nullish()}),GP=Ka(B([f({type:A("boolean"),value:Ee()}),f({value:Qu})]),f({_meta:_(h(),S()).nullish(),configId:Xm,sessionId:K})),WP=f({_meta:_(h(),S()).nullish(),configOptions:D(Ei)}),qP=f({_meta:_(h(),S()).nullish(),modeId:Xa,sessionId:K}),YP=f({_meta:_(h(),S()).nullish()}),KP=f({_meta:_(h(),S()).nullish(),modelId:Xu,sessionId:K}),JP=f({_meta:_(h(),S()).nullish()}),XP=f({_meta:_(h(),S()).nullish(),sessionId:K}),QP=B([A("end_turn"),A("max_tokens"),A("max_turn_requests"),A("refusal"),A("cancelled")]),eR=B([A("email"),A("uri"),A("date"),A("date-time")]),tR=f({default:h().nullish(),description:h().nullish(),enum:D(h()).nullish(),format:eR.nullish(),maxLength:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(Zm).nullish(),pattern:h().nullish(),title:h().nullish()}),nR=f({_meta:_(h(),S()).nullish(),context:QI.nullish(),position:yn,selection:ki.nullish(),sessionId:K,triggerKind:OI,uri:h(),version:F()}),rR=f({_meta:_(h(),S()).nullish(),suggestions:D(nP)}),iR=f({_meta:_(h(),S()).nullish(),terminalId:h()}),sR=f({_meta:_(h(),S()).nullish(),exitCode:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:h().nullish()}),iv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),oR=f({_meta:_(h(),S()).nullish(),exitStatus:sR.nullish(),output:h(),truncated:Ee()}),aR=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),text:h()}),lR=f({range:ki.nullish(),text:h()}),cR=f({_meta:_(h(),S()).nullish(),contentChanges:D(lR),sessionId:K,uri:h(),version:F()});f({method:h(),params:B([kP,TP,cR,AP,CP,$P,_P,RP,jm]).nullish()});const uR=B([A("full"),A("incremental")]),hR=f({_meta:_(h(),S()).nullish(),syncKind:uR}),dR=f({_meta:_(h(),S()).nullish(),didChange:hR.nullish(),didClose:gI.nullish(),didFocus:mI.nullish(),didOpen:vI.nullish(),didSave:yI.nullish()}),pR=f({_meta:_(h(),S()).nullish(),document:dR.nullish()}),fR=f({_meta:_(h(),S()).nullish(),context:LI.nullish(),events:pR.nullish()}),gR=f({_meta:_(h(),S()).nullish(),auth:sI.optional().default({}),loadSession:Ee().optional().default(!1),mcpCapabilities:lI.optional().default({http:!1,sse:!1}),nes:fR.nullish(),positionEncoding:Km.nullish(),promptCapabilities:YI.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:VP.optional().default({})}),mR=f({_meta:_(h(),S()).nullish(),agentCapabilities:gR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:qm.nullish(),authMethods:D(RC).optional().default([]),protocolVersion:Jm}),vR=f({_meta:_(h(),S()).nullish(),mimeType:h().nullish(),text:h(),uri:h()}),yR=B([vR,zC]),bR=f({_meta:_(h(),S()).nullish(),annotations:oo.nullish(),resource:yR}),eh=B([aR.and(f({type:A("text")})),aP.and(f({type:A("image")})),oP.and(f({type:A("audio")})),lP.and(f({type:A("resource_link")})),bR.and(f({type:A("resource")}))]),wR=f({_meta:_(h(),S()).nullish(),content:eh}),Wl=f({_meta:_(h(),S()).nullish(),content:eh,messageId:h().nullish()}),SR=f({_meta:_(h(),S()).nullish(),messageId:h().nullish(),prompt:D(eh),sessionId:K}),_R=f({anyOf:D(Zm)}),sv=B([wR.and(f({type:A("content")})),ZC.and(f({type:A("diff")})),iR.and(f({type:A("terminal")}))]),ov=h(),av=f({_meta:_(h(),S()).nullish(),line:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:h()}),lv=B([A("pending"),A("in_progress"),A("completed"),A("failed")]),cv=B([A("read"),A("edit"),A("delete"),A("move"),A("search"),A("execute"),A("think"),A("fetch"),A("switch_mode"),A("other")]),kR=f({_meta:_(h(),S()).nullish(),content:D(sv).optional(),kind:cv.optional(),locations:D(av).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:lv.optional(),title:h(),toolCallId:ov}),uv=f({_meta:_(h(),S()).nullish(),content:D(sv).nullish(),kind:cv.nullish(),locations:D(av).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:lv.nullish(),title:h().nullish(),toolCallId:ov}),hv=f({_meta:_(h(),S()).nullish(),options:D(FI),sessionId:K,toolCall:uv}),ER=f({_meta:_(h(),S()).nullish(),hint:h()}),xR=ER,AR=f({_meta:_(h(),S()).nullish(),description:h(),input:xR.nullish(),name:h()}),$R=f({_meta:_(h(),S()).nullish(),availableCommands:D(AR)}),TR=f({enum:D(h()),type:YC}),CR=B([TR,_R]),IR=f({default:D(h()).nullish(),description:h().nullish(),items:CR,maxItems:F().nullish(),minItems:F().nullish(),title:h().nullish()}),PR=B([tR.and(f({type:A("string")})),NI.and(f({type:A("number")})),tI.and(f({type:A("integer")})),LC.and(f({type:A("boolean")})),IR.and(f({type:A("array")}))]),RR=f({description:h().nullish(),properties:_(h(),PR).optional().default({}),required:D(h()).nullish(),title:h().nullish(),type:qC.optional().default("object")}),DR=f({requestedSchema:RR}),OR=Ka(B([DR.and(f({mode:A("form")})),XC.and(f({mode:A("url")}))]),f({_meta:_(h(),S()).nullish(),message:h(),sessionId:K})),zR=f({cachedReadTokens:F().nullish(),cachedWriteTokens:F().nullish(),inputTokens:F(),outputTokens:F(),thoughtTokens:F().nullish(),totalTokens:F()}),LR=f({_meta:_(h(),S()).nullish(),stopReason:QP,usage:zR.nullish(),userMessageId:h().nullish()});B([f({id:dr,result:B([mR,OC,aI,HP,ZP,zP,FP,BP,NC,YP,WP,LR,JP,XP,rR,MC,Gm])}),f({error:Bm,id:dr})]);const MR=f({_meta:_(h(),S()).nullish(),cost:UC.nullish(),size:F(),used:F()}),NR=B([Wl.and(f({sessionUpdate:A("user_message_chunk")})),Wl.and(f({sessionUpdate:A("agent_message_chunk")})),Wl.and(f({sessionUpdate:A("agent_thought_chunk")})),kR.and(f({sessionUpdate:A("tool_call")})),uv.and(f({sessionUpdate:A("tool_call_update")})),jI.and(f({sessionUpdate:A("plan")})),$R.and(f({sessionUpdate:A("available_commands_update")})),NP.and(f({sessionUpdate:A("current_mode_update")})),wP.and(f({sessionUpdate:A("config_option_update")})),LP.and(f({sessionUpdate:A("session_info_update")})),MR.and(f({sessionUpdate:A("usage_update")}))]),dv=f({_meta:_(h(),S()).nullish(),sessionId:K,update:NR});f({method:h(),params:B([dv,GC,jm]).nullish()});const pv=f({_meta:_(h(),S()).nullish(),sessionId:K,terminalId:h()}),UR=f({_meta:_(h(),S()).nullish(),exitCode:F().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:h().nullish()}),FR=f({name:h(),uri:h()}),ZR=f({_meta:_(h(),S()).nullish(),repository:II.nullish(),workspaceFolders:D(FR).nullish(),workspaceUri:h().nullish()});f({id:dr,method:h(),params:B([KI,DC,oI,MI,PP,rI,IP,DP,xP,qP,GP,SR,KP,ZR,nR,EP,Vm]).nullish()});const fv=f({_meta:_(h(),S()).nullish(),content:h(),path:h(),sessionId:K});f({id:dr,method:h(),params:B([fv,nv,hv,ev,iv,rv,pv,tv,OR,Vm]).nullish()});const HR=f({_meta:_(h(),S()).nullish()});B([f({id:dr,result:B([HR,rP,hP,FC,oR,iP,UR,nI,WC,Gm])}),f({error:Bm,id:dr})]);var Y;class BR{constructor(e,t){w(this,Y);const r=e(this),i=async(o,a)=>{var c,u,d,p,y,v,$;switch(o){case Nt.fs_write_text_file:{const E=fv.parse(a);return(c=r.writeTextFile)==null?void 0:c.call(r,E)}case Nt.fs_read_text_file:{const E=nv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,E)}case Nt.session_request_permission:{const E=hv.parse(a);return r.requestPermission(E)}case Nt.terminal_create:{const E=ev.parse(a);return(d=r.createTerminal)==null?void 0:d.call(r,E)}case Nt.terminal_output:{const E=iv.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,E)}case Nt.terminal_release:{const E=rv.parse(a);return await((y=r.releaseTerminal)==null?void 0:y.call(r,E))??{}}case Nt.terminal_wait_for_exit:{const E=pv.parse(a);return(v=r.waitForTerminalExit)==null?void 0:v.call(r,E)}case Nt.terminal_kill:{const E=tv.parse(a);return await(($=r.killTerminal)==null?void 0:$.call(r,E))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw we.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Nt.session_update:{const c=dv.parse(a);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(o,a);throw we.methodNotFound(o)}};k(this,Y,new jR(i,s,t))}async initialize(e){return await l(this,Y).sendRequest(ae.initialize,e)}async newSession(e){return await l(this,Y).sendRequest(ae.session_new,e)}async loadSession(e){return await l(this,Y).sendRequest(ae.session_load,e)??{}}async unstable_forkSession(e){return await l(this,Y).sendRequest(ae.session_fork,e)}async listSessions(e){return await l(this,Y).sendRequest(ae.session_list,e)}async unstable_resumeSession(e){return await l(this,Y).sendRequest(ae.session_resume,e)}async unstable_closeSession(e){return await l(this,Y).sendRequest(ae.session_close,e)}async setSessionMode(e){return await l(this,Y).sendRequest(ae.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await l(this,Y).sendRequest(ae.session_set_model,e)??{}}async setSessionConfigOption(e){return await l(this,Y).sendRequest(ae.session_set_config_option,e)}async authenticate(e){return await l(this,Y).sendRequest(ae.authenticate,e)??{}}async unstable_logout(e){return await l(this,Y).sendRequest(ae.logout,e)??{}}async prompt(e){return await l(this,Y).sendRequest(ae.session_prompt,e)}async cancel(e){return await l(this,Y).sendNotification(ae.session_cancel,e)}async unstable_startNes(e){return await l(this,Y).sendRequest(ae.nes_start,e)}async unstable_suggestNes(e){return await l(this,Y).sendRequest(ae.nes_suggest,e)}async unstable_closeNes(e){return await l(this,Y).sendRequest(ae.nes_close,e)??{}}async unstable_didOpenDocument(e){return await l(this,Y).sendNotification(ae.document_did_open,e)}async unstable_didChangeDocument(e){return await l(this,Y).sendNotification(ae.document_did_change,e)}async unstable_didCloseDocument(e){return await l(this,Y).sendNotification(ae.document_did_close,e)}async unstable_didSaveDocument(e){return await l(this,Y).sendNotification(ae.document_did_save,e)}async unstable_didFocusDocument(e){return await l(this,Y).sendNotification(ae.document_did_focus,e)}async unstable_acceptNes(e){return await l(this,Y).sendNotification(ae.nes_accept,e)}async unstable_rejectNes(e){return await l(this,Y).sendNotification(ae.nes_reject,e)}async extMethod(e,t){return await l(this,Y).sendRequest(e,t)}async extNotification(e,t){return await l(this,Y).sendNotification(e,t)}get signal(){return l(this,Y).signal}get closed(){return l(this,Y).closed}}Y=new WeakMap;var an,_a,gs,ms,jr,Vr,Tt,vs,he,gv,Pc,mv,vv,yv,bv,Rc,Vi;class jR{constructor(e,t,r){w(this,he);w(this,an,new Map);w(this,_a,0);w(this,gs);w(this,ms);w(this,jr);w(this,Vr,Promise.resolve());w(this,Tt,new AbortController);w(this,vs);k(this,gs,e),k(this,ms,t),k(this,jr,r),k(this,vs,new Promise(i=>{l(this,Tt).signal.addEventListener("abort",()=>i())})),g(this,he,gv).call(this)}get signal(){return l(this,Tt).signal}get closed(){return l(this,vs)}async sendRequest(e,t){g(this,he,Rc).call(this);const r=jh(this,_a)._++,i=new Promise((s,o)=>{l(this,an).set(r,{resolve:s,reject:o})});return await g(this,he,Vi).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){g(this,he,Rc).call(this),await g(this,he,Vi).call(this,{jsonrpc:"2.0",method:e,params:t})}}an=new WeakMap,_a=new WeakMap,gs=new WeakMap,ms=new WeakMap,jr=new WeakMap,Vr=new WeakMap,Tt=new WeakMap,vs=new WeakMap,he=new WeakSet,gv=async function(){let e;try{const t=l(this,jr).readable.getReader();try{for(;!l(this,Tt).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{g(this,he,mv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&g(this,he,Vi).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{g(this,he,Pc).call(this,e)}},Pc=function(e){if(l(this,Tt).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of l(this,an).values())r.reject(t);l(this,an).clear(),l(this,Tt).abort(t)},mv=async function(e){if("method"in e&&"id"in e){const t=await g(this,he,vv).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await g(this,he,Vi).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await g(this,he,yv).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?g(this,he,bv).call(this,e):console.error("Invalid message",{message:e})},vv=async function(e,t){try{return{result:await l(this,gs).call(this,e,t)??null}}catch(r){if(r instanceof we)return r.toResult();if(r instanceof Lp)return we.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 we.internalError(i?JSON.parse(i):{}).toResult()}catch{return we.internalError({details:i}).toResult()}}},yv=async function(e,t){try{return await l(this,ms).call(this,e,t),{result:null}}catch(r){if(r instanceof we)return r.toResult();if(r instanceof Lp)return we.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 we.internalError(i?JSON.parse(i):{}).toResult()}catch{return we.internalError({details:i}).toResult()}}},bv=function(e){const t=l(this,an).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new we(r,i,s))}l(this,an).delete(e.id)}else console.error("Got response to unknown request",e.id)},Rc=function(){if(l(this,Tt).signal.aborted)throw l(this,Tt).signal.reason??new Error("ACP connection closed")},Vi=async function(e){return k(this,Vr,l(this,Vr).then(async()=>{const t=l(this,jr).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{g(this,he,Pc).call(this,t)})),l(this,Vr)};class we extends Error{constructor(t,r,i){super(r);b(this,"code");b(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new we(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new we(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new we(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new we(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new we(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new we(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new we(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const VR=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,GR=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,WR=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,qR=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,YR="single_session",KR={name:"television-acp-client",version:"0.0.0"},wv="agent:main:television",JR=Si(vt);var te,Ht,Gr,Bt,qn,Yn,Kn,Jn,ln,Wr,Ct,ut,cn,Xn,jt,un,ys,Vt,ht,ka,Gt,C,Sv,_v,Dc,kv,Ev,xv,Av,$v,Tv,Cv,Rn,Rr,Dr,He,Iv,Or,Oc,zc,Yo,Pv,Rv,bs,ws,Lc,zr,Dv,Ov;class XR extends JR{constructor(t){super();w(this,C);w(this,te,e2());w(this,Ht,null);w(this,Gr,null);w(this,Bt,null);w(this,qn,null);w(this,Yn,null);w(this,Kn,null);w(this,Jn);w(this,ln,null);w(this,Wr,1);w(this,Ct,null);w(this,ut,null);w(this,cn,!1);w(this,Xn,!1);w(this,jt,null);w(this,un,new Set);w(this,ys);w(this,Vt);w(this,ht);w(this,ka,t=>{g(this,C,_v).call(this,t)});w(this,Gt,null);w(this,bs,()=>{g(this,C,zr).call(this,"ACP bridge websocket closed")});w(this,ws,()=>{g(this,C,zr).call(this,"ACP bridge websocket error")});k(this,Vt,t),k(this,ht,t.sessionMode??YR),k(this,Jn,t.mappedSessionStore??QR()),k(this,ys,t.createSocket??(r=>new WebSocket(r)))}getState(){return l(this,te)}get messages(){return l(this,te).messageOrder.map(t=>l(this,te).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(l(this,te).lifecycle.status!=="ready"){g(this,C,He).call(this,{lifecycle:{status:"connecting"}}),l(this,Gr)??k(this,Gr,g(this,C,Sv).call(this));try{await l(this,Gr),await g(this,C,Dc).call(this)}catch(t){throw g(this,C,zr).call(this,Io(t)),t}}}dispose(){g(this,C,Lc).call(this),g(this,C,He).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),l(this,te).lifecycle.status!=="ready"||l(this,te).run.status==="running"||l(this,te).run.status==="cancelling")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");g(this,C,Rr).call(this,{id:g(this,C,Or).call(this,"user"),kind:"user",text:r,status:"final"}),g(this,C,He).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await g(this,C,Yo).call(this).prompt({sessionId:g(this,C,zc).call(this),prompt:[{type:"text",text:g(this,C,Iv).call(this,r)}]});g(this,C,Rn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),g(this,C,He).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw g(this,C,Ov).call(this)||(g(this,C,Rn).call(this,"error"),g(this,C,He).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:Io(i)}})),i}}async cancel(){if(await this.connect(),!l(this,te).run.canCancel||l(this,te).run.status!=="running")throw new Error("No active cancellable run");g(this,C,He).call(this,{run:{...l(this,te).run,status:"cancelling"}}),await g(this,C,Yo).call(this).cancel({sessionId:g(this,C,zc).call(this)})}setScreenContext(t){var s,o,a;const r={screenID:t.screenID,screenName:t.screenName};if(((s=l(this,ut))==null?void 0:s.screenID)===r.screenID&&((o=l(this,ut))==null?void 0:o.screenName)===r.screenName)return;const i=((a=l(this,ut))==null?void 0:a.screenID)??null;if(k(this,ut,r),l(this,ht)==="single_session"){(!l(this,ln)||i!==r.screenID)&&k(this,cn,!0);return}l(this,ln)!==Hp(l(this,ht),r.screenID,l(this,Vt).clientGUID??"default-client")&&(k(this,Bt,null),k(this,qn,null),l(this,Ht)&&l(this,te).run.status==="idle"&&g(this,C,Dc).call(this).catch(c=>{g(this,C,zr).call(this,Io(c))}))}}te=new WeakMap,Ht=new WeakMap,Gr=new WeakMap,Bt=new WeakMap,qn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,Jn=new WeakMap,ln=new WeakMap,Wr=new WeakMap,Ct=new WeakMap,ut=new WeakMap,cn=new WeakMap,Xn=new WeakMap,jt=new WeakMap,un=new WeakMap,ys=new WeakMap,Vt=new WeakMap,ht=new WeakMap,ka=new WeakMap,Gt=new WeakMap,C=new WeakSet,Sv=async function(){try{g(this,C,He).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await r2({serverURL:l(this,Vt).serverURL,token:l(this,Vt).token,createSocket:l(this,ys),onDisconnect:l(this,ka)});k(this,Kn,i),g(this,C,He).call(this,{bridge:i}),k(this,Gt,r),r.addEventListener("close",l(this,bs)),r.addEventListener("error",l(this,ws)),k(this,Ht,new BR(s=>({connection:s,sessionUpdate:async o=>{await g(this,C,Ev).call(this,o)},requestPermission:async o=>g(this,C,xv).call(this,o)}),t)),await l(this,Ht).initialize({protocolVersion:AC,clientCapabilities:{},clientInfo:KR})}catch(t){throw t}},_v=function(t){g(this,C,zr).call(this,Io(t))},Dc=async function(){const t=g(this,C,Rv).call(this);if(l(this,Bt)&&l(this,qn)===t){await l(this,Bt);return}k(this,qn,t),k(this,Bt,g(this,C,kv).call(this,t)),await l(this,Bt)},kv=async function(t){var a;const r=g(this,C,Yo).call(this);g(this,C,Dv).call(this);let i,s=!1;const o={cwd:g(this,C,Pv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(k(this,Xn,!0),k(this,jt,null),((a=l(this,Kn))==null?void 0:a.sessionIdStrategy)==="mapped"){const c=l(this,Jn).getActualSessionId(t);if(c)try{const u=await r.loadSession({...o,sessionId:c});if(t2(u))throw new Error("Mapped ACP session was not found");i=c,s=!0}catch{i=(await r.newSession(o)).sessionId,l(this,Jn).setActualSessionId(t,i),s=!1}else i=(await r.newSession(o)).sessionId,l(this,Jn).setActualSessionId(t,i),s=!1}else try{await r.loadSession({...o,sessionId:t}),i=t,s=l(this,te).messageOrder.length>0}catch{i=(await r.newSession(o)).sessionId,s=!1}}finally{k(this,Xn,!1),k(this,jt,null),g(this,C,Rn).call(this,"final")}await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),k(this,Yn,i),k(this,ln,t),s?(l(this,un).add(t),l(this,ht)==="single_session"&&k(this,cn,!1)):(l(this,un).delete(t),k(this,cn,l(this,ht)==="single_session")),g(this,C,He).call(this,{lifecycle:{status:"ready"}})},Ev=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&g(this,C,Cv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&g(this,C,Av).call(this,r.content.text);return;case"tool_call":g(this,C,$v).call(this,r);return;case"tool_call_update":g(this,C,Tv).call(this,r);return;case"agent_thought_chunk":return;default:return}},xv=async function(t){return{outcome:{outcome:"cancelled"}}},Av=function(t){k(this,jt,null);const r=n2(t);if(!r)return;if(!l(this,Ct)){const s={id:g(this,C,Or).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};k(this,Ct,s.id),g(this,C,Rr).call(this,s);return}const i=l(this,te).messagesById[l(this,Ct)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");g(this,C,Dr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},$v=function(t){g(this,C,Rn).call(this,"final");const r=g(this,C,Oc).call(this,t.toolCallId),i=jp("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??g(this,C,Or).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){g(this,C,Dr).call(this,s);return}g(this,C,Rr).call(this,s)},Tv=function(t){const r=g(this,C,Oc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=jp(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??g(this,C,Or).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){g(this,C,Dr).call(this,a);return}g(this,C,Rr).call(this,a)},Cv=function(t){if(g(this,C,Rn).call(this,"final"),!t)return;const r=l(this,Xn)?l(this,jt):null;if(!r){const s=Bp(t);if(!s)return;const o={id:g(this,C,Or).call(this,"user"),kind:"user",text:s,status:"final"};g(this,C,Rr).call(this,o),l(this,Xn)&&k(this,jt,o.id);return}const i=l(this,te).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");g(this,C,Dr).call(this,{...i,text:Bp(`${i.text}${t}`)})},Rn=function(t){if(!l(this,Ct))return;const r=l(this,te).messagesById[l(this,Ct)];(r==null?void 0:r.kind)==="assistant"&&g(this,C,Dr).call(this,{...r,status:t}),k(this,Ct,null)},Rr=function(t){g(this,C,He).call(this,{messagesById:{...l(this,te).messagesById,[t.id]:t},messageOrder:[...l(this,te).messageOrder,t.id]})},Dr=function(t){g(this,C,He).call(this,{messagesById:{...l(this,te).messagesById,[t.id]:t}})},He=function(t){const r={...l(this,te),...t};k(this,te,{...r,sendDisabled:r.lifecycle.status!=="ready"||r.run.status==="running"||r.run.status==="cancelling",cancelDisabled:!(r.run.status==="running"||r.run.status==="cancelling")||!r.run.canCancel}),this.dispatchEvent(new J("change"))},Iv=function(t){const r=l(this,ln);return!l(this,ut)||!r||!(l(this,ht)==="single_session"?l(this,cn)||!l(this,un).has(r):!l(this,un).has(r))?t:(k(this,cn,!1),l(this,un).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${l(this,ut).screenID}`,`screen_name: ${l(this,ut).screenName??""}`,"When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.","[/Television screen context]","",t].join(`
|
|
43
|
+
`))},Or=function(t){const r=`${t}-${l(this,Wr)}`;return k(this,Wr,l(this,Wr)+1),r},Oc=function(t){for(const r of l(this,te).messageOrder){const i=l(this,te).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},zc=function(){if(!l(this,Yn))throw new Error("ACP session is not ready");return l(this,Yn)},Yo=function(){if(!l(this,Ht))throw new Error("ACP connection is not ready");return l(this,Ht)},Pv=function(){var r;const t=(r=l(this,Kn))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Rv=function(){var r;if(l(this,ht)==="single_session")return`${wv}-${(l(this,Vt).clientGUID??"default-client").toLowerCase()}`;const t=(r=l(this,ut))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return Hp(l(this,ht),t,l(this,Vt).clientGUID??"default-client")},bs=new WeakMap,ws=new WeakMap,Lc=function(){k(this,Ht,null),k(this,Gr,null),k(this,Bt,null),k(this,qn,null),k(this,Yn,null),k(this,ln,null),k(this,Kn,null),l(this,Gt)&&(l(this,Gt).removeEventListener("close",l(this,bs)),l(this,Gt).removeEventListener("error",l(this,ws)),l(this,Gt).close(),k(this,Gt,null))},zr=function(t){this.disposed||l(this,te).lifecycle.status==="disconnected"||(g(this,C,Rn).call(this,"error"),g(this,C,Lc).call(this),g(this,C,He).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Dv=function(){k(this,Ct,null),k(this,jt,null),k(this,Wr,1),g(this,C,He).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},Ov=function(){return l(this,te).lifecycle.status==="disconnected"};function QR(){const n=new Map;return{getActualSessionId(e){return n.get(e)??null},setActualSessionId(e,t){n.set(e,t)},clearActualSessionId(e){n.delete(e)}}}function e2(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function t2(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function Hp(n,e,t){return n==="single_session"?`${wv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function zv(n){return n.replace(/^(?:\s*\n)+/,"")}function Bp(n){let e=n;return e=e.replace(VR,""),e=e.replace(GR,""),e=e.replace(WR,""),e=zv(e),e}function n2(n){let e=n;return e=e.replace(qR,""),e=zv(e),e}function jp(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function r2(n){const e=n.createSocket(o2(n.serverURL,n.token));let t=!1,r,i;const s=new Promise((u,d)=>{r=u,i=d}),o=new ReadableStream({start(u){let d=!1;const p=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},y=E=>{const I=s2(E);if(!I)return;let Z;try{Z=JSON.parse(I)}catch(P){const V=P instanceof Error?P:new Error(String(P));i(V),u.error(V);return}switch(Z.type){case"acp-bridge-status":if(Z.status==="ready"){let P;try{P=i2(Z)}catch(V){const O=V instanceof Error?V:new Error(String(V));t||i(O),u.error(O);return}t||(t=!0,r(P));return}if(Z.status==="error"||Z.status==="exited"){const P=new Error(Z.error??`ACP bridge ${Z.status}`);t||i(P),u.error(P)}return;case"acp-bridge-message":u.enqueue(Z.message);return}},v=()=>{var I;if(d)return;d=!0;const E=new Error("ACP bridge websocket closed");t||i(E),(I=n.onDisconnect)==null||I.call(n,E),u.close()},$=()=>{var I;if(d)return;d=!0;const E=new Error("ACP bridge websocket error");t||i(E),(I=n.onDisconnect)==null||I.call(n,E),u.error(E)};e.addEventListener("open",p),e.addEventListener("message",y),e.addEventListener("close",v),e.addEventListener("error",$)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),c=await s;return{stream:{readable:o,writable:a},socket:e,metadata:c}}function i2(n){const{agent:e,sessionIdStrategy:t,sessionCwd:r}=n;if((e==="openclaw"||e==="hermes")&&(t==="deterministic"||t==="mapped")&&typeof r=="string"&&r.length>0)return{agent:e,sessionIdStrategy:t,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function s2(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const e=n.data;if(typeof e=="string")return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(Array.isArray(e))return Buffer.concat(e).toString("utf8")}return null}function o2(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/acp",t.search="",t.searchParams.set("token",e),t.hash="",t.toString()}function Io(n){return n instanceof Error?n.message:String(n)}const Vp="television.acpClientGUID",Gp="television.acpMappedSessions",a2=Si(vt);class l2 extends a2{constructor(t){super();b(this,"screenManager");b(this,"clients",new Map);b(this,"options");b(this,"sessionMode");b(this,"clientGUID");b(this,"mappedSessionStore");b(this,"activeClient",null);b(this,"handleActiveScreenChanged",()=>{this.syncActiveClient()});this.screenManager=t.screenManager,this.sessionMode=t.sessionMode??"single_session";const r=t.storage??h2();this.options={serverURL:t.serverURL,token:t.token,...t.createSocket?{createSocket:t.createSocket}:{},...t.sessionMode?{sessionMode:t.sessionMode}:{}},this.clientGUID=t.clientGUID??p2(d2(r)),this.mappedSessionStore=t.mappedSessionStore??(r?new u2(r,t.serverURL):new c2),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.syncActiveClient()}getActiveClient(){return this.activeClient}dispose(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged);for(const t of this.clients.values())t.dispose();this.clients.clear(),this.activeClient=null}syncActiveClient(){const t=this.screenManager.activeScreen,r=t?this.getClientForScreen(t):null;this.activeClient!==r&&(this.activeClient=r,this.dispatchEvent(new J("change")))}getClientForScreen(t){const r=this.sessionMode==="single_session"?"single_session":t.id;let i=this.clients.get(r);return i||(i=new XR({...this.options,sessionMode:this.sessionMode,clientGUID:this.clientGUID,mappedSessionStore:this.mappedSessionStore}),this.clients.set(r,i)),i.setScreenContext({screenID:t.id,screenName:t.name}),i}}var qr;class c2{constructor(){w(this,qr,new Map)}getActualSessionId(e){return l(this,qr).get(e)??null}setActualSessionId(e,t){l(this,qr).set(e,t)}clearActualSessionId(e){l(this,qr).delete(e)}}qr=new WeakMap;const Wp=1;var Yr,Ss,Xe,Ko,Jo,Mc;class u2{constructor(e,t){w(this,Xe);w(this,Yr);w(this,Ss);k(this,Yr,e),k(this,Ss,t)}getActualSessionId(e){const t=g(this,Xe,Jo).call(this)[g(this,Xe,Ko).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=g(this,Xe,Jo).call(this);r[g(this,Xe,Ko).call(this,e)]=t,g(this,Xe,Mc).call(this,r)}clearActualSessionId(e){const t=g(this,Xe,Jo).call(this);delete t[g(this,Xe,Ko).call(this,e)],g(this,Xe,Mc).call(this,t)}}Yr=new WeakMap,Ss=new WeakMap,Xe=new WeakSet,Ko=function(e){return JSON.stringify([l(this,Ss),e])},Jo=function(){const e=l(this,Yr).getItem(Gp);if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!="object"||t===null||Array.isArray(t))return{};const r=t;return r.version!==Wp?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Mc=function(e){const t={version:Wp,entries:e};l(this,Yr).setItem(Gp,JSON.stringify(t))};function h2(){return typeof window>"u"?null:window.localStorage}function d2(n){if(!n)throw new Error("ACPClientManager requires storage when clientGUID is not provided");return n}function p2(n){const e=n.getItem(Vp);if(e)return e;const t=Zu().toLowerCase();return n.setItem(Vp,t),t}var _s;class f2 extends vt{constructor(){super();w(this,_s,t=>{const r=g2(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new WE("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",l(this,_s))}dispose(){document.removeEventListener("keydown",l(this,_s))}}_s=new WeakMap;function g2(n){for(const[e,t]of Object.entries(xx))if(m2(n,t.trigger))return e;return null}function m2(n,e){return!(n.key.toLowerCase()!==e.key.toLowerCase()||n.metaKey!==!!e.meta||n.ctrlKey!==!!e.ctrl||n.shiftKey!==!!e.shift||n.altKey!==!!e.alt)}const v2="serverURL",y2="token",b2="mode",w2="electron";function Lv(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(v2);return r?new URL(r).origin:new URL(e).origin}function Nc(n=window.location.search){return new URLSearchParams(n).get(y2)}function Mv(n=window.location.search){return new URLSearchParams(n).get(b2)===w2}/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/const ns=globalThis,
|
|
48
|
-
\f\r]`,Oi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
49
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Kp=/'/g,Jp=/"/g,Nv=/^(?:script|style|textarea|title)$/i,S2=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=S2(1),hi=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),Xp=new WeakMap,Fn=pr.createTreeWalker(pr,129);function Uv(n,e){if(!eh(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wp!==void 0?Wp.createHTML(e):e}const _2=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Oi;for(let a=0;a<t;a++){const c=n[a];let u,d,p=-1,y=0;for(;y<c.length&&(o.lastIndex=y,d=o.exec(c),d!==null);)y=o.lastIndex,o===Oi?d[1]==="!--"?o=qp:d[1]!==void 0?o=Yp:d[2]!==void 0?(Nv.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Cn):d[3]!==void 0&&(o=Cn):o===Cn?d[0]===">"?(o=i??Oi,p=-1):d[1]===void 0?p=-2:(p=o.lastIndex-d[2].length,u=d[1],o=d[3]===void 0?Cn:d[3]==='"'?Jp:Kp):o===Jp||o===Kp?o=Cn:o===qp||o===Yp?o=Oi:(o=Cn,i=void 0);const v=o===Cn&&n[a+1].startsWith("/>")?" ":"";s+=o===Oi?c+b2:p>=0?(r.push(u),c.slice(0,p)+Lv+c.slice(p)+rn+v):c+rn+(p===-2?a:v)}return[Uv(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class ls{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,d]=_2(e,t);if(this.el=ls.createElement(u,r),Fn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Fn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Lv)){const y=d[o++],v=i.getAttribute(p).split(rn),$=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:$[2],strings:v,ctor:$[1]==="."?E2:$[1]==="?"?x2:$[1]==="@"?A2:tl}),i.removeAttribute(p)}else p.startsWith(rn)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(Nv.test(i.tagName)){const p=i.textContent.split(rn),y=p.length-1;if(y>0){i.textContent=ga?ga.emptyScript:"";for(let v=0;v<y;v++)i.append(p[v],os()),Fn.nextNode(),c.push({type:2,index:++s});i.append(p[y],os())}}}else if(i.nodeType===8)if(i.data===Mv)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(rn,p+1))!==-1;)c.push({type:7,index:s}),p+=rn.length-1}s++}}static createElement(e,t){const r=pr.createElement("template");return r.innerHTML=e,r}}function di(n,e,t=n,r){var o,a;if(e===hi)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=as(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=di(n,i._$AS(n,e.values),i,r)),e}class k2{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??pr).importNode(t,!0);Fn.currentNode=i;let s=Fn.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new th(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new $2(s,this,e)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Fn.nextNode(),o++)}return Fn.currentNode=pr,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let th=class Fv{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=se,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=di(this,e,t),as(e)?e===se||e==null||e===""?(this._$AH!==se&&this._$AR(),this._$AH=se):e!==this._$AH&&e!==hi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):w2(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==se&&as(this._$AH)?this._$AA.nextSibling.data=e:this.T(pr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ls.createElement(Uv(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new k2(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Xp.get(e.strings);return t===void 0&&Xp.set(e.strings,t=new ls(e)),t}k(e){eh(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Fv(this.O(os()),this.O(os()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=Gp(e).nextSibling;Gp(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},tl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=se,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=se}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=di(this,e,t,0),o=!as(e)||e!==this._$AH&&e!==hi,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=di(this,a[r+c],t,c),u===hi&&(u=this._$AH[c]),o||(o=!as(u)||u!==this._$AH[c]),u===se?e=se:e!==se&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===se?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},E2=class extends tl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===se?void 0:e}},x2=class extends tl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==se)}},A2=class extends tl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=di(this,e,t,0)??se)===hi)return;const r=this._$AH,i=e===se&&r!==se||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==se&&(r===se||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class $2{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){di(this,e)}}const ql=ns.litHtmlPolyfillSupport;ql==null||ql(ls,th),(ns.litHtmlVersions??(ns.litHtmlVersions=[])).push("3.3.2");const Re=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new th(e.insertBefore(os(),null),null,void 0,{})),i._$AI(n),i},T2=.5,Qp=.1,ef=8,C2=4,Zv=3,Hv=3,I2=4,Zn=255,Bv=.2126,jv=.7152,Vv=.0722;async function nh(n){const e=P2(n);if(!e)return"light";try{return await O2(n,e)>=T2?"light":"dark"}catch{return"light"}}function P2(n){if(typeof document.elementsFromPoint!="function")return null;const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i=document.elementsFromPoint(t,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(R2(o))return s}return null}function R2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:D2(n.backgroundColor)>0}function D2(n){if(!n)return 0;const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 0;const t=e[1].split(/[\s,/]+/).filter(Boolean);return t.length===I2?parseFloat(t[Zv]):t.length===Hv?1:0}async function O2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Po((t.left-r.left)/r.width),y:Po((t.top-r.top)/r.height),width:Po(t.width/r.width),height:Po(t.height/r.height)},s=window.getComputedStyle(e),o=z2(s.backgroundImage);return o?M2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):N2(s.backgroundColor)}function z2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const tf=new Map;function L2(n){let e=tf.get(n);return e||(e=new Promise((t,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),tf.set(n,e),e)}async function M2(n){const e=await L2(n.url),t=Math.max(ef,Math.ceil(n.surfaceWidth*Qp)),r=Math.max(ef,Math.ceil(n.surfaceHeight*Qp)),i=document.createElement("canvas");i.width=t,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=e.naturalWidth/e.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=t,u=t/a);const d=(t-c)/2,p=(r-u)/2;s.drawImage(e,d,p,c,u);const y=Math.max(0,Math.floor(n.region.x*t)),v=Math.max(0,Math.floor(n.region.y*r)),$=Math.max(1,Math.min(t-y,Math.floor(n.region.width*t))),E=Math.max(1,Math.min(r-v,Math.floor(n.region.height*r))),I=s.getImageData(y,v,$,E).data;let Z=0,P=0;for(let V=0;V<I.length;V+=C2){const O=I[V]/Zn,H=I[V+1]/Zn,U=I[V+2]/Zn,ce=I[V+Zv]/Zn;Z+=ce*(Bv*O+jv*H+Vv*U),P+=1}return P>0?Z/P:1}function N2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<Hv)return 1;const r=t[0]/Zn,i=t[1]/Zn,s=t[2]/Zn;return Bv*r+jv*i+Vv*s}function Po(n){return n<0?0:n>1?1:n}const Yl=new WeakSet,nf=new WeakSet;function Gv(n){if(nf.has(n))return;nf.add(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))Kl(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)U2(i,Kl);else r.type==="attributes"&&r.target instanceof HTMLButtonElement&&r.target.getAttribute("variant")==="ghost"&&Kl(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function U2(n,e){if(n instanceof Element){n instanceof HTMLButtonElement&&n.getAttribute("variant")==="ghost"&&e(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))e(t)}}async function Kl(n){if(Yl.has(n))return;Yl.add(n);const e=await nh(n);if(n.getAttribute("variant")!=="ghost"){Yl.delete(n);return}n.setAttribute("tone",e)}const F2="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;width:100%;height:100%}h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,hr{margin:0}button,input,textarea,select{font:inherit;color:inherit}@font-face{font-family:Hind;src:url("+new URL("Hind-Variable-C47b_dt9.woff2",import.meta.url).href+') format("woff2-variations");font-weight:300 700;font-style:normal;font-display:swap}:root{--font-sans: "Hind", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-brand: var(--font-sans);--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;--font-weight-body: 500;--text-base: 13.5px;--text-scale: 1.125;--text-sm: round(calc(var(--text-base) / var(--text-scale)), 1px);--text-lg: round(calc(var(--text-base) * var(--text-scale)), 1px);--text-xl: round(calc(var(--text-lg) * var(--text-scale)), 1px);--leading-base: 1.5;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-12: 12px;--space-16: 16px;--space-20: 20px;--space-24: 24px;--space-32: 32px;--space-48: 48px;--space-64: 64px;--radius-4: 4px;--radius-8: 8px;--radius-12: 12px;--radius-16: 16px;--radius-24: 24px;--radius-full: 9999px;--shadow-hairline: 0 0 0 .5px var(--color-border);--shadow-control: 0 1px 1px rgb(0 0 0 / .04), 0 2px 6px rgb(0 0 0 / .06);--alpha-50: 4%;--alpha-100: 8%;--alpha-200: 15%;--alpha-300: 22%;--alpha-400: 30%;--alpha-500: 40%;--alpha-600: 50%;--alpha-700: 65%;--alpha-800: 80%;--alpha-900: 90%;--alpha-950: 95%;--tint-50: color-mix(in srgb, currentColor var(--alpha-50), transparent);--tint-100: color-mix(in srgb, currentColor var(--alpha-100), transparent);--tint-200: color-mix(in srgb, currentColor var(--alpha-200), transparent);--tint-300: color-mix(in srgb, currentColor var(--alpha-300), transparent);--tint-400: color-mix(in srgb, currentColor var(--alpha-400), transparent);--tint-500: color-mix(in srgb, currentColor var(--alpha-500), transparent);--tint-600: color-mix(in srgb, currentColor var(--alpha-600), transparent);--tint-700: color-mix(in srgb, currentColor var(--alpha-700), transparent);--tint-800: color-mix(in srgb, currentColor var(--alpha-800), transparent);--tint-900: color-mix(in srgb, currentColor var(--alpha-900), transparent);--tint-950: color-mix(in srgb, currentColor var(--alpha-950), transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent);--backdrop-blur-glass: blur(20px) saturate(1.4);--black: #000000;--white: #ffffff;--neutral-50: oklch(.985 0 0);--neutral-100: oklch(.97 0 0);--neutral-200: oklch(.923 0 0);--neutral-300: oklch(.869 0 0);--neutral-350: oklch(.79 0 0);--neutral-400: oklch(.709 0 0);--neutral-500: oklch(.553 0 0);--neutral-600: oklch(.444 0 0);--neutral-700: oklch(.374 0 0);--neutral-800: oklch(.268 0 0);--neutral-900: oklch(.216 0 0);--neutral-950: oklch(.147 0 0);--red-50: oklch(.969 .015 12.422);--red-100: oklch(.941 .03 12.58);--red-200: oklch(.892 .058 10.001);--red-300: oklch(.81 .117 11.638);--red-400: oklch(.712 .194 13.428);--red-500: oklch(.645 .246 16.439);--red-600: oklch(.586 .253 17.585);--red-700: oklch(.514 .222 16.935);--red-800: oklch(.455 .188 13.697);--red-900: oklch(.41 .159 10.272);--red-950: oklch(.271 .105 12.094);--orange-50: oklch(.98 .016 73.684);--orange-100: oklch(.954 .038 75.164);--orange-200: oklch(.901 .076 70.697);--orange-300: oklch(.837 .128 66.29);--orange-400: oklch(.75 .183 55.934);--orange-500: oklch(.705 .213 47.604);--orange-600: oklch(.646 .222 41.116);--orange-700: oklch(.553 .195 38.402);--orange-800: oklch(.47 .157 37.304);--orange-900: oklch(.408 .123 38.172);--orange-950: oklch(.266 .079 36.259);--yellow-50: oklch(.987 .026 102.212);--yellow-100: oklch(.973 .071 103.193);--yellow-200: oklch(.945 .129 101.54);--yellow-300: oklch(.905 .182 98.111);--yellow-400: oklch(.852 .199 91.936);--yellow-500: oklch(.795 .184 86.047);--yellow-600: oklch(.681 .162 75.834);--yellow-700: oklch(.554 .135 66.442);--yellow-800: oklch(.476 .114 61.907);--yellow-900: oklch(.421 .095 57.708);--yellow-950: oklch(.286 .066 53.813);--green-50: oklch(.979 .021 166.113);--green-100: oklch(.95 .052 163.051);--green-200: oklch(.905 .093 164.15);--green-300: oklch(.845 .143 164.978);--green-400: oklch(.765 .177 163.223);--green-500: oklch(.696 .17 162.48);--green-600: oklch(.596 .145 163.225);--green-700: oklch(.508 .118 165.612);--green-800: oklch(.432 .095 166.913);--green-900: oklch(.378 .077 168.94);--green-950: oklch(.262 .051 172.552);--blue-50: oklch(.97 .014 254.604);--blue-100: oklch(.932 .032 255.585);--blue-200: oklch(.882 .059 254.128);--blue-300: oklch(.809 .105 251.813);--blue-400: oklch(.707 .165 254.624);--blue-500: oklch(.623 .214 259.815);--blue-600: oklch(.546 .245 262.881);--blue-700: oklch(.488 .243 264.376);--blue-800: oklch(.424 .199 265.638);--blue-900: oklch(.379 .146 265.522);--blue-950: oklch(.282 .091 267.935);--purple-50: oklch(.969 .016 293.756);--purple-100: oklch(.943 .029 294.588);--purple-200: oklch(.894 .057 293.283);--purple-300: oklch(.811 .111 293.571);--purple-400: oklch(.702 .183 293.541);--purple-500: oklch(.606 .25 292.717);--purple-600: oklch(.541 .281 293.009);--purple-700: oklch(.491 .27 292.581);--purple-800: oklch(.432 .232 292.759);--purple-900: oklch(.38 .189 293.745);--purple-950: oklch(.283 .141 291.089)}@supports (corner-shape: squircle){:root{--radius-8: 10px;--radius-12: 15px;--radius-16: 20px;--radius-24: 30px}}:root[data-font=system]{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}:root{--color-bg: var(--neutral-50);--color-bg-muted: var(--neutral-100);--color-surface: var(--white);--color-surface-muted: var(--neutral-100);--color-interactive: var(--neutral-200);--color-interactive-hover: var(--neutral-300);--color-border: rgba(0, 0, 0, .1);--color-border-muted: rgba(0, 0, 0, .06);--color-text: var(--neutral-900);--color-text-muted: var(--neutral-500);--color-link: inherit;--color-focus-ring: var(--neutral-500);--color-overlay-backdrop: rgb(0 0 0 / .5);--color-highlight: rgb(255 255 255 / .5);--color-primary: var(--blue-500);--color-danger: var(--red-600);color-scheme:light}body{font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--font-weight-body);line-height:var(--leading-base);letter-spacing:.015em;color:var(--color-text);background:var(--color-bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{color:var(--color-link);text-underline-offset:.15em;text-decoration-thickness:.08em}h1,h2,h3,h4,h5,h6{font-weight:600;color:inherit}code{font-family:var(--font-mono);font-size:.9em;background:var(--color-bg-muted);padding:var(--space-2) var(--space-4);border-radius:var(--radius-4)}pre{font-family:var(--font-mono);background:var(--color-bg-muted);padding:var(--space-12);border-radius:var(--radius-8);overflow-x:auto}pre code{background:none;padding:0}blockquote{padding-left:var(--space-16);border-left:3px solid var(--color-border);color:var(--color-text-muted)}hr{border:none;border-top:1px solid var(--color-border)}table{border-collapse:collapse}th,td{padding:var(--space-8) var(--space-12);border:1px solid var(--color-border);text-align:left}th{background:var(--color-bg-muted);font-weight:600}input,textarea{padding:6px 10px;border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}textarea{resize:none}input::placeholder,textarea::placeholder{color:var(--tint-500)}input:focus,textarea:focus{background:color-mix(in srgb,var(--white) var(--alpha-300),transparent);border-color:var(--color-primary);outline:none;box-shadow:0 0 0 1.5px var(--color-primary)}label.field{display:grid;gap:4px;font-size:13px}label.field>span{font-size:11.5px;font-weight:450;color:var(--tint-800)}@supports (corner-shape: squircle){*{corner-shape:squircle}}button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-6);padding:4px 14px;border:.5px solid var(--tint-200);border-radius:var(--radius-12);background:var(--color-surface);color:inherit;font:inherit;cursor:default;box-shadow:var(--shadow-control)}button:hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}button[variant=primary]{background:var(--color-primary);border-color:#0000002e;color:var(--white)}button[variant=primary]:hover:not(:disabled){background:color-mix(in srgb,var(--color-primary) 92%,black)}button[variant=primary]:active:not(:disabled){background:color-mix(in srgb,var(--color-primary) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=danger]{background:var(--color-danger);border-color:#0000002e;color:var(--white)}button[variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--color-danger) 92%,black)}button[variant=danger]:active:not(:disabled){background:color-mix(in srgb,var(--color-danger) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=ghost]{background:transparent;border-color:transparent;color:inherit;box-shadow:none}button[variant=ghost]:hover:not(:disabled){background:var(--color-overlay-hover)}button[variant=ghost]:active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-expanded=true]:not(:disabled),button[variant=ghost][aria-expanded=true]:hover:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}[tone=dark] button:not([variant]):not(:disabled){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}[tone=dark] button:not([variant]):hover:not(:disabled){background:var(--tint-300)}[tone=dark] button:not([variant]):active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}[tone=light] button:not([variant]):not(:disabled){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}[tone=light] button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}[tone=light] button:not([variant]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button[size=sm]{min-height:24px;padding:var(--space-2) var(--space-8)}button[size=md]{min-height:32px;padding:var(--space-6) var(--space-12)}button[icon-only]{width:24px;height:24px;min-height:0;padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}.prose{line-height:var(--leading-base)}.prose h1{font-size:var(--text-xl);margin-bottom:var(--space-8)}.prose h2{font-size:var(--text-lg);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose h3,.prose h4,.prose h5,.prose h6{font-size:var(--text-base);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose p{margin:var(--space-12) 0}.prose ul,.prose ol{padding-left:var(--space-24);margin:var(--space-12) 0}.prose blockquote,.prose pre{margin:var(--space-12) 0}.prose hr{margin:var(--space-24) 0}.prose table{width:100%;margin:var(--space-12) 0}.prose img{max-width:100%;height:auto}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}[material=paper]{background:var(--white);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text)}[material=glass]{background:color-mix(in srgb,var(--white) var(--alpha-700),transparent);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text);backdrop-filter:var(--backdrop-blur-glass);-webkit-backdrop-filter:var(--backdrop-blur-glass)}[tone=dark]{color:color-mix(in srgb,var(--white) var(--alpha-950),transparent);border-color:color-mix(in srgb,var(--white) var(--alpha-200),transparent);--color-overlay-hover: color-mix(in srgb, var(--white) var(--alpha-200), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-500), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass]{background:color-mix(in srgb,var(--black) var(--alpha-600),transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}dropdown-menu::part(panel){position:absolute;left:0;min-width:192px;padding:var(--space-4);border-radius:var(--radius-8);display:flex;flex-direction:column;gap:2px;z-index:2000}dropdown-menu::part(panel-bottom){top:calc(100% + var(--space-4))}dropdown-menu::part(panel-top){bottom:calc(100% + var(--space-4))}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}modal-overlay{color:inherit}modal-overlay::part(backdrop){position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--layer-overlay);display:flex;align-items:center;justify-content:center;padding:var(--space-16);background:var(--color-overlay-backdrop)}panel-view{display:block}panel-view::part(panel){display:flex;flex-direction:column;gap:var(--space-16);color:var(--color-text)}panel-view::part(header){display:flex;align-items:center;justify-content:space-between;gap:var(--space-12)}panel-view::part(title){margin:0;font:inherit;font-size:var(--text-lg);font-weight:600;color:var(--color-text)}panel-view::part(button){display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;border:1px solid var(--color-border);border-radius:var(--radius-4);background:var(--color-surface);color:var(--color-text);box-shadow:none}panel-view::part(button):hover{background:var(--color-interactive-hover)}panel-view::part(button):focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}panel-view::part(icon){display:inline-flex;align-items:center;justify-content:center;flex:none}ui-popover{display:contents}ui-popover::part(panel){position:fixed;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-16);outline:none;z-index:2000}ui-pill{display:inline-block;vertical-align:baseline;margin:2px 0;padding:0 var(--space-8);font-size:var(--text-sm);font-weight:500;line-height:1.7;border-radius:var(--radius-full);border:1px solid var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900);white-space:nowrap}ui-pill[color=gray]{border-color:var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900)}ui-pill[color=red]{border-color:var(--red-200);background:var(--red-100);color:var(--red-950)}ui-pill[color=orange]{border-color:var(--orange-200);background:var(--orange-100);color:var(--orange-950)}ui-pill[color=yellow]{border-color:var(--yellow-200);background:var(--yellow-100);color:var(--yellow-950)}ui-pill[color=green]{border-color:var(--green-200);background:var(--green-100);color:var(--green-950)}ui-pill[color=blue]{border-color:var(--blue-200);background:var(--blue-100);color:var(--blue-950)}ui-pill[color=purple]{border-color:var(--purple-200);background:var(--purple-100);color:var(--purple-950)}',rh=new CSSStyleSheet;rh.replaceSync(F2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,rh]}catch{}Gv(document);function Wv(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,rh]}catch{}Gv(n)}/**
|
|
47
|
+
*/const ns=globalThis,qp=n=>n,ga=ns.trustedTypes,Yp=ga?ga.createPolicy("lit-html",{createHTML:n=>n}):void 0,Nv="$lit$",rn=`lit$${Math.random().toFixed(9).slice(2)}$`,Uv="?"+rn,S2=`<${Uv}>`,pr=document,os=()=>pr.createComment(""),as=n=>n===null||typeof n!="object"&&typeof n!="function",th=Array.isArray,_2=n=>th(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",ql=`[
|
|
48
|
+
\f\r]`,Oi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kp=/-->/g,Jp=/>/g,Cn=RegExp(`>|${ql}(?:([^\\s"'>=/]+)(${ql}*=${ql}*(?:[^
|
|
49
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Xp=/'/g,Qp=/"/g,Fv=/^(?:script|style|textarea|title)$/i,k2=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=k2(1),hi=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),ef=new WeakMap,Fn=pr.createTreeWalker(pr,129);function Zv(n,e){if(!th(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Yp!==void 0?Yp.createHTML(e):e}const E2=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Oi;for(let a=0;a<t;a++){const c=n[a];let u,d,p=-1,y=0;for(;y<c.length&&(o.lastIndex=y,d=o.exec(c),d!==null);)y=o.lastIndex,o===Oi?d[1]==="!--"?o=Kp:d[1]!==void 0?o=Jp:d[2]!==void 0?(Fv.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Cn):d[3]!==void 0&&(o=Cn):o===Cn?d[0]===">"?(o=i??Oi,p=-1):d[1]===void 0?p=-2:(p=o.lastIndex-d[2].length,u=d[1],o=d[3]===void 0?Cn:d[3]==='"'?Qp:Xp):o===Qp||o===Xp?o=Cn:o===Kp||o===Jp?o=Oi:(o=Cn,i=void 0);const v=o===Cn&&n[a+1].startsWith("/>")?" ":"";s+=o===Oi?c+S2:p>=0?(r.push(u),c.slice(0,p)+Nv+c.slice(p)+rn+v):c+rn+(p===-2?a:v)}return[Zv(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class ls{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,d]=E2(e,t);if(this.el=ls.createElement(u,r),Fn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Fn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Nv)){const y=d[o++],v=i.getAttribute(p).split(rn),$=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:$[2],strings:v,ctor:$[1]==="."?A2:$[1]==="?"?$2:$[1]==="@"?T2:tl}),i.removeAttribute(p)}else p.startsWith(rn)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(Fv.test(i.tagName)){const p=i.textContent.split(rn),y=p.length-1;if(y>0){i.textContent=ga?ga.emptyScript:"";for(let v=0;v<y;v++)i.append(p[v],os()),Fn.nextNode(),c.push({type:2,index:++s});i.append(p[y],os())}}}else if(i.nodeType===8)if(i.data===Uv)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(rn,p+1))!==-1;)c.push({type:7,index:s}),p+=rn.length-1}s++}}static createElement(e,t){const r=pr.createElement("template");return r.innerHTML=e,r}}function di(n,e,t=n,r){var o,a;if(e===hi)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=as(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=di(n,i._$AS(n,e.values),i,r)),e}class x2{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??pr).importNode(t,!0);Fn.currentNode=i;let s=Fn.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new nh(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new C2(s,this,e)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(s=Fn.nextNode(),o++)}return Fn.currentNode=pr,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let nh=class Hv{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=se,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=di(this,e,t),as(e)?e===se||e==null||e===""?(this._$AH!==se&&this._$AR(),this._$AH=se):e!==this._$AH&&e!==hi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):_2(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==se&&as(this._$AH)?this._$AA.nextSibling.data=e:this.T(pr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ls.createElement(Zv(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new x2(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ef.get(e.strings);return t===void 0&&ef.set(e.strings,t=new ls(e)),t}k(e){th(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Hv(this.O(os()),this.O(os()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=qp(e).nextSibling;qp(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},tl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=se,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=se}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=di(this,e,t,0),o=!as(e)||e!==this._$AH&&e!==hi,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c<s.length-1;c++)u=di(this,a[r+c],t,c),u===hi&&(u=this._$AH[c]),o||(o=!as(u)||u!==this._$AH[c]),u===se?e=se:e!==se&&(e+=(u??"")+s[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===se?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},A2=class extends tl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===se?void 0:e}},$2=class extends tl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==se)}},T2=class extends tl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=di(this,e,t,0)??se)===hi)return;const r=this._$AH,i=e===se&&r!==se||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==se&&(r===se||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class C2{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){di(this,e)}}const Yl=ns.litHtmlPolyfillSupport;Yl==null||Yl(ls,nh),(ns.litHtmlVersions??(ns.litHtmlVersions=[])).push("3.3.2");const Re=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new nh(e.insertBefore(os(),null),null,void 0,{})),i._$AI(n),i},I2=.5,tf=.1,nf=8,P2=4,Bv=3,jv=3,R2=4,Zn=255,Vv=.2126,Gv=.7152,Wv=.0722;async function rh(n){const e=D2(n);if(!e)return"light";try{return await L2(n,e)>=I2?"light":"dark"}catch{return"light"}}function D2(n){if(typeof document.elementsFromPoint!="function")return null;const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i=document.elementsFromPoint(t,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(O2(o))return s}return null}function O2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:z2(n.backgroundColor)>0}function z2(n){if(!n)return 0;const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 0;const t=e[1].split(/[\s,/]+/).filter(Boolean);return t.length===R2?parseFloat(t[Bv]):t.length===jv?1:0}async function L2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Po((t.left-r.left)/r.width),y:Po((t.top-r.top)/r.height),width:Po(t.width/r.width),height:Po(t.height/r.height)},s=window.getComputedStyle(e),o=M2(s.backgroundImage);return o?U2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):F2(s.backgroundColor)}function M2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const rf=new Map;function N2(n){let e=rf.get(n);return e||(e=new Promise((t,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),rf.set(n,e),e)}async function U2(n){const e=await N2(n.url),t=Math.max(nf,Math.ceil(n.surfaceWidth*tf)),r=Math.max(nf,Math.ceil(n.surfaceHeight*tf)),i=document.createElement("canvas");i.width=t,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=e.naturalWidth/e.naturalHeight;let c,u;a>o?(u=r,c=r*a):(c=t,u=t/a);const d=(t-c)/2,p=(r-u)/2;s.drawImage(e,d,p,c,u);const y=Math.max(0,Math.floor(n.region.x*t)),v=Math.max(0,Math.floor(n.region.y*r)),$=Math.max(1,Math.min(t-y,Math.floor(n.region.width*t))),E=Math.max(1,Math.min(r-v,Math.floor(n.region.height*r))),I=s.getImageData(y,v,$,E).data;let Z=0,P=0;for(let V=0;V<I.length;V+=P2){const O=I[V]/Zn,H=I[V+1]/Zn,U=I[V+2]/Zn,ce=I[V+Bv]/Zn;Z+=ce*(Vv*O+Gv*H+Wv*U),P+=1}return P>0?Z/P:1}function F2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<jv)return 1;const r=t[0]/Zn,i=t[1]/Zn,s=t[2]/Zn;return Vv*r+Gv*i+Wv*s}function Po(n){return n<0?0:n>1?1:n}const Kl=new WeakSet,sf=new WeakSet;function qv(n){if(sf.has(n))return;sf.add(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))Jl(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)Z2(i,Jl);else r.type==="attributes"&&r.target instanceof HTMLButtonElement&&r.target.getAttribute("variant")==="ghost"&&Jl(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function Z2(n,e){if(n instanceof Element){n instanceof HTMLButtonElement&&n.getAttribute("variant")==="ghost"&&e(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))e(t)}}async function Jl(n){if(Kl.has(n))return;Kl.add(n);const e=await rh(n);if(n.getAttribute("variant")!=="ghost"){Kl.delete(n);return}n.setAttribute("tone",e)}const H2="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;width:100%;height:100%}h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,hr{margin:0}button,input,textarea,select{font:inherit;color:inherit}@font-face{font-family:Hind;src:url("+new URL("Hind-Variable-C47b_dt9.woff2",import.meta.url).href+') format("woff2-variations");font-weight:300 700;font-style:normal;font-display:swap}:root{--font-sans: "Hind", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-brand: var(--font-sans);--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;--font-weight-body: 500;--text-base: 13.5px;--text-scale: 1.125;--text-sm: round(calc(var(--text-base) / var(--text-scale)), 1px);--text-lg: round(calc(var(--text-base) * var(--text-scale)), 1px);--text-xl: round(calc(var(--text-lg) * var(--text-scale)), 1px);--leading-base: 1.5;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-12: 12px;--space-16: 16px;--space-20: 20px;--space-24: 24px;--space-32: 32px;--space-48: 48px;--space-64: 64px;--radius-4: 4px;--radius-8: 8px;--radius-12: 12px;--radius-16: 16px;--radius-24: 24px;--radius-full: 9999px;--shadow-hairline: 0 0 0 .5px var(--color-border);--shadow-control: 0 1px 1px rgb(0 0 0 / .04), 0 2px 6px rgb(0 0 0 / .06);--alpha-50: 4%;--alpha-100: 8%;--alpha-200: 15%;--alpha-300: 22%;--alpha-400: 30%;--alpha-500: 40%;--alpha-600: 50%;--alpha-700: 65%;--alpha-800: 80%;--alpha-900: 90%;--alpha-950: 95%;--tint-50: color-mix(in srgb, currentColor var(--alpha-50), transparent);--tint-100: color-mix(in srgb, currentColor var(--alpha-100), transparent);--tint-200: color-mix(in srgb, currentColor var(--alpha-200), transparent);--tint-300: color-mix(in srgb, currentColor var(--alpha-300), transparent);--tint-400: color-mix(in srgb, currentColor var(--alpha-400), transparent);--tint-500: color-mix(in srgb, currentColor var(--alpha-500), transparent);--tint-600: color-mix(in srgb, currentColor var(--alpha-600), transparent);--tint-700: color-mix(in srgb, currentColor var(--alpha-700), transparent);--tint-800: color-mix(in srgb, currentColor var(--alpha-800), transparent);--tint-900: color-mix(in srgb, currentColor var(--alpha-900), transparent);--tint-950: color-mix(in srgb, currentColor var(--alpha-950), transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent);--backdrop-blur-glass: blur(20px) saturate(1.4);--black: #000000;--white: #ffffff;--neutral-50: oklch(.985 0 0);--neutral-100: oklch(.97 0 0);--neutral-200: oklch(.923 0 0);--neutral-300: oklch(.869 0 0);--neutral-350: oklch(.79 0 0);--neutral-400: oklch(.709 0 0);--neutral-500: oklch(.553 0 0);--neutral-600: oklch(.444 0 0);--neutral-700: oklch(.374 0 0);--neutral-800: oklch(.268 0 0);--neutral-900: oklch(.216 0 0);--neutral-950: oklch(.147 0 0);--red-50: oklch(.969 .015 12.422);--red-100: oklch(.941 .03 12.58);--red-200: oklch(.892 .058 10.001);--red-300: oklch(.81 .117 11.638);--red-400: oklch(.712 .194 13.428);--red-500: oklch(.645 .246 16.439);--red-600: oklch(.586 .253 17.585);--red-700: oklch(.514 .222 16.935);--red-800: oklch(.455 .188 13.697);--red-900: oklch(.41 .159 10.272);--red-950: oklch(.271 .105 12.094);--orange-50: oklch(.98 .016 73.684);--orange-100: oklch(.954 .038 75.164);--orange-200: oklch(.901 .076 70.697);--orange-300: oklch(.837 .128 66.29);--orange-400: oklch(.75 .183 55.934);--orange-500: oklch(.705 .213 47.604);--orange-600: oklch(.646 .222 41.116);--orange-700: oklch(.553 .195 38.402);--orange-800: oklch(.47 .157 37.304);--orange-900: oklch(.408 .123 38.172);--orange-950: oklch(.266 .079 36.259);--yellow-50: oklch(.987 .026 102.212);--yellow-100: oklch(.973 .071 103.193);--yellow-200: oklch(.945 .129 101.54);--yellow-300: oklch(.905 .182 98.111);--yellow-400: oklch(.852 .199 91.936);--yellow-500: oklch(.795 .184 86.047);--yellow-600: oklch(.681 .162 75.834);--yellow-700: oklch(.554 .135 66.442);--yellow-800: oklch(.476 .114 61.907);--yellow-900: oklch(.421 .095 57.708);--yellow-950: oklch(.286 .066 53.813);--green-50: oklch(.979 .021 166.113);--green-100: oklch(.95 .052 163.051);--green-200: oklch(.905 .093 164.15);--green-300: oklch(.845 .143 164.978);--green-400: oklch(.765 .177 163.223);--green-500: oklch(.696 .17 162.48);--green-600: oklch(.596 .145 163.225);--green-700: oklch(.508 .118 165.612);--green-800: oklch(.432 .095 166.913);--green-900: oklch(.378 .077 168.94);--green-950: oklch(.262 .051 172.552);--blue-50: oklch(.97 .014 254.604);--blue-100: oklch(.932 .032 255.585);--blue-200: oklch(.882 .059 254.128);--blue-300: oklch(.809 .105 251.813);--blue-400: oklch(.707 .165 254.624);--blue-500: oklch(.623 .214 259.815);--blue-600: oklch(.546 .245 262.881);--blue-700: oklch(.488 .243 264.376);--blue-800: oklch(.424 .199 265.638);--blue-900: oklch(.379 .146 265.522);--blue-950: oklch(.282 .091 267.935);--purple-50: oklch(.969 .016 293.756);--purple-100: oklch(.943 .029 294.588);--purple-200: oklch(.894 .057 293.283);--purple-300: oklch(.811 .111 293.571);--purple-400: oklch(.702 .183 293.541);--purple-500: oklch(.606 .25 292.717);--purple-600: oklch(.541 .281 293.009);--purple-700: oklch(.491 .27 292.581);--purple-800: oklch(.432 .232 292.759);--purple-900: oklch(.38 .189 293.745);--purple-950: oklch(.283 .141 291.089)}@supports (corner-shape: squircle){:root{--radius-8: 10px;--radius-12: 15px;--radius-16: 20px;--radius-24: 30px}}:root[data-font=system]{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}:root{--color-bg: var(--neutral-50);--color-bg-muted: var(--neutral-100);--color-surface: var(--white);--color-surface-muted: var(--neutral-100);--color-interactive: var(--neutral-200);--color-interactive-hover: var(--neutral-300);--color-border: rgba(0, 0, 0, .1);--color-border-muted: rgba(0, 0, 0, .06);--color-text: var(--neutral-900);--color-text-muted: var(--neutral-500);--color-link: inherit;--color-focus-ring: var(--neutral-500);--color-overlay-backdrop: rgb(0 0 0 / .5);--color-highlight: rgb(255 255 255 / .5);--color-primary: var(--blue-500);--color-danger: var(--red-600);color-scheme:light}body{font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--font-weight-body);line-height:var(--leading-base);letter-spacing:.015em;color:var(--color-text);background:var(--color-bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{color:var(--color-link);text-underline-offset:.15em;text-decoration-thickness:.08em}h1,h2,h3,h4,h5,h6{font-weight:600;color:inherit}code{font-family:var(--font-mono);font-size:.9em;background:var(--color-bg-muted);padding:var(--space-2) var(--space-4);border-radius:var(--radius-4)}pre{font-family:var(--font-mono);background:var(--color-bg-muted);padding:var(--space-12);border-radius:var(--radius-8);overflow-x:auto}pre code{background:none;padding:0}blockquote{padding-left:var(--space-16);border-left:3px solid var(--color-border);color:var(--color-text-muted)}hr{border:none;border-top:1px solid var(--color-border)}table{border-collapse:collapse}th,td{padding:var(--space-8) var(--space-12);border:1px solid var(--color-border);text-align:left}th{background:var(--color-bg-muted);font-weight:600}input,textarea{padding:6px 10px;border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}textarea{resize:none}input::placeholder,textarea::placeholder{color:var(--tint-500)}input:focus,textarea:focus{background:color-mix(in srgb,var(--white) var(--alpha-300),transparent);border-color:var(--color-primary);outline:none;box-shadow:0 0 0 1.5px var(--color-primary)}label.field{display:grid;gap:4px;font-size:13px}label.field>span{font-size:11.5px;font-weight:450;color:var(--tint-800)}@supports (corner-shape: squircle){*{corner-shape:squircle}}button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-6);padding:4px 14px;border:.5px solid var(--tint-200);border-radius:var(--radius-12);background:var(--color-surface);color:inherit;font:inherit;cursor:default;box-shadow:var(--shadow-control)}button:hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}button[variant=primary]{background:var(--color-primary);border-color:#0000002e;color:var(--white)}button[variant=primary]:hover:not(:disabled){background:color-mix(in srgb,var(--color-primary) 92%,black)}button[variant=primary]:active:not(:disabled){background:color-mix(in srgb,var(--color-primary) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=danger]{background:var(--color-danger);border-color:#0000002e;color:var(--white)}button[variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--color-danger) 92%,black)}button[variant=danger]:active:not(:disabled){background:color-mix(in srgb,var(--color-danger) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=ghost]{background:transparent;border-color:transparent;color:inherit;box-shadow:none}button[variant=ghost]:hover:not(:disabled){background:var(--color-overlay-hover)}button[variant=ghost]:active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-expanded=true]:not(:disabled),button[variant=ghost][aria-expanded=true]:hover:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}[tone=dark] button:not([variant]):not(:disabled){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}[tone=dark] button:not([variant]):hover:not(:disabled){background:var(--tint-300)}[tone=dark] button:not([variant]):active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}[tone=light] button:not([variant]):not(:disabled){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}[tone=light] button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}[tone=light] button:not([variant]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button[size=sm]{min-height:24px;padding:var(--space-2) var(--space-8)}button[size=md]{min-height:32px;padding:var(--space-6) var(--space-12)}button[icon-only]{width:24px;height:24px;min-height:0;padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}.prose{line-height:var(--leading-base)}.prose h1{font-size:var(--text-xl);margin-bottom:var(--space-8)}.prose h2{font-size:var(--text-lg);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose h3,.prose h4,.prose h5,.prose h6{font-size:var(--text-base);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose p{margin:var(--space-12) 0}.prose ul,.prose ol{padding-left:var(--space-24);margin:var(--space-12) 0}.prose blockquote,.prose pre{margin:var(--space-12) 0}.prose hr{margin:var(--space-24) 0}.prose table{width:100%;margin:var(--space-12) 0}.prose img{max-width:100%;height:auto}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}[material=paper]{background:var(--white);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text)}[material=glass]{background:color-mix(in srgb,var(--white) var(--alpha-700),transparent);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text);backdrop-filter:var(--backdrop-blur-glass);-webkit-backdrop-filter:var(--backdrop-blur-glass)}[tone=dark]{color:color-mix(in srgb,var(--white) var(--alpha-950),transparent);border-color:color-mix(in srgb,var(--white) var(--alpha-200),transparent);--color-overlay-hover: color-mix(in srgb, var(--white) var(--alpha-200), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-500), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass]{background:color-mix(in srgb,var(--black) var(--alpha-600),transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}dropdown-menu::part(panel){position:absolute;left:0;min-width:192px;padding:var(--space-4);border-radius:var(--radius-8);display:flex;flex-direction:column;gap:2px;z-index:2000}dropdown-menu::part(panel-bottom){top:calc(100% + var(--space-4))}dropdown-menu::part(panel-top){bottom:calc(100% + var(--space-4))}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}modal-overlay{color:inherit}modal-overlay::part(backdrop){position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--layer-overlay);display:flex;align-items:center;justify-content:center;padding:var(--space-16);background:var(--color-overlay-backdrop)}panel-view{display:block}panel-view::part(panel){display:flex;flex-direction:column;gap:var(--space-16);color:var(--color-text)}panel-view::part(header){display:flex;align-items:center;justify-content:space-between;gap:var(--space-12)}panel-view::part(title){margin:0;font:inherit;font-size:var(--text-lg);font-weight:600;color:var(--color-text)}panel-view::part(button){display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;border:1px solid var(--color-border);border-radius:var(--radius-4);background:var(--color-surface);color:var(--color-text);box-shadow:none}panel-view::part(button):hover{background:var(--color-interactive-hover)}panel-view::part(button):focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}panel-view::part(icon){display:inline-flex;align-items:center;justify-content:center;flex:none}ui-popover{display:contents}ui-popover::part(panel){position:fixed;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-16);outline:none;z-index:2000}ui-pill{display:inline-block;vertical-align:baseline;margin:2px 0;padding:0 var(--space-8);font-size:var(--text-sm);font-weight:500;line-height:1.7;border-radius:var(--radius-full);border:1px solid var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900);white-space:nowrap}ui-pill[color=gray]{border-color:var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900)}ui-pill[color=red]{border-color:var(--red-200);background:var(--red-100);color:var(--red-950)}ui-pill[color=orange]{border-color:var(--orange-200);background:var(--orange-100);color:var(--orange-950)}ui-pill[color=yellow]{border-color:var(--yellow-200);background:var(--yellow-100);color:var(--yellow-950)}ui-pill[color=green]{border-color:var(--green-200);background:var(--green-100);color:var(--green-950)}ui-pill[color=blue]{border-color:var(--blue-200);background:var(--blue-100);color:var(--blue-950)}ui-pill[color=purple]{border-color:var(--purple-200);background:var(--purple-100);color:var(--purple-950)}',ih=new CSSStyleSheet;ih.replaceSync(H2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,ih]}catch{}qv(document);function Yv(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,ih]}catch{}qv(n)}/**
|
|
50
50
|
* @license
|
|
51
51
|
* Copyright 2017 Google LLC
|
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
|
-
*/const
|
|
53
|
+
*/const Kv={CHILD:2},sh=n=>(...e)=>({_$litDirective$:n,values:e});class Jv{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
54
54
|
* @license
|
|
55
55
|
* Copyright 2017 Google LLC
|
|
56
56
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
57
|
-
*/let ma=class extends
|
|
57
|
+
*/let ma=class extends Jv{constructor(e){if(super(e),this.it=se,e.type!==Kv.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===se||e==null)return this._t=void 0,this.it=e;if(e===hi)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};ma.directiveName="unsafeHTML",ma.resultType=1;const B2=sh(ma);/**
|
|
58
58
|
* @license
|
|
59
59
|
* Copyright 2017 Google LLC
|
|
60
60
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
61
|
-
*/class
|
|
61
|
+
*/class Uc extends ma{}Uc.directiveName="unsafeSVG",Uc.resultType=2;const j2=sh(Uc),V2={size:16,color:"currentColor",weight:"regular"};function G2(n){return typeof n=="string"?{regular:n}:n}function Dt(n,e="0 0 256 256"){const t=G2(n);return r=>{const{size:i,color:s,weight:o}={...V2,...r},a=t[o]??t.regular;return N`<svg
|
|
62
62
|
xmlns="http://www.w3.org/2000/svg"
|
|
63
63
|
data-ui-icon=""
|
|
64
64
|
width="${i}"
|
|
65
65
|
height="${i}"
|
|
66
66
|
viewBox="${e}"
|
|
67
67
|
fill="${s}"
|
|
68
|
-
>${H2(a)}</svg>`}}const V2=Dt('<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M200 224H56C53.8783 224 51.8434 223.157 50.3431 221.657C48.8429 220.157 48 218.122 48 216V40C48 37.8783 48.8429 35.8434 50.3431 34.3431C51.8434 32.8429 53.8783 32 56 32H152L208 88V216C208 218.122 207.157 220.157 205.657 221.657C204.157 223.157 202.122 224 200 224Z"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M152 32V88H208"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 88H124.5"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 128H175"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 169H175"/>'),Kv=Dt('<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"/>'),G2=Dt('<path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/>'),Jv=Dt('<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"/>'),W2=Dt('<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"/>'),q2=Dt('<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"/>'),Y2=Dt({regular:'<path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/>',bold:'<path d="M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"/>',fill:'<path d="M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"/>'}),K2=Dt({regular:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"/>',bold:'<path d="M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"/>'}),J2=Dt({regular:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',bold:'<path d="M216,44H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v4H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V68h4a12,12,0,0,0,0-24ZM104,40h48v4H104Zm84,164H68V68H188Zm-84-48V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm40,0V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Z"/>'}),Uc=Dt({regular:'<path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/>',bold:'<path d="M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z"/>',fill:'<path d="M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"/>'});class Xv extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class X2 extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var Je,dt,hn,Qn,ne,ks,L,ey,Gi,ty,ny,Fc,ry,Wi,Dn,er,Es,xs,As,Ea,iy,sy,Zc,qi,oy,Hc,Ut;class Qv extends HTMLElement{constructor(){super();w(this,L);w(this,Je,!1);w(this,dt,null);w(this,hn,null);w(this,Qn);w(this,ne,null);w(this,ks,new MutationObserver(t=>g(this,L,iy).call(this,t)));w(this,er,()=>{g(this,L,Wi).call(this,!l(this,Je))});w(this,Es,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),l(this,er).call(this))});w(this,xs,t=>{l(this,Je)&&(t.composedPath().includes(this)||g(this,L,Wi).call(this,!1))});w(this,As,t=>{t instanceof Xv&&(t.stopPropagation(),k(this,Je,!1),g(this,L,Gi).call(this,t.value),g(this,L,Ut).call(this),this.dispatchEvent(new X2(t.value)))});w(this,Ea,()=>{g(this,L,Zc).call(this)});k(this,Qn,this.attachShadow({mode:"open"})),Wv(l(this,Qn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,As)),document.addEventListener("click",l(this,xs),!0),g(this,L,ey).call(this),l(this,ks).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),g(this,L,Ut).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,As)),document.removeEventListener("click",l(this,xs),!0),l(this,ks).disconnect(),g(this,L,Hc).call(this)}attributeChangedCallback(t){if(t==="open"){g(this,L,Wi).call(this,this.hasAttribute("open"));return}g(this,L,Ut).call(this)}get open(){return l(this,Je)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get placement(){return this.getAttribute("placement")==="top"?"top":"bottom"}get value(){return l(this,dt)}set value(t){t===null?(g(this,L,Dn).call(this,null,null),g(this,L,ty).call(this)):g(this,L,Gi).call(this,t),g(this,L,Ut).call(this)}close(){g(this,L,Wi).call(this,!1)}}Je=new WeakMap,dt=new WeakMap,hn=new WeakMap,Qn=new WeakMap,ne=new WeakMap,ks=new WeakMap,L=new WeakSet,ey=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&g(this,L,Dn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},Gi=function(t){var r;for(const i of l(this,L,Fc))i.value===t?(g(this,L,Dn).call(this,t,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},ty=function(){const t=this.querySelectorAll("dropdown-item[selected]");for(const r of t)r.removeAttribute("selected")},ny=function(t){for(const r of l(this,L,Fc))if(r.value===t)return r;return null},Fc=function(){return this.querySelectorAll("dropdown-item")},ry=function(){return l(this,hn)??this.title},Wi=function(t){l(this,Je)!==t&&(k(this,Je,t),g(this,L,Ut).call(this))},Dn=function(t,r){k(this,dt,t),k(this,hn,r)},er=new WeakMap,Es=new WeakMap,xs=new WeakMap,As=new WeakMap,Ea=new WeakMap,iy=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||g(this,L,sy).call(this)},sy=function(){var r,i;const t=this.querySelector("dropdown-item[selected]");if(t){const s=t.value,o=((r=t.textContent)==null?void 0:r.trim())??null,a=l(this,dt)!==s||l(this,hn)!==o;g(this,L,Dn).call(this,s,o),g(this,L,Gi).call(this,s),a?g(this,L,Ut).call(this):g(this,L,qi).call(this);return}if(l(this,dt)!==null){const s=g(this,L,ny).call(this,l(this,dt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,hn)!==o;g(this,L,Dn).call(this,l(this,dt),o),g(this,L,Gi).call(this,l(this,dt)),a?g(this,L,Ut).call(this):g(this,L,qi).call(this);return}}if(l(this,dt)!==null||l(this,hn)!==null){g(this,L,Dn).call(this,null,null),g(this,L,Ut).call(this);return}g(this,L,qi).call(this)},Zc=function(){const t=l(this,Qn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;l(this,ne)!==r&&(g(this,L,Hc).call(this),k(this,ne,r),l(this,ne)&&(l(this,ne).addEventListener("click",l(this,er)),l(this,ne)instanceof HTMLButtonElement?l(this,ne).hasAttribute("type")||(l(this,ne).type="button"):(l(this,ne).hasAttribute("role")||l(this,ne).setAttribute("role","button"),l(this,ne).hasAttribute("tabindex")||(l(this,ne).tabIndex=0),l(this,ne).addEventListener("keydown",l(this,Es))))),g(this,L,qi).call(this)},qi=function(){l(this,ne)&&(l(this,ne).setAttribute("data-dropdown-trigger",""),l(this,ne).setAttribute("aria-haspopup","listbox"),l(this,ne).setAttribute("aria-expanded",l(this,Je)?"true":"false"))},oy=function(){return this.placement==="top"?W2:Jv},Hc=function(){l(this,ne)&&(l(this,ne).removeEventListener("click",l(this,er)),l(this,ne).removeEventListener("keydown",l(this,Es)),l(this,ne).removeAttribute("data-dropdown-trigger"),l(this,ne).removeAttribute("aria-haspopup"),l(this,ne).removeAttribute("aria-expanded"),k(this,ne,null))},Ut=function(){this.toggleAttribute("open",l(this,Je)),Re(N`
|
|
68
|
+
>${j2(a)}</svg>`}}const W2=Dt('<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M200 224H56C53.8783 224 51.8434 223.157 50.3431 221.657C48.8429 220.157 48 218.122 48 216V40C48 37.8783 48.8429 35.8434 50.3431 34.3431C51.8434 32.8429 53.8783 32 56 32H152L208 88V216C208 218.122 207.157 220.157 205.657 221.657C204.157 223.157 202.122 224 200 224Z"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M152 32V88H208"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 88H124.5"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 128H175"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 169H175"/>'),Xv=Dt('<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"/>'),q2=Dt('<path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/>'),Qv=Dt('<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"/>'),Y2=Dt('<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"/>'),K2=Dt('<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"/>'),J2=Dt({regular:'<path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/>',bold:'<path d="M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"/>',fill:'<path d="M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"/>'}),X2=Dt({regular:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"/>',bold:'<path d="M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"/>'}),Q2=Dt({regular:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',bold:'<path d="M216,44H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v4H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V68h4a12,12,0,0,0,0-24ZM104,40h48v4H104Zm84,164H68V68H188Zm-84-48V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm40,0V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Z"/>'}),Fc=Dt({regular:'<path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/>',bold:'<path d="M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z"/>',fill:'<path d="M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"/>'});class ey extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class eD extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var Je,dt,hn,Qn,ne,ks,L,ny,Gi,ry,iy,Zc,sy,Wi,Dn,er,Es,xs,As,Ea,oy,ay,Hc,qi,ly,Bc,Ut;class ty extends HTMLElement{constructor(){super();w(this,L);w(this,Je,!1);w(this,dt,null);w(this,hn,null);w(this,Qn);w(this,ne,null);w(this,ks,new MutationObserver(t=>g(this,L,oy).call(this,t)));w(this,er,()=>{g(this,L,Wi).call(this,!l(this,Je))});w(this,Es,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),l(this,er).call(this))});w(this,xs,t=>{l(this,Je)&&(t.composedPath().includes(this)||g(this,L,Wi).call(this,!1))});w(this,As,t=>{t instanceof ey&&(t.stopPropagation(),k(this,Je,!1),g(this,L,Gi).call(this,t.value),g(this,L,Ut).call(this),this.dispatchEvent(new eD(t.value)))});w(this,Ea,()=>{g(this,L,Hc).call(this)});k(this,Qn,this.attachShadow({mode:"open"})),Yv(l(this,Qn))}connectedCallback(){this.addEventListener("dropdown-item-select",l(this,As)),document.addEventListener("click",l(this,xs),!0),g(this,L,ny).call(this),l(this,ks).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),g(this,L,Ut).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",l(this,As)),document.removeEventListener("click",l(this,xs),!0),l(this,ks).disconnect(),g(this,L,Bc).call(this)}attributeChangedCallback(t){if(t==="open"){g(this,L,Wi).call(this,this.hasAttribute("open"));return}g(this,L,Ut).call(this)}get open(){return l(this,Je)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get placement(){return this.getAttribute("placement")==="top"?"top":"bottom"}get value(){return l(this,dt)}set value(t){t===null?(g(this,L,Dn).call(this,null,null),g(this,L,ry).call(this)):g(this,L,Gi).call(this,t),g(this,L,Ut).call(this)}close(){g(this,L,Wi).call(this,!1)}}Je=new WeakMap,dt=new WeakMap,hn=new WeakMap,Qn=new WeakMap,ne=new WeakMap,ks=new WeakMap,L=new WeakSet,ny=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&g(this,L,Dn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},Gi=function(t){var r;for(const i of l(this,L,Zc))i.value===t?(g(this,L,Dn).call(this,t,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},ry=function(){const t=this.querySelectorAll("dropdown-item[selected]");for(const r of t)r.removeAttribute("selected")},iy=function(t){for(const r of l(this,L,Zc))if(r.value===t)return r;return null},Zc=function(){return this.querySelectorAll("dropdown-item")},sy=function(){return l(this,hn)??this.title},Wi=function(t){l(this,Je)!==t&&(k(this,Je,t),g(this,L,Ut).call(this))},Dn=function(t,r){k(this,dt,t),k(this,hn,r)},er=new WeakMap,Es=new WeakMap,xs=new WeakMap,As=new WeakMap,Ea=new WeakMap,oy=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||g(this,L,ay).call(this)},ay=function(){var r,i;const t=this.querySelector("dropdown-item[selected]");if(t){const s=t.value,o=((r=t.textContent)==null?void 0:r.trim())??null,a=l(this,dt)!==s||l(this,hn)!==o;g(this,L,Dn).call(this,s,o),g(this,L,Gi).call(this,s),a?g(this,L,Ut).call(this):g(this,L,qi).call(this);return}if(l(this,dt)!==null){const s=g(this,L,iy).call(this,l(this,dt));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=l(this,hn)!==o;g(this,L,Dn).call(this,l(this,dt),o),g(this,L,Gi).call(this,l(this,dt)),a?g(this,L,Ut).call(this):g(this,L,qi).call(this);return}}if(l(this,dt)!==null||l(this,hn)!==null){g(this,L,Dn).call(this,null,null),g(this,L,Ut).call(this);return}g(this,L,qi).call(this)},Hc=function(){const t=l(this,Qn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;l(this,ne)!==r&&(g(this,L,Bc).call(this),k(this,ne,r),l(this,ne)&&(l(this,ne).addEventListener("click",l(this,er)),l(this,ne)instanceof HTMLButtonElement?l(this,ne).hasAttribute("type")||(l(this,ne).type="button"):(l(this,ne).hasAttribute("role")||l(this,ne).setAttribute("role","button"),l(this,ne).hasAttribute("tabindex")||(l(this,ne).tabIndex=0),l(this,ne).addEventListener("keydown",l(this,Es))))),g(this,L,qi).call(this)},qi=function(){l(this,ne)&&(l(this,ne).setAttribute("data-dropdown-trigger",""),l(this,ne).setAttribute("aria-haspopup","listbox"),l(this,ne).setAttribute("aria-expanded",l(this,Je)?"true":"false"))},ly=function(){return this.placement==="top"?Y2:Qv},Bc=function(){l(this,ne)&&(l(this,ne).removeEventListener("click",l(this,er)),l(this,ne).removeEventListener("keydown",l(this,Es)),l(this,ne).removeAttribute("data-dropdown-trigger"),l(this,ne).removeAttribute("aria-haspopup"),l(this,ne).removeAttribute("aria-expanded"),k(this,ne,null))},Ut=function(){this.toggleAttribute("open",l(this,Je)),Re(N`
|
|
69
69
|
<slot name="trigger" @slotchange=${l(this,Ea)}>
|
|
70
70
|
<button
|
|
71
71
|
class="fallback-trigger"
|
|
@@ -75,9 +75,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
75
75
|
aria-expanded=${l(this,Je)?"true":"false"}
|
|
76
76
|
@click=${l(this,er)}
|
|
77
77
|
>
|
|
78
|
-
<span class="trigger-label" part="trigger-label">${l(this,L,
|
|
78
|
+
<span class="trigger-label" part="trigger-label">${l(this,L,sy)}</span>
|
|
79
79
|
<span class="trigger-icon" part="trigger-icon" aria-hidden="true">
|
|
80
|
-
${l(this,L,
|
|
80
|
+
${l(this,L,ly).call(this,{size:16})}
|
|
81
81
|
</span>
|
|
82
82
|
</button>
|
|
83
83
|
</slot>
|
|
@@ -92,13 +92,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
92
92
|
<slot></slot>
|
|
93
93
|
</div>
|
|
94
94
|
`:null}
|
|
95
|
-
`,l(this,Qn)),queueMicrotask(()=>g(this,L,
|
|
95
|
+
`,l(this,Qn)),queueMicrotask(()=>g(this,L,Hc).call(this))},b(ty,"observedAttributes",["title","placement","open"]);class tD extends HTMLElement{}class nD extends HTMLElement{}class rD extends HTMLElement{}var mr,jc,uy,$s,Ts;class cy extends HTMLElement{constructor(){super(...arguments);w(this,mr);w(this,$s,()=>{this.action||g(this,mr,uy).call(this)});w(this,Ts,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",l(this,$s)),this.addEventListener("keydown",l(this,Ts)),g(this,mr,jc).call(this)}disconnectedCallback(){this.removeEventListener("click",l(this,$s)),this.removeEventListener("keydown",l(this,Ts))}attributeChangedCallback(){g(this,mr,jc).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}mr=new WeakSet,jc=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")},uy=function(){this.dispatchEvent(new ey(this.value))},$s=new WeakMap,Ts=new WeakMap,b(cy,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",ty);customElements.get("dropdown-group")||customElements.define("dropdown-group",tD);customElements.get("dropdown-label")||customElements.define("dropdown-label",nD);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",rD);customElements.get("dropdown-item")||customElements.define("dropdown-item",cy);class iD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Cs,bn,Vc,xa,Is,Gc;class hy extends HTMLElement{constructor(){super();w(this,bn);w(this,Cs);w(this,xa,t=>{t.target===t.currentTarget&&g(this,bn,Vc).call(this)});w(this,Is,t=>{this.open&&t.key==="Escape"&&g(this,bn,Vc).call(this)});k(this,Cs,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",l(this,Is)),g(this,bn,Gc).call(this)}disconnectedCallback(){document.removeEventListener("keydown",l(this,Is))}attributeChangedCallback(){g(this,bn,Gc).call(this)}get open(){return this.hasAttribute("open")}}Cs=new WeakMap,bn=new WeakSet,Vc=function(){this.dispatchEvent(new iD)},xa=new WeakMap,Is=new WeakMap,Gc=function(){Re(N`
|
|
96
96
|
${this.open?N`
|
|
97
97
|
<div class="backdrop" part="backdrop" @click=${l(this,xa)}>
|
|
98
98
|
<slot></slot>
|
|
99
99
|
</div>
|
|
100
100
|
`:null}
|
|
101
|
-
`,l(this,Cs))},b(
|
|
101
|
+
`,l(this,Cs))},b(hy,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",hy);class sD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class oD extends HTMLElement{}var Ps,Rs,Wc;class dy extends HTMLElement{constructor(){super();w(this,Rs);w(this,Ps);k(this,Ps,this.attachShadow({mode:"open"}))}connectedCallback(){g(this,Rs,Wc).call(this)}attributeChangedCallback(){g(this,Rs,Wc).call(this)}get closable(){return this.hasAttribute("closable")}}Ps=new WeakMap,Rs=new WeakSet,Wc=function(){const t=this.querySelector("panel-page");Re(N`
|
|
102
102
|
<section class="panel" part="panel">
|
|
103
103
|
<header class="title-bar" part="header">
|
|
104
104
|
<h2 class="title" part="title">${(t==null?void 0:t.getAttribute("title"))??""}</h2>
|
|
@@ -108,15 +108,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
108
108
|
class="title-button"
|
|
109
109
|
part="button close-button"
|
|
110
110
|
aria-label="Close"
|
|
111
|
-
@click=${()=>this.dispatchEvent(new
|
|
111
|
+
@click=${()=>this.dispatchEvent(new sD)}
|
|
112
112
|
>
|
|
113
|
-
<span class="close-icon" part="icon close-icon">${
|
|
113
|
+
<span class="close-icon" part="icon close-icon">${Xv({size:16})}</span>
|
|
114
114
|
</button>
|
|
115
115
|
`:null}
|
|
116
116
|
</header>
|
|
117
117
|
<slot></slot>
|
|
118
118
|
</section>
|
|
119
|
-
`,l(this,Ps))},b(
|
|
119
|
+
`,l(this,Ps))},b(dy,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",dy);customElements.get("panel-page")||customElements.define("panel-page",oD);class aD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const of='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Xl=4;var je,Wt,tr,tt,Ds,Kr,re,fy,gy,qc,Os,zs,nr,my,Yc,vy,yy,Xo,Qo;class py extends HTMLElement{constructor(){super();w(this,re);w(this,je,!1);w(this,Wt,null);w(this,tr);w(this,tt,null);w(this,Ds,"bottom-start");w(this,Kr,!1);w(this,Os,t=>{l(this,je)&&(l(this,Kr)||t.composedPath().includes(this)||(this.open=!1))});w(this,zs,t=>{if(l(this,je)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&g(this,re,my).call(this,t)}});w(this,nr,()=>{l(this,je)&&g(this,re,Xo).call(this)});k(this,tr,this.attachShadow({mode:"open"})),Yv(l(this,tr))}connectedCallback(){this.hasAttribute("tone")||this.setAttribute("tone","light"),g(this,re,Qo).call(this)}disconnectedCallback(){g(this,re,qc).call(this)}attributeChangedCallback(t){t==="open"&&g(this,re,fy).call(this,this.hasAttribute("open"))}get open(){return l(this,je)}set open(t){this.toggleAttribute("open",t)}get anchor(){return l(this,Wt)}set anchor(t){l(this,Wt)!==t&&(k(this,Wt,t),l(this,je)&&g(this,re,Xo).call(this))}}je=new WeakMap,Wt=new WeakMap,tr=new WeakMap,tt=new WeakMap,Ds=new WeakMap,Kr=new WeakMap,re=new WeakSet,fy=function(t){var r;l(this,je)!==t&&(k(this,je,t),t?(k(this,Kr,!0),setTimeout(()=>{k(this,Kr,!1)},0),g(this,re,Qo).call(this),g(this,re,gy).call(this),queueMicrotask(()=>{l(this,je)&&(g(this,re,Xo).call(this),g(this,re,yy).call(this))})):(g(this,re,qc).call(this),g(this,re,Qo).call(this),(r=l(this,Wt))==null||r.focus(),this.dispatchEvent(new aD)))},gy=function(){document.addEventListener("click",l(this,Os)),document.addEventListener("keydown",l(this,zs),!0),window.addEventListener("resize",l(this,nr)),window.addEventListener("scroll",l(this,nr),!0)},qc=function(){document.removeEventListener("click",l(this,Os)),document.removeEventListener("keydown",l(this,zs),!0),window.removeEventListener("resize",l(this,nr)),window.removeEventListener("scroll",l(this,nr),!0)},Os=new WeakMap,zs=new WeakMap,nr=new WeakMap,my=function(t){const r=g(this,re,Yc).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=g(this,re,vy).call(this),a=o instanceof HTMLElement&&r.includes(o);t.shiftKey?(!a||o===i)&&(t.preventDefault(),s.focus()):(!a||o===s)&&(t.preventDefault(),i.focus())},Yc=function(){if(!l(this,tt))return[];const t=l(this,tt).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(of)&&r.push(i);for(const s of i.querySelectorAll(of))r.push(s)}return r},vy=function(){var r;let t=document.activeElement;for(;t&&((r=t.shadowRoot)!=null&&r.activeElement);)t=t.shadowRoot.activeElement;return t},yy=function(){var r;const t=g(this,re,Yc).call(this);t.length>0?t[0].focus():(r=l(this,tt))==null||r.focus()},Xo=function(){if(!l(this,je)||!l(this,Wt)||!l(this,tt))return;const t=l(this,Wt).getBoundingClientRect(),r=l(this,tt).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+Xl,a=s<o&&t.top>o?"top-start":"bottom-start";k(this,Ds,a);const c=a==="bottom-start"?t.bottom+Xl:t.top-r.height-Xl,u=t.left;l(this,tt).style.top=`${c}px`,l(this,tt).style.left=`${u}px`,l(this,tt).setAttribute("data-placement",a)},Qo=function(){this.toggleAttribute("open",l(this,je)),Re(l(this,je)?N`<div
|
|
120
120
|
class="panel"
|
|
121
121
|
part="panel"
|
|
122
122
|
data-placement=${l(this,Ds)}
|
|
@@ -126,8 +126,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
126
126
|
level="1"
|
|
127
127
|
>
|
|
128
128
|
<slot></slot>
|
|
129
|
-
</div>`:se,l(this,tr)),k(this,tt,l(this,tr).querySelector(".panel"))},b(
|
|
130
|
-
${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const
|
|
129
|
+
</div>`:se,l(this,tr)),k(this,tt,l(this,tr).querySelector(".panel"))},b(py,"observedAttributes",["open"]);customElements.get("ui-popover")||customElements.define("ui-popover",py);const lD=mt(),cD="No handler registered for update-content",uD="handleUpdateContent: handler already registered";function hD(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const dD=Si(vt);var Jr,Xr,Qr,rr,ir,Ls,Ce,Kc,by,wy,Yi,Jc,Mf;let pD=(Mf=class extends dD{constructor(t){super();w(this,Ce);w(this,Jr);w(this,Xr);w(this,Qr);w(this,rr,null);w(this,ir,null);w(this,Ls,!1);k(this,Jr,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");k(this,Xr,r),k(this,Qr,i=>g(this,Ce,by).call(this,i)),l(this,Xr).addEventListener("message",l(this,Qr))}get content(){return l(this,ir)}set content(t){g(this,Ce,Jc).call(this),k(this,ir,t),l(this,Ls)&&g(this,Ce,Kc).call(this,t)}handleUpdateContent(t){if(g(this,Ce,Jc).call(this),l(this,rr)!==null)throw new Error(uD);k(this,rr,t)}dispose(){l(this,Xr).removeEventListener("message",l(this,Qr)),k(this,rr,null)}},Jr=new WeakMap,Xr=new WeakMap,Qr=new WeakMap,rr=new WeakMap,ir=new WeakMap,Ls=new WeakMap,Ce=new WeakSet,Kc=function(t){const r={type:"content-updated",content:t};g(this,Ce,Yi).call(this,r)},by=function(t){if(this.disposed||t.source!==l(this,Jr).contentWindow)return;const r=t.data;if(gC(r)){k(this,Ls,!0),this.dispatchEvent(new lD("ready")),l(this,ir)!==null&&g(this,Ce,Kc).call(this,l(this,ir));return}if(mC(r)){g(this,Ce,wy).call(this,r);return}},wy=async function(t){const r=l(this,rr);if(r===null){g(this,Ce,Yi).call(this,{type:"response",id:t.id,error:{message:cD}});return}try{await r(t.content)}catch(i){if(this.disposed)return;g(this,Ce,Yi).call(this,{type:"response",id:t.id,error:{message:hD(i)}});return}this.disposed||g(this,Ce,Yi).call(this,{type:"response",id:t.id,result:{}})},Yi=function(t){const r=l(this,Jr).contentWindow;r&&r.postMessage(t,"*")},Jc=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Mf);function fD(n=window){if(n.parent===n)return;let e=0,t=0;n.addEventListener("wheel",r=>{const i=r;e=i.clientX,t=i.clientY,n.parent.postMessage({type:"wheel",deltaX:i.deltaX,deltaY:i.deltaY,shiftKey:i.shiftKey},"*"),i.preventDefault()},{passive:!1}),n.addEventListener("message",r=>{var u,d;const i=r.data;if(i===null||typeof i!="object"||i.type!=="scroll")return;const s=i,o=typeof s.deltaX=="number"?s.deltaX:0,a=typeof s.deltaY=="number"?s.deltaY:0;let c=((d=(u=n.document).elementFromPoint)==null?void 0:d.call(u,e,t))??null;for(;c!==null;){const p=n.getComputedStyle(c);if(a!==0){const y=(p.overflowY==="auto"||p.overflowY==="scroll")&&c.scrollHeight>c.clientHeight,v=a>0?c.scrollTop+c.clientHeight<c.scrollHeight:c.scrollTop>0;if(y&&v){c.scrollBy(o,a);return}}if(o!==0){const y=(p.overflowX==="auto"||p.overflowX==="scroll")&&c.scrollWidth>c.clientWidth,v=o>0?c.scrollLeft+c.clientWidth<c.scrollWidth:c.scrollLeft>0;if(y&&v){c.scrollBy(o,a);return}}c=c.parentElement}n.scrollBy(o,a)})}function gD(){return`(${fD.toString()})(window);`}async function mD(n){const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch artifact content: ${e.status}`);const t=await e.text(),r=new DOMParser().parseFromString(t,"text/html"),i=r.createElement("base");i.href=n,r.head.insertBefore(i,r.head.firstChild);const s=r.createElement("script");s.textContent=gD(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
|
|
130
|
+
${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const Sy=mt();class vD extends HTMLElement{constructor(){super(...arguments);b(this,"_artifact",null);b(this,"_viewURL",null);b(this,"_contentURL",null);b(this,"_screen",null);b(this,"_subscribedScreen",null);b(this,"_activeView",null);b(this,"_contentState",{kind:"idle"});b(this,"_fetchSequence",0);b(this,"_blobSequence",0);b(this,"_mountedViewURL",null);b(this,"_directRender",!1);b(this,"_blobURL",null);b(this,"handleScreenContentChanged",t=>{!this._artifact||t.artifactID!==this._artifact.id||this._activeView!==null&&this.refetchContent()})}set artifact(t){const r=this._artifact;this._artifact=t,this.render(),r!==null&&r!==t&&this.syncView()}get artifact(){return this._artifact}set viewURL(t){this._viewURL!==t&&(this._viewURL=t,this.syncView())}get viewURL(){return this._viewURL}set contentURL(t){this._contentURL!==t&&(this._contentURL=t,this.syncView())}get contentURL(){return this._contentURL}set screen(t){this._screen!==t&&(this._screen=t,this.syncScreenSubscription())}get screen(){return this._screen}set dragging(t){t?this.setAttribute("dragging","true"):this.removeAttribute("dragging")}get dragging(){return this.getAttribute("dragging")==="true"}get activeView(){return this._activeView}connectedCallback(){this.setAttribute("level","2"),this.render(),this.syncView(),this.syncScreenSubscription()}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen()}handleClose(){this._artifact&&this.dispatchEvent(new Sy("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){var t;if(this.isConnected){if(this._viewURL!==null){if(this._directRender&&this.teardownView(),this._mountedViewURL!==this._viewURL){this.teardownView(),this._contentState={kind:"loading"},this._mountedViewURL=this._viewURL,this.render();const r=this.querySelector("iframe.artifact-frame");if(!r){this._contentState={kind:"error"},this.render();return}this._activeView=new pD(r),this._activeView.handleUpdateContent(async i=>{await this.saveContent(i)}),this.loadBlobFrame(this._viewURL),this.startContentFetch();return}this._activeView!==null&&this.startContentFetch();return}if(this._contentURL!==null){this.teardownView(),this._directRender=!0,this._contentState={kind:"idle"},this.render(),((t=this._artifact)==null?void 0:t.status)==="committed"&&this.loadBlobFrame(this._contentURL);return}this.teardownView(),this._contentState={kind:"idle"},this.render()}}async saveContent(t){const r=this._screen,i=this._artifact;if(!r||!i)throw new Error("artifact-view: cannot save without a screen and artifact");await r.server.client.artifacts.putContent({artifactID:i.id,content:t})}syncScreenSubscription(){if(!this.isConnected){this.unsubscribeFromScreen();return}this._subscribedScreen!==this._screen&&(this.unsubscribeFromScreen(),this._screen!==null&&(this._screen.addEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=this._screen))}unsubscribeFromScreen(){this._subscribedScreen!==null&&(this._subscribedScreen.removeEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=null)}startContentFetch(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;if(!i||r===null){this._contentState={kind:"error"},this.render();return}this._contentState={kind:"loading"},(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence)return;if(!s.ok){this._contentState={kind:"error"},this.teardownView(),this.render();return}const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o,this._contentState={kind:"ready"}}catch{if(t!==this._fetchSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}refetchContent(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;!i||r===null||(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence||!s.ok)return;const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o}catch{}})()}loadBlobFrame(t){this._blobSequence+=1;const r=this._blobSequence;(async()=>{try{const i=await mD(t);if(r!==this._blobSequence){URL.revokeObjectURL(i);return}this._blobURL=i,this.render();const s=this.querySelector("iframe.artifact-frame");s&&(s.src=i)}catch{if(r!==this._blobSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}teardownView(){this._activeView!==null&&(this._activeView.dispose(),this._activeView=null),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}contentTemplate(){return this._contentState.kind==="error"?N`
|
|
131
131
|
<div class="artifact-content artifact-placeholder">
|
|
132
132
|
<em>Failed to load content</em>
|
|
133
133
|
</div>
|
|
@@ -145,7 +145,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
145
145
|
${this.contentTemplate()}
|
|
146
146
|
<footer class="artifact-title-bar" drag-handle material="glass">
|
|
147
147
|
<div class="artifact-title-group">
|
|
148
|
-
<span class="artifact-title-icon">${
|
|
148
|
+
<span class="artifact-title-icon">${W2({size:16})}</span>
|
|
149
149
|
<span class="artifact-title">${t.title}</span>
|
|
150
150
|
</div>
|
|
151
151
|
<button
|
|
@@ -155,10 +155,10 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
155
155
|
@click=${()=>this.handleClose()}
|
|
156
156
|
aria-label="Close"
|
|
157
157
|
>
|
|
158
|
-
${
|
|
158
|
+
${Xv({size:16})}
|
|
159
159
|
</button>
|
|
160
160
|
</footer>
|
|
161
|
-
`}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Re(this.template(),this))}}customElements.define("artifact-view",gD);const ke=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Ro=2,mD=2;class vD{constructor(e){b(this,"basis");b(this,"min");b(this,"_gap");b(this,"_viewport");b(this,"_unit");this.basis=e.basis,this.min=e.min,this._viewport=e.viewport,this._gap=e.gap??ke({x:ge,y:ge});const t=this._viewport.x??hr,r=this._viewport.y??ca,i=this._gap.x??ge,s=this._gap.y??ge,o=hr+i*mD,a=t<=o,c=a?t-i*Ro:Math.min(hr,t-i*Ro),u=a?r-s*Ro:Math.min(ca,r-s*Ro),d=(c-i*(Rt-1))/Rt,p=(u-s*(Qe-1))/Qe,y=this.basis.x??0,v=this.basis.y??0,$=this.min.x??0,E=this.min.y??0;this._unit=ke(a?{x:Math.max($,d),y:Math.max(E,p)}:{x:Math.max($,Math.min(y,d)),y:Math.max(E,Math.min(v,p))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return Te({x:e.x==null?void 0:e.x/(this._unit.x??1),y:e.y==null?void 0:e.y/(this._unit.y??1)})}toPixels(e){const t=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??ge,s=this._gap.y??ge,o=e.x==null?void 0:e.x*t+Math.max(0,e.x-1)*i,a=e.y==null?void 0:e.y*r+Math.max(0,e.y-1)*s;return ke({x:o,y:a})}}const fr=1e-4,Yt=1e-6,yD=40,bD=24;function wy(n,e){return Math.max(0,n-e*2)}function Sy(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function _y(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+ge)}return e}function ky(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s<n.length;s+=1){const o=n[s],a=i===0?o:r+ge+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function wD(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s>=0;s-=1){const o=n[s],a=i===0?o:r+ge+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function SD(n,e){if(n.length===0)return 0;let t=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:t+ge+s;if(o>e+fr)break;t=o,r+=1}return Math.max(1,r)}function sh(n,e){if(n.length===0)return 0;const t=SD(n,e);return Math.max(0,n.length-t)}function sf(n,e,t){if(n.length===0)return 0;const r=ky(n,e,t),i=Math.min(n.length,e+r);if(i<=e)return 0;const s=n.slice(e,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*ge}function Jc(n,e,t){const r=n[e]??0;return t-r}function Lr(n,e,t,r,i){if(n.length===0)return 0;const s=sh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let c=0;for(let H=0;H<s;H+=1){const U=e[H]??0,ce=e[H+1]??U;if(a>=U&&a<=ce+fr){c=H;break}c=H+1}const u=Math.min(c+1,s),d=e[c]??0,p=e[u]??d,y=Math.max(p-d,fr),v=u===c?0:(a-d)/y,$=_y(n),E=sf(n,c,i),I=sf(n,u,i),Z=(r-E)/2,P=(r-I)/2,V=Jc($,c,Z),O=Jc($,u,P);return V+(O-V)*v}function of(n,e,t,r,i){const s=sh(n,r),o=e[s]??0;let a=0,c=o;for(let u=0;u<yD;u+=1){const d=(a+c)/2;Lr(n,e,d,t,r)>i?a=d:c=d}return(a+c)/2}function af(n,e,t){const r=_y(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,d)=>u+d,0)+Math.max(0,o.length-1)*ge,c=(t-a)/2;return Jc(r,i,c)}function _D(n,e,t){const r=ky(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function kD(n,e,t){const r=wD(n,e,t);return[Math.max(0,e-r+1),e]}function ED(n){const e=new Set,t=[];for(const r of n){const i=`${r.nodeRange[0]}:${r.nodeRange[1]}`;if(e.has(i))continue;const s=t[t.length-1];s&&Math.abs(s.anchor-r.anchor)<=Yt||(e.add(i),t.push(r))}return t}function xD(n){const{nodeCols:e,nodeWidthsPx:t,viewportWidthPx:r}=n;if(e.length===0||t.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=n.gapPx??ge,s=wy(r,i),o=Sy(e),a=sh(t,s),c=o[a]??0,u=[];for(let d=0;d<=a;d+=1){const p=_D(t,d,s),y=af(t,p,r),v=of(t,o,r,s,y);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,v))})}for(let d=t.length-1;d>=0;d-=1){const p=kD(t,d,s),y=`${p[0]}:${p[1]}`;if(u.some(E=>`${E.nodeRange[0]}:${E.nodeRange[1]}`===y))continue;const v=af(t,p,r),$=of(t,o,r,s,v);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,$))})}return u.sort((d,p)=>Math.abs(d.anchor-p.anchor)>Yt?d.anchor-p.anchor:d.nodeRange[0]!==p.nodeRange[0]?d.nodeRange[0]-p.nodeRange[0]:d.nodeRange[1]-p.nodeRange[1]),{viewspans:ED(u),minScroll:0,maxScroll:c}}function AD(n,e){var i;let t=0,r=Number.POSITIVE_INFINITY;for(let s=0;s<n.length;s+=1){const o=Math.abs((((i=n[s])==null?void 0:i.anchor)??0)-e);if(o+Yt<r){r=o,t=s;continue}Math.abs(o-r)<=Yt&&s<t&&(t=s)}return t}function $D(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function zi(n,e,t){return Math.max(e,Math.min(t,n))}class TD extends vt{constructor(t){super();b(this,"_scroll",0);b(this,"minScroll",0);b(this,"maxScroll",0);b(this,"viewspans",[]);b(this,"activeViewspanIndex",null);b(this,"nodeWidthsPx",[]);b(this,"boundaryCols",[0]);b(this,"viewportWidthPx",0);b(this,"framedViewportWidthPx",0);this._scroll=(t==null?void 0:t.x)??0}get scroll(){return Te({x:this._scroll})}get translate(){return ke({x:Lr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx)})}set scroll(t){const r=zi(t.x??this._scroll,this.minScroll,this.maxScroll);Math.abs(r-this._scroll)<=Yt||(this._scroll=r,this.activeViewspanIndex=null,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}rebuild(t){const r=t.nodeWidths.map(u=>Math.max(0,u.x??0)),i=r.map(u=>t.grid.toPixels(Te({x:u})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??ge,a=xD({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this.nodeWidthsPx=i,this.boundaryCols=Sy(r),this.viewportWidthPx=s,this.framedViewportWidthPx=wy(s,o),this.viewspans=a.viewspans,this.minScroll=a.minScroll,this.maxScroll=a.maxScroll,this.activeViewspanIndex=null;const c=zi(this._scroll,this.minScroll,this.maxScroll);Math.abs(c-this._scroll)>Yt&&(this._scroll=c,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}step(t){var a;if(this.viewspans.length===0)return;const r=this.activeViewspanIndex??AD(this.viewspans,this._scroll),i=$D(r,t,this.viewspans.length),s=((a=this.viewspans[i])==null?void 0:a.anchor)??this._scroll,o=zi(s,this.minScroll,this.maxScroll);this.activeViewspanIndex=i,!(Math.abs(o-this._scroll)<=Yt)&&(this._scroll=o,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=zi(this._scroll+(t.x??0),this.minScroll,this.maxScroll);this.activeViewspanIndex=null,!(Math.abs(r-this._scroll)<=Yt)&&(this._scroll=r,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=fr)return;this.activeViewspanIndex=null;const i=Lr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx),s=i-r,o=Lr(this.nodeWidthsPx,this.boundaryCols,this.maxScroll,this.viewportWidthPx,this.framedViewportWidthPx),a=Lr(this.nodeWidthsPx,this.boundaryCols,this.minScroll,this.viewportWidthPx,this.framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=fr)return;let u=this.minScroll,d=this.maxScroll;for(let y=0;y<bD;y+=1){const v=(u+d)/2;Lr(this.nodeWidthsPx,this.boundaryCols,v,this.viewportWidthPx,this.framedViewportWidthPx)>c?u=v:d=v}const p=zi((u+d)/2,this.minScroll,this.maxScroll);Math.abs(p-this._scroll)<=Yt||(this._scroll=p,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}}const Xl={"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}},CD=["stack-above","stack-below","reorder-before","reorder-after"];function Ql(n,e){return{left:n.left+n.width*e.left,top:n.top+n.height*e.top,width:n.width*e.width,height:n.height*e.height}}function In(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function oh(n,e){for(const t of n){if(t.type==="card"&&t.id===e)return t;if(t.type==="stack")for(const r of t.children){if(r.type==="card"&&r.id===e)return r;if(r.type==="row"){for(const i of r.children)if(i.id===e)return i}}}return null}function Xc(n){return n.height===Qe||n.height===gn?{...n,height:gn}:n}function Qc(n){return n.height===gn?{...n,height:Qe}:n}function ID(n,e,t,r){const i=n.findIndex(d=>d.type==="stack"&&d.id===e);if(i===-1)return n;const s=n[i];if(!s||s.type!=="stack")return n;const o=s.children.find(d=>d.type==="card"&&d.id===t);if(!o||o.type!=="card")return n;const a=s.children.filter(d=>d.id!==t);if(a.length===s.children.length||a.length<1)return n;const c=[...n];if(a.length===1){const[d]=a;c[i]=d.type==="card"?Qc(d):d}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,Qc(o)),c}const PD=mt(),RD=mt(),DD=50;function OD(n,e){if(n.type!==e.type)return!1;switch(n.type){case"reorder":return e.index===n.index;case"stack":return e.targetCardId===n.targetCardId&&e.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return e.toIndex===n.toIndex;case"stack-child-reorder":return e.position===n.position;default:return!1}}function ao(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function lf(n){return n.map(LD)}function zD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function LD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(zD)}:n}function Ey(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function cf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function MD(n,e){const t=[...e],r=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=t[r];if(!i||i.type!=="card")return null;t.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,t.length));t.splice(s,0,i);const o=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:t,visualDraggedIndex:o}}function ND(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(y=>y.type==="card"&&y.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Ey(r,e.nodeId);if(!a)return null;const c=Xc(a),u=Xc(o),d=ao(c),p=t.position==="above"?[d,u]:[u,d];return i[s]={id:o.id,type:"stack",children:p},i}function ec(n,e){return n.parentStackId?FD(n,e):UD(n,e)}function UD(n,e){const t=n.hitTarget;if(t.type==="reorder"){const r=e[n.sourceIndex];if(!r||r.type!=="card")return[...e];const i=[...e];return i.splice(n.sourceIndex,1),i.splice(t.index,0,ao(r)),i}if(t.type==="stack"){const r=MD(n,e);return r?ND(r,n,t,e)??[...e]:[...e]}return[...e]}function FD(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return ZD(n,e,t.position);case"stack-child-extract":return HD(n,e,t.toIndex);case"stack-child-noop":return BD(n,e);default:return[...e]}}function ZD(n,e,t){const r=e.findIndex(y=>y.type==="stack"&&y.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(y=>y.type==="card"))return[...e];const s=i.children,o=s.findIndex(y=>y.id===n.nodeId);if(o===-1)return[...e];const a=s[o],c=s.filter(y=>y.id!==n.nodeId),u=ao(a),d=t==="above"?[u,...c]:[...c,u],p=[...e];return p[r]={...i,children:d},p}function HD(n,e,t){if(!n.parentStackId)return[...e];const r=ID(e,n.parentStackId,n.nodeId,t);if(r===e)return[...e];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...e];const s=r[i];if(!s||s.type!=="card")return[...e];const o=[...r];return o[i]=ao(s),o}function BD(n,e){const t=e.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(c=>c.type==="card"&&c.id===n.nodeId);if(i===-1)return[...e];const s=r.children[i];if(!s||s.type!=="card")return[...e];const o=[...e],a=[...r.children];return a[i]=ao(s),o[t]={...r,children:a},o}function jD(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Fu()}function VD(n,e,t){if(n.type==="drop-target"){const r=oh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return Xc(r)}return n}function GD(n,e,t){const r=n.children.map(s=>VD(s,e,t));return{id:jD(n,e),type:"stack",children:r}}function WD(n,e,t){if(n.type==="drop-target"){const r=oh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return Ey(e,t)!==null?r:Qc(r)}return n.type==="card"||n.type==="row"?n:GD(n,e,t)}function qD(n,e,t){return n.map(r=>WD(r,e,t))}function YD(n,e){return JSON.stringify(n)===JSON.stringify(e)}const KD=Si(vt);class JD extends KD{constructor(t={}){super();b(this,"pending",null);b(this,"active",null)}start(t){if(this.pending||this.active)return;const r=t.pointer.x??0,i=t.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:t.grabOffset.x??0,grabOffsetY:t.grabOffset.y??0,nodeId:t.nodeId,sourceIndex:t.source.index,parentStackId:t.source.parentId,width:t.size.x??0,height:t.size.y??0,baseLayout:t.layout}}update(t){const r=t.pointer.x??0,i=t.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,d=i-s.startY;Math.hypot(u,d)>=nx&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new J("change")));return}if(!this.active)return;const o=ec(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&OD(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 J("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=ec(this.active,t),s=qD(i,t,this.active.nodeId);YD(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new RD("drop",{layout:r})),this.dispatchEvent(new J("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new J("change")))}dispose(){this.reset()}get status(){return this.active?"active":this.pending?"pending":"idle"}reset(){this.pending=null,this.active=null}emitDrag(){if(!this.active)return;const t=ec(this.active,this.active.baseLayout);this.dispatchEvent(new PD("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:ke({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:ke({x:this.active.pointerX,y:this.active.pointerY}),size:ke({x:this.active.width,y:this.active.height}),projectedLayout:t}))}getHitTargetForPointer(t,r,i,s){return this.active?this.isPointerInsideDragBounds(t,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(t,r,i,s):this.getTopLevelCardHitTarget(t,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(t,r,i,s){var u;if(!((u=this.active)!=null&&u.parentStackId))return{type:"stack-child-noop"};const o=this.getSourceStackInteractionRect(i.geometry);if(o&&In(t,r,o)){const d=o.top+o.height/2;return{type:"stack-child-reorder",position:r<d?"above":"below"}}const a=this.getSourceRemainingSiblingRect(i.geometry);if(a&&In(t,r,a)){const d=a.top+a.height/2;return{type:"stack-child-reorder",position:r<d?"above":"below"}}return{type:"stack-child-extract",toIndex:this.getTopLevelReorderIndexForPointer(t,r,i,s)}}getSourceRemainingSiblingRect(t){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=cf(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=t.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(t){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=t.find(a=>{var c;return a.id===((c=this.active)==null?void 0:c.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=cf(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=t.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var v,$,E;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((v=this.active)==null?void 0:v.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=DD;for(const I of o){const Z=I.rect;if(!In(t,r,Z))continue;const P=this.resolveTopLevelTargetForCard(t,r,I,I.logicalIndex,c);if(P)return P;if(!c&&(($=this.active)!=null&&$.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((E=this.active)==null?void 0:E.sourceIndex)??0};const d=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,t)),p=this.resolveTopLevelTargetForCard(d,r,u,u.logicalIndex,c);if(p)return p;const y=u.rect.left+u.rect.width/2;return{type:"reorder",index:t<y?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(t,r,i,s){var u,d;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return((u=this.active)==null?void 0:u.sourceIndex)??0;for(const p of o){if(!In(t,r,p.rect))continue;const y=Ql(p.rect,Xl["reorder-before"]);if(In(t,r,y))return p.logicalIndex;const v=Ql(p.rect,Xl["reorder-after"]);if(In(t,r,v))return p.logicalIndex+1}const a=this.getNearestTargetableZone(t,o);if(!a)return((d=this.active)==null?void 0:d.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return t<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(t,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of t){const c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:c.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(t,r,i,s,o){const a=i.rect;for(const c of CD){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Xl[c],d=Ql(a,u);if(In(t,r,d))return c==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:c==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:c==="reorder-before"?{type:"reorder",index:s}:{type:"reorder",index:s+1}}return null}getNearestTargetableZone(t,r){let i=null,s=Number.POSITIVE_INFINITY;for(const o of r){const a=o.rect.left,c=o.rect.left+o.rect.width,u=t<a?a-t:t>c?t-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(t,r,i){return t>=i.left&&t<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const uf=60,XD=80,hf=.5,df=10;class QD{constructor(){b(this,"awaitingFreshWheelGesture",!1);b(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);b(this,"lastWheelDeltaX",0);b(this,"activeGestureType","none");b(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(e){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=e,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(e){const{now:t,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=e;t-this.lastWheelGestureAt>=uf&&(this.activeGestureType="none");const c=r&&s!==0,u=c?s:i,d=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?d>=hf&&d>=p*df?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=d*df?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):d<hf?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):c||d>p?this.classifyHorizontal(t,u):p>d?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u)}classifyHorizontal(e,t){const r=e-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(t),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(t)>=Math.abs(this.lastWheelDeltaX)+XD;return this.awaitingFreshWheelGesture&&r<uf&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=e,this.lastWheelDeltaX=t,this.lastWheelGestureAt=e,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:t})}}const eO=2,pf=1e3,Do=1e-4;function tO(n){return n.replace(/["\\]/g,"\\$&")}function ff(n,e,t){if(n===0)return 0;const r=e.toPixels(Te({y:Qe})).y??0;return(t-r)/eO}function tc(n){const e=n.clientWidth>0?n.clientWidth:hr,t=n.clientHeight>0?n.clientHeight:ca;let r=0,i=0;if(n.isConnected){const o=getComputedStyle(n);r=parseFloat(o.paddingTop)||0,i=parseFloat(o.paddingBottom)||0}const s=Math.max(1,t-r-i);return{width:e,height:s,offsetY:r}}class nO extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class xy extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class rO extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new TD(Te({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new QD);b(this,"dragController",new JD);b(this,"dragState",null);b(this,"activeDragPointerId",null);b(this,"dragListenersAttached",!1);b(this,"dragFrame",0);b(this,"lastDragFrameTime",0);b(this,"lastPointerX",0);b(this,"lastPointerY",0);b(this,"pointerVelocityPxPerSec",0);b(this,"scrollVelocityPxPerSec",0);b(this,"motionSampleTime",0);b(this,"motionSampleX",0);b(this,"motionSampleY",0);b(this,"dragTrackOffsetXPx",0);b(this,"previousProjectedLayoutForOffset",null);b(this,"renderContent",()=>N``);b(this,"onDragControllerChange",()=>{this.dragController.status==="idle"&&(this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null),this.scheduleRender()});b(this,"onDragControllerDrag",t=>{const r=lf(t.projectedLayout),i=this.shouldApplyTrackOffset(t.projectedLayout,t.source.parentId),s=t.source.parentId?this.getStackChildAnchorCardId(t.source.parentId,t.nodeId):null;this.dragTrackOffsetXPx=i?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,r,t.nodeId,t.source.parentId,s,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=r,this.dragState={nodeId:t.nodeId,source:t.source,grabOffset:t.grabOffset,pointer:t.pointer,size:t.size,projectedLayout:t.projectedLayout},this.scheduleRender()});b(this,"onDragControllerDrop",t=>{this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.commitLayout(t.layout)});b(this,"onLayoutScrollInternal",t=>{const i=t.scroll.x??0;Math.abs(i-this._scrollPosition)<Do||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});b(this,"handleKeyDown",t=>{if(t.key==="Escape"&&this.dragController.status!=="idle"){t.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(t.key==="ArrowRight"?(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):t.key==="ArrowLeft"&&(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});b(this,"handleWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(t.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});b(this,"handleWindowMessage",t=>{var o;if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(!r||!this.isTrustedArtifactFrameMessage(t,r)||!gC(t.data))return;const i=this.wheelGesture.decide({now:Date.now(),shiftKey:t.data.shiftKey,deltaX:t.data.deltaX,deltaY:t.data.deltaY,overArtifactContent:!0});if(i.type==="scroll-horizontal"){this.applyHorizontalWheel(i.horizontalDelta);return}if(i.type!=="scroll-native")return;const s={type:"scroll",deltaX:0,deltaY:t.data.deltaY};(o=r.contentWindow)==null||o.postMessage(s,this.getArtifactFrameTargetOrigin(r))});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle")return;const r=t.target;if(!(r instanceof Element)||!r.closest("[drag-handle]")||r.closest("button, input, textarea, select, a, [role='button']"))return;const i=r.closest(".card-slot");if(!i)return;const s=i.getAttribute("data-layout-node-id");if(!s)return;const o=sO(this._layout,s);if(!o)return;const a=i.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:s,source:{index:o.topLevelIndex,parentId:o.sourceStackId},pointer:ke({x:t.clientX,y:t.clientY}),grabOffset:ke({x:t.clientX-a.left,y:t.clientY-a.top}),size:ke({x:a.width,y:a.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleWindowPointerMove",t=>{this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.updatePointerVelocity(t.clientX,t.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});b(this,"handleWindowPointerUp",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowPointerCancel",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"runDragFrame",t=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,t-this.lastDragFrameTime)/pf;this.lastDragFrameTime=t,this.samplePointerVelocityAt(t,this.lastPointerX,this.lastPointerY);const i=this.getBoundingClientRect(),s=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,i),o=this.getDragEdgeScrollDeltaPixels(s.x,i,r);this.scrollVelocityPxPerSec=r>Do?Math.abs(o)/r:0,Math.abs(o)>Do&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(ke({x:o}))),this.dragController.status==="active"&&this.syncDragTarget(s.x,s.y,i),this.dragFrame=requestAnimationFrame(this.runDragFrame)});this.dragController.addEventListener("change",this.onDragControllerChange),this.dragController.addEventListener("drag",this.onDragControllerDrag),this.dragController.addEventListener("drop",this.onDragControllerDrop),this.layoutScroll.addEventListener("layout-scroll",this.onLayoutScrollInternal)}set layout(t){this._layout=[...t],this.stopDragFrameLoop(),this.dragController.cancel(),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Te({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(t){this.layout=t,this.emitLayoutChanged()}set scrollPosition(t){Math.abs(t-this._scrollPosition)<Do||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=Nr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===t));if(i<0)return;let s=0;for(let o=0;o<i;o+=1)s+=r.nodes[o].width;this.scrollPosition=s,queueMicrotask(()=>{const o=this.querySelector(`.card-slot[data-layout-card-id="${tO(t)}"]`);if(!o)return;o.classList.remove("card-focus-pulse"),o.offsetHeight,o.classList.add("card-focus-pulse");const a=()=>{o.classList.remove("card-focus-pulse"),o.removeEventListener("animationend",a)};o.addEventListener("animationend",a)})}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.focus(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("wheel",this.handleWheel,{passive:!1}),this.addEventListener("pointerdown",this.handlePointerDown),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var t;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),window.removeEventListener("message",this.handleWindowMessage),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=null,this.wheelGesture.reset(),this.detachDragListeners(),this.dragController.removeEventListener("change",this.onDragControllerChange),this.dragController.removeEventListener("drag",this.onDragControllerDrag),this.dragController.removeEventListener("drop",this.onDragControllerDrop),this.layoutScroll.removeEventListener("layout-scroll",this.onLayoutScrollInternal),this.dragController.dispose(),this.stopDragFrameLoop()}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(t,r){return new vD({basis:ke({x:zn,y:zn}),min:ke({x:gp,y:gp}),viewport:ke({x:t,y:r}),gap:ke({x:ge,y:ge})})}syncScrollModel(){const t=tc(this),i=Nr(this._layout).nodes.map(o=>o.width),s=`${t.width}x${t.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(t.width,t.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>Te({x:o}))}))}emitScrollPositionChanged(t){this.dispatchEvent(new nO(t))}emitLayoutChanged(){this.dispatchEvent(new xy([...this._layout]))}shiftWindow(t){this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(t)}applyHorizontalWheel(t){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(ke({x:t}));this.layoutScroll.wheel(Te({x:i.x??0}))}findManagedArtifactFrame(t){if(!t)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===t)return i;return null}isTrustedArtifactFrameMessage(t,r){if(t.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||t.origin===i}getArtifactFrameTargetOrigin(t){const r=t.getAttribute("sandbox")??"";return new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin")?this.getArtifactFrameOrigin(t)??"*":"*"}getArtifactFrameOrigin(t){const r=t.getAttribute("src")??t.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}attachDragListeners(){this.dragListenersAttached||(window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerCancel),this.addEventListener("pointermove",this.handleWindowPointerMove),this.addEventListener("pointerup",this.handleWindowPointerUp),this.addEventListener("pointercancel",this.handleWindowPointerCancel),window.addEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!0)}detachDragListeners(){this.dragListenersAttached&&(window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerCancel),this.removeEventListener("pointermove",this.handleWindowPointerMove),this.removeEventListener("pointerup",this.handleWindowPointerUp),this.removeEventListener("pointercancel",this.handleWindowPointerCancel),window.removeEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!1,this.activeDragPointerId=null)}getDisplayModel(){if(this.dragController.status!=="active"||!this.dragState)return{layout:this._layout,activePlaceholderId:null,placeholdersById:new Map};const t=new Map;return t.set(this.dragState.nodeId,{id:this.dragState.nodeId,sourceCardId:this.dragState.nodeId}),{layout:lf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}render(){const t=tc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=Nr(s),c=a.nodes.map(O=>O.width),u=`${t.width}x${t.height}:${c.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:c.map(O=>Te({x:O}))}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const d=iO(s),p=r.unit.x??zn,y=r.unit.y??zn,v=o?this.dragTrackOffsetXPx:0,$=(this.layoutScroll.translate.x??0)+v,E=ff(a.nodes.length,r,t.height),I=this.animateNextRender&&!o,Z=[`transform: translate(${$}px, ${E}px);`,`transition-duration: ${I?tx:0}ms;`,`pointer-events: ${o?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${p}px`),this.style.setProperty("--layout-unit-y",`${y}px`),this.style.setProperty("--layout-gap",`${ge}px`);const P=this.dragState,V={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0};Re(N`
|
|
161
|
+
`}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Re(this.template(),this))}}customElements.define("artifact-view",vD);const ke=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Ro=2,yD=2;class bD{constructor(e){b(this,"basis");b(this,"min");b(this,"_gap");b(this,"_viewport");b(this,"_unit");this.basis=e.basis,this.min=e.min,this._viewport=e.viewport,this._gap=e.gap??ke({x:ge,y:ge});const t=this._viewport.x??hr,r=this._viewport.y??ca,i=this._gap.x??ge,s=this._gap.y??ge,o=hr+i*yD,a=t<=o,c=a?t-i*Ro:Math.min(hr,t-i*Ro),u=a?r-s*Ro:Math.min(ca,r-s*Ro),d=(c-i*(Rt-1))/Rt,p=(u-s*(Qe-1))/Qe,y=this.basis.x??0,v=this.basis.y??0,$=this.min.x??0,E=this.min.y??0;this._unit=ke(a?{x:Math.max($,d),y:Math.max(E,p)}:{x:Math.max($,Math.min(y,d)),y:Math.max(E,Math.min(v,p))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return Te({x:e.x==null?void 0:e.x/(this._unit.x??1),y:e.y==null?void 0:e.y/(this._unit.y??1)})}toPixels(e){const t=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??ge,s=this._gap.y??ge,o=e.x==null?void 0:e.x*t+Math.max(0,e.x-1)*i,a=e.y==null?void 0:e.y*r+Math.max(0,e.y-1)*s;return ke({x:o,y:a})}}const fr=1e-4,Yt=1e-6,wD=40,SD=24;function _y(n,e){return Math.max(0,n-e*2)}function ky(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function Ey(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+ge)}return e}function xy(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s<n.length;s+=1){const o=n[s],a=i===0?o:r+ge+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function _D(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s>=0;s-=1){const o=n[s],a=i===0?o:r+ge+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function kD(n,e){if(n.length===0)return 0;let t=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:t+ge+s;if(o>e+fr)break;t=o,r+=1}return Math.max(1,r)}function oh(n,e){if(n.length===0)return 0;const t=kD(n,e);return Math.max(0,n.length-t)}function af(n,e,t){if(n.length===0)return 0;const r=xy(n,e,t),i=Math.min(n.length,e+r);if(i<=e)return 0;const s=n.slice(e,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*ge}function Xc(n,e,t){const r=n[e]??0;return t-r}function Lr(n,e,t,r,i){if(n.length===0)return 0;const s=oh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let c=0;for(let H=0;H<s;H+=1){const U=e[H]??0,ce=e[H+1]??U;if(a>=U&&a<=ce+fr){c=H;break}c=H+1}const u=Math.min(c+1,s),d=e[c]??0,p=e[u]??d,y=Math.max(p-d,fr),v=u===c?0:(a-d)/y,$=Ey(n),E=af(n,c,i),I=af(n,u,i),Z=(r-E)/2,P=(r-I)/2,V=Xc($,c,Z),O=Xc($,u,P);return V+(O-V)*v}function lf(n,e,t,r,i){const s=oh(n,r),o=e[s]??0;let a=0,c=o;for(let u=0;u<wD;u+=1){const d=(a+c)/2;Lr(n,e,d,t,r)>i?a=d:c=d}return(a+c)/2}function cf(n,e,t){const r=Ey(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,d)=>u+d,0)+Math.max(0,o.length-1)*ge,c=(t-a)/2;return Xc(r,i,c)}function ED(n,e,t){const r=xy(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function xD(n,e,t){const r=_D(n,e,t);return[Math.max(0,e-r+1),e]}function AD(n){const e=new Set,t=[];for(const r of n){const i=`${r.nodeRange[0]}:${r.nodeRange[1]}`;if(e.has(i))continue;const s=t[t.length-1];s&&Math.abs(s.anchor-r.anchor)<=Yt||(e.add(i),t.push(r))}return t}function $D(n){const{nodeCols:e,nodeWidthsPx:t,viewportWidthPx:r}=n;if(e.length===0||t.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=n.gapPx??ge,s=_y(r,i),o=ky(e),a=oh(t,s),c=o[a]??0,u=[];for(let d=0;d<=a;d+=1){const p=ED(t,d,s),y=cf(t,p,r),v=lf(t,o,r,s,y);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,v))})}for(let d=t.length-1;d>=0;d-=1){const p=xD(t,d,s),y=`${p[0]}:${p[1]}`;if(u.some(E=>`${E.nodeRange[0]}:${E.nodeRange[1]}`===y))continue;const v=cf(t,p,r),$=lf(t,o,r,s,v);u.push({nodeRange:p,anchor:Math.max(0,Math.min(c,$))})}return u.sort((d,p)=>Math.abs(d.anchor-p.anchor)>Yt?d.anchor-p.anchor:d.nodeRange[0]!==p.nodeRange[0]?d.nodeRange[0]-p.nodeRange[0]:d.nodeRange[1]-p.nodeRange[1]),{viewspans:AD(u),minScroll:0,maxScroll:c}}function TD(n,e){var i;let t=0,r=Number.POSITIVE_INFINITY;for(let s=0;s<n.length;s+=1){const o=Math.abs((((i=n[s])==null?void 0:i.anchor)??0)-e);if(o+Yt<r){r=o,t=s;continue}Math.abs(o-r)<=Yt&&s<t&&(t=s)}return t}function CD(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function zi(n,e,t){return Math.max(e,Math.min(t,n))}class ID extends vt{constructor(t){super();b(this,"_scroll",0);b(this,"minScroll",0);b(this,"maxScroll",0);b(this,"viewspans",[]);b(this,"activeViewspanIndex",null);b(this,"nodeWidthsPx",[]);b(this,"boundaryCols",[0]);b(this,"viewportWidthPx",0);b(this,"framedViewportWidthPx",0);this._scroll=(t==null?void 0:t.x)??0}get scroll(){return Te({x:this._scroll})}get translate(){return ke({x:Lr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx)})}set scroll(t){const r=zi(t.x??this._scroll,this.minScroll,this.maxScroll);Math.abs(r-this._scroll)<=Yt||(this._scroll=r,this.activeViewspanIndex=null,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}rebuild(t){const r=t.nodeWidths.map(u=>Math.max(0,u.x??0)),i=r.map(u=>t.grid.toPixels(Te({x:u})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??ge,a=$D({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this.nodeWidthsPx=i,this.boundaryCols=ky(r),this.viewportWidthPx=s,this.framedViewportWidthPx=_y(s,o),this.viewspans=a.viewspans,this.minScroll=a.minScroll,this.maxScroll=a.maxScroll,this.activeViewspanIndex=null;const c=zi(this._scroll,this.minScroll,this.maxScroll);Math.abs(c-this._scroll)>Yt&&(this._scroll=c,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}step(t){var a;if(this.viewspans.length===0)return;const r=this.activeViewspanIndex??TD(this.viewspans,this._scroll),i=CD(r,t,this.viewspans.length),s=((a=this.viewspans[i])==null?void 0:a.anchor)??this._scroll,o=zi(s,this.minScroll,this.maxScroll);this.activeViewspanIndex=i,!(Math.abs(o-this._scroll)<=Yt)&&(this._scroll=o,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=zi(this._scroll+(t.x??0),this.minScroll,this.maxScroll);this.activeViewspanIndex=null,!(Math.abs(r-this._scroll)<=Yt)&&(this._scroll=r,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=fr)return;this.activeViewspanIndex=null;const i=Lr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx),s=i-r,o=Lr(this.nodeWidthsPx,this.boundaryCols,this.maxScroll,this.viewportWidthPx,this.framedViewportWidthPx),a=Lr(this.nodeWidthsPx,this.boundaryCols,this.minScroll,this.viewportWidthPx,this.framedViewportWidthPx),c=Math.max(o,Math.min(a,s));if(Math.abs(c-i)<=fr)return;let u=this.minScroll,d=this.maxScroll;for(let y=0;y<SD;y+=1){const v=(u+d)/2;Lr(this.nodeWidthsPx,this.boundaryCols,v,this.viewportWidthPx,this.framedViewportWidthPx)>c?u=v:d=v}const p=zi((u+d)/2,this.minScroll,this.maxScroll);Math.abs(p-this._scroll)<=Yt||(this._scroll=p,this.dispatchEvent(new Di("layout-scroll",{scroll:this.scroll})))}}const Ql={"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}},PD=["stack-above","stack-below","reorder-before","reorder-after"];function ec(n,e){return{left:n.left+n.width*e.left,top:n.top+n.height*e.top,width:n.width*e.width,height:n.height*e.height}}function In(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function ah(n,e){for(const t of n){if(t.type==="card"&&t.id===e)return t;if(t.type==="stack")for(const r of t.children){if(r.type==="card"&&r.id===e)return r;if(r.type==="row"){for(const i of r.children)if(i.id===e)return i}}}return null}function Qc(n){return n.height===Qe||n.height===gn?{...n,height:gn}:n}function eu(n){return n.height===gn?{...n,height:Qe}:n}function RD(n,e,t,r){const i=n.findIndex(d=>d.type==="stack"&&d.id===e);if(i===-1)return n;const s=n[i];if(!s||s.type!=="stack")return n;const o=s.children.find(d=>d.type==="card"&&d.id===t);if(!o||o.type!=="card")return n;const a=s.children.filter(d=>d.id!==t);if(a.length===s.children.length||a.length<1)return n;const c=[...n];if(a.length===1){const[d]=a;c[i]=d.type==="card"?eu(d):d}else c[i]={...s,children:a};const u=Math.max(0,Math.min(r,c.length));return c.splice(u,0,eu(o)),c}const DD=mt(),OD=mt(),zD=50;function LD(n,e){if(n.type!==e.type)return!1;switch(n.type){case"reorder":return e.index===n.index;case"stack":return e.targetCardId===n.targetCardId&&e.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return e.toIndex===n.toIndex;case"stack-child-reorder":return e.position===n.position;default:return!1}}function ao(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function uf(n){return n.map(ND)}function MD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function ND(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(MD)}:n}function Ay(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function hf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function UD(n,e){const t=[...e],r=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=t[r];if(!i||i.type!=="card")return null;t.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,t.length));t.splice(s,0,i);const o=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:t,visualDraggedIndex:o}}function FD(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(y=>y.type==="card"&&y.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Ay(r,e.nodeId);if(!a)return null;const c=Qc(a),u=Qc(o),d=ao(c),p=t.position==="above"?[d,u]:[u,d];return i[s]={id:o.id,type:"stack",children:p},i}function tc(n,e){return n.parentStackId?HD(n,e):ZD(n,e)}function ZD(n,e){const t=n.hitTarget;if(t.type==="reorder"){const r=e[n.sourceIndex];if(!r||r.type!=="card")return[...e];const i=[...e];return i.splice(n.sourceIndex,1),i.splice(t.index,0,ao(r)),i}if(t.type==="stack"){const r=UD(n,e);return r?FD(r,n,t,e)??[...e]:[...e]}return[...e]}function HD(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return BD(n,e,t.position);case"stack-child-extract":return jD(n,e,t.toIndex);case"stack-child-noop":return VD(n,e);default:return[...e]}}function BD(n,e,t){const r=e.findIndex(y=>y.type==="stack"&&y.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(y=>y.type==="card"))return[...e];const s=i.children,o=s.findIndex(y=>y.id===n.nodeId);if(o===-1)return[...e];const a=s[o],c=s.filter(y=>y.id!==n.nodeId),u=ao(a),d=t==="above"?[u,...c]:[...c,u],p=[...e];return p[r]={...i,children:d},p}function jD(n,e,t){if(!n.parentStackId)return[...e];const r=RD(e,n.parentStackId,n.nodeId,t);if(r===e)return[...e];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...e];const s=r[i];if(!s||s.type!=="card")return[...e];const o=[...r];return o[i]=ao(s),o}function VD(n,e){const t=e.findIndex(c=>c.type==="stack"&&c.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(c=>c.type==="card"&&c.id===n.nodeId);if(i===-1)return[...e];const s=r.children[i];if(!s||s.type!=="card")return[...e];const o=[...e],a=[...r.children];return a[i]=ao(s),o[t]={...r,children:a},o}function GD(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Zu()}function WD(n,e,t){if(n.type==="drop-target"){const r=ah(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return Qc(r)}return n}function qD(n,e,t){const r=n.children.map(s=>WD(s,e,t));return{id:GD(n,e),type:"stack",children:r}}function YD(n,e,t){if(n.type==="drop-target"){const r=ah(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return Ay(e,t)!==null?r:eu(r)}return n.type==="card"||n.type==="row"?n:qD(n,e,t)}function KD(n,e,t){return n.map(r=>YD(r,e,t))}function JD(n,e){return JSON.stringify(n)===JSON.stringify(e)}const XD=Si(vt);class QD extends XD{constructor(t={}){super();b(this,"pending",null);b(this,"active",null)}start(t){if(this.pending||this.active)return;const r=t.pointer.x??0,i=t.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:t.grabOffset.x??0,grabOffsetY:t.grabOffset.y??0,nodeId:t.nodeId,sourceIndex:t.source.index,parentStackId:t.source.parentId,width:t.size.x??0,height:t.size.y??0,baseLayout:t.layout}}update(t){const r=t.pointer.x??0,i=t.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,d=i-s.startY;Math.hypot(u,d)>=ix&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new J("change")));return}if(!this.active)return;const o=tc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),c=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&LD(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 J("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=tc(this.active,t),s=KD(i,t,this.active.nodeId);JD(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new OD("drop",{layout:r})),this.dispatchEvent(new J("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new J("change")))}dispose(){this.reset()}get status(){return this.active?"active":this.pending?"pending":"idle"}reset(){this.pending=null,this.active=null}emitDrag(){if(!this.active)return;const t=tc(this.active,this.active.baseLayout);this.dispatchEvent(new DD("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:ke({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:ke({x:this.active.pointerX,y:this.active.pointerY}),size:ke({x:this.active.width,y:this.active.height}),projectedLayout:t}))}getHitTargetForPointer(t,r,i,s){return this.active?this.isPointerInsideDragBounds(t,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(t,r,i,s):this.getTopLevelCardHitTarget(t,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(t,r,i,s){var u;if(!((u=this.active)!=null&&u.parentStackId))return{type:"stack-child-noop"};const o=this.getSourceStackInteractionRect(i.geometry);if(o&&In(t,r,o)){const d=o.top+o.height/2;return{type:"stack-child-reorder",position:r<d?"above":"below"}}const a=this.getSourceRemainingSiblingRect(i.geometry);if(a&&In(t,r,a)){const d=a.top+a.height/2;return{type:"stack-child-reorder",position:r<d?"above":"below"}}return{type:"stack-child-extract",toIndex:this.getTopLevelReorderIndexForPointer(t,r,i,s)}}getSourceRemainingSiblingRect(t){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=hf(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(i)return(o=t.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(t){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=t.find(a=>{var c;return a.id===((c=this.active)==null?void 0:c.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=hf(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var c;return a.type==="card"&&a.id!==((c=this.active)==null?void 0:c.nodeId)});if(s){const a=t.find(c=>c.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var v,$,E;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((v=this.active)==null?void 0:v.sourceIndex)??0};const c=(i.effectiveVelocity??0)<=zD;for(const I of o){const Z=I.rect;if(!In(t,r,Z))continue;const P=this.resolveTopLevelTargetForCard(t,r,I,I.logicalIndex,c);if(P)return P;if(!c&&(($=this.active)!=null&&$.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((E=this.active)==null?void 0:E.sourceIndex)??0};const d=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,t)),p=this.resolveTopLevelTargetForCard(d,r,u,u.logicalIndex,c);if(p)return p;const y=u.rect.left+u.rect.width/2;return{type:"reorder",index:t<y?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(t,r,i,s){var u,d;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return((u=this.active)==null?void 0:u.sourceIndex)??0;for(const p of o){if(!In(t,r,p.rect))continue;const y=ec(p.rect,Ql["reorder-before"]);if(In(t,r,y))return p.logicalIndex;const v=ec(p.rect,Ql["reorder-after"]);if(In(t,r,v))return p.logicalIndex+1}const a=this.getNearestTargetableZone(t,o);if(!a)return((d=this.active)==null?void 0:d.sourceIndex)??0;const c=a.rect.left+a.rect.width/2;return t<c?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(t,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of t){const c=i.get(a.id);c&&c.type!=="drop-target"&&(c.type==="card"||c.type==="stack")&&(s.push({id:c.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(t,r,i,s,o){const a=i.rect;for(const c of PD){if(!o&&(c==="stack-above"||c==="stack-below"))continue;const u=Ql[c],d=ec(a,u);if(In(t,r,d))return c==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:c==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:c==="reorder-before"?{type:"reorder",index:s}:{type:"reorder",index:s+1}}return null}getNearestTargetableZone(t,r){let i=null,s=Number.POSITIVE_INFINITY;for(const o of r){const a=o.rect.left,c=o.rect.left+o.rect.width,u=t<a?a-t:t>c?t-c:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(t,r,i){return t>=i.left&&t<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const df=60,eO=80,pf=.5,ff=10;class tO{constructor(){b(this,"awaitingFreshWheelGesture",!1);b(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);b(this,"lastWheelDeltaX",0);b(this,"activeGestureType","none");b(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(e){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=e,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(e){const{now:t,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=e;t-this.lastWheelGestureAt>=df&&(this.activeGestureType="none");const c=r&&s!==0,u=c?s:i,d=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?d>=pf&&d>=p*ff?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!c&&o&&p>0&&p>=d*ff?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):d<pf?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):c||d>p?this.classifyHorizontal(t,u):p>d?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u)}classifyHorizontal(e,t){const r=e-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(t),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(t)>=Math.abs(this.lastWheelDeltaX)+eO;return this.awaitingFreshWheelGesture&&r<df&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=e,this.lastWheelDeltaX=t,this.lastWheelGestureAt=e,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:t})}}const nO=2,gf=1e3,Do=1e-4;function rO(n){return n.replace(/["\\]/g,"\\$&")}function mf(n,e,t){if(n===0)return 0;const r=e.toPixels(Te({y:Qe})).y??0;return(t-r)/nO}function nc(n){const e=n.clientWidth>0?n.clientWidth:hr,t=n.clientHeight>0?n.clientHeight:ca;let r=0,i=0;if(n.isConnected){const o=getComputedStyle(n);r=parseFloat(o.paddingTop)||0,i=parseFloat(o.paddingBottom)||0}const s=Math.max(1,t-r-i);return{width:e,height:s,offsetY:r}}class iO extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class $y extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class sO extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new ID(Te({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new tO);b(this,"dragController",new QD);b(this,"dragState",null);b(this,"activeDragPointerId",null);b(this,"dragListenersAttached",!1);b(this,"dragFrame",0);b(this,"lastDragFrameTime",0);b(this,"lastPointerX",0);b(this,"lastPointerY",0);b(this,"pointerVelocityPxPerSec",0);b(this,"scrollVelocityPxPerSec",0);b(this,"motionSampleTime",0);b(this,"motionSampleX",0);b(this,"motionSampleY",0);b(this,"dragTrackOffsetXPx",0);b(this,"previousProjectedLayoutForOffset",null);b(this,"renderContent",()=>N``);b(this,"onDragControllerChange",()=>{this.dragController.status==="idle"&&(this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null),this.scheduleRender()});b(this,"onDragControllerDrag",t=>{const r=uf(t.projectedLayout),i=this.shouldApplyTrackOffset(t.projectedLayout,t.source.parentId),s=t.source.parentId?this.getStackChildAnchorCardId(t.source.parentId,t.nodeId):null;this.dragTrackOffsetXPx=i?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,r,t.nodeId,t.source.parentId,s,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=r,this.dragState={nodeId:t.nodeId,source:t.source,grabOffset:t.grabOffset,pointer:t.pointer,size:t.size,projectedLayout:t.projectedLayout},this.scheduleRender()});b(this,"onDragControllerDrop",t=>{this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.commitLayout(t.layout)});b(this,"onLayoutScrollInternal",t=>{const i=t.scroll.x??0;Math.abs(i-this._scrollPosition)<Do||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});b(this,"handleKeyDown",t=>{if(t.key==="Escape"&&this.dragController.status!=="idle"){t.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(t.key==="ArrowRight"?(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):t.key==="ArrowLeft"&&(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});b(this,"handleWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(t.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});b(this,"handleWindowMessage",t=>{var o;if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(!r||!this.isTrustedArtifactFrameMessage(t,r)||!vC(t.data))return;const i=this.wheelGesture.decide({now:Date.now(),shiftKey:t.data.shiftKey,deltaX:t.data.deltaX,deltaY:t.data.deltaY,overArtifactContent:!0});if(i.type==="scroll-horizontal"){this.applyHorizontalWheel(i.horizontalDelta);return}if(i.type!=="scroll-native")return;const s={type:"scroll",deltaX:0,deltaY:t.data.deltaY};(o=r.contentWindow)==null||o.postMessage(s,this.getArtifactFrameTargetOrigin(r))});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle")return;const r=t.target;if(!(r instanceof Element)||!r.closest("[drag-handle]")||r.closest("button, input, textarea, select, a, [role='button']"))return;const i=r.closest(".card-slot");if(!i)return;const s=i.getAttribute("data-layout-node-id");if(!s)return;const o=aO(this._layout,s);if(!o)return;const a=i.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:s,source:{index:o.topLevelIndex,parentId:o.sourceStackId},pointer:ke({x:t.clientX,y:t.clientY}),grabOffset:ke({x:t.clientX-a.left,y:t.clientY-a.top}),size:ke({x:a.width,y:a.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleWindowPointerMove",t=>{this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.updatePointerVelocity(t.clientX,t.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});b(this,"handleWindowPointerUp",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowPointerCancel",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"runDragFrame",t=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,t-this.lastDragFrameTime)/gf;this.lastDragFrameTime=t,this.samplePointerVelocityAt(t,this.lastPointerX,this.lastPointerY);const i=this.getBoundingClientRect(),s=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,i),o=this.getDragEdgeScrollDeltaPixels(s.x,i,r);this.scrollVelocityPxPerSec=r>Do?Math.abs(o)/r:0,Math.abs(o)>Do&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(ke({x:o}))),this.dragController.status==="active"&&this.syncDragTarget(s.x,s.y,i),this.dragFrame=requestAnimationFrame(this.runDragFrame)});this.dragController.addEventListener("change",this.onDragControllerChange),this.dragController.addEventListener("drag",this.onDragControllerDrag),this.dragController.addEventListener("drop",this.onDragControllerDrop),this.layoutScroll.addEventListener("layout-scroll",this.onLayoutScrollInternal)}set layout(t){this._layout=[...t],this.stopDragFrameLoop(),this.dragController.cancel(),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Te({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(t){this.layout=t,this.emitLayoutChanged()}set scrollPosition(t){Math.abs(t-this._scrollPosition)<Do||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=Nr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===t));if(i<0)return;let s=0;for(let o=0;o<i;o+=1)s+=r.nodes[o].width;this.scrollPosition=s,queueMicrotask(()=>{const o=this.querySelector(`.card-slot[data-layout-card-id="${rO(t)}"]`);if(!o)return;o.classList.remove("card-focus-pulse"),o.offsetHeight,o.classList.add("card-focus-pulse");const a=()=>{o.classList.remove("card-focus-pulse"),o.removeEventListener("animationend",a)};o.addEventListener("animationend",a)})}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.focus(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("wheel",this.handleWheel,{passive:!1}),this.addEventListener("pointerdown",this.handlePointerDown),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var t;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),window.removeEventListener("message",this.handleWindowMessage),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=null,this.wheelGesture.reset(),this.detachDragListeners(),this.dragController.removeEventListener("change",this.onDragControllerChange),this.dragController.removeEventListener("drag",this.onDragControllerDrag),this.dragController.removeEventListener("drop",this.onDragControllerDrop),this.layoutScroll.removeEventListener("layout-scroll",this.onLayoutScrollInternal),this.dragController.dispose(),this.stopDragFrameLoop()}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(t,r){return new bD({basis:ke({x:zn,y:zn}),min:ke({x:vp,y:vp}),viewport:ke({x:t,y:r}),gap:ke({x:ge,y:ge})})}syncScrollModel(){const t=nc(this),i=Nr(this._layout).nodes.map(o=>o.width),s=`${t.width}x${t.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(t.width,t.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>Te({x:o}))}))}emitScrollPositionChanged(t){this.dispatchEvent(new iO(t))}emitLayoutChanged(){this.dispatchEvent(new $y([...this._layout]))}shiftWindow(t){this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(t)}applyHorizontalWheel(t){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(ke({x:t}));this.layoutScroll.wheel(Te({x:i.x??0}))}findManagedArtifactFrame(t){if(!t)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===t)return i;return null}isTrustedArtifactFrameMessage(t,r){if(t.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||t.origin===i}getArtifactFrameTargetOrigin(t){const r=t.getAttribute("sandbox")??"";return new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin")?this.getArtifactFrameOrigin(t)??"*":"*"}getArtifactFrameOrigin(t){const r=t.getAttribute("src")??t.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}attachDragListeners(){this.dragListenersAttached||(window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerCancel),this.addEventListener("pointermove",this.handleWindowPointerMove),this.addEventListener("pointerup",this.handleWindowPointerUp),this.addEventListener("pointercancel",this.handleWindowPointerCancel),window.addEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!0)}detachDragListeners(){this.dragListenersAttached&&(window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerCancel),this.removeEventListener("pointermove",this.handleWindowPointerMove),this.removeEventListener("pointerup",this.handleWindowPointerUp),this.removeEventListener("pointercancel",this.handleWindowPointerCancel),window.removeEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!1,this.activeDragPointerId=null)}getDisplayModel(){if(this.dragController.status!=="active"||!this.dragState)return{layout:this._layout,activePlaceholderId:null,placeholdersById:new Map};const t=new Map;return t.set(this.dragState.nodeId,{id:this.dragState.nodeId,sourceCardId:this.dragState.nodeId}),{layout:uf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}render(){const t=nc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=Nr(s),c=a.nodes.map(O=>O.width),u=`${t.width}x${t.height}:${c.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:c.map(O=>Te({x:O}))}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const d=oO(s),p=r.unit.x??zn,y=r.unit.y??zn,v=o?this.dragTrackOffsetXPx:0,$=(this.layoutScroll.translate.x??0)+v,E=mf(a.nodes.length,r,t.height),I=this.animateNextRender&&!o,Z=[`transform: translate(${$}px, ${E}px);`,`transition-duration: ${I?rx:0}ms;`,`pointer-events: ${o?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${p}px`),this.style.setProperty("--layout-unit-y",`${y}px`),this.style.setProperty("--layout-gap",`${ge}px`);const P=this.dragState,V={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0};Re(N`
|
|
162
162
|
<div class="track" style=${Z}>
|
|
163
163
|
${a.nodes.map((O,H)=>N`
|
|
164
164
|
<div
|
|
@@ -201,7 +201,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
201
201
|
${this.renderDraggedPreview(P.nodeId)}
|
|
202
202
|
</div>
|
|
203
203
|
`})():null}
|
|
204
|
-
`,this)}ensureDragFrameLoop(){this.dragFrame!==0||this.dragController.status==="idle"||(this.lastDragFrameTime=performance.now(),this.dragFrame=requestAnimationFrame(this.runDragFrame))}stopDragFrameLoop(){this.dragFrame!==0&&(cancelAnimationFrame(this.dragFrame),this.dragFrame=0,this.scrollVelocityPxPerSec=0)}syncDragTargetForLatestPointer(){if(this.dragController.status==="idle")return;const t=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);this.syncDragTarget(i.x,i.y,t);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,t),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,t)}syncDragTarget(t,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getDisplayModel(),o=new Set(s.placeholdersById.keys()),a=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,c=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:ke({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:c,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(t,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=t,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(t,r){this.samplePointerVelocityAt(performance.now(),t,r)}samplePointerVelocityAt(t,r,i){if(this.motionSampleTime===0){this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=t-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*
|
|
204
|
+
`,this)}ensureDragFrameLoop(){this.dragFrame!==0||this.dragController.status==="idle"||(this.lastDragFrameTime=performance.now(),this.dragFrame=requestAnimationFrame(this.runDragFrame))}stopDragFrameLoop(){this.dragFrame!==0&&(cancelAnimationFrame(this.dragFrame),this.dragFrame=0,this.scrollVelocityPxPerSec=0)}syncDragTargetForLatestPointer(){if(this.dragController.status==="idle")return;const t=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);this.syncDragTarget(i.x,i.y,t);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,t),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,t)}syncDragTarget(t,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getDisplayModel(),o=new Set(s.placeholdersById.keys()),a=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,c=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:ke({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:c,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(t,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=t,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(t,r){this.samplePointerVelocityAt(performance.now(),t,r)}samplePointerVelocityAt(t,r,i){if(this.motionSampleTime===0){this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=t-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*gf,this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(t,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,t)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}isPointerOutsideViewport(t,r,i){return t<i.left||t>i.left+i.width||r<i.top||r>i.top+i.height}getDragEdgeScrollDeltaPixels(t,r,i){var u;const s=r.left+Ao,o=r.left+r.width-Ao,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??zn,c=sx*a;if(t<s){const d=Math.max(0,Math.min(1,(s-t)/Ao));return-(c*d**yp)*i}if(t>o){const d=Math.max(0,Math.min(1,(t-o)/Ao));return c*d**yp*i}return 0}measureLayoutGeometry(t,r,i=0){const s=this.layoutGrid;if(!s)return[];const o=Nr(t),a=new Map(o.nodes.map(E=>[E.id,E.width])),c=s.toPixels(Te({y:Qe})).y??ca,u=nc(this),d=(this.layoutScroll.translate.x??0)+i,p=mf(o.nodes.length,s,u.height),y=u.offsetY+p,v=[];let $=d;for(const E of t){const I=a.get(E.id)??Rt,Z=s.toPixels(Te({x:I})).x??hr,P={left:$,top:y,width:Z,height:c};v.push({id:E.id,rect:P}),$+=Z+ge}return v}getPlaceholderPixelSize(t,r,i,s){if(!r)return s;for(const o of t.nodes)for(const a of o.cards)if(a.id===r)return{width:i.toPixels(Te({x:a.width})).x??s.width,height:i.toPixels(Te({y:a.height})).y??s.height};return s}renderDraggedPreview(t){const r=ah(this._layout,t);return r?this.renderContent(r,{isDragging:!0}):N``}shouldApplyTrackOffset(t,r){if(r)return!0;for(const i of t){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(t,r,i,s,o,a){if(!t)return a;const c=s?o??this.getStableAnchorCardId(t,r,i):this.getStableAnchorNodeId(t,r,i);if(!c)return a;const u=s?yf(t,c,this.layoutGrid):bf(t,c,this.layoutGrid),d=s?yf(r,c,this.layoutGrid):bf(r,c,this.layoutGrid);return u===null||d===null?a:a+(u-d)}getStableAnchorCardId(t,r,i){const s=vf(t),o=new Set(vf(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(t,r,i){const s=new Set(r.map(o=>o.id));for(const o of t)if(o.id!==i&&s.has(o.id))return o.id;return null}getStackChildAnchorCardId(t,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===t);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&o.id!==r);return(s==null?void 0:s.id)??null}}function oO(n){const e=new Map;for(const t of n){if(t.type==="card"){e.set(t.id,t);continue}for(const r of t.children)if(r.type==="card")e.set(r.id,r);else for(const i of r.children)e.set(i.id,i)}return e}function aO(n,e){const t=n.findIndex(r=>r.type==="card"&&r.id===e);if(t!==-1)return{topLevelIndex:t};for(let r=0;r<n.length;r+=1){const i=n[r];if(!(!i||i.type!=="stack")&&i.children.some(s=>s.type==="card"&&s.id===e))return{topLevelIndex:r,sourceStackId:i.id}}return null}function vf(n){const e=[];for(const t of n){if(t.type==="card"){e.push(t.id);continue}if(t.type==="stack"){const r=t.children.find(i=>i.type==="card");r&&e.push(r.id)}}return e}function yf(n,e,t){if(!t)return null;const r=Nr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&o.id===e||o.type==="stack"&&o.children.some(u=>u.type==="card"&&u.id===e))return s;const a=i.get(o.id)??Rt,c=t.toPixels(Te({x:a})).x??hr;s+=c+ge}return null}function bf(n,e,t){if(!t)return null;const r=Nr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.id===e)return s;const a=i.get(o.id)??Rt,c=t.toPixels(Te({x:a})).x??hr;s+=c+ge}return null}customElements.get("layout-view")||customElements.define("layout-view",sO);class lO extends HTMLElement{constructor(){super(...arguments);b(this,"screenManager",qe.resolve("ScreenManager"));b(this,"boundModel",null);b(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});b(this,"handleModelChange",()=>{this.render()});b(this,"handleCloseArtifact",t=>{t instanceof Sy&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(t.artifactID)});b(this,"handleScrollPositionChanged",t=>{const r=t;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});b(this,"handleLayoutChanged",t=>{t instanceof $y&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(t.layout)});b(this,"handleServerEvent",t=>{const r=t.event;if(r.type!=="viewer-focus"||!this.boundModel||r.screenID!==this.boundModel.id)return;const i=this.querySelector("layout-view");i&&i.focusArtifact(r.artifactID)})}connectedCallback(){this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),this.unbindModel()}rebindModel(){const t=this.screenManager.activeScreen;this.boundModel!==t&&(this.unbindModel(),this.boundModel=t,t&&(t.addEventListener("change",this.handleModelChange),t.server.addEventListener("server-event",this.handleServerEvent)))}unbindModel(){this.boundModel&&(this.boundModel.removeEventListener("change",this.handleModelChange),this.boundModel.server.removeEventListener("server-event",this.handleServerEvent),this.boundModel=null)}buildArtifactMap(){const t=this.screenManager.activeScreen;return t?new Map(t.artifacts):new Map}render(){const t=this.screenManager.activeScreen,r=(t==null?void 0:t.layout)??[],i=this.buildArtifactMap();if(r.length===0){Re(N`<p data-testid="empty-screen" class="empty">
|
|
205
205
|
No artifacts yet. Create one by asking for something.
|
|
206
206
|
</p>`,this);return}Re(N`
|
|
207
207
|
<layout-view
|
|
@@ -218,7 +218,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
218
218
|
@layout-change=${this.handleLayoutChanged}
|
|
219
219
|
@close-artifact=${this.handleCloseArtifact}
|
|
220
220
|
></layout-view>
|
|
221
|
-
`,this)}}customElements.define("screen-view",
|
|
221
|
+
`,this)}}customElements.define("screen-view",lO);var Aa,ei,Ms,Jt,Ty,Cy,tu;class cO extends HTMLElement{constructor(){super(...arguments);w(this,Jt);w(this,Aa,qe.resolve("ScreenManager"));w(this,ei,qe.resolve("ServerManager"));w(this,Ms,()=>{g(this,Jt,tu).call(this)})}connectedCallback(){l(this,ei).addEventListener("change",l(this,Ms)),g(this,Jt,tu).call(this)}disconnectedCallback(){l(this,ei).removeEventListener("change",l(this,Ms))}}Aa=new WeakMap,ei=new WeakMap,Ms=new WeakMap,Jt=new WeakSet,Ty=function(t,r){l(this,Aa).setActive(t,r)},Cy=function(){for(const t of l(this,ei).servers.values())return t;return null},tu=function(){const t=g(this,Jt,Cy).call(this),i=(t?[...t.screens.values()]:[]).slice().sort((o,a)=>o.starred!==a.starred?o.starred?-1:1:o.name.localeCompare(a.name,void 0,{sensitivity:"base"})),s=i.length===0?N`<p class="empty">No screens yet. Hit + to create one.</p>`:N`
|
|
222
222
|
<ul class="tiles">
|
|
223
223
|
${i.map(o=>N`
|
|
224
224
|
<li>
|
|
@@ -226,27 +226,27 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
226
226
|
class="tile"
|
|
227
227
|
type="button"
|
|
228
228
|
material="glass"
|
|
229
|
-
@click=${()=>t&&g(this,Jt,
|
|
229
|
+
@click=${()=>t&&g(this,Jt,Ty).call(this,t.url,o.id)}
|
|
230
230
|
>
|
|
231
231
|
<span class="tile-name">${o.name}</span>
|
|
232
|
-
${o.starred?N`<span class="tile-star" aria-hidden="true">${
|
|
232
|
+
${o.starred?N`<span class="tile-star" aria-hidden="true">${Fc({weight:"fill"})}</span>`:se}
|
|
233
233
|
</button>
|
|
234
234
|
</li>
|
|
235
235
|
`)}
|
|
236
236
|
</ul>
|
|
237
|
-
`;Re(s,this)};customElements.get("home-screen")||customElements.define("home-screen",
|
|
237
|
+
`;Re(s,this)};customElements.get("home-screen")||customElements.define("home-screen",cO);const rc=new WeakMap,wf=Object.prototype.hasOwnProperty,uO=(()=>{const n=new Set;let e=HTMLElement.prototype;for(;e;){for(const t of Object.getOwnPropertyNames(e))n.add(t);if(e===Node.prototype)break;e=Object.getPrototypeOf(e)}return n})();function hO(n,e){if(n===Boolean)return e!==null;if(e!==null)return n===Number?Number(e):e}var Ns,nu,sr,nt,It,ti,or,ni,Ie,Ki,Iy,Py,Ry,ea;const Nn=class Nn extends HTMLElement{constructor(){var i;super();w(this,Ie);w(this,sr,new Map);w(this,nt,new Map);w(this,It,new Map);w(this,ti,!1);w(this,or,!1);w(this,ni,!1);const t=g(i=Nn,Ns,nu).call(i,this.constructor),r=this;for(const s of t.properties)wf.call(r,s)&&(l(this,It).set(s,r[s]),delete r[s])}static get observedAttributes(){var t;return g(t=Nn,Ns,nu).call(t,this).observedAttributes}connected(){}disconnected(){}changed(t){}connectedCallback(){if(g(this,Ie,Ry).call(this),!l(this,or))for(const t of g(this,Ie,Ki).call(this).properties)l(this,nt).has(t)||l(this,nt).set(t,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),g(this,Ie,ea).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(t,r,i){if(r===i)return;const s=g(this,Ie,Ki).call(this).byAttr.get(t);s&&(l(this,It).has(s.property)||(this[s.property]=hO(s.type,i)))}};Ns=new WeakSet,nu=function(t){const r=rc.get(t);if(r)return r;const i=[...t.properties??[]],s=t.attributes??{},o=new Map,a=new Map;for(const u of i)if(uO.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,d]of Object.entries(s)){if(u.includes("-")&&d.property===void 0)throw new Error(`Attribute "${u}" must declare a "property" name because kebab-case cannot be a property.`);const p=d.property??u;if(!i.includes(p))throw new Error(`Attribute '${u}' references property '${p}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);const y={attribute:u,property:p,type:d.type};o.set(u,y),a.set(p,y)}for(const u of i){const d=Object.getOwnPropertyDescriptor(t.prototype,u);if((d==null?void 0:d.get)!==void 0||(d==null?void 0:d.set)!==void 0)throw new Error(`Observed property "${u}" cannot define a custom getter/setter. Use changed() for side effects instead.`);d===void 0&&Object.defineProperty(t.prototype,u,{configurable:!0,enumerable:!0,get(){return l(this,sr).get(u)},set(p){g(this,Ie,Iy).call(this,u,p)}})}const c={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return rc.set(t,c),c},sr=new WeakMap,nt=new WeakMap,It=new WeakMap,ti=new WeakMap,or=new WeakMap,ni=new WeakMap,Ie=new WeakSet,Ki=function(){return rc.get(this.constructor)},Iy=function(t,r){if(!l(this,ni)&&l(this,It).has(t))return;const i=l(this,sr).get(t);Object.is(i,r)||(l(this,nt).has(t)||l(this,nt).set(t,i),l(this,sr).set(t,r),l(this,It).delete(t),g(this,Ie,Py).call(this,t,r),this.isConnected&&g(this,Ie,ea).call(this))},Py=function(t,r){const i=g(this,Ie,Ki).call(this).byProp.get(t);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const c=this.hasAttribute(s);r&&!c?this.setAttribute(s,""):!r&&c&&this.removeAttribute(s);return}if(r==null){this.hasAttribute(s)&&this.removeAttribute(s);return}const a=String(r);this.getAttribute(s)!==a&&this.setAttribute(s,a)},Ry=function(){const t=this,r=g(this,Ie,Ki).call(this);for(const i of r.properties){if(!wf.call(t,i))continue;const s=t[i];delete t[i],!(l(this,It).has(i)||l(this,sr).has(i))&&(t[i]=s)}k(this,ni,!0);try{for(const[i,s]of l(this,It))t[i]=s;l(this,It).clear()}finally{k(this,ni,!1)}},ea=function(){l(this,ti)||!this.isConnected||l(this,or)&&l(this,nt).size===0||(k(this,ti,!0),queueMicrotask(()=>{if(k(this,ti,!1),!this.isConnected||l(this,or)&&l(this,nt).size===0)return;const t=new Map(l(this,nt));l(this,nt).clear(),k(this,or,!0);try{this.changed(t)}catch(r){console.error(r)}this.isConnected&&l(this,nt).size>0&&g(this,Ie,ea).call(this)}))},w(Nn,Ns),b(Nn,"properties"),b(Nn,"attributes");let cs=Nn;/**
|
|
238
238
|
* @license
|
|
239
239
|
* Copyright 2020 Google LLC
|
|
240
240
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
241
|
-
*/const
|
|
241
|
+
*/const dO=n=>n.strings===void 0;/**
|
|
242
242
|
* @license
|
|
243
243
|
* Copyright 2017 Google LLC
|
|
244
244
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
245
|
-
*/const rs=(n,e)=>{var r;const t=n._$AN;if(t===void 0)return!1;for(const i of t)(r=i._$AO)==null||r.call(i,e,!1),rs(i,e);return!0},va=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},
|
|
245
|
+
*/const rs=(n,e)=>{var r;const t=n._$AN;if(t===void 0)return!1;for(const i of t)(r=i._$AO)==null||r.call(i,e,!1),rs(i,e);return!0},va=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},Dy=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),gO(e)}};function pO(n){this._$AN!==void 0?(va(this),this._$AM=n,Dy(this)):this._$AM=n}function fO(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)rs(r[s],!1),va(r[s]);else r!=null&&(rs(r,!1),va(r));else rs(this,n)}const gO=n=>{n.type==Kv.CHILD&&(n._$AP??(n._$AP=fO),n._$AQ??(n._$AQ=pO))};class mO extends Jv{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Dy(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(rs(this,e),va(this))}setValue(e){if(dO(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
|
|
246
246
|
* @license
|
|
247
247
|
* Copyright 2020 Google LLC
|
|
248
248
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
249
|
-
*/const Oo=()=>new
|
|
249
|
+
*/const Oo=()=>new vO;class vO{}const ic=new WeakMap,zo=sh(class extends mO{render(n){return se}update(n,[e]){var r;const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),se}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=ic.get(e);t===void 0&&(t=new WeakMap,ic.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,e;return typeof this.G=="function"?(n=ic.get(this.ht??globalThis))==null?void 0:n.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Ve,dn,ri,ii,Us,ar,lr,ie,Pe,Oy,Fs,Zs,ru,iu,$a,Ta,Ca,Ia,Pa,Ra,Da,Oa,Hs,Bs,Ji,zy,pt;class yO extends cs{constructor(){super(...arguments);w(this,Pe);w(this,Ve,qe.resolve("ScreenManager"));w(this,dn,null);w(this,ri,new DisposableStack);w(this,ii,Oo());w(this,Us,Oo());w(this,ar,Oo());w(this,lr,Oo());w(this,ie,{kind:"none"});w(this,Fs,()=>{g(this,Pe,ru).call(this),l(this,pt).call(this)});w(this,Zs,()=>{l(this,pt).call(this)});w(this,$a,()=>{l(this,Ve).clearActive()});w(this,Ta,()=>{const t=l(this,Ve).activeScreen;t&&t.setStarred(!t.starred)});w(this,Ca,t=>{l(this,ie).kind!=="none"&&(t.stopImmediatePropagation(),g(this,Pe,Ji).call(this))});w(this,Ia,()=>{var r;const t=l(this,Ve).activeScreen;t&&((r=l(this,ii).value)==null||r.close(),k(this,ie,{kind:"rename",draft:t.name}),l(this,pt).call(this))});w(this,Pa,()=>{var t;l(this,Ve).activeScreen&&((t=l(this,ii).value)==null||t.close(),k(this,ie,{kind:"delete",error:null}),l(this,pt).call(this))});w(this,Ra,t=>{if(l(this,ie).kind!=="rename")return;const r=t.target;r instanceof HTMLInputElement&&k(this,ie,{kind:"rename",draft:r.value})});w(this,Da,t=>{if(t.preventDefault(),l(this,ie).kind!=="rename")return;const r=l(this,Ve).activeScreen;if(!r)return;const i=l(this,ie).draft.trim();i.length>0&&i!==r.name&&r.rename(i),g(this,Pe,Ji).call(this)});w(this,Oa,async()=>{if(l(this,ie).kind!=="delete")return;const t=l(this,Ve).activeScreen;if(t){k(this,ie,{kind:"delete",error:null});try{await t.remove(),l(this,Ve).clearActive(),g(this,Pe,Ji).call(this)}catch(r){k(this,ie,{kind:"delete",error:r instanceof Error?r.message:"Failed to delete screen."}),l(this,pt).call(this)}}});w(this,Hs,()=>{g(this,Pe,Ji).call(this)});w(this,Bs,()=>{l(this,ie).kind!=="none"&&(k(this,ie,{kind:"none"}),l(this,pt).call(this))});w(this,pt,()=>{const t=N`
|
|
250
250
|
<button
|
|
251
251
|
icon-only
|
|
252
252
|
variant="ghost"
|
|
@@ -255,11 +255,11 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
255
255
|
aria-label="Home"
|
|
256
256
|
@click=${l(this,$a)}
|
|
257
257
|
>
|
|
258
|
-
${
|
|
258
|
+
${J2({weight:"fill"})}
|
|
259
259
|
</button>
|
|
260
|
-
`;Re(N`${t}${g(this,Pe,
|
|
260
|
+
`;Re(N`${t}${g(this,Pe,zy).call(this)}`,this);const r=l(this,Us).value??null;l(this,ar).value&&(l(this,ar).value.anchor=r),l(this,lr).value&&(l(this,lr).value.anchor=r)})}connected(){l(this,Ve).addEventListener("active-screen-changed",l(this,Fs)),g(this,Pe,ru).call(this),l(this,pt).call(this),g(this,Pe,Oy).call(this),l(this,ri).defer(()=>{l(this,Ve).removeEventListener("active-screen-changed",l(this,Fs)),g(this,Pe,iu).call(this)})}disconnected(){l(this,ri).dispose(),k(this,ri,new DisposableStack)}}Ve=new WeakMap,dn=new WeakMap,ri=new WeakMap,ii=new WeakMap,Us=new WeakMap,ar=new WeakMap,lr=new WeakMap,ie=new WeakMap,Pe=new WeakSet,Oy=async function(){const t=await rh(this);this.setAttribute("tone",t)},Fs=new WeakMap,Zs=new WeakMap,ru=function(){var r;const t=l(this,Ve).activeScreen;l(this,dn)!==t&&(g(this,Pe,iu).call(this),k(this,dn,t),(r=l(this,dn))==null||r.addEventListener("change",l(this,Zs)))},iu=function(){var t;(t=l(this,dn))==null||t.removeEventListener("change",l(this,Zs)),k(this,dn,null)},$a=new WeakMap,Ta=new WeakMap,Ca=new WeakMap,Ia=new WeakMap,Pa=new WeakMap,Ra=new WeakMap,Da=new WeakMap,Oa=new WeakMap,Hs=new WeakMap,Bs=new WeakMap,Ji=function(){const t=l(this,ie).kind==="rename"?l(this,ar).value:l(this,ie).kind==="delete"?l(this,lr).value:null;t&&(t.open=!1),k(this,ie,{kind:"none"}),l(this,pt).call(this)},zy=function(){const t=l(this,Ve).activeScreen;if(!t)return null;const r=l(this,ie).kind==="rename"?l(this,ie).draft:"",i=l(this,ie).kind==="delete"?l(this,ie).error:null;return N`
|
|
261
261
|
<span class="separator" aria-hidden="true">
|
|
262
|
-
${
|
|
262
|
+
${q2()}
|
|
263
263
|
</span>
|
|
264
264
|
<dropdown-menu ${zo(l(this,ii))}>
|
|
265
265
|
<button
|
|
@@ -275,10 +275,10 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
275
275
|
</button>
|
|
276
276
|
<dropdown-group>
|
|
277
277
|
<dropdown-item action @click=${l(this,Ia)}>
|
|
278
|
-
${
|
|
278
|
+
${X2()} Rename
|
|
279
279
|
</dropdown-item>
|
|
280
280
|
<dropdown-item action danger @click=${l(this,Pa)}>
|
|
281
|
-
${
|
|
281
|
+
${Q2()} Delete
|
|
282
282
|
</dropdown-item>
|
|
283
283
|
</dropdown-group>
|
|
284
284
|
</dropdown-menu>
|
|
@@ -333,9 +333,9 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
333
333
|
?data-starred=${t.starred}
|
|
334
334
|
@click=${l(this,Ta)}
|
|
335
335
|
>
|
|
336
|
-
${t.starred?
|
|
336
|
+
${t.starred?Fc({weight:"fill"}):Fc()}
|
|
337
337
|
</button>
|
|
338
|
-
`},pt=new WeakMap;customElements.define("screen-breadcrumb",
|
|
338
|
+
`},pt=new WeakMap;customElements.define("screen-breadcrumb",yO);var za,La,si,wn,Ly,My,Ma,Ny;class bO extends HTMLElement{constructor(){super(...arguments);w(this,wn);w(this,za,qe.resolve("ServerManager"));w(this,La,qe.resolve("ScreenManager"));w(this,si,!1);w(this,Ma,async()=>{if(l(this,si))return;const t=g(this,wn,My).call(this);if(t){k(this,si,!0);try{const r=await t.createScreen(wO(new Date));l(this,La).setActive(t.url,r.id)}catch{}finally{k(this,si,!1)}}})}connectedCallback(){g(this,wn,Ny).call(this),g(this,wn,Ly).call(this)}}za=new WeakMap,La=new WeakMap,si=new WeakMap,wn=new WeakSet,Ly=async function(){const t=await rh(this);this.setAttribute("tone",t)},My=function(){for(const t of l(this,za).servers.values())return t;return null},Ma=new WeakMap,Ny=function(){Re(N`
|
|
339
339
|
<button
|
|
340
340
|
icon-only
|
|
341
341
|
variant="ghost"
|
|
@@ -344,14 +344,14 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
|
|
|
344
344
|
aria-label="New screen"
|
|
345
345
|
@click=${l(this,Ma)}
|
|
346
346
|
>
|
|
347
|
-
${
|
|
347
|
+
${K2({size:16,weight:"bold"})}
|
|
348
348
|
</button>
|
|
349
|
-
`,this)};function yO(n){const e=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),t=12,r=n.getHours(),i=r%t===0?t:r%t,s=n.getMinutes().toString().padStart(2,"0"),o=r>=t?"pm":"am";return`${e} at ${i}:${s}${o}`}customElements.define("screen-create-button",vO);function bO(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{const o=n.getActiveClient();o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(a=>{console.error("ACPClient.connect() failed",a)})),r())};n.addEventListener("change",i),i();const s=()=>{n.removeEventListener("change",i),t==null||t.removeEventListener("change",r),t=null};return{dispose:s,[Symbol.dispose](){s()}}}/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:My,setPrototypeOf:bf,isFrozen:wO,getPrototypeOf:SO,getOwnPropertyDescriptor:_O}=Object;let{freeze:Ue,seal:st,create:ta}=Object,{apply:iu,construct:su}=typeof Reflect<"u"&&Reflect;Ue||(Ue=function(e){return e});st||(st=function(e){return e});iu||(iu=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});su||(su=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Lo=Fe(Array.prototype.forEach),kO=Fe(Array.prototype.lastIndexOf),wf=Fe(Array.prototype.pop),Li=Fe(Array.prototype.push),EO=Fe(Array.prototype.splice),na=Fe(String.prototype.toLowerCase),ic=Fe(String.prototype.toString),sc=Fe(String.prototype.match),Mi=Fe(String.prototype.replace),xO=Fe(String.prototype.indexOf),AO=Fe(String.prototype.trim),Ke=Fe(Object.prototype.hasOwnProperty),ze=Fe(RegExp.prototype.test),Ni=$O(TypeError);function Fe(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return iu(n,e,r)}}function $O(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return su(n,t)}}function j(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:na;bf&&bf(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(wO(e)||(e[r]=s),i=s)}n[i]=!0}return n}function TO(n){for(let e=0;e<n.length;e++)Ke(n,e)||(n[e]=null);return n}function kt(n){const e=ta(null);for(const[t,r]of My(n))Ke(n,t)&&(Array.isArray(r)?e[t]=TO(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=kt(r):e[t]=r);return e}function Ui(n,e){for(;n!==null;){const r=_O(n,e);if(r){if(r.get)return Fe(r.get);if(typeof r.value=="function")return Fe(r.value)}n=SO(n)}function t(){return null}return t}const Sf=Ue(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),oc=Ue(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ac=Ue(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),CO=Ue(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),lc=Ue(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),IO=Ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_f=Ue(["#text"]),kf=Ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cc=Ue(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ef=Ue(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Mo=Ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),PO=st(/\{\{[\w\W]*|[\w\W]*\}\}/gm),RO=st(/<%[\w\W]*|[\w\W]*%>/gm),DO=st(/\$\{[\w\W]*/gm),OO=st(/^data-[\-\w.\u00B7-\uFFFF]+$/),zO=st(/^aria-[\-\w]+$/),Ny=st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),LO=st(/^(?:\w+script|data):/i),MO=st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Uy=st(/^html$/i),NO=st(/^[a-z][.\w]*(-[.\w]+)+$/i);var xf=Object.freeze({__proto__:null,ARIA_ATTR:zO,ATTR_WHITESPACE:MO,CUSTOM_ELEMENT:NO,DATA_ATTR:OO,DOCTYPE_NAME:Uy,ERB_EXPR:RO,IS_ALLOWED_URI:Ny,IS_SCRIPT_OR_DATA:LO,MUSTACHE_EXPR:PO,TMPLIT_EXPR:DO});const Fi={element:1,text:3,progressingInstruction:7,comment:8,document:9},UO=function(){return typeof window>"u"?null:window},FO=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Af=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Fy(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UO();const e=M=>Fy(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Fi.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:d=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:y,trustedTypes:v}=n,$=c.prototype,E=Ui($,"cloneNode"),I=Ui($,"remove"),Z=Ui($,"nextSibling"),P=Ui($,"childNodes"),V=Ui($,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let O,H="";const{implementation:U,createNodeIterator:ce,createDocumentFragment:ue,getElementsByTagName:Ai}=t,{importNode:co}=r;let xe=Af();e.isSupported=typeof My=="function"&&typeof V=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:An,ERB_EXPR:yt,TMPLIT_EXPR:tn,DATA_ATTR:sl,ARIA_ATTR:uo,IS_SCRIPT_OR_DATA:rb,ATTR_WHITESPACE:yh,CUSTOM_ELEMENT:ib}=xf;let{IS_ALLOWED_URI:bh}=xf,Se=null;const wh=j({},[...Sf,...oc,...ac,...lc,..._f]);let Ae=null;const Sh=j({},[...kf,...cc,...Ef,...Mo]);let me=Object.seal(ta(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}})),$i=null,ho=null;const nn=Object.seal(ta(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _h=!0,ol=!0,kh=!1,Eh=!0,Sr=!1,po=!0,$n=!1,al=!1,ll=!1,_r=!1,fo=!1,go=!1,xh=!0,Ah=!1;const sb="user-content-";let cl=!0,Ti=!1,kr={},bt=null;const ul=j({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let $h=null;const Th=j({},["audio","video","img","source","image","track"]);let hl=null;const Ch=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),mo="http://www.w3.org/1998/Math/MathML",vo="http://www.w3.org/2000/svg",Ot="http://www.w3.org/1999/xhtml";let Er=Ot,dl=!1,pl=null;const ob=j({},[mo,vo,Ot],ic);let yo=j({},["mi","mo","mn","ms","mtext"]),bo=j({},["annotation-xml"]);const ab=j({},["title","style","font","a","script"]);let Ci=null;const lb=["application/xhtml+xml","text/html"],cb="text/html";let be=null,xr=null;const ub=t.createElement("form"),Ih=function(m){return m instanceof RegExp||m instanceof Function},fl=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xr&&xr===m)){if((!m||typeof m!="object")&&(m={}),m=kt(m),Ci=lb.indexOf(m.PARSER_MEDIA_TYPE)===-1?cb:m.PARSER_MEDIA_TYPE,be=Ci==="application/xhtml+xml"?ic:na,Se=Ke(m,"ALLOWED_TAGS")?j({},m.ALLOWED_TAGS,be):wh,Ae=Ke(m,"ALLOWED_ATTR")?j({},m.ALLOWED_ATTR,be):Sh,pl=Ke(m,"ALLOWED_NAMESPACES")?j({},m.ALLOWED_NAMESPACES,ic):ob,hl=Ke(m,"ADD_URI_SAFE_ATTR")?j(kt(Ch),m.ADD_URI_SAFE_ATTR,be):Ch,$h=Ke(m,"ADD_DATA_URI_TAGS")?j(kt(Th),m.ADD_DATA_URI_TAGS,be):Th,bt=Ke(m,"FORBID_CONTENTS")?j({},m.FORBID_CONTENTS,be):ul,$i=Ke(m,"FORBID_TAGS")?j({},m.FORBID_TAGS,be):kt({}),ho=Ke(m,"FORBID_ATTR")?j({},m.FORBID_ATTR,be):kt({}),kr=Ke(m,"USE_PROFILES")?m.USE_PROFILES:!1,_h=m.ALLOW_ARIA_ATTR!==!1,ol=m.ALLOW_DATA_ATTR!==!1,kh=m.ALLOW_UNKNOWN_PROTOCOLS||!1,Eh=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Sr=m.SAFE_FOR_TEMPLATES||!1,po=m.SAFE_FOR_XML!==!1,$n=m.WHOLE_DOCUMENT||!1,_r=m.RETURN_DOM||!1,fo=m.RETURN_DOM_FRAGMENT||!1,go=m.RETURN_TRUSTED_TYPE||!1,ll=m.FORCE_BODY||!1,xh=m.SANITIZE_DOM!==!1,Ah=m.SANITIZE_NAMED_PROPS||!1,cl=m.KEEP_CONTENT!==!1,Ti=m.IN_PLACE||!1,bh=m.ALLOWED_URI_REGEXP||Ny,Er=m.NAMESPACE||Ot,yo=m.MATHML_TEXT_INTEGRATION_POINTS||yo,bo=m.HTML_INTEGRATION_POINTS||bo,me=m.CUSTOM_ELEMENT_HANDLING||{},m.CUSTOM_ELEMENT_HANDLING&&Ih(m.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(me.tagNameCheck=m.CUSTOM_ELEMENT_HANDLING.tagNameCheck),m.CUSTOM_ELEMENT_HANDLING&&Ih(m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(me.attributeNameCheck=m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),m.CUSTOM_ELEMENT_HANDLING&&typeof m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Sr&&(ol=!1),fo&&(_r=!0),kr&&(Se=j({},_f),Ae=ta(null),kr.html===!0&&(j(Se,Sf),j(Ae,kf)),kr.svg===!0&&(j(Se,oc),j(Ae,cc),j(Ae,Mo)),kr.svgFilters===!0&&(j(Se,ac),j(Ae,cc),j(Ae,Mo)),kr.mathMl===!0&&(j(Se,lc),j(Ae,Ef),j(Ae,Mo))),Ke(m,"ADD_TAGS")||(nn.tagCheck=null),Ke(m,"ADD_ATTR")||(nn.attributeCheck=null),m.ADD_TAGS&&(typeof m.ADD_TAGS=="function"?nn.tagCheck=m.ADD_TAGS:(Se===wh&&(Se=kt(Se)),j(Se,m.ADD_TAGS,be))),m.ADD_ATTR&&(typeof m.ADD_ATTR=="function"?nn.attributeCheck=m.ADD_ATTR:(Ae===Sh&&(Ae=kt(Ae)),j(Ae,m.ADD_ATTR,be))),m.ADD_URI_SAFE_ATTR&&j(hl,m.ADD_URI_SAFE_ATTR,be),m.FORBID_CONTENTS&&(bt===ul&&(bt=kt(bt)),j(bt,m.FORBID_CONTENTS,be)),m.ADD_FORBID_CONTENTS&&(bt===ul&&(bt=kt(bt)),j(bt,m.ADD_FORBID_CONTENTS,be)),cl&&(Se["#text"]=!0),$n&&j(Se,["html","head","body"]),Se.table&&(j(Se,["tbody"]),delete $i.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');O=m.TRUSTED_TYPES_POLICY,H=O.createHTML("")}else O===void 0&&(O=FO(v,i)),O!==null&&typeof H=="string"&&(H=O.createHTML(""));Ue&&Ue(m),xr=m}},Ph=j({},[...oc,...ac,...CO]),Rh=j({},[...lc,...IO]),hb=function(m){let T=V(m);(!T||!T.tagName)&&(T={namespaceURI:Er,tagName:"template"});const R=na(m.tagName),oe=na(T.tagName);return pl[m.namespaceURI]?m.namespaceURI===vo?T.namespaceURI===Ot?R==="svg":T.namespaceURI===mo?R==="svg"&&(oe==="annotation-xml"||yo[oe]):!!Ph[R]:m.namespaceURI===mo?T.namespaceURI===Ot?R==="math":T.namespaceURI===vo?R==="math"&&bo[oe]:!!Rh[R]:m.namespaceURI===Ot?T.namespaceURI===vo&&!bo[oe]||T.namespaceURI===mo&&!yo[oe]?!1:!Rh[R]&&(ab[R]||!Ph[R]):!!(Ci==="application/xhtml+xml"&&pl[m.namespaceURI]):!1},wt=function(m){Li(e.removed,{element:m});try{V(m).removeChild(m)}catch{I(m)}},Tn=function(m,T){try{Li(e.removed,{attribute:T.getAttributeNode(m),from:T})}catch{Li(e.removed,{attribute:null,from:T})}if(T.removeAttribute(m),m==="is")if(_r||fo)try{wt(T)}catch{}else try{T.setAttribute(m,"")}catch{}},Dh=function(m){let T=null,R=null;if(ll)m="<remove></remove>"+m;else{const ve=sc(m,/^[\r\n\t ]+/);R=ve&&ve[0]}Ci==="application/xhtml+xml"&&Er===Ot&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");const oe=O?O.createHTML(m):m;if(Er===Ot)try{T=new y().parseFromString(oe,Ci)}catch{}if(!T||!T.documentElement){T=U.createDocument(Er,"template",null);try{T.documentElement.innerHTML=dl?H:oe}catch{}}const De=T.body||T.documentElement;return m&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Er===Ot?Ai.call(T,$n?"html":"body")[0]:$n?T.documentElement:De},Oh=function(m){return ce.call(m.ownerDocument||m,m,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},gl=function(m){return m instanceof p&&(typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||!(m.attributes instanceof d)||typeof m.removeAttribute!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function")},zh=function(m){return typeof a=="function"&&m instanceof a};function zt(M,m,T){Lo(M,R=>{R.call(e,m,T,xr)})}const Lh=function(m){let T=null;if(zt(xe.beforeSanitizeElements,m,null),gl(m))return wt(m),!0;const R=be(m.nodeName);if(zt(xe.uponSanitizeElement,m,{tagName:R,allowedTags:Se}),po&&m.hasChildNodes()&&!zh(m.firstElementChild)&&ze(/<[/\w!]/g,m.innerHTML)&&ze(/<[/\w!]/g,m.textContent)||m.nodeType===Fi.progressingInstruction||po&&m.nodeType===Fi.comment&&ze(/<[/\w]/g,m.data))return wt(m),!0;if(!(nn.tagCheck instanceof Function&&nn.tagCheck(R))&&(!Se[R]||$i[R])){if(!$i[R]&&Nh(R)&&(me.tagNameCheck instanceof RegExp&&ze(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R)))return!1;if(cl&&!bt[R]){const oe=V(m)||m.parentNode,De=P(m)||m.childNodes;if(De&&oe){const ve=De.length;for(let Ze=ve-1;Ze>=0;--Ze){const Lt=E(De[Ze],!0);Lt.__removalCount=(m.__removalCount||0)+1,oe.insertBefore(Lt,Z(m))}}}return wt(m),!0}return m instanceof c&&!hb(m)||(R==="noscript"||R==="noembed"||R==="noframes")&&ze(/<\/no(script|embed|frames)/i,m.innerHTML)?(wt(m),!0):(Sr&&m.nodeType===Fi.text&&(T=m.textContent,Lo([An,yt,tn],oe=>{T=Mi(T,oe," ")}),m.textContent!==T&&(Li(e.removed,{element:m.cloneNode()}),m.textContent=T)),zt(xe.afterSanitizeElements,m,null),!1)},Mh=function(m,T,R){if(ho[T]||xh&&(T==="id"||T==="name")&&(R in t||R in ub))return!1;if(!(ol&&!ho[T]&&ze(sl,T))){if(!(_h&&ze(uo,T))){if(!(nn.attributeCheck instanceof Function&&nn.attributeCheck(T,m))){if(!Ae[T]||ho[T]){if(!(Nh(m)&&(me.tagNameCheck instanceof RegExp&&ze(me.tagNameCheck,m)||me.tagNameCheck instanceof Function&&me.tagNameCheck(m))&&(me.attributeNameCheck instanceof RegExp&&ze(me.attributeNameCheck,T)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(T,m))||T==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&ze(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R))))return!1}else if(!hl[T]){if(!ze(bh,Mi(R,yh,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&m!=="script"&&xO(R,"data:")===0&&$h[m])){if(!(kh&&!ze(rb,Mi(R,yh,"")))){if(R)return!1}}}}}}}return!0},Nh=function(m){return m!=="annotation-xml"&&sc(m,ib)},Uh=function(m){zt(xe.beforeSanitizeAttributes,m,null);const{attributes:T}=m;if(!T||gl(m))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ae,forceKeepAttr:void 0};let oe=T.length;for(;oe--;){const De=T[oe],{name:ve,namespaceURI:Ze,value:Lt}=De,Ar=be(ve),ml=Lt;let $e=ve==="value"?ml:AO(ml);if(R.attrName=Ar,R.attrValue=$e,R.keepAttr=!0,R.forceKeepAttr=void 0,zt(xe.uponSanitizeAttribute,m,R),$e=R.attrValue,Ah&&(Ar==="id"||Ar==="name")&&(Tn(ve,m),$e=sb+$e),po&&ze(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){Tn(ve,m);continue}if(Ar==="attributename"&&sc($e,"href")){Tn(ve,m);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Tn(ve,m);continue}if(!Eh&&ze(/\/>/i,$e)){Tn(ve,m);continue}Sr&&Lo([An,yt,tn],Zh=>{$e=Mi($e,Zh," ")});const Fh=be(m.nodeName);if(!Mh(Fh,Ar,$e)){Tn(ve,m);continue}if(O&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ze)switch(v.getAttributeType(Fh,Ar)){case"TrustedHTML":{$e=O.createHTML($e);break}case"TrustedScriptURL":{$e=O.createScriptURL($e);break}}if($e!==ml)try{Ze?m.setAttributeNS(Ze,ve,$e):m.setAttribute(ve,$e),gl(m)?wt(m):wf(e.removed)}catch{Tn(ve,m)}}zt(xe.afterSanitizeAttributes,m,null)},db=function M(m){let T=null;const R=Oh(m);for(zt(xe.beforeSanitizeShadowDOM,m,null);T=R.nextNode();)zt(xe.uponSanitizeShadowNode,T,null),Lh(T),Uh(T),T.content instanceof s&&M(T.content);zt(xe.afterSanitizeShadowDOM,m,null)};return e.sanitize=function(M){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,R=null,oe=null,De=null;if(dl=!M,dl&&(M="<!-->"),typeof M!="string"&&!zh(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Ni("dirty is not a string, aborting")}else throw Ni("toString is not a function");if(!e.isSupported)return M;if(al||fl(m),e.removed=[],typeof M=="string"&&(Ti=!1),Ti){if(M.nodeName){const Lt=be(M.nodeName);if(!Se[Lt]||$i[Lt])throw Ni("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)T=Dh("<!---->"),R=T.ownerDocument.importNode(M,!0),R.nodeType===Fi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?T=R:T.appendChild(R);else{if(!_r&&!Sr&&!$n&&M.indexOf("<")===-1)return O&&go?O.createHTML(M):M;if(T=Dh(M),!T)return _r?null:go?H:""}T&&ll&&wt(T.firstChild);const ve=Oh(Ti?M:T);for(;oe=ve.nextNode();)Lh(oe),Uh(oe),oe.content instanceof s&&db(oe.content);if(Ti)return M;if(_r){if(fo)for(De=ue.call(T.ownerDocument);T.firstChild;)De.appendChild(T.firstChild);else De=T;return(Ae.shadowroot||Ae.shadowrootmode)&&(De=co.call(r,De,!0)),De}let Ze=$n?T.outerHTML:T.innerHTML;return $n&&Se["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&ze(Uy,T.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
|
|
350
|
-
`+Ze),Sr&&Lo([An,yt,tn],Lt=>{Ze=Mi(Ze,Lt," ")}),O&&go?O.createHTML(Ze):Ze},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fl(M),al=!0},e.clearConfig=function(){xr=null,al=!1},e.isValidAttribute=function(M,m,T){xr||fl({});const R=be(M),oe=be(m);return
|
|
351
|
-
]`).replace("lheading",
|
|
349
|
+
`,this)};function wO(n){const e=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),t=12,r=n.getHours(),i=r%t===0?t:r%t,s=n.getMinutes().toString().padStart(2,"0"),o=r>=t?"pm":"am";return`${e} at ${i}:${s}${o}`}customElements.define("screen-create-button",bO);function SO(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{const o=n.getActiveClient();o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(a=>{console.error("ACPClient.connect() failed",a)})),r())};n.addEventListener("change",i),i();const s=()=>{n.removeEventListener("change",i),t==null||t.removeEventListener("change",r),t=null};return{dispose:s,[Symbol.dispose](){s()}}}/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:Uy,setPrototypeOf:Sf,isFrozen:_O,getPrototypeOf:kO,getOwnPropertyDescriptor:EO}=Object;let{freeze:Ue,seal:st,create:ta}=Object,{apply:su,construct:ou}=typeof Reflect<"u"&&Reflect;Ue||(Ue=function(e){return e});st||(st=function(e){return e});su||(su=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});ou||(ou=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Lo=Fe(Array.prototype.forEach),xO=Fe(Array.prototype.lastIndexOf),_f=Fe(Array.prototype.pop),Li=Fe(Array.prototype.push),AO=Fe(Array.prototype.splice),na=Fe(String.prototype.toLowerCase),sc=Fe(String.prototype.toString),oc=Fe(String.prototype.match),Mi=Fe(String.prototype.replace),$O=Fe(String.prototype.indexOf),TO=Fe(String.prototype.trim),Ke=Fe(Object.prototype.hasOwnProperty),ze=Fe(RegExp.prototype.test),Ni=CO(TypeError);function Fe(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return su(n,e,r)}}function CO(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return ou(n,t)}}function j(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:na;Sf&&Sf(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(_O(e)||(e[r]=s),i=s)}n[i]=!0}return n}function IO(n){for(let e=0;e<n.length;e++)Ke(n,e)||(n[e]=null);return n}function kt(n){const e=ta(null);for(const[t,r]of Uy(n))Ke(n,t)&&(Array.isArray(r)?e[t]=IO(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=kt(r):e[t]=r);return e}function Ui(n,e){for(;n!==null;){const r=EO(n,e);if(r){if(r.get)return Fe(r.get);if(typeof r.value=="function")return Fe(r.value)}n=kO(n)}function t(){return null}return t}const kf=Ue(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ac=Ue(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),lc=Ue(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),PO=Ue(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cc=Ue(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),RO=Ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ef=Ue(["#text"]),xf=Ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),uc=Ue(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Af=Ue(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Mo=Ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),DO=st(/\{\{[\w\W]*|[\w\W]*\}\}/gm),OO=st(/<%[\w\W]*|[\w\W]*%>/gm),zO=st(/\$\{[\w\W]*/gm),LO=st(/^data-[\-\w.\u00B7-\uFFFF]+$/),MO=st(/^aria-[\-\w]+$/),Fy=st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NO=st(/^(?:\w+script|data):/i),UO=st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zy=st(/^html$/i),FO=st(/^[a-z][.\w]*(-[.\w]+)+$/i);var $f=Object.freeze({__proto__:null,ARIA_ATTR:MO,ATTR_WHITESPACE:UO,CUSTOM_ELEMENT:FO,DATA_ATTR:LO,DOCTYPE_NAME:Zy,ERB_EXPR:OO,IS_ALLOWED_URI:Fy,IS_SCRIPT_OR_DATA:NO,MUSTACHE_EXPR:DO,TMPLIT_EXPR:zO});const Fi={element:1,text:3,progressingInstruction:7,comment:8,document:9},ZO=function(){return typeof window>"u"?null:window},HO=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Tf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Hy(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ZO();const e=M=>Hy(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Fi.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:u,NamedNodeMap:d=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:y,trustedTypes:v}=n,$=c.prototype,E=Ui($,"cloneNode"),I=Ui($,"remove"),Z=Ui($,"nextSibling"),P=Ui($,"childNodes"),V=Ui($,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let O,H="";const{implementation:U,createNodeIterator:ce,createDocumentFragment:ue,getElementsByTagName:Ai}=t,{importNode:co}=r;let xe=Tf();e.isSupported=typeof Uy=="function"&&typeof V=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:An,ERB_EXPR:yt,TMPLIT_EXPR:tn,DATA_ATTR:sl,ARIA_ATTR:uo,IS_SCRIPT_OR_DATA:sb,ATTR_WHITESPACE:bh,CUSTOM_ELEMENT:ob}=$f;let{IS_ALLOWED_URI:wh}=$f,Se=null;const Sh=j({},[...kf,...ac,...lc,...cc,...Ef]);let Ae=null;const _h=j({},[...xf,...uc,...Af,...Mo]);let me=Object.seal(ta(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}})),$i=null,ho=null;const nn=Object.seal(ta(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let kh=!0,ol=!0,Eh=!1,xh=!0,Sr=!1,po=!0,$n=!1,al=!1,ll=!1,_r=!1,fo=!1,go=!1,Ah=!0,$h=!1;const ab="user-content-";let cl=!0,Ti=!1,kr={},bt=null;const ul=j({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Th=null;const Ch=j({},["audio","video","img","source","image","track"]);let hl=null;const Ih=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),mo="http://www.w3.org/1998/Math/MathML",vo="http://www.w3.org/2000/svg",Ot="http://www.w3.org/1999/xhtml";let Er=Ot,dl=!1,pl=null;const lb=j({},[mo,vo,Ot],sc);let yo=j({},["mi","mo","mn","ms","mtext"]),bo=j({},["annotation-xml"]);const cb=j({},["title","style","font","a","script"]);let Ci=null;const ub=["application/xhtml+xml","text/html"],hb="text/html";let be=null,xr=null;const db=t.createElement("form"),Ph=function(m){return m instanceof RegExp||m instanceof Function},fl=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xr&&xr===m)){if((!m||typeof m!="object")&&(m={}),m=kt(m),Ci=ub.indexOf(m.PARSER_MEDIA_TYPE)===-1?hb:m.PARSER_MEDIA_TYPE,be=Ci==="application/xhtml+xml"?sc:na,Se=Ke(m,"ALLOWED_TAGS")?j({},m.ALLOWED_TAGS,be):Sh,Ae=Ke(m,"ALLOWED_ATTR")?j({},m.ALLOWED_ATTR,be):_h,pl=Ke(m,"ALLOWED_NAMESPACES")?j({},m.ALLOWED_NAMESPACES,sc):lb,hl=Ke(m,"ADD_URI_SAFE_ATTR")?j(kt(Ih),m.ADD_URI_SAFE_ATTR,be):Ih,Th=Ke(m,"ADD_DATA_URI_TAGS")?j(kt(Ch),m.ADD_DATA_URI_TAGS,be):Ch,bt=Ke(m,"FORBID_CONTENTS")?j({},m.FORBID_CONTENTS,be):ul,$i=Ke(m,"FORBID_TAGS")?j({},m.FORBID_TAGS,be):kt({}),ho=Ke(m,"FORBID_ATTR")?j({},m.FORBID_ATTR,be):kt({}),kr=Ke(m,"USE_PROFILES")?m.USE_PROFILES:!1,kh=m.ALLOW_ARIA_ATTR!==!1,ol=m.ALLOW_DATA_ATTR!==!1,Eh=m.ALLOW_UNKNOWN_PROTOCOLS||!1,xh=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Sr=m.SAFE_FOR_TEMPLATES||!1,po=m.SAFE_FOR_XML!==!1,$n=m.WHOLE_DOCUMENT||!1,_r=m.RETURN_DOM||!1,fo=m.RETURN_DOM_FRAGMENT||!1,go=m.RETURN_TRUSTED_TYPE||!1,ll=m.FORCE_BODY||!1,Ah=m.SANITIZE_DOM!==!1,$h=m.SANITIZE_NAMED_PROPS||!1,cl=m.KEEP_CONTENT!==!1,Ti=m.IN_PLACE||!1,wh=m.ALLOWED_URI_REGEXP||Fy,Er=m.NAMESPACE||Ot,yo=m.MATHML_TEXT_INTEGRATION_POINTS||yo,bo=m.HTML_INTEGRATION_POINTS||bo,me=m.CUSTOM_ELEMENT_HANDLING||{},m.CUSTOM_ELEMENT_HANDLING&&Ph(m.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(me.tagNameCheck=m.CUSTOM_ELEMENT_HANDLING.tagNameCheck),m.CUSTOM_ELEMENT_HANDLING&&Ph(m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(me.attributeNameCheck=m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),m.CUSTOM_ELEMENT_HANDLING&&typeof m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Sr&&(ol=!1),fo&&(_r=!0),kr&&(Se=j({},Ef),Ae=ta(null),kr.html===!0&&(j(Se,kf),j(Ae,xf)),kr.svg===!0&&(j(Se,ac),j(Ae,uc),j(Ae,Mo)),kr.svgFilters===!0&&(j(Se,lc),j(Ae,uc),j(Ae,Mo)),kr.mathMl===!0&&(j(Se,cc),j(Ae,Af),j(Ae,Mo))),Ke(m,"ADD_TAGS")||(nn.tagCheck=null),Ke(m,"ADD_ATTR")||(nn.attributeCheck=null),m.ADD_TAGS&&(typeof m.ADD_TAGS=="function"?nn.tagCheck=m.ADD_TAGS:(Se===Sh&&(Se=kt(Se)),j(Se,m.ADD_TAGS,be))),m.ADD_ATTR&&(typeof m.ADD_ATTR=="function"?nn.attributeCheck=m.ADD_ATTR:(Ae===_h&&(Ae=kt(Ae)),j(Ae,m.ADD_ATTR,be))),m.ADD_URI_SAFE_ATTR&&j(hl,m.ADD_URI_SAFE_ATTR,be),m.FORBID_CONTENTS&&(bt===ul&&(bt=kt(bt)),j(bt,m.FORBID_CONTENTS,be)),m.ADD_FORBID_CONTENTS&&(bt===ul&&(bt=kt(bt)),j(bt,m.ADD_FORBID_CONTENTS,be)),cl&&(Se["#text"]=!0),$n&&j(Se,["html","head","body"]),Se.table&&(j(Se,["tbody"]),delete $i.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');O=m.TRUSTED_TYPES_POLICY,H=O.createHTML("")}else O===void 0&&(O=HO(v,i)),O!==null&&typeof H=="string"&&(H=O.createHTML(""));Ue&&Ue(m),xr=m}},Rh=j({},[...ac,...lc,...PO]),Dh=j({},[...cc,...RO]),pb=function(m){let T=V(m);(!T||!T.tagName)&&(T={namespaceURI:Er,tagName:"template"});const R=na(m.tagName),oe=na(T.tagName);return pl[m.namespaceURI]?m.namespaceURI===vo?T.namespaceURI===Ot?R==="svg":T.namespaceURI===mo?R==="svg"&&(oe==="annotation-xml"||yo[oe]):!!Rh[R]:m.namespaceURI===mo?T.namespaceURI===Ot?R==="math":T.namespaceURI===vo?R==="math"&&bo[oe]:!!Dh[R]:m.namespaceURI===Ot?T.namespaceURI===vo&&!bo[oe]||T.namespaceURI===mo&&!yo[oe]?!1:!Dh[R]&&(cb[R]||!Rh[R]):!!(Ci==="application/xhtml+xml"&&pl[m.namespaceURI]):!1},wt=function(m){Li(e.removed,{element:m});try{V(m).removeChild(m)}catch{I(m)}},Tn=function(m,T){try{Li(e.removed,{attribute:T.getAttributeNode(m),from:T})}catch{Li(e.removed,{attribute:null,from:T})}if(T.removeAttribute(m),m==="is")if(_r||fo)try{wt(T)}catch{}else try{T.setAttribute(m,"")}catch{}},Oh=function(m){let T=null,R=null;if(ll)m="<remove></remove>"+m;else{const ve=oc(m,/^[\r\n\t ]+/);R=ve&&ve[0]}Ci==="application/xhtml+xml"&&Er===Ot&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");const oe=O?O.createHTML(m):m;if(Er===Ot)try{T=new y().parseFromString(oe,Ci)}catch{}if(!T||!T.documentElement){T=U.createDocument(Er,"template",null);try{T.documentElement.innerHTML=dl?H:oe}catch{}}const De=T.body||T.documentElement;return m&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Er===Ot?Ai.call(T,$n?"html":"body")[0]:$n?T.documentElement:De},zh=function(m){return ce.call(m.ownerDocument||m,m,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},gl=function(m){return m instanceof p&&(typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||!(m.attributes instanceof d)||typeof m.removeAttribute!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function")},Lh=function(m){return typeof a=="function"&&m instanceof a};function zt(M,m,T){Lo(M,R=>{R.call(e,m,T,xr)})}const Mh=function(m){let T=null;if(zt(xe.beforeSanitizeElements,m,null),gl(m))return wt(m),!0;const R=be(m.nodeName);if(zt(xe.uponSanitizeElement,m,{tagName:R,allowedTags:Se}),po&&m.hasChildNodes()&&!Lh(m.firstElementChild)&&ze(/<[/\w!]/g,m.innerHTML)&&ze(/<[/\w!]/g,m.textContent)||m.nodeType===Fi.progressingInstruction||po&&m.nodeType===Fi.comment&&ze(/<[/\w]/g,m.data))return wt(m),!0;if(!(nn.tagCheck instanceof Function&&nn.tagCheck(R))&&(!Se[R]||$i[R])){if(!$i[R]&&Uh(R)&&(me.tagNameCheck instanceof RegExp&&ze(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R)))return!1;if(cl&&!bt[R]){const oe=V(m)||m.parentNode,De=P(m)||m.childNodes;if(De&&oe){const ve=De.length;for(let Ze=ve-1;Ze>=0;--Ze){const Lt=E(De[Ze],!0);Lt.__removalCount=(m.__removalCount||0)+1,oe.insertBefore(Lt,Z(m))}}}return wt(m),!0}return m instanceof c&&!pb(m)||(R==="noscript"||R==="noembed"||R==="noframes")&&ze(/<\/no(script|embed|frames)/i,m.innerHTML)?(wt(m),!0):(Sr&&m.nodeType===Fi.text&&(T=m.textContent,Lo([An,yt,tn],oe=>{T=Mi(T,oe," ")}),m.textContent!==T&&(Li(e.removed,{element:m.cloneNode()}),m.textContent=T)),zt(xe.afterSanitizeElements,m,null),!1)},Nh=function(m,T,R){if(ho[T]||Ah&&(T==="id"||T==="name")&&(R in t||R in db))return!1;if(!(ol&&!ho[T]&&ze(sl,T))){if(!(kh&&ze(uo,T))){if(!(nn.attributeCheck instanceof Function&&nn.attributeCheck(T,m))){if(!Ae[T]||ho[T]){if(!(Uh(m)&&(me.tagNameCheck instanceof RegExp&&ze(me.tagNameCheck,m)||me.tagNameCheck instanceof Function&&me.tagNameCheck(m))&&(me.attributeNameCheck instanceof RegExp&&ze(me.attributeNameCheck,T)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(T,m))||T==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&ze(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R))))return!1}else if(!hl[T]){if(!ze(wh,Mi(R,bh,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&m!=="script"&&$O(R,"data:")===0&&Th[m])){if(!(Eh&&!ze(sb,Mi(R,bh,"")))){if(R)return!1}}}}}}}return!0},Uh=function(m){return m!=="annotation-xml"&&oc(m,ob)},Fh=function(m){zt(xe.beforeSanitizeAttributes,m,null);const{attributes:T}=m;if(!T||gl(m))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ae,forceKeepAttr:void 0};let oe=T.length;for(;oe--;){const De=T[oe],{name:ve,namespaceURI:Ze,value:Lt}=De,Ar=be(ve),ml=Lt;let $e=ve==="value"?ml:TO(ml);if(R.attrName=Ar,R.attrValue=$e,R.keepAttr=!0,R.forceKeepAttr=void 0,zt(xe.uponSanitizeAttribute,m,R),$e=R.attrValue,$h&&(Ar==="id"||Ar==="name")&&(Tn(ve,m),$e=ab+$e),po&&ze(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){Tn(ve,m);continue}if(Ar==="attributename"&&oc($e,"href")){Tn(ve,m);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Tn(ve,m);continue}if(!xh&&ze(/\/>/i,$e)){Tn(ve,m);continue}Sr&&Lo([An,yt,tn],Hh=>{$e=Mi($e,Hh," ")});const Zh=be(m.nodeName);if(!Nh(Zh,Ar,$e)){Tn(ve,m);continue}if(O&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ze)switch(v.getAttributeType(Zh,Ar)){case"TrustedHTML":{$e=O.createHTML($e);break}case"TrustedScriptURL":{$e=O.createScriptURL($e);break}}if($e!==ml)try{Ze?m.setAttributeNS(Ze,ve,$e):m.setAttribute(ve,$e),gl(m)?wt(m):_f(e.removed)}catch{Tn(ve,m)}}zt(xe.afterSanitizeAttributes,m,null)},fb=function M(m){let T=null;const R=zh(m);for(zt(xe.beforeSanitizeShadowDOM,m,null);T=R.nextNode();)zt(xe.uponSanitizeShadowNode,T,null),Mh(T),Fh(T),T.content instanceof s&&M(T.content);zt(xe.afterSanitizeShadowDOM,m,null)};return e.sanitize=function(M){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,R=null,oe=null,De=null;if(dl=!M,dl&&(M="<!-->"),typeof M!="string"&&!Lh(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Ni("dirty is not a string, aborting")}else throw Ni("toString is not a function");if(!e.isSupported)return M;if(al||fl(m),e.removed=[],typeof M=="string"&&(Ti=!1),Ti){if(M.nodeName){const Lt=be(M.nodeName);if(!Se[Lt]||$i[Lt])throw Ni("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)T=Oh("<!---->"),R=T.ownerDocument.importNode(M,!0),R.nodeType===Fi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?T=R:T.appendChild(R);else{if(!_r&&!Sr&&!$n&&M.indexOf("<")===-1)return O&&go?O.createHTML(M):M;if(T=Oh(M),!T)return _r?null:go?H:""}T&&ll&&wt(T.firstChild);const ve=zh(Ti?M:T);for(;oe=ve.nextNode();)Mh(oe),Fh(oe),oe.content instanceof s&&fb(oe.content);if(Ti)return M;if(_r){if(fo)for(De=ue.call(T.ownerDocument);T.firstChild;)De.appendChild(T.firstChild);else De=T;return(Ae.shadowroot||Ae.shadowrootmode)&&(De=co.call(r,De,!0)),De}let Ze=$n?T.outerHTML:T.innerHTML;return $n&&Se["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&ze(Zy,T.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
|
|
350
|
+
`+Ze),Sr&&Lo([An,yt,tn],Lt=>{Ze=Mi(Ze,Lt," ")}),O&&go?O.createHTML(Ze):Ze},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fl(M),al=!0},e.clearConfig=function(){xr=null,al=!1},e.isValidAttribute=function(M,m,T){xr||fl({});const R=be(M),oe=be(m);return Nh(R,oe,T)},e.addHook=function(M,m){typeof m=="function"&&Li(xe[M],m)},e.removeHook=function(M,m){if(m!==void 0){const T=xO(xe[M],m);return T===-1?void 0:AO(xe[M],T,1)[0]}return _f(xe[M])},e.removeHooks=function(M){xe[M]=[]},e.removeAllHooks=function(){xe=Tf()},e}var By=Hy();function lh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wr=lh();function jy(n){wr=n}var Mn={exec:()=>null};function q(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ne.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var BO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ne={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},jO=/^(?:[ \t]*(?:\n|$))+/,VO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,GO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,lo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,WO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ch=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Vy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Gy=q(Vy).replace(/bull/g,ch).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(),qO=q(Vy).replace(/bull/g,ch).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(),uh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,YO=/^[^\n]+/,hh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,KO=q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",hh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),JO=q(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ch).getRegex(),nl="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",dh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,XO=q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",dh).replace("tag",nl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Wy=q(uh).replace("hr",lo).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",nl).getRegex(),QO=q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Wy).getRegex(),ph={blockquote:QO,code:VO,def:KO,fences:GO,heading:WO,hr:lo,html:XO,lheading:Gy,list:JO,newline:jO,paragraph:Wy,table:Mn,text:YO},Cf=q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",lo).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",nl).getRegex(),ez={...ph,lheading:qO,table:Cf,paragraph:q(uh).replace("hr",lo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cf).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",nl).getRegex()},tz={...ph,html:q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q(uh).replace("hr",lo).replace("heading",` *#{1,6} *[^
|
|
351
|
+
]`).replace("lheading",Gy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qy=/^( {2,}|\\)\n(?!\s*$)/,iz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xi=/[\p{P}\p{S}]/u,rl=/[\s\p{P}\p{S}]/u,fh=/[^\s\p{P}\p{S}]/u,sz=q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,rl).getRegex(),Yy=/(?!~)[\p{P}\p{S}]/u,oz=/(?!~)[\s\p{P}\p{S}]/u,az=/(?:[^\s\p{P}\p{S}]|~)/u,lz=q(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",BO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ky=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,cz=q(Ky,"u").replace(/punct/g,xi).getRegex(),uz=q(Ky,"u").replace(/punct/g,Yy).getRegex(),Jy="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hz=q(Jy,"gu").replace(/notPunctSpace/g,fh).replace(/punctSpace/g,rl).replace(/punct/g,xi).getRegex(),dz=q(Jy,"gu").replace(/notPunctSpace/g,az).replace(/punctSpace/g,oz).replace(/punct/g,Yy).getRegex(),pz=q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,fh).replace(/punctSpace/g,rl).replace(/punct/g,xi).getRegex(),fz=q(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,xi).getRegex(),gz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",mz=q(gz,"gu").replace(/notPunctSpace/g,fh).replace(/punctSpace/g,rl).replace(/punct/g,xi).getRegex(),vz=q(/\\(punct)/,"gu").replace(/punct/g,xi).getRegex(),yz=q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),bz=q(dh).replace("(?:-->|$)","-->").getRegex(),wz=q("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",bz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ya=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Sz=q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ya).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xy=q(/^!?\[(label)\]\[(ref)\]/).replace("label",ya).replace("ref",hh).getRegex(),Qy=q(/^!?\[(ref)\](?:\[\])?/).replace("ref",hh).getRegex(),_z=q("reflink|nolink(?!\\()","g").replace("reflink",Xy).replace("nolink",Qy).getRegex(),If=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,gh={_backpedal:Mn,anyPunctuation:vz,autolink:yz,blockSkip:lz,br:qy,code:rz,del:Mn,delLDelim:Mn,delRDelim:Mn,emStrongLDelim:cz,emStrongRDelimAst:hz,emStrongRDelimUnd:pz,escape:nz,link:Sz,nolink:Qy,punctuation:sz,reflink:Xy,reflinkSearch:_z,tag:wz,text:iz,url:Mn},kz={...gh,link:q(/^!?\[(label)\]\((.*?)\)/).replace("label",ya).getRegex(),reflink:q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ya).getRegex()},au={...gh,emStrongRDelimAst:dz,emStrongLDelim:uz,delLDelim:fz,delRDelim:mz,url:q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",If).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",If).getRegex()},Ez={...au,br:q(qy).replace("{2,}","*").getRegex(),text:q(au.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},No={normal:ph,gfm:ez,pedantic:tz},Zi={normal:gh,gfm:au,breaks:Ez,pedantic:kz},xz={"&":"&","<":"<",">":">",'"':""","'":"'"},Pf=n=>xz[n];function Et(n,e){if(e){if(Ne.escapeTest.test(n))return n.replace(Ne.escapeReplace,Pf)}else if(Ne.escapeTestNoEncode.test(n))return n.replace(Ne.escapeReplaceNoEncode,Pf);return n}function Rf(n){try{n=encodeURI(n).replace(Ne.percentDecode,"%")}catch{return null}return n}function Df(n,e){var s;let t=n.replace(Ne.findPipe,(o,a,c)=>{let u=!1,d=a;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Ne.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Ne.slashPipe,"|");return r}function Hi(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function Az(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function $z(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function Of(n,e,t,r,i){let s=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function Tz(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
352
352
|
`).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
|
|
353
353
|
`)}var ba=class{constructor(n){b(this,"options");b(this,"rules");b(this,"lexer");this.options=n||wr}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Hi(t,`
|
|
354
|
-
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=
|
|
354
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=Tz(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=Hi(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Hi(e[0],`
|
|
355
355
|
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Hi(e[0],`
|
|
356
356
|
`).split(`
|
|
357
357
|
`),r="",i="",s=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let u=a.join(`
|
|
@@ -363,16 +363,16 @@ ${d}`:d;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
363
363
|
`),E=this.blockquote($);s[s.length-1]=E,r=r.substring(0,r.length-v.raw.length)+E.raw,i=i.substring(0,i.length-v.text.length)+E.text;break}else if((y==null?void 0:y.type)==="list"){let v=y,$=v.raw+`
|
|
364
364
|
`+t.join(`
|
|
365
365
|
`),E=this.list($);s[s.length-1]=E,r=r.substring(0,r.length-y.raw.length)+E.raw,i=i.substring(0,i.length-v.raw.length)+E.raw,t=$.substring(s.at(-1).raw.length).split(`
|
|
366
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let d=!1,p="",y="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let v
|
|
366
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let d=!1,p="",y="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let v=$z(e[2].split(`
|
|
367
367
|
`,1)[0],e[1].length),$=n.split(`
|
|
368
368
|
`,1)[0],E=!v.trim(),I=0;if(this.options.pedantic?(I=2,y=v.trimStart()):E?I=e[1].length+1:(I=v.search(this.rules.other.nonSpaceChar),I=I>4?1:I,y=v.slice(I),I+=e[1].length),E&&this.rules.other.blankLine.test($)&&(p+=$+`
|
|
369
369
|
`,n=n.substring($.length+1),d=!0),!d){let Z=this.rules.other.nextBulletRegex(I),P=this.rules.other.hrRegex(I),V=this.rules.other.fencesBeginRegex(I),O=this.rules.other.headingBeginRegex(I),H=this.rules.other.htmlBeginRegex(I),U=this.rules.other.blockquoteBeginRegex(I);for(;n;){let ce=n.split(`
|
|
370
370
|
`,1)[0],ue;if($=ce,this.options.pedantic?($=$.replace(this.rules.other.listReplaceNesting," "),ue=$):ue=$.replace(this.rules.other.tabCharGlobal," "),V.test($)||O.test($)||H.test($)||U.test($)||Z.test($)||P.test($))break;if(ue.search(this.rules.other.nonSpaceChar)>=I||!$.trim())y+=`
|
|
371
371
|
`+ue.slice(I);else{if(E||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test(v)||O.test(v)||P.test(v))break;y+=`
|
|
372
372
|
`+$}E=!$.trim(),p+=ce+`
|
|
373
|
-
`,n=n.substring(ce.length+1),v=ue.slice(I)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(y),loose:!1,text:y,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){if(this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]),d.task){if(d.text=d.text.replace(this.rules.other.listReplaceTask,""),((t=d.tokens[0])==null?void 0:t.type)==="text"||((r=d.tokens[0])==null?void 0:r.type)==="paragraph"){d.tokens[0].raw=d.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),d.tokens[0].text=d.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 p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let y={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=y.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=y.raw+d.tokens[0].raw,d.tokens[0].text=y.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(y)):d.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):d.tokens.unshift(y)}}if(!o.loose){let p=d.tokens.filter(v=>v.type==="space"),y=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));o.loose=y}}if(o.loose)for(let d of o.items){d.loose=!0;for(let p of d.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=
|
|
374
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(
|
|
375
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Hi(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=
|
|
373
|
+
`,n=n.substring(ce.length+1),v=ue.slice(I)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(y),loose:!1,text:y,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){if(this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]),d.task){if(d.text=d.text.replace(this.rules.other.listReplaceTask,""),((t=d.tokens[0])==null?void 0:t.type)==="text"||((r=d.tokens[0])==null?void 0:r.type)==="paragraph"){d.tokens[0].raw=d.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),d.tokens[0].text=d.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 p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let y={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=y.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=y.raw+d.tokens[0].raw,d.tokens[0].text=y.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(y)):d.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):d.tokens.unshift(y)}}if(!o.loose){let p=d.tokens.filter(v=>v.type==="space"),y=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));o.loose=y}}if(o.loose)for(let d of o.items){d.loose=!0;for(let p of d.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Df(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
374
|
+
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(Df(a,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
375
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Hi(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=Az(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),Of(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return Of(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+i);(r=u.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let d=[...r[0]][0].length,p=n.slice(0,i+r.index+d+o);if(Math.min(i,o)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let y=p.slice(2,-2);return{type:"strong",raw:p,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,d=n.slice(0,i+r.index+u+o),p=d.slice(i,-i);return{type:"del",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},ft=class lu{constructor(e){b(this,"tokens");b(this,"options");b(this,"state");b(this,"inlineQueue");b(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wr,this.options.tokenizer=this.options.tokenizer||new ba,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ne,block:No.normal,inline:Zi.normal};this.options.pedantic?(t.block=No.pedantic,t.inline=Zi.pedantic):this.options.gfm&&(t.block=No.gfm,this.options.breaks?t.inline=Zi.breaks:t.inline=Zi.gfm),this.tokenizer.rules=t}static get rules(){return{block:No,inline:Zi}}static lex(e,t){return new lu(t).lex(e)}static lexInline(e,t){return new lu(t).inlineTokens(e)}lex(e){e=e.replace(Ne.carriageReturn,`
|
|
376
376
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var i,s,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Ne.tabCharGlobal," ").replace(Ne.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
|
|
377
377
|
`:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
378
378
|
`)?"":`
|
|
@@ -404,16 +404,16 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
404
404
|
`}tablerow({text:n}){return`<tr>
|
|
405
405
|
${n}</tr>
|
|
406
406
|
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
407
|
-
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${Et(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=
|
|
408
|
-
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Et(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},gr=new
|
|
407
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${Et(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=Rf(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+Et(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Rf(n);if(i===null)return Et(t);n=i;let s=`<img src="${n}" alt="${Et(t)}"`;return e&&(s+=` title="${Et(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Et(n.text)}},mh=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}},gt=class cu{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||wr,this.options.renderer=this.options.renderer||new wa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mh}static parse(e,t){return new cu(t).parse(e)}static parseInline(e,t){return new cu(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=u||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return t}parseInline(e,t=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let c=a;switch(c.type){case"escape":{r+=t.text(c);break}case"html":{r+=t.html(c);break}case"link":{r+=t.link(c);break}case"image":{r+=t.image(c);break}case"checkbox":{r+=t.checkbox(c);break}case"strong":{r+=t.strong(c);break}case"em":{r+=t.em(c);break}case"codespan":{r+=t.codespan(c);break}case"br":{r+=t.br(c);break}case"del":{r+=t.del(c);break}case"text":{r+=t.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Uo,Xi=(Uo=class{constructor(n){b(this,"options");b(this,"block");this.options=n||wr}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?ft.lex:ft.lexInline}provideParser(){return this.block?gt.parse:gt.parseInline}},b(Uo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(Uo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Uo),Cz=class{constructor(...n){b(this,"defaults",lh());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",gt);b(this,"Renderer",wa);b(this,"TextRenderer",mh);b(this,"Lexer",ft);b(this,"Tokenizer",ba);b(this,"Hooks",Xi);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let c of a)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let o=s;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let c=o[a].flat(1/0);t=t.concat(this.walkTokens(c,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new wa(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],c=i[o];i[o]=(...u)=>{let d=a.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ba(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],c=i[o];i[o]=(...u)=>{let d=a.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Xi;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],c=i[o];Xi.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Xi.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return c.call(i,p)})();let d=a.call(i,u);return c.call(i,d)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let d=a.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return ft.lex(n,e??this.defaults)}parser(n,e){return gt.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():n?ft.lex:ft.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?gt.parse:gt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():n?ft.lex:ft.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?gt.parse:gt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
|
|
408
|
+
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Et(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},gr=new Cz;function Q(n,e){return gr.parse(n,e)}Q.options=Q.setOptions=function(n){return gr.setOptions(n),Q.defaults=gr.defaults,jy(Q.defaults),Q};Q.getDefaults=lh;Q.defaults=wr;Q.use=function(...n){return gr.use(...n),Q.defaults=gr.defaults,jy(Q.defaults),Q};Q.walkTokens=function(n,e){return gr.walkTokens(n,e)};Q.parseInline=gr.parseInline;Q.Parser=gt;Q.parser=gt.parse;Q.Renderer=wa;Q.TextRenderer=mh;Q.Lexer=ft;Q.lexer=ft.lex;Q.Tokenizer=ba;Q.Hooks=Xi;Q.parse=Q;Q.options;Q.setOptions;Q.use;Q.walkTokens;Q.parseInline;gt.parse;ft.lex;By.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function Iz(n){const e=Q.parse(n,{async:!1});return By.sanitize(e,{USE_PROFILES:{html:!0}})}const Pz=8,zf=new WeakMap;function Rz(n){const e=zf.get(n);if(e&&e.text===n.text)return e.html;const t=Iz(n.text);return zf.set(n,{text:n.text,html:t}),t}function Dz(n){return n.replace(/_/g," ")}function Oz(n){return N`
|
|
409
409
|
<div class="tool-call-header">
|
|
410
410
|
<span class="tool-call-title">${n.title}</span>
|
|
411
|
-
<span class="tool-call-meta">${n.toolKind} · ${
|
|
411
|
+
<span class="tool-call-meta">${n.toolKind} · ${Dz(n.status)}</span>
|
|
412
412
|
</div>
|
|
413
413
|
${n.text?N`<pre class="tool-call-text">${n.text}</pre>`:null}
|
|
414
|
-
`}function
|
|
414
|
+
`}function Lf(n){for(let e=n.length-1;e>=0;e-=1){const t=n[e];if(t&&t.kind==="user")return t.id}return null}var qt,cr,Na,Ua,js,uu;class eb extends cs{constructor(){super(...arguments);w(this,js);b(this,"messages",[]);w(this,qt,!0);w(this,cr,null);w(this,Na,()=>{const t=l(this,cr);if(!t)return;const i=t.scrollHeight-t.clientHeight-t.scrollTop<=Pz;i!==l(this,qt)&&(k(this,qt,i),this.toggleAttribute("data-pinned",i))});w(this,Ua,()=>{k(this,qt,!0),this.toggleAttribute("data-pinned",!0),g(this,js,uu).call(this,!0)})}changed(t){let r=!1;if(t.has("messages")){const i=t.get("messages")??[],s=Lf(this.messages);r=s!==null&&s!==Lf(i),r&&k(this,qt,!0)}Re(this.template(),this),l(this,cr)||k(this,cr,this.querySelector(".history-scroll")),this.toggleAttribute("data-pinned",l(this,qt)),g(this,js,uu).call(this,r)}template(){return N`
|
|
415
415
|
<div class="history-scroll" @scroll=${l(this,Na)}>
|
|
416
|
-
${this.messages.map(t=>{const r=t.kind==="assistant"?
|
|
416
|
+
${this.messages.map(t=>{const r=t.kind==="assistant"?B2(Rz(t)):t.kind==="tool_call"?Oz(t):t.text;return N`<div
|
|
417
417
|
class="message message-${t.kind}"
|
|
418
418
|
data-message-id=${t.id}
|
|
419
419
|
>${r}</div>`})}
|
|
@@ -424,9 +424,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
424
424
|
aria-label="Jump to latest message"
|
|
425
425
|
@click=${l(this,Ua)}
|
|
426
426
|
>
|
|
427
|
-
${
|
|
427
|
+
${Qv({size:16})}
|
|
428
428
|
</button>
|
|
429
|
-
`}}qt=new WeakMap,cr=new WeakMap,Na=new WeakMap,Ua=new WeakMap,js=new WeakSet,
|
|
429
|
+
`}}qt=new WeakMap,cr=new WeakMap,Na=new WeakMap,Ua=new WeakMap,js=new WeakSet,uu=function(t){requestAnimationFrame(()=>{const r=l(this,cr);r&&(!l(this,qt)&&!t||(r.scrollTop=r.scrollHeight-r.clientHeight))})},b(eb,"properties",["messages"]);customElements.define("message-history",eb);var Vs,Gs,oi,Ws,Sn,du,pu,qs,Ys;class hu extends cs{constructor(){super(...arguments);w(this,Sn);b(this,"placeholder","What do you want to do?");b(this,"open",!1);b(this,"messages",[]);w(this,Vs,qe.resolve("ACPClientManager"));w(this,Gs,qe.resolve("ShortcutService"));w(this,oi,null);b(this,"handleTriggerActivate",()=>{this.open=!0});b(this,"handleKeydown",t=>{if(t.key!=="Enter"||t.shiftKey)return;const r=t.currentTarget,i=r.value.trim();if(t.preventDefault(),!i)return;r.value="";const s=l(this,Vs).getActiveClient();s&&s.sendMessage({text:i}).catch(o=>{console.error("ACPClient.sendMessage() failed",o)})});w(this,Ws,t=>{if(t.shortcut!=="focusCommandInput")return;if(!this.open){this.open=!0;return}const r=this.querySelector("textarea");if(r){if(document.activeElement===r){this.open=!1;return}r.focus()}});w(this,qs,t=>{t.target instanceof Node&&(this.contains(t.target)||(this.open=!1))});w(this,Ys,t=>{t.key==="Escape"&&(this.open=!1)})}connected(){this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay");const t=new DisposableStack;k(this,oi,t);const r=SO(l(this,Vs),i=>{this.messages=i});t.defer(()=>r.dispose()),l(this,Gs).addEventListener("shortcut-triggered",l(this,Ws)),t.defer(()=>l(this,Gs).removeEventListener("shortcut-triggered",l(this,Ws))),this.open&&g(this,Sn,du).call(this)}disconnected(){var t;(t=l(this,oi))==null||t.dispose(),k(this,oi,null),g(this,Sn,pu).call(this)}changed(t){if(Re(this.template(),this),t.has("open"))if(this.open){g(this,Sn,du).call(this);const r=this.querySelector("textarea");r==null||r.focus()}else g(this,Sn,pu).call(this)}template(){return this.open?N`
|
|
430
430
|
<message-history .messages=${this.messages}></message-history>
|
|
431
431
|
<textarea
|
|
432
432
|
class="input"
|
|
@@ -444,7 +444,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
444
444
|
<span class="label">${this.placeholder}</span>
|
|
445
445
|
<span class="kbd" aria-hidden="true">⌘K</span>
|
|
446
446
|
</div>
|
|
447
|
-
`}}Vs=new WeakMap,Gs=new WeakMap,oi=new WeakMap,Ws=new WeakMap,Sn=new WeakSet,
|
|
447
|
+
`}}Vs=new WeakMap,Gs=new WeakMap,oi=new WeakMap,Ws=new WeakMap,Sn=new WeakSet,du=function(){document.addEventListener("mousedown",l(this,qs)),document.addEventListener("keydown",l(this,Ys))},pu=function(){document.removeEventListener("mousedown",l(this,qs)),document.removeEventListener("keydown",l(this,Ys))},qs=new WeakMap,Ys=new WeakMap,b(hu,"properties",["placeholder","open","messages"]),b(hu,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",hu);class tb extends Event{constructor(t){super("auth-submit",{bubbles:!0,composed:!0});b(this,"token");this.token=t}}class zz extends HTMLElement{constructor(){super(...arguments);b(this,"_invalid",!1);b(this,"_tokenValue","")}set invalid(t){this._invalid=t,this.render()}get invalid(){return this._invalid}set tokenValue(t){this._tokenValue=t,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(t){const r=t.currentTarget;this._tokenValue=r.value}handleSubmit(t){t.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new tb(r))}render(){Re(N`
|
|
448
448
|
<modal-overlay open>
|
|
449
449
|
<section class="auth-modal">
|
|
450
450
|
<form class="auth-form" @submit=${t=>this.handleSubmit(t)}>
|
|
@@ -465,7 +465,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
465
465
|
</form>
|
|
466
466
|
</section>
|
|
467
467
|
</modal-overlay>
|
|
468
|
-
`,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",
|
|
468
|
+
`,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",zz);class Lz extends HTMLElement{constructor(){super(...arguments);b(this,"runtimeServerURL",Lv());b(this,"electronMode",Mv());b(this,"serverManager",qe.resolve("ServerManager"));b(this,"screenManager",qe.resolve("ScreenManager"));b(this,"connectError",null);b(this,"handleServerManagerChange",()=>{this.render()});b(this,"handleActiveScreenChanged",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.addEventListener("auth-submit",t=>{var i;const r=t instanceof tb?t.token:t instanceof CustomEvent&&typeof((i=t.detail)==null?void 0:i.token)=="string"?t.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged)}async initializeConnection(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,Nc());return}if(this.serverManager.activeServer)return;const t=new Ic({url:this.runtimeServerURL,name:"Server",token:Nc()});this.serverManager.add(t),this.serverManager.setActive(t);try{await t.connect(),this.connectError=null}catch(r){this.connectError=r instanceof Error&&!(r instanceof Cc)?r.message:null}this.render()}async handleAuthSubmit(t){const r=this.serverManager.activeServer;if(r){this.connectError=null,r.token=t,this.updateTokenQueryParam(t);try{await r.connect()}catch(i){i instanceof Cc||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(t){const r=new URL(window.location.href);r.searchParams.set("token",t),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}render(){const t=this.serverManager.activeServer,r=(t==null?void 0:t.status)??null;if(r==="connecting"){Re(N`
|
|
469
469
|
<main class="auth-gate"><p>Connecting...</p></main>
|
|
470
470
|
`,this);return}if(r==="disconnected"){const o=t;if(!o)return;Re(N`
|
|
471
471
|
<main class="auth-gate">
|
|
@@ -489,4 +489,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
|
|
|
489
489
|
`:null}
|
|
490
490
|
`}
|
|
491
491
|
</main>
|
|
492
|
-
`,this)}}customElements.get("television-app")||customElements.define("television-app",
|
|
492
|
+
`,this)}}customElements.get("television-app")||customElements.define("television-app",Lz);const vh=Mv(),il=Lv(),nb=new Dx(vh?"television-electron":"television-browser",Rx(il)),rb=new xC({localStore:nb,localServerURL:il}),ib=new Cx({localStore:nb,serverManager:rb}),Mz=new l2({serverURL:il,token:Nc()??"",screenManager:ib}),Nz=new f2;qe.register("ServerManager",()=>rb);qe.register("ScreenManager",()=>ib);qe.register("ACPClientManager",()=>Mz);qe.register("ShortcutService",()=>Nz);const yh=document.createElement("television-app");yh.runtimeServerURL=il;yh.electronMode=vh;vh&&document.body.classList.add("electron");document.body.appendChild(yh);
|