@telepath-computer/television 1.3.7 → 1.3.8
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.
- package/dist/canonical/v2/components.js +1 -1
- package/dist/canonical/v2/styles.css +7 -0
- package/dist/cli.cjs +5 -5
- package/dist/skills/television/SKILL.md +1 -1
- package/dist/skills/television/theming.md +73 -18
- package/dist/web/assets/main-Br8kMNPo.css +1 -0
- package/dist/web/assets/main-DBp9Wg-D.js +816 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/main-ClOW3LGh.css +0 -1
- package/dist/web/assets/main-XOCJlYqJ.js +0 -721
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
var s8=Object.defineProperty;var pv=n=>{throw TypeError(n)};var o8=(n,e,t)=>e in n?s8(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var C=(n,e,t)=>o8(n,typeof e!="symbol"?e+"":e,t),Kp=(n,e,t)=>e.has(n)||pv("Cannot "+t);var s=(n,e,t)=>(Kp(n,e,"read from private field"),t?t.call(n):e.get(n)),f=(n,e,t)=>e.has(n)?pv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),h=(n,e,t,r)=>(Kp(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),u=(n,e,t)=>(Kp(n,e,"access private method"),t);var qu=(n,e,t,r)=>({set _(i){h(n,e,i,t)},get _(){return s(n,e,r)}});import{i as a8,a as l8,b as c8,c as u8,d as h8,e as d8,f as p8,g as f8,U as m8,A as g8,h as v8}from"./artifact-bridge-BEUWXKq7.js";import{m as y8,a as w8,b as b8}from"./missing-artifact-page-DVzJ41AE.js";var os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function S8(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 fv=Object.prototype.toString,$w=function(e){var t=fv.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&fv.call(e.callee)==="[object Function]"),r},Xp,mv;function _8(){if(mv)return Xp;mv=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=$w,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(y){var v=y.constructor;return v&&v.prototype===y},d={$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},p=function(){if(typeof window>"u")return!1;for(var y in window)try{if(!d["$"+y]&&e.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1}(),g=function(y){if(typeof window>"u"||!p)return c(y);try{return c(y)}catch{return!1}};n=function(v){var A=v!==null&&typeof v=="object",E=t.call(v)==="[object Function]",x=r(v),B=A&&t.call(v)==="[object String]",P=[];if(!A&&!E&&!x)throw new TypeError("Object.keys called on a non-object");var J=a&&E;if(B&&v.length>0&&!e.call(v,0))for(var O=0;O<v.length;++O)P.push(String(O));if(x&&v.length>0)for(var Y=0;Y<v.length;++Y)P.push(String(Y));else for(var Z in v)!(J&&Z==="prototype")&&e.call(v,Z)&&P.push(String(Z));if(o)for(var j=g(v),fe=0;fe<l.length;++fe)!(j&&l[fe]==="constructor")&&e.call(v,l[fe])&&P.push(l[fe]);return P}}return Xp=n,Xp}var A8=Array.prototype.slice,E8=$w,gv=Object.keys,gh=gv?function(e){return gv(e)}:_8(),vv=Object.keys;gh.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 E8(r)?vv(A8.call(r)):vv(r)})}else Object.keys=gh;return Object.keys||gh};var k8=gh,vh=Object.defineProperty||!1;if(vh)try{vh({},"a",{value:1})}catch{vh=!1}var _u=vh,Wr=SyntaxError,re=TypeError,C8=Object.getOwnPropertyDescriptor,yh=C8;if(yh)try{yh([],"length")}catch{yh=null}var Ja=yh,yv=_u,T8=Wr,wo=re,wv=Ja,Rw=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new wo("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new wo("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new wo("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new wo("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new wo("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new wo("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,c=!!wv&&wv(e,t);if(yv)yv(e,t,{configurable:a===null&&c?c.configurable:!a,enumerable:i===null&&c?c.enumerable:!i,value:r,writable:o===null&&c?c.writable:!o});else if(l||!i&&!o&&!a)e[t]=r;else throw new T8("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Wf=_u,Iw=function(){return!!Wf};Iw.hasArrayLengthDefineBug=function(){if(!Wf)return null;try{return Wf([],"length",{value:1}).length!==1}catch{return!0}};var gp=Iw,$8=k8,R8=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",I8=Object.prototype.toString,x8=Array.prototype.concat,bv=Rw,P8=function(n){return typeof n=="function"&&I8.call(n)==="[object Function]"},xw=gp(),L8=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!P8(r)||!r())return}xw?bv(n,e,t,!0):bv(n,e,t)},Pw=function(n,e){var t=arguments.length>2?arguments[2]:{},r=$8(e);R8&&(r=x8.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)L8(n,r[i],e[r[i]],t[r[i]])};Pw.supportsDescriptors=!!xw;var lo=Pw,wh={exports:{}};typeof self<"u"?wh.exports=self:typeof window<"u"?wh.exports=window:wh.exports=Function("return this")();var Lw=wh.exports,D8=Lw,Dw=function(){return typeof os!="object"||!os||os.Math!==Math||os.Array!==Array?D8:os},O8=lo,M8=Ja,N8=Dw,z8=function(){var e=N8();if(O8.supportsDescriptors){var t=M8(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},U8=lo,F8=Lw,Ow=Dw,Z8=z8,H8=Ow(),Mw=function(){return H8};U8(Mw,{getPolyfill:Ow,implementation:F8,shim:Z8});var Ug=Mw,jr=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},Fg=Object,Nw=Error,V8=EvalError,B8=RangeError,Zg=ReferenceError,q8=URIError,W8=Math.abs,j8=Math.floor,G8=Math.max,Y8=Math.min,J8=Math.pow,K8=Math.round,Hg=Number.isNaN||function(e){return e!==e},X8=Hg,Q8=function(e){return X8(e)||e===0?e:e<0?-1:1},Ka=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 o 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 a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,t);if(l.value!==i||l.enumerable!==!0)return!1}return!0},Sv=typeof Symbol<"u"&&Symbol,eA=Ka,Vg=function(){return typeof Sv!="function"||typeof Symbol!="function"||typeof Sv("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:eA()},zw=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,tA=Fg,Uw=tA.getPrototypeOf||null,nA="Function.prototype.bind called on incompatible ",rA=Object.prototype.toString,iA=Math.max,sA="[object Function]",_v=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},oA=function(e,t){for(var r=[],i=t,o=0;i<e.length;i+=1,o+=1)r[o]=e[i];return r},aA=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},lA=function(e){var t=this;if(typeof t!="function"||rA.apply(t)!==sA)throw new TypeError(nA+t);for(var r=oA(arguments,1),i,o=function(){if(this instanceof i){var p=t.apply(this,_v(r,arguments));return Object(p)===p?p:this}return t.apply(e,_v(r,arguments))},a=iA(0,t.length-r.length),l=[],c=0;c<a;c++)l[c]="$"+c;if(i=Function("binder","return function ("+aA(l,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var d=function(){};d.prototype=t.prototype,i.prototype=new d,d.prototype=null}return i},cA=lA,Au=Function.prototype.bind||cA,Bg=Function.prototype.call,qg=Function.prototype.apply,uA=typeof Reflect<"u"&&Reflect&&Reflect.apply,hA=Au,dA=qg,pA=Bg,fA=uA,Fw=fA||hA.call(pA,dA),mA=Au,gA=re,vA=Bg,yA=Fw,vp=function(e){if(e.length<1||typeof e[0]!="function")throw new gA("a function is required");return yA(mA,vA,e)},wA=vp,Av=Ja,Zw;try{Zw=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Qp=!!Zw&&Av&&Av(Object.prototype,"__proto__"),Hw=Object,Ev=Hw.getPrototypeOf,bA=Qp&&typeof Qp.get=="function"?wA([Qp.get]):typeof Ev=="function"?function(e){return Ev(e==null?e:Hw(e))}:!1,kv=zw,Cv=Uw,Tv=bA,Vw=kv?function(e){return kv(e)}:Cv?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Cv(e)}:Tv?function(e){return Tv(e)}:null,SA=Function.prototype.call,_A=Object.prototype.hasOwnProperty,AA=Au,Gr=AA.call(SA,_A),ee,EA=Fg,kA=Nw,CA=V8,TA=B8,$A=Zg,Va=Wr,Vo=re,RA=q8,IA=W8,xA=j8,PA=G8,LA=Y8,DA=J8,OA=K8,MA=Q8,Bw=Function,ef=function(n){try{return Bw('"use strict"; return ('+n+").constructor;")()}catch{}},nc=Ja,NA=_u,tf=function(){throw new Vo},zA=nc?function(){try{return arguments.callee,tf}catch{try{return nc(arguments,"callee").get}catch{return tf}}}():tf,bo=Vg(),Ze=Vw,UA=Uw,FA=zw,qw=qg,Eu=Bg,Ao={},ZA=typeof Uint8Array>"u"||!Ze?ee:Ze(Uint8Array),ro={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ee:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ee:ArrayBuffer,"%ArrayIteratorPrototype%":bo&&Ze?Ze([][Symbol.iterator]()):ee,"%AsyncFromSyncIteratorPrototype%":ee,"%AsyncFunction%":Ao,"%AsyncGenerator%":Ao,"%AsyncGeneratorFunction%":Ao,"%AsyncIteratorPrototype%":Ao,"%Atomics%":typeof Atomics>"u"?ee:Atomics,"%BigInt%":typeof BigInt>"u"?ee:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ee:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ee:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ee:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":kA,"%eval%":eval,"%EvalError%":CA,"%Float16Array%":typeof Float16Array>"u"?ee:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ee:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ee:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ee:FinalizationRegistry,"%Function%":Bw,"%GeneratorFunction%":Ao,"%Int8Array%":typeof Int8Array>"u"?ee:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ee:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ee:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":bo&&Ze?Ze(Ze([][Symbol.iterator]())):ee,"%JSON%":typeof JSON=="object"?JSON:ee,"%Map%":typeof Map>"u"?ee:Map,"%MapIteratorPrototype%":typeof Map>"u"||!bo||!Ze?ee:Ze(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":EA,"%Object.getOwnPropertyDescriptor%":nc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ee:Promise,"%Proxy%":typeof Proxy>"u"?ee:Proxy,"%RangeError%":TA,"%ReferenceError%":$A,"%Reflect%":typeof Reflect>"u"?ee:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ee:Set,"%SetIteratorPrototype%":typeof Set>"u"||!bo||!Ze?ee:Ze(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ee:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":bo&&Ze?Ze(""[Symbol.iterator]()):ee,"%Symbol%":bo?Symbol:ee,"%SyntaxError%":Va,"%ThrowTypeError%":zA,"%TypedArray%":ZA,"%TypeError%":Vo,"%Uint8Array%":typeof Uint8Array>"u"?ee:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ee:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ee:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ee:Uint32Array,"%URIError%":RA,"%WeakMap%":typeof WeakMap>"u"?ee:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ee:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ee:WeakSet,"%Function.prototype.call%":Eu,"%Function.prototype.apply%":qw,"%Object.defineProperty%":NA,"%Object.getPrototypeOf%":UA,"%Math.abs%":IA,"%Math.floor%":xA,"%Math.max%":PA,"%Math.min%":LA,"%Math.pow%":DA,"%Math.round%":OA,"%Math.sign%":MA,"%Reflect.getPrototypeOf%":FA};if(Ze)try{null.error}catch(n){var HA=Ze(Ze(n));ro["%Error.prototype%"]=HA}var VA=function n(e){var t;if(e==="%AsyncFunction%")t=ef("async function () {}");else if(e==="%GeneratorFunction%")t=ef("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ef("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&Ze&&(t=Ze(i.prototype))}return ro[e]=t,t},$v={__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"]},ku=Au,rd=Gr,BA=ku.call(Eu,Array.prototype.concat),qA=ku.call(qw,Array.prototype.splice),Rv=ku.call(Eu,String.prototype.replace),id=ku.call(Eu,String.prototype.slice),WA=ku.call(Eu,RegExp.prototype.exec),jA=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,GA=/\\(\\)?/g,YA=function(e){var t=id(e,0,1),r=id(e,-1);if(t==="%"&&r!=="%")throw new Va("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new Va("invalid intrinsic syntax, expected opening `%`");var i=[];return Rv(e,jA,function(o,a,l,c){i[i.length]=l?Rv(c,GA,"$1"):a||o}),i},JA=function(e,t){var r=e,i;if(rd($v,r)&&(i=$v[r],r="%"+i[0]+"%"),rd(ro,r)){var o=ro[r];if(o===Ao&&(o=VA(r)),typeof o>"u"&&!t)throw new Vo("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Va("intrinsic "+e+" does not exist!")},tn=function(e,t){if(typeof e!="string"||e.length===0)throw new Vo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Vo('"allowMissing" argument must be a boolean');if(WA(/^%?[^%]*%?$/,e)===null)throw new Va("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=YA(e),i=r.length>0?r[0]:"",o=JA("%"+i+"%",t),a=o.name,l=o.value,c=!1,d=o.alias;d&&(i=d[0],qA(r,BA([0,1],d)));for(var p=1,g=!0;p<r.length;p+=1){var y=r[p],v=id(y,0,1),A=id(y,-1);if((v==='"'||v==="'"||v==="`"||A==='"'||A==="'"||A==="`")&&v!==A)throw new Va("property names with quotes must have matching quotes");if((y==="constructor"||!g)&&(c=!0),i+="."+y,a="%"+i+"%",rd(ro,a))l=ro[a];else if(l!=null){if(!(y in l)){if(!t)throw new Vo("base intrinsic for "+e+" exists, but the property is not available.");return}if(nc&&p+1>=r.length){var E=nc(l,y);g=!!E,g&&"get"in E&&!("originalValue"in E.get)?l=E.get:l=l[y]}else g=rd(l,y),l=l[y];g&&!c&&(ro[a]=l)}}return l},nf,Iv;function qi(){if(Iv)return nf;Iv=1;var n=tn,e=vp,t=e([n("%String.prototype.indexOf%")]);return nf=function(i,o){var a=n(i,!!o);return typeof a=="function"&&t(i,".prototype.")>-1?e([a]):a},nf}var rf,xv;function Wg(){if(xv)return rf;xv=1;var n=tn,e=n("%Array%"),t=!e.isArray&&qi()("Object.prototype.toString");return rf=e.isArray||function(i){return t(i)==="[object Array]"},rf}var KA=gp,Pv=_u,Ww=KA.hasArrayLengthDefineBug(),XA=Ww&&Wg(),QA=qi(),eE=QA("Object.prototype.propertyIsEnumerable"),jg=function(e,t,r,i,o,a){if(!Pv){if(!e(a)||!a["[[Configurable]]"]||!a["[[Writable]]"]||o in i&&eE(i,o)!==!!a["[[Enumerable]]"])return!1;var l=a["[[Value]]"];return i[o]=l,t(i[o],l)}return Ww&&o==="length"&&"[[Value]]"in a&&XA(i)&&i.length!==a["[[Value]]"]?(i.length=a["[[Value]]"],i.length===a["[[Value]]"]):(Pv(i,o,r(a)),!0)},tE=re,ml=Gr,nE={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},Xa=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(ml(e,t)&&!nE[t])return!1;var r=ml(e,"[[Value]]")||ml(e,"[[Writable]]"),i=ml(e,"[[Get]]")||ml(e,"[[Set]]");if(r&&i)throw new tE("Property Descriptors may not be both accessor and data descriptors");return!0},jw=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},rE=re,iE=Xa,sE=jw,Gw=function(e){if(typeof e<"u"&&!iE(e))throw new rE("Assertion failed: `Desc` must be a Property Descriptor");return sE(e)},oE=re,Lv=Gr,aE=Xa,Yw=function(e){if(typeof e>"u")return!1;if(!aE(e))throw new oE("Assertion failed: `Desc` must be a Property Descriptor");return!(!Lv(e,"[[Value]]")&&!Lv(e,"[[Writable]]"))},Qa=function(e){return typeof e=="string"||typeof e=="symbol"},Dv=Hg,Jw=function(e,t){return e===t?e===0?1/e===1/t:!0:Dv(e)&&Dv(t)},Ov=re,lE=jr,cE=jg,uE=Gw,hE=Yw,dE=Qa,pE=Jw,Gg=function(e,t,r){if(!lE(e))throw new Ov("Assertion failed: Type(O) is not Object");if(!dE(t))throw new Ov("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return cE(hE,pE,uE,e,t,i)},Kw=Function.prototype.toString,zo=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,jf,bh;if(typeof zo=="function"&&typeof Object.defineProperty=="function")try{jf=Object.defineProperty({},"length",{get:function(){throw bh}}),bh={},zo(function(){throw 42},null,jf)}catch(n){n!==bh&&(zo=null)}else zo=null;var fE=/^\s*class\b/,Gf=function(e){try{var t=Kw.call(e);return fE.test(t)}catch{return!1}},sf=function(e){try{return Gf(e)?!1:(Kw.call(e),!0)}catch{return!1}},Sh=Object.prototype.toString,mE="[object Object]",gE="[object Function]",vE="[object GeneratorFunction]",yE="[object HTMLAllCollection]",wE="[object HTML document.all class]",bE="[object HTMLCollection]",SE=typeof Symbol=="function"&&!!Symbol.toStringTag,_E=!(0 in[,]),Yf=function(){return!1};if(typeof document=="object"){var AE=document.all;Sh.call(AE)===Sh.call(document.all)&&(Yf=function(e){if((_E||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Sh.call(e);return(t===yE||t===wE||t===bE||t===mE)&&e("")==null}catch{}return!1})}var Xw=zo?function(e){if(Yf(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{zo(e,null,jf)}catch(t){if(t!==bh)return!1}return!Gf(e)&&sf(e)}:function(e){if(Yf(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(SE)return sf(e);if(Gf(e))return!1;var t=Sh.call(e);return t!==gE&&t!==vE&&!/^\[object HTML/.test(t)?!1:sf(e)},EE=Xw,kE=function(e){return!!e},An=Gr,Wu=re,CE=jr,Mv=EE,of=kE,TE=function(e){if(!CE(e))throw new Wu("ToPropertyDescriptor requires an object");var t={};if(An(e,"enumerable")&&(t["[[Enumerable]]"]=of(e.enumerable)),An(e,"configurable")&&(t["[[Configurable]]"]=of(e.configurable)),An(e,"value")&&(t["[[Value]]"]=e.value),An(e,"writable")&&(t["[[Writable]]"]=of(e.writable)),An(e,"get")){var r=e.get;if(typeof r<"u"&&!Mv(r))throw new Wu("getter must be a function");t["[[Get]]"]=r}if(An(e,"set")){var i=e.set;if(typeof i<"u"&&!Mv(i))throw new Wu("setter must be a function");t["[[Set]]"]=i}if((An(t,"[[Get]]")||An(t,"[[Set]]"))&&(An(t,"[[Value]]")||An(t,"[[Writable]]")))throw new Wu("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},af=re,$E=jr,Nv=Xa,RE=jg,IE=Gw,xE=Yw,PE=Qa,LE=Jw,DE=TE,OE=function(e,t,r){if(!$E(e))throw new af("Assertion failed: Type(O) is not Object");if(!PE(t))throw new af("Assertion failed: P is not a Property Key");var i=Nv(r)?r:DE(r);if(!Nv(i))throw new af("Assertion failed: Desc is not a valid Property Descriptor");return RE(xE,LE,IE,e,t,i)},zv=re,ME=jr,NE=OE,zE=Qa,UE=function(e,t,r){if(!ME(e))throw new zv("Assertion failed: Type(O) is not Object");if(!zE(t))throw new zv("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return NE(e,t,i)},FE=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,ZE=Fg,HE=ZE.setPrototypeOf||null,VE=vp,Uv=Ja,BE=re,Qw={};try{Qw.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var qE=!("toString"in Qw),lf=Uv&&Uv(Object.prototype,"__proto__"),WE=qE&&(!!lf&&typeof lf.set=="function"&&VE([lf.set])||function(e,t){if(e==null)throw new BE("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),Fv=FE,jE=HE,Zv=WE,GE=re,YE=Fv?function(e,t){if(Fv(e,t))return e;throw new GE("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:jE||(Zv?function(e,t){return Zv(e,t),e}:null),Hv=re,JE=jr,Vv=Vw,KE=function(e){if(!JE(e))throw new Hv("Assertion failed: O must be an Object");if(!Vv)throw new Hv("This environment does not support fetching prototypes.");return Vv(e)},XE=re,QE=YE,ek=jr,tk=KE,nk=function(e,t){if(t!==null&&!ek(t))throw new XE("Assertion failed: V must be Object or Null");try{QE(e,t)}catch{return!1}return tk(e)===t},cf=Gg,Bv=UE,eb=nk,rk=gp(),Yg=Nw;function Cu(n,e,t){var r=new Yg(t);return eb(r,_h),delete r.constructor,Bv(r,"error",n),Bv(r,"suppressed",e),r}rk&&Object.defineProperty(Cu,"prototype",{writable:!1});var _h=Cu.prototype;if(!cf(_h,"constructor",Cu)||!cf(_h,"message","")||!cf(_h,"name","SuppressedError"))throw new Yg("unable to install SuppressedError.prototype properties; please report this!");eb(Cu.prototype,Yg.prototype);var ik=Cu,sk=ik,tb=function(){return typeof SuppressedError=="function"?SuppressedError:sk},ok=lo,qv=Ug(),ak=tb,lk=function(){var e=ak();return ok(qv,{SuppressedError:e},{SuppressedError:function(){return qv.SuppressedError!==e}}),e};lk();var ck=re,uk=Xa,hk=jw,dk=function(e){if(typeof e<"u"&&!uk(e))throw new ck("Assertion failed: `Desc` must be a Property Descriptor");return hk(e)},pk=re,Wv=Gr,fk=Xa,mk=function(e){if(typeof e>"u")return!1;if(!fk(e))throw new pk("Assertion failed: `Desc` must be a Property Descriptor");return!(!Wv(e,"[[Value]]")&&!Wv(e,"[[Writable]]"))},jv=Hg,gk=function(e,t){return e===t?e===0?1/e===1/t:!0:jv(e)&&jv(t)},el=Xw,vk=function(e){return!!e},En=Gr,ju=re,yk=jr,Gv=el,uf=vk,wk=function(e){if(!yk(e))throw new ju("ToPropertyDescriptor requires an object");var t={};if(En(e,"enumerable")&&(t["[[Enumerable]]"]=uf(e.enumerable)),En(e,"configurable")&&(t["[[Configurable]]"]=uf(e.configurable)),En(e,"value")&&(t["[[Value]]"]=e.value),En(e,"writable")&&(t["[[Writable]]"]=uf(e.writable)),En(e,"get")){var r=e.get;if(typeof r<"u"&&!Gv(r))throw new ju("getter must be a function");t["[[Get]]"]=r}if(En(e,"set")){var i=e.set;if(typeof i<"u"&&!Gv(i))throw new ju("setter must be a function");t["[[Set]]"]=i}if((En(t,"[[Get]]")||En(t,"[[Set]]"))&&(En(t,"[[Value]]")||En(t,"[[Writable]]")))throw new ju("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},hf=re,bk=jr,Yv=Xa,Sk=jg,_k=dk,Ak=mk,Ek=Qa,kk=gk,Ck=wk,Tu=function(e,t,r){if(!bk(e))throw new hf("Assertion failed: Type(O) is not Object");if(!Ek(t))throw new hf("Assertion failed: P is not a Property Key");var i=Yv(r)?r:Ck(r);if(!Yv(i))throw new hf("Assertion failed: Desc is not a valid Property Descriptor");return Sk(Ak,kk,_k,e,t,i)},Tk=Ka(),$k=Tk?Symbol.dispose||Symbol("Symbol.dispose"):null,Rk=Ka,Ik=$k,Jg=function(){return Rk()&&Symbol.dispose||Ik},xk=Vg,Pk=Tu,Lk=Jg,Dk=function(){var e=Lk();return xk()&&Pk(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},Ok=Ka(),Mk=Ok?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,Nk=Ka,zk=Mk,Kg=function(){return Nk()&&Symbol.asyncDispose||zk},Uk=Vg,Fk=Tu,Zk=Kg,Hk=function(){var e=Zk();return Uk()&&Fk(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},Vk=Wg(),Bk=tn,qk=qi(),Wk=re,jk=Vk,Gk=Bk("%Reflect.apply%",!0)||qk("Function.prototype.apply"),yp=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!jk(r))throw new Wk("Assertion failed: optional `argumentsList`, if provided, must be a List");return Gk(e,t,r)};const Yk={},Jk=Object.freeze(Object.defineProperty({__proto__:null,default:Yk},Symbol.toStringTag,{value:"Module"})),Kk=S8(Jk);var Xg=typeof Map=="function"&&Map.prototype,df=Object.getOwnPropertyDescriptor&&Xg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,sd=Xg&&df&&typeof df.get=="function"?df.get:null,Jv=Xg&&Map.prototype.forEach,Qg=typeof Set=="function"&&Set.prototype,pf=Object.getOwnPropertyDescriptor&&Qg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,od=Qg&&pf&&typeof pf.get=="function"?pf.get:null,Kv=Qg&&Set.prototype.forEach,Xk=typeof WeakMap=="function"&&WeakMap.prototype,Jl=Xk?WeakMap.prototype.has:null,Qk=typeof WeakSet=="function"&&WeakSet.prototype,Kl=Qk?WeakSet.prototype.has:null,eC=typeof WeakRef=="function"&&WeakRef.prototype,Xv=eC?WeakRef.prototype.deref:null,tC=Boolean.prototype.valueOf,nC=Object.prototype.toString,rC=Function.prototype.toString,iC=String.prototype.match,e0=String.prototype.slice,Mi=String.prototype.replace,sC=String.prototype.toUpperCase,Qv=String.prototype.toLowerCase,nb=RegExp.prototype.test,e1=Array.prototype.concat,Kn=Array.prototype.join,oC=Array.prototype.slice,t1=Math.floor,Jf=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ff=Object.getOwnPropertySymbols,Kf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ba=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Xl=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ba||!0)?Symbol.toStringTag:null,rb=Object.prototype.propertyIsEnumerable,n1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function r1(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||nb.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-t1(-n):t1(n);if(r!==n){var i=String(r),o=e0.call(e,i.length+1);return Mi.call(i,t,"$&_")+"."+Mi.call(Mi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Mi.call(e,t,"$&_")}var Xf=Kk,i1=Xf.custom,s1=ob(i1)?i1:null,ib={__proto__:null,double:'"',single:"'"},aC={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},tl=function n(e,t,r,i){var o=t||{};if(ur(o,"quoteStyle")&&!ur(ib,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ur(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=ur(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ur(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ur(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.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 lb(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return l?r1(e,c):c}if(typeof e=="bigint"){var d=String(e)+"n";return l?r1(e,d):d}var p=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=p&&p>0&&typeof e=="object")return Qf(e)?"[Array]":"[Object]";var g=kC(o,r);if(typeof i>"u")i=[];else if(ab(i,e)>=0)return"[Circular]";function y(Ue,le,nr){if(le&&(i=oC.call(i),i.push(le)),nr){var Nt={depth:o.depth};return ur(o,"quoteStyle")&&(Nt.quoteStyle=o.quoteStyle),n(Ue,Nt,r+1,i)}return n(Ue,o,r+1,i)}if(typeof e=="function"&&!o1(e)){var v=gC(e),A=Gu(e,y);return"[Function"+(v?": "+v:" (anonymous)")+"]"+(A.length>0?" { "+Kn.call(A,", ")+" }":"")}if(ob(e)){var E=Ba?Mi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Kf.call(e);return typeof e=="object"&&!Ba?gl(E):E}if(_C(e)){for(var x="<"+Qv.call(String(e.nodeName)),B=e.attributes||[],P=0;P<B.length;P++)x+=" "+B[P].name+"="+sb(lC(B[P].value),"double",o);return x+=">",e.childNodes&&e.childNodes.length&&(x+="..."),x+="</"+Qv.call(String(e.nodeName))+">",x}if(Qf(e)){if(e.length===0)return"[]";var J=Gu(e,y);return g&&!EC(J)?"["+em(J,g)+"]":"[ "+Kn.call(J,", ")+" ]"}if(uC(e)){var O=Gu(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!rb.call(e,"cause")?"{ ["+String(e)+"] "+Kn.call(e1.call("[cause]: "+y(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Kn.call(O,", ")+" }"}if(typeof e=="object"&&a){if(s1&&typeof e[s1]=="function"&&Xf)return Xf(e,{depth:p-r});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(vC(e)){var Y=[];return Jv&&Jv.call(e,function(Ue,le){Y.push(y(le,e,!0)+" => "+y(Ue,e))}),a1("Map",sd.call(e),Y,g)}if(bC(e)){var Z=[];return Kv&&Kv.call(e,function(Ue){Z.push(y(Ue,e))}),a1("Set",od.call(e),Z,g)}if(yC(e))return mf("WeakMap");if(SC(e))return mf("WeakSet");if(wC(e))return mf("WeakRef");if(dC(e))return gl(y(Number(e)));if(fC(e))return gl(y(Jf.call(e)));if(pC(e))return gl(tC.call(e));if(hC(e))return gl(y(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof os<"u"&&e===os)return"{ [object globalThis] }";if(!cC(e)&&!o1(e)){var j=Gu(e,y),fe=n1?n1(e)===Object.prototype:e instanceof Object||e.constructor===Object,de=e instanceof Object?"":"null prototype",Ve=!fe&&Xl&&Object(e)===e&&Xl in e?e0.call(Wi(e),8,-1):de?"Object":"",ve=fe||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Xe=ve+(Ve||de?"["+Kn.call(e1.call([],Ve||[],de||[]),": ")+"] ":"");return j.length===0?Xe+"{}":g?Xe+"{"+em(j,g)+"}":Xe+"{ "+Kn.call(j,", ")+" }"}return String(e)};function sb(n,e,t){var r=t.quoteStyle||e,i=ib[r];return i+n+i}function lC(n){return Mi.call(String(n),/"/g,""")}function co(n){return!Xl||!(typeof n=="object"&&(Xl in n||typeof n[Xl]<"u"))}function Qf(n){return Wi(n)==="[object Array]"&&co(n)}function cC(n){return Wi(n)==="[object Date]"&&co(n)}function o1(n){return Wi(n)==="[object RegExp]"&&co(n)}function uC(n){return Wi(n)==="[object Error]"&&co(n)}function hC(n){return Wi(n)==="[object String]"&&co(n)}function dC(n){return Wi(n)==="[object Number]"&&co(n)}function pC(n){return Wi(n)==="[object Boolean]"&&co(n)}function ob(n){if(Ba)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Kf)return!1;try{return Kf.call(n),!0}catch{}return!1}function fC(n){if(!n||typeof n!="object"||!Jf)return!1;try{return Jf.call(n),!0}catch{}return!1}var mC=Object.prototype.hasOwnProperty||function(n){return n in this};function ur(n,e){return mC.call(n,e)}function Wi(n){return nC.call(n)}function gC(n){if(n.name)return n.name;var e=iC.call(rC.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function ab(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 vC(n){if(!sd||!n||typeof n!="object")return!1;try{sd.call(n);try{od.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function yC(n){if(!Jl||!n||typeof n!="object")return!1;try{Jl.call(n,Jl);try{Kl.call(n,Kl)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function wC(n){if(!Xv||!n||typeof n!="object")return!1;try{return Xv.call(n),!0}catch{}return!1}function bC(n){if(!od||!n||typeof n!="object")return!1;try{od.call(n);try{sd.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function SC(n){if(!Kl||!n||typeof n!="object")return!1;try{Kl.call(n,Kl);try{Jl.call(n,Jl)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function _C(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function lb(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return lb(e0.call(n,0,e.maxStringLength),e)+r}var i=aC[e.quoteStyle||"single"];i.lastIndex=0;var o=Mi.call(Mi.call(n,i,"\\$1"),/[\x00-\x1f]/g,AC);return sb(o,"single",e)}function AC(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":"")+sC.call(e.toString(16))}function gl(n){return"Object("+n+")"}function mf(n){return n+" { ? }"}function a1(n,e,t,r){var i=r?em(t,r):Kn.call(t,", ");return n+" ("+e+") {"+i+"}"}function EC(n){for(var e=0;e<n.length;e++)if(ab(n[e],`
|
|
2
|
+
`)>=0)return!1;return!0}function kC(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Kn.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Kn.call(Array(e+1),t)}}function em(n,e){if(n.length===0)return"";var t=`
|
|
3
|
+
`+e.prev+e.base;return t+Kn.call(n,","+t)+`
|
|
4
|
+
`+e.prev}function Gu(n,e){var t=Qf(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=ur(n,i)?e(n[i],n):""}var o=typeof ff=="function"?ff(n):[],a;if(Ba){a={};for(var l=0;l<o.length;l++)a["$"+o[l]]=o[l]}for(var c in n)ur(n,c)&&(t&&String(Number(c))===c&&c<n.length||Ba&&a["$"+c]instanceof Symbol||(nb.call(/[^\w$]/,c)?r.push(e(c,n)+": "+e(n[c],n)):r.push(c+": "+e(n[c],n))));if(typeof ff=="function")for(var d=0;d<o.length;d++)rb.call(n,o[d])&&r.push("["+e(o[d])+"]: "+e(n[o[d]],n));return r}var CC=tl,TC=re,wp=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},$C=function(n,e){if(n){var t=wp(n,e);return t&&t.value}},RC=function(n,e,t){var r=wp(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},IC=function(n,e){return n?!!wp(n,e):!1},xC=function(n,e){if(n)return wp(n,e,!0)},PC=function(){var e,t={assert:function(r){if(!t.has(r))throw new TC("Side channel does not contain "+CC(r))},delete:function(r){var i=xC(e,r);return i&&e&&!e.next&&(e=void 0),!!i},get:function(r){return $C(e,r)},has:function(r){return IC(e,r)},set:function(r,i){e||(e={next:void 0}),RC(e,r,i)}};return t},LC=tn,$u=qi(),DC=tl,OC=re,l1=LC("%Map%",!0),MC=$u("Map.prototype.get",!0),NC=$u("Map.prototype.set",!0),zC=$u("Map.prototype.has",!0),UC=$u("Map.prototype.delete",!0),FC=$u("Map.prototype.size",!0),cb=!!l1&&function(){var e,t={assert:function(r){if(!t.has(r))throw new OC("Side channel does not contain "+DC(r))},delete:function(r){if(e){var i=UC(e,r);return FC(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return MC(e,r)},has:function(r){return e?zC(e,r):!1},set:function(r,i){e||(e=new l1),NC(e,r,i)}};return t},ZC=tn,bp=qi(),HC=tl,Yu=cb,VC=re,So=ZC("%WeakMap%",!0),BC=bp("WeakMap.prototype.get",!0),qC=bp("WeakMap.prototype.set",!0),WC=bp("WeakMap.prototype.has",!0),jC=bp("WeakMap.prototype.delete",!0),GC=So?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new VC("Side channel does not contain "+HC(i))},delete:function(i){if(So&&i&&(typeof i=="object"||typeof i=="function")){if(e)return jC(e,i)}else if(Yu&&t)return t.delete(i);return!1},get:function(i){return So&&i&&(typeof i=="object"||typeof i=="function")&&e?BC(e,i):t&&t.get(i)},has:function(i){return So&&i&&(typeof i=="object"||typeof i=="function")&&e?WC(e,i):!!t&&t.has(i)},set:function(i,o){So&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new So),qC(e,i,o)):Yu&&(t||(t=Yu()),t.set(i,o))}};return r}:Yu,YC=re,JC=tl,KC=PC,XC=cb,QC=GC,eT=QC||XC||KC,tT=function(){var e,t={assert:function(r){if(!t.has(r)){var i=r&&Object(r)===r?"the given object key":JC(r);throw new YC("Side channel does not contain "+i)}},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=eT()),e.set(r,i)}};return t},nT=Gr,vl=tT(),or=re,t0={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new or("`O` is not an object");if(typeof e!="string")throw new or("`slot` must be a string");if(vl.assert(n),!t0.has(n,e))throw new or("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new or("`O` is not an object");if(typeof e!="string")throw new or("`slot` must be a string");var t=vl.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new or("`O` is not an object");if(typeof e!="string")throw new or("`slot` must be a string");var t=vl.get(n);return!!t&&nT(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new or("`O` is not an object");if(typeof e!="string")throw new or("`slot` must be a string");var r=vl.get(n);r||(r={},vl.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(t0);var n0=t0,ub=Wr,Ui=n0,Ru=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 ub('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');Ui.set(this,"[[Type]]",e),Ui.set(this,"[[Value]]",t)};Ru.prototype.type=function(){return Ui.get(this,"[[Type]]")};Ru.prototype.value=function(){return Ui.get(this,"[[Value]]")};Ru.prototype["?"]=function(){var e=Ui.get(this,"[[Type]]"),t=Ui.get(this,"[[Value]]");if(e==="throw")throw t;return t};Ru.prototype["!"]=function(){var e=Ui.get(this,"[[Type]]");if(e!=="normal")throw new ub('Assertion failed: Completion Record is not of type "normal"');return Ui.get(this,"[[Value]]")};var r0=Ru,rT=r0,i0=function(e){return new rT("normal",e)},gf,c1;function iT(){if(c1)return gf;c1=1;var n=Ka;return gf=function(){return n()&&!!Symbol.toStringTag},gf}var sT=tn,u1=sT("%Object.defineProperty%",!0),oT=iT()(),aT=Gr,lT=re,Ju=oT?Symbol.toStringTag:null,hb=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 lT("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Ju&&(r||!aT(e,Ju))&&(u1?u1(e,Ju,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[Ju]=t)},db={exports:{}},cT=tn,h1=Rw,uT=gp(),d1=Ja,p1=re,hT=cT("%Math.floor%"),dT=function(e,t){if(typeof e!="function")throw new p1("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||hT(t)!==t)throw new p1("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&d1){var a=d1(e,"length");a&&!a.configurable&&(i=!1),a&&!a.writable&&(o=!1)}return(i||o||!r)&&(uT?h1(e,"length",t,!0,!0):h1(e,"length",t)),e},pT=Au,fT=qg,mT=Fw,gT=function(){return mT(pT,fT,arguments)};(function(n){var e=dT,t=_u,r=vp,i=gT;n.exports=function(a){var l=r(arguments),c=1+a.length-(arguments.length-1);return e(l,c>0?c:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(db);var s0=db.exports,vT=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},yT=Object,wT=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||yT(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},bT=Gr,ST=Wg(),_T=vT,AT=wT,ET=function(e){return e&&typeof e=="object"&&bT(e,"[[DisposableResourceStack]]")&&ST(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||_T(e["[[DisposableResourceStack]]"],AT))},kT=jr,CT=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(kT(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},TT=CT,o0=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":TT(e)},$T=re,RT=tl,IT=Qa,xT=function(e,t){if(!IT(t))throw new $T("Assertion failed: P is not a Property Key, got "+RT(t));return e[t]},f1=re,PT=xT,LT=el,DT=Qa,m1=tl,OT=function(e,t){if(!DT(t))throw new f1("Assertion failed: P is not a Property Key");var r=PT(e,t);if(r!=null){if(!LT(r))throw new f1(m1(t)+" is not a function: "+m1(r));return r}},tm={exports:{}},MT=tn,NT=MT,g1=NT("%Reflect.construct%",!0),ad=Tu;try{ad({},"",{"[[Get]]":function(){}})}catch{ad=null}if(ad&&g1){var v1={},y1={};ad(y1,"length",{"[[Get]]":function(){throw v1},"[[Enumerable]]":!0}),tm.exports=function(e){try{g1(e,y1)}catch(t){return t===v1}}}else tm.exports=function(e){return typeof e=="function"&&!!e.prototype};var zT=tm.exports,vf=re,w1=el,UT=zT,FT=function(e){if(!UT(e))throw new vf("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,o){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new vf("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=o});if(!w1(t["[[Resolve]]"])||!w1(t["[[Reject]]"]))throw new vf("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},b1=Wr,ZT=re,yf=yp,S1=OT,HT=FT,VT=o0,_1=Jg(),A1=Kg(),BT=function(e,t){if(VT(e)!=="Object")throw new ZT("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new b1("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&A1&&(r=S1(e,A1)),!r){if(!_1)throw new b1("`Symbol.dispose` is not supported");if(r=S1(e,_1),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var o=HT(Promise);try{yf(r,i),yf(o["[[Resolve]]"],void 0,[void 0])}catch(a){o["[[Reject]]"](a)}return o["[[Promise]]"]}yf(r,i)}}return r},qT=Wr,wf=re,WT=el,jT=o0,GT=BT,YT=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new qT("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"&&jT(e)!=="Object")throw new wf("`V` must be an Object, or `null` or `undefined`");if(r=GT(e,t),typeof r>"u")throw new wf("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!WT(r))throw new wf("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},JT=Wr,Ku=re,KT=ET,E1=YT,XT=qi(),QT=XT("Array.prototype.push"),pb=function(e,t,r){if(!KT(e))throw new Ku("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new JT("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 Ku("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Ku("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var o;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";o=E1(t,r)}else{if(typeof t<"u")throw new Ku("Assertion failed: `V` must be undefined when `method` is present");o=E1(void 0,r,i)}return QT(e["[[DisposableResourceStack]]"],o),"UNUSED"},bf,k1;function a0(){if(k1)return bf;k1=1;var n=tn,e=s0,t=Wr,r=n("%Promise.resolve%",!0),i=r&&e(r);return bf=function(a,l){if(!i)throw new t("This environment does not support Promises.");return i(a,l)},bf}var Sf,C1;function e$(){if(C1)return Sf;C1=1;var n=tn,e=Wr,t=n("%Promise%",!0),r=yp,i=a0(),o=o0;return Sf=function(l,c,d){if(typeof l<"u"&&o(l)!=="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 d<"u"&&typeof d!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var p=typeof d>"u"?d:r(d,l);if(c==="ASYNC-DISPOSE")return i(t,p)},Sf}var _f,T1;function t$(){if(T1)return _f;T1=1;var n=r0;return _f=function(t){return new n("throw",t)},_f}var n$=tn,Af=Wr,$1=re,r$=n$("%Promise%",!0),i$=qi(),R1=i$("Promise.prototype.then",!0),s$=r0,I1=e$(),o$=i0,a$=a0(),x1=t$(),l$=tb(),fb=function(e,t){if(!(t instanceof s$))throw new $1("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new $1("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var i,o=r.length-1;o>=0;o-=1)if(!i)i=r[o]["[[Hint]]"];else if(i!==r[o]["[[Hint]]"])throw new Af("mixed hint stacks are not supported");for(var a=i==="ASYNC-DISPOSE"&&a$(r$,t),l=function(y){if(t.type()==="throw"){var v=t.value(),A=new l$(y,v);t=x1(A)}else t=x1(y)},c=i==="ASYNC-DISPOSE"&&function(v){return R1(a,function(){var A=I1(v["[[ResourceValue]]"],v["[[Hint]]"],v["[[DisposeMethod]]"]);if(!A)throw new Af("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return R1(A,o$)},l)},d=r.length-1;d>=0;d-=1)if(i==="ASYNC-DISPOSE")a=c(r[d]);else{var p=r[d];try{var g=I1(p["[[ResourceValue]]"],p["[[Hint]]"],p["[[DisposeMethod]]"]);if(g)throw new Af("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(y){l(y)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?a:t},mb=function(){var e=[];return{"[[DisposableResourceStack]]":e}},Sp=Zg,l0=re,c$=yp,nl=Gg,u$=Tu,gb=el,h$=i0,At=n0,d$=hb,vb=lo.supportsDescriptors,p$=s0,c0=pb,f$=fb,yb=mb,P1=Jg(),Xt=function n(){if(!(this instanceof n)||At.has(this,"[[DisposableState]]")||At.has(this,"[[DisposeCapability]]"))throw new l0("can only be used with new");At.set(this,"[[DisposableState]]","PENDING"),At.set(this,"[[DisposeCapability]]",yb())},wb=function(){var e=this;return At.assert(e,"[[DisposableState]]"),At.get(e,"[[DisposableState]]")==="DISPOSED"},Iu=p$(wb);vb?u$(Xt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":wb}):Xt.prototype.disposed=!1;var bb=function(e){At.set(e,"[[DisposableState]]","DISPOSED"),vb||(e.disposed=!0)};nl(Xt.prototype,"dispose",function(){var e=this;if(!Iu(e))return bb(e),f$(At.get(e,"[[DisposeCapability]]"),h$())["?"]()});nl(Xt.prototype,"use",function(e){var t=this;if(Iu(t))throw new Sp("a disposed stack can not use anything new");return c0(At.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});nl(Xt.prototype,"adopt",function(e,t){var r=this;if(Iu(r))throw new Sp("a disposed stack can not use anything new");if(!gb(t))throw new l0("`onDispose` must be a function");var i=function(){return c$(t,void 0,[e])};return c0(At.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});nl(Xt.prototype,"defer",function(e){var t=this;if(Iu(t))throw new Sp("a disposed stack can not defer anything new");if(!gb(e))throw new l0("`onDispose` must be a function");c0(At.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});nl(Xt.prototype,"move",function(){var e=this;if(Iu(e))throw new Sp("a disposed stack can not use anything new");var t=new Xt;return At.set(t,"[[DisposeCapability]]",At.get(e,"[[DisposeCapability]]")),At.set(e,"[[DisposeCapability]]",yb()),bb(e),t});P1&&nl(Xt.prototype,P1,Xt.prototype.dispose);d$(Xt.prototype,"DisposableStack");var m$=Xt,g$=m$,v$=function(){return typeof DisposableStack=="function"?DisposableStack:g$},y$=lo,w$=Ug(),b$=v$,S$=function(){var e=b$();return y$(w$,{DisposableStack:e},{DisposableStack:!0}),e},_$=tn,_p=Zg,u0=re,L1=_$("%Promise%",!0),h0=pb,A$=yp,rl=Gg,E$=Tu,k$=fb,Sb=el,_b=mb,C$=i0,D1=a0(),Et=n0,T$=hb,Ab=lo.supportsDescriptors,$$=s0,R$=qi(),I$=R$("Promise.prototype.then",!0),O1=Kg(),Qt=function n(){if(!(this instanceof n)||Et.has(this,"[[AsyncDisposableState]]")||Et.has(this,"[[DisposeCapability]]"))throw new u0("can only be used with new");Et.set(this,"[[AsyncDisposableState]]","pending"),Et.set(this,"[[DisposeCapability]]",_b())},Eb=function(){var e=this;return Et.assert(e,"[[AsyncDisposableState]]"),Et.get(e,"[[AsyncDisposableState]]")==="disposed"},xu=$$(Eb);Ab?E$(Qt.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Eb}):Qt.prototype.disposed=!1;var kb=function(e){Et.set(e,"[[AsyncDisposableState]]","disposed"),Ab||(e.disposed=!0)};rl(Qt.prototype,"disposeAsync",function(){var e=this;return xu(e)?D1(L1):(kb(e),I$(D1(L1,k$(Et.get(e,"[[DisposeCapability]]"),C$())),function(t){return t["?"]()}))});rl(Qt.prototype,"use",function(e){var t=this;if(xu(t))throw new _p("a disposed stack can not use anything new");return h0(Et.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});rl(Qt.prototype,"adopt",function(e,t){var r=this;if(xu(r))throw new _p("a disposed stack can not use anything new");if(!Sb(t))throw new u0("`onDisposeAsync` must be a function");var i=function(){return A$(t,void 0,[e])};return i.value=e,h0(Et.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});rl(Qt.prototype,"defer",function(e){var t=this;if(xu(t))throw new _p("a disposed stack can not defer anything new");if(!Sb(e))throw new u0("`onDispose` must be a function");h0(Et.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});rl(Qt.prototype,"move",function(){var e=this;if(xu(e))throw new _p("a disposed stack can not use anything new");var t=new Qt;return Et.set(t,"[[DisposeCapability]]",Et.get(e,"[[DisposeCapability]]")),Et.set(e,"[[DisposeCapability]]",_b()),kb(e),t});O1&&rl(Qt.prototype,O1,Qt.prototype.disposeAsync);T$(Qt.prototype,"AsyncDisposableStack");var x$=Qt,P$=x$,L$=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:P$},D$=lo,O$=Ug(),M$=L$,N$=function(){var e=M$();return D$(O$,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},z$=Dk,U$=Hk,F$=S$,Z$=N$,H$=function(){z$(),U$(),F$(),Z$()};H$();const M1=new WeakMap;function V$(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function _o(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function N1(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function B$(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class q${constructor(){C(this,"entries",new Map);C(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw N1();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw N1();if(t.constructor.name==="AsyncFunction")throw B$();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=M1.get(e);if(t){if(e.length!==t.length)throw new Error(`${_o(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(`${_o(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=M1.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),o=Reflect.get(i,r,i);return typeof o=="function"?o.bind(i):o},set:(t,r,i)=>{const o=this.getInstance(e);return Reflect.set(o,r,i,o)},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(`${_o(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=>_o(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(V$(r))throw new Error(`Factory for ${_o(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${_o(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 Cb=new q$,W$=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function j$(n){for(const e of Object.keys(n))if(W$.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function G$(n,e){j$(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function nn(){class n extends Event{constructor(t,r){const{type:i,bubbles:o,cancelable:a,composed:l,...c}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(t,{bubbles:o,cancelable:a,composed:l}),G$(this,c)}}return n}class ji extends globalThis.EventTarget{}const Y$="X-Television-Client-Meta",J$="telemetry-activity",K$="telemetry-signal",Tb={kind:"single",full_screen:!1},$b={width:560,height:740};function X$(n){return n.layout.flatMap(e=>e.artifactIds)}function Q$(n){if(!Array.isArray(n))return{valid:!1,errors:["Layout must be an array of pages"]};const e=[];for(const[t,r]of n.entries())e4(r,t,e);return{valid:e.length===0,errors:e}}function rc(n){return n.flatMap(e=>e.artifactIds)}function nm(n,e){return n.flatMap(t=>{if(!t.artifactIds.includes(e))return[t];const r=t.artifactIds.filter(i=>i!==e);return r.length===0?[]:[{...t,artifactIds:r}]})}function e4(n,e,t){if(!Ef(n)){t.push(`Page ${e} must be an object`);return}for(const r of Object.keys(n))r!=="artifactIds"&&r!=="geometry"&&r!=="size"&&t.push(`Page ${e} has unknown field: ${r}`);if(!Array.isArray(n.artifactIds)||n.artifactIds.length===0?t.push(`Page ${e} must contain at least one artifact id`):n.artifactIds.some(r=>typeof r!="string"||r.length===0)&&t.push(`Page ${e} artifact ids must be non-empty strings`),!Ef(n.geometry)){t.push(`Page ${e} geometry must be an object`);return}for(const r of Object.keys(n.geometry))r!=="kind"&&r!=="full_screen"&&t.push(`Page ${e} geometry has unknown field: ${r}`);if(n.geometry.kind!=="single"){t.push(`Page ${e} has unknown geometry kind: ${String(n.geometry.kind)}`);return}if(typeof n.geometry.full_screen!="boolean"&&t.push(`Page ${e} single geometry must include a boolean full_screen`),!Ef(n.size)){t.push(`Page ${e} size must be an object`);return}for(const r of Object.keys(n.size))r!=="width"&&r!=="height"&&t.push(`Page ${e} size has unknown field: ${r}`);for(const r of["width","height"]){const i=n.size[r];(typeof i!="number"||!Number.isFinite(i)||i<=0)&&t.push(`Page ${e} size ${r} must be a finite positive number`)}}function Ef(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const Jt=nn(),Ah=nn(),z1=nn(),t4=nn(),n4=nn(),r4=nn();function Rb(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const il=Rb("RequestError"),U1=Rb("ValidationError"),i4=200,s4=300,Xu=401;class o4{constructor(e,t){C(this,"serverURL");C(this,"token");C(this,"onUnauthorized");C(this,"telemetryMeta");this.serverURL=e.replace(/\/$/,""),this.token=t.token,this.onUnauthorized=t.onUnauthorized,this.telemetryMeta=t.telemetryMeta}async requestJSON(e,t,r){var a;const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),o=await a4(i);if(!i.ok||i.status<i4||i.status>=s4)throw i.status===Xu&&((a=this.onUnauthorized)==null||a.call(this)),this.createError(typeof o.error=="string"?o.error:i.statusText,i.status);return o}async requestVoid(e,t,r){var o;const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0);if(!i.ok)throw i.status===Xu&&((o=this.onUnauthorized)==null||o.call(this)),this.createError(await kf(i,i.statusText),i.status)}async requestText(e,t){var i;const r=await this.request(e,t);if(!r.ok)throw r.status===Xu&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await kf(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){var o;const i=await this.request(e,t,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw i.status===Xu&&((o=this.onUnauthorized)==null||o.call(this)),this.createError(await kf(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new il(e,r)}async request(e,t,r,i){const o=`${this.serverURL}${t}`;try{return await fetch(o,{method:e,headers:this.buildHeaders(i),body:r})}catch(a){throw this.createError(a instanceof Error?a.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),this.telemetryMeta&&(t[Y$]=JSON.stringify(this.telemetryMeta)),Object.keys(t).length>0?t:void 0}}async function a4(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function kf(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 l4(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var dr,kd,Ib;class c4{constructor(e){f(this,kd);f(this,dr);h(this,dr,e)}list(){return s(this,dr).requestJSON("GET","/channels")}async get(e={}){const t=await u(this,kd,Ib).call(this,e.channelID);return s(this,dr).requestJSON("GET",`/channels/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),s(this,dr).requestJSON("POST","/channels",t)}update(e){const{channelID:t,...r}=e;return s(this,dr).requestJSON("PATCH",`/channels/${encodeURIComponent(t)}`,r)}remove(e){return s(this,dr).requestJSON("DELETE",`/channels/${encodeURIComponent(e.channelID)}`)}}dr=new WeakMap,kd=new WeakSet,Ib=async function(e){if(e!==void 0)return e;const{channels:t}=await this.list();if(t.length===1)return t[0].id;throw t.length===0?new U1("channelID is required, but no channels exist."):new U1(`channelID is required when multiple channels exist. Available channels: ${l4(t)}`)};var pr;class u4{constructor(e){f(this,pr);h(this,pr,e)}create(e){const t={kind:e.kind,title:e.title};switch(e.kind){case"path":t.path=e.path;break;case"url":t.url=e.url;break}return t.channelID=e.channelID,s(this,pr).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.channelID!==void 0&&t.set("channelID",e.channelID);const r=t.toString();return s(this,pr).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return s(this,pr).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),e.path!==void 0&&(t.path=e.path),e.url!==void 0&&(t.url=e.url),s(this,pr).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}delete(e){return s(this,pr).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}}pr=new WeakMap;var Wo;class h4{constructor(e){f(this,Wo);h(this,Wo,e)}list(){return s(this,Wo).requestJSON("GET","/themes")}refresh(){return s(this,Wo).requestJSON("POST","/themes/refresh")}}Wo=new WeakMap;var jo;class d4{constructor(e){f(this,jo);h(this,jo,e)}get(e){return s(this,jo).requestText("GET",`/markdown/${encodeURIComponent(e.artifactID)}`)}update(e){return s(this,jo).requestRawVoid("PUT",`/markdown/${encodeURIComponent(e.artifactID)}`,e.content)}}jo=new WeakMap;var hs;class p4{constructor(e){f(this,hs);h(this,hs,e)}status(){return s(this,hs).requestJSON("GET","/telemetry")}enable(){return s(this,hs).requestJSON("POST","/telemetry/enable")}disable(){return s(this,hs).requestJSON("POST","/telemetry/disable")}}hs=new WeakMap;var ds;class f4{constructor(e){f(this,ds);h(this,ds,e)}get(){return s(this,ds).requestJSON("GET","/display")}patch(e){const t={};return e.focusedChannelId!==void 0&&(t.focusedChannelId=e.focusedChannelId),e.pinnedChannelIds!==void 0&&(t.pinnedChannelIds=e.pinnedChannelIds),e.activeThemeName!==void 0&&(t.activeThemeName=e.activeThemeName),e.appearanceMode!==void 0&&(t.appearanceMode=e.appearanceMode),e.themeJavaScriptConsentIds!==void 0&&(t.themeJavaScriptConsentIds=e.themeJavaScriptConsentIds),s(this,ds).requestVoid("PATCH","/display",t)}focus(e){return s(this,ds).requestJSON("POST","/display/focus",{artifactID:e.artifactID})}}ds=new WeakMap;var on;class m4{constructor(e,t={}){C(this,"channels");C(this,"artifacts");C(this,"display");C(this,"themes");C(this,"markdown");C(this,"telemetry");f(this,on);h(this,on,new o4(e,t)),this.channels=new c4(s(this,on)),this.artifacts=new u4(s(this,on)),this.display=new f4(s(this,on)),this.themes=new h4(s(this,on)),this.markdown=new d4(s(this,on)),this.telemetry=new p4(s(this,on))}health(){return s(this,on).requestJSON("GET","/health")}}on=new WeakMap;const ld="0.0.0",g4=/^\d+\.\d+\.\d+$/,v4=3;function Ap(n){return g4.test(n)}function d0(n,e){const t=n.split(".").map(Number),r=e.split(".").map(Number);for(let i=0;i<v4;i++)if(t[i]!==r[i])return t[i]>r[i];return!1}function y4(n,e){return n===ld||e===ld?!1:n!==e}const w4=400,b4=404,xb=500,S4=600,_4={focusedChannelId:null,pinnedChannelIds:[],activeThemeName:null,activeThemeColorScheme:null,appearanceMode:"system",themeJavaScriptConsentIds:[],acpEnabled:!1};var te,uc,hc,fr,xe,ce,ps,ri,fs,mr,Tt,Go,dc,L,kn,rm,Eo,Pb,im,Lb,Eh,sm,Db,ko,Ob,lr,om,Mb,Ie;class A4 extends ji{constructor(t){super();f(this,L);f(this,te);f(this,uc);f(this,hc);f(this,fr,new Set);C(this,"pendingPageWrites",new Map);f(this,xe,new Map);f(this,ce,C4());f(this,ps);f(this,ri,!1);f(this,fs,!1);f(this,mr,0);f(this,Tt,!1);f(this,Go,()=>{if(s(this,Tt))return;const t=s(this,te).connection.status==="connected";t&&!s(this,fs)?(h(this,fs,!0),u(this,L,Ob).call(this)):!t&&s(this,fs)&&(h(this,fs,!1),h(this,mr,s(this,mr)+1)),u(this,L,lr).call(this)});f(this,dc,t=>{if(s(this,Tt)||t.serverURL!==s(this,te).connection.url)return;for(const i of s(this,fr))i.push(t.event);const r=t.event;if(r.type==="artifact-content-changed"){this.dispatchEvent(new z1("artifact-content-changed",{artifactID:r.artifactID}));return}if(r.type==="artifact-focus"){s(this,ri)&&cd(s(this,ce),s(this,xe),r.channelID,r.artifactID)&&u(this,L,lr).call(this),this.dispatchEvent(new t4("artifact-focus",{channelID:r.channelID,artifactID:r.artifactID}));return}r.type==="theme-changed"&&this.dispatchEvent(new n4("theme-changed",{themeName:r.themeName,activeThemeColorScheme:r.activeThemeColorScheme,themeJavaScriptConsentIds:[...r.themeJavaScriptConsentIds]})),r.type==="appearance-changed"&&this.dispatchEvent(new r4("appearance-changed",{appearanceMode:r.appearanceMode})),s(this,ri)&&(Qu(s(this,ce),r,this.pendingPageWrites,s(this,xe)),Cf(s(this,ce),s(this,xe)),u(this,L,lr).call(this))});h(this,te,t.connectionOwner),h(this,uc,t.navigationKeyHandler),h(this,hc,t.retainedGateHalted??(()=>!1)),h(this,ps,u(this,L,om).call(this)),s(this,te).addEventListener("change",s(this,Go)),s(this,te).addEventListener("server-event",s(this,dc)),s(this,Go).call(this)}get snapshot(){return s(this,ps)}handleNavigationKey(t){var r;u(this,L,Ie).call(this),(r=s(this,uc))==null||r.call(this,t)}authenticate(t){return u(this,L,Ie).call(this),s(this,te).authenticate(t)}async createChannel(t){u(this,L,Ie).call(this);const{channel:r}=await u(this,L,kn).call(this,s(this,te).connection.client.channels.create({name:t}),()=>u(this,L,Pb).call(this));return r}focusChannel(t){return u(this,L,Ie).call(this),u(this,L,kn).call(this,s(this,te).connection.client.display.patch({focusedChannelId:t}),()=>u(this,L,Eo).call(this))}setPinnedChannelIds(t){return u(this,L,Ie).call(this),u(this,L,kn).call(this,s(this,te).connection.client.display.patch({pinnedChannelIds:[...t]}),()=>u(this,L,Eo).call(this))}listThemes(){return u(this,L,Ie).call(this),s(this,te).connection.client.themes.list()}refreshThemes(){return u(this,L,Ie).call(this),s(this,te).connection.client.themes.refresh()}setActiveTheme(t){return u(this,L,Ie).call(this),u(this,L,kn).call(this,s(this,te).connection.client.display.patch({activeThemeName:t}),()=>u(this,L,Eo).call(this))}setAppearanceMode(t){return u(this,L,Ie).call(this),u(this,L,kn).call(this,s(this,te).connection.client.display.patch({appearanceMode:t}),()=>u(this,L,Eo).call(this))}setThemeJavaScriptConsent(t,r){u(this,L,Ie).call(this);const i=s(this,ce).display.themeJavaScriptConsentIds,o=r?i.includes(t)?[...i]:[...i,t]:i.filter(a=>a!==t);return u(this,L,kn).call(this,s(this,te).connection.client.display.patch({themeJavaScriptConsentIds:o}),()=>u(this,L,Eo).call(this))}selectPage(t,r){u(this,L,Ie).call(this),cd(s(this,ce),s(this,xe),t,r)&&u(this,L,lr).call(this)}async renameChannel(t,r){u(this,L,Ie).call(this),await u(this,L,kn).call(this,s(this,te).connection.client.channels.update({channelID:t,name:r}),()=>u(this,L,im).call(this,t))}async deleteChannel(t){u(this,L,Ie).call(this),await u(this,L,kn).call(this,s(this,te).connection.client.channels.remove({channelID:t}),()=>u(this,L,Lb).call(this,t))}updateChannelPages(t,r){u(this,L,Ie).call(this);const i=Q$(r),o=s(this,ce).channels.get(t);if(!i.valid||!o)return Promise.resolve();const a=ls(r),l=ls(o.channel.layout),c={previousPages:l};return io(s(this,xe),t,l,a),o.channel={...o.channel,layout:a},this.pendingPageWrites.set(t,c),u(this,L,lr).call(this),s(this,te).connection.client.channels.update({channelID:t,layout:ls(a)}).then(()=>{this.pendingPageWrites.get(t)===c&&this.pendingPageWrites.delete(t)},async d=>{if(s(this,Tt))throw d;const p=this.pendingPageWrites.get(t)===c;if(p&&this.pendingPageWrites.delete(t),Z1(d))throw await u(this,L,rm).call(this,()=>u(this,L,im).call(this,t)),d;if(!p||!x4(d))throw d;const g=s(this,ce).channels.get(t);if(!g)throw d;const y=ls(c.previousPages);throw io(s(this,xe),t,g.channel.layout,y),g.channel={...g.channel,layout:y},u(this,L,lr).call(this),d})}async deleteArtifact(t){u(this,L,Ie).call(this);const r=H1(s(this,ce),t);await u(this,L,kn).call(this,s(this,te).connection.client.artifacts.delete({artifactID:t}),()=>u(this,L,Db).call(this,t,r))}readMarkdown(t){return u(this,L,Ie).call(this),s(this,te).connection.client.markdown.get({artifactID:t})}writeMarkdown(t,r){return u(this,L,Ie).call(this),s(this,te).connection.client.markdown.update({artifactID:t,content:r})}getArtifactViewURL(t){return u(this,L,Ie).call(this),s(this,te).connection.getViewURL(t)}getArtifactContentURL(t){return u(this,L,Ie).call(this),s(this,te).connection.getContentURL(t)}dispose(){s(this,Tt)||(h(this,Tt,!0),h(this,mr,s(this,mr)+1),s(this,fr).clear(),this.pendingPageWrites.clear(),s(this,xe).clear(),s(this,te).removeEventListener("change",s(this,Go)),s(this,te).removeEventListener("server-event",s(this,dc)))}}te=new WeakMap,uc=new WeakMap,hc=new WeakMap,fr=new WeakMap,xe=new WeakMap,ce=new WeakMap,ps=new WeakMap,ri=new WeakMap,fs=new WeakMap,mr=new WeakMap,Tt=new WeakMap,Go=new WeakMap,dc=new WeakMap,L=new WeakSet,kn=async function(t,r){try{return await t}catch(i){throw!s(this,Tt)&&Z1(i)&&await u(this,L,rm).call(this,r),i}},rm=async function(t){try{await t()}catch{}},Eo=function(){const t=s(this,te).connection.client;return u(this,L,ko).call(this,()=>t.display.get(),r=>u(this,L,Eh).call(this,r))},Pb=function(){const t=s(this,te).connection.client;return u(this,L,ko).call(this,async()=>{const[{channels:r},i]=await Promise.all([t.channels.list(),t.display.get()]);return{channels:r,display:i}},({channels:r,display:i})=>{const o=new Set(r.map(({id:a})=>a));for(const a of s(this,ce).channels.keys())o.has(a)||(this.pendingPageWrites.delete(a),s(this,xe).delete(a),s(this,ce).channels.delete(a));for(const a of r)s(this,ce).channels.has(a.id)||s(this,ce).channels.set(a.id,{channel:Bo(a),artifacts:new Map});u(this,L,Eh).call(this,i)})},im=function(t){const r=s(this,te).connection.client;return u(this,L,ko).call(this,()=>Tf(()=>r.channels.get({channelID:t})),i=>u(this,L,sm).call(this,t,i))},Lb=function(t){const r=s(this,te).connection.client;return u(this,L,ko).call(this,async()=>{const[i,o]=await Promise.all([Tf(()=>r.channels.get({channelID:t})),r.display.get()]);return{detail:i,display:o}},({detail:i,display:o})=>{u(this,L,sm).call(this,t,i),u(this,L,Eh).call(this,o)})},Eh=function(t){s(this,ce).display=lm(t),s(this,te).connection.acpClient.setEnabled(t.acpEnabled)},sm=function(t,r){this.pendingPageWrites.delete(t);const i=s(this,ce).channels.get(t);if(r===null){s(this,xe).delete(t),s(this,ce).channels.delete(t);return}io(s(this,xe),t,(i==null?void 0:i.channel.layout)??[],r.channel.layout),s(this,ce).channels.set(t,{channel:Bo(r.channel),artifacts:new Map(r.artifacts.map(o=>[o.id,structuredClone(o)]))})},Db=function(t,r){const i=s(this,te).connection.client;return u(this,L,ko).call(this,()=>Tf(()=>i.artifacts.get({artifactID:t})),o=>{const a=H1(s(this,ce),t)??r;if(o===null){a!==null&&Qu(s(this,ce),{type:"artifact-removed",channelID:a,artifactID:t},this.pendingPageWrites,s(this,xe));return}const l=a===null?void 0:s(this,ce).channels.get(a);l==null||l.artifacts.set(t,structuredClone(o.artifact))})},ko=async function(t,r){const i=s(this,mr),o=[];s(this,fr).add(o);try{const a=await t();if(s(this,Tt)||i!==s(this,mr))return;r(a);for(const l of o)Qu(s(this,ce),l,this.pendingPageWrites,s(this,xe));Cf(s(this,ce),s(this,xe)),u(this,L,lr).call(this)}finally{s(this,fr).delete(o)}},Ob=async function(){const t=++qu(this,mr)._,r=s(this,te).connection,i=r.client,o=[];s(this,fr).add(o);try{const[{channels:a},l]=await Promise.all([i.channels.list(),i.display.get()]),c=await Promise.all(a.map(({id:g})=>i.channels.get({channelID:g})));if(s(this,Tt)||t!==s(this,mr))return;const d={channels:new Map,display:lm(l)};for(const g of c)d.channels.set(g.channel.id,{channel:Bo(g.channel),artifacts:new Map(g.artifacts.map(y=>[y.id,structuredClone(y)]))});T4(s(this,xe),s(this,ce),d);for(const g of o)Qu(d,g,this.pendingPageWrites,s(this,xe));Cf(d,s(this,xe));const p=s(this,ri)?E4(s(this,ce),d):[];this.pendingPageWrites.clear(),h(this,ce,d),h(this,ri,!0),r.acpClient.setEnabled(l.acpEnabled),u(this,L,lr).call(this);for(const g of p)this.dispatchEvent(new z1("artifact-content-changed",{artifactID:g}))}catch{}finally{s(this,fr).delete(o)}},lr=function(){s(this,Tt)||(h(this,ps,u(this,L,om).call(this)),u(this,L,Mb).call(this),this.dispatchEvent(new Jt("change")))},om=function(){var o;const t=[...s(this,ce).channels.values()].map(a=>R4(a,s(this,xe).get(a.channel.id))),r=t.find(({id:a})=>a===s(this,ce).display.focusedChannelId)??null,i=s(this,te).connection;return Object.freeze({ready:s(this,ri),channels:Object.freeze(t),display:I4(s(this,ce).display),focusedChannel:r,connection:Object.freeze({authorizationRequired:i.hasAuthRejected,authorizationRejected:i.hasAuthTokenRejected,gateHalted:i.bootState==="halted"||s(this,hc).call(this),status:i.status,hasEverConnected:i.hasEverConnected,firstConnectError:i.hasEverConnected?null:s(this,te).connectError,nextRetryAt:i.nextRetryAt,upgradeInstructions:k4(((o=i.updateState)==null?void 0:o.desktop)??null)})})},Mb=function(){const t=s(this,ps).focusedChannel;s(this,te).connection.acpClient.setChannelContext(t?{channelID:t.id,channelName:t.name}:null)},Ie=function(){if(s(this,Tt))throw new Error("ApplicationService is disposed")};function E4(n,e){const t=e.display.focusedChannelId;if(t===null||n.display.focusedChannelId!==t)return[];const r=n.channels.get(t),i=e.channels.get(t);if(!r||!i)return[];const o=new Set(rc(r.channel.layout));return rc(i.channel.layout).filter(a=>{var l,c;return o.has(a)&&((l=r.artifacts.get(a))==null?void 0:l.kind)==="path"&&((c=i.artifacts.get(a))==null?void 0:c.kind)==="path"})}function k4(n){return n===null?null:Object.freeze({...n})}function C4(){return{channels:new Map,display:lm(_4)}}function Qu(n,e,t,r){switch(e.type){case"channel-created":r.delete(e.channel.id),n.channels.set(e.channel.id,{channel:Bo(e.channel),artifacts:new Map});return;case"channel-updated":{t.delete(e.channel.id);const i=n.channels.get(e.channel.id);if(!i){r.delete(e.channel.id),n.channels.set(e.channel.id,{channel:Bo(e.channel),artifacts:new Map});return}io(r,e.channel.id,i.channel.layout,e.channel.layout);const o=new Set(rc(e.channel.layout));i.channel=Bo(e.channel);for(const a of i.artifacts.keys())o.has(a)||i.artifacts.delete(a);return}case"channel-removed":t.delete(e.channelID),r.delete(e.channelID),n.channels.delete(e.channelID);return;case"channel-changed":n.display.focusedChannelId=e.channelID;return;case"pinned-channels-changed":n.display.pinnedChannelIds=[...e.pinnedChannelIds];return;case"theme-changed":n.display.activeThemeName=e.themeName,n.display.activeThemeColorScheme=e.activeThemeColorScheme,n.display.themeJavaScriptConsentIds=[...e.themeJavaScriptConsentIds];return;case"appearance-changed":n.display.appearanceMode=e.appearanceMode;return;case"artifact-created":{const i=n.channels.get(e.channelID);if(!i)return;const o=t.get(e.channelID);if(o&&(o.previousPages=F1(o.previousPages,e.artifact.id)),!rc(i.channel.layout).includes(e.artifact.id)){const a=i.channel.layout,l=F1(a,e.artifact.id);io(r,e.channelID,a,l),i.channel={...i.channel,layout:l}}i.artifacts.set(e.artifact.id,structuredClone(e.artifact));return}case"artifact-updated":for(const i of n.channels.values())if(i.artifacts.has(e.artifact.id)){i.artifacts.set(e.artifact.id,structuredClone(e.artifact));return}return;case"artifact-removed":{const i=n.channels.get(e.channelID);if(!i)return;const o=t.get(e.channelID);o&&(o.previousPages=nm(o.previousPages,e.artifactID)),i.artifacts.delete(e.artifactID);const a=i.channel.layout,l=nm(a,e.artifactID);io(r,e.channelID,a,l),i.channel={...i.channel,layout:l};return}case"artifact-focus":cd(n,r,e.channelID,e.artifactID);return;case"artifact-content-changed":return;default:return P4(e)}}function T4(n,e,t){var r;for(const i of n.keys())t.channels.has(i)||n.delete(i);for(const[i,o]of t.channels)io(n,i,((r=e.channels.get(i))==null?void 0:r.channel.layout)??[],o.channel.layout)}function io(n,e,t,r){const i=n.get(e);if(i===void 0)return;if(r.length===0){n.delete(e);return}const o=am(r,i);if(o!==-1){n.set(e,[...r[o].artifactIds]);return}const a=am(t,i),l=a===-1?0:Math.min(a,r.length-1);n.set(e,[...r[l].artifactIds])}function cd(n,e,t,r){const i=n.channels.get(t),o=i==null?void 0:i.channel.layout.find(({artifactIds:l})=>l.includes(r));if(!o)return!1;const a=e.get(t);return a&&$4(a,o.artifactIds)?!1:(e.set(t,[...o.artifactIds]),!0)}function Cf(n,e){var i,o;const t=n.display.focusedChannelId;if(t===null||e.has(t))return;const r=(o=(i=n.channels.get(t))==null?void 0:i.channel.layout[0])==null?void 0:o.artifactIds[0];r!==void 0&&cd(n,e,t,r)}function am(n,e){const t=new Set(e);return n.findIndex(r=>r.artifactIds.some(i=>t.has(i)))}function $4(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}function R4(n,e){const t=Object.freeze(n.channel.layout.map(l=>Object.freeze({artifactIds:Object.freeze([...l.artifactIds]),geometry:Object.freeze({...l.geometry}),size:Object.freeze({...l.size})}))),r=e===void 0?0:am(n.channel.layout,e),i=t[r]??t[0]??null,o=Object.freeze([...n.artifacts.values()].map(l=>Object.freeze(structuredClone(l)))),a={id:n.channel.id,name:n.channel.name,pages:t,selectedPage:i,artifacts:o};return Object.freeze(n.channel.onboarding?{...a,onboarding:Object.freeze({...n.channel.onboarding})}:a)}function I4(n){return Object.freeze({focusedChannelId:n.focusedChannelId,pinnedChannelIds:Object.freeze([...n.pinnedChannelIds]),activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:Object.freeze([...n.themeJavaScriptConsentIds]),acpEnabled:n.acpEnabled})}function F1(n,e){return rc(n).includes(e)?ls(n):[...ls(n),{artifactIds:[e],geometry:{...Tb},size:{...$b}}]}function x4(n){return n instanceof il&&n.status!==void 0&&n.status>=w4&&n.status<xb}function Z1(n){return n instanceof il&&(n.status===void 0||n.status>=xb&&n.status<S4)}async function Tf(n){try{return await n()}catch(e){if(e instanceof il&&e.status===b4)return null;throw e}}function H1(n,e){for(const[t,r]of n.channels)if(r.artifacts.has(e))return t;return null}function ls(n){return n.map(e=>({artifactIds:[...e.artifactIds],geometry:{...e.geometry},size:{...e.size}}))}function Bo(n){return{id:n.id,name:n.name,layout:ls(n.layout),...n.onboarding?{onboarding:{...n.onboarding}}:{}}}function lm(n){return{focusedChannelId:n.focusedChannelId,pinnedChannelIds:[...n.pinnedChannelIds],activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:[...n.themeJavaScriptConsentIds],acpEnabled:n.acpEnabled}}function P4(n){throw new Error(`Unexpected server event: ${JSON.stringify(n)}`)}function L4(n,e){var c;const t=n.snapshot,r=t.focusedChannel;if(e==="ArrowLeft"||e==="ArrowRight"){if(r===null||r.selectedPage===null)return!1;const d=r.pages.indexOf(r.selectedPage),p=d+(e==="ArrowLeft"?-1:1),g=(c=r.pages[p])==null?void 0:c.artifactIds[0];return d===-1||g===void 0?!1:(V1(),n.selectPage(r.id,g),!0)}const i=D4(t),o=r===null?-1:i.indexOf(r.id),a=o+(e==="ArrowUp"?-1:1),l=i[a];return o===-1||l===void 0?!1:(V1(),n.focusChannel(l).catch(()=>{}),!0)}function D4(n){const e=new Map(n.channels.map(o=>[o.id,o])),t=n.display.pinnedChannelIds.filter(o=>e.has(o)),r=new Set(t),i=n.channels.filter(({id:o})=>!r.has(o)).map(({id:o})=>o).sort((o,a)=>a.localeCompare(o));return[...t,...i]}function V1(){const n=document.activeElement;n instanceof HTMLElement&&n.blur()}const Nb="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ud=32,O4=16,zb=10,B1=0xffffffffffff;var cs;(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"})(cs||(cs={}));class Il extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function M4(n){const e=Math.floor(n()*ud)%ud;return Nb.charAt(e)}function N4(n){const e=z4(),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 Il(cs.PRNGDetectFailure,"Failed to find a reliable PRNG")}function z4(){return Z4()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function U4(n,e){let t="";for(;n>0;n--)t=M4(e)+t;return t}function F4(n,e=zb){if(isNaN(n))throw new Il(cs.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>B1)throw new Il(cs.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${B1}: ${n}`);if(n<0)throw new Il(cs.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Il(cs.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%ud,r=Nb.charAt(t)+r,n=(n-t)/ud;return r}function Z4(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function p0(n,e){const t=N4(),r=Date.now();return F4(r,zb)+U4(O4,t)}const xl=nn(),Ub=nn(),Fb=nn(),H4=nn(),$f=nn(),V4="store-";function Fi(n){return new URL(n).origin}function B4(){return{authTokens:{}}}var ms,gs,vs;class q4 extends ji{constructor(t,r,i={}){super();f(this,ms);f(this,gs);f(this,vs);h(this,ms,`${V4}${t}`),h(this,gs,i.storage??j4());const o=s(this,gs).getItem(s(this,ms));o===null?(h(this,vs,r),s(this,gs).setItem(s(this,ms),JSON.stringify(r))):h(this,vs,G4(JSON.parse(o),r))}get(){return s(this,vs)}set(t){h(this,vs,t),s(this,gs).setItem(s(this,ms),JSON.stringify(t)),this.dispatchEvent(new Jt("change"))}}ms=new WeakMap,gs=new WeakMap,vs=new WeakMap;function q1(n,e){return n.authTokens[Fi(e)]??null}function W1(n,e,t){return{authTokens:{...n.authTokens,[Fi(e)]:t}}}function W4(n,e){const t=Fi(e);if(!(t in n.authTokens))return n;const r={...n.authTokens};return delete r[t],{authTokens:r}}function j4(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function G4(n,e){if(typeof n!="object"||n===null||Array.isArray(n))return e;const t=n.authTokens;if(typeof t!="object"||t===null||Array.isArray(t))return e;const r={};for(const[i,o]of Object.entries(t))if(typeof o=="string")try{r[Fi(i)]=o}catch{}return{authTokens:r}}function k(n,e,t){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(n))return;l._zod.traits.add(n),e(l,c);const d=a.prototype,p=Object.keys(d);for(let g=0;g<p.length;g++){const y=p[g];y in l||(l[y]=d[y].bind(l))}}const i=(t==null?void 0:t.Parent)??Object;class o extends i{}Object.defineProperty(o,"name",{value:n});function a(l){var c;const d=t!=null&&t.Parent?new o:this;r(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var c,d;return t!=null&&t.Parent&&l instanceof t.Parent?!0:(d=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:d.has(n)}}),Object.defineProperty(a,"name",{value:n}),a}class qo extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zb extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Hb={};function Zi(n){return Hb}function Vb(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 cm(n,e){return typeof e=="bigint"?e.toString():e}function Ep(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function f0(n){return n==null}function m0(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function Y4(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 o=t>i?t:i,a=Number.parseInt(n.toFixed(o).replace(".","")),l=Number.parseInt(e.toFixed(o).replace(".",""));return a%l/10**o}const j1=Symbol("evaluating");function ue(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==j1)return r===void 0&&(r=j1,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function uo(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Gi(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function G1(n){return JSON.stringify(n)}function J4(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Bb="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function ic(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const K4=Ep(()=>{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 qa(n){if(ic(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(ic(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function qb(n){return qa(n)?{...n}:Array.isArray(n)?[...n]:n}const X4=new Set(["string","number","symbol"]);function Wa(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yi(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 F(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 Q4(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const eR={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 tR(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 o=Gi(n._zod.def,{get shape(){const a={};for(const l in e){if(!(l in t.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&(a[l]=t.shape[l])}return uo(this,"shape",a),a},checks:[]});return Yi(n,o)}function nR(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 o=Gi(n._zod.def,{get shape(){const a={...n._zod.def.shape};for(const l in e){if(!(l in t.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&delete a[l]}return uo(this,"shape",a),a},checks:[]});return Yi(n,o)}function rR(n,e){if(!qa(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const o=n._zod.def.shape;for(const a in e)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Gi(n._zod.def,{get shape(){const o={...n._zod.def.shape,...e};return uo(this,"shape",o),o}});return Yi(n,i)}function iR(n,e){if(!qa(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=Gi(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return uo(this,"shape",r),r}});return Yi(n,t)}function sR(n,e){const t=Gi(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return uo(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Yi(n,t)}function oR(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 a=Gi(e._zod.def,{get shape(){const l=e._zod.def.shape,c={...l};if(t)for(const d in t){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(c[d]=n?new n({type:"optional",innerType:l[d]}):l[d])}else for(const d in l)c[d]=n?new n({type:"optional",innerType:l[d]}):l[d];return uo(this,"shape",c),c},checks:[]});return Yi(e,a)}function aR(n,e,t){const r=Gi(e._zod.def,{get shape(){const i=e._zod.def.shape,o={...i};if(t)for(const a in t){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=new n({type:"nonoptional",innerType:i[a]}))}else for(const a in i)o[a]=new n({type:"nonoptional",innerType:i[a]});return uo(this,"shape",o),o}});return Yi(e,r)}function Uo(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 Fo(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function eh(n){return typeof n=="string"?n:n==null?void 0:n.message}function Hi(n,e,t){var i,o,a,l,c,d;const r={...n,path:n.path??[]};if(!n.message){const p=eh((a=(o=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:o.error)==null?void 0:a.call(o,n))??eh((l=e==null?void 0:e.error)==null?void 0:l.call(e,n))??eh((c=t.customError)==null?void 0:c.call(t,n))??eh((d=t.localeError)==null?void 0:d.call(t,n))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function g0(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function sc(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Wb=(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,cm,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},jb=k("$ZodError",Wb),Gb=k("$ZodError",Wb,{Parent:Error});function lR(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 cR(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a}));else if(o.code==="invalid_key")r({issues:o.issues});else if(o.code==="invalid_element")r({issues:o.issues});else if(o.path.length===0)t._errors.push(e(o));else{let a=t,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(n),t}const v0=n=>(e,t,r,i)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise)throw new qo;if(a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>Hi(c,o,Zi())));throw Bb(l,i==null?void 0:i.callee),l}return a.value},y0=n=>async(e,t,r,i)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let a=e._zod.run({value:t,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>Hi(c,o,Zi())));throw Bb(l,i==null?void 0:i.callee),l}return a.value},kp=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},o=e._zod.run({value:t,issues:[]},i);if(o instanceof Promise)throw new qo;return o.issues.length?{success:!1,error:new(n??jb)(o.issues.map(a=>Hi(a,i,Zi())))}:{success:!0,data:o.value}},uR=kp(Gb),Cp=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new n(o.issues.map(a=>Hi(a,i,Zi())))}:{success:!0,data:o.value}},hR=Cp(Gb),dR=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return v0(n)(e,t,i)},pR=n=>(e,t,r)=>v0(n)(e,t,r),fR=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return y0(n)(e,t,i)},mR=n=>async(e,t,r)=>y0(n)(e,t,r),gR=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return kp(n)(e,t,i)},vR=n=>(e,t,r)=>kp(n)(e,t,r),yR=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Cp(n)(e,t,i)},wR=n=>async(e,t,r)=>Cp(n)(e,t,r),bR=/^[cC][^\s-]{8,}$/,SR=/^[0-9a-z]+$/,_R=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,AR=/^[0-9a-vA-V]{20}$/,ER=/^[A-Za-z0-9]{27}$/,kR=/^[a-zA-Z0-9_-]{21}$/,CR=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,TR=/^([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})$/,Y1=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)$/,$R=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,RR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function IR(){return new RegExp(RR,"u")}const xR=/^(?:(?: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])$/,PR=/^(([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}|:))$/,LR=/^((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])$/,DR=/^(([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])$/,OR=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yb=/^[A-Za-z0-9_-]*$/,MR=/^\+[1-9]\d{6,14}$/,Jb="(?:(?:\\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])))",NR=new RegExp(`^${Jb}$`);function Kb(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 zR(n){return new RegExp(`^${Kb(n)}$`)}function UR(n){const e=Kb({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(`^${Jb}T(?:${r})$`)}const FR=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}$`)},ZR=/^-?\d+$/,Xb=/^-?\d+(?:\.\d+)?$/,HR=/^(?:true|false)$/i,VR=/^[^A-Z]*$/,BR=/^[^a-z]*$/,kt=k("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Qb={number:"number",bigint:"bigint",object:"date"},e2=k("$ZodCheckLessThan",(n,e)=>{kt.init(n,e);const t=Qb[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(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})}}),t2=k("$ZodCheckGreaterThan",(n,e)=>{kt.init(n,e);const t=Qb[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(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})}}),qR=k("$ZodCheckMultipleOf",(n,e)=>{kt.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):Y4(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})}}),WR=k("$ZodCheckNumberFormat",(n,e)=>{var a;kt.init(n,e),e.format=e.format||"float64";const t=(a=e.format)==null?void 0:a.includes("int"),r=t?"int":"number",[i,o]=eR[e.format];n._zod.onattach.push(l=>{const c=l._zod.bag;c.format=e.format,c.minimum=i,c.maximum=o,t&&(c.pattern=ZR)}),n._zod.check=l=>{const c=l.value;if(t){if(!Number.isInteger(c)){l.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?l.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}):l.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&&l.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),c>o&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inclusive:!0,inst:n,continue:!e.abort})}}),jR=k("$ZodCheckMaxLength",(n,e)=>{var t;kt.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!f0(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 a=g0(i);r.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),GR=k("$ZodCheckMinLength",(n,e)=>{var t;kt.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!f0(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 a=g0(i);r.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),YR=k("$ZodCheckLengthEquals",(n,e)=>{var t;kt.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!f0(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,o=i.length;if(o===e.length)return;const a=g0(i),l=o>e.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Tp=k("$ZodCheckStringFormat",(n,e)=>{var t,r;kt.init(n,e),n._zod.onattach.push(i=>{const o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.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=()=>{})}),JR=k("$ZodCheckRegex",(n,e)=>{Tp.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})}}),KR=k("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=VR),Tp.init(n,e)}),XR=k("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=BR),Tp.init(n,e)}),QR=k("$ZodCheckIncludes",(n,e)=>{kt.init(n,e);const t=Wa(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.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})}}),eI=k("$ZodCheckStartsWith",(n,e)=>{kt.init(n,e);const t=new RegExp(`^${Wa(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})}}),tI=k("$ZodCheckEndsWith",(n,e)=>{kt.init(n,e);const t=new RegExp(`.*${Wa(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})}}),nI=k("$ZodCheckOverwrite",(n,e)=>{kt.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class rI{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
|
+
`).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),o=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of o)this.content.push(a)}compile(){const e=Function,t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new e(...t,i.join(`
|
|
6
|
+
`))}}const iI={major:4,minor:3,patch:6},Ee=k("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=iI;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const o of r)for(const a of o._zod.onattach)a(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 o=(l,c,d)=>{let p=Uo(l),g;for(const y of c){if(y._zod.def.when){if(!y._zod.def.when(l))continue}else if(p)continue;const v=l.issues.length,A=y._zod.check(l);if(A instanceof Promise&&(d==null?void 0:d.async)===!1)throw new qo;if(g||A instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await A,l.issues.length!==v&&(p||(p=Uo(l,v)))});else{if(l.issues.length===v)continue;p||(p=Uo(l,v))}}return g?g.then(()=>l):l},a=(l,c,d)=>{if(Uo(l))return l.aborted=!0,l;const p=o(c,r,d);if(p instanceof Promise){if(d.async===!1)throw new qo;return p.then(g=>n._zod.parse(g,d))}return n._zod.parse(p,d)};n._zod.run=(l,c)=>{if(c.skipChecks)return n._zod.parse(l,c);if(c.direction==="backward"){const p=n._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return p instanceof Promise?p.then(g=>a(g,l,c)):a(p,l,c)}const d=n._zod.parse(l,c);if(d instanceof Promise){if(c.async===!1)throw new qo;return d.then(p=>o(p,r,c))}return o(d,r,c)}}ue(n,"~standard",()=>({validate:o=>{var a;try{const l=uR(n,o);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return hR(n,o).then(c=>{var d;return c.success?{value:c.data}:{issues:(d=c.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),w0=k("$ZodString",(n,e)=>{var t;Ee.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??FR(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}}),_e=k("$ZodStringFormat",(n,e)=>{Tp.init(n,e),w0.init(n,e)}),sI=k("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=TR),_e.init(n,e)}),oI=k("$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=Y1(r))}else e.pattern??(e.pattern=Y1());_e.init(n,e)}),aI=k("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=$R),_e.init(n,e)}),lI=k("$ZodURL",(n,e)=>{_e.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})}}}),cI=k("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=IR()),_e.init(n,e)}),uI=k("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=kR),_e.init(n,e)}),hI=k("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=bR),_e.init(n,e)}),dI=k("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=SR),_e.init(n,e)}),pI=k("$ZodULID",(n,e)=>{e.pattern??(e.pattern=_R),_e.init(n,e)}),fI=k("$ZodXID",(n,e)=>{e.pattern??(e.pattern=AR),_e.init(n,e)}),mI=k("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=ER),_e.init(n,e)}),gI=k("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=UR(e)),_e.init(n,e)}),vI=k("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=NR),_e.init(n,e)}),yI=k("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=zR(e)),_e.init(n,e)}),wI=k("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=CR),_e.init(n,e)}),bI=k("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=xR),_e.init(n,e),n._zod.bag.format="ipv4"}),SI=k("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=PR),_e.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})}}}),_I=k("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=LR),_e.init(n,e)}),AI=k("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=DR),_e.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>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 n2(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const EI=k("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=OR),_e.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{n2(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function kI(n){if(!Yb.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return n2(t)}const CI=k("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Yb),_e.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{kI(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),TI=k("$ZodE164",(n,e)=>{e.pattern??(e.pattern=MR),_e.init(n,e)});function $I(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 RI=k("$ZodJWT",(n,e)=>{_e.init(n,e),n._zod.check=t=>{$I(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),r2=k("$ZodNumber",(n,e)=>{Ee.init(n,e),n._zod.pattern=n._zod.bag.pattern??Xb,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 o=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,...o?{received:o}:{}}),t}}),II=k("$ZodNumberFormat",(n,e)=>{WR.init(n,e),r2.init(n,e)}),xI=k("$ZodBoolean",(n,e)=>{Ee.init(n,e),n._zod.pattern=HR,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}}),PI=k("$ZodUnknown",(n,e)=>{Ee.init(n,e),n._zod.parse=t=>t}),LI=k("$ZodNever",(n,e)=>{Ee.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function J1(n,e,t){n.issues.length&&e.issues.push(...Fo(t,n.issues)),e.value[t]=n.value}const DI=k("$ZodArray",(n,e)=>{Ee.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 o=[];for(let a=0;a<i.length;a++){const l=i[a],c=e.element._zod.run({value:l,issues:[]},r);c instanceof Promise?o.push(c.then(d=>J1(d,t,a))):J1(c,t,a)}return o.length?Promise.all(o).then(()=>t):t}});function hd(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Fo(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function i2(n){var r,i,o,a;const e=Object.keys(n.shape);for(const l of e)if(!((a=(o=(i=(r=n.shape)==null?void 0:r[l])==null?void 0:i._zod)==null?void 0:o.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const t=Q4(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function s2(n,e,t,r,i,o){const a=[],l=i.keySet,c=i.catchall._zod,d=c.def.type,p=c.optout==="optional";for(const g in e){if(l.has(g))continue;if(d==="never"){a.push(g);continue}const y=c.run({value:e[g],issues:[]},r);y instanceof Promise?n.push(y.then(v=>hd(v,t,g,e,p))):hd(y,t,g,e,p)}return a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o}),n.length?Promise.all(n).then(()=>t):t}const OI=k("$ZodObject",(n,e)=>{Ee.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const l=e.shape;Object.defineProperty(e,"shape",{get:()=>{const c={...l};return Object.defineProperty(e,"shape",{value:c}),c}})}const r=Ep(()=>i2(e));ue(n._zod,"propValues",()=>{const l=e.shape,c={};for(const d in l){const p=l[d]._zod;if(p.values){c[d]??(c[d]=new Set);for(const g of p.values)c[d].add(g)}}return c});const i=ic,o=e.catchall;let a;n._zod.parse=(l,c)=>{a??(a=r.value);const d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:n}),l;l.value={};const p=[],g=a.shape;for(const y of a.keys){const v=g[y],A=v._zod.optout==="optional",E=v._zod.run({value:d[y],issues:[]},c);E instanceof Promise?p.push(E.then(x=>hd(x,l,y,d,A))):hd(E,l,y,d,A)}return o?s2(p,d,l,c,r.value,n):p.length?Promise.all(p).then(()=>l):l}}),MI=k("$ZodObjectJIT",(n,e)=>{OI.init(n,e);const t=n._zod.parse,r=Ep(()=>i2(e)),i=y=>{var J;const v=new rI(["shape","payload","ctx"]),A=r.value,E=O=>{const Y=G1(O);return`shape[${Y}]._zod.run({ value: input[${Y}], issues: [] }, ctx)`};v.write("const input = payload.value;");const x=Object.create(null);let B=0;for(const O of A.keys)x[O]=`key_${B++}`;v.write("const newResult = {};");for(const O of A.keys){const Y=x[O],Z=G1(O),j=y[O],fe=((J=j==null?void 0:j._zod)==null?void 0:J.optout)==="optional";v.write(`const ${Y} = ${E(O)};`),fe?v.write(`
|
|
7
|
+
if (${Y}.issues.length) {
|
|
8
|
+
if (${Z} in input) {
|
|
9
|
+
payload.issues = payload.issues.concat(${Y}.issues.map(iss => ({
|
|
10
|
+
...iss,
|
|
11
|
+
path: iss.path ? [${Z}, ...iss.path] : [${Z}]
|
|
12
|
+
})));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (${Y}.value === undefined) {
|
|
17
|
+
if (${Z} in input) {
|
|
18
|
+
newResult[${Z}] = undefined;
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
newResult[${Z}] = ${Y}.value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
`):v.write(`
|
|
25
|
+
if (${Y}.issues.length) {
|
|
26
|
+
payload.issues = payload.issues.concat(${Y}.issues.map(iss => ({
|
|
27
|
+
...iss,
|
|
28
|
+
path: iss.path ? [${Z}, ...iss.path] : [${Z}]
|
|
29
|
+
})));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (${Y}.value === undefined) {
|
|
33
|
+
if (${Z} in input) {
|
|
34
|
+
newResult[${Z}] = undefined;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
newResult[${Z}] = ${Y}.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
`)}v.write("payload.value = newResult;"),v.write("return payload;");const P=v.compile();return(O,Y)=>P(y,O,Y)};let o;const a=ic,l=!Hb.jitless,d=l&&K4.value,p=e.catchall;let g;n._zod.parse=(y,v)=>{g??(g=r.value);const A=y.value;return a(A)?l&&d&&(v==null?void 0:v.async)===!1&&v.jitless!==!0?(o||(o=i(e.shape)),y=o(y,v),p?s2([],A,y,v,g,n):y):t(y,v):(y.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),y)}});function K1(n,e,t,r){for(const o of n)if(o.issues.length===0)return e.value=o.value,e;const i=n.filter(o=>!Uo(o));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(o=>o.issues.map(a=>Hi(a,r,Zi())))}),e)}const o2=k("$ZodUnion",(n,e)=>{Ee.init(n,e),ue(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ue(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ue(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ue(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>m0(o.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,o)=>{if(t)return r(i,o);let a=!1;const l=[];for(const c of e.options){const d=c._zod.run({value:i.value,issues:[]},o);if(d instanceof Promise)l.push(d),a=!0;else{if(d.issues.length===0)return d;l.push(d)}}return a?Promise.all(l).then(c=>K1(c,i,n,o)):K1(l,i,n,o)}}),NI=k("$ZodDiscriminatedUnion",(n,e)=>{e.inclusive=!1,o2.init(n,e);const t=n._zod.parse;ue(n._zod,"propValues",()=>{const i={};for(const o of e.options){const a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const[l,c]of Object.entries(a)){i[l]||(i[l]=new Set);for(const d of c)i[l].add(d)}}return i});const r=Ep(()=>{var a;const i=e.options,o=new Map;for(const l of i){const c=(a=l._zod.propValues)==null?void 0:a[e.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(l)}"`);for(const d of c){if(o.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);o.set(d,l)}}return o});n._zod.parse=(i,o)=>{const a=i.value;if(!ic(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:n}),i;const l=r.value.get(a==null?void 0:a[e.discriminator]);return l?l._zod.run(i,o):e.unionFallback?t(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:n}),i)}}),zI=k("$ZodIntersection",(n,e)=>{Ee.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,o=e.left._zod.run({value:i,issues:[]},r),a=e.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([c,d])=>X1(t,c,d)):X1(t,o,a)}});function um(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(qa(n)&&qa(e)){const t=Object.keys(e),r=Object.keys(n).filter(o=>t.indexOf(o)!==-1),i={...n,...e};for(const o of r){const a=um(n[o],e[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.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],o=e[r],a=um(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};t.push(a.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function X1(n,e,t){const r=new Map;let i;for(const l of e.issues)if(l.code==="unrecognized_keys"){i??(i=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(l);for(const l of t.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(l);const o=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(o.length&&i&&n.issues.push({...i,keys:o}),Uo(n))return n;const a=um(e.value,t.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return n.value=a.data,n}const UI=k("$ZodRecord",(n,e)=>{Ee.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!qa(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const o=[],a=e.keyType._zod.values;if(a){t.value={};const l=new Set;for(const d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){l.add(typeof d=="number"?d.toString():d);const p=e.valueType._zod.run({value:i[d],issues:[]},r);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&t.issues.push(...Fo(d,g.issues)),t.value[d]=g.value})):(p.issues.length&&t.issues.push(...Fo(d,p.issues)),t.value[d]=p.value)}let c;for(const d in i)l.has(d)||(c=c??[],c.push(d));c&&c.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{t.value={};for(const l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let c=e.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Xb.test(l)&&c.issues.length){const g=e.keyType._zod.run({value:Number(l),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(c=g)}if(c.issues.length){e.mode==="loose"?t.value[l]=i[l]:t.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(g=>Hi(g,r,Zi())),input:l,path:[l],inst:n});continue}const p=e.valueType._zod.run({value:i[l],issues:[]},r);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&t.issues.push(...Fo(l,g.issues)),t.value[c.value]=g.value})):(p.issues.length&&t.issues.push(...Fo(l,p.issues)),t.value[c.value]=p.value)}}return o.length?Promise.all(o).then(()=>t):t}}),FI=k("$ZodEnum",(n,e)=>{Ee.init(n,e);const t=Vb(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>X4.has(typeof i)).map(i=>typeof i=="string"?Wa(i):i.toString()).join("|")})$`),n._zod.parse=(i,o)=>{const a=i.value;return r.has(a)||i.issues.push({code:"invalid_value",values:t,input:a,inst:n}),i}}),ZI=k("$ZodLiteral",(n,e)=>{if(Ee.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"?Wa(r):r?Wa(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const o=r.value;return t.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:n}),r}}),HI=k("$ZodTransform",(n,e)=>{Ee.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Zb(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(t.value=a,t));if(i instanceof Promise)throw new qo;return t.value=i,t}});function Q1(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const a2=k("$ZodOptional",(n,e)=>{Ee.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ue(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ue(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${m0(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(o=>Q1(o,t.value)):Q1(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),VI=k("$ZodExactOptional",(n,e)=>{a2.init(n,e),ue(n._zod,"values",()=>e.innerType._zod.values),ue(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),BI=k("$ZodNullable",(n,e)=>{Ee.init(n,e),ue(n._zod,"optin",()=>e.innerType._zod.optin),ue(n._zod,"optout",()=>e.innerType._zod.optout),ue(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${m0(t.source)}|null)$`):void 0}),ue(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)}),qI=k("$ZodDefault",(n,e)=>{Ee.init(n,e),n._zod.optin="optional",ue(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(o=>ey(o,e)):ey(i,e)}});function ey(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const WI=k("$ZodPrefault",(n,e)=>{Ee.init(n,e),n._zod.optin="optional",ue(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))}),jI=k("$ZodNonOptional",(n,e)=>{Ee.init(n,e),ue(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(o=>ty(o,n)):ty(i,n)}});function ty(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 GI=k("$ZodCatch",(n,e)=>{Ee.init(n,e),ue(n._zod,"optin",()=>e.innerType._zod.optin),ue(n._zod,"optout",()=>e.innerType._zod.optout),ue(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(o=>(t.value=o.value,o.issues.length&&(t.value=e.catchValue({...t,error:{issues:o.issues.map(a=>Hi(a,r,Zi()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(o=>Hi(o,r,Zi()))},input:t.value}),t.issues=[]),t)}}),YI=k("$ZodPipe",(n,e)=>{Ee.init(n,e),ue(n._zod,"values",()=>e.in._zod.values),ue(n._zod,"optin",()=>e.in._zod.optin),ue(n._zod,"optout",()=>e.out._zod.optout),ue(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const o=e.out._zod.run(t,r);return o instanceof Promise?o.then(a=>th(a,e.in,r)):th(o,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(o=>th(o,e.out,r)):th(i,e.out,r)}});function th(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const JI=k("$ZodReadonly",(n,e)=>{Ee.init(n,e),ue(n._zod,"propValues",()=>e.innerType._zod.propValues),ue(n._zod,"values",()=>e.innerType._zod.values),ue(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ue(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(ny):ny(i)}});function ny(n){return n.value=Object.freeze(n.value),n}const KI=k("$ZodCustom",(n,e)=>{kt.init(n,e),Ee.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(o=>ry(o,t,r,n));ry(i,t,r,n)}});function ry(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(sc(i))}}var iy;class XI{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 QI(){return new XI}(iy=globalThis).__zod_globalRegistry??(iy.__zod_globalRegistry=QI());const Pl=globalThis.__zod_globalRegistry;function ex(n,e){return new n({type:"string",...F(e)})}function tx(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...F(e)})}function sy(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...F(e)})}function nx(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...F(e)})}function rx(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...F(e)})}function ix(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...F(e)})}function sx(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...F(e)})}function ox(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...F(e)})}function ax(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...F(e)})}function lx(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...F(e)})}function cx(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...F(e)})}function ux(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...F(e)})}function hx(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...F(e)})}function dx(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...F(e)})}function px(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...F(e)})}function fx(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...F(e)})}function mx(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...F(e)})}function gx(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...F(e)})}function vx(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...F(e)})}function yx(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...F(e)})}function wx(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...F(e)})}function bx(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...F(e)})}function Sx(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...F(e)})}function _x(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...F(e)})}function Ax(n,e){return new n({type:"string",format:"date",check:"string_format",...F(e)})}function Ex(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...F(e)})}function kx(n,e){return new n({type:"string",format:"duration",check:"string_format",...F(e)})}function Cx(n,e){return new n({type:"number",checks:[],...F(e)})}function Tx(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...F(e)})}function $x(n,e){return new n({type:"boolean",...F(e)})}function Rx(n){return new n({type:"unknown"})}function Ix(n,e){return new n({type:"never",...F(e)})}function oy(n,e){return new e2({check:"less_than",...F(e),value:n,inclusive:!1})}function Rf(n,e){return new e2({check:"less_than",...F(e),value:n,inclusive:!0})}function ay(n,e){return new t2({check:"greater_than",...F(e),value:n,inclusive:!1})}function If(n,e){return new t2({check:"greater_than",...F(e),value:n,inclusive:!0})}function ly(n,e){return new qR({check:"multiple_of",...F(e),value:n})}function l2(n,e){return new jR({check:"max_length",...F(e),maximum:n})}function dd(n,e){return new GR({check:"min_length",...F(e),minimum:n})}function c2(n,e){return new YR({check:"length_equals",...F(e),length:n})}function xx(n,e){return new JR({check:"string_format",format:"regex",...F(e),pattern:n})}function Px(n){return new KR({check:"string_format",format:"lowercase",...F(n)})}function Lx(n){return new XR({check:"string_format",format:"uppercase",...F(n)})}function Dx(n,e){return new QR({check:"string_format",format:"includes",...F(e),includes:n})}function Ox(n,e){return new eI({check:"string_format",format:"starts_with",...F(e),prefix:n})}function Mx(n,e){return new tI({check:"string_format",format:"ends_with",...F(e),suffix:n})}function sl(n){return new nI({check:"overwrite",tx:n})}function Nx(n){return sl(e=>e.normalize(n))}function zx(){return sl(n=>n.trim())}function Ux(){return sl(n=>n.toLowerCase())}function Fx(){return sl(n=>n.toUpperCase())}function Zx(){return sl(n=>J4(n))}function Hx(n,e,t){return new n({type:"array",element:e,...F(t)})}function Vx(n,e,t){return new n({type:"custom",check:"custom",fn:e,...F(t)})}function Bx(n){const e=qx(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(sc(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(sc(i))}},n(t.value,t)));return e}function qx(n,e){const t=new kt({check:"custom",...F(e)});return t._zod.check=n,t}function u2(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)??Pl,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 Le(n,e,t={path:[],schemaPath:[]}){var p,g;var r;const i=n._zod.def,o=e.seen.get(n);if(o)return o.count++,t.schemaPath.includes(n)&&(o.cycle=t.path),o.schema;const a={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,a);const l=(g=(p=n._zod).toJSONSchema)==null?void 0:g.call(p);if(l)a.schema=l;else{const y={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,a.schema,y);else{const A=a.schema,E=e.processors[i.type];if(!E)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);E(n,e,A,y)}const v=n._zod.parent;v&&(a.ref||(a.ref=v),Le(v,e,y),e.seen.get(v).isParent=!0)}const c=e.metadataRegistry.get(n);return c&&Object.assign(a.schema,c),e.io==="input"&&et(n)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(n).schema}function h2(n,e){var a,l,c,d;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 p of n.seen.entries()){const g=(a=n.metadataRegistry.get(p[0]))==null?void 0:a.id;if(g){const y=r.get(g);if(y&&y!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,p[0])}}const i=p=>{var E;const g=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const x=(E=n.external.registry.get(p[0]))==null?void 0:E.id,B=n.external.uri??(J=>J);if(x)return{ref:B(x)};const P=p[1].defId??p[1].schema.id??`schema${n.counter++}`;return p[1].defId=P,{defId:P,ref:`${B("__shared")}#/${g}/${P}`}}if(p[1]===t)return{ref:"#"};const v=`#/${g}/`,A=p[1].schema.id??`__schema${n.counter++}`;return{defId:A,ref:v+A}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:y,defId:v}=i(p);g.def={...g.schema},v&&(g.defId=v);const A=g.schema;for(const E in A)delete A[E];A.$ref=y};if(n.cycles==="throw")for(const p of n.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(l=g.cycle)==null?void 0:l.join("/")}/<root>
|
|
41
|
+
|
|
42
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of n.seen.entries()){const g=p[1];if(e===p[0]){o(p);continue}if(n.external){const v=(c=n.external.registry.get(p[0]))==null?void 0:c.id;if(e!==p[0]&&v){o(p);continue}}if((d=n.metadataRegistry.get(p[0]))==null?void 0:d.id){o(p);continue}if(g.cycle){o(p);continue}if(g.count>1&&n.reused==="ref"){o(p);continue}}}function d2(n,e){var a,l,c;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=d=>{const p=n.seen.get(d);if(p.ref===null)return;const g=p.def??p.schema,y={...g},v=p.ref;if(p.ref=null,v){r(v);const E=n.seen.get(v),x=E.schema;if(x.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(x)):Object.assign(g,x),Object.assign(g,y),d._zod.parent===v)for(const P in g)P==="$ref"||P==="allOf"||P in y||delete g[P];if(x.$ref&&E.def)for(const P in g)P==="$ref"||P==="allOf"||P in E.def&&JSON.stringify(g[P])===JSON.stringify(E.def[P])&&delete g[P]}const A=d._zod.parent;if(A&&A!==v){r(A);const E=n.seen.get(A);if(E!=null&&E.schema.$ref&&(g.$ref=E.schema.$ref,E.def))for(const x in g)x==="$ref"||x==="allOf"||x in E.def&&JSON.stringify(g[x])===JSON.stringify(E.def[x])&&delete g[x]}n.override({zodSchema:d,jsonSchema:g,path:p.path??[]})};for(const d of[...n.seen.entries()].reverse())r(d[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,(a=n.external)!=null&&a.uri){const d=(l=n.external.registry.get(e))==null?void 0:l.id;if(!d)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(d)}Object.assign(i,t.def??t.schema);const o=((c=n.external)==null?void 0:c.defs)??{};for(const d of n.seen.entries()){const p=d[1];p.def&&p.defId&&(o[p.defId]=p.def)}n.external||Object.keys(o).length>0&&(n.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const d=JSON.parse(JSON.stringify(i));return Object.defineProperty(d,"~standard",{value:{...e["~standard"],jsonSchema:{input:pd(e,"input",n.processors),output:pd(e,"output",n.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function et(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 et(r.element,t);if(r.type==="set")return et(r.valueType,t);if(r.type==="lazy")return et(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 et(r.innerType,t);if(r.type==="intersection")return et(r.left,t)||et(r.right,t);if(r.type==="record"||r.type==="map")return et(r.keyType,t)||et(r.valueType,t);if(r.type==="pipe")return et(r.in,t)||et(r.out,t);if(r.type==="object"){for(const i in r.shape)if(et(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(et(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(et(i,t))return!0;return!!(r.rest&&et(r.rest,t))}return!1}const Wx=(n,e={})=>t=>{const r=u2({...t,processors:e});return Le(n,r),h2(r,n),d2(r,n)},pd=(n,e,t={})=>r=>{const{libraryOptions:i,target:o}=r??{},a=u2({...i??{},target:o,io:e,processors:t});return Le(n,a),h2(a,n),d2(a,n)},jx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gx=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:o,maximum:a,format:l,patterns:c,contentEncoding:d}=n._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),l&&(i.format=jx[l]??l,i.format===""&&delete i.format,l==="time"&&delete i.format),d&&(i.contentEncoding=d),c&&c.size>0){const p=[...c];p.length===1?i.pattern=p[0].source:p.length>1&&(i.allOf=[...p.map(g=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},Yx=(n,e,t,r)=>{const i=t,{minimum:o,maximum:a,format:l,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:p}=n._zod.bag;typeof l=="string"&&l.includes("int")?i.type="integer":i.type="number",typeof p=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=p,i.exclusiveMinimum=!0):i.exclusiveMinimum=p),typeof o=="number"&&(i.minimum=o,typeof p=="number"&&e.target!=="draft-04"&&(p>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof d=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=d,i.exclusiveMaximum=!0):i.exclusiveMaximum=d),typeof a=="number"&&(i.maximum=a,typeof d=="number"&&e.target!=="draft-04"&&(d<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},Jx=(n,e,t,r)=>{t.type="boolean"},Kx=(n,e,t,r)=>{t.not={}},Xx=(n,e,t,r)=>{},Qx=(n,e,t,r)=>{const i=n._zod.def,o=Vb(i.entries);o.every(a=>typeof a=="number")&&(t.type="number"),o.every(a=>typeof a=="string")&&(t.type="string"),t.enum=o},e3=(n,e,t,r)=>{const i=n._zod.def,o=[];for(const a of i.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){const a=o[0];t.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[a]:t.const=a}else o.every(a=>typeof a=="number")&&(t.type="number"),o.every(a=>typeof a=="string")&&(t.type="string"),o.every(a=>typeof a=="boolean")&&(t.type="boolean"),o.every(a=>a===null)&&(t.type="null"),t.enum=o},t3=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},n3=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},r3=(n,e,t,r)=>{const i=t,o=n._zod.def,{minimum:a,maximum:l}=n._zod.bag;typeof a=="number"&&(i.minItems=a),typeof l=="number"&&(i.maxItems=l),i.type="array",i.items=Le(o.element,e,{...r,path:[...r.path,"items"]})},i3=(n,e,t,r)=>{var d;const i=t,o=n._zod.def;i.type="object",i.properties={};const a=o.shape;for(const p in a)i.properties[p]=Le(a[p],e,{...r,path:[...r.path,"properties",p]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(p=>{const g=o.shape[p]._zod;return e.io==="input"?g.optin===void 0:g.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((d=o.catchall)==null?void 0:d._zod.def.type)==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Le(o.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},s3=(n,e,t,r)=>{const i=n._zod.def,o=i.inclusive===!1,a=i.options.map((l,c)=>Le(l,e,{...r,path:[...r.path,o?"oneOf":"anyOf",c]}));o?t.oneOf=a:t.anyOf=a},o3=(n,e,t,r)=>{const i=n._zod.def,o=Le(i.left,e,{...r,path:[...r.path,"allOf",0]}),a=Le(i.right,e,{...r,path:[...r.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(o)?o.allOf:[o],...l(a)?a.allOf:[a]];t.allOf=c},a3=(n,e,t,r)=>{const i=t,o=n._zod.def;i.type="object";const a=o.keyType,l=a._zod.bag,c=l==null?void 0:l.patterns;if(o.mode==="loose"&&c&&c.size>0){const p=Le(o.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const g of c)i.patternProperties[g.source]=p}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Le(o.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Le(o.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const d=a._zod.values;if(d){const p=[...d].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(i.required=p)}},l3=(n,e,t,r)=>{const i=n._zod.def,o=Le(i.innerType,e,r),a=e.seen.get(n);e.target==="openapi-3.0"?(a.ref=i.innerType,t.nullable=!0):t.anyOf=[o,{type:"null"}]},c3=(n,e,t,r)=>{const i=n._zod.def;Le(i.innerType,e,r);const o=e.seen.get(n);o.ref=i.innerType},u3=(n,e,t,r)=>{const i=n._zod.def;Le(i.innerType,e,r);const o=e.seen.get(n);o.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},h3=(n,e,t,r)=>{const i=n._zod.def;Le(i.innerType,e,r);const o=e.seen.get(n);o.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},d3=(n,e,t,r)=>{const i=n._zod.def;Le(i.innerType,e,r);const o=e.seen.get(n);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a},p3=(n,e,t,r)=>{const i=n._zod.def,o=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Le(o,e,r);const a=e.seen.get(n);a.ref=o},f3=(n,e,t,r)=>{const i=n._zod.def;Le(i.innerType,e,r);const o=e.seen.get(n);o.ref=i.innerType,t.readOnly=!0},p2=(n,e,t,r)=>{const i=n._zod.def;Le(i.innerType,e,r);const o=e.seen.get(n);o.ref=i.innerType},m3=k("ZodISODateTime",(n,e)=>{gI.init(n,e),Ce.init(n,e)});function g3(n){return _x(m3,n)}const v3=k("ZodISODate",(n,e)=>{vI.init(n,e),Ce.init(n,e)});function y3(n){return Ax(v3,n)}const w3=k("ZodISOTime",(n,e)=>{yI.init(n,e),Ce.init(n,e)});function b3(n){return Ex(w3,n)}const S3=k("ZodISODuration",(n,e)=>{wI.init(n,e),Ce.init(n,e)});function _3(n){return kx(S3,n)}const f2=(n,e)=>{jb.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>cR(n,t)},flatten:{value:t=>lR(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,cm,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,cm,2)}},isEmpty:{get(){return n.issues.length===0}}})},cy=k("ZodError",f2),rn=k("ZodError",f2,{Parent:Error}),A3=v0(rn),E3=y0(rn),k3=kp(rn),C3=Cp(rn),T3=dR(rn),$3=pR(rn),R3=fR(rn),I3=mR(rn),x3=gR(rn),P3=vR(rn),L3=yR(rn),D3=wR(rn),ke=k("ZodType",(n,e)=>(Ee.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:pd(n,"input"),output:pd(n,"output")}}),n.toJSONSchema=Wx(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(Gi(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)=>Yi(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>A3(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>k3(n,t,r),n.parseAsync=async(t,r)=>E3(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>C3(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>T3(n,t,r),n.decode=(t,r)=>$3(n,t,r),n.encodeAsync=async(t,r)=>R3(n,t,r),n.decodeAsync=async(t,r)=>I3(n,t,r),n.safeEncode=(t,r)=>x3(n,t,r),n.safeDecode=(t,r)=>P3(n,t,r),n.safeEncodeAsync=async(t,r)=>L3(n,t,r),n.safeDecodeAsync=async(t,r)=>D3(n,t,r),n.refine=(t,r)=>n.check(CP(t,r)),n.superRefine=t=>n.check(TP(t)),n.overwrite=t=>n.check(sl(t)),n.optional=()=>dy(n),n.exactOptional=()=>pP(n),n.nullable=()=>py(n),n.nullish=()=>dy(py(n)),n.nonoptional=t=>wP(n,t),n.array=()=>N(n),n.or=t=>X([n,t]),n.and=t=>$p(n,t),n.transform=t=>fy(n,hP(t)),n.default=t=>gP(n,t),n.prefault=t=>yP(n,t),n.catch=t=>SP(n,t),n.pipe=t=>fy(n,t),n.readonly=()=>EP(n),n.describe=t=>{const r=n.clone();return Pl.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Pl.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Pl.get(n);const r=n.clone();return Pl.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),m2=k("_ZodString",(n,e)=>{w0.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(r,i,o)=>Gx(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(xx(...r)),n.includes=(...r)=>n.check(Dx(...r)),n.startsWith=(...r)=>n.check(Ox(...r)),n.endsWith=(...r)=>n.check(Mx(...r)),n.min=(...r)=>n.check(dd(...r)),n.max=(...r)=>n.check(l2(...r)),n.length=(...r)=>n.check(c2(...r)),n.nonempty=(...r)=>n.check(dd(1,...r)),n.lowercase=r=>n.check(Px(r)),n.uppercase=r=>n.check(Lx(r)),n.trim=()=>n.check(zx()),n.normalize=(...r)=>n.check(Nx(...r)),n.toLowerCase=()=>n.check(Ux()),n.toUpperCase=()=>n.check(Fx()),n.slugify=()=>n.check(Zx())}),O3=k("ZodString",(n,e)=>{w0.init(n,e),m2.init(n,e),n.email=t=>n.check(tx(M3,t)),n.url=t=>n.check(ox(N3,t)),n.jwt=t=>n.check(Sx(X3,t)),n.emoji=t=>n.check(ax(z3,t)),n.guid=t=>n.check(sy(uy,t)),n.uuid=t=>n.check(nx(nh,t)),n.uuidv4=t=>n.check(rx(nh,t)),n.uuidv6=t=>n.check(ix(nh,t)),n.uuidv7=t=>n.check(sx(nh,t)),n.nanoid=t=>n.check(lx(U3,t)),n.guid=t=>n.check(sy(uy,t)),n.cuid=t=>n.check(cx(F3,t)),n.cuid2=t=>n.check(ux(Z3,t)),n.ulid=t=>n.check(hx(H3,t)),n.base64=t=>n.check(yx(Y3,t)),n.base64url=t=>n.check(wx(J3,t)),n.xid=t=>n.check(dx(V3,t)),n.ksuid=t=>n.check(px(B3,t)),n.ipv4=t=>n.check(fx(q3,t)),n.ipv6=t=>n.check(mx(W3,t)),n.cidrv4=t=>n.check(gx(j3,t)),n.cidrv6=t=>n.check(vx(G3,t)),n.e164=t=>n.check(bx(K3,t)),n.datetime=t=>n.check(g3(t)),n.date=t=>n.check(y3(t)),n.time=t=>n.check(b3(t)),n.duration=t=>n.check(_3(t))});function m(n){return ex(O3,n)}const Ce=k("ZodStringFormat",(n,e)=>{_e.init(n,e),m2.init(n,e)}),M3=k("ZodEmail",(n,e)=>{aI.init(n,e),Ce.init(n,e)}),uy=k("ZodGUID",(n,e)=>{sI.init(n,e),Ce.init(n,e)}),nh=k("ZodUUID",(n,e)=>{oI.init(n,e),Ce.init(n,e)}),N3=k("ZodURL",(n,e)=>{lI.init(n,e),Ce.init(n,e)}),z3=k("ZodEmoji",(n,e)=>{cI.init(n,e),Ce.init(n,e)}),U3=k("ZodNanoID",(n,e)=>{uI.init(n,e),Ce.init(n,e)}),F3=k("ZodCUID",(n,e)=>{hI.init(n,e),Ce.init(n,e)}),Z3=k("ZodCUID2",(n,e)=>{dI.init(n,e),Ce.init(n,e)}),H3=k("ZodULID",(n,e)=>{pI.init(n,e),Ce.init(n,e)}),V3=k("ZodXID",(n,e)=>{fI.init(n,e),Ce.init(n,e)}),B3=k("ZodKSUID",(n,e)=>{mI.init(n,e),Ce.init(n,e)}),q3=k("ZodIPv4",(n,e)=>{bI.init(n,e),Ce.init(n,e)}),W3=k("ZodIPv6",(n,e)=>{SI.init(n,e),Ce.init(n,e)}),j3=k("ZodCIDRv4",(n,e)=>{_I.init(n,e),Ce.init(n,e)}),G3=k("ZodCIDRv6",(n,e)=>{AI.init(n,e),Ce.init(n,e)}),Y3=k("ZodBase64",(n,e)=>{EI.init(n,e),Ce.init(n,e)}),J3=k("ZodBase64URL",(n,e)=>{CI.init(n,e),Ce.init(n,e)}),K3=k("ZodE164",(n,e)=>{TI.init(n,e),Ce.init(n,e)}),X3=k("ZodJWT",(n,e)=>{RI.init(n,e),Ce.init(n,e)}),g2=k("ZodNumber",(n,e)=>{r2.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(r,i,o)=>Yx(n,r,i),n.gt=(r,i)=>n.check(ay(r,i)),n.gte=(r,i)=>n.check(If(r,i)),n.min=(r,i)=>n.check(If(r,i)),n.lt=(r,i)=>n.check(oy(r,i)),n.lte=(r,i)=>n.check(Rf(r,i)),n.max=(r,i)=>n.check(Rf(r,i)),n.int=r=>n.check(hy(r)),n.safe=r=>n.check(hy(r)),n.positive=r=>n.check(ay(0,r)),n.nonnegative=r=>n.check(If(0,r)),n.negative=r=>n.check(oy(0,r)),n.nonpositive=r=>n.check(Rf(0,r)),n.multipleOf=(r,i)=>n.check(ly(r,i)),n.step=(r,i)=>n.check(ly(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 G(n){return Cx(g2,n)}const Q3=k("ZodNumberFormat",(n,e)=>{II.init(n,e),g2.init(n,e)});function hy(n){return Tx(Q3,n)}const eP=k("ZodBoolean",(n,e)=>{xI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Jx(n,t,r)});function He(n){return $x(eP,n)}const tP=k("ZodUnknown",(n,e)=>{PI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Xx()});function S(){return Rx(tP)}const nP=k("ZodNever",(n,e)=>{LI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Kx(n,t,r)});function rP(n){return Ix(nP,n)}const iP=k("ZodArray",(n,e)=>{DI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>r3(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(dd(t,r)),n.nonempty=t=>n.check(dd(1,t)),n.max=(t,r)=>n.check(l2(t,r)),n.length=(t,r)=>n.check(c2(t,r)),n.unwrap=()=>n.element});function N(n,e){return Hx(iP,n,e)}const v2=k("ZodObject",(n,e)=>{MI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>i3(n,t,r,i),ue(n,"shape",()=>e.shape),n.keyof=()=>b2(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:rP()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>rR(n,t),n.safeExtend=t=>iR(n,t),n.merge=t=>sR(n,t),n.pick=t=>tR(n,t),n.omit=t=>nR(n,t),n.partial=(...t)=>oR(S2,n,t[0]),n.required=(...t)=>aR(_2,n,t[0])});function y2(n,e){const t={type:"object",shape:n??{},...F(e)};return new v2(t)}function w(n,e){return new v2({type:"object",shape:n,catchall:S(),...F(e)})}const w2=k("ZodUnion",(n,e)=>{o2.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>s3(n,t,r,i),n.options=e.options});function X(n,e){return new w2({type:"union",options:n,...F(e)})}const sP=k("ZodDiscriminatedUnion",(n,e)=>{w2.init(n,e),NI.init(n,e)});function oP(n,e,t){return new sP({type:"union",options:e,discriminator:n,...F(t)})}const aP=k("ZodIntersection",(n,e)=>{zI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>o3(n,t,r,i)});function $p(n,e){return new aP({type:"intersection",left:n,right:e})}const lP=k("ZodRecord",(n,e)=>{UI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>a3(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new lP({type:"record",keyType:n,valueType:e,...F(t)})}const hm=k("ZodEnum",(n,e)=>{FI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(r,i,o)=>Qx(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 o={};for(const a of r)if(t.has(a))o[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new hm({...e,checks:[],...F(i),entries:o})},n.exclude=(r,i)=>{const o={...e.entries};for(const a of r)if(t.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new hm({...e,checks:[],...F(i),entries:o})}});function b2(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new hm({type:"enum",entries:t,...F(e)})}const cP=k("ZodLiteral",(n,e)=>{ZI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>e3(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function $(n,e){return new cP({type:"literal",values:Array.isArray(n)?n:[n],...F(e)})}const uP=k("ZodTransform",(n,e)=>{HI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>n3(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Zb(n.constructor.name);t.addIssue=o=>{if(typeof o=="string")t.issues.push(sc(o,t.value,e));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=t.value),a.inst??(a.inst=n),t.issues.push(sc(a))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(o=>(t.value=o,t)):(t.value=i,t)}});function hP(n){return new uP({type:"transform",transform:n})}const S2=k("ZodOptional",(n,e)=>{a2.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>p2(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function dy(n){return new S2({type:"optional",innerType:n})}const dP=k("ZodExactOptional",(n,e)=>{VI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>p2(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function pP(n){return new dP({type:"optional",innerType:n})}const fP=k("ZodNullable",(n,e)=>{BI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>l3(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function py(n){return new fP({type:"nullable",innerType:n})}const mP=k("ZodDefault",(n,e)=>{qI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>u3(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function gP(n,e){return new mP({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():qb(e)}})}const vP=k("ZodPrefault",(n,e)=>{WI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>h3(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function yP(n,e){return new vP({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():qb(e)}})}const _2=k("ZodNonOptional",(n,e)=>{jI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>c3(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function wP(n,e){return new _2({type:"nonoptional",innerType:n,...F(e)})}const bP=k("ZodCatch",(n,e)=>{GI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>d3(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function SP(n,e){return new bP({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const _P=k("ZodPipe",(n,e)=>{YI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>p3(n,t,r,i),n.in=e.in,n.out=e.out});function fy(n,e){return new _P({type:"pipe",in:n,out:e})}const AP=k("ZodReadonly",(n,e)=>{JI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>f3(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function EP(n){return new AP({type:"readonly",innerType:n})}const kP=k("ZodCustom",(n,e)=>{KI.init(n,e),ke.init(n,e),n._zod.processJSONSchema=(t,r,i)=>t3(n,t)});function CP(n,e={}){return Vx(kP,n,e)}function TP(n){return Bx(n)}const $P=[".md",".markdown"];function A2(n){if(n.length===0)return!1;const e=n.at(-1);return e==="/"||e==="\\"}function E2(n){const e=n.lastIndexOf("/"),t=n.lastIndexOf("\\");return n.slice(Math.max(e,t)+1)}function RP(n){return E2(n).toLowerCase()}function IP(n,e){const t=RP(n);return e.some(r=>t.endsWith(r))}function dm(n){return!A2(n)&&IP(n,$P)}function xP(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function hr(n){try{const{pathname:e}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(e)}catch{return!1}}const PP=y2({id:m().min(1),kind:$("path"),title:m(),path:m()}).strict(),LP=y2({id:m().min(1),kind:$("url"),title:m(),url:m().refine(xP,{message:"url must be an http(s) URL"})}).strict();oP("kind",[PP,LP]);const DP=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function OP(n,e){try{const t=new URL(e),r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?{kind:"web",url:r.href}:DP.has(r.protocol)?{kind:"browser-local",url:r.href}:{kind:"application",url:r.href}}catch{return{kind:"invalid"}}}function my(n,e){return OP(n,e).kind==="web"}const MP="/views/markdown/",NP="/views/url-unsupported/";function k2(n){return`/artifact/${encodeURIComponent(n)}`}function zP(n,e){return`${k2(n)}/${encodeURIComponent(e)}`}function UP(n){return`/markdown/${encodeURIComponent(n)}`}function pm(n,e={electron:!1}){if(n.kind==="url")return e.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:hr(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:NP,contentURL:null};if(dm(n.path)){const r={viewURL:MP,contentURL:UP(n.id)};return e.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const t=A2(n.path)?`${k2(n.id)}/`:zP(n.id,E2(n.path));return e.electron?{renderer:"url-webview",viewURL:t,contentURL:null}:{renderer:"proxy-iframe",viewURL:t,contentURL:null}}const FP="serverURL",ZP="token",HP="mode",VP="desktopAppVersion",BP="electron";function qP(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(FP);return r?new URL(r).origin:new URL(e).origin}function WP(n=window.location.search){return new URLSearchParams(n).get(ZP)}function Hr(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(HP)===BP}function C2(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(VP)}const gy="tv.telemetry.clientId",jP=5,GP=60,YP=1e3,JP=jP*GP*YP,vy=["pointerdown","scroll","keydown"],yy=["focus"],wy=["visibilitychange"],KP="hidden";function XP(n,e=rL){const t=n.getItem(gy);if(t)return t;const r=e();return n.setItem(gy,r),r}function QP(n){return{clientId:XP(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function eL(n){const e=new URLSearchParams;return e.set("clientId",n.clientId),e.set("userAgent",n.userAgent),e.set("clientApp",n.clientApp),n.desktopAppVersion&&e.set("desktopAppVersion",n.desktopAppVersion),e}function tL(n){return new nL(n)}var pc,gr,ii,fc,mc,zt,ys,gc,Cd,T2;class nL{constructor(e){f(this,Cd);f(this,pc);f(this,gr);f(this,ii);f(this,fc);f(this,mc);f(this,zt);f(this,ys,!1);f(this,gc,Number.NEGATIVE_INFINITY);h(this,pc,e.meta),h(this,gr,e.documentTarget),h(this,ii,e.windowTarget),h(this,fc,e.send),h(this,mc,e.nowMs??Date.now),h(this,zt,()=>u(this,Cd,T2).call(this))}start(){if(!s(this,ys)){h(this,ys,!0);for(const e of vy)s(this,ii).addEventListener(e,s(this,zt)),s(this,gr).addEventListener(e,s(this,zt));for(const e of yy)s(this,ii).addEventListener(e,s(this,zt));for(const e of wy)s(this,gr).addEventListener(e,s(this,zt))}}stop(){if(s(this,ys)){h(this,ys,!1);for(const e of vy)s(this,ii).removeEventListener(e,s(this,zt)),s(this,gr).removeEventListener(e,s(this,zt));for(const e of yy)s(this,ii).removeEventListener(e,s(this,zt));for(const e of wy)s(this,gr).removeEventListener(e,s(this,zt))}}}pc=new WeakMap,gr=new WeakMap,ii=new WeakMap,fc=new WeakMap,mc=new WeakMap,zt=new WeakMap,ys=new WeakMap,gc=new WeakMap,Cd=new WeakSet,T2=function(){if(s(this,gr).visibilityState===KP)return;const e=s(this,mc).call(this);e-s(this,gc)<JP||(h(this,gc,e),s(this,fc).call(this,{type:J$,clientId:s(this,pc).clientId}))};function rL(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():p0().toLowerCase()}const we={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"},ar={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"},iL=1,sL=w({_meta:_(m(),S()).nullish(),terminal:He().optional().default(!1)}),oL=w({_meta:_(m(),S()).nullish(),label:m().nullish(),name:m(),optional:He().optional().default(!1),secret:He().optional().default(!0)}),aL=w({_meta:_(m(),S()).nullish(),description:m().nullish(),id:m(),name:m()}),lL=w({_meta:_(m(),S()).nullish(),description:m().nullish(),id:m(),link:m().nullish(),name:m(),vars:N(oL)}),cL=w({_meta:_(m(),S()).nullish(),args:N(m()).optional(),description:m().nullish(),env:_(m(),m()).optional(),id:m(),name:m()}),uL=X([lL.and(w({type:$("env_var")})),cL.and(w({type:$("terminal")})),aL]),hL=w({_meta:_(m(),S()).nullish(),methodId:m()}),dL=w({_meta:_(m(),S()).nullish()}),pL=w({_meta:_(m(),S()).nullish(),blob:m(),mimeType:m().nullish(),uri:m()}),fL=w({default:He().nullish(),description:m().nullish(),title:m().nullish()}),mL=w({_meta:_(m(),S()).nullish()}),gL=w({_meta:_(m(),S()).nullish()}),vL=w({amount:G(),currency:m()}),yL=w({_meta:_(m(),S()).nullish(),terminalId:m()}),wL=w({_meta:_(m(),S()).nullish(),newText:m(),oldText:m().nullish(),path:m()}),bL=X([m(),G(),G(),He(),N(m())]),SL=w({content:_(m(),bL).nullish()}),_L=X([SL.and(w({action:$("accept")})),w({action:$("decline")}),w({action:$("cancel")})]),AL=w({_meta:_(m(),S()).nullish()}),$2=m(),EL=w({_meta:_(m(),S()).nullish(),elicitationId:$2}),kL=w({_meta:_(m(),S()).nullish(),action:_L}),CL=$("object"),TL=$("string"),$L=w({_meta:_(m(),S()).nullish()}),RL=w({_meta:_(m(),S()).nullish(),form:AL.nullish(),url:$L.nullish()}),IL=w({elicitationId:$2,url:m().url()}),R2=w({const:m(),title:m()}),I2=w({_meta:_(m(),S()).nullish(),name:m(),value:m()}),xL=X([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),G().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),x2=w({code:xL,data:S().optional(),message:m()}),P2=S(),L2=S(),D2=S(),PL=w({_meta:_(m(),S()).nullish(),readTextFile:He().optional().default(!1),writeTextFile:He().optional().default(!1)}),O2=w({_meta:_(m(),S()).nullish(),name:m(),value:m()}),M2=w({_meta:_(m(),S()).nullish(),name:m(),title:m().nullish(),version:m()}),LL=w({default:G().nullish(),description:m().nullish(),maximum:G().nullish(),minimum:G().nullish(),title:m().nullish()}),DL=w({_meta:_(m(),S()).nullish()}),OL=w({_meta:_(m(),S()).nullish(),additionalDirectories:N(m()).optional(),cursor:m().nullish(),cwd:m().nullish()}),ML=w({_meta:_(m(),S()).nullish()}),NL=w({_meta:_(m(),S()).nullish(),logout:ML.nullish()}),zL=w({_meta:_(m(),S()).nullish()}),UL=w({_meta:_(m(),S()).nullish()}),FL=w({_meta:_(m(),S()).nullish(),http:He().optional().default(!1),sse:He().optional().default(!1)}),ZL=w({_meta:_(m(),S()).nullish(),headers:N(O2),name:m(),url:m()}),HL=w({_meta:_(m(),S()).nullish(),headers:N(O2),name:m(),url:m()}),VL=w({_meta:_(m(),S()).nullish(),args:N(m()),command:m(),env:N(I2),name:m()}),Rp=X([ZL.and(w({type:$("http")})),HL.and(w({type:$("sse")})),VL]),b0=m(),BL=w({_meta:_(m(),S()).nullish(),description:m().nullish(),modelId:b0,name:m()}),qL=X([$("error"),$("warning"),$("information"),$("hint")]),WL=w({_meta:_(m(),S()).nullish()}),jL=w({_meta:_(m(),S()).nullish()}),GL=w({_meta:_(m(),S()).nullish()}),YL=w({_meta:_(m(),S()).nullish()}),JL=w({_meta:_(m(),S()).nullish()}),KL=w({_meta:_(m(),S()).nullish(),maxCount:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),XL=w({diff:m(),uri:m()}),QL=w({endLine:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:m()}),eD=w({_meta:_(m(),S()).nullish()}),tD=w({_meta:_(m(),S()).nullish()}),nD=w({languageId:m(),text:m(),uri:m()}),rD=w({_meta:_(m(),S()).nullish(),maxCount:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),iD=X([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),sD=w({excerpts:N(QL),uri:m()}),oD=w({_meta:_(m(),S()).nullish()}),aD=w({_meta:_(m(),S()).nullish()}),lD=w({name:m(),owner:m(),remoteUrl:m()}),cD=w({_meta:_(m(),S()).nullish()}),uD=w({_meta:_(m(),S()).nullish(),jump:eD.nullish(),rename:aD.nullish(),searchAndReplace:cD.nullish()}),hD=w({id:m(),isRegex:He().nullish(),replace:m(),search:m(),uri:m()}),dD=X([$("automatic"),$("diagnostic"),$("manual")]),pD=w({_meta:_(m(),S()).nullish(),maxCount:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),fD=w({_meta:_(m(),S()).nullish(),diagnostics:WL.nullish(),editHistory:KL.nullish(),openFiles:tD.nullish(),recentFiles:rD.nullish(),relatedSnippets:oD.nullish(),userActions:pD.nullish()}),mD=w({_meta:_(m(),S()).nullish(),additionalDirectories:N(m()).optional(),cwd:m(),mcpServers:N(Rp)}),gD=w({default:G().nullish(),description:m().nullish(),maximum:G().nullish(),minimum:G().nullish(),title:m().nullish()}),N2=m(),vD=X([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),yD=w({_meta:_(m(),S()).nullish(),kind:vD,name:m(),optionId:N2}),wD=X([$("high"),$("medium"),$("low")]),bD=X([$("pending"),$("in_progress"),$("completed")]),SD=w({_meta:_(m(),S()).nullish(),content:m(),priority:wD,status:bD}),_D=w({_meta:_(m(),S()).nullish(),entries:N(SD)}),Vi=w({character:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),AD=w({id:m(),position:Vi,uri:m()}),ED=w({id:m(),newName:m(),position:Vi,uri:m()}),kD=w({action:m(),position:Vi,timestampMs:G(),uri:m()}),z2=X([$("utf-16"),$("utf-32"),$("utf-8")]),CD=w({_meta:_(m(),S()).nullish(),auth:sL.optional().default({terminal:!1}),elicitation:RL.nullish(),fs:PL.optional().default({readTextFile:!1,writeTextFile:!1}),nes:uD.nullish(),positionEncodings:N(z2).optional(),terminal:He().optional().default(!1)}),TD=w({_meta:_(m(),S()).nullish(),audio:He().optional().default(!1),embeddedContext:He().optional().default(!1),image:He().optional().default(!1)}),U2=G().int().gte(0).lte(65535),$D=w({_meta:_(m(),S()).nullish(),clientCapabilities:CD.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:M2.nullish(),protocolVersion:U2}),ol=w({end:Vi,start:Vi}),RD=w({message:m(),range:ol,severity:qL,uri:m()}),ID=w({languageId:m(),lastFocusedMs:G().nullish(),uri:m(),visibleRange:ol.nullish()}),xD=w({_meta:_(m(),S()).nullish(),diagnostics:N(RD).nullish(),editHistory:N(XL).nullish(),openFiles:N(ID).nullish(),recentFiles:N(nD).nullish(),relatedSnippets:N(sD).nullish(),userActions:N(kD).nullish()}),PD=w({newText:m(),range:ol}),LD=w({cursorPosition:Vi.nullish(),edits:N(PD),id:m(),uri:m()}),DD=X([LD.and(w({kind:$("edit")})),AD.and(w({kind:$("jump")})),ED.and(w({kind:$("rename")})),hD.and(w({kind:$("searchAndReplace")}))]),OD=w({_meta:_(m(),S()).nullish(),content:m()}),MD=w({_meta:_(m(),S()).nullish()}),so=X([G(),m()]).nullable();w({_meta:_(m(),S()).nullish(),requestId:so});const ND=b2(["assistant","user"]),Pu=w({_meta:_(m(),S()).nullish(),audience:N(ND).nullish(),lastModified:m().nullish(),priority:G().nullish()}),zD=w({_meta:_(m(),S()).nullish(),annotations:Pu.nullish(),data:m(),mimeType:m()}),UD=w({_meta:_(m(),S()).nullish(),annotations:Pu.nullish(),data:m(),mimeType:m(),uri:m().nullish()}),FD=w({_meta:_(m(),S()).nullish(),annotations:Pu.nullish(),description:m().nullish(),mimeType:m().nullish(),name:m(),size:G().nullish(),title:m().nullish(),uri:m()}),ZD=w({_meta:_(m(),S()).nullish(),optionId:N2}),HD=X([w({outcome:$("cancelled")}),ZD.and(w({outcome:$("selected")}))]),VD=w({_meta:_(m(),S()).nullish(),outcome:HD}),BD=w({_meta:_(m(),S()).nullish()}),qD=w({_meta:_(m(),S()).nullish()}),WD=w({currentValue:He()}),jD=m(),F2=m(),GD=X([$("mode"),$("model"),$("thought_level"),m()]),S0=m(),Z2=w({_meta:_(m(),S()).nullish(),description:m().nullish(),name:m(),value:S0}),YD=w({_meta:_(m(),S()).nullish(),group:jD,name:m(),options:N(Z2)}),JD=X([N(Z2),N(YD)]),KD=w({currentValue:S0,options:JD}),al=$p(X([KD.and(w({type:$("select")})),WD.and(w({type:$("boolean")}))]),w({_meta:_(m(),S()).nullish(),category:GD.nullish(),description:m().nullish(),id:F2,name:m()})),XD=w({_meta:_(m(),S()).nullish(),configOptions:N(al)}),QD=w({_meta:_(m(),S()).nullish()}),ae=m(),eO=w({_meta:_(m(),S()).nullish(),id:m(),sessionId:ae}),tO=w({_meta:_(m(),S()).nullish(),sessionId:ae}),nO=w({_meta:_(m(),S()).nullish(),sessionId:ae}),rO=w({_meta:_(m(),S()).nullish(),sessionId:ae}),H2=w({_meta:_(m(),S()).nullish(),args:N(m()).optional(),command:m(),cwd:m().nullish(),env:N(I2).optional(),outputByteLimit:G().nullish(),sessionId:ae}),iO=w({_meta:_(m(),S()).nullish(),sessionId:ae,uri:m()}),sO=w({_meta:_(m(),S()).nullish(),position:Vi,sessionId:ae,uri:m(),version:G(),visibleRange:ol}),oO=w({_meta:_(m(),S()).nullish(),languageId:m(),sessionId:ae,text:m(),uri:m(),version:G()}),aO=w({_meta:_(m(),S()).nullish(),sessionId:ae,uri:m()}),lO=w({_meta:_(m(),S()).nullish(),additionalDirectories:N(m()).optional(),cwd:m(),mcpServers:N(Rp).optional(),sessionId:ae}),V2=w({_meta:_(m(),S()).nullish(),sessionId:ae,terminalId:m()}),cO=w({_meta:_(m(),S()).nullish(),additionalDirectories:N(m()).optional(),cwd:m(),mcpServers:N(Rp),sessionId:ae}),B2=w({_meta:_(m(),S()).nullish(),limit:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:m(),sessionId:ae}),uO=w({_meta:_(m(),S()).nullish(),id:m(),reason:iD.nullish(),sessionId:ae}),q2=w({_meta:_(m(),S()).nullish(),sessionId:ae,terminalId:m()}),hO=w({_meta:_(m(),S()).nullish(),additionalDirectories:N(m()).optional(),cwd:m(),mcpServers:N(Rp).optional(),sessionId:ae}),dO=w({_meta:_(m(),S()).nullish(),additionalDirectories:N(m()).optional(),cwd:m(),sessionId:ae,title:m().nullish(),updatedAt:m().nullish()}),pO=w({_meta:_(m(),S()).nullish(),nextCursor:m().nullish(),sessions:N(dO)}),fO=w({_meta:_(m(),S()).nullish(),title:m().nullish(),updatedAt:m().nullish()}),mO=w({_meta:_(m(),S()).nullish()}),Ip=m(),gO=w({_meta:_(m(),S()).nullish(),currentModeId:Ip}),vO=w({_meta:_(m(),S()).nullish(),description:m().nullish(),id:Ip,name:m()}),xp=w({_meta:_(m(),S()).nullish(),availableModes:N(vO),currentModeId:Ip}),Pp=w({_meta:_(m(),S()).nullish(),availableModels:N(BL),currentModelId:b0}),yO=w({_meta:_(m(),S()).nullish(),configOptions:N(al).nullish(),models:Pp.nullish(),modes:xp.nullish(),sessionId:ae}),wO=w({_meta:_(m(),S()).nullish(),configOptions:N(al).nullish(),models:Pp.nullish(),modes:xp.nullish()}),bO=w({_meta:_(m(),S()).nullish(),configOptions:N(al).nullish(),models:Pp.nullish(),modes:xp.nullish(),sessionId:ae}),SO=w({_meta:_(m(),S()).nullish(),configOptions:N(al).nullish(),models:Pp.nullish(),modes:xp.nullish()}),_O=w({_meta:_(m(),S()).nullish()}),AO=w({_meta:_(m(),S()).nullish(),additionalDirectories:BD.nullish(),close:qD.nullish(),fork:QD.nullish(),list:mO.nullish(),resume:_O.nullish()}),EO=$p(X([w({type:$("boolean"),value:He()}),w({value:S0})]),w({_meta:_(m(),S()).nullish(),configId:F2,sessionId:ae})),kO=w({_meta:_(m(),S()).nullish(),configOptions:N(al)}),CO=w({_meta:_(m(),S()).nullish(),modeId:Ip,sessionId:ae}),TO=w({_meta:_(m(),S()).nullish()}),$O=w({_meta:_(m(),S()).nullish(),modelId:b0,sessionId:ae}),RO=w({_meta:_(m(),S()).nullish()}),IO=w({_meta:_(m(),S()).nullish(),sessionId:ae}),xO=X([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),PO=X([$("email"),$("uri"),$("date"),$("date-time")]),LO=w({default:m().nullish(),description:m().nullish(),enum:N(m()).nullish(),format:PO.nullish(),maxLength:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:N(R2).nullish(),pattern:m().nullish(),title:m().nullish()}),DO=w({_meta:_(m(),S()).nullish(),context:xD.nullish(),position:Vi,selection:ol.nullish(),sessionId:ae,triggerKind:dD,uri:m(),version:G()}),OO=w({_meta:_(m(),S()).nullish(),suggestions:N(DD)}),MO=w({_meta:_(m(),S()).nullish(),terminalId:m()}),NO=w({_meta:_(m(),S()).nullish(),exitCode:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:m().nullish()}),W2=w({_meta:_(m(),S()).nullish(),sessionId:ae,terminalId:m()}),zO=w({_meta:_(m(),S()).nullish(),exitStatus:NO.nullish(),output:m(),truncated:He()}),UO=w({_meta:_(m(),S()).nullish(),annotations:Pu.nullish(),text:m()}),FO=w({range:ol.nullish(),text:m()}),ZO=w({_meta:_(m(),S()).nullish(),contentChanges:N(FO),sessionId:ae,uri:m(),version:G()});w({method:m(),params:X([tO,oO,ZO,iO,aO,sO,eO,uO,P2]).nullish()});const HO=X([$("full"),$("incremental")]),VO=w({_meta:_(m(),S()).nullish(),syncKind:HO}),BO=w({_meta:_(m(),S()).nullish(),didChange:VO.nullish(),didClose:jL.nullish(),didFocus:GL.nullish(),didOpen:YL.nullish(),didSave:JL.nullish()}),qO=w({_meta:_(m(),S()).nullish(),document:BO.nullish()}),WO=w({_meta:_(m(),S()).nullish(),context:fD.nullish(),events:qO.nullish()}),jO=w({_meta:_(m(),S()).nullish(),auth:NL.optional().default({}),loadSession:He().optional().default(!1),mcpCapabilities:FL.optional().default({http:!1,sse:!1}),nes:WO.nullish(),positionEncoding:z2.nullish(),promptCapabilities:TD.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:AO.optional().default({})}),GO=w({_meta:_(m(),S()).nullish(),agentCapabilities:jO.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:M2.nullish(),authMethods:N(uL).optional().default([]),protocolVersion:U2}),YO=w({_meta:_(m(),S()).nullish(),mimeType:m().nullish(),text:m(),uri:m()}),JO=X([YO,pL]),KO=w({_meta:_(m(),S()).nullish(),annotations:Pu.nullish(),resource:JO}),_0=X([UO.and(w({type:$("text")})),UD.and(w({type:$("image")})),zD.and(w({type:$("audio")})),FD.and(w({type:$("resource_link")})),KO.and(w({type:$("resource")}))]),XO=w({_meta:_(m(),S()).nullish(),content:_0}),xf=w({_meta:_(m(),S()).nullish(),content:_0,messageId:m().nullish()}),QO=w({_meta:_(m(),S()).nullish(),messageId:m().nullish(),prompt:N(_0),sessionId:ae}),e5=w({anyOf:N(R2)}),j2=X([XO.and(w({type:$("content")})),wL.and(w({type:$("diff")})),MO.and(w({type:$("terminal")}))]),G2=m(),Y2=w({_meta:_(m(),S()).nullish(),line:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:m()}),J2=X([$("pending"),$("in_progress"),$("completed"),$("failed")]),K2=X([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),t5=w({_meta:_(m(),S()).nullish(),content:N(j2).optional(),kind:K2.optional(),locations:N(Y2).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:J2.optional(),title:m(),toolCallId:G2}),X2=w({_meta:_(m(),S()).nullish(),content:N(j2).nullish(),kind:K2.nullish(),locations:N(Y2).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:J2.nullish(),title:m().nullish(),toolCallId:G2}),Q2=w({_meta:_(m(),S()).nullish(),options:N(yD),sessionId:ae,toolCall:X2}),n5=w({_meta:_(m(),S()).nullish(),hint:m()}),r5=n5,i5=w({_meta:_(m(),S()).nullish(),description:m(),input:r5.nullish(),name:m()}),s5=w({_meta:_(m(),S()).nullish(),availableCommands:N(i5)}),o5=w({enum:N(m()),type:TL}),a5=X([o5,e5]),l5=w({default:N(m()).nullish(),description:m().nullish(),items:a5,maxItems:G().nullish(),minItems:G().nullish(),title:m().nullish()}),c5=X([LO.and(w({type:$("string")})),gD.and(w({type:$("number")})),LL.and(w({type:$("integer")})),fL.and(w({type:$("boolean")})),l5.and(w({type:$("array")}))]),u5=w({description:m().nullish(),properties:_(m(),c5).optional().default({}),required:N(m()).nullish(),title:m().nullish(),type:CL.optional().default("object")}),h5=w({requestedSchema:u5}),d5=$p(X([h5.and(w({mode:$("form")})),IL.and(w({mode:$("url")}))]),w({_meta:_(m(),S()).nullish(),message:m(),sessionId:ae})),p5=w({cachedReadTokens:G().nullish(),cachedWriteTokens:G().nullish(),inputTokens:G(),outputTokens:G(),thoughtTokens:G().nullish(),totalTokens:G()}),f5=w({_meta:_(m(),S()).nullish(),stopReason:xO,usage:p5.nullish(),userMessageId:m().nullish()});X([w({id:so,result:X([GO,dL,UL,bO,wO,pO,yO,SO,gL,TO,kO,f5,RO,IO,OO,mL,D2])}),w({error:x2,id:so})]);const m5=w({_meta:_(m(),S()).nullish(),cost:vL.nullish(),size:G(),used:G()}),g5=X([xf.and(w({sessionUpdate:$("user_message_chunk")})),xf.and(w({sessionUpdate:$("agent_message_chunk")})),xf.and(w({sessionUpdate:$("agent_thought_chunk")})),t5.and(w({sessionUpdate:$("tool_call")})),X2.and(w({sessionUpdate:$("tool_call_update")})),_D.and(w({sessionUpdate:$("plan")})),s5.and(w({sessionUpdate:$("available_commands_update")})),gO.and(w({sessionUpdate:$("current_mode_update")})),XD.and(w({sessionUpdate:$("config_option_update")})),fO.and(w({sessionUpdate:$("session_info_update")})),m5.and(w({sessionUpdate:$("usage_update")}))]),eS=w({_meta:_(m(),S()).nullish(),sessionId:ae,update:g5});w({method:m(),params:X([eS,EL,P2]).nullish()});const tS=w({_meta:_(m(),S()).nullish(),sessionId:ae,terminalId:m()}),v5=w({_meta:_(m(),S()).nullish(),exitCode:G().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:m().nullish()}),y5=w({name:m(),uri:m()}),w5=w({_meta:_(m(),S()).nullish(),repository:lD.nullish(),workspaceFolders:N(y5).nullish(),workspaceUri:m().nullish()});w({id:so,method:m(),params:X([$D,hL,zL,mD,cO,OL,lO,hO,rO,CO,EO,QO,$O,w5,DO,nO,L2]).nullish()});const nS=w({_meta:_(m(),S()).nullish(),content:m(),path:m(),sessionId:ae});w({id:so,method:m(),params:X([nS,B2,Q2,H2,W2,q2,tS,V2,d5,L2]).nullish()});const b5=w({_meta:_(m(),S()).nullish()});X([w({id:so,result:X([b5,OD,VD,yL,zO,MD,v5,DL,kL,D2])}),w({error:x2,id:so})]);var oe;class S5{constructor(e,t){f(this,oe);const r=e(this),i=async(a,l)=>{var c,d,p,g,y,v,A;switch(a){case ar.fs_write_text_file:{const E=nS.parse(l);return(c=r.writeTextFile)==null?void 0:c.call(r,E)}case ar.fs_read_text_file:{const E=B2.parse(l);return(d=r.readTextFile)==null?void 0:d.call(r,E)}case ar.session_request_permission:{const E=Q2.parse(l);return r.requestPermission(E)}case ar.terminal_create:{const E=H2.parse(l);return(p=r.createTerminal)==null?void 0:p.call(r,E)}case ar.terminal_output:{const E=W2.parse(l);return(g=r.terminalOutput)==null?void 0:g.call(r,E)}case ar.terminal_release:{const E=q2.parse(l);return await((y=r.releaseTerminal)==null?void 0:y.call(r,E))??{}}case ar.terminal_wait_for_exit:{const E=tS.parse(l);return(v=r.waitForTerminalExit)==null?void 0:v.call(r,E)}case ar.terminal_kill:{const E=V2.parse(l);return await((A=r.killTerminal)==null?void 0:A.call(r,E))??{}}default:if(r.extMethod)return r.extMethod(a,l);throw Me.methodNotFound(a)}},o=async(a,l)=>{switch(a){case ar.session_update:{const c=eS.parse(l);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(a,l);throw Me.methodNotFound(a)}};h(this,oe,new _5(i,o,t))}async initialize(e){return await s(this,oe).sendRequest(we.initialize,e)}async newSession(e){return await s(this,oe).sendRequest(we.session_new,e)}async loadSession(e){return await s(this,oe).sendRequest(we.session_load,e)??{}}async unstable_forkSession(e){return await s(this,oe).sendRequest(we.session_fork,e)}async listSessions(e){return await s(this,oe).sendRequest(we.session_list,e)}async unstable_resumeSession(e){return await s(this,oe).sendRequest(we.session_resume,e)}async unstable_closeSession(e){return await s(this,oe).sendRequest(we.session_close,e)}async setSessionMode(e){return await s(this,oe).sendRequest(we.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await s(this,oe).sendRequest(we.session_set_model,e)??{}}async setSessionConfigOption(e){return await s(this,oe).sendRequest(we.session_set_config_option,e)}async authenticate(e){return await s(this,oe).sendRequest(we.authenticate,e)??{}}async unstable_logout(e){return await s(this,oe).sendRequest(we.logout,e)??{}}async prompt(e){return await s(this,oe).sendRequest(we.session_prompt,e)}async cancel(e){return await s(this,oe).sendNotification(we.session_cancel,e)}async unstable_startNes(e){return await s(this,oe).sendRequest(we.nes_start,e)}async unstable_suggestNes(e){return await s(this,oe).sendRequest(we.nes_suggest,e)}async unstable_closeNes(e){return await s(this,oe).sendRequest(we.nes_close,e)??{}}async unstable_didOpenDocument(e){return await s(this,oe).sendNotification(we.document_did_open,e)}async unstable_didChangeDocument(e){return await s(this,oe).sendNotification(we.document_did_change,e)}async unstable_didCloseDocument(e){return await s(this,oe).sendNotification(we.document_did_close,e)}async unstable_didSaveDocument(e){return await s(this,oe).sendNotification(we.document_did_save,e)}async unstable_didFocusDocument(e){return await s(this,oe).sendNotification(we.document_did_focus,e)}async unstable_acceptNes(e){return await s(this,oe).sendNotification(we.nes_accept,e)}async unstable_rejectNes(e){return await s(this,oe).sendNotification(we.nes_reject,e)}async extMethod(e,t){return await s(this,oe).sendRequest(e,t)}async extNotification(e,t){return await s(this,oe).sendNotification(e,t)}get signal(){return s(this,oe).signal}get closed(){return s(this,oe).closed}}oe=new WeakMap;var si,Td,vc,yc,Yo,Jo,$n,wc,Ae,rS,fm,iS,sS,oS,aS,mm,Ll;class _5{constructor(e,t,r){f(this,Ae);f(this,si,new Map);f(this,Td,0);f(this,vc);f(this,yc);f(this,Yo);f(this,Jo,Promise.resolve());f(this,$n,new AbortController);f(this,wc);h(this,vc,e),h(this,yc,t),h(this,Yo,r),h(this,wc,new Promise(i=>{s(this,$n).signal.addEventListener("abort",()=>i())})),u(this,Ae,rS).call(this)}get signal(){return s(this,$n).signal}get closed(){return s(this,wc)}async sendRequest(e,t){u(this,Ae,mm).call(this);const r=qu(this,Td)._++,i=new Promise((o,a)=>{s(this,si).set(r,{resolve:o,reject:a})});return await u(this,Ae,Ll).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){u(this,Ae,mm).call(this),await u(this,Ae,Ll).call(this,{jsonrpc:"2.0",method:e,params:t})}}si=new WeakMap,Td=new WeakMap,vc=new WeakMap,yc=new WeakMap,Yo=new WeakMap,Jo=new WeakMap,$n=new WeakMap,wc=new WeakMap,Ae=new WeakSet,rS=async function(){let e;try{const t=s(this,Yo).readable.getReader();try{for(;!s(this,$n).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{u(this,Ae,iS).call(this,r)}catch(o){console.error("Unexpected error during message processing:",r,o),"id"in r&&r.id!==void 0&&u(this,Ae,Ll).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{u(this,Ae,fm).call(this,e)}},fm=function(e){if(s(this,$n).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of s(this,si).values())r.reject(t);s(this,si).clear(),s(this,$n).abort(t)},iS=async function(e){if("method"in e&&"id"in e){const t=await u(this,Ae,sS).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await u(this,Ae,Ll).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await u(this,Ae,oS).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?u(this,Ae,aS).call(this,e):console.error("Invalid message",{message:e})},sS=async function(e,t){try{return{result:await s(this,vc).call(this,e,t)??null}}catch(r){if(r instanceof Me)return r.toResult();if(r instanceof cy)return Me.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 Me.internalError(i?JSON.parse(i):{}).toResult()}catch{return Me.internalError({details:i}).toResult()}}},oS=async function(e,t){try{return await s(this,yc).call(this,e,t),{result:null}}catch(r){if(r instanceof Me)return r.toResult();if(r instanceof cy)return Me.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 Me.internalError(i?JSON.parse(i):{}).toResult()}catch{return Me.internalError({details:i}).toResult()}}},aS=function(e){const t=s(this,si).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:o}=e.error;t.reject(new Me(r,i,o))}s(this,si).delete(e.id)}else console.error("Got response to unknown request",e.id)},mm=function(){if(s(this,$n).signal.aborted)throw s(this,$n).signal.reason??new Error("ACP connection closed")},Ll=async function(e){return h(this,Jo,s(this,Jo).then(async()=>{const t=s(this,Yo).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{u(this,Ae,fm).call(this,t)})),s(this,Jo)};class Me extends Error{constructor(t,r,i){super(r);C(this,"code");C(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new Me(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Me(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Me(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Me(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Me(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Me(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Me(-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}}}function A5(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function lS(n){var t;class e extends n{constructor(...o){super(...o);f(this,t,!1);A5(this,()=>s(this,t),()=>{h(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return s(this,t)}}return t=new WeakMap,e}const E5=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,k5=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,C5=/\[Television channel context\][\s\S]*?\[\/Television channel context\]\n*/,T5=/\b(tv|television|channel|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,$5=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,R5="single_session",I5={name:"television-acp-client",version:"0.0.0"},cS="agent:main:television",x5=lS(ji);var Ko,Rn,$t,In,oi,an,vr,xn,Pn,ai,ln,Xo,Qo,Ln,tt,yr,ea,ws,wr,li,bc,cn,Dn,$d,On,R,gm,uS,hS,dS,kh,pS,fS,mS,gS,vS,yS,wS,ts,Co,To,cr,bS,$o,vm,ym,Ch,SS,Th,wm,bm,Sc,_c,$h,Ro,Sm,_S;class P5 extends x5{constructor(t){super();f(this,R);f(this,Ko,"disconnected");f(this,Rn,null);f(this,$t,new Map);f(this,In,null);f(this,oi,null);f(this,an,null);f(this,vr,null);f(this,xn,null);f(this,Pn,null);f(this,ai);f(this,ln,null);f(this,Xo,0);f(this,Qo,1);f(this,Ln,null);f(this,tt,null);f(this,yr,!1);f(this,ea,!1);f(this,ws,!1);f(this,wr,null);f(this,li,new Set);f(this,bc);f(this,cn);f(this,Dn);f(this,$d,t=>{u(this,R,hS).call(this,t)});f(this,On,null);f(this,Sc,()=>{u(this,R,Ro).call(this,"ACP bridge websocket closed")});f(this,_c,()=>{u(this,R,Ro).call(this,"ACP bridge websocket error")});h(this,cn,t),h(this,Dn,t.sessionMode??R5),h(this,ai,t.mappedSessionStore??L5()),h(this,bc,t.createSocket??(r=>new WebSocket(r)))}get status(){return s(this,Ko)}get messages(){return[...s(this,$t).values()]}get enabled(){return s(this,cn).enabled??!1}setToken(t){s(this,cn).token=t??""}setEnabled(t){s(this,cn).enabled=t,t||(u(this,R,$h).call(this),h(this,Rn,null),u(this,R,cr).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){s(this,oi)===null&&(h(this,Rn,null),h(this,oi,u(this,R,uS).call(this)));try{await s(this,oi),await u(this,R,kh).call(this)}catch(t){throw u(this,R,Ro).call(this,Pf(t)),t}}}dispose(){u(this,R,$h).call(this),h(this,Rn,null),u(this,R,cr).call(this,"disposed")}async sendMessage(t){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await u(this,R,gm).call(this,"ready")),(s(this,xn)===null||s(this,ln)!==u(this,R,Th).call(this))&&await u(this,R,kh).call(this),this.status!=="ready")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");u(this,R,Co).call(this,{id:u(this,R,$o).call(this,"user"),kind:"user",text:r,status:"final"}),u(this,R,cr).call(this,"running");try{const i=await u(this,R,Ch).call(this).prompt({sessionId:u(this,R,ym).call(this),prompt:[{type:"text",text:u(this,R,bS).call(this,r)}]});u(this,R,ts).call(this,i.stopReason==="cancelled"?"cancelled":"final"),u(this,R,cr).call(this,"ready")}catch(i){throw u(this,R,_S).call(this)||(u(this,R,ts).call(this,"error"),u(this,R,cr).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await u(this,R,gm).call(this,"ready"));const t=u(this,R,Th).call(this);((r=s(this,Pn))==null?void 0:r.sessionIdStrategy)==="mapped"?s(this,ai).clearActualSessionId(t):h(this,Xo,s(this,Xo)+1),h(this,an,null),h(this,vr,null),h(this,xn,null),h(this,ln,null),u(this,R,Sm).call(this)}async cancel(){this.status==="running"&&(u(this,R,cr).call(this,"cancelling"),await u(this,R,Ch).call(this).cancel({sessionId:u(this,R,ym).call(this)}))}setChannelContext(t){var o,a,l;if(t===null){if(s(this,tt)===null)return;h(this,tt,null),h(this,yr,!1);return}const r={channelID:t.channelID,channelName:t.channelName};if(((o=s(this,tt))==null?void 0:o.channelID)===r.channelID&&((a=s(this,tt))==null?void 0:a.channelName)===r.channelName)return;const i=((l=s(this,tt))==null?void 0:l.channelID)??null;if(h(this,tt,r),s(this,Dn)==="single_session"){(!s(this,ln)||i!==r.channelID)&&h(this,yr,!0);return}s(this,ln)!==u(this,R,wm).call(this,r.channelID)&&(h(this,an,null),h(this,vr,null),s(this,In)&&this.status==="ready"&&u(this,R,kh).call(this).catch(c=>{u(this,R,Ro).call(this,Pf(c))}))}}Ko=new WeakMap,Rn=new WeakMap,$t=new WeakMap,In=new WeakMap,oi=new WeakMap,an=new WeakMap,vr=new WeakMap,xn=new WeakMap,Pn=new WeakMap,ai=new WeakMap,ln=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,Ln=new WeakMap,tt=new WeakMap,yr=new WeakMap,ea=new WeakMap,ws=new WeakMap,wr=new WeakMap,li=new WeakMap,bc=new WeakMap,cn=new WeakMap,Dn=new WeakMap,$d=new WeakMap,On=new WeakMap,R=new WeakSet,gm=async function(t){if(this.status!==t){if(this.status==="disposed")throw new Error("ACPClient has been disposed");if(this.status==="disconnected")throw new Error(s(this,Rn)??"ACPClient is disconnected");await new Promise((r,i)=>{const o=()=>{this.removeEventListener("status-changed",a)},a=()=>{if(this.status===t){o(),r();return}if(this.status==="disposed"){o(),i(new Error("ACPClient has been disposed"));return}this.status==="disconnected"&&(o(),i(new Error(s(this,Rn)??"ACPClient is disconnected")))};this.addEventListener("status-changed",a)})}},uS=async function(){try{const{stream:t,socket:r,metadata:i}=await N5({serverURL:s(this,cn).serverURL,token:s(this,cn).token,createSocket:s(this,bc),onDisconnect:s(this,$d)});h(this,Pn,i),h(this,On,r),r.addEventListener("close",s(this,Sc)),r.addEventListener("error",s(this,_c)),h(this,In,new S5(o=>({connection:o,sessionUpdate:async a=>{await u(this,R,fS).call(this,a)},requestPermission:async a=>u(this,R,mS).call(this,a)}),t)),await s(this,In).initialize({protocolVersion:iL,clientCapabilities:{},clientInfo:I5})}catch(t){throw t}},hS=function(t){u(this,R,Ro).call(this,Pf(t))},dS=function(t){const r=t==null?void 0:t.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(o=>o.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},kh=async function(){const t=u(this,R,Th).call(this);if(s(this,an)&&s(this,vr)===t){await s(this,an);return}h(this,vr,t),h(this,an,u(this,R,pS).call(this,t)),await s(this,an)},pS=async function(t){var c;const r=u(this,R,Ch).call(this);u(this,R,Sm).call(this);let i,o=!1,a=null;const l={cwd:u(this,R,SS).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(h(this,ws,!0),h(this,wr,null),((c=s(this,Pn))==null?void 0:c.sessionIdStrategy)==="mapped"){const d=s(this,ai).getActualSessionId(t);if(d)try{const p=await r.loadSession({...l,sessionId:d});if(D5(p))throw new Error("Mapped ACP session was not found");a=p,i=d,o=!0}catch{const p=await r.newSession(l);a=p,i=p.sessionId,s(this,ai).setActualSessionId(t,i),o=!1}else{const p=await r.newSession(l);a=p,i=p.sessionId,s(this,ai).setActualSessionId(t,i),o=!1}}else try{a=await r.loadSession({...l,sessionId:t}),i=t,o=s(this,$t).size>0}catch{const d=await r.newSession(l);a=d,i=d.sessionId,o=!1}}finally{h(this,ws,!1),h(this,wr,null),u(this,R,ts).call(this,"final")}u(this,R,dS).call(this,a),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),h(this,xn,i),h(this,ln,t),h(this,ea,!0),o?(s(this,li).add(t),s(this,Dn)==="single_session"&&h(this,yr,!1)):(s(this,li).delete(t),h(this,yr,s(this,Dn)==="single_session")),h(this,Rn,null),u(this,R,cr).call(this,"ready")},fS=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&u(this,R,wS).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&u(this,R,gS).call(this,r.content.text);return;case"tool_call":u(this,R,vS).call(this,r);return;case"tool_call_update":u(this,R,yS).call(this,r);return;case"agent_thought_chunk":return;default:return}},mS=async function(t){return{outcome:{outcome:"cancelled"}}},gS=function(t){h(this,wr,null);const r=M5(t);if(!r)return;if(!s(this,Ln)){const o={id:u(this,R,$o).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};h(this,Ln,o.id),u(this,R,Co).call(this,o);return}const i=s(this,$t).get(s(this,Ln));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");u(this,R,To).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},vS=function(t){u(this,R,ts).call(this,"final");const r=u(this,R,vm).call(this,t.toolCallId),i=Sy("content"in t?t.content:void 0),o={id:(r==null?void 0:r.id)??u(this,R,$o).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){u(this,R,To).call(this,o);return}u(this,R,Co).call(this,o)},yS=function(t){const r=u(this,R,vm).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",o=Sy(t.content),a=o?`${i}${o}`:i,l={id:(r==null?void 0:r.id)??u(this,R,$o).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:a,locations:t.locations??(r==null?void 0:r.locations)};if(r){u(this,R,To).call(this,l);return}u(this,R,Co).call(this,l)},wS=function(t){if(u(this,R,ts).call(this,"final"),!t)return;const r=s(this,ws)?s(this,wr):null;if(!r){const o=by(t);if(!o)return;const a={id:u(this,R,$o).call(this,"user"),kind:"user",text:o,status:"final"};u(this,R,Co).call(this,a),s(this,ws)&&h(this,wr,a.id);return}const i=s(this,$t).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");u(this,R,To).call(this,{...i,text:by(`${i.text}${t}`)})},ts=function(t){if(!s(this,Ln))return;const r=s(this,$t).get(s(this,Ln));(r==null?void 0:r.kind)==="assistant"&&u(this,R,To).call(this,{...r,status:t}),h(this,Ln,null)},Co=function(t){s(this,$t).set(t.id,t),this.dispatchEvent(new $f("messages-changed"))},To=function(t){s(this,$t).set(t.id,t),this.dispatchEvent(new $f("messages-changed"))},cr=function(t){s(this,Ko)!==t&&(h(this,Ko,t),this.dispatchEvent(new H4("status-changed")))},bS=function(t){const r=s(this,ln);if(!r)return t;const i=s(this,tt)?s(this,Dn)==="single_session"?s(this,yr)||!s(this,li).has(r):!s(this,li).has(r):!1,o=s(this,ea)&&(s(this,tt)!==null||T5.test(t));if(!(o||i))return t;o&&h(this,ea,!1),i&&(h(this,yr,!1),s(this,li).add(r));const l=["[Television channel context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."];return s(this,tt)?(l.push("This conversation is currently attached to the channel below."),l.push(`channel_id: ${s(this,tt).channelID}`),l.push(`channel_name: ${s(this,tt).channelName??""}`),l.push("When the user asks to inspect or change Television state with the tv CLI, use this channel ID with the --channel argument.")):l.push("There is currently no active Television channel."),l.push("[/Television channel context]","",t),l.join(`
|
|
43
|
+
`)},$o=function(t){const r=`${t}-${s(this,Qo)}`;return h(this,Qo,s(this,Qo)+1),r},vm=function(t){for(const r of s(this,$t).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===t)return r;return null},ym=function(){if(!s(this,xn))throw new Error("ACP session is not ready");return s(this,xn)},Ch=function(){if(!s(this,In))throw new Error("ACP connection is not ready");return s(this,In)},SS=function(){var r;const t=(r=s(this,Pn))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Th=function(){var r;if(s(this,Dn)==="single_session")return u(this,R,bm).call(this,`${cS}-${(s(this,cn).clientGUID??"default-client").toLowerCase()}`);const t=(r=s(this,tt))==null?void 0:r.channelID;if(!t)throw new Error("Channel context is required for per-channel session mode");return u(this,R,wm).call(this,t)},wm=function(t){return u(this,R,bm).call(this,O5(s(this,Dn),t,s(this,cn).clientGUID??"default-client"))},bm=function(t){var r;return((r=s(this,Pn))==null?void 0:r.sessionIdStrategy)==="deterministic"&&s(this,Xo)>0?`${t}:epoch-${s(this,Xo)}`:t},Sc=new WeakMap,_c=new WeakMap,$h=function(){h(this,In,null),h(this,oi,null),h(this,an,null),h(this,vr,null),h(this,xn,null),h(this,ln,null),h(this,Pn,null),s(this,On)&&(s(this,On).removeEventListener("close",s(this,Sc)),s(this,On).removeEventListener("error",s(this,_c)),s(this,On).close(),h(this,On,null))},Ro=function(t){const r=s(this,In)!==null||s(this,oi)!==null||s(this,an)!==null||s(this,vr)!==null||s(this,xn)!==null||s(this,ln)!==null||s(this,Pn)!==null||s(this,On)!==null;this.disposed||this.status==="disconnected"&&!r||(u(this,R,ts).call(this,"error"),u(this,R,$h).call(this),h(this,Rn,t??null),u(this,R,cr).call(this,"disconnected"))},Sm=function(){const t=s(this,$t).size>0;h(this,Ln,null),h(this,wr,null),h(this,Qo,1),s(this,$t).clear(),t&&this.dispatchEvent(new $f("messages-changed"))},_S=function(){return this.status==="disconnected"};function L5(){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 D5(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function O5(n,e,t){return n==="single_session"?`${cS}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function AS(n){return n.replace(/^(?:\s*\n)+/,"")}function by(n){let e=n;return e=e.replace(E5,""),e=e.replace(k5,""),e=e.replace(C5,""),e=AS(e),e}function M5(n){let e=n;return e=e.replace($5,""),e=AS(e),e}function Sy(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function N5(n){const e=n.createSocket(F5(n.serverURL,n.token));let t=!1,r,i;const o=new Promise((d,p)=>{r=d,i=p}),a=new ReadableStream({start(d){let p=!1;const g=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},y=E=>{const x=U5(E);if(!x)return;let B;try{B=JSON.parse(x)}catch(P){const J=P instanceof Error?P:new Error(String(P));i(J),d.error(J);return}switch(B.type){case"acp-bridge-status":if(B.status==="ready"){let P;try{P=z5(B)}catch(J){const O=J instanceof Error?J:new Error(String(J));t||i(O),d.error(O);return}t||(t=!0,r(P));return}if(B.status==="error"||B.status==="exited"){const P=new Error(B.error??`ACP bridge ${B.status}`);t||i(P),d.error(P)}return;case"acp-bridge-message":d.enqueue(B.message);return}},v=()=>{var x;if(p)return;p=!0;const E=new Error("ACP bridge websocket closed");t||i(E),(x=n.onDisconnect)==null||x.call(n,E),d.close()},A=()=>{var x;if(p)return;p=!0;const E=new Error("ACP bridge websocket error");t||i(E),(x=n.onDisconnect)==null||x.call(n,E),d.error(E)};e.addEventListener("open",g),e.addEventListener("message",y),e.addEventListener("close",v),e.addEventListener("error",A)}}),l=new WritableStream({async write(d){await o,e.send(JSON.stringify({type:"acp-bridge-message",message:d}))},close(){e.close()},abort(){e.close()}}),c=await o;return{stream:{readable:a,writable:l},socket:e,metadata:c}}function z5(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 U5(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 F5(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 Pf(n){return n instanceof Error?n.message:String(n)}const _y="television.acpClientGUID",Ay="television.acpMappedSessions",Ey=1;var ta;class Z5{constructor(){f(this,ta,new Map)}getActualSessionId(e){return s(this,ta).get(e)??null}setActualSessionId(e,t){s(this,ta).set(e,t)}clearActualSessionId(e){s(this,ta).delete(e)}}ta=new WeakMap;var na,Ac,Lt,Rh,Ih,_m;class H5{constructor(e,t){f(this,Lt);f(this,na);f(this,Ac);h(this,na,e),h(this,Ac,t)}getActualSessionId(e){const t=u(this,Lt,Ih).call(this)[u(this,Lt,Rh).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=u(this,Lt,Ih).call(this);r[u(this,Lt,Rh).call(this,e)]=t,u(this,Lt,_m).call(this,r)}clearActualSessionId(e){const t=u(this,Lt,Ih).call(this);delete t[u(this,Lt,Rh).call(this,e)],u(this,Lt,_m).call(this,t)}}na=new WeakMap,Ac=new WeakMap,Lt=new WeakSet,Rh=function(e){return JSON.stringify([s(this,Ac),e])},Ih=function(){const e=s(this,na).getItem(Ay);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!==Ey?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},_m=function(e){const t={version:Ey,entries:e};s(this,na).setItem(Ay,JSON.stringify(t))};function ES(){return typeof window>"u"?null:window.localStorage}function V5(n){const e=n.getItem(_y);if(e)return e;const t=p0().toLowerCase();return n.setItem(_y,t),t}const ky=4401,B5=401,rh=1e3,q5=3e4;class xh extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class W5 extends ji{constructor(t){var a,l;super();C(this,"url");C(this,"name");C(this,"telemetryMeta");C(this,"status","unauthorized");C(this,"channels",new Map);C(this,"client");C(this,"acpClient");C(this,"_token");C(this,"attempting",!1);C(this,"nextRetryAt",null);C(this,"hasEverConnected",!1);C(this,"hasAuthRejected",!1);C(this,"hasAuthTokenRejected",!1);C(this,"bootState","pending");C(this,"serverVersion",null);C(this,"updateState",null);C(this,"decideBoot");C(this,"navigationPending");C(this,"createSocket");C(this,"createClient");C(this,"socket",null);C(this,"connectAttempt",0);C(this,"autoReconnect",!1);C(this,"retryTimer",null);C(this,"retryDelay",rh);C(this,"visibilityEventTarget");C(this,"networkEventTarget");C(this,"onVisibilityChange");C(this,"onNetworkOnline");C(this,"telemetryActivityAgent");this.url=Fi(t.url),this.name=t.name,this.decideBoot=t.decideBoot??null,this.navigationPending=t.navigationPending??(()=>!1),this._token=t.token??null,this.telemetryMeta=t.telemetryMeta??null,this.createSocket=t.createSocket??(c=>new WebSocket(c)),this.createClient=t.createClient??((c,d,p)=>new m4(c,{token:d??void 0,onUnauthorized:()=>this.handleAuthRejected(),...p?{telemetryMeta:p}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=t.mappedSessionStore??(t.acpStorage?new H5(t.acpStorage,this.url):new Z5);this.acpClient=new P5({serverURL:this.url,token:this._token??"",...t.createACPSocket?{createSocket:t.createACPSocket}:t.createSocket?{createSocket:t.createSocket}:{},...t.clientGUID?{clientGUID:t.clientGUID}:{},mappedSessionStore:r}),this.visibilityEventTarget=t.visibilityEventTarget!==void 0?t.visibilityEventTarget:typeof document<"u"?document:null,this.networkEventTarget=t.networkEventTarget!==void 0?t.networkEventTarget:typeof window<"u"?window:null,this.onVisibilityChange=()=>{this.isPageVisible()&&this.kickReconnect()},this.onNetworkOnline=()=>{this.kickReconnect()},(a=this.visibilityEventTarget)==null||a.addEventListener("visibilitychange",this.onVisibilityChange),(l=this.networkEventTarget)==null||l.addEventListener("online",this.onNetworkOnline);const i=t.telemetryDocumentTarget!==void 0?t.telemetryDocumentTarget:typeof document<"u"?document:null,o=t.telemetryWindowTarget!==void 0?t.telemetryWindowTarget:typeof window<"u"?window:null;this.telemetryActivityAgent=this.telemetryMeta&&i&&o?tL({meta:this.telemetryMeta,documentTarget:i,windowTarget:o,send:c=>this.sendTelemetryActivity(c)}):null}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null,this.telemetryMeta)}async connect(t){this._token=t,this.hasAuthRejected=!1,this.hasAuthTokenRejected=!1,this.acpClient.setToken(t),this.cancelRetryTimer(),this.retryDelay=rh,this.autoReconnect=!0,await this.attempt()}dispose(){var t,r,i,o;this.autoReconnect=!1,this.connectAttempt+=1,this.cancelRetryTimer(),(t=this.socket)==null||t.close(),this.socket=null,this.setStatus("unauthorized"),(r=this.visibilityEventTarget)==null||r.removeEventListener("visibilitychange",this.onVisibilityChange),(i=this.networkEventTarget)==null||i.removeEventListener("online",this.onNetworkOnline),(o=this.telemetryActivityAgent)==null||o.stop(),this.acpClient.dispose()}getViewURL(t){const r=pm(t,{electron:Hr()});return Hr()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}getContentURL(t){const r=pm(t,{electron:Hr()}).contentURL;return r===null?null:new URL(r,this.url).toString()}async createChannel(t){const{channel:r}=await this.client.channels.create({name:t});return this.channels.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"channel-created":this.channels.set(t.channel.id,structuredClone(t.channel)),this.dispatchEvent(new xl("channels-changed"));break;case"channel-updated":this.channels.set(t.channel.id,structuredClone(t.channel)),this.dispatchEvent(new xl("channels-changed"));break;case"channel-removed":this.channels.delete(t.channelID),this.dispatchEvent(new xl("channels-changed"));break;case"artifact-created":{const r=this.channels.get(t.channelID);r&&!X$(r).includes(t.artifact.id)&&(r.layout=[...r.layout,{artifactIds:[t.artifact.id],geometry:{...Tb},size:{...$b}}]);break}case"artifact-removed":{const r=this.channels.get(t.channelID);r&&(r.layout=nm(r.layout,t.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"channel-changed":case"pinned-channels-changed":case"theme-changed":case"appearance-changed":case"artifact-focus":break;default:return j5(t,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1,this.bootState="pending";const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token,this.telemetryMeta),this.setStatus("disconnected"),this.dispatchEvent(new Jt("change"));const r=this.createSocket(G5(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((o,a)=>{let l=!1;const c=()=>{var g;l||this.connectAttempt!==t||(l=!0,this.retryDelay=rh,this.hasEverConnected=!0,this.setStatus("connected"),(g=this.telemetryActivityAgent)==null||g.start(),o())},d=g=>{l||this.connectAttempt!==t||(l=!0,a(g))},p=async()=>{const g=this.hasEverConnected;try{const[{channels:y},v]=await Promise.all([this.client.channels.list(),this.client.display.get()]);this.channels=new Map(y.map(A=>[A.id,structuredClone(A)])),this.acpClient.setEnabled(v.acpEnabled),this.dispatchEvent(new Jt("change")),g&&this.dispatchEvent(new xl("channels-changed")),this.dispatchEvent(new Ah("server-event",{serverURL:this.url,event:{type:"channel-changed",channelID:v.focusedChannelId}})),this.dispatchEvent(new Ah("server-event",{serverURL:this.url,event:{type:"pinned-channels-changed",pinnedChannelIds:[...v.pinnedChannelIds]}})),c(),g&&this.connectAttempt===t&&this.dispatchEvent(new Ub("server-reconnected",{serverURL:this.url}))}catch(y){if(eM(y)){d(new xh);return}d(y instanceof Error?y:new Error(String(y)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||p())}),r.addEventListener("message",g=>{const y=Q5(g);if(!y)return;if(y.type==="server-status"){const A=y;this.serverVersion=A.version,this.updateState=A.update??null;let E=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===t&&(this.decideBoot(A)==="boot"?(this.bootState="booted",E=!0):(this.bootState="halted",this.attempting=!1)),this.dispatchEvent(new Fb("server-status",{serverURL:this.url,message:A})),E?this.navigationPending()||p():this.bootState==="halted"&&!this.navigationPending()&&this.dispatchEvent(new Jt("change"));return}if(!X5(y.type))return;const v=y;this.applyServerEvent(v),this.dispatchEvent(new Ah("server-event",{serverURL:this.url,event:v}))}),r.addEventListener("close",g=>{if(this.connectAttempt!==t)return;this.socket=null;const y=Y5(g);if(!l){d(y===ky?new xh:new Error("Connection closed before initialization"));return}if(y===ky){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}),r.addEventListener("error",()=>{if(this.connectAttempt===t){if(l){this.handleTransportFailure(new Error("WebSocket error"));return}d(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},o=>{throw this.attempting=!1,this.handleAttemptFailure(o),o})}handleAuthRejected(){this.hasAuthRejected=!0,this.hasAuthTokenRejected=this._token!==null,this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized")}handleAttemptFailure(t){if(t instanceof xh){this.handleAuthRejected();return}this.autoReconnect&&this.scheduleRetry()}handleTransportFailure(t){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const t=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,q5),this.nextRetryAt=Date.now()+t,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},t),this.dispatchEvent(new Jt("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new Jt("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=rh,this.attempt().catch(()=>{})))}sendTelemetryActivity(t){var r;this.status==="connected"&&((r=this.socket)==null||r.send(JSON.stringify(t)))}sendTelemetrySignal(t,r){var o;if(!this.telemetryMeta||this.status!=="connected"&&this.bootState!=="halted")return;const i={type:K$,clientId:this.telemetryMeta.clientId,event:t,properties:r};(o=this.socket)==null||o.send(JSON.stringify(i))}setStatus(t){this.status!==t&&(this.status=t,this.dispatchEvent(new Jt("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function j5(n,e){throw new Error(`Unexpected ${e}: ${JSON.stringify(n)}`)}function G5(n,e,t=null){const r=new URL(n);if(r.protocol=r.protocol==="https:"?"wss:":"ws:",r.pathname="/events",r.search="",e&&r.searchParams.set("token",e),t)for(const[i,o]of eL(t))r.searchParams.set(i,o);return r.hash="",r.toString()}function Y5(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const J5={"artifact-created":!0,"artifact-updated":!0,"artifact-content-changed":!0,"artifact-removed":!0,"channel-created":!0,"channel-updated":!0,"channel-removed":!0,"channel-changed":!0,"pinned-channels-changed":!0,"theme-changed":!0,"appearance-changed":!0,"artifact-focus":!0},K5=new Set(Object.keys(J5));function X5(n){return K5.has(n)}function Q5(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;let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||!("type"in t)||typeof t.type!="string"?null:t}function eM(n){return n instanceof il&&n.status===B5}const tM="Local";var Ut,un,er,Am,Em,kS,Ec,kc,Cc,Tc,$c;class nM extends ji{constructor(t){super();f(this,er);C(this,"connection");C(this,"clientGUID");C(this,"acpStorage");C(this,"connectError",null);f(this,Ut);f(this,un,!1);f(this,Ec,()=>{s(this,un)||(u(this,er,kS).call(this),this.dispatchEvent(new Jt("change")))});f(this,kc,t=>{s(this,un)||this.dispatchEvent(new Ah("server-event",{serverURL:t.serverURL,event:t.event}))});f(this,Cc,()=>{s(this,un)||this.dispatchEvent(new xl("channels-changed"))});f(this,Tc,t=>{s(this,un)||this.dispatchEvent(new Ub("server-reconnected",{serverURL:t.serverURL}))});f(this,$c,t=>{s(this,un)||this.dispatchEvent(new Fb("server-status",{serverURL:t.serverURL,message:t.message}))});h(this,Ut,t.localStore),this.acpStorage=t.acpStorage===void 0?ES():t.acpStorage,this.clientGUID=t.clientGUID??(this.acpStorage?V5(this.acpStorage):p0().toLowerCase());const r=Fi(t.serverURL);t.launchToken!==void 0&&t.launchToken!==null&&s(this,Ut).set(W1(s(this,Ut).get(),r,t.launchToken));const i=t.launchToken??q1(s(this,Ut).get(),r),o=t.createSocket??(l=>new WebSocket(l)),a=t.createConnection??(l=>new W5(l));this.connection=a({url:r,name:t.connectionName??tM,token:i,createSocket:o,clientGUID:this.clientGUID,acpStorage:this.acpStorage,telemetryMeta:t.telemetryMeta??null,decideBoot:t.decideBoot,navigationPending:t.navigationPending}),this.connection.addEventListener("change",s(this,Ec)),this.connection.addEventListener("server-event",s(this,kc)),this.connection.addEventListener("channels-changed",s(this,Cc)),this.connection.addEventListener("server-reconnected",s(this,Tc)),this.connection.addEventListener("server-status",s(this,$c))}get storedAuthToken(){return q1(s(this,Ut).get(),this.connection.url)}async connect(){await u(this,er,Am).call(this,this.connection.token)}async authenticate(t){s(this,Ut).set(W1(s(this,Ut).get(),this.connection.url,t)),await u(this,er,Am).call(this,t)}dispose(){s(this,un)||(h(this,un,!0),this.connection.removeEventListener("change",s(this,Ec)),this.connection.removeEventListener("server-event",s(this,kc)),this.connection.removeEventListener("channels-changed",s(this,Cc)),this.connection.removeEventListener("server-reconnected",s(this,Tc)),this.connection.removeEventListener("server-status",s(this,$c)),this.connection.dispose())}}Ut=new WeakMap,un=new WeakMap,er=new WeakSet,Am=async function(t){if(!s(this,un)){u(this,er,Em).call(this,null);try{await this.connection.connect(t)}catch(r){u(this,er,Em).call(this,r instanceof xh?null:r instanceof Error?r.message:String(r))}}},Em=function(t){this.connectError!==t&&(this.connectError=t,this.dispatchEvent(new Jt("change")))},kS=function(){if(this.connection.status!=="unauthorized"||!this.connection.hasAuthRejected)return;const t=s(this,Ut).get(),r=W4(t,this.connection.url);r!==t&&s(this,Ut).set(r),this.connection.token!==null&&this.connection.clearToken()},Ec=new WeakMap,kc=new WeakMap,Cc=new WeakMap,Tc=new WeakMap,$c=new WeakMap;const km="tv-nav:",ja="tv-reload",Cy=100,rM=1e3,iM=60,sM=60,oM=24,aM=30,lM=aM*oM*sM*iM*rM;function Vr(n){try{const e=new URL(n,window.location.href),t=e.searchParams.has(ja);return e.searchParams.delete(ja),e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:t?e.toString():n}catch{return n}}var Rc,ra,ge,pe,bs,Pe,CS,Jr,TS,Cm,Tm;class cM extends ji{constructor(t,r){super();f(this,Pe);f(this,Rc);f(this,ra);f(this,ge,[]);f(this,pe,-1);f(this,bs,0);h(this,Rc,t),h(this,ra,Vr(r)),u(this,Pe,CS).call(this)}get currentURL(){var t;return s(this,pe)===-1?null:((t=s(this,ge)[s(this,pe)])==null?void 0:t.url)??null}get canGoBack(){return s(this,pe)>-1}get canGoForward(){return s(this,pe)<s(this,ge).length-1}get entries(){return s(this,ge).map(t=>({...t}))}get cursor(){return s(this,pe)}navigate(t){const r=Vr(t);if(r===s(this,ra)){if(s(this,pe)===-1)return;h(this,pe,-1),u(this,Pe,Jr).call(this);return}s(this,pe)<s(this,ge).length-1&&h(this,ge,s(this,ge).slice(0,s(this,pe)+1)),s(this,ge).push({url:r}),h(this,pe,s(this,ge).length-1),u(this,Pe,Cm).call(this),u(this,Pe,Jr).call(this)}replace(t){var i;if(s(this,pe)===-1){this.navigate(t);return}const r=Vr(t);if(r===s(this,ra)){h(this,ge,s(this,ge).filter((o,a)=>a!==s(this,pe))),h(this,pe,-1),u(this,Pe,Jr).call(this);return}((i=s(this,ge)[s(this,pe)])==null?void 0:i.url)!==r&&(h(this,ge,s(this,ge).map((o,a)=>a===s(this,pe)?{url:r}:o)),u(this,Pe,Jr).call(this))}back(){s(this,pe)!==-1&&(h(this,pe,s(this,pe)-1),u(this,Pe,Jr).call(this))}forward(){this.canGoForward&&(h(this,pe,s(this,pe)+1),u(this,Pe,Jr).call(this))}reset(){s(this,pe)===-1&&s(this,ge).length===0||(h(this,ge,[]),h(this,pe,-1),u(this,Pe,Jr).call(this))}}Rc=new WeakMap,ra=new WeakMap,ge=new WeakMap,pe=new WeakMap,bs=new WeakMap,Pe=new WeakSet,CS=function(){const t=localStorage.getItem(s(this,Pe,Tm));if(t!==null)try{const r=JSON.parse(t);if(!$S(r))return;h(this,ge,r.entries.map(i=>({url:i.url}))),h(this,pe,r.cursor),h(this,bs,r.lastWritten),u(this,Pe,Cm).call(this)}catch{h(this,ge,[]),h(this,pe,-1),h(this,bs,0)}},Jr=function(){h(this,bs,Date.now());try{localStorage.setItem(s(this,Pe,Tm),JSON.stringify(u(this,Pe,TS).call(this)))}catch(t){if(!dM(t))throw t}this.dispatchEvent(new Jt("change"))},TS=function(){return{v:1,entries:s(this,ge).map(t=>({...t})),cursor:s(this,pe),lastWritten:s(this,bs)}},Cm=function(){if(s(this,ge).length<=Cy)return;const t=s(this,ge).length-Cy;h(this,ge,s(this,ge).slice(t)),h(this,pe,Math.max(-1,s(this,pe)-t))},Tm=function(){return uM(s(this,Rc))};function uM(n){return`${km}${n}`}function hM(n){const e=Date.now()-lM,t=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(km)))continue;const o=i.slice(km.length),a=localStorage.getItem(i);if(a===null)continue;let l;try{l=JSON.parse(a)}catch{t.push(i);continue}if(!$S(l)){t.push(i);continue}!n.has(o)&&l.lastWritten<e&&t.push(i)}for(const r of t)localStorage.removeItem(r)}function dM(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function $S(n){if(typeof n!="object"||n===null)return!1;const e=n;if(e.v!==1||!Array.isArray(e.entries))return!1;const t=e.cursor;return typeof t!="number"||!Number.isInteger(t)||typeof e.lastWritten!="number"||!Number.isFinite(e.lastWritten)||t<-1||t>=e.entries.length?!1:e.entries.every(r=>typeof r=="object"&&r!==null&&typeof r.url=="string")}const Lf="tv-channel-sidebar-collapsed";var Ss;class pM{constructor(e){f(this,Ss);h(this,Ss,e)}read(){return s(this,Ss).getItem(Lf)==="true"}setCollapsed(e){try{e?s(this,Ss).setItem(Lf,"true"):s(this,Ss).removeItem(Lf)}catch{}}}Ss=new WeakMap;const Df="tv-channel-sidebar-width",$m=160,Rm=350,ih=260,fM=/^-?\d+$/;var _s;class mM{constructor(e){f(this,_s);h(this,_s,e)}read(){const e=s(this,_s).getItem(Df);if(e===null||!fM.test(e))return null;const t=BigInt(e);return t<BigInt($m)?$m:t>BigInt(Rm)?Rm:Number(t)}commit(e){const t=RS(Math.round(e));try{s(this,_s).setItem(Df,String(t))}catch{}return t}clear(){try{s(this,_s).removeItem(Df)}catch{}}}_s=new WeakMap;function RS(n){return Math.min(Math.max(n,$m),Rm)}const gM="1.3.8";function A0(n=gM){return n!==void 0&&n.length>0?n:"0.0.0"}function E0(){let n=!1;return{get pending(){return n},begin(e){n||(n=!0,e())}}}const Im="tv-reload-attempted";function vM(n){return n.originMatch?n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:y4(n.bundleVersion,n.serverVersion)?n.marker!==null&&n.marker.serverVersion===n.serverVersion?{action:"none"}:{action:"reload",marker:{serverVersion:n.serverVersion,fromVersion:n.bundleVersion}}:{action:"none"}:{action:"none"}}function yM(n){const e=n.getItem(Im);if(e===null)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const r=t;return typeof r.serverVersion!="string"||typeof r.fromVersion!="string"?null:{serverVersion:r.serverVersion,fromVersion:r.fromVersion}}function wM(n){const e=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,t=n.reload??(()=>location.reload()),r=n.navigationLatch??E0(),i=n.bundleVersion??A0();if(e===null)return{dispose(){}};let o=null;const a=()=>{if(o===null)return;const d=n.owner.connection;if(d.url!==n.primaryServerURL||d.status!=="connected")return;const p=o;o=null,d.sendTelemetrySignal("client_autoreloaded",{from_version:p.fromVersion,to_version:p.toVersion})},l=d=>{if(r.pending)return;const p=vM({bundleVersion:i,serverVersion:d.message.version,originMatch:d.serverURL===n.primaryServerURL,marker:yM(e)});switch(p.action){case"reload":e.setItem(Im,JSON.stringify(p.marker)),r.begin(t);return;case"signal-autoreloaded":e.removeItem(Im),o={fromVersion:p.fromVersion,toVersion:p.toVersion},a();return;case"none":return}},c=()=>{a()};return n.owner.addEventListener("server-status",l),n.owner.addEventListener("change",c),{dispose(){n.owner.removeEventListener("server-status",l),n.owner.removeEventListener("change",c)}}}function bM(n){const e=Hr(n.search),t=C2(n.search),r=t!==null&&Ap(t)?t:null;return{electron:e,shellVersion:r}}function SM(n){return!n.electron||n.requiredDesktopVersion===null||!Ap(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===ld?!1:d0(n.requiredDesktopVersion,n.shellVersion)}const _M=`# Desktop app upgrade required
|
|
44
|
+
|
|
45
|
+
Your Television server requires a newer version of this desktop app.
|
|
46
|
+
In a terminal, please upgrade:
|
|
47
|
+
|
|
48
|
+
\`\`\`bash
|
|
49
|
+
npm install -g @telepath-computer/television-desktop@latest
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
Then quit this app, and relaunch it from the terminal with:
|
|
53
|
+
|
|
54
|
+
\`\`\`bash
|
|
55
|
+
tv-desktop
|
|
56
|
+
\`\`\``;function IS(n){return n===null?_M:n.upgradeMarkdown}function AM(n){const e=SM(n);return{gated:e,instructionsMarkdown:e?IS(n.desktop):null,suppressUpdateToast:e}}function EM(n){const e=n.reload??(()=>location.reload()),t=n.navigationLatch??E0();let r=null,i=!1;const o=new Set,a=p=>{var g;return AM({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:p.requiredDesktopVersion,desktop:((g=p.update)==null?void 0:g.desktop)??null})};function l(){var p;(p=n.presentation)==null||p.suppressToasts()}function c(p){const g=p.requiredDesktopVersion;if(g===null||o.has(g))return;o.add(g);const y=r==null?void 0:r.connection;(y==null?void 0:y.url)===n.primaryServerURL&&y.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:g})}const d=p=>{t.pending||p.serverURL===n.primaryServerURL&&(a(p.message).gated?(i=!0,l(),c(p.message)):i&&t.begin(e))};return{get gated(){return i},decideBoot(p){return a(p).gated?"halt":"boot"},attach(p){r=p,p.addEventListener("server-status",d)},dispose(){r==null||r.removeEventListener("server-status",d),r=null}}}var ia;class kM extends ji{constructor(){super(...arguments);f(this,ia,!1)}get toastsSuppressed(){return s(this,ia)}suppressToasts(){s(this,ia)||(h(this,ia,!0),this.dispatchEvent(new Jt("change")))}}ia=new WeakMap;function CM(n,e=window){const t=e.__televisionAppearanceResolver;if(t!==void 0)return t;const r=e.matchMedia("(prefers-color-scheme: dark)");let i=n;const o=c=>c==="system"||c==="light"||c==="dark",a=()=>{const c=i==="system"?r.matches?"dark":"light":i;e.document.documentElement.dataset.theme=c},l={setPreference(c){o(c)&&(i=c,a())}};return e.__televisionAppearanceResolver=l,r.addEventListener("change",()=>{i==="system"&&a()}),a(),l}function xS(n){return typeof n=="object"&&n!==null}function PS(n){return!xS(n)||n.type!=="ready"?!1:!("id"in n)}function LS(n){return!(!xS(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const DS=nn(),OS="No handler registered for update-content",MS="handleUpdateContent: handler already registered",Ty="television-artifact-bridge";function NS(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const zS=lS(ji);var sa,oa,aa,As,Es,la,Ne,xm,US,FS,Io,Ph,Tw;let TM=(Tw=class extends zS{constructor(t){super();f(this,Ne);f(this,sa);f(this,oa);f(this,aa);f(this,As,null);f(this,Es,null);f(this,la,!1);h(this,sa,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");h(this,oa,r),h(this,aa,i=>u(this,Ne,US).call(this,i)),s(this,oa).addEventListener("message",s(this,aa))}get content(){return s(this,Es)}set content(t){u(this,Ne,Ph).call(this),h(this,Es,t),s(this,la)&&u(this,Ne,xm).call(this,t)}handleUpdateContent(t){if(u(this,Ne,Ph).call(this),s(this,As)!==null)throw new Error(MS);h(this,As,t)}notifyStylesChanged(){if(u(this,Ne,Ph).call(this),!s(this,la))return;const t={type:"styles-changed"};u(this,Ne,Io).call(this,t)}dispose(){s(this,oa).removeEventListener("message",s(this,aa)),h(this,As,null)}},sa=new WeakMap,oa=new WeakMap,aa=new WeakMap,As=new WeakMap,Es=new WeakMap,la=new WeakMap,Ne=new WeakSet,xm=function(t){const r={type:"content-updated",content:t};u(this,Ne,Io).call(this,r)},US=function(t){if(this.disposed||t.source!==s(this,sa).contentWindow)return;const r=t.data;if(PS(r)){h(this,la,!0),this.dispatchEvent(new DS("ready")),s(this,Es)!==null&&u(this,Ne,xm).call(this,s(this,Es));return}if(LS(r)){u(this,Ne,FS).call(this,r);return}},FS=async function(t){const r=s(this,As);if(r===null){u(this,Ne,Io).call(this,{type:"response",id:t.id,error:{message:OS}});return}try{await r(t.content)}catch(i){if(this.disposed)return;u(this,Ne,Io).call(this,{type:"response",id:t.id,error:{message:NS(i)}});return}this.disposed||u(this,Ne,Io).call(this,{type:"response",id:t.id,result:{}})},Io=function(t){const r=s(this,sa).contentWindow;r&&r.postMessage(t,"*")},Ph=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Tw);var ks,ca,Cs,Ts,ua,ze,Pm,ZS,HS,xo,Lh;class $M extends zS{constructor(t){super();f(this,ze);f(this,ks);f(this,ca);f(this,Cs,null);f(this,Ts,null);f(this,ua,!1);h(this,ks,t),h(this,ca,r=>u(this,ze,ZS).call(this,r)),s(this,ks).addEventListener("ipc-message",s(this,ca))}get content(){return s(this,Ts)}set content(t){u(this,ze,Lh).call(this),h(this,Ts,t),s(this,ua)&&u(this,ze,Pm).call(this,t)}handleUpdateContent(t){if(u(this,ze,Lh).call(this),s(this,Cs)!==null)throw new Error(MS);h(this,Cs,t)}notifyStylesChanged(){if(u(this,ze,Lh).call(this),!s(this,ua))return;const t={type:"styles-changed"};u(this,ze,xo).call(this,t)}dispose(){s(this,ks).removeEventListener("ipc-message",s(this,ca)),h(this,Cs,null)}}ks=new WeakMap,ca=new WeakMap,Cs=new WeakMap,Ts=new WeakMap,ua=new WeakMap,ze=new WeakSet,Pm=function(t){const r={type:"content-updated",content:t};u(this,ze,xo).call(this,r)},ZS=function(t){var o;if(this.disposed)return;const r=t.detail??t;if(!r||r.channel!==Ty)return;const i=(o=r.args)==null?void 0:o[0];if(PS(i)){h(this,ua,!0),this.dispatchEvent(new DS("ready")),s(this,Ts)!==null&&u(this,ze,Pm).call(this,s(this,Ts));return}if(LS(i)){u(this,ze,HS).call(this,i);return}},HS=async function(t){const r=s(this,Cs);if(r===null){u(this,ze,xo).call(this,{type:"response",id:t.id,error:{message:OS}});return}try{await r(t.content)}catch(i){if(this.disposed)return;u(this,ze,xo).call(this,{type:"response",id:t.id,error:{message:NS(i)}});return}this.disposed||u(this,ze,xo).call(this,{type:"response",id:t.id,result:{}})},xo=function(t){var r,i;(i=(r=s(this,ks)).send)==null||i.call(r,Ty,t)},Lh=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};/**
|
|
57
|
+
* @license
|
|
58
|
+
* Copyright 2017 Google LLC
|
|
59
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
60
|
+
*/const Ql=globalThis,$y=n=>n,fd=Ql.trustedTypes,Ry=fd?fd.createPolicy("lit-html",{createHTML:n=>n}):void 0,VS="$lit$",ti=`lit$${Math.random().toFixed(9).slice(2)}$`,BS="?"+ti,RM=`<${BS}>`,oo=document,oc=()=>oo.createComment(""),ac=n=>n===null||typeof n!="object"&&typeof n!="function",k0=Array.isArray,IM=n=>k0(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Of=`[
|
|
61
|
+
\f\r]`,yl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Iy=/-->/g,xy=/>/g,Xi=RegExp(`>|${Of}(?:([^\\s"'>=/]+)(${Of}*=${Of}*(?:[^
|
|
62
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Py=/'/g,Ly=/"/g,qS=/^(?:script|style|textarea|title)$/i,xM=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),U=xM(1),at=Symbol.for("lit-noChange"),ne=Symbol.for("lit-nothing"),Dy=new WeakMap,us=oo.createTreeWalker(oo,129);function WS(n,e){if(!k0(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ry!==void 0?Ry.createHTML(e):e}const PM=(n,e)=>{const t=n.length-1,r=[];let i,o=e===2?"<svg>":e===3?"<math>":"",a=yl;for(let l=0;l<t;l++){const c=n[l];let d,p,g=-1,y=0;for(;y<c.length&&(a.lastIndex=y,p=a.exec(c),p!==null);)y=a.lastIndex,a===yl?p[1]==="!--"?a=Iy:p[1]!==void 0?a=xy:p[2]!==void 0?(qS.test(p[2])&&(i=RegExp("</"+p[2],"g")),a=Xi):p[3]!==void 0&&(a=Xi):a===Xi?p[0]===">"?(a=i??yl,g=-1):p[1]===void 0?g=-2:(g=a.lastIndex-p[2].length,d=p[1],a=p[3]===void 0?Xi:p[3]==='"'?Ly:Py):a===Ly||a===Py?a=Xi:a===Iy||a===xy?a=yl:(a=Xi,i=void 0);const v=a===Xi&&n[l+1].startsWith("/>")?" ":"";o+=a===yl?c+RM:g>=0?(r.push(d),c.slice(0,g)+VS+c.slice(g)+ti+v):c+ti+(g===-2?l:v)}return[WS(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class lc{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,a=0;const l=e.length-1,c=this.parts,[d,p]=PM(e,t);if(this.el=lc.createElement(d,r),us.currentNode=this.el.content,t===2||t===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=us.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(VS)){const y=p[a++],v=i.getAttribute(g).split(ti),A=/([.?@])?(.*)/.exec(y);c.push({type:1,index:o,name:A[2],strings:v,ctor:A[1]==="."?DM:A[1]==="?"?OM:A[1]==="@"?MM:Dp}),i.removeAttribute(g)}else g.startsWith(ti)&&(c.push({type:6,index:o}),i.removeAttribute(g));if(qS.test(i.tagName)){const g=i.textContent.split(ti),y=g.length-1;if(y>0){i.textContent=fd?fd.emptyScript:"";for(let v=0;v<y;v++)i.append(g[v],oc()),us.nextNode(),c.push({type:2,index:++o});i.append(g[y],oc())}}}else if(i.nodeType===8)if(i.data===BS)c.push({type:2,index:o});else{let g=-1;for(;(g=i.data.indexOf(ti,g+1))!==-1;)c.push({type:7,index:o}),g+=ti.length-1}o++}}static createElement(e,t){const r=oo.createElement("template");return r.innerHTML=e,r}}function Ga(n,e,t=n,r){var a,l;if(e===at)return e;let i=r!==void 0?(a=t._$Co)==null?void 0:a[r]:t._$Cl;const o=ac(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((l=i==null?void 0:i._$AO)==null||l.call(i,!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=Ga(n,i._$AS(n,e.values),i,r)),e}class LM{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)??oo).importNode(t,!0);us.currentNode=i;let o=us.nextNode(),a=0,l=0,c=r[0];for(;c!==void 0;){if(a===c.index){let d;c.type===2?d=new Lp(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new NM(o,this,e)),this._$AV.push(d),c=r[++l]}a!==(c==null?void 0:c.index)&&(o=us.nextNode(),a++)}return us.currentNode=oo,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 Lp=class jS{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=ne,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=Ga(this,e,t),ac(e)?e===ne||e==null||e===""?(this._$AH!==ne&&this._$AR(),this._$AH=ne):e!==this._$AH&&e!==at&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):IM(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!==ne&&ac(this._$AH)?this._$AA.nextSibling.data=e:this.T(oo.createTextNode(e)),this._$AH=e}$(e){var o;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=lc.createElement(WS(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(t);else{const a=new LM(i,this),l=a.u(this.options);a.p(t),this.T(l),this._$AH=a}}_$AC(e){let t=Dy.get(e.strings);return t===void 0&&Dy.set(e.strings,t=new lc(e)),t}k(e){k0(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const o of e)i===t.length?t.push(r=new jS(this.O(oc()),this.O(oc()),this,this.options)):r=t[i],r._$AI(o),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=$y(e).nextSibling;$y(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},Dp=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=ne,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ne}_$AI(e,t=this,r,i){const o=this.strings;let a=!1;if(o===void 0)e=Ga(this,e,t,0),a=!ac(e)||e!==this._$AH&&e!==at,a&&(this._$AH=e);else{const l=e;let c,d;for(e=o[0],c=0;c<o.length-1;c++)d=Ga(this,l[r+c],t,c),d===at&&(d=this._$AH[c]),a||(a=!ac(d)||d!==this._$AH[c]),d===ne?e=ne:e!==ne&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}a&&!i&&this.j(e)}j(e){e===ne?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},DM=class extends Dp{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ne?void 0:e}},OM=class extends Dp{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ne)}},MM=class extends Dp{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=Ga(this,e,t,0)??ne)===at)return;const r=this._$AH,i=e===ne&&r!==ne||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==ne&&(r===ne||i);i&&this.element.removeEventListener(this.name,this,r),o&&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 NM{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){Ga(this,e)}}const zM={I:Lp},Mf=Ql.litHtmlPolyfillSupport;Mf==null||Mf(lc,Lp),(Ql.litHtmlVersions??(Ql.litHtmlVersions=[])).push("3.3.2");const Dh=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Lp(e.insertBefore(oc(),null),null,void 0,{})),i._$AI(n),i};/**
|
|
63
|
+
* @license
|
|
64
|
+
* Copyright 2020 Google LLC
|
|
65
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
66
|
+
*/const{I:UM}=zM,Oy=n=>n,GS=n=>n.strings===void 0,My=()=>document.createComment(""),wl=(n,e,t)=>{var o;const r=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){const a=r.insertBefore(My(),i),l=r.insertBefore(My(),i);t=new UM(a,l,n,n.options)}else{const a=t._$AB.nextSibling,l=t._$AM,c=l!==n;if(c){let d;(o=t._$AQ)==null||o.call(t,n),t._$AM=n,t._$AP!==void 0&&(d=n._$AU)!==l._$AU&&t._$AP(d)}if(a!==i||c){let d=t._$AA;for(;d!==a;){const p=Oy(d).nextSibling;Oy(r).insertBefore(d,i),d=p}}}return t},Qi=(n,e,t=n)=>(n._$AI(e,t),n),FM={},YS=(n,e=FM)=>n._$AH=e,ZM=n=>n._$AH,Nf=n=>{n._$AR(),n._$AA.remove()};/**
|
|
67
|
+
* @license
|
|
68
|
+
* Copyright 2017 Google LLC
|
|
69
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
+
*/const Xn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},ll=n=>(...e)=>({_$litDirective$:n,values:e});let Lu=class{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)}};/**
|
|
71
|
+
* @license
|
|
72
|
+
* Copyright 2017 Google LLC
|
|
73
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
74
|
+
*/const ec=(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),ec(i,e);return!0},md=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)},JS=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),BM(e)}};function HM(n){this._$AN!==void 0?(md(this),this._$AM=n,JS(this)):this._$AM=n}function VM(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 o=t;o<r.length;o++)ec(r[o],!1),md(r[o]);else r!=null&&(ec(r,!1),md(r));else ec(this,n)}const BM=n=>{n.type==Xn.CHILD&&(n._$AP??(n._$AP=VM),n._$AQ??(n._$AQ=HM))};class KS extends Lu{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),JS(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&&(ec(this,e),md(this))}setValue(e){if(GS(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(){}}var Ic,xc,ci,$s;class Ot extends KS{constructor(){super(...arguments);f(this,Ic,[]);f(this,xc,!1);f(this,ci,!1);f(this,$s,!1)}connected(){}template(...t){return at}render(...t){return!this.isConnected||s(this,ci)||this.setValue(t.length?t[0]:this.template(...s(this,Ic))),at}update(t,r){h(this,Ic,r),h(this,$s,!1),h(this,ci,!0);try{return s(this,xc)||(h(this,xc,!0),this.connected()),this.template(...r)}finally{h(this,ci,!1)}}reconnected(){h(this,ci,!0);try{this.connected()}finally{h(this,ci,!1)}h(this,$s,!0),queueMicrotask(()=>{s(this,$s)&&(h(this,$s,!1),this.render())})}}Ic=new WeakMap,xc=new WeakMap,ci=new WeakMap,$s=new WeakMap;function Mt(n){return ll(n)}function qM(n,e){var r;const t=n.connection;return t.authorizationRequired?t.authorizationRejected?{kind:"unauthorized",invalid:!0}:{kind:"unauthorized"}:t.gateHalted?{kind:"needs-upgrade",instructions:t.upgradeInstructions}:t.status!=="connected"?t.hasEverConnected?{kind:"disconnected",nextRetryAt:t.nextRetryAt}:t.firstConnectError!==null?{kind:"error",serverURL:e,message:t.firstConnectError}:{kind:"connecting"}:n.ready?n.channels.length===0?{kind:"no-channel"}:((r=n.focusedChannel)==null?void 0:r.pages.length)===0?{kind:"empty-channel"}:{kind:"connected"}:{kind:"connecting"}}const WM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/></svg>',jM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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"/></svg>',GM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"/></svg>',YM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/></svg>',JM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"/></svg>',KM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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"/></svg>',XM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"/></svg>',QM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"/></svg>',eN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>',tN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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"/></svg>',nN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"/></svg>',rN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"><path d="M74 96 128 46 182 96"/><path d="M74 160 128 210 182 160"/></svg>',iN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M71.59,61.47a8,8,0,0,0-15.18,0l-40,120A8,8,0,0,0,24,192h80a8,8,0,0,0,7.59-10.53ZM35.1,176,64,89.3,92.9,176ZM208,76a52,52,0,1,0-52,52A52.06,52.06,0,0,0,208,76Zm-88,0a36,36,0,1,1,36,36A36,36,0,0,1,120,76Zm104,68H136a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h88a8,8,0,0,0,8-8V152A8,8,0,0,0,224,144Zm-8,56H144V160h72Z"/></svg>',sN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,71.1a8,8,0,0,1-10.78-3.42,94.13,94.13,0,0,0-33.46-36.91,8,8,0,1,1,8.54-13.54,111.46,111.46,0,0,1,39.12,43.09A8,8,0,0,1,224,71.1ZM35.71,72a8,8,0,0,0,7.1-4.32A94.13,94.13,0,0,1,76.27,30.77a8,8,0,1,0-8.54-13.54A111.46,111.46,0,0,0,28.61,60.32,8,8,0,0,0,35.71,72Zm186.1,103.94A16,16,0,0,1,208,200H167.2a40,40,0,0,1-78.4,0H48a16,16,0,0,1-13.79-24.06C43.22,160.39,48,138.28,48,112a80,80,0,0,1,160,0C208,138.27,212.78,160.38,221.81,175.94ZM150.62,200H105.38a24,24,0,0,0,45.24,0ZM208,184c-10.64-18.27-16-42.49-16-72a64,64,0,0,0-128,0c0,29.52-5.38,53.74-16,72Z"/></svg>',oN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/></svg>',aN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"/></svg>',lN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,112a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm80-72H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/></svg>',cN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M53.92,34.62A8,8,0,1,0,42.08,45.38L67.37,73.2A69.82,69.82,0,0,0,38,87.63a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33,89.75,89.75,0,0,0,11.58-20.27l21.84,24a8,8,0,1,0,11.84-10.76ZM155.9,208,48,100.08C58.23,91.83,69.2,87.72,80.66,87.81l87.16,95.88C165.59,193.56,160.24,202.23,155.9,208Zm79.42-104-44.64,44.79a8,8,0,1,1-11.33-11.3L224,92.7,163.32,32,122.1,73.35a8,8,0,0,1-11.33-11.29L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.32,104Z"/></svg>',uN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/></svg>',hN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"/></svg>',dN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64ZM40,80H144V200H40ZM216,200H160V80h56V200Zm-16-84a12,12,0,1,1-12-12A12,12,0,0,1,200,116Zm0,48a12,12,0,1,1-12-12A12,12,0,0,1,200,164Z"/></svg>',pN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"/></svg>',fN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z"/></svg>',mN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z"/></svg>',gN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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"/></svg>',vN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"/></svg>',yN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"/></svg>',wN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"/></svg>',bN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg>',SN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/></svg>',_N='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/></svg>',AN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/></svg>',EN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"/></svg>',kN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40ZM216,200H40V88H216Z"/></svg>',CN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"/></svg>',TN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z"/></svg>',$N='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z"/></svg>',RN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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"/></svg>',IN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><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"/></svg>',xN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z"/></svg>',PN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M230.6,49.53A15.81,15.81,0,0,0,216,40H40A16,16,0,0,0,28.19,66.76l.08.09L96,139.17V216a16,16,0,0,0,24.87,13.32l32-21.34A16,16,0,0,0,160,194.66V139.17l67.74-72.32.08-.09A15.8,15.8,0,0,0,230.6,49.53ZM40,56h0Zm106.18,74.58A8,8,0,0,0,144,136v58.66L112,216V136a8,8,0,0,0-2.16-5.47L40,56H216Z"/></svg>',LN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"/></svg>',DN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',ON='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,200h-8V40a8,8,0,0,0-8-8H152a8,8,0,0,0-8,8V80H96a8,8,0,0,0-8,8v40H48a8,8,0,0,0-8,8v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16ZM160,48h40V200H160ZM104,96h40V200H104ZM56,144H88v56H56Z"/></svg>',MN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"/></svg>',NN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"/></svg>',zN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"/></svg>',UN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z"/></svg>',FN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z"/></svg>',ZN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z"/></svg>',HN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"/></svg>',VN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M212.92,17.69a8,8,0,0,0-6.86-1.45l-128,32A8,8,0,0,0,72,56V166.08A36,36,0,1,0,88,196V110.25l112-28v51.83A36,36,0,1,0,216,164V24A8,8,0,0,0,212.92,17.69ZM52,216a20,20,0,1,1,20-20A20,20,0,0,1,52,216ZM88,93.75V62.25l112-28v31.5ZM180,184a20,20,0,1,1,20-20A20,20,0,0,1,180,184Z"/></svg>',BN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',qN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"/></svg>',WN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M222.37,158.46l-47.11-21.11-.13-.06a16,16,0,0,0-15.17,1.4,8.12,8.12,0,0,0-.75.56L134.87,160c-15.42-7.49-31.34-23.29-38.83-38.51l20.78-24.71c.2-.25.39-.5.57-.77a16,16,0,0,0,1.32-15.06l0-.12L97.54,33.64a16,16,0,0,0-16.62-9.52A56.26,56.26,0,0,0,32,80c0,79.4,64.6,144,144,144a56.26,56.26,0,0,0,55.88-48.92A16,16,0,0,0,222.37,158.46ZM176,208A128.14,128.14,0,0,1,48,80,40.2,40.2,0,0,1,82.87,40a.61.61,0,0,0,0,.12l21,47L83.2,111.86a6.13,6.13,0,0,0-.57.77,16,16,0,0,0-1,15.7c9.06,18.53,27.73,37.06,46.46,46.11a16,16,0,0,0,15.75-1.14,8.44,8.44,0,0,0,.74-.56L168.89,152l47,21.05h0s.08,0,.11,0A40.21,40.21,0,0,1,176,208Z"/></svg>',jN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24h0A104,104,0,1,0,232,128,104.12,104.12,0,0,0,128,24Zm88,104a87.61,87.61,0,0,1-3.33,24H174.16a157.44,157.44,0,0,0,0-48h38.51A87.61,87.61,0,0,1,216,128ZM102,168H154a115.11,115.11,0,0,1-26,45A115.27,115.27,0,0,1,102,168Zm-3.9-16a140.84,140.84,0,0,1,0-48h59.88a140.84,140.84,0,0,1,0,48ZM40,128a87.61,87.61,0,0,1,3.33-24H81.84a157.44,157.44,0,0,0,0,48H43.33A87.61,87.61,0,0,1,40,128ZM154,88H102a115.11,115.11,0,0,1,26-45A115.27,115.27,0,0,1,154,88Zm52.33,0H170.71a135.28,135.28,0,0,0-22.3-45.6A88.29,88.29,0,0,1,206.37,88ZM107.59,42.4A135.28,135.28,0,0,0,85.29,88H49.63A88.29,88.29,0,0,1,107.59,42.4ZM49.63,168H85.29a135.28,135.28,0,0,0,22.3,45.6A88.29,88.29,0,0,1,49.63,168Zm98.78,45.6a135.28,135.28,0,0,0,22.3-45.6h35.66A88.29,88.29,0,0,1,148.41,213.6Z"/></svg>',GN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z"/></svg>',YN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,32H72A16,16,0,0,0,56,48V224a8,8,0,0,0,12.24,6.78L128,193.43l59.77,37.35A8,8,0,0,0,200,224V48A16,16,0,0,0,184,32Zm0,177.57-51.77-32.35a8,8,0,0,0-8.48,0L72,209.57V48H184Z"/></svg>',JN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"/></svg>',KN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z"/></svg>',XN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"/></svg>',QN='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"/></svg>',ez='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z"/></svg>',tz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,120H136V56h8a32,32,0,0,1,32,32,8,8,0,0,0,16,0,48.05,48.05,0,0,0-48-48h-8V24a8,8,0,0,0-16,0V40h-8a48,48,0,0,0,0,96h8v64H104a32,32,0,0,1-32-32,8,8,0,0,0-16,0,48.05,48.05,0,0,0,48,48h16v16a8,8,0,0,0,16,0V216h16a48,48,0,0,0,0-96Zm-40,0a32,32,0,0,1,0-64h8v64Zm40,80H136V136h16a32,32,0,0,1,0,64Z"/></svg>',nz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M24,104H48v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16H208V104h24a8,8,0,0,0,4.19-14.81l-104-64a8,8,0,0,0-8.38,0l-104,64A8,8,0,0,0,24,104Zm40,0H96v64H64Zm80,0v64H112V104Zm48,64H160V104h32ZM128,41.39,203.74,88H52.26ZM248,208a8,8,0,0,1-8,8H16a8,8,0,0,1,0-16H240A8,8,0,0,1,248,208Z"/></svg>',rz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,16V88H32V64Zm0,128H32V104H224v88Zm-16-24a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h32A8,8,0,0,1,208,168Zm-64,0a8,8,0,0,1-8,8H120a8,8,0,0,1,0-16h16A8,8,0,0,1,144,168Z"/></svg>',iz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,64H56a8,8,0,0,1,0-16H192a8,8,0,0,0,0-16H56A24,24,0,0,0,32,56V184a24,24,0,0,0,24,24H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64Zm0,128H56a8,8,0,0,1-8-8V78.63A23.84,23.84,0,0,0,56,80H216Zm-48-60a12,12,0,1,1,12,12A12,12,0,0,1,168,132Z"/></svg>',sz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M207.06,72.67A111.24,111.24,0,0,0,128,40h-.4C66.07,40.21,16,91,16,153.13V176a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V152A111.25,111.25,0,0,0,207.06,72.67ZM224,176H119.71l54.76-75.3a8,8,0,0,0-12.94-9.42L99.92,176H32V153.13c0-3.08.15-6.12.43-9.13H56a8,8,0,0,0,0-16H35.27c10.32-38.86,44-68.24,84.73-71.66V80a8,8,0,0,0,16,0V56.33A96.14,96.14,0,0,1,221,128H200a8,8,0,0,0,0,16h23.67c.21,2.65.33,5.31.33,8Z"/></svg>',oz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a8,8,0,0,1-8,8H204.94l-37.78,75.58A8,8,0,0,1,160,216h-.4a8,8,0,0,1-7.08-5.14L95.35,60.76,63.28,131.31A8,8,0,0,1,56,136H24a8,8,0,0,1,0-16H50.85L88.72,36.69a8,8,0,0,1,14.76.46l57.51,151,31.85-63.71A8,8,0,0,1,200,120h32A8,8,0,0,1,240,128Z"/></svg>',az='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z"/></svg>',lz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z"/></svg>',cz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z"/></svg>',uz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,136H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V152A16,16,0,0,0,208,136Zm0,64H48V152H208v48Zm0-160H48A16,16,0,0,0,32,56v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V56A16,16,0,0,0,208,40Zm0,64H48V56H208v48ZM192,80a12,12,0,1,1-12-12A12,12,0,0,1,192,80Zm0,96a12,12,0,1,1-12-12A12,12,0,0,1,192,176Z"/></svg>',hz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M223.85,47.12a16,16,0,0,0-15-15c-12.58-.75-44.73.4-71.41,27.07L132.69,64H74.36A15.91,15.91,0,0,0,63,68.68L28.7,103a16,16,0,0,0,9.07,27.16l38.47,5.37,44.21,44.21,5.37,38.49a15.94,15.94,0,0,0,10.78,12.92,16.11,16.11,0,0,0,5.1.83A15.91,15.91,0,0,0,153,227.3L187.32,193A15.91,15.91,0,0,0,192,181.64V123.31l4.77-4.77C223.45,91.86,224.6,59.71,223.85,47.12ZM74.36,80h42.33L77.16,119.52,40,114.34Zm74.41-9.45a76.65,76.65,0,0,1,59.11-22.47,76.46,76.46,0,0,1-22.42,59.16L128,164.68,91.32,128ZM176,181.64,141.67,216l-5.19-37.17L176,139.31Zm-74.16,9.5C97.34,201,82.29,224,40,224a8,8,0,0,1-8-8c0-42.29,23-57.34,32.86-61.85a8,8,0,0,1,6.64,14.56c-6.43,2.93-20.62,12.36-23.12,38.91,26.55-2.5,36-16.69,38.91-23.12a8,8,0,1,1,14.56,6.64Z"/></svg>',dz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"/></svg>',pz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"/></svg>',fz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z"/></svg>',mz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.27,47,25.53a8,8,0,0,0,4.2,0c1-.26,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0Z"/></svg>',gz='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"/></svg>',vz=':host,tv-icon:not(:defined){display:inline-flex;flex:none;width:1em;height:1em;vertical-align:-.125em}:host([size="sm"]),tv-icon:not(:defined)[size=sm]{font-size:16px}:host([size="md"]),tv-icon:not(:defined)[size=md]{font-size:20px}:host([size="lg"]),tv-icon:not(:defined)[size=lg]{font-size:24px}:host([size="xl"]),tv-icon:not(:defined)[size=xl]{font-size:32px}svg{width:100%;height:100%}:host([spinning])>svg{animation:tv-icon-spin 1s linear infinite}@keyframes tv-icon-spin{to{rotate:1turn}}@media (prefers-reduced-motion: reduce){:host([spinning])>svg{animation:none}}',XS=new CSSStyleSheet;XS.replaceSync(vz);const QS={check:WM,close:jM,copy:GM,pin:YM,search:JM,add:KM,more:XM,settings:QM,expand:eN,collapse:tN,"collapse-up":nN,select:rN,skills:iN,notification:sN,artifact:oN,spinner:aN,locked:lN,unpin:cN,back:uN,forward:hN,television:dN,calendar:pN,grid:fN,hash:mN,delete:gN,edit:vN,link:yN,external:wN,download:bN,reload:SN,warning:_N,info:AN,file:EN,folder:kN,clock:CN,user:TN,upload:$N,star:RN,home:IN,send:xN,filter:PN,sort:LN,help:DN,chart:ON,image:MN,chat:NN,location:zN,play:UN,pause:FN,stop:ZN,video:HN,music:VN,error:BN,email:qN,phone:WN,web:jN,tag:GN,bookmark:YN,table:JN,code:KN,group:XN,up:QN,down:ez,money:tz,bank:nz,card:rz,wallet:iz,gauge:sz,activity:oz,"trend-up":az,"trend-down":lz,database:cz,server:uz,deploy:hz,list:dz,terminal:pz,branch:fz,shield:mz,sidebar:gz};function yz(n){return n!==null&&Object.hasOwn(QS,n)}var Pc,Lm;class e_ extends HTMLElement{constructor(){super(...arguments);f(this,Pc)}connectedCallback(){u(this,Pc,Lm).call(this)}attributeChangedCallback(){this.isConnected&&u(this,Pc,Lm).call(this)}}Pc=new WeakSet,Lm=function(){const t=this.shadowRoot??this.attachShadow({mode:"open"});t.adoptedStyleSheets=[XS],this.replaceChildren();const r=this.getAttribute("name");t.innerHTML=yz(r)?QS[r]:""},C(e_,"observedAttributes",["name"]);customElements.get("tv-icon")||customElements.define("tv-icon",e_);function Op(n){return U`<div class="dialog-overlay"><dialog open><div class="dialog-content">${n}</div></dialog></div>`}function Mp(n,e){let t=!1;const r=o=>{o.preventDefault(),e("escape")},i=o=>{if(o.target!==n)return;const a=n.getBoundingClientRect();o.clientX>=a.left&&o.clientX<=a.right&&o.clientY>=a.top&&o.clientY<=a.bottom||e("backdrop")};n.addEventListener("cancel",r),n.addEventListener("click",i);for(const o of n.ownerDocument.querySelectorAll("tv-popover[open], tv-menu[open], tv-select[open]"))o.removeAttribute("open");return n.removeAttribute("open"),n.showModal(),{withdraw(){t||(t=!0,n.removeEventListener("cancel",r),n.removeEventListener("click",i),n.open&&n.close())}}}function cc(n){n==null||n.focus({preventScroll:!0}),n==null||n.scrollIntoView({block:"nearest"})}function t_(n,e){if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"||e.length===0)return!1;const t=e.indexOf(e[0].ownerDocument.activeElement),r=n.key==="ArrowDown",i=t<0?r?0:e.length-1:Math.max(0,Math.min(e.length-1,t+(r?1:-1)));return n.preventDefault(),n.stopImmediatePropagation(),cc(e[i]),!0}const Dm=new WeakMap;function Po(n,e,t){t===null?n.hasAttribute(e)&&n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}var br,Lc,Dc,ha,ui,Bi,Om,Rd,Id,xd,Pd,Ld,Mm;class wz{constructor(e){f(this,Bi);C(this,"document");C(this,"panels",new Set);f(this,br,new Map);f(this,Lc,new WeakMap);f(this,Dc,new AbortController);f(this,ha);f(this,ui,0);f(this,Rd,e=>{if(!(e.target instanceof Element))return;const t=e.target;s(this,Lc).set(e,{inside:new Set([...this.panels].filter(r=>{var i;return this.contains(r,t)||((i=r.trigger)==null?void 0:i.contains(t))})),open:[...this.panels].filter(r=>r.open)})});f(this,Id,e=>{var o,a,l;if(!(e.target instanceof Element))return;const t=e.target,r=s(this,Lc).get(e),i=[...this.panels].find(c=>{var d;return(d=c.trigger)==null?void 0:d.contains(t)});for(const c of(r==null?void 0:r.open)??[])c.open&&!c.manual&&c!==i&&!(r!=null&&r.inside.has(c))&&c.close();if(i&&!((o=i.trigger)!=null&&o.disabled))i.toggle(e.detail===0);else for(const c of[...this.panels])c.open&&c.host.contains(t)&&((l=(a=c.behavior).click)==null||l.call(a,t))});f(this,xd,e=>{var t,r;if(e.target instanceof Element)for(const i of this.panels)i.open&&i.host.contains(e.target)&&((r=(t=i.behavior).pointermove)==null||r.call(t,e.target))});f(this,Pd,e=>{var o,a,l,c;const t=u(this,Bi,Om).call(this),r=t.find(d=>d.behavior.select),i=r??t.find(d=>d.behavior.keydown);if(!((a=i==null?void 0:(o=i.behavior).keydown)!=null&&a.call(o,e))){if(e.key==="Escape"&&r){u(this,Bi,Mm).call(this,e,t,r);return}for(const d of this.panels)if(!d.open&&d.trigger===this.document.activeElement&&((c=(l=d.behavior).keydown)!=null&&c.call(l,e)))return}});f(this,Ld,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;const t=u(this,Bi,Om).call(this);u(this,Bi,Mm).call(this,e,t)});this.document=e;const t={signal:s(this,Dc).signal};e.addEventListener("click",s(this,Rd),{...t,capture:!0}),e.addEventListener("click",s(this,Id),t),e.addEventListener("keydown",s(this,Pd),{...t,capture:!0}),e.addEventListener("keydown",s(this,Ld),t),e.addEventListener("pointermove",s(this,xd),t),h(this,ha,new MutationObserver(()=>{for(const r of[...this.panels])r.refresh()})),s(this,ha).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["id","trigger","selected","value","aria-expanded","role","aria-haspopup","aria-controls","aria-activedescendant"]})}animate(){if(s(this,ui))return;const e=()=>{h(this,ui,0);for(const t of this.panels)t.open&&t.place();[...this.panels].some(t=>t.open)&&h(this,ui,this.document.defaultView.requestAnimationFrame(e))};h(this,ui,this.document.defaultView.requestAnimationFrame(e))}remove(e){this.closed(e),this.panels.delete(e),!this.panels.size&&(s(this,Dc).abort(),s(this,ha).disconnect(),this.document.defaultView.cancelAnimationFrame(s(this,ui)),Dm.delete(this.document))}prepareOpen(e){let t=null;for(const r of this.panels)r===e||!r.open||!e.trigger||!r.host.contains(e.trigger)||(t===null||t.host.contains(r.host))&&(t=r);if(s(this,br).set(e,t),!(e.manual||e.behavior.select))for(const r of this.panels)r.open&&r!==e&&!r.manual&&!r.behavior.select&&!this.isDescendant(e,r)&&r.close()}isDescendant(e,t){for(let r=s(this,br).get(e);r;r=s(this,br).get(r))if(r===t)return!0;return!1}contains(e,t){return t?e.host.contains(t)||[...this.panels].some(r=>this.isDescendant(r,e)&&r.host.contains(t)):!1}closeDescendants(e){for(const t of[...this.panels])this.isDescendant(t,e)&&t.close(!1)}closed(e){s(this,br).delete(e)}}br=new WeakMap,Lc=new WeakMap,Dc=new WeakMap,ha=new WeakMap,ui=new WeakMap,Bi=new WeakSet,Om=function(){const e=t=>{let r=0;for(let i=s(this,br).get(t);i;i=s(this,br).get(i))r++;return r};return[...this.panels].filter(t=>t.open).reverse().sort((t,r)=>e(r)-e(t))},Rd=new WeakMap,Id=new WeakMap,xd=new WeakMap,Pd=new WeakMap,Ld=new WeakMap,Mm=function(e,t,r){if(!r&&t.some(o=>o.manual&&e.composedPath().includes(o.host)))return;const i=r??t.find(o=>!o.manual);i&&!i.manual&&(e.preventDefault(),e.stopImmediatePropagation(),i.close())};var $e,hi,Rs,da,di,pi,ht,Nm,n_,zm,Oc,r_,Um;class C0{constructor(e,t={}){f(this,ht);C(this,"host");C(this,"behavior");C(this,"trigger",null);f(this,$e);f(this,hi,!1);f(this,Rs,!1);f(this,da,!0);f(this,di,new Map);f(this,pi,new Set);f(this,Oc,e=>{const t=e.target;t instanceof HTMLElement&&t!==this.host&&this.host.contains(t)&&s(this,pi).add(t)});this.host=e,this.behavior=t}get open(){return this.host.hasAttribute("open")&&s(this,hi)}get manual(){return this.host.hasAttribute("manual")}connect(){if(s(this,$e))return;const e=this.host.ownerDocument;h(this,$e,Dm.get(e)),s(this,$e)||(h(this,$e,new wz(e)),Dm.set(e,s(this,$e))),s(this,$e).panels.add(this),this.refresh()}disconnect(){var t,r,i,o;if(!s(this,$e))return;const e=s(this,$e).contains(this,this.host.ownerDocument.activeElement);h(this,hi,!1),s(this,$e).closeDescendants(this),s(this,$e).closed(this),this.host.removeAttribute("open"),(r=(t=this.behavior).closed)==null||r.call(t),u(this,ht,zm).call(this),u(this,ht,Um).call(this),e&&((i=this.trigger)!=null&&i.isConnected)&&this.trigger.focus({preventScroll:!0}),u(this,ht,Nm).call(this),(o=s(this,$e))==null||o.remove(this),h(this,$e,void 0)}refresh(){var r,i,o,a,l,c,d;if(!s(this,$e))return;const e=this.host.ownerDocument.getElementById(this.host.getAttribute("trigger")??""),t=e instanceof HTMLButtonElement?e:null;if(t!==this.trigger&&(u(this,ht,Nm).call(this),this.trigger=t),this.trigger&&Po(this.trigger,"aria-expanded",this.host.hasAttribute("open")?"true":"false"),(i=(r=this.behavior).refresh)==null||i.call(r),this.host.hasAttribute("open")&&!this.trigger){this.host.removeAttribute("open");return}if(this.host.hasAttribute("open")!==s(this,hi))if(this.host.hasAttribute("open"))s(this,$e).prepareOpen(this),h(this,hi,!0),u(this,ht,n_).call(this),u(this,ht,r_).call(this),this.place(),(a=(o=this.behavior).opened)==null||a.call(o,s(this,Rs)),h(this,Rs,!1),s(this,$e).animate();else{const p=s(this,$e).contains(this,this.host.ownerDocument.activeElement);h(this,hi,!1),s(this,$e).closeDescendants(this),s(this,$e).closed(this),(c=(l=this.behavior).closed)==null||c.call(l),u(this,ht,zm).call(this),u(this,ht,Um).call(this),p&&s(this,da)&&((d=this.trigger)!=null&&d.isConnected)&&this.trigger.focus({preventScroll:!0})}}toggle(e=!1){h(this,Rs,e),this.host.toggleAttribute("open")}show(e=!1){h(this,Rs,e),this.host.setAttribute("open","")}close(e=!0){h(this,da,e),this.host.removeAttribute("open"),this.refresh(),h(this,da,!0)}place(){var ve,Xe,Ue;if(!this.open||!this.trigger)return;const e=this.host,t=e.ownerDocument.defaultView,r=this.trigger.getBoundingClientRect();if(!this.trigger.isConnected){this.close();return}const i=Number.parseFloat(t.getComputedStyle(e).getPropertyValue("--popover-distance"));if(!Number.isFinite(i))return;const o=e.scrollTop,a=e.scrollLeft,l=[];for(const le of s(this,pi)){if(!le.isConnected||!e.contains(le)){s(this,pi).delete(le);continue}l.push({element:le,scrollTop:le.scrollTop,scrollLeft:le.scrollLeft})}e.style.maxWidth="none";const c=s(this,di).get("max-height");c!=null&&c.value?e.style.setProperty("max-height",c.value,c.priority):e.style.removeProperty("max-height");const d=t.getComputedStyle(e).maxHeight;e.style.minWidth=this.behavior.select?`${Math.min(r.width,t.innerWidth-2*i)}px`:((ve=s(this,di).get("min-width"))==null?void 0:ve.value)??"";const p=e.getBoundingClientRect(),g=Math.max(0,t.innerWidth-i-r.left),y=Math.max(0,r.right-i),v=p.width>g&&y>g,A=Math.min(t.innerWidth-2*i,v?y:g),E=Number.parseFloat(t.getComputedStyle(e).minWidth)||0;e.style.minWidth=`${Math.max(0,Math.min(E,A))}px`,e.style.maxWidth=`${Math.max(0,A)}px`;const x=e.getBoundingClientRect(),B=x.width,P=x.height,J=Math.max(i,Math.min(v?r.right-B:r.left,t.innerWidth-i-B));let O,Y;if(this.behavior.select){const le=(Ue=(Xe=this.behavior).selectedRow)==null?void 0:Ue.call(Xe),nr=le?le.getBoundingClientRect().top+le.offsetHeight/2-x.top:0,Nt=r.top+r.height/2-nr;if(Nt>=i&&Nt+P<=t.innerHeight-i)O=Nt,Y=t.innerHeight-i-Nt;else{const ul=t.innerHeight-i-r.top,hl=r.bottom-i,Mu=P>ul&&hl>ul;Y=Mu?hl:ul,O=Mu?r.bottom-Math.min(P,Y):r.top}}else{const le=Math.max(0,t.innerHeight-i-r.bottom-i),nr=Math.max(0,r.top-2*i),Nt=P>le&&nr>le;Y=Nt?nr:le,O=Nt?r.top-i-Math.min(P,nr):r.bottom+i}const Z=`${Math.max(0,Y)}px`;e.style.maxHeight=d==="none"?Z:`min(${d}, ${Z})`,e.style.left=`${J}px`,e.style.top=`${Math.max(i,Math.min(O,t.innerHeight-i-Math.min(P,Y)))}px`;const j=t.getComputedStyle(e),fe=j.boxSizing==="border-box",de=parseFloat(j.width)+(fe?0:parseFloat(j.paddingLeft)+parseFloat(j.paddingRight)+parseFloat(j.borderLeftWidth)+parseFloat(j.borderRightWidth)),Ve=parseFloat(j.height)+(fe?0:parseFloat(j.paddingTop)+parseFloat(j.paddingBottom)+parseFloat(j.borderTopWidth)+parseFloat(j.borderBottomWidth));e.style.setProperty("--_panel-edge-inset",`${e.style.top} auto auto ${e.style.left}`),e.style.setProperty("--_panel-edge-width",`${de}px`),e.style.setProperty("--_panel-edge-height",`${Ve}px`),e.scrollTop=o,e.scrollLeft=a;for(const le of l)le.element.scrollTop=le.scrollTop,le.element.scrollLeft=le.scrollLeft}}$e=new WeakMap,hi=new WeakMap,Rs=new WeakMap,da=new WeakMap,di=new WeakMap,pi=new WeakMap,ht=new WeakSet,Nm=function(){var e,t;this.trigger&&(this.trigger.removeAttribute("aria-expanded"),(t=(e=this.behavior).unpair)==null||t.call(e,this.trigger),this.trigger=null)},n_=function(){s(this,pi).clear(),this.host.addEventListener("scroll",s(this,Oc),!0)},zm=function(){this.host.removeEventListener("scroll",s(this,Oc),!0),s(this,pi).clear()},Oc=new WeakMap,r_=function(){const e=this.host;for(const t of["position","z-index","left","top","margin","max-width","max-height","min-width","overflow","--_panel-edge-position","--_panel-edge-inset","--_panel-edge-width","--_panel-edge-height"])s(this,di).set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)});e.style.position="fixed",e.style.zIndex="var(--layer-panel)",e.style.margin="0",e.style.overflow="auto",e.style.setProperty("--_panel-edge-position","fixed")},Um=function(){for(const[e,{value:t,priority:r}]of s(this,di))t?this.host.style.setProperty(e,t,r):this.host.style.removeProperty(e);s(this,di).clear()};class bz extends HTMLElement{constructor(){super(),this.attachInternals().role="menuitem"}connectedCallback(){this.tabIndex=-1}}var fi,tr,Fm,Zm,s_;class i_ extends HTMLElement{constructor(){super();f(this,tr);f(this,fi,new C0(this,{opened:t=>{t&&cc(u(this,tr,Fm).call(this)[0])},keydown:t=>u(this,tr,s_).call(this,t),pointermove:t=>cc(u(this,tr,Zm).call(this,t)??void 0),click:t=>{u(this,tr,Zm).call(this,t)&&s(this,fi).close()}}));this.attachInternals().role="menu"}connectedCallback(){s(this,fi).connect()}disconnectedCallback(){s(this,fi).disconnect()}attributeChangedCallback(){s(this,fi).refresh()}}fi=new WeakMap,tr=new WeakSet,Fm=function(){return[...this.querySelectorAll("tv-menu-item")]},Zm=function(t){const r=t.closest("tv-menu-item");return(r==null?void 0:r.closest("tv-menu"))===this?r:null},s_=function(t){if(!s(this,fi).open)return!1;const r=u(this,tr,Fm).call(this),i=r.indexOf(this.ownerDocument.activeElement);return t_(t,r)?!0:t.key==="Enter"&&i>=0?(t.preventDefault(),t.stopImmediatePropagation(),r[i].click(),!0):!1},C(i_,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-menu-item")||customElements.define("tv-menu-item",bz);customElements.get("tv-menu")||customElements.define("tv-menu",i_);let Sz=0;var Mc;class _z extends Ot{constructor(){super(...arguments);f(this,Mc,`menu-trigger-${++Sz}`)}template(t,{trigger:r}){return U`${r(s(this,Mc))}<tv-menu trigger=${s(this,Mc)}>
|
|
75
|
+
${t.map(i=>"separator"in i?U`<hr>`:U`<tv-menu-item intent=${i.destructive?"danger":ne} @click=${i.action}>${i.label}</tv-menu-item>`)}
|
|
76
|
+
</tv-menu>`}}Mc=new WeakMap;const o_=Mt(_z);/**
|
|
77
|
+
* @license
|
|
78
|
+
* Copyright 2020 Google LLC
|
|
79
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
80
|
+
*/const vn=()=>new Az;class Az{}const zf=new WeakMap,Je=ll(class extends KS{render(n){return ne}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)),ne}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=zf.get(e);t===void 0&&(t=new WeakMap,zf.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=zf.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)}});/**
|
|
81
|
+
* @license
|
|
82
|
+
* Copyright 2017 Google LLC
|
|
83
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
84
|
+
*/const Ny=(n,e,t)=>{const r=new Map;for(let i=e;i<=t;i++)r.set(n[i],i);return r},gd=ll(class extends Lu{constructor(n){if(super(n),n.type!==Xn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);const i=[],o=[];let a=0;for(const l of n)i[a]=r?r(l,a):a,o[a]=t(l,a),a++;return{values:o,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,r]){const i=ZM(n),{values:o,keys:a}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=a,o;const l=this.ut??(this.ut=[]),c=[];let d,p,g=0,y=i.length-1,v=0,A=o.length-1;for(;g<=y&&v<=A;)if(i[g]===null)g++;else if(i[y]===null)y--;else if(l[g]===a[v])c[v]=Qi(i[g],o[v]),g++,v++;else if(l[y]===a[A])c[A]=Qi(i[y],o[A]),y--,A--;else if(l[g]===a[A])c[A]=Qi(i[g],o[A]),wl(n,c[A+1],i[g]),g++,A--;else if(l[y]===a[v])c[v]=Qi(i[y],o[v]),wl(n,i[g],i[y]),y--,v++;else if(d===void 0&&(d=Ny(a,v,A),p=Ny(l,g,y)),d.has(l[g]))if(d.has(l[y])){const E=p.get(a[v]),x=E!==void 0?i[E]:null;if(x===null){const B=wl(n,i[g]);Qi(B,o[v]),c[v]=B}else c[v]=Qi(x,o[v]),wl(n,i[g],x),i[E]=null;v++}else Nf(i[y]),y--;else Nf(i[g]),g++;for(;v<=A;){const E=wl(n,c[A+1]);Qi(E,o[v]),c[v++]=E}for(;g<=y;){const E=i[g++];E!==null&&Nf(E)}return this.ut=a,YS(n,c),at}});/**
|
|
85
|
+
* @license
|
|
86
|
+
* Copyright 2018 Google LLC
|
|
87
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
88
|
+
*/const a_="important",Ez=" !"+a_,vd=ll(class extends Lu{constructor(n){var e;if(super(n),n.type!==Xn.ATTRIBUTE||n.name!=="style"||((e=n.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[e]){const{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(const r in e){const i=e[r];if(i!=null){this.ft.add(r);const o=typeof i=="string"&&i.endsWith(Ez);r.includes("-")||o?t.setProperty(r,o?i.slice(0,-11):i,o?a_:""):t[r]=i}}return at}}),kz=24;function Cz(n){return!zy(n.source)||!zy(n.current)||!Lz(n.source,n.current)||!Dz(n)||!Pz(n.geometry)?{kind:"invalidated"}:Rz(n.pointer,n.geometry)==="pinned"?Tz(n):$z(n)}function Tz(n){var c;const{source:e,current:t,pointer:r,geometry:i}=n,a=(((c=i.placeholder)==null?void 0:c.side)==="pinned"&&r.y>=i.placeholder.top&&r.y<=i.placeholder.bottom?i.placeholder.index:null)??Iz(r.y,i.pinnedRows),l=t.pinnedChannelIds.filter(d=>d!==e.channelId);return l.splice(a,0,e.channelId),{kind:"placement",side:"pinned",placeholder:{side:"pinned",index:a},operation:l}}function $z(n){const{source:e,current:t}=n,r=e.pinnedChannelIds.includes(e.channelId),i=r?xz(t.unpinnedChannelIds,e.channelId):e.unpinnedChannelIds.indexOf(e.channelId);return{kind:"placement",side:"unpinned",placeholder:r&&t.unpinnedChannelIds.length===0?null:{side:"unpinned",index:i},operation:r?t.pinnedChannelIds.filter(o=>o!==e.channelId):null}}function Rz(n,e){const{sidebar:t}=e;if(n.x<t.left||n.x>t.right||n.y<t.top||n.y>t.bottom)return"unpinned";const i=e.unpinnedGroupTop??(e.pinnedContentBottom===null?Number.NEGATIVE_INFINITY:e.pinnedContentBottom+kz);return n.y<i?"pinned":"unpinned"}function Iz(n,e){const t=e.findIndex(({top:r,bottom:i})=>n<r+(i-r)/2);return t===-1?e.length:t}function xz(n,e){const t=n.filter(i=>i!==e),r=t.findIndex(i=>i<e);return r===-1?t.length:r}function Pz(n){return n.unpinnedGroupTop!==null||n.pinnedContentBottom!==null}function zy(n){const e=[...n.pinnedChannelIds,...n.unpinnedChannelIds];return new Set(e).size===e.length}function Lz(n,e){return Hm(n.pinnedChannelIds,e.pinnedChannelIds)&&Hm(n.unpinnedChannelIds,e.unpinnedChannelIds)}function Dz(n){const e=n.current.pinnedChannelIds.filter(o=>o!==n.source.channelId),t=n.geometry.pinnedRows.map(({channelId:o})=>o),r=n.geometry.placeholder,i=r===null||Number.isInteger(r.index)&&r.index>=0&&r.index<=(r.side==="pinned"?e.length:n.current.unpinnedChannelIds.length);return n.source.pinnedChannelIds.includes(n.source.channelId)!==n.source.unpinnedChannelIds.includes(n.source.channelId)&&Hm(e,t)&&i}function Hm(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}const l_=4,Zo=200,Kt=28,yd=800,sh="ease",Uy=.5,bl=.5,Oz="New channel",es=".channel-group:not(.channel-group-withdrawal) .channel-row",Mz=24;var pt,Rt,nt,Ge,It,ft,Mn,Is,be,se,Ft,Zt,Ht,mt,gt,vt,Vt,yt,Nn,Sr,pa,fa,mi,T,Vm,u_,h_,d_,p_,Oh,f_,m_,g_,v_,Dl,Lo,y_,w_,Bm,Ol,Dd,Od,Md,Nd,b_,qm,Wm,S_,Nc,zc,__,zd,Uc,A_,E_,Ml,jm,k_,C_,Nl,Gm,Ym,Jm,T_,Mh,Fc,Zc,Hc,Vc,$_,Km,Nh,zh,zl,Xm,Qm;class c_{constructor(e){f(this,T);f(this,pt);f(this,Rt,null);f(this,nt,null);f(this,Ge,{management:!0});f(this,It,!1);f(this,ft,null);f(this,Mn,"");f(this,Is,!1);f(this,be,null);f(this,se,null);f(this,Ft,!1);f(this,Zt,null);f(this,Ht,null);f(this,mt,null);f(this,gt,null);f(this,vt,null);f(this,Vt,null);f(this,yt,null);f(this,Nn,null);f(this,Sr,vn());f(this,pa,vn());f(this,fa,vn());f(this,mi,null);C(this,"create",()=>{const e=s(this,Rt),t=s(this,nt);if(e===null||t===null||s(this,Zt)!==null)return;const r={resultChannelId:null};h(this,Zt,r),s(this,pt).call(this),e.createChannel(Oz).then(i=>{r.resultChannelId=i.id,e.focusChannel(i.id).catch(()=>{}),s(this,Zt)===r&&s(this,pt).call(this)},()=>{s(this,Zt)!==r||s(this,Ht)!==null||(h(this,Zt,null),s(this,pt).call(this))})});f(this,Dd,e=>{h(this,Mn,e.currentTarget.value)});f(this,Od,e=>{e.key==="Enter"?(e.preventDefault(),u(this,T,Ol).call(this,!0)):e.key==="Escape"&&(e.preventDefault(),u(this,T,Ol).call(this,!1))});f(this,Md,()=>{u(this,T,Ol).call(this,!0)});f(this,Nd,e=>{e.preventDefault(),u(this,T,Ol).call(this,!0)});f(this,Nc,()=>{h(this,Ft,!1)});f(this,zc,e=>{!s(this,Ft)||e.detail===0||(h(this,Ft,!1),e.preventDefault(),e.stopImmediatePropagation())});f(this,zd,e=>{var t;!s(this,Ge).highlightOnPointerMove||s(this,se)!==null||s(this,ft)!==null||(t=s(this,Sr).value)!=null&&t.querySelector("tv-menu[open]")||cc(e.currentTarget)});f(this,Uc,e=>{if(s(this,It)){h(this,be,null);return}const t=s(this,se);if(t!==null){if(t.pointerId!==e.pointerId)return;e.preventDefault(),u(this,T,Ml).call(this,t,e);return}const r=s(this,be);if(!(r===null||r.pointerId!==e.pointerId)){if(e.buttons===0){h(this,be,null);return}Math.hypot(e.clientX-r.x,e.clientY-r.y)<=l_||u(this,T,A_).call(this,r,e)}});f(this,Fc,e=>{var r;const t=s(this,se);if(t!==null&&t.pointerId===e.pointerId){if(t.completed)return;const i=t.captureTarget.hasPointerCapture(e.pointerId);u(this,T,Ml).call(this,t,e);const o=i&&t.placement.kind==="placement"?t.placement.operation:null,a=s(this,Rt);if(o===null||a===null){u(this,T,zl).call(this,t,!1);return}t.completed=!0,u(this,T,Nl).call(this,t),t.operation=[...o],a.setPinnedChannelIds([...o]).then(()=>{s(this,se)===t&&(t.operationResolved=!0,u(this,T,Km).call(this,s(this,nt)))},()=>{s(this,se)===t&&(t.operationResolved=!0,t.operationRejected=!0,u(this,T,Nh).call(this,t))});return}((r=s(this,be))==null?void 0:r.pointerId)===e.pointerId&&h(this,be,null)});f(this,Zc,e=>{var t,r;((t=s(this,se))==null?void 0:t.pointerId)===e.pointerId&&!s(this,se).completed?u(this,T,zh).call(this):((r=s(this,be))==null?void 0:r.pointerId)===e.pointerId&&h(this,be,null)});f(this,Hc,e=>{const t=s(this,se);t===null||t.pointerId!==e.pointerId||t.completed||u(this,T,zl).call(this,t,!1)});f(this,Vc,e=>{e.key!=="Escape"||s(this,se)===null||s(this,se).completed||(e.preventDefault(),e.stopImmediatePropagation(),u(this,T,zh).call(this))});h(this,pt,e)}get creating(){return s(this,Zt)!==null}get dragging(){return s(this,se)!==null}connect(){window.addEventListener("pointermove",s(this,Uc)),window.addEventListener("pointerup",s(this,Fc)),window.addEventListener("pointercancel",s(this,Zc)),window.addEventListener("lostpointercapture",s(this,Hc)),window.addEventListener("keydown",s(this,Vc),!0),window.addEventListener("click",s(this,zc),!0),window.addEventListener("pointerdown",s(this,Nc),!0)}update(e,t,r){const i=s(this,nt),o=s(this,It);h(this,Rt,e),h(this,nt,t),h(this,Ge,r),h(this,It,r.motionSuppressed??!1),!o&&s(this,It)&&u(this,T,y_).call(this),u(this,T,$_).call(this,t),u(this,T,d_).call(this,t),u(this,T,g_).call(this,i,t),s(this,ft)!==null&&!t.channels.some(({id:l})=>l===s(this,ft))&&(h(this,ft,null),h(this,Mn,"")),u(this,T,Km).call(this,t);const a=s(this,mi);a!==null&&t.display.pinnedChannelIds.includes(a.channelId)===a.pinned&&(h(this,mi,null),queueMicrotask(()=>{const l=u(this,T,qm).call(this,a.channelId);l==null||l.scrollIntoView({block:"nearest"}),a.focus&&(l==null||l.focus({preventScroll:!0}))})),o&&!s(this,It)&&u(this,T,w_).call(this)}template(){var r;const e=s(this,nt);if(e===null)return ne;const t=u(this,T,v_).call(this,Fy(e,(r=s(this,se))==null?void 0:r.source));return U`
|
|
89
|
+
<div
|
|
90
|
+
class="channel-list"
|
|
91
|
+
role="listbox"
|
|
92
|
+
aria-label="Channels"
|
|
93
|
+
${Je(s(this,Sr))}
|
|
94
|
+
>
|
|
95
|
+
${u(this,T,Vm).call(this,"Pinned",t.pinned)}
|
|
96
|
+
${u(this,T,Vm).call(this,"Recent",t.unpinned)}
|
|
97
|
+
</div>
|
|
98
|
+
`}overlayTemplate(){return s(this,Ge).management?u(this,T,m_).call(this):ne}disconnect(){var e,t,r;window.removeEventListener("pointermove",s(this,Uc)),window.removeEventListener("pointerup",s(this,Fc)),window.removeEventListener("pointercancel",s(this,Zc)),window.removeEventListener("lostpointercapture",s(this,Hc)),window.removeEventListener("keydown",s(this,Vc),!0),window.removeEventListener("click",s(this,zc),!0),window.removeEventListener("pointerdown",s(this,Nc),!0),u(this,T,Xm).call(this),(e=s(this,Nn))==null||e.withdraw(),h(this,Nn,null),(t=s(this,Vt))==null||t.cancel(),h(this,Vt,null),(r=s(this,yt))==null||r.cancel(),h(this,yt,null),h(this,Rt,null),h(this,nt,null),h(this,ft,null),h(this,Mn,""),h(this,Is,!1),h(this,be,null),h(this,Ft,!1),h(this,Zt,null),h(this,Ht,null),h(this,mt,null),h(this,gt,null),h(this,vt,null),h(this,mi,null)}}pt=new WeakMap,Rt=new WeakMap,nt=new WeakMap,Ge=new WeakMap,It=new WeakMap,ft=new WeakMap,Mn=new WeakMap,Is=new WeakMap,be=new WeakMap,se=new WeakMap,Ft=new WeakMap,Zt=new WeakMap,Ht=new WeakMap,mt=new WeakMap,gt=new WeakMap,vt=new WeakMap,Vt=new WeakMap,yt=new WeakMap,Nn=new WeakMap,Sr=new WeakMap,pa=new WeakMap,fa=new WeakMap,mi=new WeakMap,T=new WeakSet,Vm=function(e,t){var p;const r=e==="Pinned"?"pinned":"unpinned",i=s(this,se);if(i===null&&t.length===0)return null;const o=i===null?void 0:t.find(({channel:g})=>g.id===i.channelId),a=i===null?t:t.filter(({channel:g})=>g.id!==i.channelId),l=(i==null?void 0:i.placement.kind)==="placement"&&((p=i.placement.placeholder)==null?void 0:p.side)===r?i.placement.placeholder:null,c=a.map(g=>({kind:"row",row:g}));l!==null&&c.splice(l.index,0,{kind:"placeholder",key:`channel-placeholder-${r}`}),o!==void 0&&c.push({kind:"row",row:o});const d=i!==null&&a.length===0&&l===null;return U`
|
|
99
|
+
<div
|
|
100
|
+
class="channel-group"
|
|
101
|
+
role="group"
|
|
102
|
+
aria-labelledby=${`channel-group-${r}`}
|
|
103
|
+
data-channel-side=${r}
|
|
104
|
+
?drag-collapsed=${d}
|
|
105
|
+
>
|
|
106
|
+
<div class="channel-group-label" id=${`channel-group-${r}`}>${e}</div>
|
|
107
|
+
${gd(c,g=>g.kind==="row"?g.row.channel.id:g.key,g=>g.kind==="row"?u(this,T,u_).call(this,g.row):U`
|
|
108
|
+
<span
|
|
109
|
+
class="channel-placeholder"
|
|
110
|
+
aria-hidden="true"
|
|
111
|
+
data-channel-side=${r}
|
|
112
|
+
data-channel-index=${(l==null?void 0:l.index)??0}
|
|
113
|
+
style=${vd({height:`${(i==null?void 0:i.rowHeight)??0}px`})}
|
|
114
|
+
></span>
|
|
115
|
+
`)}
|
|
116
|
+
</div>
|
|
117
|
+
`},u_=function(e){var c;const{channel:t,pinned:r,selected:i}=e,o=((c=s(this,se))==null?void 0:c.channelId)===t.id?s(this,se):null,a=o!==null&&r&&o.placement.kind==="placement"&&o.placement.side==="unpinned",l=t.id===s(this,ft);return U`
|
|
118
|
+
<div
|
|
119
|
+
class=${`channel-row${o!==null?" dragged":""}${a?" unpinning":""}`}
|
|
120
|
+
data-channel-id=${t.id}
|
|
121
|
+
style=${vd(o===null?{}:{left:`${o.currentX-o.grip.previewOffsetX}px`,top:`${o.currentY-o.grip.offsetY}px`,width:`${o.rowWidth}px`,height:`${o.rowHeight}px`})}
|
|
122
|
+
>
|
|
123
|
+
${a?U`
|
|
124
|
+
<span class="channel-drag-action" aria-hidden="true">
|
|
125
|
+
<tv-icon name="unpin"></tv-icon>
|
|
126
|
+
Unpin
|
|
127
|
+
</span>
|
|
128
|
+
`:null}
|
|
129
|
+
${l?U`
|
|
130
|
+
<input
|
|
131
|
+
class="channel-rename"
|
|
132
|
+
aria-label="Channel name"
|
|
133
|
+
.value=${s(this,Mn)}
|
|
134
|
+
@input=${s(this,Dd)}
|
|
135
|
+
@keydown=${s(this,Od)}
|
|
136
|
+
@blur=${s(this,Md)}
|
|
137
|
+
${Je(s(this,pa))}
|
|
138
|
+
/>
|
|
139
|
+
<button
|
|
140
|
+
class="channel-rename-commit"
|
|
141
|
+
variant="ghost"
|
|
142
|
+
icon
|
|
143
|
+
size="sm"
|
|
144
|
+
type="button"
|
|
145
|
+
tabindex="-1"
|
|
146
|
+
aria-label="Rename"
|
|
147
|
+
@pointerdown=${s(this,Nd)}
|
|
148
|
+
>
|
|
149
|
+
<tv-icon name="check"></tv-icon>
|
|
150
|
+
</button>
|
|
151
|
+
`:U`
|
|
152
|
+
<div
|
|
153
|
+
class="channel"
|
|
154
|
+
role="option"
|
|
155
|
+
tabindex="-1"
|
|
156
|
+
@keydown=${d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),d.stopPropagation(),d.currentTarget.click())}}
|
|
157
|
+
@pointermove=${s(this,zd)}
|
|
158
|
+
aria-selected=${i?"true":ne}
|
|
159
|
+
@pointerdown=${d=>s(this,Ge).dragging??s(this,Ge).management?u(this,T,S_).call(this,t.id,d):void 0}
|
|
160
|
+
@click=${d=>u(this,T,__).call(this,t.id,d)}
|
|
161
|
+
>
|
|
162
|
+
${t.name}
|
|
163
|
+
</div>
|
|
164
|
+
${s(this,Ge).management?o_(u(this,T,h_).call(this,e),{trigger:d=>U`
|
|
165
|
+
<button
|
|
166
|
+
class="channel-menu-trigger"
|
|
167
|
+
variant="ghost"
|
|
168
|
+
icon
|
|
169
|
+
size="sm"
|
|
170
|
+
type="button"
|
|
171
|
+
tabindex="-1"
|
|
172
|
+
id=${d}
|
|
173
|
+
aria-haspopup="menu"
|
|
174
|
+
title=${`${t.name} menu`}
|
|
175
|
+
>
|
|
176
|
+
<tv-icon name="expand"></tv-icon>
|
|
177
|
+
</button>
|
|
178
|
+
`}):ne}
|
|
179
|
+
`}
|
|
180
|
+
</div>
|
|
181
|
+
`},h_=function(e){const{channel:t,pinned:r}=e;return[{label:"Rename",action:()=>u(this,T,Bm).call(this,t.id)},{label:r?"Unpin":"Pin",action:()=>u(this,T,b_).call(this,t.id,!r)},{separator:!0},{label:"Delete",destructive:!0,action:()=>u(this,T,p_).call(this,t.id,t.name)}]},d_=function(e){const t=s(this,Zt);if(t===null||s(this,Ht)!==null||t.resultChannelId===null)return;const r=e.channels.find(({id:i})=>i===t.resultChannelId);r!==void 0&&(h(this,Ht,r.id),queueMicrotask(()=>u(this,T,Dl).call(this,"create",r.id)))},p_=function(e,t){var i,o,a,l,c;if(s(this,mt)!==null||s(this,gt)!==null)return;u(this,T,Wm).call(this,e),h(this,mt,{channelId:e,name:t}),(o=(i=s(this,Ge)).onDeleteStart)==null||o.call(i,e),s(this,pt).call(this);const r=(a=s(this,fa).value)==null?void 0:a.closest("dialog");r instanceof HTMLDialogElement&&(h(this,Nn,Mp(r,()=>{u(this,T,Oh).call(this)})),(c=(l=s(this,fa).value)==null?void 0:l.querySelector(".dialog-actions button"))==null||c.focus())},Oh=function(e=!1){var i,o;const t=s(this,mt),r=s(this,Nn);h(this,Nn,null),h(this,mt,null),r==null||r.withdraw(),s(this,pt).call(this),!e&&t!==null&&((o=(i=s(this,Ge)).onDeleteEnd)==null||o.call(i,t.channelId,!1))},f_=function(){const e=s(this,Rt),t=s(this,mt);if(e===null||t===null||s(this,gt)!==null)return;h(this,gt,t.channelId),u(this,T,Oh).call(this,!0);const r=s(this,Ge).onDeleteEnd;e.deleteChannel(t.channelId).then(()=>{r==null||r(t.channelId,!0)}).catch(()=>{s(this,gt)===t.channelId&&s(this,vt)===null&&(h(this,gt,null),s(this,pt).call(this)),r==null||r(t.channelId,!1)})},m_=function(){const e=s(this,mt);return e===null?null:Op(U`
|
|
182
|
+
<div
|
|
183
|
+
class="dialog-alert channel-delete-alert"
|
|
184
|
+
role="alertdialog"
|
|
185
|
+
aria-labelledby="channel-delete-title"
|
|
186
|
+
aria-describedby="channel-delete-body"
|
|
187
|
+
${Je(s(this,fa))}
|
|
188
|
+
>
|
|
189
|
+
<h2 id="channel-delete-title">Delete “${e.name}”?</h2>
|
|
190
|
+
<p id="channel-delete-body">
|
|
191
|
+
This will permanently delete this channel from Television.
|
|
192
|
+
</p>
|
|
193
|
+
<div class="dialog-actions">
|
|
194
|
+
<button type="button" autofocus @click=${()=>u(this,T,Oh).call(this)}>
|
|
195
|
+
Cancel
|
|
196
|
+
</button>
|
|
197
|
+
<button type="button" intent="danger" @click=${()=>u(this,T,f_).call(this)}>
|
|
198
|
+
Delete
|
|
199
|
+
</button>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
`)},g_=function(e,t){var d,p;if(s(this,mt)!==null&&!t.channels.some(({id:g})=>{var y;return g===((y=s(this,mt))==null?void 0:y.channelId)})){const g=s(this,mt);(d=s(this,Nn))==null||d.withdraw(),h(this,Nn,null),h(this,mt,null),queueMicrotask(()=>{var y,v;return(v=(y=s(this,Ge)).onDeleteEnd)==null?void 0:v.call(y,g.channelId,!0)})}const r=s(this,vt);if(r!==null&&t.channels.some(({id:g})=>g===r.row.channel.id)){(p=s(this,yt))==null||p.cancel(),h(this,yt,null),h(this,vt,null),h(this,gt,null);return}const i=s(this,gt);if(i===null||r!==null||t.channels.some(({id:g})=>g===i))return;if(e===null){h(this,gt,null);return}const o=Fy(e),a=o.pinned.findIndex(({channel:g})=>g.id===i),l=o.unpinned.findIndex(({channel:g})=>g.id===i),c=a>=0?o.pinned[a]:o.unpinned[l];if(c===void 0){h(this,gt,null);return}h(this,vt,{row:{...c,selected:!1},side:a>=0?"pinned":"unpinned",index:a>=0?a:l}),queueMicrotask(()=>u(this,T,Dl).call(this,"delete",i))},v_=function(e){const t=s(this,vt);if(t===null)return e;const r=[...e[t.side]];return r.some(({channel:i})=>i.id===t.row.channel.id)||r.splice(t.index,0,t.row),{...e,[t.side]:r}},Dl=function(e,t){var l,c;if(e==="create"&&s(this,Ht)!==t||e==="delete"&&((l=s(this,vt))==null?void 0:l.row.channel.id)!==t||s(this,It))return;const r=[...((c=s(this,Sr).value)==null?void 0:c.querySelectorAll(es))??[]].find(d=>d.dataset.channelId===t);if(r===void 0){e==="delete"&&u(this,T,Lo).call(this,e,t);return}if(typeof r.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches){u(this,T,Lo).call(this,e,t);return}const i=r.getBoundingClientRect().height,o=e==="create"?[{maxHeight:"0px",opacity:0},{maxHeight:`${i}px`,opacity:1}]:[{maxHeight:`${i}px`,opacity:1},{maxHeight:"0px",opacity:0}],a=r.animate(o,{duration:Zo,easing:sh});e==="create"?h(this,Vt,a):h(this,yt,a),a.finished.then(()=>{e==="create"&&s(this,Vt)!==a||e==="delete"&&s(this,yt)!==a||(e==="create"?h(this,Vt,null):h(this,yt,null),u(this,T,Lo).call(this,e,t))},()=>{})},Lo=function(e,t){var r;if(e==="create"){if(s(this,Ht)!==t)return;h(this,Ht,null),h(this,Zt,null),u(this,T,Bm).call(this,t);return}((r=s(this,vt))==null?void 0:r.row.channel.id)===t&&(h(this,vt,null),h(this,gt,null),s(this,pt).call(this))},y_=function(){var r;h(this,be,null),u(this,T,Xm).call(this);const e=s(this,Ht);s(this,Vt)!==null&&(s(this,Vt).cancel(),h(this,Vt,null),e!==null&&queueMicrotask(()=>u(this,T,Lo).call(this,"create",e)));const t=((r=s(this,vt))==null?void 0:r.row.channel.id)??null;s(this,yt)!==null&&(s(this,yt).cancel(),h(this,yt,null),t!==null&&queueMicrotask(()=>u(this,T,Lo).call(this,"delete",t)))},w_=function(){var r;const e=s(this,Ht),t=((r=s(this,vt))==null?void 0:r.row.channel.id)??null;e!==null&&s(this,Vt)===null&&queueMicrotask(()=>u(this,T,Dl).call(this,"create",e)),t!==null&&s(this,yt)===null&&queueMicrotask(()=>u(this,T,Dl).call(this,"delete",t))},Bm=function(e){var r;const t=(r=s(this,nt))==null?void 0:r.channels.find(({id:i})=>i===e);t!==void 0&&(h(this,ft,e),h(this,Mn,t.name),h(this,be,null),s(this,pt).call(this),queueMicrotask(()=>{var i,o;s(this,ft)===e&&((i=s(this,pa).value)==null||i.focus(),(o=s(this,pa).value)==null||o.select())}))},Ol=function(e){if(s(this,ft)===null||s(this,Is)||s(this,Rt)===null)return;h(this,Is,!0);const t=s(this,ft),r=s(this,Mn).trim();h(this,ft,null),h(this,Mn,""),s(this,pt).call(this),h(this,Is,!1),e&&r.length>0&&s(this,Rt).renameChannel(t,r).catch(()=>{})},Dd=new WeakMap,Od=new WeakMap,Md=new WeakMap,Nd=new WeakMap,b_=function(e,t){var o;if(s(this,Rt)===null||s(this,nt)===null)return;if(u(this,T,Wm).call(this,e),s(this,Ge).revealMovedRow){const a=u(this,T,qm).call(this,e);h(this,mi,{channelId:e,pinned:t,focus:((o=a==null?void 0:a.parentElement)==null?void 0:o.contains(document.activeElement))??!1})}const r=s(this,nt).display.pinnedChannelIds,i=t?[...r.filter(a=>a!==e),e]:r.filter(a=>a!==e);s(this,Rt).setPinnedChannelIds(i).catch(()=>{h(this,mi,null)})},qm=function(e){var t,r;return((r=[...((t=s(this,Sr).value)==null?void 0:t.querySelectorAll(es))??[]].find(i=>i.dataset.channelId===e))==null?void 0:r.querySelector(".channel"))??void 0},Wm=function(e){var i,o,a;const t=[...((i=s(this,Sr).value)==null?void 0:i.querySelectorAll(es))??[]].find(l=>l.dataset.channelId===e),r=t==null?void 0:t.querySelector(".channel-menu-trigger");r&&((a=(o=s(this,Sr).value)==null?void 0:o.ownerDocument.querySelector(`tv-menu[trigger="${r.id}"]`))==null||a.removeAttribute("open"))},S_=function(e,t){if(t.button!==0||s(this,be)!==null||s(this,se)!==null||s(this,nt)===null)return;h(this,Ft,!1);const i=t.currentTarget.closest(".sidebar, .channel-switcher-pop");if(i===null)return;const o=Ul(s(this,nt));!o.pinnedChannelIds.includes(e)&&!o.unpinnedChannelIds.includes(e)||h(this,be,{channelId:e,pointerId:t.pointerId,x:t.clientX,y:t.clientY,source:{channelId:e,...o},captureTarget:i})},Nc=new WeakMap,zc=new WeakMap,__=function(e,t){var r;if(t.detail!==0&&s(this,Ft)){h(this,Ft,!1);return}h(this,Ft,!1),s(this,se)===null&&(s(this,Ge).selectChannel?s(this,Ge).selectChannel(e):(r=s(this,Rt))==null||r.focusChannel(e).catch(()=>{}))},zd=new WeakMap,Uc=new WeakMap,A_=function(e,t){if(s(this,It)){h(this,be,null);return}const r=[...e.captureTarget.querySelectorAll(es)].find(p=>p.dataset.channelId===e.channelId);if(r===void 0){h(this,be,null);return}const i=r.getBoundingClientRect(),o=u(this,T,E_).call(this,r),a=Nz({wideRow:i,compactPreviewWidth:o,pointer:{x:e.x,y:e.y}}),l=e.captureTarget.querySelector('[data-channel-side="pinned"]'),c=e.captureTarget.querySelector('[data-channel-side="unpinned"]');try{e.captureTarget.setPointerCapture(e.pointerId)}catch{h(this,be,null);return}e.captureTarget.style.setProperty("--channel-sidebar-drag-grip-x",`${a.previewOffsetX}px`),e.captureTarget.style.setProperty("--channel-sidebar-drag-grip-y",`${a.offsetY}px`),e.captureTarget.style.setProperty("--channel-sidebar-drag-grip-correction-x",`${a.correctionX}px`),h(this,Ft,!0);const d={...e,placement:{kind:"invalidated"},currentX:t.clientX,currentY:t.clientY,grip:a,rowWidth:o,rowHeight:i.height,originPinnedContentBottom:(l==null?void 0:l.getBoundingClientRect().bottom)??null,originUnpinnedGroupTop:(c==null?void 0:c.getBoundingClientRect().top)??null,displacementAnimations:new Set,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,completed:!1,operation:null,operationResolved:!1,operationRejected:!1,restorationQueued:!1};h(this,be,null),h(this,se,d),u(this,T,Ml).call(this,d,t)},E_=function(e){const t=e.cloneNode(!0);for(const i of[t,...t.querySelectorAll("[id], [trigger]")])i.removeAttribute("id"),i.removeAttribute("trigger");t.classList.add("dragged"),t.style.position="fixed",t.style.left="-10000px",t.style.top="-10000px",t.style.visibility="hidden",t.style.pointerEvents="none",document.body.append(t);const r=t.getBoundingClientRect().width;return t.remove(),r},Ml=function(e,t,r=!0){if(e.completed)return;const i=s(this,nt);if(i===null){e.placement={kind:"invalidated"};return}e.currentX=t.clientX,e.currentY=t.clientY;const o=Ul(i),a=new Map([...e.captureTarget.querySelectorAll(es)].map(P=>[P.dataset.channelId,P])),l=o.pinnedChannelIds.filter(P=>P!==e.channelId).flatMap(P=>{const J=a.get(P);if(J===void 0)return[];const O=J.getBoundingClientRect();return[{channelId:P,top:O.top,bottom:O.bottom}]}),c=e.captureTarget.querySelector('.channel-group[data-channel-side="pinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),d=e.captureTarget.querySelector('.channel-group[data-channel-side="unpinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),p=e.captureTarget.querySelector(".channel-group:not(.channel-group-withdrawal) .channel-placeholder"),g=p==null?void 0:p.getBoundingClientRect(),y=p==null?void 0:p.dataset.channelSide,v=Number(p==null?void 0:p.dataset.channelIndex),A=e.captureTarget.getBoundingClientRect(),E=Cz({source:e.source,current:o,pointer:{x:t.clientX,y:t.clientY},geometry:{sidebar:{left:A.left,right:A.right,top:A.top,bottom:A.bottom},pinnedRows:l,unpinnedGroupTop:(d==null?void 0:d.getBoundingClientRect().top)??e.originUnpinnedGroupTop,pinnedContentBottom:(c==null?void 0:c.getBoundingClientRect().bottom)??e.originPinnedContentBottom,placeholder:g!==void 0&&(y==="pinned"||y==="unpinned")&&Number.isInteger(v)?{side:y,index:v,top:g.top,bottom:g.bottom}:null}}),x=!zz(e.placement,E),B=x?u(this,T,Ym).call(this,e):null;e.placement=E,(x||r)&&u(this,T,Jm).call(this,e,B,!1),u(this,T,jm).call(this,e)},jm=function(e){const t=e.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body"),r=t?u(this,T,Gm).call(this,t,e.currentY):0,i=t?Math.max(0,t.scrollHeight-t.clientHeight):0,o=r<0?((t==null?void 0:t.scrollTop)??0)<=Uy:((t==null?void 0:t.scrollTop)??0)>=i-Uy;if(s(this,It)||e.completed||r===0||i===0||o||typeof requestAnimationFrame!="function"){u(this,T,Nl).call(this,e);return}e.edgeScrollFrame===0&&(e.edgeScrollFrame=requestAnimationFrame(a=>{u(this,T,k_).call(this,e,a)}))},k_=function(e,t){if(e.edgeScrollFrame=0,s(this,It)||s(this,se)!==e||e.completed){e.edgeScrollTimestamp=null;return}const r=e.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body");if(r===null){e.edgeScrollTimestamp=null;return}const i=u(this,T,Gm).call(this,r,e.currentY),o=e.edgeScrollTimestamp;if(e.edgeScrollTimestamp=t,i!==0&&o!==null){const a=Math.max(0,t-o)/1e3,l=Math.max(0,r.scrollHeight-r.clientHeight),c=r.scrollTop,d=i*a+e.edgeScrollRemainder,p=Math.max(0,Math.min(l,c+d));r.scrollTop=p;const g=r.scrollTop-c;if(e.edgeScrollRemainder=p===0||p===l?0:d-g,g!==0){r.toggleAttribute("continues-start",r.scrollTop>0),u(this,T,C_).call(this,e);return}}u(this,T,jm).call(this,e)},C_=function(e){u(this,T,Ml).call(this,e,{clientX:e.currentX,clientY:e.currentY},!1)},Nl=function(e){e.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e.edgeScrollFrame),e.edgeScrollFrame=0,e.edgeScrollTimestamp=null,e.edgeScrollRemainder=0},Gm=function(e,t){const r=e.getBoundingClientRect();return t>=r.top&&t<r.top+Kt?-yd*(r.top+Kt-t)/Kt:t>r.bottom-Kt&&t<=r.bottom?yd*(t-(r.bottom-Kt))/Kt:0},Ym=function(e){var i;for(const o of e.displacementAnimations)o.cancel();e.displacementAnimations.clear();const t=new Map;for(const o of e.captureTarget.querySelectorAll(es)){const a=o.dataset.channelId;if(a===void 0)continue;const l=o.getBoundingClientRect();t.set(a,{left:l.left,top:l.top})}const r=new Map;for(const o of e.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const a=o.dataset.channelSide;if(a!=="pinned"&&a!=="unpinned")continue;const l=o.getBoundingClientRect(),c=o.cloneNode(!0);for(const d of[c,...c.querySelectorAll("[id], [trigger]")])d.removeAttribute("id"),d.removeAttribute("trigger");(i=c.querySelector(".channel-row.dragged"))==null||i.remove(),c.classList.add("channel-group-withdrawal"),c.setAttribute("aria-hidden","true"),c.removeAttribute("drag-collapsed"),r.set(a,{left:l.left,top:l.top,width:l.width,height:o.hasAttribute("drag-collapsed")?0:l.height,withdrawal:c})}return{rows:t,groups:r}},Jm=function(e,t,r){const i=e.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body"),o=(i==null?void 0:i.scrollTop)??0;s(this,pt).call(this),queueMicrotask(()=>{const a=e.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body");a!==null&&(a.scrollTop=o),t!==null&&u(this,T,T_).call(this,e,t,r)})},T_=function(e,t,r){if(!(s(this,It)||typeof HTMLElement.prototype.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const i of e.captureTarget.querySelectorAll(es)){const o=i.dataset.channelId;if(o===void 0||!r&&o===e.channelId)continue;const a=t.rows.get(o);if(a===void 0)continue;const l=i.getBoundingClientRect(),c=a.left-l.left,d=a.top-l.top;Math.hypot(c,d)<=bl||u(this,T,Mh).call(this,e,i.animate({translate:[`${c}px ${d}px`,"0px 0px"]},{duration:Zo,easing:sh}))}for(const i of e.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const o=i.dataset.channelSide;if(o!=="pinned"&&o!=="unpinned")continue;const a=t.groups.get(o),l=i.getBoundingClientRect(),c=i.hasAttribute("drag-collapsed")?0:l.height;if(a!==void 0){if(a.height<=bl&&c>bl)u(this,T,Mh).call(this,e,i.animate([{opacity:0,translate:`0px -${c}px`},{opacity:1,translate:"0px 0px"}],{duration:Zo,easing:sh}));else if(a.height>bl&&c<=bl&&a.withdrawal.childElementCount>0){const d=a.withdrawal;d.style.left=`${a.left}px`,d.style.top=`${a.top}px`,d.style.width=`${a.width}px`,d.style.height=`${a.height}px`,e.captureTarget.append(d);const p=d.animate([{opacity:1,translate:"0px 0px"},{opacity:0,translate:`0px -${a.height}px`}],{duration:Zo,easing:sh});u(this,T,Mh).call(this,e,p),p.finished.finally(()=>d.remove()).catch(()=>{})}}}}},Mh=function(e,t){e.displacementAnimations.add(t),t.finished.finally(()=>{e.displacementAnimations.delete(t)}).catch(()=>{})},Fc=new WeakMap,Zc=new WeakMap,Hc=new WeakMap,Vc=new WeakMap,$_=function(e){const t=Ul(e);s(this,se)!==null&&!s(this,se).completed&&!Zy(s(this,se).source,t)&&u(this,T,zh).call(this),s(this,be)!==null&&!Zy(s(this,be).source,t)&&h(this,be,null)},Km=function(e){const t=s(this,se);if(e===null||t===null||!t.completed||!t.operationResolved||t.restorationQueued)return;if(t.operationRejected){u(this,T,Nh).call(this,t);return}const r=t.operation;r!==null&&wd(Ul(e).pinnedChannelIds,r)&&u(this,T,Nh).call(this,t)},Nh=function(e){s(this,se)!==e||e.restorationQueued||(e.restorationQueued=!0,queueMicrotask(()=>{s(this,se)===e&&u(this,T,zl).call(this,e,!1)}))},zh=function(){h(this,be,null);const e=s(this,se);e!==null&&u(this,T,zl).call(this,e,!0)},zl=function(e,t){if(s(this,se)!==e)return;u(this,T,Nl).call(this,e);const r=u(this,T,Ym).call(this,e);h(this,se,null),u(this,T,Qm).call(this,e),t&&e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId),u(this,T,Jm).call(this,e,r,!0)},Xm=function(){h(this,be,null);const e=s(this,se);if(h(this,se,null),e!==null){u(this,T,Nl).call(this,e);for(const t of e.displacementAnimations)t.cancel();e.displacementAnimations.clear(),u(this,T,Qm).call(this,e),e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}},Qm=function(e){e.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-x"),e.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-y"),e.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-correction-x")};function Nz(n){const e=Math.max(0,n.wideRow.right-n.wideRow.left),t=Math.max(0,n.wideRow.bottom-n.wideRow.top),r=Hy(n.pointer.x-n.wideRow.left,0,e),i=Math.min(r,Math.max(0,n.compactPreviewWidth-Mz));return{wideOffsetX:r,previewOffsetX:i,correctionX:r-i,offsetY:Hy(n.pointer.y-n.wideRow.top,0,t)}}function Fy(n,e=Ul(n)){var l,c;const t=new Map(n.channels.map(d=>[d.id,d])),r=e.pinnedChannelIds.flatMap(d=>{const p=t.get(d);return p===void 0?[]:[p]}),i=e.unpinnedChannelIds.flatMap(d=>{const p=t.get(d);return p===void 0?[]:[p]}),o=n.display.focusedChannelId,a=o!==null&&t.has(o)?o:((l=r[0])==null?void 0:l.id)??((c=i[0])==null?void 0:c.id)??null;return{pinned:r.map(d=>({channel:d,pinned:!0,selected:d.id===a})),unpinned:i.map(d=>({channel:d,pinned:!1,selected:d.id===a}))}}function Ul(n){const e=new Set(n.channels.map(({id:o})=>o)),t=n.display.pinnedChannelIds.filter(o=>e.has(o)),r=new Set(t),i=n.channels.filter(({id:o})=>!r.has(o)).map(({id:o})=>o).sort((o,a)=>a.localeCompare(o));return{pinnedChannelIds:t,unpinnedChannelIds:i}}function Zy(n,e){return wd(n.pinnedChannelIds,e.pinnedChannelIds)&&wd(n.unpinnedChannelIds,e.unpinnedChannelIds)}function wd(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}function zz(n,e){var t,r,i,o;return n.kind!==e.kind?!1:n.kind==="invalidated"||e.kind==="invalidated"?!0:n.side===e.side&&((t=n.placeholder)==null?void 0:t.side)===((r=e.placeholder)==null?void 0:r.side)&&((i=n.placeholder)==null?void 0:i.index)===((o=e.placeholder)==null?void 0:o.index)&&n.operation===null==(e.operation===null)&&(n.operation===null||e.operation===null||wd(n.operation,e.operation))}function Hy(n,e,t){return Math.max(e,Math.min(t,n))}var hn,Ud;class Uz extends Ot{constructor(){super(...arguments);f(this,hn,new c_(()=>this.render()));f(this,Ud,t=>{const r=t.currentTarget;r.toggleAttribute("continues-start",r.scrollTop>0)})}connected(){s(this,hn).connect()}template(t,r,i,o,a,l=!1){return s(this,hn).update(t,r,{management:!0,motionSuppressed:l}),U`
|
|
203
|
+
<nav class="sidebar" ?dragging=${s(this,hn).dragging}>
|
|
204
|
+
<header
|
|
205
|
+
class="sidebar-titlebar"
|
|
206
|
+
?electron-draggable=${i}
|
|
207
|
+
>
|
|
208
|
+
<button
|
|
209
|
+
class="channel-create"
|
|
210
|
+
variant="ghost"
|
|
211
|
+
icon
|
|
212
|
+
aria-label="New channel"
|
|
213
|
+
title="New channel"
|
|
214
|
+
type="button"
|
|
215
|
+
?disabled=${s(this,hn).creating}
|
|
216
|
+
@click=${s(this,hn).create}
|
|
217
|
+
>
|
|
218
|
+
<tv-icon name="add"></tv-icon>
|
|
219
|
+
</button>
|
|
220
|
+
<span
|
|
221
|
+
class="toolbar-separator"
|
|
222
|
+
role="separator"
|
|
223
|
+
aria-orientation="vertical"
|
|
224
|
+
></span>
|
|
225
|
+
${a===void 0?U`
|
|
226
|
+
<button
|
|
227
|
+
class="sidebar-collapse"
|
|
228
|
+
variant="ghost"
|
|
229
|
+
icon
|
|
230
|
+
aria-label="Collapse sidebar"
|
|
231
|
+
title="Collapse sidebar"
|
|
232
|
+
type="button"
|
|
233
|
+
@click=${o}
|
|
234
|
+
>
|
|
235
|
+
<tv-icon name="sidebar" size="sm"></tv-icon>
|
|
236
|
+
</button>
|
|
237
|
+
`:a??U`
|
|
238
|
+
<span class="sidebar-toggle-seat" aria-hidden="true"></span>
|
|
239
|
+
`}
|
|
240
|
+
</header>
|
|
241
|
+
|
|
242
|
+
<div class="sidebar-body" @scroll=${s(this,Ud)}>
|
|
243
|
+
${s(this,hn).template()}
|
|
244
|
+
</div>
|
|
245
|
+
</nav>
|
|
246
|
+
${s(this,hn).overlayTemplate()}
|
|
247
|
+
`}disconnected(){s(this,hn).disconnect()}}hn=new WeakMap,Ud=new WeakMap;const Fz=Mt(Uz),Zz=1280,Hz=800,Vy=.4,By=.4,R_=280,qy=180,Vz=14,Bz=45,qz=16,Wy=64,Wz=100,jz=1,Gz=24,Yz=230,Jz=230;function Kz(n,e){const{expandedSidebarWidth:t,expandedToggleLeft:r,collapsedToggleLeft:i,toggleWidth:o,toggleSwitcherGap:a,collapsedLeadReservation:l,hasSwitcher:c}=e,d=t*(1-n),p=t-r,g=Math.max(d-p,i),y=i+p,v=Math.max(0,Math.min(o,d-g)),A=eg((d-y)/(t-y)),E=o+a,x=i+E,B=c?eg((x-d)/E):0;let P=n*l;if(l>t){const J=1-x/t,O=Math.min(1,n/J);P=n*t+O*(l-t)}return{sidebarBoundary:d,toggleLeft:g,toggleWipe:v,titlebarOpacity:A,switcherOpacity:B,leadReservation:P}}function Xz(n,e,t,r){const i=r*Math.abs(e-n);if(i===0)return e;const a=1-(1-eg(t/i))**2;return n+(e-n)*a}function eg(n){return Math.max(0,Math.min(1,n))}var _r,gi,Ar,ma,ga,xs,qr,Uh,tg;class Qz{constructor(e){f(this,qr);f(this,_r,null);f(this,gi,0);f(this,Ar);f(this,ma);f(this,ga);f(this,xs,1);h(this,Ar,e),h(this,ma,e),h(this,ga,e)}get boundary(){return u(this,qr,Uh).call(this),s(this,Ar)}move(e){const t=this.boundary;if(u(this,qr,tg).call(this),h(this,ma,t),h(this,ga,e.target),h(this,xs,e.width),e.onFrame(t),matchMedia("(prefers-reduced-motion: reduce)").matches||Math.abs(e.target-t)<Number.EPSILON){h(this,Ar,e.target),e.onFrame(e.target),e.onFinish(e.target);return}const r=Math.abs(e.target-t)/e.width,i=e.root.animate([{},{}],{duration:qy*r,easing:"linear"});i.id="sidebar-collapse-boundary",h(this,_r,i);const o=()=>{if(s(this,_r)===i){if(u(this,qr,Uh).call(this),e.onFrame(s(this,Ar)),i.playState==="finished"){h(this,_r,null),h(this,gi,0),h(this,Ar,e.target),e.onFrame(e.target),e.onFinish(e.target);return}h(this,gi,requestAnimationFrame(o))}};h(this,gi,requestAnimationFrame(o))}cancel(){u(this,qr,Uh).call(this),u(this,qr,tg).call(this)}}_r=new WeakMap,gi=new WeakMap,Ar=new WeakMap,ma=new WeakMap,ga=new WeakMap,xs=new WeakMap,qr=new WeakSet,Uh=function(){const e=s(this,_r);if(e===null)return;const t=Xz(1-s(this,ma)/s(this,xs),1-s(this,ga)/s(this,xs),Number(e.currentTime??0),qy);h(this,Ar,s(this,xs)*(1-t))},tg=function(){var e;cancelAnimationFrame(s(this,gi)),h(this,gi,0),(e=s(this,_r))==null||e.cancel(),h(this,_r,null)};const I_="television-active-theme",T0="tv-theme";let ni=null,Br=null,Ni=null,zi=null,Kr=null,jy=0,bd=0;function e9(n){const e=document.createElement("link"),t=new URL("/theme/theme.css",n);t.searchParams.set(T0,$0()),e.rel="stylesheet",e.href=t.toString(),e.dataset.televisionStyle=I_;const r=()=>{ni===e&&document.dispatchEvent(new Event("television-theme-styles-changed"))};return e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0}),ni==null||ni.remove(),document.head.append(e),ni=e,e}function t9(){ni&&(ni.remove(),ni=null,document.dispatchEvent(new Event("television-theme-styles-changed")))}function Gy(n){const e=document.createElement("script"),t=new URL("/theme/main.js",n);return t.searchParams.set(T0,$0()),e.src=t.toString(),e.dataset.televisionScript=I_,Br==null||Br.remove(),document.head.append(e),Br=e,e}function n9(){Br==null||Br.remove(),Br=null}function r9(){return Br}async function i9(n,e,t){const r=x_();if(e===null)return;let i;try{i=await t()}catch{return}if(r!==bd)return;const o=i.themes.find(p=>p.id===e);if(o===void 0)return;const a=document.querySelector("#app"),l=document.querySelector("#foreground-overlay");if(a===null||l===null)return;const c=o.enableIframeBackgroundJS===!0?Yy(n,"background"):null,d=o.enableIframeOverlayJS===!0?Yy(n,"overlay"):null;r===bd&&(c!==null&&(a.before(c),Ni=c),d!==null&&(l.after(d),zi=d))}function s9(){x_()}function x_(){return bd+=1,Ni==null||Ni.remove(),zi==null||zi.remove(),Ni=null,zi=null,bd}function Yy(n,e){const t=e==="background"?new URL("/theme/iframe-background.js",n):new URL("/theme/iframe-overlay.js",n);t.searchParams.set(T0,$0());const r=document.createElement("iframe");return r.id=e==="background"?"theme-iframe-background":"theme-iframe-overlay",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("inert",""),r.setAttribute("tabindex","-1"),r.setAttribute("aria-hidden","true"),r.srcdoc=a9(t.toString(),o9()),r}function o9(){const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n}function a9(n,e){return`<!doctype html>
|
|
248
|
+
<html data-theme="${e}">
|
|
249
|
+
<head>
|
|
250
|
+
<meta charset="utf-8">
|
|
251
|
+
<style>
|
|
252
|
+
html, body {
|
|
253
|
+
width: 100%;
|
|
254
|
+
height: 100%;
|
|
255
|
+
margin: 0;
|
|
256
|
+
overflow: hidden;
|
|
257
|
+
background: transparent;
|
|
258
|
+
color-scheme: ${e};
|
|
259
|
+
}
|
|
260
|
+
</style>
|
|
261
|
+
</head>
|
|
262
|
+
<body>
|
|
263
|
+
<script src="${n}"><\/script>
|
|
264
|
+
</body>
|
|
265
|
+
</html>`}function P_(n){var o;let e,t=n.button,r=n.buttons;switch(n.eventType){case"pointermove":e="television-theme-pointer-move",t=-1;break;case"pointerdown":e="television-theme-pointer-down";break;case"pointerup":e="television-theme-pointer-up";break;case"pointercancel":e="television-theme-pointer-cancel",t=-1,r=0;break;case"click":e="television-theme-pointer-click",r=0;break}const i={type:e,clientX:n.clientX,clientY:n.clientY,button:t,buttons:r};for(const a of[Ni,zi])(a==null?void 0:a.isConnected)===!0&&((o=a.contentWindow)==null||o.postMessage(i,"*"))}function Du(n){n.isTrusted&&P_({eventType:n.type,clientX:n.clientX,clientY:n.clientY,button:n.button,buttons:n.buttons})}document.addEventListener("pointermove",Du,{capture:!0});document.addEventListener("pointerdown",Du,{capture:!0});document.addEventListener("pointerup",Du,{capture:!0});document.addEventListener("pointercancel",Du,{capture:!0});document.addEventListener("click",Du,{capture:!0});function L_(n){if(n!==Ni&&n!==zi)return!1;const t=((Kr==null?void 0:Kr.isConnected)===!0&&Kr!==Ni&&Kr!==zi&&Kr.closest("#foreground-overlay")===null?Kr:null)??document.querySelector("#app");return t==null||t.focus({preventScroll:!0}),!0}document.addEventListener("focusin",n=>{const e=n.target;e instanceof HTMLElement&&(L_(e)||e.isConnected&&e.closest("#foreground-overlay")===null&&(Kr=e))},{capture:!0});window.addEventListener("blur",()=>{queueMicrotask(()=>L_(document.activeElement))},{capture:!0});function $0(){return jy+=1,`${Date.now()}-${jy}`}const l9=404,c9="/views/url-unsupported/";function Fh(n){const e=pm(n.artifact,{electron:n.electron});let t;if(n.currentURL===null){const r=n.viewURL??e.viewURL;e.renderer==="markdown"?t={renderer:"markdown",viewURL:r,contentURL:n.contentURL??e.contentURL}:e.renderer==="url-webview"&&e.contentURL!==null?t={renderer:"url-webview",viewURL:r,contentURL:n.contentURL??e.contentURL}:t={...e,viewURL:r}}else Jy(n.currentURL)&&!n.electron?t=hr(n.currentURL)?{renderer:"proxy-iframe",viewURL:n.currentURL,contentURL:null}:{renderer:"proxy-iframe",viewURL:c9,contentURL:null}:Jy(n.currentURL)?t={renderer:"url-webview",viewURL:n.currentURL,contentURL:null}:t={renderer:n.electron?"url-webview":"proxy-iframe",viewURL:d9(n.currentURL,n.viewURL),contentURL:null};return n.frameSrcOverride?{...t,viewURL:n.frameSrcOverride}:t}var We,Bt,va,Ps,Ls,dn,Ds,ya,wt,wa,ba,zn,vi,yi,Os,K,Zh,D_,O_,ng,M_,Un,Hh,Fl,rg,N_,ig,sg,ns;class u9 extends Ot{constructor(){super(...arguments);f(this,K);f(this,We,null);f(this,Bt,null);f(this,va,"");f(this,Ps,()=>{});f(this,Ls,()=>{});f(this,dn,null);f(this,Ds,null);f(this,ya,null);f(this,wt,null);f(this,wa,null);f(this,ba,null);f(this,zn,null);f(this,vi,null);f(this,yi,null);f(this,Os,null);f(this,Un,()=>{!s(this,Bt)||s(this,Bt)!==s(this,dn)||s(this,Ps).call(this,!0)})}get currentFrame(){return s(this,Bt)}connected(){u(this,K,Hh).call(this),u(this,K,rg).call(this)}disconnected(){u(this,K,Fl).call(this),u(this,K,ns).call(this)}template(t,r,i=()=>{}){return h(this,Ps,r),h(this,Ls,i),t(this),s(this,va)}assignSource(t){const r=s(this,We),i=r?!p9(r.artifact,t.artifact):!0;((r==null?void 0:r.artifact.id)!==t.artifact.id||(r==null?void 0:r.artifact.kind)==="path"&&t.artifact.kind==="path"&&r.artifact.path!==t.artifact.path)&&h(this,Os,null),i&&(h(this,zn,null),s(this,wt)&&(s(this,wt).content=""),h(this,vi,null),h(this,yi,null)),h(this,We,t),u(this,K,Zh).call(this)}handleArtifactContentChanged(t){const r=s(this,We);return t!==(r==null?void 0:r.artifact.id)||!s(this,wt)&&!u(this,K,sg).call(this)?!1:(u(this,K,ig).call(this),!0)}handleThemeChanged(){var r;const t=(r=s(this,We))==null?void 0:r.artifact;return(t==null?void 0:t.kind)!=="path"||!dm(t.path)||s(this,wt)===null?!1:(s(this,wt).notifyStylesChanged(),!0)}refreshFrameLoadState(){u(this,K,Hh).call(this)}}We=new WeakMap,Bt=new WeakMap,va=new WeakMap,Ps=new WeakMap,Ls=new WeakMap,dn=new WeakMap,Ds=new WeakMap,ya=new WeakMap,wt=new WeakMap,wa=new WeakMap,ba=new WeakMap,zn=new WeakMap,vi=new WeakMap,yi=new WeakMap,Os=new WeakMap,K=new WeakSet,Zh=function(){const t=s(this,We);if(!t)return;if(t.artifact.kind==="path"&&u(this,K,sg).call(this)){u(this,K,M_).call(this,t.artifact);return}const r=Fh(t),i=u(this,K,D_).call(this,r.renderer);u(this,K,O_).call(this,i,r),u(this,K,ng).call(this,i),u(this,K,Hh).call(this),u(this,K,rg).call(this)},D_=function(t){var o;const r=t==="url-webview"?"webview":"iframe";if(((o=s(this,Bt))==null?void 0:o.tagName.toLowerCase())===r)return s(this,Bt);u(this,K,Fl).call(this),u(this,K,ns).call(this);const i=document.createElement(r);return i.className="artifact-content",r==="webview"&&i.setAttribute("allowpopups",""),h(this,Bt,i),i},O_=function(t,r){t.getAttribute("src")!==r.viewURL&&(s(this,Ls).call(this,null),s(this,Ls).call(this,t),t.setAttribute("src",r.viewURL)),r.contentURL===null?delete t.dataset.contentUrl:t.dataset.contentUrl=r.contentURL},ng=function(t){s(this,va)!==t&&(h(this,va,t),this.render(t))},M_=function(t){s(this,Ls).call(this,null),u(this,K,Fl).call(this),u(this,K,ns).call(this),h(this,Bt,null),s(this,Ps).call(this,!1),u(this,K,ng).call(this,U`
|
|
266
|
+
<section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
|
|
267
|
+
<div class="artifact-missing-wrapper">
|
|
268
|
+
<h1>${y8()}</h1>
|
|
269
|
+
<p>${w8()}</p>
|
|
270
|
+
<section class="artifact-missing-path" aria-label="Missing artifact path">
|
|
271
|
+
<p class="artifact-missing-path-label">Registered path:</p>
|
|
272
|
+
<p><code>${t.path}</code></p>
|
|
273
|
+
</section>
|
|
274
|
+
<p>${b8()}</p>
|
|
275
|
+
</div>
|
|
276
|
+
</section>
|
|
277
|
+
`)},Un=new WeakMap,Hh=function(){var o;const t=s(this,Bt),r=t?`${t.tagName.toLowerCase()}:${t.getAttribute("src")??""}:${t.dataset.contentUrl??""}`:null;if(t&&t===s(this,dn)&&r===s(this,Ds)||(u(this,K,Fl).call(this),s(this,Ps).call(this,!1),!t||!r||!this.isConnected))return;if(h(this,dn,t),h(this,Ds,r),t.tagName.toLowerCase()==="webview"){t.addEventListener("did-finish-load",s(this,Un)),t.addEventListener("did-fail-load",s(this,Un));return}t.addEventListener("load",s(this,Un));const i=t;try{i.isConnected&&((o=i.contentDocument)==null?void 0:o.readyState)==="complete"&&s(this,Un).call(this)}catch{}},Fl=function(){if(!s(this,dn)){h(this,Ds,null);return}s(this,dn).removeEventListener("load",s(this,Un)),s(this,dn).removeEventListener("did-finish-load",s(this,Un)),s(this,dn).removeEventListener("did-fail-load",s(this,Un)),h(this,dn,null),h(this,Ds,null)},rg=function(){const t=s(this,We),r=s(this,Bt),i=(r==null?void 0:r.dataset.contentUrl)??null,o=(t==null?void 0:t.artifact.id)??null;if(!t||!r||!i||!o){u(this,K,ns).call(this,{clearContent:!0});return}if(r!==s(this,ya)||o!==s(this,ba)){u(this,K,ns).call(this),h(this,ya,r),h(this,wa,i),h(this,ba,o);const a=r.tagName.toLowerCase()==="webview"?new $M(r):new TM(r);h(this,wt,a),a.handleUpdateContent(async l=>{const c=s(this,We),d=c==null?void 0:c.application;if(!c||!d)throw new Error("No markdown artifact selected");await d.writeMarkdown(c.artifact.id,l),h(this,zn,l),s(this,wt)===a&&(a.content=l)}),s(this,zn)!==null&&(a.content=s(this,zn))}else h(this,wa,i);u(this,K,N_).call(this)},N_=function(){const t=s(this,We),r=t==null?void 0:t.application;!t||!r||!s(this,wt)||s(this,vi)===t.artifact.id&&s(this,yi)===r||(h(this,vi,t.artifact.id),h(this,yi,r),u(this,K,ig).call(this))},ig=async function(){var o,a;const t=s(this,We),r=t==null?void 0:t.application;if(!t||!r)return;const i=t.artifact.id;try{const l=await r.readMarkdown(i);if(((o=s(this,We))==null?void 0:o.artifact.id)!==i||s(this,We).application!==r)return;h(this,Os,null),h(this,zn,l);const c=s(this,wt);if(!c){u(this,K,Zh).call(this);return}c.content=l}catch(l){if(((a=s(this,We))==null?void 0:a.artifact.id)!==i||s(this,We).application!==r)return;if(l instanceof il&&l.status===l9){h(this,Os,i),h(this,zn,null),u(this,K,ns).call(this),u(this,K,Zh).call(this);return}h(this,vi,null),h(this,yi,null)}},sg=function(){var r;const t=(r=s(this,We))==null?void 0:r.artifact;return s(this,Os)===(t==null?void 0:t.id)&&t.kind==="path"&&dm(t.path)},ns=function(t={}){var r;(r=s(this,wt))==null||r.dispose(),h(this,wt,null),h(this,ya,null),h(this,wa,null),h(this,ba,null),h(this,vi,null),h(this,yi,null),t.clearContent&&h(this,zn,null)};const h9=Mt(u9);function Jy(n){return n.startsWith("http://")||n.startsWith("https://")}function d9(n,e){if(!n.startsWith("/")||!e)return n;try{return new URL(n,e).toString()}catch{return n}}function p9(n,e){return n.id!==e.id||n.kind!==e.kind?!1:n.kind==="path"&&e.kind==="path"?n.path===e.path:n.kind==="url"&&e.kind==="url"?n.url===e.url:!0}var Bc,Sa,Fn,Er,wi,bi,Si,qc,Wc,jc,Gc,Dt,og,Vh,Bh;class f9{constructor(e,t=()=>{}){f(this,Dt);f(this,Bc);f(this,Sa);f(this,Fn,null);f(this,Er,null);f(this,wi,null);f(this,bi,null);f(this,Si,!1);f(this,qc,e=>{const t=Xy(e.data);if(!t)return;const r=s(this,wi);if(!r||r.tagName.toLowerCase()!=="iframe"||!r.isConnected)return;const i=r,o=i.contentWindow;if(o===null)return;const a=t.type==="leaving",l=t.type==="navigation-request"&&t.native===!0&&t.sameDocument!==!0,c=o===e.source,d=(a||l)&&s(this,Er)!==null&&s(this,Er)===e.source,p=a&&g9(i)===e.origin;!c&&!d&&!p||u(this,Dt,og).call(this,t,i,{send:g=>{var y;return(y=i.contentWindow)==null?void 0:y.postMessage(g,"*")}})});f(this,Wc,e=>{var o;const t=e.detail??e;if(!t||t.channel!==Ky)return;const r=Xy((o=t.args)==null?void 0:o[0]),i=s(this,bi);!r||!i||u(this,Dt,og).call(this,r,i,{send:a=>{var l;return(l=i.send)==null?void 0:l.call(i,Ky,a)}})});f(this,jc,e=>{const t=Qy(e);t.isMainFrame===!0&&t.isInPlace!==!0&&this.reset()});f(this,Gc,e=>{Qy(e).isMainFrame!==!1&&this.reset()});h(this,Bc,e),h(this,Sa,t)}get currentGuid(){return s(this,Fn)}get lifecycleWindow(){return s(this,Er)}get trustState(){return{currentGuid:s(this,Fn),lifecycleWindow:s(this,Er)}}connect(){s(this,Si)||(h(this,Si,!0),window.addEventListener("message",s(this,qc)),u(this,Dt,Vh).call(this))}disconnect(){s(this,Si)&&(window.removeEventListener("message",s(this,qc)),h(this,Si,!1),u(this,Dt,Bh).call(this))}reset(){h(this,Fn,null),h(this,Er,null),s(this,Sa).call(this)}setCurrentFrame(e){if(e===s(this,wi)){u(this,Dt,Vh).call(this);return}u(this,Dt,Bh).call(this),s(this,wi)!==null&&this.reset(),h(this,wi,m9(e)?e:null),u(this,Dt,Vh).call(this)}}Bc=new WeakMap,Sa=new WeakMap,Fn=new WeakMap,Er=new WeakMap,wi=new WeakMap,bi=new WeakMap,Si=new WeakMap,qc=new WeakMap,Wc=new WeakMap,jc=new WeakMap,Gc=new WeakMap,Dt=new WeakSet,og=function(e,t,r){e.type==="bridge-ready"&&e.guid!==s(this,Fn)?(s(this,Fn)!==null&&s(this,Sa).call(this),h(this,Fn,e.guid),h(this,Er,t.tagName.toLowerCase()==="iframe"?t.contentWindow:null)):e.type==="leaving"&&e.guid===s(this,Fn)&&this.reset(),s(this,Bc).call(this,e,r)},Vh=function(){if(!s(this,Si))return;const e=s(this,wi),t=(e==null?void 0:e.tagName.toLowerCase())==="webview"?e:null;t!==s(this,bi)&&(u(this,Dt,Bh).call(this),t&&(t.addEventListener("ipc-message",s(this,Wc)),t.addEventListener("did-start-navigation",s(this,jc)),t.addEventListener("did-fail-load",s(this,Gc)),h(this,bi,t)))},Bh=function(){const e=s(this,bi);e&&(e.removeEventListener("ipc-message",s(this,Wc)),e.removeEventListener("did-start-navigation",s(this,jc)),e.removeEventListener("did-fail-load",s(this,Gc)),h(this,bi,null))};const Ky="television-artifact-bridge";function Xy(n){return a8(n)||l8(n)||c8(n)||u8(n)||h8(n)||d8(n)||p8(n)||f8(n)?n:null}function m9(n){if(!n)return!1;const e=n.tagName.toLowerCase();return e==="iframe"||e==="webview"}function g9(n){try{return new URL(n.getAttribute("src")??n.src,window.location.href).origin}catch{return null}}function Qy(n){return n.detail??n}const v9="/views/url-unsupported/";class y9 extends Ot{constructor(){super(...arguments);C(this,"_artifact",null);C(this,"_viewURL",null);C(this,"_contentURL",null);C(this,"_application",null);C(this,"_fullScreen",!1);C(this,"_inert",!1);C(this,"_onFullScreenChange",()=>{});C(this,"_connected",!1);C(this,"_deleteConfirmationOpen",!1);C(this,"_dialogPresentation",null);C(this,"_subscribedWebview",null);C(this,"_documentHost",null);C(this,"_pendingDocumentSource",null);C(this,"_rootRef",vn());C(this,"_trustedChannel",new f9((t,r)=>{this.handleTrustedFrameMessage(t,r)},()=>{this._missingArtifactReplyTransport=null}));C(this,"_activeReloadFrameSrc",null);C(this,"_applicationSubscriptionsAttached",!1);C(this,"_proxyReloadVersion",0);C(this,"_navigationState",null);C(this,"_navigationArtifactId",null);C(this,"_navigationCanonicalURL",null);C(this,"_preserveFrameSrcOnNavigationRender",!1);C(this,"_missingArtifactReplyTransport",null);C(this,"handleNavigationChange",()=>{const t=this._preserveFrameSrcOnNavigationRender,r=!t;r&&!Hr()?(this.renderArtifact({preserveFrameSrc:!0}),this.forceCurrentFrameSrc()):this.renderArtifact({preserveFrameSrc:t,resetTrust:r}),this._preserveFrameSrcOnNavigationRender=!1});C(this,"handleArtifactContentChanged",t=>{var o;const r=t.artifactID,i=this._artifact;!i||r!==i.id||i.kind!=="path"||typeof r=="string"&&((o=this._documentHost)!=null&&o.handleArtifactContentChanged(r))||this.reloadProxyFrame()});C(this,"handleThemeChanged",()=>{var t,r;((t=this._artifact)==null?void 0:t.kind)==="url"&&hr(this._artifact.url)||(r=this._documentHost)!=null&&r.handleThemeChanged()||this.reloadProxyFrame()});C(this,"handleWebviewDidNavigate",t=>{this.handleWebviewNavigationEvent(t)});C(this,"handleWebviewDidNavigateInPage",t=>{if(t.isMainFrame===!1)return;this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(t)||(this._preserveFrameSrcOnNavigationRender=!1)});C(this,"captureDocumentHost",t=>{this._documentHost=t,this._pendingDocumentSource&&(t.assignSource(this._pendingDocumentSource),this.syncFrameSubscriptions())});C(this,"handleEmbedLoadChange",t=>{var r;(r=this._rootRef.value)==null||r.toggleAttribute("data-embed-loaded",t)});C(this,"handleDocumentFrameChange",t=>{t===null&&this.resetTrustedFrame(),this.syncFrameTitle(t),this._trustedChannel.setCurrentFrame(t),this.syncWebviewSubscription(t)});C(this,"handleTitleBarDoubleClick",t=>{const r=t.target;r instanceof Element&&r.closest("button")||this.requestFullScreen(!this._fullScreen)})}update(t,r){var d;const[i,o,a]=r;let l=!1;this._application!==i&&(this.detachApplicationSubscriptions(),this._application=i,this.attachApplicationSubscriptions(),this._connected&&(this.assignDocumentSource({preserveFrameSrc:!0}),l=!0));const c=this._artifact;if(c!==o){const p=c?!S9(c,o):!0;if(p&&(this._activeReloadFrameSrc=null),this._artifact=o,this.syncNavigationState(),this._connected){if(this.renderArtifact({resetTrust:p}),l=!0,c&&_9(c,o)){const g=this.currentMissingArtifactMessage();g&&((d=this._missingArtifactReplyTransport)==null||d.send(g))}}else p&&this.resetTrustedFrame()}return this._viewURL!==a.viewURL&&(this._viewURL=a.viewURL,this.syncNavigationState(),this._connected?(this.renderArtifact({resetTrust:!0}),l=!0):this._trustedChannel.reset()),this._contentURL!==a.contentURL&&(this._contentURL=a.contentURL,this._connected&&(this.renderArtifact(),l=!0)),this._fullScreen!==a.fullScreen&&(this._fullScreen=a.fullScreen,this._connected&&this._artifact&&(this.renderArtifact({preserveFrameSrc:!0}),l=!0)),this._inert=a.inert,this._onFullScreenChange=a.onFullScreenChange,this._connected&&!l&&this.renderArtifact({preserveFrameSrc:!0}),super.update(t,r)}attachApplicationSubscriptions(){!this._application||this._applicationSubscriptionsAttached||(this._application.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._application.addEventListener("theme-changed",this.handleThemeChanged),this._applicationSubscriptionsAttached=!0)}detachApplicationSubscriptions(){!this._application||!this._applicationSubscriptionsAttached||(this._application.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._application.removeEventListener("theme-changed",this.handleThemeChanged),this._applicationSubscriptionsAttached=!1)}get activeView(){return null}connected(){this._connected=!0,this._trustedChannel.connect(),this.attachApplicationSubscriptions(),this.resetTrustedFrame(),this.syncNavigationState(),this.renderArtifact(),this.syncFrameSubscriptions()}disconnected(){var t;this._connected=!1,(t=this._dialogPresentation)==null||t.withdraw(),this._dialogPresentation=null,this._deleteConfirmationOpen=!1,this.resetTrustedFrame(),this._trustedChannel.disconnect(),this.unsubscribeFromWebview(),this.syncNavigationState(),this.detachApplicationSubscriptions()}handleTrustedFrameMessage(t,r){var i;switch(t.type){case"url-target-request":r.send({type:m8,url:this.currentExternalTargetURL()});return;case"artifact-missing-request":{const o=this.currentMissingArtifactMessage();o&&(this._missingArtifactReplyTransport=r,r.send(o));return}case"proxy-content-changed":this.handleProxyContentChanged();return;case"navigation-request":this.handleNavigationRequest(t);return;case"navigation-key":(i=this._application)==null||i.handleNavigationKey(t.key);return;case"artifact-pointer":this.handleArtifactPointer(t);return;case"bridge-ready":case"leaving":return}}handleArtifactPointer(t){const r=this.currentFrame;if(r===null||r.clientWidth<=0||r.clientHeight<=0)return;const i=r.getBoundingClientRect();P_({eventType:t.eventType,clientX:i.left+t.clientX*i.width/r.clientWidth,clientY:i.top+t.clientY*i.height/r.clientHeight,button:t.button,buttons:t.buttons})}currentExternalTargetURL(){var r,i;const t=((r=this._navigationState)==null?void 0:r.currentURL)??null;return t&&b9(t)?t:((i=this._artifact)==null?void 0:i.kind)==="url"?this._artifact.url:null}currentMissingArtifactMessage(){const t=this._artifact;return(t==null?void 0:t.kind)!=="path"?null:{type:g8,title:t.title,path:t.path}}handleProxyContentChanged(){var t;((t=this._artifact)==null?void 0:t.kind)!=="url"||!hr(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(t){if(!my(t.url,window.location.href))return;this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(t.url);if(i===v9||i===r.currentURL)return;const o=t.native===!0;(t.sameDocument||o)&&(this._preserveFrameSrcOnNavigationRender=!0),t.replace?r.replace(i):r.navigate(i)}syncNavigationState(){if(!this._connected||!this._artifact){this.disposeNavigationState();return}const t=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===t||(this.disposeNavigationState(),this._navigationState=new cM(this._artifact.id,t),this._navigationArtifactId=this._artifact.id,this._navigationCanonicalURL=t,this._navigationState.addEventListener("change",this.handleNavigationChange),this._navigationState.currentURL!==null?this.renderArtifact():this._navigationState.canGoForward&&this.renderArtifact({preserveFrameSrc:!0}))}disposeNavigationState(){var t;(t=this._navigationState)==null||t.removeEventListener("change",this.handleNavigationChange),this._navigationState=null,this._navigationArtifactId=null,this._navigationCanonicalURL=null,this._preserveFrameSrcOnNavigationRender=!1}canonicalURLForArtifact(t){const r=Fh({artifact:t,application:this._application,electron:Hr(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:null}),i=r.viewURL;return t.kind==="url"&&hr(t.url)||r.renderer==="url-webview"?Vr(i):ew(i,i)}convertIframeNavigationURL(t){var r;return((r=this._artifact)==null?void 0:r.kind)==="url"&&hr(this._artifact.url)&&hr(t)?Vr(t):ew(t,this._viewURL??this._navigationCanonicalURL??null)}handleWebviewNavigationEvent(t){const r=t.url;if(typeof r!="string"||!my(r,window.location.href))return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const o=Vr(r);return o===i.currentURL?!1:(i.navigate(o),!0)}syncWebviewSubscription(t=this.currentFrame){const r=(t==null?void 0:t.tagName.toLowerCase())==="webview"?t:null;r!==this._subscribedWebview&&(this.unsubscribeFromWebview(),r&&(r.addEventListener("did-navigate",this.handleWebviewDidNavigate),r.addEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=r))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("did-navigate",this.handleWebviewDidNavigate),this._subscribedWebview.removeEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=null)}get currentFrame(){var t;return((t=this._documentHost)==null?void 0:t.currentFrame)??null}syncFrameSubscriptions(){const t=this.currentFrame;this.syncFrameTitle(t),this._trustedChannel.setCurrentFrame(t),this.syncWebviewSubscription(t)}syncFrameTitle(t){t&&this._artifact&&t.getAttribute("title")!==this._artifact.title&&t.setAttribute("title",this._artifact.title)}resetTrustedFrame(){this._missingArtifactReplyTransport=null,this._trustedChannel.reset()}assignDocumentSource(t={}){var p,g,y;const r=this._artifact;if(!r)return;t.resetTrust&&this.resetTrustedFrame();const i={artifact:r,application:this._application,electron:Hr(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((p=this._navigationState)==null?void 0:p.currentURL)??null},o=Fh(i),a=(g=this.currentFrame)==null?void 0:g.getAttribute("src");let l=null;this._activeReloadFrameSrc&&(z_(this._activeReloadFrameSrc,o.viewURL)?l=this._activeReloadFrameSrc:this._activeReloadFrameSrc=null);const c=t.frameSrcOverride??l??(t.preserveFrameSrc&&a?a:o.viewURL),d={...i,frameSrcOverride:c};this._pendingDocumentSource=d,(y=this._documentHost)==null||y.assignSource(d),this.syncFrameSubscriptions()}reloadProxyFrame(){var a,l,c,d,p;const t=this.currentFrame;if(!t||t.hasAttribute("data-content-url")||t.tagName.toLowerCase()==="webview"&&!(((a=this._artifact)==null?void 0:a.kind)==="path"||((l=this._artifact)==null?void 0:l.kind)==="url"&&hr(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&hr(this._artifact.url)?((d=this._navigationState)==null?void 0:d.currentURL)??t.getAttribute("src"):t.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(ja,String(++this._proxyReloadVersion));const o=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=o,(p=this._rootRef.value)==null||p.removeAttribute("data-embed-loaded"),this.renderArtifact({frameSrcOverride:o,resetTrust:!0})}forceCurrentFrameSrc(){var o,a,l;if(!this._artifact)return;const t=Fh({artifact:this._artifact,application:this._application,electron:Hr(),viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((o=this._navigationState)==null?void 0:o.currentURL)??null});if(t.renderer==="url-webview")return;const r=this.currentFrame,i=(r==null?void 0:r.tagName.toLowerCase())==="iframe"?r:null;i&&(this.resetTrustedFrame(),this._activeReloadFrameSrc=null,(a=this._rootRef.value)==null||a.removeAttribute("data-embed-loaded"),i.setAttribute("src",t.viewURL),(l=this._documentHost)==null||l.refreshFrameLoadState())}menuEntries(){return[{label:this._fullScreen?"Exit full-screen":"Make full-screen",action:()=>this.requestFullScreen(!this._fullScreen)},{separator:!0},{label:"Delete",destructive:!0,action:()=>this.showDeleteConfirmation()}]}closeMenu(){var i;const t=this._rootRef.value,r=t==null?void 0:t.querySelector(".artifact-menu-trigger");r&&((i=t==null?void 0:t.ownerDocument.querySelector(`tv-menu[trigger="${r.id}"]`))==null||i.removeAttribute("open"))}requestFullScreen(t){this.closeMenu(),this._onFullScreenChange(t)}showDeleteConfirmation(){var r,i,o;if(this._deleteConfirmationOpen)return;this.closeMenu(),this._deleteConfirmationOpen=!0,this.renderArtifact({preserveFrameSrc:!0});const t=(r=this._rootRef.value)==null?void 0:r.querySelector("dialog");t&&(this._dialogPresentation=Mp(t,()=>this.dismissDeleteConfirmation()),(o=(i=this._rootRef.value)==null?void 0:i.querySelector(".dialog-actions button"))==null||o.focus())}dismissDeleteConfirmation(){const t=this._dialogPresentation;this._dialogPresentation=null,this._deleteConfirmationOpen=!1,t==null||t.withdraw(),this.isConnected&&this._artifact&&this.renderArtifact({preserveFrameSrc:!0})}confirmDelete(){var i;const t=(i=this._artifact)==null?void 0:i.id,r=this._application;this.dismissDeleteConfirmation(),!(!t||!r)&&r.deleteArtifact(t).catch(()=>{})}navigationControlsTemplate(){const t=this._navigationState;return!t||!t.canGoBack&&!t.canGoForward?null:U`
|
|
278
|
+
<button
|
|
279
|
+
icon
|
|
280
|
+
size="sm"
|
|
281
|
+
variant="ghost"
|
|
282
|
+
class="artifact-back"
|
|
283
|
+
?disabled=${!t.canGoBack}
|
|
284
|
+
@click=${()=>t.back()}
|
|
285
|
+
aria-label="Back"
|
|
286
|
+
>
|
|
287
|
+
<tv-icon name="back" size="sm"></tv-icon>
|
|
288
|
+
</button>
|
|
289
|
+
<button
|
|
290
|
+
icon
|
|
291
|
+
size="sm"
|
|
292
|
+
variant="ghost"
|
|
293
|
+
class="artifact-forward"
|
|
294
|
+
?disabled=${!t.canGoForward}
|
|
295
|
+
@click=${()=>t.forward()}
|
|
296
|
+
aria-label="Forward"
|
|
297
|
+
>
|
|
298
|
+
<tv-icon name="forward" size="sm"></tv-icon>
|
|
299
|
+
</button>
|
|
300
|
+
<span class="artifact-bar-divider" aria-hidden="true"></span>
|
|
301
|
+
`}deleteConfirmationTemplate(){return!this._deleteConfirmationOpen||!this._artifact?null:Op(U`
|
|
302
|
+
<div class="dialog-alert" role="alertdialog">
|
|
303
|
+
<h2>Delete “${this._artifact.title}”?</h2>
|
|
304
|
+
<p>It’s removed from this channel; the file or web page it points to is not deleted.</p>
|
|
305
|
+
<div class="dialog-actions">
|
|
306
|
+
<button @click=${()=>this.dismissDeleteConfirmation()}>Cancel</button>
|
|
307
|
+
<button intent="danger" @click=${()=>this.confirmDelete()}>Delete</button>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
`)}template(t,r,i){const o=this._artifact;return U`
|
|
311
|
+
<div
|
|
312
|
+
class="artifact-view artifact-frame"
|
|
313
|
+
kind=${o.kind}
|
|
314
|
+
?full-screen=${this._fullScreen}
|
|
315
|
+
?inert=${this._inert}
|
|
316
|
+
._trustedChannel=${this._trustedChannel}
|
|
317
|
+
${Je(this._rootRef)}
|
|
318
|
+
>
|
|
319
|
+
<div class="artifact-frame-clip">
|
|
320
|
+
${h9(this.captureDocumentHost,this.handleEmbedLoadChange,this.handleDocumentFrameChange)}
|
|
321
|
+
<footer class="artifact-title-bar" @dblclick=${this.handleTitleBarDoubleClick}>
|
|
322
|
+
<tv-icon name="artifact"></tv-icon>
|
|
323
|
+
<span class="artifact-title">${o.title}</span>
|
|
324
|
+
${this.navigationControlsTemplate()}
|
|
325
|
+
${o_(this.menuEntries(),{trigger:a=>U`
|
|
326
|
+
<button
|
|
327
|
+
icon
|
|
328
|
+
size="sm"
|
|
329
|
+
variant="ghost"
|
|
330
|
+
class="artifact-menu-trigger"
|
|
331
|
+
id=${a}
|
|
332
|
+
aria-label=${`${o.title} menu`}
|
|
333
|
+
>
|
|
334
|
+
<tv-icon name="expand"></tv-icon>
|
|
335
|
+
</button>
|
|
336
|
+
`})}
|
|
337
|
+
</footer>
|
|
338
|
+
</div>
|
|
339
|
+
${this.deleteConfirmationTemplate()}
|
|
340
|
+
</div>
|
|
341
|
+
`}renderArtifact(t={}){this._artifact&&(this.assignDocumentSource({preserveFrameSrc:t.preserveFrameSrc??!1,frameSrcOverride:t.frameSrcOverride,resetTrust:t.resetTrust}),this.render(),t.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncFrameSubscriptions())}}const w9=Mt(y9);function b9(n){return n.startsWith("http://")||n.startsWith("https://")}function S9(n,e){return n.id!==e.id||n.kind!==e.kind?!1:n.kind==="path"&&e.kind==="path"?n.path===e.path:n.kind==="url"&&e.kind==="url"?z_(n.url,e.url):!0}function _9(n,e){return n.kind==="path"&&e.kind==="path"&&n.id===e.id&&(n.title!==e.title||n.path!==e.path)}function z_(n,e){try{const t=new URL(n,window.location.href),r=new URL(e,window.location.href);return t.searchParams.delete(ja),r.searchParams.delete(ja),t.origin===r.origin&&t.pathname===r.pathname&&t.search===r.search}catch{return!1}}function ew(n,e){try{const t=new URL(n,window.location.href);if(e){const r=new URL(e,window.location.href);if(t.origin!=="null"&&t.origin===r.origin)return t.searchParams.delete(ja),`${t.pathname}${t.search}${t.hash}`}}catch{return Vr(n)}return Vr(n)}function U_(n,e,t,r,i){const o=e.pages.map(a=>({artifactIds:[...a.artifactIds],geometry:{...a.geometry,full_screen:a===t?i:a.geometry.full_screen},size:a===t?{...r}:{...a.size}}));n.updateChannelPages(e.id,o).catch(()=>{})}function ag(n,e,t,r){U_(n,e,t,t.size,r)}function R0(n){return{width:1-Vy+Vy*n.width/Zz,height:1-By+By*n.height/Hz}}function F_(n){return{width:Math.min(Yz,n.width),height:Math.min(Jz,n.height)}}function tw(n,e){const t=R0(e),r=F_(e);return{width:Math.min(e.width,Math.max(r.width,n.width*t.width)),height:Math.min(e.height,Math.max(r.height,n.height*t.height))}}function A9(n,e){const t=R0(e);return{width:n.width/t.width,height:n.height/t.height}}const nw=.5,oh=2,E9=120,k9=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];var Ms,Zn,_a,kr,Aa,Ns,_i,Ai,Ei,Cr,zs,Us,Hn,Ea,Tr,Vn,rt,$r,Bn,z,Z_,H_,Zl,V_,Hl,lg,qh,B_,Yc,Jc,Kc,Xc,Fs,Qc,cg,sn,ug,Do,q_,W_,Vl;class C9 extends Ot{constructor(){super(...arguments);f(this,z);f(this,Ms,vn());f(this,Zn,vn());f(this,_a);f(this,kr);f(this,Aa);f(this,Ns);f(this,_i);f(this,Ai,0);f(this,Ei,0);f(this,Cr,null);f(this,zs,null);f(this,Us,null);f(this,Hn,null);f(this,Ea,[]);f(this,Tr,null);f(this,Vn,null);f(this,rt,null);f(this,$r,new Set);f(this,Bn,!1);f(this,Yc,t=>{const r=s(this,rt);!r||t.pointerId!==r.pointerId||(r.lastPointer={x:t.clientX,y:t.clientY},r.option=t.altKey,u(this,z,cg).call(this,r))});f(this,Jc,t=>{var r;t.pointerId===((r=s(this,rt))==null?void 0:r.pointerId)&&u(this,z,sn).call(this,!0)});f(this,Kc,t=>{var r;t.pointerId===((r=s(this,rt))==null?void 0:r.pointerId)&&u(this,z,sn).call(this,!1)});f(this,Xc,t=>{var r;t.pointerId===((r=s(this,rt))==null?void 0:r.pointerId)&&u(this,z,sn).call(this,!1)});f(this,Fs,t=>{const r=s(this,rt);if(r){if(t.type==="keydown"&&t.key==="Escape"){t.preventDefault(),u(this,z,sn).call(this,!1);return}r.option!==t.altKey&&(r.option=t.altKey,u(this,z,cg).call(this,r))}});f(this,Qc,()=>{const t=s(this,rt);!t||rw(u(this,z,Zl).call(this,t.filmstrip),t.pageBox)||(u(this,z,lg).call(this),u(this,z,sn).call(this,!1))})}connected(){h(this,_a,void 0),h(this,kr,void 0),h(this,Aa,void 0),h(this,Ns,void 0),h(this,_i,void 0)}template(t,r,i,o=!1){var fe;const a=!s(this,Bn)&&o;if(h(this,Bn,o),a){u(this,z,sn).call(this,!1),u(this,z,Vl).call(this);for(const de of s(this,$r))de.cancel();s(this,$r).clear()}const l=(i==null?void 0:i.channelId)===(r==null?void 0:r.id)?i:null,c=$9(r,(l==null?void 0:l.pages)??(r==null?void 0:r.pages)),d=(r==null?void 0:r.selectedPage)??null,p=(r==null?void 0:r.id)??null,g=(d==null?void 0:d.artifactIds[0])??null,y=(d==null?void 0:d.geometry.full_screen)??null,v=s(this,Ns)!==void 0,A=c.map(({key:de,page:Ve})=>`${de}:${Ve.geometry.full_screen}:${Ve.size.width}:${Ve.size.height}`).sort().join("|"),E=l===null?null:c.map(({key:de})=>de).join("|"),x=p!==s(this,_a),B=g!==s(this,kr),P=y!==s(this,Aa),J=A!==s(this,Ns),O=E!==s(this,_i),Z=!s(this,Bn)&&l!==null&&s(this,_i)!==void 0&&s(this,_i)!==null&&O?u(this,z,q_).call(this):null,j=!s(this,Bn)&&B&&!x&&s(this,kr)!==void 0&&s(this,kr)!==null&&g!==null;return s(this,rt)&&(x||B||P)&&u(this,z,sn).call(this,!1),h(this,_a,p),h(this,kr,g),h(this,Aa,y),h(this,Ns,A),h(this,_i,E),h(this,Ea,c),J&&v&&u(this,z,qh).call(this),x&&((fe=s(this,Hn))==null||fe.disconnect(),h(this,zs,null),h(this,Us,null),h(this,Tr,null)),queueMicrotask(()=>u(this,z,Hl).call(this)),x||B||J||a?queueMicrotask(()=>u(this,z,Z_).call(this,g,j)):O&&queueMicrotask(()=>{const de=s(this,Zn).value;de&&(u(this,z,Do).call(this,de,g,!1),Z&&u(this,z,W_).call(this,Z))}),U`
|
|
342
|
+
<section
|
|
343
|
+
class="stage"
|
|
344
|
+
${Je(s(this,Ms))}
|
|
345
|
+
style=${`--handle-band: ${Vz}px; --handle-reach: ${Bz}px; --handle-thickness: ${qz}px;`}
|
|
346
|
+
>
|
|
347
|
+
${r!==null&&c.length===0?U`
|
|
348
|
+
<div class="stage-empty">
|
|
349
|
+
<tv-icon name="artifact" size="xl"></tv-icon>
|
|
350
|
+
<p>No artifacts yet — ask your agent to put something here.</p>
|
|
351
|
+
</div>
|
|
352
|
+
`:null}
|
|
353
|
+
${gd([p],de=>de,()=>U`
|
|
354
|
+
<div class="filmstrip" ${Je(s(this,Zn))}>
|
|
355
|
+
<div class="filmstrip-inner">
|
|
356
|
+
${gd(c,({key:de})=>de,({page:de,artifact:Ve,key:ve})=>{if(r===null)return null;const Xe=ve===g;return U`
|
|
357
|
+
<div
|
|
358
|
+
class="page"
|
|
359
|
+
data-page-key=${ve}
|
|
360
|
+
?selected=${Xe}
|
|
361
|
+
?full-screen=${de.geometry.full_screen}
|
|
362
|
+
style=${u(this,z,V_).call(this,de)}
|
|
363
|
+
@click=${Xe||Ve===null?null:()=>t.selectPage(r.id,Ve.id)}
|
|
364
|
+
>
|
|
365
|
+
${Ve?w9(t,Ve,{viewURL:t.getArtifactViewURL(Ve),contentURL:t.getArtifactContentURL(Ve),fullScreen:de.geometry.full_screen,inert:!Xe,onFullScreenChange:Ue=>ag(t,r,de,Ue)}):null}
|
|
366
|
+
${Xe?U`
|
|
367
|
+
<div class="page-handles" aria-hidden="true">
|
|
368
|
+
${k9.map(Ue=>U`
|
|
369
|
+
<span
|
|
370
|
+
class="page-handle ${Ue}"
|
|
371
|
+
@pointerdown=${le=>u(this,z,B_).call(this,le,Ue,t,r,de,ve)}
|
|
372
|
+
></span>
|
|
373
|
+
`)}
|
|
374
|
+
</div>
|
|
375
|
+
`:null}
|
|
376
|
+
</div>
|
|
377
|
+
`})}
|
|
378
|
+
</div>
|
|
379
|
+
</div>
|
|
380
|
+
`)}
|
|
381
|
+
</section>
|
|
382
|
+
`}disconnected(){var t;u(this,z,sn).call(this,!1),u(this,z,qh).call(this),u(this,z,Vl).call(this),cancelAnimationFrame(s(this,Ai)),h(this,Ai,0),(t=s(this,Hn))==null||t.disconnect(),h(this,Hn,null),h(this,zs,null),h(this,Us,null),h(this,Tr,null),h(this,Ea,[]);for(const r of s(this,$r))r.cancel();s(this,$r).clear()}}Ms=new WeakMap,Zn=new WeakMap,_a=new WeakMap,kr=new WeakMap,Aa=new WeakMap,Ns=new WeakMap,_i=new WeakMap,Ai=new WeakMap,Ei=new WeakMap,Cr=new WeakMap,zs=new WeakMap,Us=new WeakMap,Hn=new WeakMap,Ea=new WeakMap,Tr=new WeakMap,Vn=new WeakMap,rt=new WeakMap,$r=new WeakMap,Bn=new WeakMap,z=new WeakSet,Z_=function(t,r){const i=s(this,Zn).value;i&&(cancelAnimationFrame(s(this,Ai)),h(this,Ai,requestAnimationFrame(()=>{h(this,Ai,0),u(this,z,Do).call(this,i,t,r)})))},H_=function(t,r){var i;typeof ResizeObserver>"u"||t===s(this,zs)&&r===s(this,Us)||((i=s(this,Hn))==null||i.disconnect(),h(this,zs,t),h(this,Us,r),h(this,Hn,new ResizeObserver(()=>{const o=u(this,z,Zl).call(this,t);rw(o,s(this,Tr))||(u(this,z,lg).call(this),s(this,rt)&&u(this,z,sn).call(this,!1),u(this,z,Hl).call(this,t)),s(this,Cr)===null&&u(this,z,Do).call(this,t,s(this,kr)??null,!1)})),s(this,Hn).observe(t),s(this,Hn).observe(r))},Zl=function(t){const r=Number.parseFloat(getComputedStyle(t).getPropertyValue("--page-inset"))||0;return{width:Math.max(0,t.clientWidth-2*r),height:Math.max(0,t.clientHeight-r)}},V_=function(t){if(t.geometry.full_screen||s(this,Tr)===null)return"";const r=tw(t.size,s(this,Tr));return`width: ${r.width}px; height: ${r.height}px;`},Hl=function(t=s(this,Zn).value){var o;if(!t)return;const r=u(this,z,Zl).call(this,t);h(this,Tr,r);const i=new Map(s(this,Ea).map(a=>[a.key,a.page]));for(const a of t.querySelectorAll(".page")){if(a===((o=s(this,rt))==null?void 0:o.pageElement))continue;const l=i.get(a.dataset.pageKey??"");if(!l)continue;if(l.geometry.full_screen){a.style.width="",a.style.height="";continue}const c=tw(l.size,r);a.style.width=`${c.width}px`,a.style.height=`${c.height}px`}},lg=function(){const t=s(this,Ms).value;t&&(t.setAttribute("window-tracking",""),s(this,Vn)!==null&&clearTimeout(s(this,Vn)),h(this,Vn,setTimeout(()=>{h(this,Vn,null),t.removeAttribute("window-tracking")},E9)))},qh=function(){var t;s(this,Vn)!==null&&(clearTimeout(s(this,Vn)),h(this,Vn,null)),(t=s(this,Ms).value)==null||t.removeAttribute("window-tracking")},B_=function(t,r,i,o,a,l){if(s(this,Bn)||t.button!==0||!t.isPrimary)return;const c=t.currentTarget,d=c.closest(".page"),p=s(this,Zn).value,g=s(this,Ms).value;if(!d||!p||!g)return;u(this,z,sn).call(this,!1),u(this,z,qh).call(this),t.preventDefault(),t.stopPropagation();const y=d.getBoundingClientRect(),v=u(this,z,Zl).call(this,p),A=R0(v),E=a.geometry.full_screen,x=r.includes("left")||r.includes("right"),B=r.includes("top")||r.includes("bottom");h(this,rt,{application:i,channel:o,page:a,pageKey:l,pageElement:d,filmstrip:p,stage:g,handle:c,pointerId:t.pointerId,startPointer:{x:t.clientX,y:t.clientY},lastPointer:{x:t.clientX,y:t.clientY},startRendered:{width:y.width,height:y.height},rendered:{width:y.width,height:y.height},baselineSize:E?{width:v.width/A.width,height:v.height/A.height}:{...a.size},pageBox:v,wasFullScreen:E,horizontal:x,vertical:B,leftish:r.includes("left"),topish:r.includes("top"),option:t.altKey,armed:!1,leftFullScreen:!1}),g.setAttribute("resizing",""),c.addEventListener("pointermove",s(this,Yc)),c.addEventListener("pointerup",s(this,Jc)),c.addEventListener("pointercancel",s(this,Kc)),c.addEventListener("lostpointercapture",s(this,Xc)),window.addEventListener("keydown",s(this,Fs)),window.addEventListener("keyup",s(this,Fs)),window.addEventListener("resize",s(this,Qc)),c.setPointerCapture(t.pointerId)},Yc=new WeakMap,Jc=new WeakMap,Kc=new WeakMap,Xc=new WeakMap,Fs=new WeakMap,Qc=new WeakMap,cg=function(t){const r=t.lastPointer.x!==t.startPointer.x||t.lastPointer.y!==t.startPointer.y;if(t.wasFullScreen&&!t.leftFullScreen){if(!r)return;t.leftFullScreen=!0,t.pageElement.removeAttribute("full-screen")}const i=F_(t.pageBox);let o=t.startRendered.width,a=t.startRendered.height;if(t.horizontal){const l=t.leftish?-oh:oh;o=Math.min(t.pageBox.width,Math.max(i.width,t.startRendered.width+(t.lastPointer.x-t.startPointer.x)*l))}if(t.vertical){const l=t.topish?-oh:oh;a=Math.min(t.pageBox.height,Math.max(i.height,t.startRendered.height+(t.lastPointer.y-t.startPointer.y)*l))}t.armed=!t.option&&t.horizontal&&t.vertical&&o>=t.pageBox.width-Wy&&a>=t.pageBox.height-Wy,t.rendered=t.armed?{...t.pageBox}:{width:o,height:a},t.pageElement.style.width=`${t.rendered.width}px`,t.pageElement.style.height=`${t.rendered.height}px`,u(this,z,ug).call(this,t.stage,t.armed),u(this,z,Do).call(this,t.filmstrip,t.pageKey,!1)},sn=function(t){const r=s(this,rt);if(r){if(h(this,rt,null),r.handle.removeEventListener("pointermove",s(this,Yc)),r.handle.removeEventListener("pointerup",s(this,Jc)),r.handle.removeEventListener("pointercancel",s(this,Kc)),r.handle.removeEventListener("lostpointercapture",s(this,Xc)),window.removeEventListener("keydown",s(this,Fs)),window.removeEventListener("keyup",s(this,Fs)),window.removeEventListener("resize",s(this,Qc)),r.handle.hasPointerCapture(r.pointerId)&&r.handle.releasePointerCapture(r.pointerId),u(this,z,ug).call(this,r.stage,!1),t&&r.armed)r.wasFullScreen&&r.pageElement.setAttribute("full-screen",""),ag(r.application,r.channel,r.page,!0);else if(t){const i={...r.baselineSize},o=A9(r.rendered,r.pageBox);let a=r.wasFullScreen&&r.leftFullScreen;r.horizontal&&r.rendered.width!==r.startRendered.width&&(i.width=o.width,a=!0),r.vertical&&r.rendered.height!==r.startRendered.height&&(i.height=o.height,a=!0),a?U_(r.application,r.channel,r.page,i,!1):u(this,z,Hl).call(this,r.filmstrip)}else r.pageElement.toggleAttribute("full-screen",r.wasFullScreen),u(this,z,Hl).call(this,r.filmstrip);r.pageElement.getBoundingClientRect(),r.stage.removeAttribute("resizing"),u(this,z,Do).call(this,r.filmstrip,r.pageKey,!1)}},ug=function(t,r){const i=t.querySelector(":scope > .snap-outline");if(!r){i==null||i.remove();return}if(i)return;const o=document.createElement("div");o.className="snap-outline",o.setAttribute("aria-hidden","true"),t.append(o)},Do=function(t,r,i){const o=[...t.querySelectorAll(".page")].find(y=>y.dataset.pageKey===r);if(!o){u(this,z,Vl).call(this);return}u(this,z,H_).call(this,t,o);const a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),c=Math.max(0,Math.min(t.scrollLeft+a.left+a.width/2-(l.left+l.width/2),t.scrollWidth-t.clientWidth));if(u(this,z,Vl).call(this),s(this,Bn)||!i||Math.abs(c-t.scrollLeft)<nw||matchMedia("(prefers-reduced-motion: reduce)").matches){t.scrollLeft=c;return}const d=t.scrollLeft,p=t.animate([{},{}],{duration:R_,easing:"ease"});h(this,Cr,p);const g=()=>{var v;if(p!==s(this,Cr))return;const y=p.playState==="finished"?1:((v=p.effect)==null?void 0:v.getComputedTiming().progress)??0;t.scrollLeft=d+(c-d)*y,p.playState==="finished"?(t.scrollLeft=c,h(this,Cr,null),h(this,Ei,0)):h(this,Ei,requestAnimationFrame(g))};h(this,Ei,requestAnimationFrame(g))},q_=function(){const t=s(this,Zn).value;return t?new Map([...t.querySelectorAll(".page")].map(r=>[r.dataset.pageKey??"",r.getBoundingClientRect().left])):new Map},W_=function(t){if(s(this,Bn))return;const r=s(this,Zn).value;if(r)for(const i of r.querySelectorAll(".page")){if(i.hasAttribute("selected"))continue;const o=t.get(i.dataset.pageKey??"");if(o===void 0)continue;const a=o-i.getBoundingClientRect().left;if(Math.abs(a)<=nw)continue;const l=i.animate({translate:[`${a}px 0`,"0px 0"]},{duration:Zo,easing:"ease"});s(this,$r).add(l),l.finished.finally(()=>{s(this,$r).delete(l)}).catch(()=>{})}},Vl=function(){var t;cancelAnimationFrame(s(this,Ei)),h(this,Ei,0),(t=s(this,Cr))==null||t.cancel(),h(this,Cr,null)};const T9=Mt(C9);function $9(n,e){if(!n||!e)return[];const t=new Map(n.artifacts.map(r=>[r.id,r]));return e.map((r,i)=>{const o=r.artifactIds[0];return{page:r,artifact:o===void 0?null:t.get(o)??null,key:o??`empty-page-${i}`}})}function rw(n,e){return e!==null&&n.width===e.width&&n.height===e.height}/**
|
|
383
|
+
* @license
|
|
384
|
+
* Copyright 2017 Google LLC
|
|
385
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
386
|
+
*/class hg extends Lu{constructor(e){if(super(e),this.it=ne,e.type!==Xn.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ne||e==null)return this._t=void 0,this.it=e;if(e===at)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:[]}}}hg.directiveName="unsafeHTML",hg.resultType=1;const j_=ll(hg);/*! @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:G_,setPrototypeOf:iw,isFrozen:R9,getPrototypeOf:I9,getOwnPropertyDescriptor:x9}=Object;let{freeze:ct,seal:en,create:Wh}=Object,{apply:dg,construct:pg}=typeof Reflect<"u"&&Reflect;ct||(ct=function(e){return e});en||(en=function(e){return e});dg||(dg=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];return e.apply(t,i)});pg||(pg=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 ah=ut(Array.prototype.forEach),P9=ut(Array.prototype.lastIndexOf),sw=ut(Array.prototype.pop),Sl=ut(Array.prototype.push),L9=ut(Array.prototype.splice),jh=ut(String.prototype.toLowerCase),Uf=ut(String.prototype.toString),Ff=ut(String.prototype.match),_l=ut(String.prototype.replace),D9=ut(String.prototype.indexOf),O9=ut(String.prototype.trim),Ct=ut(Object.prototype.hasOwnProperty),Qe=ut(RegExp.prototype.test),Al=M9(TypeError);function ut(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 dg(n,e,r)}}function M9(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return pg(n,t)}}function Q(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jh;iw&&iw(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=t(i);o!==i&&(R9(e)||(e[r]=o),i=o)}n[i]=!0}return n}function N9(n){for(let e=0;e<n.length;e++)Ct(n,e)||(n[e]=null);return n}function Cn(n){const e=Wh(null);for(const[t,r]of G_(n))Ct(n,t)&&(Array.isArray(r)?e[t]=N9(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=Cn(r):e[t]=r);return e}function El(n,e){for(;n!==null;){const r=x9(n,e);if(r){if(r.get)return ut(r.get);if(typeof r.value=="function")return ut(r.value)}n=I9(n)}function t(){return null}return t}const ow=ct(["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"]),Zf=ct(["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"]),Hf=ct(["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"]),z9=ct(["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"]),Vf=ct(["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"]),U9=ct(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),aw=ct(["#text"]),lw=ct(["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"]),Bf=ct(["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"]),cw=ct(["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"]),lh=ct(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),F9=en(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Z9=en(/<%[\w\W]*|[\w\W]*%>/gm),H9=en(/\$\{[\w\W]*/gm),V9=en(/^data-[\-\w.\u00B7-\uFFFF]+$/),B9=en(/^aria-[\-\w]+$/),Y_=en(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),q9=en(/^(?:\w+script|data):/i),W9=en(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),J_=en(/^html$/i),j9=en(/^[a-z][.\w]*(-[.\w]+)+$/i);var uw=Object.freeze({__proto__:null,ARIA_ATTR:B9,ATTR_WHITESPACE:W9,CUSTOM_ELEMENT:j9,DATA_ATTR:V9,DOCTYPE_NAME:J_,ERB_EXPR:Z9,IS_ALLOWED_URI:Y_,IS_SCRIPT_OR_DATA:q9,MUSTACHE_EXPR:F9,TMPLIT_EXPR:H9});const kl={element:1,text:3,progressingInstruction:7,comment:8,document:9},G9=function(){return typeof window>"u"?null:window},Y9=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 o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},hw=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function K_(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G9();const e=V=>K_(V);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==kl.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:d,NamedNodeMap:p=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:g,DOMParser:y,trustedTypes:v}=n,A=c.prototype,E=El(A,"cloneNode"),x=El(A,"remove"),B=El(A,"nextSibling"),P=El(A,"childNodes"),J=El(A,"parentNode");if(typeof a=="function"){const V=t.createElement("template");V.content&&V.content.ownerDocument&&(t=V.content.ownerDocument)}let O,Y="";const{implementation:Z,createNodeIterator:j,createDocumentFragment:fe,getElementsByTagName:de}=t,{importNode:Ve}=r;let ve=hw();e.isSupported=typeof G_=="function"&&typeof J=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Xe,ERB_EXPR:Ue,TMPLIT_EXPR:le,DATA_ATTR:nr,ARIA_ATTR:Nt,IS_SCRIPT_OR_DATA:ul,ATTR_WHITESPACE:hl,CUSTOM_ELEMENT:Mu}=uw;let{IS_ALLOWED_URI:B0}=uw,Fe=null;const q0=Q({},[...ow,...Zf,...Hf,...Vf,...aw]);let Be=null;const W0=Q({},[...lw,...Bf,...cw,...lh]);let Te=Object.seal(Wh(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}})),dl=null,Nu=null;const Yr=Object.seal(Wh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let j0=!0,Fp=!0,G0=!1,Y0=!0,po=!1,zu=!0,Ji=!1,Zp=!1,Hp=!1,fo=!1,Uu=!1,Fu=!1,J0=!0,K0=!1;const K6="user-content-";let Vp=!0,pl=!1,mo={},Sn=null;const Bp=Q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let X0=null;const Q0=Q({},["audio","video","img","source","image","track"]);let qp=null;const ev=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zu="http://www.w3.org/1998/Math/MathML",Hu="http://www.w3.org/2000/svg",rr="http://www.w3.org/1999/xhtml";let go=rr,Wp=!1,jp=null;const X6=Q({},[Zu,Hu,rr],Uf);let Vu=Q({},["mi","mo","mn","ms","mtext"]),Bu=Q({},["annotation-xml"]);const Q6=Q({},["title","style","font","a","script"]);let fl=null;const e8=["application/xhtml+xml","text/html"],t8="text/html";let De=null,vo=null;const n8=t.createElement("form"),tv=function(b){return b instanceof RegExp||b instanceof Function},Gp=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(vo&&vo===b)){if((!b||typeof b!="object")&&(b={}),b=Cn(b),fl=e8.indexOf(b.PARSER_MEDIA_TYPE)===-1?t8:b.PARSER_MEDIA_TYPE,De=fl==="application/xhtml+xml"?Uf:jh,Fe=Ct(b,"ALLOWED_TAGS")?Q({},b.ALLOWED_TAGS,De):q0,Be=Ct(b,"ALLOWED_ATTR")?Q({},b.ALLOWED_ATTR,De):W0,jp=Ct(b,"ALLOWED_NAMESPACES")?Q({},b.ALLOWED_NAMESPACES,Uf):X6,qp=Ct(b,"ADD_URI_SAFE_ATTR")?Q(Cn(ev),b.ADD_URI_SAFE_ATTR,De):ev,X0=Ct(b,"ADD_DATA_URI_TAGS")?Q(Cn(Q0),b.ADD_DATA_URI_TAGS,De):Q0,Sn=Ct(b,"FORBID_CONTENTS")?Q({},b.FORBID_CONTENTS,De):Bp,dl=Ct(b,"FORBID_TAGS")?Q({},b.FORBID_TAGS,De):Cn({}),Nu=Ct(b,"FORBID_ATTR")?Q({},b.FORBID_ATTR,De):Cn({}),mo=Ct(b,"USE_PROFILES")?b.USE_PROFILES:!1,j0=b.ALLOW_ARIA_ATTR!==!1,Fp=b.ALLOW_DATA_ATTR!==!1,G0=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Y0=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,po=b.SAFE_FOR_TEMPLATES||!1,zu=b.SAFE_FOR_XML!==!1,Ji=b.WHOLE_DOCUMENT||!1,fo=b.RETURN_DOM||!1,Uu=b.RETURN_DOM_FRAGMENT||!1,Fu=b.RETURN_TRUSTED_TYPE||!1,Hp=b.FORCE_BODY||!1,J0=b.SANITIZE_DOM!==!1,K0=b.SANITIZE_NAMED_PROPS||!1,Vp=b.KEEP_CONTENT!==!1,pl=b.IN_PLACE||!1,B0=b.ALLOWED_URI_REGEXP||Y_,go=b.NAMESPACE||rr,Vu=b.MATHML_TEXT_INTEGRATION_POINTS||Vu,Bu=b.HTML_INTEGRATION_POINTS||Bu,Te=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&tv(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&tv(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Te.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),po&&(Fp=!1),Uu&&(fo=!0),mo&&(Fe=Q({},aw),Be=Wh(null),mo.html===!0&&(Q(Fe,ow),Q(Be,lw)),mo.svg===!0&&(Q(Fe,Zf),Q(Be,Bf),Q(Be,lh)),mo.svgFilters===!0&&(Q(Fe,Hf),Q(Be,Bf),Q(Be,lh)),mo.mathMl===!0&&(Q(Fe,Vf),Q(Be,cw),Q(Be,lh))),Ct(b,"ADD_TAGS")||(Yr.tagCheck=null),Ct(b,"ADD_ATTR")||(Yr.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?Yr.tagCheck=b.ADD_TAGS:(Fe===q0&&(Fe=Cn(Fe)),Q(Fe,b.ADD_TAGS,De))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?Yr.attributeCheck=b.ADD_ATTR:(Be===W0&&(Be=Cn(Be)),Q(Be,b.ADD_ATTR,De))),b.ADD_URI_SAFE_ATTR&&Q(qp,b.ADD_URI_SAFE_ATTR,De),b.FORBID_CONTENTS&&(Sn===Bp&&(Sn=Cn(Sn)),Q(Sn,b.FORBID_CONTENTS,De)),b.ADD_FORBID_CONTENTS&&(Sn===Bp&&(Sn=Cn(Sn)),Q(Sn,b.ADD_FORBID_CONTENTS,De)),Vp&&(Fe["#text"]=!0),Ji&&Q(Fe,["html","head","body"]),Fe.table&&(Q(Fe,["tbody"]),delete dl.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Al('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Al('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');O=b.TRUSTED_TYPES_POLICY,Y=O.createHTML("")}else O===void 0&&(O=Y9(v,i)),O!==null&&typeof Y=="string"&&(Y=O.createHTML(""));ct&&ct(b),vo=b}},nv=Q({},[...Zf,...Hf,...z9]),rv=Q({},[...Vf,...U9]),r8=function(b){let I=J(b);(!I||!I.tagName)&&(I={namespaceURI:go,tagName:"template"});const M=jh(b.tagName),ye=jh(I.tagName);return jp[b.namespaceURI]?b.namespaceURI===Hu?I.namespaceURI===rr?M==="svg":I.namespaceURI===Zu?M==="svg"&&(ye==="annotation-xml"||Vu[ye]):!!nv[M]:b.namespaceURI===Zu?I.namespaceURI===rr?M==="math":I.namespaceURI===Hu?M==="math"&&Bu[ye]:!!rv[M]:b.namespaceURI===rr?I.namespaceURI===Hu&&!Bu[ye]||I.namespaceURI===Zu&&!Vu[ye]?!1:!rv[M]&&(Q6[M]||!nv[M]):!!(fl==="application/xhtml+xml"&&jp[b.namespaceURI]):!1},_n=function(b){Sl(e.removed,{element:b});try{J(b).removeChild(b)}catch{x(b)}},Ki=function(b,I){try{Sl(e.removed,{attribute:I.getAttributeNode(b),from:I})}catch{Sl(e.removed,{attribute:null,from:I})}if(I.removeAttribute(b),b==="is")if(fo||Uu)try{_n(I)}catch{}else try{I.setAttribute(b,"")}catch{}},iv=function(b){let I=null,M=null;if(Hp)b="<remove></remove>"+b;else{const Re=Ff(b,/^[\r\n\t ]+/);M=Re&&Re[0]}fl==="application/xhtml+xml"&&go===rr&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const ye=O?O.createHTML(b):b;if(go===rr)try{I=new y().parseFromString(ye,fl)}catch{}if(!I||!I.documentElement){I=Z.createDocument(go,"template",null);try{I.documentElement.innerHTML=Wp?Y:ye}catch{}}const je=I.body||I.documentElement;return b&&M&&je.insertBefore(t.createTextNode(M),je.childNodes[0]||null),go===rr?de.call(I,Ji?"html":"body")[0]:Ji?I.documentElement:je},sv=function(b){return j.call(b.ownerDocument||b,b,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Yp=function(b){return b instanceof g&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof p)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},ov=function(b){return typeof l=="function"&&b instanceof l};function ir(V,b,I){ah(V,M=>{M.call(e,b,I,vo)})}const av=function(b){let I=null;if(ir(ve.beforeSanitizeElements,b,null),Yp(b))return _n(b),!0;const M=De(b.nodeName);if(ir(ve.uponSanitizeElement,b,{tagName:M,allowedTags:Fe}),zu&&b.hasChildNodes()&&!ov(b.firstElementChild)&&Qe(/<[/\w!]/g,b.innerHTML)&&Qe(/<[/\w!]/g,b.textContent)||b.nodeType===kl.progressingInstruction||zu&&b.nodeType===kl.comment&&Qe(/<[/\w]/g,b.data))return _n(b),!0;if(!(Yr.tagCheck instanceof Function&&Yr.tagCheck(M))&&(!Fe[M]||dl[M])){if(!dl[M]&&cv(M)&&(Te.tagNameCheck instanceof RegExp&&Qe(Te.tagNameCheck,M)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(M)))return!1;if(Vp&&!Sn[M]){const ye=J(b)||b.parentNode,je=P(b)||b.childNodes;if(je&&ye){const Re=je.length;for(let dt=Re-1;dt>=0;--dt){const sr=E(je[dt],!0);sr.__removalCount=(b.__removalCount||0)+1,ye.insertBefore(sr,B(b))}}}return _n(b),!0}return b instanceof c&&!r8(b)||(M==="noscript"||M==="noembed"||M==="noframes")&&Qe(/<\/no(script|embed|frames)/i,b.innerHTML)?(_n(b),!0):(po&&b.nodeType===kl.text&&(I=b.textContent,ah([Xe,Ue,le],ye=>{I=_l(I,ye," ")}),b.textContent!==I&&(Sl(e.removed,{element:b.cloneNode()}),b.textContent=I)),ir(ve.afterSanitizeElements,b,null),!1)},lv=function(b,I,M){if(Nu[I]||J0&&(I==="id"||I==="name")&&(M in t||M in n8))return!1;if(!(Fp&&!Nu[I]&&Qe(nr,I))){if(!(j0&&Qe(Nt,I))){if(!(Yr.attributeCheck instanceof Function&&Yr.attributeCheck(I,b))){if(!Be[I]||Nu[I]){if(!(cv(b)&&(Te.tagNameCheck instanceof RegExp&&Qe(Te.tagNameCheck,b)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(b))&&(Te.attributeNameCheck instanceof RegExp&&Qe(Te.attributeNameCheck,I)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(I,b))||I==="is"&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&Qe(Te.tagNameCheck,M)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(M))))return!1}else if(!qp[I]){if(!Qe(B0,_l(M,hl,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&b!=="script"&&D9(M,"data:")===0&&X0[b])){if(!(G0&&!Qe(ul,_l(M,hl,"")))){if(M)return!1}}}}}}}return!0},cv=function(b){return b!=="annotation-xml"&&Ff(b,Mu)},uv=function(b){ir(ve.beforeSanitizeAttributes,b,null);const{attributes:I}=b;if(!I||Yp(b))return;const M={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Be,forceKeepAttr:void 0};let ye=I.length;for(;ye--;){const je=I[ye],{name:Re,namespaceURI:dt,value:sr}=je,yo=De(Re),Jp=sr;let qe=Re==="value"?Jp:O9(Jp);if(M.attrName=yo,M.attrValue=qe,M.keepAttr=!0,M.forceKeepAttr=void 0,ir(ve.uponSanitizeAttribute,b,M),qe=M.attrValue,K0&&(yo==="id"||yo==="name")&&(Ki(Re,b),qe=K6+qe),zu&&Qe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,qe)){Ki(Re,b);continue}if(yo==="attributename"&&Ff(qe,"href")){Ki(Re,b);continue}if(M.forceKeepAttr)continue;if(!M.keepAttr){Ki(Re,b);continue}if(!Y0&&Qe(/\/>/i,qe)){Ki(Re,b);continue}po&&ah([Xe,Ue,le],dv=>{qe=_l(qe,dv," ")});const hv=De(b.nodeName);if(!lv(hv,yo,qe)){Ki(Re,b);continue}if(O&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!dt)switch(v.getAttributeType(hv,yo)){case"TrustedHTML":{qe=O.createHTML(qe);break}case"TrustedScriptURL":{qe=O.createScriptURL(qe);break}}if(qe!==Jp)try{dt?b.setAttributeNS(dt,Re,qe):b.setAttribute(Re,qe),Yp(b)?_n(b):sw(e.removed)}catch{Ki(Re,b)}}ir(ve.afterSanitizeAttributes,b,null)},i8=function V(b){let I=null;const M=sv(b);for(ir(ve.beforeSanitizeShadowDOM,b,null);I=M.nextNode();)ir(ve.uponSanitizeShadowNode,I,null),av(I),uv(I),I.content instanceof o&&V(I.content);ir(ve.afterSanitizeShadowDOM,b,null)};return e.sanitize=function(V){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,M=null,ye=null,je=null;if(Wp=!V,Wp&&(V="<!-->"),typeof V!="string"&&!ov(V))if(typeof V.toString=="function"){if(V=V.toString(),typeof V!="string")throw Al("dirty is not a string, aborting")}else throw Al("toString is not a function");if(!e.isSupported)return V;if(Zp||Gp(b),e.removed=[],typeof V=="string"&&(pl=!1),pl){if(V.nodeName){const sr=De(V.nodeName);if(!Fe[sr]||dl[sr])throw Al("root node is forbidden and cannot be sanitized in-place")}}else if(V instanceof l)I=iv("<!---->"),M=I.ownerDocument.importNode(V,!0),M.nodeType===kl.element&&M.nodeName==="BODY"||M.nodeName==="HTML"?I=M:I.appendChild(M);else{if(!fo&&!po&&!Ji&&V.indexOf("<")===-1)return O&&Fu?O.createHTML(V):V;if(I=iv(V),!I)return fo?null:Fu?Y:""}I&&Hp&&_n(I.firstChild);const Re=sv(pl?V:I);for(;ye=Re.nextNode();)av(ye),uv(ye),ye.content instanceof o&&i8(ye.content);if(pl)return V;if(fo){if(Uu)for(je=fe.call(I.ownerDocument);I.firstChild;)je.appendChild(I.firstChild);else je=I;return(Be.shadowroot||Be.shadowrootmode)&&(je=Ve.call(r,je,!0)),je}let dt=Ji?I.outerHTML:I.innerHTML;return Ji&&Fe["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&Qe(J_,I.ownerDocument.doctype.name)&&(dt="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
|
|
387
|
+
`+dt),po&&ah([Xe,Ue,le],sr=>{dt=_l(dt,sr," ")}),O&&Fu?O.createHTML(dt):dt},e.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gp(V),Zp=!0},e.clearConfig=function(){vo=null,Zp=!1},e.isValidAttribute=function(V,b,I){vo||Gp({});const M=De(V),ye=De(b);return lv(M,ye,I)},e.addHook=function(V,b){typeof b=="function"&&Sl(ve[V],b)},e.removeHook=function(V,b){if(b!==void 0){const I=P9(ve[V],b);return I===-1?void 0:L9(ve[V],I,1)[0]}return sw(ve[V])},e.removeHooks=function(V){ve[V]=[]},e.removeAllHooks=function(){ve=hw()},e}var X_=K_();function I0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ho=I0();function Q_(n){ho=n}var as={exec:()=>null};function ie(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(lt.caret,"$1"),t=t.replace(i,a),r},getRegex:()=>new RegExp(t,e)};return r}var J9=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),lt={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)}}>`)},K9=/^(?:[ \t]*(?:\n|$))+/,X9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Q9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ou=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,e7=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,x0=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,e6=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,t6=ie(e6).replace(/bull/g,x0).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(),t7=ie(e6).replace(/bull/g,x0).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(),P0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,n7=/^[^\n]+/,L0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,r7=ie(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",L0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),i7=ie(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,x0).getRegex(),Np="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",D0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,s7=ie("^ {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",D0).replace("tag",Np).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),n6=ie(P0).replace("hr",Ou).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",Np).getRegex(),o7=ie(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",n6).getRegex(),O0={blockquote:o7,code:X9,def:r7,fences:Q9,heading:e7,hr:Ou,html:s7,lheading:t6,list:i7,newline:K9,paragraph:n6,table:as,text:n7},dw=ie("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ou).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",Np).getRegex(),a7={...O0,lheading:t7,table:dw,paragraph:ie(P0).replace("hr",Ou).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",dw).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",Np).getRegex()},l7={...O0,html:ie(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",D0).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:as,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ie(P0).replace("hr",Ou).replace("heading",` *#{1,6} *[^
|
|
388
|
+
]`).replace("lheading",t6).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},c7=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,u7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,r6=/^( {2,}|\\)\n(?!\s*$)/,h7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,cl=/[\p{P}\p{S}]/u,zp=/[\s\p{P}\p{S}]/u,M0=/[^\s\p{P}\p{S}]/u,d7=ie(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,zp).getRegex(),i6=/(?!~)[\p{P}\p{S}]/u,p7=/(?!~)[\s\p{P}\p{S}]/u,f7=/(?:[^\s\p{P}\p{S}]|~)/u,m7=ie(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",J9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),s6=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,g7=ie(s6,"u").replace(/punct/g,cl).getRegex(),v7=ie(s6,"u").replace(/punct/g,i6).getRegex(),o6="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",y7=ie(o6,"gu").replace(/notPunctSpace/g,M0).replace(/punctSpace/g,zp).replace(/punct/g,cl).getRegex(),w7=ie(o6,"gu").replace(/notPunctSpace/g,f7).replace(/punctSpace/g,p7).replace(/punct/g,i6).getRegex(),b7=ie("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,M0).replace(/punctSpace/g,zp).replace(/punct/g,cl).getRegex(),S7=ie(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,cl).getRegex(),_7="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",A7=ie(_7,"gu").replace(/notPunctSpace/g,M0).replace(/punctSpace/g,zp).replace(/punct/g,cl).getRegex(),E7=ie(/\\(punct)/,"gu").replace(/punct/g,cl).getRegex(),k7=ie(/^<(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(),C7=ie(D0).replace("(?:-->|$)","-->").getRegex(),T7=ie("^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",C7).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Sd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$7=ie(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Sd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),a6=ie(/^!?\[(label)\]\[(ref)\]/).replace("label",Sd).replace("ref",L0).getRegex(),l6=ie(/^!?\[(ref)\](?:\[\])?/).replace("ref",L0).getRegex(),R7=ie("reflink|nolink(?!\\()","g").replace("reflink",a6).replace("nolink",l6).getRegex(),pw=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,N0={_backpedal:as,anyPunctuation:E7,autolink:k7,blockSkip:m7,br:r6,code:u7,del:as,delLDelim:as,delRDelim:as,emStrongLDelim:g7,emStrongRDelimAst:y7,emStrongRDelimUnd:b7,escape:c7,link:$7,nolink:l6,punctuation:d7,reflink:a6,reflinkSearch:R7,tag:T7,text:h7,url:as},I7={...N0,link:ie(/^!?\[(label)\]\((.*?)\)/).replace("label",Sd).getRegex(),reflink:ie(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Sd).getRegex()},fg={...N0,emStrongRDelimAst:w7,emStrongLDelim:v7,delLDelim:S7,delRDelim:A7,url:ie(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",pw).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:ie(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",pw).getRegex()},x7={...fg,br:ie(r6).replace("{2,}","*").getRegex(),text:ie(fg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ch={normal:O0,gfm:a7,pedantic:l7},Cl={normal:N0,gfm:fg,breaks:x7,pedantic:I7},P7={"&":"&","<":"<",">":">",'"':""","'":"'"},fw=n=>P7[n];function Tn(n,e){if(e){if(lt.escapeTest.test(n))return n.replace(lt.escapeReplace,fw)}else if(lt.escapeTestNoEncode.test(n))return n.replace(lt.escapeReplaceNoEncode,fw);return n}function mw(n){try{n=encodeURI(n).replace(lt.percentDecode,"%")}catch{return null}return n}function gw(n,e){var o;let t=n.replace(lt.findPipe,(a,l,c)=>{let d=!1,p=l;for(;--p>=0&&c[p]==="\\";)d=!d;return d?"|":" |"}),r=t.split(lt.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((o=r.at(-1))!=null&&o.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(lt.slashPipe,"|");return r}function Tl(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 L7(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 D7(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let o=4-t%4;r+=" ".repeat(o),t+=o}else r+=i,t++;return r}function vw(n,e,t,r,i){let o=e.href,a=e.title||null,l=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:o,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function O7(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
389
|
+
`).map(o=>{let a=o.match(t.other.beginningSpace);if(a===null)return o;let[l]=a;return l.length>=i.length?o.slice(i.length):o}).join(`
|
|
390
|
+
`)}var _d=class{constructor(n){C(this,"options");C(this,"rules");C(this,"lexer");this.options=n||ho}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:Tl(t,`
|
|
391
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=O7(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=Tl(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:Tl(e[0],`
|
|
392
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Tl(e[0],`
|
|
393
|
+
`).split(`
|
|
394
|
+
`),r="",i="",o=[];for(;t.length>0;){let a=!1,l=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))l.push(t[c]),a=!0;else if(!a)l.push(t[c]);else break;t=t.slice(c);let d=l.join(`
|
|
395
|
+
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
396
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
397
|
+
${d}`:d,i=i?`${i}
|
|
398
|
+
${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,o,!0),this.lexer.state.top=g,t.length===0)break;let y=o.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){let v=y,A=v.raw+`
|
|
399
|
+
`+t.join(`
|
|
400
|
+
`),E=this.blockquote(A);o[o.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,A=v.raw+`
|
|
401
|
+
`+t.join(`
|
|
402
|
+
`),E=this.list(A);o[o.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=A.substring(o.at(-1).raw.length).split(`
|
|
403
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:o,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),o=i.length>1,a={type:"list",raw:"",ordered:o,start:o?+i.slice(0,-1):"",loose:!1,items:[]};i=o?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=o?i:"[*+-]");let l=this.rules.other.listItemRegex(i),c=!1;for(;n;){let p=!1,g="",y="";if(!(e=l.exec(n))||this.rules.block.hr.test(n))break;g=e[0],n=n.substring(g.length);let v=D7(e[2].split(`
|
|
404
|
+
`,1)[0],e[1].length),A=n.split(`
|
|
405
|
+
`,1)[0],E=!v.trim(),x=0;if(this.options.pedantic?(x=2,y=v.trimStart()):E?x=e[1].length+1:(x=v.search(this.rules.other.nonSpaceChar),x=x>4?1:x,y=v.slice(x),x+=e[1].length),E&&this.rules.other.blankLine.test(A)&&(g+=A+`
|
|
406
|
+
`,n=n.substring(A.length+1),p=!0),!p){let B=this.rules.other.nextBulletRegex(x),P=this.rules.other.hrRegex(x),J=this.rules.other.fencesBeginRegex(x),O=this.rules.other.headingBeginRegex(x),Y=this.rules.other.htmlBeginRegex(x),Z=this.rules.other.blockquoteBeginRegex(x);for(;n;){let j=n.split(`
|
|
407
|
+
`,1)[0],fe;if(A=j,this.options.pedantic?(A=A.replace(this.rules.other.listReplaceNesting," "),fe=A):fe=A.replace(this.rules.other.tabCharGlobal," "),J.test(A)||O.test(A)||Y.test(A)||Z.test(A)||B.test(A)||P.test(A))break;if(fe.search(this.rules.other.nonSpaceChar)>=x||!A.trim())y+=`
|
|
408
|
+
`+fe.slice(x);else{if(E||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||J.test(v)||O.test(v)||P.test(v))break;y+=`
|
|
409
|
+
`+A}E=!A.trim(),g+=j+`
|
|
410
|
+
`,n=n.substring(j.length+1),v=fe.slice(x)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),a.items.push({type:"list_item",raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(y),loose:!1,text:y,tokens:[]}),a.raw+=g}let d=a.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let p of a.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),((t=p.tokens[0])==null?void 0:t.type)==="text"||((r=p.tokens[0])==null?void 0:r.type)==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.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 g=this.rules.other.listTaskCheckbox.exec(p.raw);if(g){let y={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};p.checked=y.checked,a.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=y.raw+p.tokens[0].raw,p.tokens[0].text=y.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(y)):p.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):p.tokens.unshift(y)}}if(!a.loose){let g=p.tokens.filter(v=>v.type==="space"),y=g.length>0&&g.some(v=>this.rules.other.anyLine.test(v.raw));a.loose=y}}if(a.loose)for(let p of a.items){p.loose=!0;for(let g of p.tokens)g.type==="text"&&(g.type="paragraph")}return a}}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 a;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=gw(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
411
|
+
`):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<t.length;l++)o.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:o.align[l]});for(let l of i)o.rows.push(gw(l,o.header.length).map((c,d)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[d]})));return o}}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)===`
|
|
412
|
+
`?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 o=Tl(t.slice(0,-1),"\\");if((t.length-o.length)%2===0)return}else{let o=L7(e[2],"()");if(o===-2)return;if(o>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[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)),vw(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 o=t[0].charAt(0);return{type:"text",raw:o,text:o}}return vw(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,o,a,l=i,c=0,d=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*n.length+i);(r=d.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let p=[...r[0]][0].length,g=n.slice(0,i+r.index+p+a);if(Math.min(i,a)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let y=g.slice(2,-2);return{type:"strong",raw:g,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,o,a,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o||(a=[...o].length,a!==i))continue;if(r[3]||r[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let d=[...r[0]][0].length,p=n.slice(0,i+r.index+d+a),g=p.slice(i,-i);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}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 o;do o=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(o!==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}}}},mn=class mg{constructor(e){C(this,"tokens");C(this,"options");C(this,"state");C(this,"inlineQueue");C(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ho,this.options.tokenizer=this.options.tokenizer||new _d,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:lt,block:ch.normal,inline:Cl.normal};this.options.pedantic?(t.block=ch.pedantic,t.inline=Cl.pedantic):this.options.gfm&&(t.block=ch.gfm,this.options.breaks?t.inline=Cl.breaks:t.inline=Cl.gfm),this.tokenizer.rules=t}static get rules(){return{block:ch,inline:Cl}}static lex(e,t){return new mg(t).lex(e)}static lexInline(e,t){return new mg(t).inlineTokens(e)}lex(e){e=e.replace(lt.carriageReturn,`
|
|
413
|
+
`),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,o,a;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(lt.tabCharGlobal," ").replace(lt.spaceLine,""));e;){let l;if((o=(i=this.options.extensions)==null?void 0:i.block)!=null&&o.some(d=>(l=d.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let d=t.at(-1);l.raw.length===1&&d!==void 0?d.raw+=`
|
|
414
|
+
`:t.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let d=t.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
|
|
415
|
+
`)?"":`
|
|
416
|
+
`)+l.raw,d.text+=`
|
|
417
|
+
`+l.text,this.inlineQueue.at(-1).src=d.text):t.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let d=t.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
|
|
418
|
+
`)?"":`
|
|
419
|
+
`)+l.raw,d.text+=`
|
|
420
|
+
`+l.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},t.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if((a=this.options.extensions)!=null&&a.startBlock){let d=1/0,p=e.slice(1),g;this.options.extensions.startBlock.forEach(y=>{g=y.call({lexer:this},p),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let d=t.at(-1);r&&(d==null?void 0:d.type)==="paragraph"?(d.raw+=(d.raw.endsWith(`
|
|
421
|
+
`)?"":`
|
|
422
|
+
`)+l.raw,d.text+=`
|
|
423
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):t.push(l),r=c.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let d=t.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
|
|
424
|
+
`)?"":`
|
|
425
|
+
`)+l.raw,d.text+=`
|
|
426
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):t.push(l);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,d,p,g,y;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)v.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)o=i[2]?i[2].length:0,r=r.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((d=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let a=!1,l="";for(;e;){a||(l=""),a=!1;let v;if((g=(p=this.options.extensions)==null?void 0:p.inline)!=null&&g.some(E=>(v=E.call({lexer:this},e,t))?(e=e.substring(v.raw.length),t.push(v),!0):!1))continue;if(v=this.tokenizer.escape(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.tag(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.link(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(v.raw.length);let E=t.at(-1);v.type==="text"&&(E==null?void 0:E.type)==="text"?(E.raw+=v.raw,E.text+=v.text):t.push(v);continue}if(v=this.tokenizer.emStrong(e,r,l)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.codespan(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.br(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.del(e,r,l)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.autolink(e)){e=e.substring(v.raw.length),t.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(e))){e=e.substring(v.raw.length),t.push(v);continue}let A=e;if((y=this.options.extensions)!=null&&y.startInline){let E=1/0,x=e.slice(1),B;this.options.extensions.startInline.forEach(P=>{B=P.call({lexer:this},x),typeof B=="number"&&B>=0&&(E=Math.min(E,B))}),E<1/0&&E>=0&&(A=e.substring(0,E+1))}if(v=this.tokenizer.inlineText(A)){e=e.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(l=v.raw.slice(-1)),a=!0;let E=t.at(-1);(E==null?void 0:E.type)==="text"?(E.raw+=v.raw,E.text+=v.text):t.push(v);continue}if(e){let E="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(E);break}else throw new Error(E)}}return t}},Ad=class{constructor(n){C(this,"options");C(this,"parser");this.options=n||ho}space(n){return""}code({text:n,lang:e,escaped:t}){var o;let r=(o=(e||"").match(lt.notSpaceStart))==null?void 0:o[0],i=n.replace(lt.endingNewline,"")+`
|
|
427
|
+
`;return r?'<pre><code class="language-'+Tn(r)+'">'+(t?i:Tn(i,!0))+`</code></pre>
|
|
428
|
+
`:"<pre><code>"+(t?i:Tn(i,!0))+`</code></pre>
|
|
429
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
430
|
+
${this.parser.parse(n)}</blockquote>
|
|
431
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
432
|
+
`}hr(n){return`<hr>
|
|
433
|
+
`}list(n){let e=n.ordered,t=n.start,r="";for(let a=0;a<n.items.length;a++){let l=n.items[a];r+=this.listitem(l)}let i=e?"ol":"ul",o=e&&t!==1?' start="'+t+'"':"";return"<"+i+o+`>
|
|
434
|
+
`+r+"</"+i+`>
|
|
435
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
436
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
437
|
+
`}table(n){let e="",t="";for(let i=0;i<n.header.length;i++)t+=this.tablecell(n.header[i]);e+=this.tablerow({text:t});let r="";for(let i=0;i<n.rows.length;i++){let o=n.rows[i];t="";for(let a=0;a<o.length;a++)t+=this.tablecell(o[a]);r+=this.tablerow({text:t})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
438
|
+
<thead>
|
|
439
|
+
`+e+`</thead>
|
|
440
|
+
`+r+`</table>
|
|
441
|
+
`}tablerow({text:n}){return`<tr>
|
|
442
|
+
${n}</tr>
|
|
443
|
+
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
444
|
+
`}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>${Tn(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=mw(n);if(i===null)return r;n=i;let o='<a href="'+n+'"';return e&&(o+=' title="'+Tn(e)+'"'),o+=">"+r+"</a>",o}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=mw(n);if(i===null)return Tn(t);n=i;let o=`<img src="${n}" alt="${Tn(t)}"`;return e&&(o+=` title="${Tn(e)}"`),o+=">",o}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Tn(n.text)}},z0=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}},gn=class gg{constructor(e){C(this,"options");C(this,"renderer");C(this,"textRenderer");this.options=e||ho,this.options.renderer=this.options.renderer||new Ad,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new z0}static parse(e,t){return new gg(t).parse(e)}static parseInline(e,t){return new gg(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[a.type]){let c=a,d=this.options.extensions.renderers[c.type].call({parser:this},c);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=d||"";continue}}let l=a;switch(l.type){case"space":{t+=this.renderer.space(l);break}case"hr":{t+=this.renderer.hr(l);break}case"heading":{t+=this.renderer.heading(l);break}case"code":{t+=this.renderer.code(l);break}case"table":{t+=this.renderer.table(l);break}case"blockquote":{t+=this.renderer.blockquote(l);break}case"list":{t+=this.renderer.list(l);break}case"checkbox":{t+=this.renderer.checkbox(l);break}case"html":{t+=this.renderer.html(l);break}case"def":{t+=this.renderer.def(l);break}case"paragraph":{t+=this.renderer.paragraph(l);break}case"text":{t+=this.renderer.text(l);break}default:{let c='Token with "'+l.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,o;this.renderer.parser=this;let r="";for(let a=0;a<e.length;a++){let l=e[a];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[l.type]){let d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=d||"";continue}}let c=l;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 d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return r}},mh,Bl=(mh=class{constructor(n){C(this,"options");C(this,"block");this.options=n||ho}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?mn.lex:mn.lexInline}provideParser(){return this.block?gn.parse:gn.parseInline}},C(mh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),C(mh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),mh),M7=class{constructor(...n){C(this,"defaults",I0());C(this,"options",this.setOptions);C(this,"parse",this.parseMarkdown(!0));C(this,"parseInline",this.parseMarkdown(!1));C(this,"Parser",gn);C(this,"Renderer",Ad);C(this,"TextRenderer",z0);C(this,"Lexer",mn);C(this,"Tokenizer",_d);C(this,"Hooks",Bl);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let o of n)switch(t=t.concat(e.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)t=t.concat(this.walkTokens(l.tokens,e));for(let l of a.rows)for(let c of l)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let a=o;t=t.concat(this.walkTokens(a.items,e));break}default:{let a=o;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);t=t.concat(this.walkTokens(c,e))}):a.tokens&&(t=t.concat(this.walkTokens(a.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 o=e.renderers[i.name];o?e.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}: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 o=e[i.level];o?o.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 Ad(this.defaults);for(let o in t.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=t.renderer[a],c=i[a];i[a]=(...d)=>{let p=l.apply(i,d);return p===!1&&(p=c.apply(i,d)),p||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new _d(this.defaults);for(let o in t.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=t.tokenizer[a],c=i[a];i[a]=(...d)=>{let p=l.apply(i,d);return p===!1&&(p=c.apply(i,d)),p}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Bl;for(let o in t.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=t.hooks[a],c=i[a];Bl.passThroughHooks.has(o)?i[a]=d=>{if(this.defaults.async&&Bl.passThroughHooksRespectAsync.has(o))return(async()=>{let g=await l.call(i,d);return c.call(i,g)})();let p=l.call(i,d);return c.call(i,p)}:i[a]=(...d)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,d);return g===!1&&(g=await c.apply(i,d)),g})();let p=l.apply(i,d);return p===!1&&(p=c.apply(i,d)),p}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,o=t.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return mn.lex(n,e??this.defaults)}parser(n,e){return gn.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return o(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 o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(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 a=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer():n?mn.lex:mn.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser():n?gn.parse:gn.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(o);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer():n?mn.lex:mn.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():n?gn.parse:gn.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(n,e){return t=>{if(t.message+=`
|
|
445
|
+
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Tn(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},ao=new M7;function he(n,e){return ao.parse(n,e)}he.options=he.setOptions=function(n){return ao.setOptions(n),he.defaults=ao.defaults,Q_(he.defaults),he};he.getDefaults=I0;he.defaults=ho;he.use=function(...n){return ao.use(...n),he.defaults=ao.defaults,Q_(he.defaults),he};he.walkTokens=function(n,e){return ao.walkTokens(n,e)};he.parseInline=ao.parseInline;he.Parser=gn;he.parser=gn.parse;he.Renderer=Ad;he.TextRenderer=z0;he.Lexer=mn;he.lexer=mn.lex;he.Tokenizer=_d;he.Hooks=Bl;he.parse=he;he.options;he.setOptions;he.use;he.walkTokens;he.parseInline;gn.parse;mn.lex;X_.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function c6(n){const e=he.parse(n,{async:!1});return X_.sanitize(e,{USE_PROFILES:{html:!0}})}var Zs,eu;class N7 extends Ot{constructor(){super(...arguments);f(this,Zs,null);f(this,eu,vn())}connected(){queueMicrotask(()=>{var r;if(!this.isConnected||s(this,Zs)!==null)return;const t=((r=s(this,eu).value)==null?void 0:r.querySelector("dialog"))??null;if(t===null)throw new Error("Desktop upgrade gate requires its composed dialog");h(this,Zs,Mp(t,()=>{}))})}disconnected(){var t;(t=s(this,Zs))==null||t.withdraw(),h(this,Zs,null)}template(t){return U`
|
|
446
|
+
<div class="desktop-upgrade-gate" ${Je(s(this,eu))}>
|
|
447
|
+
${Op(U`<div class="upgrade-gate-body" data-testid="upgrade-gate-body">${j_(c6(IS(t)))}</div>`)}
|
|
448
|
+
</div>
|
|
449
|
+
`}}Zs=new WeakMap,eu=new WeakMap;const z7=Mt(N7),U7=250,F7=1e3;var qn,Wn,Hs,ki,Vs,ka,bn,u6,Fd,Zd,h6,vg,d6;class Z7 extends Ot{constructor(){super(...arguments);f(this,bn);f(this,qn,V7());f(this,Wn,null);f(this,Hs,!1);f(this,ki,null);f(this,Vs,"");f(this,ka,null);f(this,Fd,t=>{h(this,Vs,t.currentTarget.value)});f(this,Zd,t=>{t.preventDefault();const r=s(this,Vs).trim();r.length===0||s(this,ka)===null||s(this,ka).authenticate(r)})}disconnected(){var t;u(this,bn,vg).call(this),(t=s(this,Wn))==null||t.withdraw(),h(this,Wn,null),h(this,Hs,!1),Dh(null,s(this,qn))}template(t,r){var i;return h(this,ka,r),u(this,bn,h6).call(this,t),t.kind==="needs-upgrade"?((i=s(this,Wn))==null||i.withdraw(),h(this,Wn,null),Dh(z7(t.instructions),s(this,qn)),s(this,qn)):(Dh(Op(u(this,bn,u6).call(this,t)),s(this,qn)),u(this,bn,d6).call(this),s(this,qn))}}qn=new WeakMap,Wn=new WeakMap,Hs=new WeakMap,ki=new WeakMap,Vs=new WeakMap,ka=new WeakMap,bn=new WeakSet,u6=function(t){switch(t.kind){case"connecting":return U`
|
|
450
|
+
<div class="system-modal" role="status" aria-live="polite">
|
|
451
|
+
<tv-icon name="spinner" size="xl" spinning></tv-icon>
|
|
452
|
+
<h2>Connecting</h2>
|
|
453
|
+
</div>
|
|
454
|
+
`;case"disconnected":return U`
|
|
455
|
+
<div class="system-modal" role="status" aria-live="polite">
|
|
456
|
+
<tv-icon name="spinner" size="xl" spinning></tv-icon>
|
|
457
|
+
<h2>Disconnected</h2>
|
|
458
|
+
<p>${B7(t.nextRetryAt)}</p>
|
|
459
|
+
</div>
|
|
460
|
+
`;case"unauthorized":{const r=!!t.invalid;return r&&h(this,Vs,""),U`
|
|
461
|
+
<form class="system-modal auth-form" @submit=${s(this,Zd)}>
|
|
462
|
+
<tv-icon name="locked" size="xl"></tv-icon>
|
|
463
|
+
<h2>Enter access token</h2>
|
|
464
|
+
<p>This server requires an access token to connect.</p>
|
|
465
|
+
<input
|
|
466
|
+
class="auth-token"
|
|
467
|
+
type="password"
|
|
468
|
+
name="token"
|
|
469
|
+
placeholder="paste token here"
|
|
470
|
+
aria-label="Access token"
|
|
471
|
+
aria-invalid=${r?"true":ne}
|
|
472
|
+
aria-describedby=${r?"auth-token-error":ne}
|
|
473
|
+
.value=${s(this,Vs)}
|
|
474
|
+
@input=${s(this,Fd)}
|
|
475
|
+
autofocus
|
|
476
|
+
required
|
|
477
|
+
/>
|
|
478
|
+
${r?U`<p id="auth-token-error" class="tv-error" role="alert">
|
|
479
|
+
The previous token was rejected. Try again.
|
|
480
|
+
</p>`:null}
|
|
481
|
+
<button type="submit" intent="primary" class="auth-submit">
|
|
482
|
+
Connect
|
|
483
|
+
</button>
|
|
484
|
+
</form>
|
|
485
|
+
`}case"error":return U`
|
|
486
|
+
<div class="system-modal">
|
|
487
|
+
<h2>Can’t connect with server</h2>
|
|
488
|
+
<p class="server-url">${t.serverURL}</p>
|
|
489
|
+
<p>${t.message}</p>
|
|
490
|
+
</div>
|
|
491
|
+
`}},Fd=new WeakMap,Zd=new WeakMap,h6=function(t){const r=t.kind==="disconnected"&&t.nextRetryAt!==null;r&&s(this,ki)===null?h(this,ki,setInterval(()=>this.render(),U7)):r||u(this,bn,vg).call(this)},vg=function(){s(this,ki)!==null&&(clearInterval(s(this,ki)),h(this,ki,null))},d6=function(){s(this,Wn)!==null||s(this,Hs)||(h(this,Hs,!0),queueMicrotask(()=>{if(h(this,Hs,!1),!this.isConnected||!s(this,qn).isConnected||s(this,Wn)!==null)return;const t=s(this,qn).querySelector("dialog");t!==null&&h(this,Wn,Mp(t,()=>{}))}))};const H7=Mt(Z7);function V7(){const n=document.createElement("section");return n.className="system-modal-host",n}function B7(n){if(n===null)return"Reattempting now…";const e=n-Date.now();return e<=0?"Reattempting now…":`Reattempting in ${Math.ceil(e/F7)}s…`}const q7=1400,uh=new WeakMap;function W7(n,e){var o;const t=e.ownerDocument,r=(o=t.defaultView)==null?void 0:o.navigator.clipboard;if(r&&typeof r.writeText=="function"){r.writeText(n).catch(()=>{});return}const i=t.createElement("textarea");i.value=n,i.setAttribute("readonly",""),i.style.position="fixed",i.style.opacity="0",t.body.append(i),i.select();try{t.execCommand("copy")}catch{}i.remove()}const j7={writeClipboard:W7,scheduler:{setTimeout(n,e){return globalThis.setTimeout(n,e)},clearTimeout(n){globalThis.clearTimeout(n)}}};function G7(n,e,t){const r=n.currentTarget;if(!r)return;e.writeClipboard(r.getAttribute("prompt")??"",r),r.toggleAttribute("copied",!0);const i=r.nextElementSibling,o=i!=null&&i.classList.contains("copy-button-status")?i:null;o&&(o.textContent="",o.textContent="Copied");const a=uh.get(r);a&&a.scheduler.clearTimeout(a.handle);const l={handle:void 0,scheduler:e.scheduler};l.handle=e.scheduler.setTimeout(()=>{uh.get(r)===l&&(uh.delete(r),r.toggleAttribute("copied",!1),o&&(o.textContent=""))},q7),uh.set(r,l),t()}function p6({label:n,prompt:e="",intent:t,copied:r=!1,onActivate:i=()=>{}},o=j7){return U`
|
|
492
|
+
<button
|
|
493
|
+
class="copy-button"
|
|
494
|
+
size="sm"
|
|
495
|
+
aria-label=${n}
|
|
496
|
+
intent=${t??ne}
|
|
497
|
+
?copied=${r}
|
|
498
|
+
prompt=${e}
|
|
499
|
+
@click=${a=>G7(a,o,i)}
|
|
500
|
+
>
|
|
501
|
+
<span class="copy-button-idle"><tv-icon name="copy"></tv-icon>${n}</span>
|
|
502
|
+
<span class="copy-button-done"><tv-icon name="check"></tv-icon>Copied</span>
|
|
503
|
+
</button>
|
|
504
|
+
<span
|
|
505
|
+
class="copy-button-status"
|
|
506
|
+
role="status"
|
|
507
|
+
aria-live="polite"
|
|
508
|
+
>${r?"Copied":ne}</span
|
|
509
|
+
>
|
|
510
|
+
`}const f6="1.3.1",Y7="tv-desktop-upgrade-recommendation-dismissed",J7="### Recommended desktop upgrade available\n\nTelevision now supports light/dark mode settings and better theming. To fully use them, upgrade the desktop app with `npm install -g @telepath-computer/television-desktop@latest`, then quit Television and relaunch it with `tv-desktop`.\n\nIf you don't need light/dark mode, you can keep using your current version.";function K7(n){var e;return!n.electron||n.noticesSuppressed||((e=n.updateState)==null?void 0:e.toast)!=null||n.shellVersion===null||!Ap(n.shellVersion)||n.shellVersion===ld?!1:d0(f6,n.shellVersion)}var Ca;class m6 extends HTMLElement{constructor(){super(...arguments);f(this,Ca,new C0(this))}connectedCallback(){s(this,Ca).connect()}disconnectedCallback(){s(this,Ca).disconnect()}attributeChangedCallback(){s(this,Ca).refresh()}}Ca=new WeakMap,C(m6,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-popover")||customElements.define("tv-popover",m6);const X7="tv-update-dismissed",hh={update_available:"Update available",copy_prompt:"Copy upgrade prompt",later:"Later"},Q7="update-popover";function eU(n,e){const t=n.target;if(!(t instanceof Element))return!1;const r=t.closest("button, a[href], input, select, textarea, [tabindex]");return r!==null&&e.contains(r)}var Ta,Rr,$a,tu,nu,Hd;class tU extends Ot{constructor(){super(...arguments);f(this,Ta);f(this,Rr);f(this,$a,!1);f(this,tu,()=>{});f(this,nu,()=>{});f(this,Hd,t=>{var r;(r=s(this,Rr))==null||r.disconnect(),h(this,Rr,void 0),h(this,Ta,t),h(this,$a,(t==null?void 0:t.hasAttribute("open"))??!1),t&&(h(this,Rr,new MutationObserver(()=>{const i=t.hasAttribute("open");i!==s(this,$a)&&(h(this,$a,i),i?s(this,tu).call(this):s(this,nu).call(this))})),s(this,Rr).observe(t,{attributes:!0,attributeFilter:["open"]}))})}disconnected(){var t;(t=s(this,Rr))==null||t.disconnect(),h(this,Rr,void 0),h(this,Ta,void 0)}template({body:t,prompt:r,copied:i=!1,panelRef:o,bellRef:a,onPresent:l=()=>{},onDismiss:c=()=>{},onCopy:d=()=>{}}){h(this,tu,l),h(this,nu,c);const p=()=>{var y;(y=s(this,Ta))==null||y.removeAttribute("open")},g=y=>{const v=y.currentTarget;y.key!=="Escape"||!eU(y,v)||(y.preventDefault(),y.stopPropagation(),v.removeAttribute("open"))};return U`
|
|
511
|
+
<button
|
|
512
|
+
class="update-bell"
|
|
513
|
+
id="update-bell"
|
|
514
|
+
icon
|
|
515
|
+
intent="alert"
|
|
516
|
+
aria-label=${hh.update_available}
|
|
517
|
+
title=${hh.update_available}
|
|
518
|
+
${a===void 0?ne:Je(a)}
|
|
519
|
+
>
|
|
520
|
+
<tv-icon name="notification" size="sm"></tv-icon>
|
|
521
|
+
</button>
|
|
522
|
+
|
|
523
|
+
<tv-popover
|
|
524
|
+
id=${Q7}
|
|
525
|
+
manual
|
|
526
|
+
trigger="update-bell"
|
|
527
|
+
role="status"
|
|
528
|
+
class="update-popover"
|
|
529
|
+
${Je(s(this,Hd))}
|
|
530
|
+
${o===void 0?ne:Je(o)}
|
|
531
|
+
@keydown=${g}
|
|
532
|
+
>
|
|
533
|
+
${t}
|
|
534
|
+
<div class="update-actions">
|
|
535
|
+
<button size="sm" class="update-later" @click=${p}
|
|
536
|
+
>${hh.later}</button
|
|
537
|
+
>
|
|
538
|
+
${r===void 0?ne:p6({label:hh.copy_prompt,prompt:r,intent:"primary",copied:i,onActivate:d})}
|
|
539
|
+
</div>
|
|
540
|
+
</tv-popover>
|
|
541
|
+
`}}Ta=new WeakMap,Rr=new WeakMap,$a=new WeakMap,tu=new WeakMap,nu=new WeakMap,Hd=new WeakMap;const nU=Mt(tU);function rU(n,e){return e===null?!0:d0(n,e)}const yw=new Set;var qt,xt,ru,iu,Ra,Ir,Bs,qs,Ia,Ye,xr,Ws,xa,Pa,js,Ci,q,yg,wg,bg,Sg,_g,su,Gs,Gh,ql,Ag,g6,Eg,kg,Cg,Vd,Bd,qd,Wd,jd,Wl,v6;class iU{constructor(e=()=>{}){f(this,q);f(this,qt,null);f(this,xt,null);f(this,ru,null);f(this,iu,"");f(this,Ra);f(this,Ir,!1);f(this,Bs,!1);f(this,qs,!1);f(this,Ia,null);f(this,Ye,!1);f(this,xr,!1);f(this,Ws,null);f(this,xa,null);f(this,Pa,!1);f(this,js,[]);f(this,Ci);f(this,su,()=>{s(this,Ci).call(this)});f(this,Gs,()=>{u(this,q,Cg).call(this),s(this,Ci).call(this)});f(this,Vd,()=>{var t;const e=u(this,q,ql).call(this,((t=s(this,xt))==null?void 0:t.toastsSuppressed)??!1);e===null||s(this,Ye)||(h(this,Ye,!0),e.kind==="server"&&u(this,q,Eg).call(this,e.toast),s(this,Ci).call(this))});f(this,Bd,()=>{var t,r;if(!s(this,Ye))return;const e=u(this,q,ql).call(this,((t=s(this,xt))==null?void 0:t.toastsSuppressed)??!1);e!==null&&((r=u(this,q,yg).call(this))==null||r.setItem(u(this,q,Ag).call(this,e),e.version)),h(this,Ye,!1),h(this,xr,!0),s(this,Ci).call(this)});f(this,qd,()=>{var t;const e=u(this,q,ql).call(this,((t=s(this,xt))==null?void 0:t.toastsSuppressed)??!1);(e==null?void 0:e.kind)!=="server"||e.prompt===void 0||u(this,q,kg).call(this,"update_prompt_copy_clicked",e.toast)});f(this,Wd,e=>{h(this,Ws,e instanceof HTMLElement?e:null),u(this,q,Wl).call(this)});f(this,jd,e=>{h(this,xa,e instanceof HTMLElement?e:null),u(this,q,Wl).call(this)});h(this,Ci,e)}get presented(){return s(this,Ye)}configure({connectionOwner:e=null,primaryServerURL:t="",presentation:r=null,dismissalStorage:i,desktopRecommendation:o=null}){e!==s(this,qt)&&(u(this,q,bg).call(this),h(this,qt,e),u(this,q,wg).call(this)),r!==s(this,xt)&&(u(this,q,_g).call(this),h(this,xt,r),u(this,q,Sg).call(this)),h(this,iu,t),h(this,Ra,i),h(this,ru,o)}connect(){s(this,Ir)||(h(this,Ir,!0),u(this,q,wg).call(this),u(this,q,Sg).call(this))}disconnect(){s(this,Ir)&&(u(this,q,bg).call(this),u(this,q,_g).call(this),h(this,Ir,!1),h(this,Ws,null),h(this,xa,null))}template(){var l,c;const e=((l=s(this,xt))==null?void 0:l.toastsSuppressed)??!1,t=u(this,q,ql).call(this,e),r=t===null?null:`${t.kind}:${t.version}`;if(t===null?(h(this,Ia,null),h(this,Ye,!1),h(this,xr,!0)):r!==s(this,Ia)&&(h(this,Ia,r),h(this,Ye,rU(t.version,u(this,q,g6).call(this,u(this,q,Ag).call(this,t)))),h(this,xr,!0),s(this,Ye)&&t.kind==="server"&&!e&&u(this,q,Eg).call(this,t.toast)),t===null||e)return h(this,Ye,!1),h(this,xr,!0),u(this,q,Wl).call(this),ne;const i=(c=s(this,Ws))==null?void 0:c.querySelector(".copy-button"),o=s(this,Ye)&&!s(this,xr)&&(i==null?void 0:i.hasAttribute("copied"))===!0,a=nU({body:j_(c6(t.markdown)),prompt:t.kind==="server"?t.prompt:void 0,copied:o,presented:s(this,Ye),panelRef:s(this,Wd),bellRef:s(this,jd),onPresent:s(this,Vd),onDismiss:s(this,Bd),onCopy:s(this,qd)});return h(this,xr,!1),u(this,q,Wl).call(this),a}}qt=new WeakMap,xt=new WeakMap,ru=new WeakMap,iu=new WeakMap,Ra=new WeakMap,Ir=new WeakMap,Bs=new WeakMap,qs=new WeakMap,Ia=new WeakMap,Ye=new WeakMap,xr=new WeakMap,Ws=new WeakMap,xa=new WeakMap,Pa=new WeakMap,js=new WeakMap,Ci=new WeakMap,q=new WeakSet,yg=function(){return s(this,Ra)!==void 0?s(this,Ra):typeof localStorage>"u"?null:localStorage},wg=function(){!s(this,Ir)||s(this,Bs)||s(this,qt)===null||(s(this,qt).addEventListener("server-status",s(this,Gs)),s(this,qt).addEventListener("change",s(this,Gs)),h(this,Bs,!0))},bg=function(){!s(this,Bs)||s(this,qt)===null||(s(this,qt).removeEventListener("server-status",s(this,Gs)),s(this,qt).removeEventListener("change",s(this,Gs)),h(this,Bs,!1))},Sg=function(){!s(this,Ir)||s(this,qs)||s(this,xt)===null||(s(this,xt).addEventListener("change",s(this,su)),h(this,qs,!0))},_g=function(){!s(this,qs)||s(this,xt)===null||(s(this,xt).removeEventListener("change",s(this,su)),h(this,qs,!1))},su=new WeakMap,Gs=new WeakMap,Gh=function(){var t;const e=((t=s(this,qt))==null?void 0:t.connection)??null;return(e==null?void 0:e.url)===s(this,iu)?e:null},ql=function(e){var o;const t=((o=u(this,q,Gh).call(this))==null?void 0:o.updateState)??null,r=(t==null?void 0:t.toast)??null;if(r!==null)return{kind:"server",version:r.version,markdown:r.markdown,...r.prompt===void 0?{}:{prompt:r.prompt},toast:r};const i=s(this,ru);return i!==null&&K7({...i,noticesSuppressed:e,updateState:t})?{kind:"desktop",version:f6,markdown:J7}:null},Ag=function(e){return e.kind==="server"?X7:Y7},g6=function(e){var r;const t=((r=u(this,q,yg).call(this))==null?void 0:r.getItem(e))??null;return t!==null&&Ap(t)?t:null},Eg=function(e){yw.has(e.version)||(yw.add(e.version),u(this,q,kg).call(this,"update_toast_shown",e))},kg=function(e,t){var r;s(this,js).push({event:e,properties:{server_version:((r=u(this,q,Gh).call(this))==null?void 0:r.serverVersion)??"",channel_version:t.version}}),u(this,q,Cg).call(this)},Cg=function(){if(s(this,js).length===0)return;const e=u(this,q,Gh).call(this);if(!e||e.status!=="connected")return;const t=s(this,js);h(this,js,[]);for(const r of t)e.sendTelemetrySignal(r.event,r.properties)},Vd=new WeakMap,Bd=new WeakMap,qd=new WeakMap,Wd=new WeakMap,jd=new WeakMap,Wl=function(){s(this,Pa)||(h(this,Pa,!0),queueMicrotask(()=>{h(this,Pa,!1),u(this,q,v6).call(this)}))},v6=function(){const e=s(this,Ws);e!==null&&(s(this,Ye)&&s(this,xa)===null||e.toggleAttribute("open",s(this,Ye)))};const sU=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,oU=""+new URL("table-oeG9uAN1.png",import.meta.url).href,aU=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,lU=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,ww="Artifact skills",cU="Artifact skills",uU="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",hU="Copy prompt";function dh({artifactSkill:n,name:e,description:t,prompt:r,thumbnail:i},o){return U`
|
|
542
|
+
<article class="skill-card">
|
|
543
|
+
<div class="skill-thumb"><img src=${i} alt="" /></div>
|
|
544
|
+
<div class="skill-name">${e}</div>
|
|
545
|
+
<p class="skill-desc">${t}</p>
|
|
546
|
+
${p6({label:hU,prompt:r,onActivate:()=>o==null?void 0:o.sendTelemetrySignal("artifact_skill_prompt_copy_clicked",{artifact_skill:n})})}
|
|
547
|
+
</article>
|
|
548
|
+
`}class dU extends Ot{template(e=null){return U`
|
|
549
|
+
<button
|
|
550
|
+
class="skill-trigger"
|
|
551
|
+
variant="ghost"
|
|
552
|
+
icon
|
|
553
|
+
id="skills-trigger"
|
|
554
|
+
aria-label=${ww}
|
|
555
|
+
title=${ww}
|
|
556
|
+
>
|
|
557
|
+
<tv-icon name="skills" size="sm"></tv-icon>
|
|
558
|
+
</button>
|
|
559
|
+
|
|
560
|
+
<tv-popover
|
|
561
|
+
id="skills-popover"
|
|
562
|
+
trigger="skills-trigger"
|
|
563
|
+
class="skill-popover"
|
|
564
|
+
>
|
|
565
|
+
<div class="skill-heading">${cU}</div>
|
|
566
|
+
<p class="skill-intro">${uU}</p>
|
|
567
|
+
<div class="skill-grid">
|
|
568
|
+
${dh({artifactSkill:"calendar",name:"Calendar",description:"Visualize your calendar events across day and week views.",prompt:"Use the tv-calendar skill to make a calendar artifact for the following request, and put it on TV: ",thumbnail:sU},e)}
|
|
569
|
+
${dh({artifactSkill:"table",name:"Table",description:"Beautiful tables with headers, grouping, and chips for displaying data.",prompt:"Use the tv-table skill to make a table artifact for the following request, and put it on TV: ",thumbnail:oU},e)}
|
|
570
|
+
${dh({artifactSkill:"tasks",name:"Tasks",description:"Track tasks and plans in a checklist, with due dates, projects, and labels.",prompt:"Use the tv-tasks skill to make a task list artifact for the following request, and put it on TV: ",thumbnail:aU},e)}
|
|
571
|
+
${dh({artifactSkill:"markdown",name:"Markdown",description:"An interactive markdown editor for Obsidian notes and other formatted docs.",prompt:"Make a markdown artifact for the following request, and put it on TV: ",thumbnail:lU},e)}
|
|
572
|
+
</div>
|
|
573
|
+
</tv-popover>
|
|
574
|
+
`}}const pU=Mt(dU),fU=600;let mU=0;const bw=new WeakMap,qf=n=>{if(n.id)return n.id;let e=bw.get(n);if(!e){do e=`tv-select-${++mU}`;while(n.ownerDocument.getElementById(e));bw.set(n,e)}return n.id=e,e},ph=n=>{var e;return((e=n.textContent)==null?void 0:e.trim())??""};var ou;class y6 extends HTMLElement{constructor(){super();f(this,ou,this.attachInternals());s(this,ou).role="option"}connectedCallback(){this.attributeChangedCallback()}attributeChangedCallback(){s(this,ou).ariaSelected=String(this.hasAttribute("selected"))}}ou=new WeakMap,C(y6,"observedAttributes",["selected"]);var it,Pr,La,Ti,$i,au,W,Xr,Oo,Tg,Yh,Qr,Jh,$g,b6,Kh,S6;class w6 extends HTMLElement{constructor(){super();f(this,W);f(this,it,new C0(this,{select:!0,refresh:()=>u(this,W,Jh).call(this),opened:()=>{h(this,$i,""),u(this,W,Qr).call(this,u(this,W,Oo).call(this))},closed:()=>{u(this,W,Qr).call(this,void 0),h(this,$i,"")},keydown:t=>u(this,W,S6).call(this,t),pointermove:t=>{const r=u(this,W,Tg).call(this,t);r&&u(this,W,Qr).call(this,r)},click:t=>{const r=u(this,W,Tg).call(this,t);r&&u(this,W,Kh).call(this,r)},selectedRow:()=>u(this,W,Oo).call(this),unpair:t=>u(this,W,b6).call(this,t)}));f(this,Pr);f(this,La,"");f(this,Ti);f(this,$i,"");f(this,au,0);this.attachInternals().role="listbox"}connectedCallback(){s(this,it).connect()}disconnectedCallback(){s(this,it).disconnect()}attributeChangedCallback(){s(this,it).refresh()}get value(){var t;return((t=u(this,W,Oo).call(this))==null?void 0:t.getAttribute("value"))??""}set value(t){const r=u(this,W,Xr).call(this).find(i=>i.getAttribute("value")===t);r&&(u(this,W,Yh).call(this,r),u(this,W,Jh).call(this))}}it=new WeakMap,Pr=new WeakMap,La=new WeakMap,Ti=new WeakMap,$i=new WeakMap,au=new WeakMap,W=new WeakSet,Xr=function(){return[...this.querySelectorAll("tv-option")].filter(t=>t.closest("tv-select")===this)},Oo=function(){return u(this,W,Xr).call(this).find(t=>t.hasAttribute("selected"))},Tg=function(t){const r=t.closest("tv-option");return(r==null?void 0:r.closest("tv-select"))===this?r:void 0},Yh=function(t){for(const r of u(this,W,Xr).call(this))r.toggleAttribute("selected",r===t)},Qr=function(t){for(const r of u(this,W,Xr).call(this))r.toggleAttribute("highlighted",r===t);if(s(this,it).trigger&&Po(s(this,it).trigger,"aria-activedescendant",t?qf(t):null),t){const r=t.getBoundingClientRect(),i=this.getBoundingClientRect();r.top<i.top+this.clientTop?this.scrollTop-=i.top+this.clientTop-r.top:r.bottom>i.top+this.clientTop+this.clientHeight&&(this.scrollTop+=r.bottom-i.top-this.clientTop-this.clientHeight)}},Jh=function(){var l;const t=u(this,W,Xr).call(this),r=u(this,W,Oo).call(this)??t[0];r&&u(this,W,Yh).call(this,r);const i=s(this,it).trigger;if(!i)return;Po(i,"role","combobox"),Po(i,"aria-haspopup","listbox"),Po(i,"aria-controls",qf(this));for(const c of t)qf(c);const o=t.find(c=>c.hasAttribute("highlighted"));Po(i,"aria-activedescendant",this.hasAttribute("open")&&o?o.id:null);const a=r?ph(r):"";if(!(i.firstChild instanceof Text)||i.firstChild.nodeValue!==`${a} `||i.childNodes.length!==2||((l=i.lastElementChild)==null?void 0:l.getAttribute("name"))!=="select"){const c=this.ownerDocument.createElement("tv-icon");c.setAttribute("name","select"),c.setAttribute("aria-hidden","true"),i.replaceChildren(`${a} `,c)}u(this,W,$g).call(this,i,t)},$g=function(t,r){if(s(this,Ti)||(h(this,Ti,new ResizeObserver(()=>{const c=s(this,it).trigger;c&&u(this,W,$g).call(this,c,u(this,W,Xr).call(this))})),s(this,Ti).observe(t)),!t.getClientRects().length)return;const i=this.ownerDocument.defaultView.getComputedStyle(t),o=JSON.stringify([t.id,r.map(ph),i.font,i.letterSpacing,i.padding,i.borderWidth,i.gap]);if(o===s(this,La))return;h(this,La,o);const a=t.cloneNode(!0);a.removeAttribute("id"),a.style.cssText+=";position:absolute;visibility:hidden;pointer-events:none;width:max-content;min-width:0;max-width:none;",a.style.font=i.font,a.style.letterSpacing=i.letterSpacing,t.after(a);let l=0;for(const c of r)a.firstChild.nodeValue=`${ph(c)} `,l=Math.max(l,a.getBoundingClientRect().width);a.remove(),s(this,Pr)??h(this,Pr,this.ownerDocument.createElement("style")),s(this,Pr).textContent=`:where(button[id="${CSS.escape(t.id)}"]) { width: ${l}px; }`,s(this,Pr).isConnected||this.ownerDocument.head.append(s(this,Pr))},b6=function(t){var r,i;for(const o of["role","aria-haspopup","aria-controls","aria-activedescendant"])t.removeAttribute(o);(r=s(this,Ti))==null||r.disconnect(),h(this,Ti,void 0),(i=s(this,Pr))==null||i.remove(),h(this,Pr,void 0),h(this,La,"")},Kh=function(t){const r=u(this,W,Oo).call(this)!==t;u(this,W,Yh).call(this,t),u(this,W,Jh).call(this),s(this,it).close(),r&&this.dispatchEvent(new Event("change",{bubbles:!0}))},S6=function(t){if(!s(this,it).open)return this.ownerDocument.activeElement!==s(this,it).trigger||!["Enter"," ","ArrowDown","ArrowUp"].includes(t.key)?!1:(t.preventDefault(),t.stopImmediatePropagation(),s(this,it).show(!0),!0);const r=u(this,W,Xr).call(this),i=r.findIndex(a=>a.hasAttribute("highlighted"));if(t.key==="Tab")return t.stopImmediatePropagation(),this.ownerDocument.activeElement!==s(this,it).trigger?(t.preventDefault(),!0):(r[i]&&u(this,W,Kh).call(this,r[i]),!0);if(t.key==="Escape")return!1;const o=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey;if(!["ArrowDown","ArrowUp","Home","End","Enter"," "].includes(t.key)&&!o)return!1;if(t.preventDefault(),t.stopImmediatePropagation(),t.key==="Enter"||t.key===" ")r[i]&&u(this,W,Kh).call(this,r[i]);else if(t.key==="Home")u(this,W,Qr).call(this,r[0]);else if(t.key==="End")u(this,W,Qr).call(this,r.at(-1));else if(t.key==="ArrowDown"||t.key==="ArrowUp")u(this,W,Qr).call(this,r[Math.max(0,Math.min(r.length-1,i+(t.key==="ArrowDown"?1:-1)))]);else{const a=performance.now();h(this,$i,a-s(this,au)>fU?t.key.toLowerCase():s(this,$i)+t.key.toLowerCase()),h(this,au,a);const c=[...r.slice(i+1),...r.slice(0,i+1)].find(d=>ph(d).toLowerCase().startsWith(s(this,$i)));c&&u(this,W,Qr).call(this,c)}return!0},C(w6,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-option")||customElements.define("tv-option",y6);customElements.get("tv-select")||customElements.define("tv-select",w6);/**
|
|
575
|
+
* @license
|
|
576
|
+
* Copyright 2020 Google LLC
|
|
577
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
578
|
+
*/const gU=ll(class extends Lu{constructor(n){if(super(n),n.type!==Xn.PROPERTY&&n.type!==Xn.ATTRIBUTE&&n.type!==Xn.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!GS(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[e]){if(e===at||e===ne)return e;const t=n.element,r=n.name;if(n.type===Xn.PROPERTY){if(e===t[r])return at}else if(n.type===Xn.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(r))return at}else if(n.type===Xn.ATTRIBUTE&&t.getAttribute(r)===e+"")return at;return YS(n),e}}),Sw="Settings",_w="Refresh themes",vU="Themes directory",yU="None";function Aw(n){return n instanceof Error?n.message:String(n)}var bt,Ys,Lr,jn,lu,Dr,Or,Js,Da,Oa,yn,_6,Gd,Yd,Rg,Jd,Kd,Xd,Xh;class wU extends Ot{constructor(){super(...arguments);f(this,yn);f(this,bt,null);f(this,Ys,null);f(this,Lr,!1);f(this,jn,null);f(this,lu,!1);f(this,Dr,0);f(this,Or,null);f(this,Js,!1);f(this,Da,vn());f(this,Oa,vn());f(this,Gd,t=>{var i;if((i=s(this,Or))==null||i.disconnect(),h(this,Or,null),h(this,Js,!1),!t)return;const r=()=>{const o=t.hasAttribute("open");o!==s(this,Js)&&(h(this,Js,o),o&&u(this,yn,Rg).call(this,!1))};h(this,Or,new MutationObserver(r)),s(this,Or).observe(t,{attributes:!0,attributeFilter:["open"]}),r()});f(this,Yd,()=>{u(this,yn,Rg).call(this,!0)});f(this,Jd,t=>{var o;const r=t.currentTarget,i=r.value;r.value=((o=s(this,bt))==null?void 0:o.snapshot.display.appearanceMode)??"system",this.render(),u(this,yn,Xh).call(this,()=>{var a;return(a=s(this,bt))==null?void 0:a.setAppearanceMode(i)},"Unable to change light/dark mode")});f(this,Kd,t=>{var o;const r=t.currentTarget,i=r.value||null;r.value=((o=s(this,bt))==null?void 0:o.snapshot.display.activeThemeName)??"",this.render(),u(this,yn,Xh).call(this,()=>{var a;return(a=s(this,bt))==null?void 0:a.setActiveTheme(i)},"Unable to change theme")});f(this,Xd,t=>{var a;const r=t.currentTarget,i=r.value,o=r.checked;r.checked=((a=s(this,bt))==null?void 0:a.snapshot.display.themeJavaScriptConsentIds.includes(i))??!1,this.render(),u(this,yn,Xh).call(this,()=>{var l;return(l=s(this,bt))==null?void 0:l.setThemeJavaScriptConsent(i,o)},"Unable to change theme JavaScript consent")})}template(t){var g,y;h(this,bt,t);const r=t.snapshot.connection.status==="connected";s(this,lu)&&!r&&u(this,yn,_6).call(this),h(this,lu,r);const{activeThemeName:i,appearanceMode:o,themeJavaScriptConsentIds:a}=t.snapshot.display,l=((g=s(this,Ys))==null?void 0:g.themes)??[],c=((y=s(this,Ys))==null?void 0:y.errors)??[],d=i===null?void 0:l.find(v=>v.id===i&&v.enableMainJS===!0),p=i!==null&&a.includes(i);return queueMicrotask(()=>{var v,A;this.isConnected&&(s(this,Da).value&&(s(this,Da).value.value=((v=s(this,bt))==null?void 0:v.snapshot.display.appearanceMode)??"system"),s(this,Oa).value&&(s(this,Oa).value.value=((A=s(this,bt))==null?void 0:A.snapshot.display.activeThemeName)??""))}),U`
|
|
579
|
+
<button
|
|
580
|
+
class="settings-trigger"
|
|
581
|
+
variant="ghost"
|
|
582
|
+
icon
|
|
583
|
+
id="settings-trigger"
|
|
584
|
+
aria-label=${Sw}
|
|
585
|
+
title=${Sw}
|
|
586
|
+
>
|
|
587
|
+
<tv-icon name="settings" size="sm"></tv-icon>
|
|
588
|
+
</button>
|
|
589
|
+
|
|
590
|
+
<tv-popover
|
|
591
|
+
id="settings-popover"
|
|
592
|
+
trigger="settings-trigger"
|
|
593
|
+
class="settings-popover"
|
|
594
|
+
${Je(s(this,Gd))}
|
|
595
|
+
>
|
|
596
|
+
<div class="settings-heading">Settings</div>
|
|
597
|
+
|
|
598
|
+
<div class="settings-field">
|
|
599
|
+
<label id="settings-appearance-label">Light/dark mode</label>
|
|
600
|
+
<button id="settings-appearance" aria-labelledby="settings-appearance-label"></button>
|
|
601
|
+
<tv-select
|
|
602
|
+
trigger="settings-appearance"
|
|
603
|
+
name="appearance-mode"
|
|
604
|
+
${Je(s(this,Da))}
|
|
605
|
+
@change=${s(this,Jd)}
|
|
606
|
+
>
|
|
607
|
+
<tv-option value="system" ?selected=${o==="system"}>Adapt to system</tv-option>
|
|
608
|
+
<tv-option value="light" ?selected=${o==="light"}>Light</tv-option>
|
|
609
|
+
<tv-option value="dark" ?selected=${o==="dark"}>Dark</tv-option>
|
|
610
|
+
</tv-select>
|
|
611
|
+
</div>
|
|
612
|
+
|
|
613
|
+
<div class="settings-field">
|
|
614
|
+
<label id="settings-theme-label">Theme</label>
|
|
615
|
+
<div class="settings-theme-control">
|
|
616
|
+
<button id="settings-theme" aria-labelledby="settings-theme-label"></button>
|
|
617
|
+
<tv-select
|
|
618
|
+
trigger="settings-theme"
|
|
619
|
+
name="theme"
|
|
620
|
+
${Je(s(this,Oa))}
|
|
621
|
+
@change=${s(this,Kd)}
|
|
622
|
+
>
|
|
623
|
+
<tv-option value="" ?selected=${i===null}>${yU}</tv-option>
|
|
624
|
+
${l.map(v=>U`
|
|
625
|
+
<tv-option
|
|
626
|
+
value=${v.id}
|
|
627
|
+
?selected=${v.id===i}
|
|
628
|
+
>${v.name}</tv-option>
|
|
629
|
+
`)}
|
|
630
|
+
</tv-select>
|
|
631
|
+
<button
|
|
632
|
+
type="button"
|
|
633
|
+
variant="ghost"
|
|
634
|
+
icon
|
|
635
|
+
aria-label=${_w}
|
|
636
|
+
title=${_w}
|
|
637
|
+
?disabled=${s(this,Lr)||!r}
|
|
638
|
+
@click=${s(this,Yd)}
|
|
639
|
+
>
|
|
640
|
+
<tv-icon name="reload" size="sm"></tv-icon>
|
|
641
|
+
</button>
|
|
642
|
+
</div>
|
|
643
|
+
</div>
|
|
644
|
+
|
|
645
|
+
${d?U`
|
|
646
|
+
<section
|
|
647
|
+
class="settings-javascript-consent"
|
|
648
|
+
aria-label="Experimental main-page JavaScript"
|
|
649
|
+
>
|
|
650
|
+
<p class="settings-javascript-disclosure">This theme uses experimental JavaScript. JavaScript can access your Television content, so only enable for themes you trust or have had your agent inspect.</p>
|
|
651
|
+
<label class="settings-javascript-toggle">
|
|
652
|
+
<input
|
|
653
|
+
type="checkbox"
|
|
654
|
+
role="switch"
|
|
655
|
+
name="theme-javascript-consent"
|
|
656
|
+
value=${d.id}
|
|
657
|
+
.checked=${gU(p)}
|
|
658
|
+
@change=${s(this,Xd)}
|
|
659
|
+
>
|
|
660
|
+
<span>Enable experimental javascript for this theme</span>
|
|
661
|
+
</label>
|
|
662
|
+
</section>
|
|
663
|
+
`:null}
|
|
664
|
+
|
|
665
|
+
${s(this,Lr)?U`<p class="settings-status" role="status">Loading themes…</p>`:null}
|
|
666
|
+
${s(this,jn)?U`<p class="settings-failure" role="alert">${s(this,jn)}</p>`:null}
|
|
667
|
+
${c.length>0?U`
|
|
668
|
+
<div class="settings-errors" aria-label="Theme validation errors">
|
|
669
|
+
${c.map(v=>U`
|
|
670
|
+
<p><strong>${v.folder??vU}</strong>: ${v.error}</p>
|
|
671
|
+
`)}
|
|
672
|
+
</div>
|
|
673
|
+
`:null}
|
|
674
|
+
</tv-popover>
|
|
675
|
+
`}disconnected(){var t;(t=s(this,Or))==null||t.disconnect(),h(this,Or,null),h(this,Js,!1),h(this,bt,null),h(this,Dr,s(this,Dr)+1)}}bt=new WeakMap,Ys=new WeakMap,Lr=new WeakMap,jn=new WeakMap,lu=new WeakMap,Dr=new WeakMap,Or=new WeakMap,Js=new WeakMap,Da=new WeakMap,Oa=new WeakMap,yn=new WeakSet,_6=function(){h(this,Ys,null),h(this,jn,null),h(this,Lr,!1),h(this,Dr,s(this,Dr)+1)},Gd=new WeakMap,Yd=new WeakMap,Rg=async function(t){const r=s(this,bt);if(r===null||r.snapshot.connection.status!=="connected"||s(this,Lr))return;const i=++qu(this,Dr)._;h(this,Lr,!0),h(this,jn,null),this.render();try{const o=await(t?r.refreshThemes():r.listThemes());if(i!==s(this,Dr))return;h(this,Ys,o)}catch(o){if(i!==s(this,Dr))return;h(this,jn,`${t?"Unable to refresh themes":"Unable to load themes"}: ${Aw(o)}`)}finally{i===s(this,Dr)&&(h(this,Lr,!1),this.render())}},Jd=new WeakMap,Kd=new WeakMap,Xd=new WeakMap,Xh=async function(t,r){h(this,jn,null),this.render();try{await t()}catch(i){h(this,jn,`${r}: ${Aw(i)}`),this.render()}};const bU=Mt(wU),$l={start:"--item-fade-start",end:"--item-fade-end",left:"--item-fade-left",right:"--item-fade-right"},SU=(n,{items:e,distance:t,edges:r})=>{const i=new Set;let o=0,a=!1;const l=v=>{v.removeAttribute("data-item-edge-fade");for(const A of Object.values($l))v.style.removeProperty(A)},c=()=>{o=0;const v=new Set(n.querySelectorAll(e)),A=[];for(const Z of i)v.has(Z)||(p.unobserve(Z),i.delete(Z),A.push(Z));for(const Z of v)i.has(Z)||(i.add(Z),p.observe(Z));const x=n.getBoundingClientRect().left+n.clientLeft,B=x+n.clientWidth,P=Math.max(0,Math.min(t,n.clientWidth/2)),J=n.scrollLeft>1?P:0,O=n.scrollLeft<n.scrollWidth-n.clientWidth-1?P:0,Y=[...v].map(Z=>({item:Z,bounds:Z.getBoundingClientRect()}));for(const Z of A)l(Z);for(const{item:Z,bounds:j}of Y){const fe=J>0&&j.left<x+J&&j.right>x,de=O>0&&j.right>B-O&&j.left<B;if(!fe&&!de){l(Z);continue}Z.style.setProperty($l.start,`${x-j.left}px`),Z.style.setProperty($l.end,`${B-j.left}px`),Z.style.setProperty($l.left,`${J}px`),Z.style.setProperty($l.right,`${O}px`),Z.setAttribute("data-item-edge-fade","")}},d=()=>{!a&&!o&&(o=requestAnimationFrame(c))},p=new ResizeObserver(d);p.observe(n);const g=new MutationObserver(d);return g.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class"]}),n.addEventListener("scroll",d,{passive:!0}),d(),{refresh:d,dispose:()=>{if(!a){a=!0,cancelAnimationFrame(o),p.disconnect(),g.disconnect(),n.removeEventListener("scroll",d);for(const v of i)l(v);i.clear()}}}},Rl=.5;var St,Ma,Na,Ks,Ri,Gn,Mr,Nr,Ii,xi,pn,Pi,za,Li,Xs,cu,Oe,zr,Ur,Wt,Qd,D,A6,E6,uu,hu,du,ep,pu,Mo,Ig,k6,Qh,xg,Pg,Lg,C6,T6,Ua,fu,$6,rs,ed,R6,I6,x6,No,P6,jl;class _U extends Ot{constructor(){super(...arguments);f(this,D);f(this,St,vn());f(this,Ma);f(this,Na);f(this,Ks,!1);f(this,Ri,0);f(this,Gn,!1);f(this,Mr,!1);f(this,Nr,!1);f(this,Ii,0);f(this,xi,null);f(this,pn,!1);f(this,Pi,null);f(this,za,null);f(this,Li,null);f(this,Xs,null);f(this,cu,!1);f(this,Oe,null);f(this,zr,!1);f(this,Ur,!1);f(this,Wt,!1);f(this,Qd,()=>{u(this,D,jl).call(this)});f(this,uu,t=>{var o;const r=s(this,Oe);if(r===null||r.pointerId!==t.pointerId||!r.dragging&&Math.hypot(t.clientX-r.originX,t.clientY-r.originY)<=l_)return;const i=s(this,St).value;if(i){if(r.currentX=t.clientX,r.currentY=t.clientY,r.dragging)this.render();else{u(this,D,No).call(this);const a=r.tab.getBoundingClientRect();h(this,zr,!0),r.dragging=!0,r.tabLeft=a.left,r.tabTop=a.top,r.tabWidth=a.width,r.tabHeight=a.height,i.setPointerCapture(t.pointerId),this.render(),(o=r.onReorderChange)==null||o.call(r,u(this,D,Lg).call(this,r))}u(this,D,Pg).call(this,r),u(this,D,Ig).call(this,r)}});f(this,hu,t=>{const r=s(this,Oe);r===null||r.pointerId!==t.pointerId||u(this,D,Mo).call(this,!0,!0)});f(this,du,t=>{var r;((r=s(this,Oe))==null?void 0:r.pointerId)===t.pointerId&&u(this,D,Mo).call(this,!1,!0)});f(this,ep,t=>{var r;((r=s(this,Oe))==null?void 0:r.pointerId)===t.pointerId&&u(this,D,Mo).call(this,!1,!0)});f(this,pu,t=>{var r;t.key!=="Escape"||!((r=s(this,Oe))!=null&&r.dragging)||(t.preventDefault(),u(this,D,Mo).call(this,!1,!0))});f(this,Ua,()=>{h(this,pn,!0),u(this,D,rs).call(this,!1)});f(this,fu,()=>{h(this,pn,!0),u(this,D,rs).call(this,!0)})}connected(){var t;h(this,Ma,void 0),h(this,Na,void 0),h(this,pn,!1),u(this,D,$6).call(this),typeof document<"u"&&((t=document.fonts)==null||t.addEventListener("loadingdone",s(this,fu),{once:!0})),document.addEventListener("television-theme-styles-changed",s(this,Ua)),h(this,Xs,new MutationObserver(s(this,Ua))),s(this,Xs).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("pointermove",s(this,uu)),window.addEventListener("pointerup",s(this,hu)),window.addEventListener("pointercancel",s(this,du)),window.addEventListener("keydown",s(this,pu))}template(t,r,i=null,o,a=!1){var x,B;u(this,D,P6).call(this,a);const l=(x=s(this,Oe))!=null&&x.dragging?s(this,Oe):null,c=(l==null?void 0:l.provisionalPages)??(r==null?void 0:r.pages),d=EU(r,c),p=(l==null?void 0:l.artifactId)??i,g=((B=r==null?void 0:r.selectedPage)==null?void 0:B.artifactIds[0])??null,y=`${(r==null?void 0:r.id)??""}:${d.map(({key:P,label:J})=>`${P}:${J}`).join("|")}`,v=g!==s(this,Ma),A=y!==s(this,Na);v&&h(this,Ur,!1);const E=v||l===null&&A;return A&&h(this,pn,!0),h(this,Ma,g),h(this,Na,y),u(this,D,rs).call(this,E,v,v&&!A),U`
|
|
676
|
+
<div
|
|
677
|
+
class="tab-strip"
|
|
678
|
+
role="tablist"
|
|
679
|
+
${Je(s(this,St))}
|
|
680
|
+
?tab-held=${l!==null}
|
|
681
|
+
@scroll=${s(this,Qd)}
|
|
682
|
+
@lostpointercapture=${s(this,ep)}
|
|
683
|
+
>
|
|
684
|
+
${gd(d,({key:P})=>P,(P,J)=>{const O=P.artifactId!==null&&P.artifactId===g,Y=P.artifactId!==null&&P.artifactId===p,Z=Y&&l!==null;return U`
|
|
685
|
+
${Y?U`
|
|
686
|
+
<span
|
|
687
|
+
class="tab-placeholder"
|
|
688
|
+
aria-hidden="true"
|
|
689
|
+
style=${vd(Z?{width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
|
|
690
|
+
></span>
|
|
691
|
+
`:null}
|
|
692
|
+
<div
|
|
693
|
+
class=${Y?"tab dragged":"tab"}
|
|
694
|
+
?dragging=${Z}
|
|
695
|
+
style=${vd(Z?{left:`${l.tabLeft+l.currentX-l.originX}px`,top:`${l.tabTop+l.currentY-l.originY}px`,width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
|
|
696
|
+
@keydown=${j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),j.currentTarget.click())}}
|
|
697
|
+
role="tab"
|
|
698
|
+
aria-selected=${O?"true":"false"}
|
|
699
|
+
tabindex=${O?"0":"-1"}
|
|
700
|
+
data-artifact-id=${P.artifactId??""}
|
|
701
|
+
@pointerdown=${p===null?j=>u(this,D,A6).call(this,j,t,r,P,o):null}
|
|
702
|
+
@click=${j=>u(this,D,E6).call(this,j,t,r,P)}
|
|
703
|
+
@dblclick=${O&&r!==null&&!Z?()=>ag(t,r,P.page,!P.page.geometry.full_screen):null}
|
|
704
|
+
>
|
|
705
|
+
<span class="tab-label">${P.label}</span>
|
|
706
|
+
</div>
|
|
707
|
+
`})}
|
|
708
|
+
</div>
|
|
709
|
+
`}disconnected(){var t,r,i,o;h(this,Ks,!1),typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(s(this,Ri)),h(this,Ri,0),h(this,Gn,!1),h(this,Mr,!1),h(this,Nr,!1),u(this,D,No).call(this),h(this,Ur,!1),h(this,pn,!1),(t=s(this,Pi))==null||t.disconnect(),h(this,Pi,null),h(this,za,null),(r=s(this,Li))==null||r.dispose(),h(this,Li,null),(i=s(this,Xs))==null||i.disconnect(),h(this,Xs,null),document.removeEventListener("television-theme-styles-changed",s(this,Ua)),typeof document<"u"&&((o=document.fonts)==null||o.removeEventListener("loadingdone",s(this,fu))),window.removeEventListener("pointermove",s(this,uu)),window.removeEventListener("pointerup",s(this,hu)),window.removeEventListener("pointercancel",s(this,du)),window.removeEventListener("keydown",s(this,pu)),u(this,D,Mo).call(this,!1,!1),h(this,zr,!1)}}St=new WeakMap,Ma=new WeakMap,Na=new WeakMap,Ks=new WeakMap,Ri=new WeakMap,Gn=new WeakMap,Mr=new WeakMap,Nr=new WeakMap,Ii=new WeakMap,xi=new WeakMap,pn=new WeakMap,Pi=new WeakMap,za=new WeakMap,Li=new WeakMap,Xs=new WeakMap,cu=new WeakMap,Oe=new WeakMap,zr=new WeakMap,Ur=new WeakMap,Wt=new WeakMap,Qd=new WeakMap,D=new WeakSet,A6=function(t,r,i,o,a){s(this,Wt)||s(this,Oe)!==null||i===null||o.artifactId===null||t.button!==0||!t.isPrimary||(h(this,zr,!1),h(this,Oe,{pointerId:t.pointerId,originX:t.clientX,originY:t.clientY,tab:t.currentTarget,application:r,channelId:i.id,artifactId:o.artifactId,originalPages:i.pages,onReorderChange:a,displacementAnimations:new Set,provisionalPages:[...i.pages],slot:i.pages.indexOf(o.page),currentX:t.clientX,currentY:t.clientY,tabLeft:0,tabTop:0,tabWidth:0,tabHeight:0,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,edgeScrollMoved:!1,dragging:!1}))},E6=function(t,r,i,o){var a;if(t.detail!==0&&s(this,zr)){h(this,zr,!1);return}h(this,zr,!1),!((a=s(this,Oe))!=null&&a.dragging||i===null||o.artifactId===null)&&r.selectPage(i.id,o.artifactId)},uu=new WeakMap,hu=new WeakMap,du=new WeakMap,ep=new WeakMap,pu=new WeakMap,Mo=function(t,r){var a;const i=s(this,Oe);if(i===null)return;if(u(this,D,Qh).call(this,i),i.edgeScrollMoved&&h(this,Ur,!0),i.dragging&&(h(this,Gn,s(this,Mr)),s(this,Mr)||h(this,Nr,!1)),i.dragging&&t&&!kU(i.originalPages,i.provisionalPages)){const l=i.provisionalPages.map(c=>({artifactIds:[...c.artifactIds],geometry:{...c.geometry},size:{...c.size}}));i.application.updateChannelPages(i.channelId,l).catch(()=>{})}if(!t)for(const l of i.displacementAnimations)l.cancel();h(this,Oe,null),(a=i.onReorderChange)==null||a.call(i,null);const o=s(this,St).value;i.dragging&&(o!=null&&o.hasPointerCapture(i.pointerId))&&o.releasePointerCapture(i.pointerId),r&&this.render()},Ig=function(t){const r=s(this,St).value,i=r?u(this,D,xg).call(this,r,t.currentX):0,o=r?Math.max(0,r.scrollWidth-r.clientWidth):0,a=i<0?((r==null?void 0:r.scrollLeft)??0)<=Rl:((r==null?void 0:r.scrollLeft)??0)>=o-Rl;if(s(this,Wt)||!t.dragging||i===0||o===0||a||typeof requestAnimationFrame!="function"){u(this,D,Qh).call(this,t);return}t.edgeScrollFrame===0&&(t.edgeScrollFrame=requestAnimationFrame(l=>{u(this,D,k6).call(this,t,l)}))},k6=function(t,r){if(t.edgeScrollFrame=0,s(this,Wt)||s(this,Oe)!==t||!t.dragging){t.edgeScrollTimestamp=null;return}const i=s(this,St).value;if(!i){t.edgeScrollTimestamp=null;return}const o=u(this,D,xg).call(this,i,t.currentX),a=t.edgeScrollTimestamp;if(t.edgeScrollTimestamp=r,o!==0&&a!==null){const l=Math.max(0,r-a)/1e3,c=Math.max(0,i.scrollWidth-i.clientWidth),d=i.scrollLeft,p=o*l+t.edgeScrollRemainder,g=Math.max(0,Math.min(c,d+p));i.scrollLeft=g;const y=i.scrollLeft-d;y!==0&&(t.edgeScrollMoved=!0),t.edgeScrollRemainder=g===0||g===c?0:p-y,y!==0&&(u(this,D,jl).call(this,i),u(this,D,Pg).call(this,t))}u(this,D,Ig).call(this,t)},Qh=function(t){t.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(t.edgeScrollFrame),t.edgeScrollFrame=0,t.edgeScrollTimestamp=null,t.edgeScrollRemainder=0},xg=function(t,r){const i=t.getBoundingClientRect();return r>=i.left&&r<i.left+Kt?-yd*(i.left+Kt-r)/Kt:r>i.right-Kt&&r<=i.right?yd*(r-(i.right-Kt))/Kt:0},Pg=function(t){var A;const r=s(this,St).value,i=r==null?void 0:r.querySelector(".tab-placeholder");if(!r||!i)return;const o=i.nextElementSibling,a=t.tab.getBoundingClientRect(),l=a.left+a.width/2;let c=t.slot,d=i.previousElementSibling;for(;d!=null&&d.classList.contains("tab");){const E=d.getBoundingClientRect();if(l>=E.left+E.width/2)break;c-=1,d=d.previousElementSibling}let p=o==null?void 0:o.nextElementSibling;for(;p!=null&&p.classList.contains("tab");){const E=p.getBoundingClientRect();if(l<=E.left+E.width/2)break;c+=1,p=p.nextElementSibling}if(c===t.slot)return;const g=u(this,D,C6).call(this,r),y=[...t.provisionalPages],[v]=y.splice(t.slot,1);v&&(y.splice(c,0,v),t.provisionalPages=y,t.slot=c,this.render(),(A=t.onReorderChange)==null||A.call(t,u(this,D,Lg).call(this,t)),queueMicrotask(()=>u(this,D,T6).call(this,t,g)))},Lg=function(t){return{channelId:t.channelId,pages:t.provisionalPages,carriedArtifactId:t.artifactId}},C6=function(t){return new Map([...t.querySelectorAll(".tab:not([dragging])")].map(r=>[r.dataset.artifactId??"",r.getBoundingClientRect().left]))},T6=function(t,r){if(s(this,Wt))return;const i=s(this,St).value;if(i)for(const o of i.querySelectorAll(".tab:not([dragging])")){const a=r.get(o.dataset.artifactId??"");if(a===void 0)continue;const l=a-o.getBoundingClientRect().left;if(Math.abs(l)<=Rl)continue;const c=o.animate({translate:[`${l}px 0`,"0px 0"]},{duration:Zo,easing:"ease"});t.displacementAnimations.add(c),c.finished.finally(()=>{t.displacementAnimations.delete(c)}).catch(()=>{})}},Ua=new WeakMap,fu=new WeakMap,$6=function(){s(this,cu)||typeof document>"u"||!document.fonts||(h(this,cu,!0),document.fonts.ready.then(()=>{this.isConnected&&(h(this,pn,!0),u(this,D,rs).call(this,!0))}))},rs=function(t,r=!1,i=!1){s(this,Gn)||h(this,Gn,t),t&&r&&(h(this,Mr,!0),h(this,Nr,i&&!s(this,Wt))),!(s(this,Ks)||s(this,Ri)!==0)&&(h(this,Ks,!0),queueMicrotask(()=>{if(h(this,Ks,!1),!!this.isConnected){if(typeof requestAnimationFrame!="function"){u(this,D,ed).call(this);return}h(this,Ri,requestAnimationFrame(()=>{h(this,Ri,0),u(this,D,ed).call(this)}))}}))},ed=function(){var l,c;const t=s(this,St).value;if(!t)return;s(this,pn)&&(h(this,pn,!1),u(this,D,R6).call(this,t)),u(this,D,I6).call(this,t);const r=((l=s(this,Oe))==null?void 0:l.dragging)===!0,i=s(this,Mr),o=i&&s(this,Nr),a=!r&&(i||s(this,Gn)&&!s(this,Ur));r?h(this,Gn,i):(h(this,Gn,!1),h(this,Mr,!1),h(this,Nr,!1),i&&h(this,Ur,!1)),a&&u(this,D,x6).call(this,t,o),u(this,D,jl).call(this,t),(c=s(this,Li))==null||c.refresh()},R6=function(t){var r;for(const i of t.querySelectorAll(".tab")){const o=i.querySelector(".tab-label");if(!o)continue;const a=document.createRange();a.selectNodeContents(o);const l=(r=a.getBoundingClientRect)==null?void 0:r.call(a);if(!l||l.width<=0)continue;const c=getComputedStyle(i),d=fh(c.paddingLeft)+fh(c.paddingRight)+fh(c.borderLeftWidth)+fh(c.borderRightWidth),g=Math.ceil(l.width)+d>Wz+jz?"capped":"hugging";i.dataset.compression!==g&&(i.dataset.compression=g)}},I6=function(t){var r,i;typeof ResizeObserver>"u"||s(this,za)===t||((r=s(this,Pi))==null||r.disconnect(),s(this,Pi)??h(this,Pi,new ResizeObserver(()=>{s(this,Wt)?(h(this,Gn,!0),u(this,D,ed).call(this)):u(this,D,rs).call(this,!0)})),s(this,Pi).observe(t),h(this,za,t),(i=s(this,Li))==null||i.dispose(),h(this,Li,SU(t,{items:".tab:not(.dragged)",distance:Gz,edges:"both"})))},x6=function(t,r){const i=t.querySelector('.tab[aria-selected="true"]');if(!i){u(this,D,No).call(this);return}const o=t.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Math.max(0,Math.min(t.scrollLeft+a.left+a.width/2-(o.left+o.width/2),t.scrollWidth-t.clientWidth));if(u(this,D,No).call(this),s(this,Wt)||!r||Math.abs(t.scrollLeft-l)<=Rl||matchMedia("(prefers-reduced-motion: reduce)").matches){t.scrollLeft=l;return}const c=t.scrollLeft,d=t.animate([{},{}],{duration:R_,easing:"ease"});h(this,xi,d);const p=()=>{var y;if(d!==s(this,xi))return;const g=d.playState==="finished"?1:((y=d.effect)==null?void 0:y.getComputedTiming().progress)??0;t.scrollLeft=c+(l-c)*g,d.playState==="finished"?(t.scrollLeft=l,h(this,xi,null),h(this,Ii,0),u(this,D,jl).call(this,t)):h(this,Ii,requestAnimationFrame(p))};h(this,Ii,requestAnimationFrame(p))},No=function(){var t;typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(s(this,Ii)),h(this,Ii,0),(t=s(this,xi))==null||t.cancel(),h(this,xi,null)},P6=function(t){var i;if(s(this,Wt)===t||(h(this,Wt,t),!t))return;u(this,D,No).call(this),h(this,Nr,!1),h(this,Ur,!1);const r=s(this,Oe);if(r!==null){u(this,D,Qh).call(this,r);for(const o of r.displacementAnimations)o.cancel();r.displacementAnimations.clear(),h(this,Oe,null),r.dragging&&((i=s(this,St).value)!=null&&i.hasPointerCapture(r.pointerId))&&s(this,St).value.releasePointerCapture(r.pointerId),queueMicrotask(()=>{var o;return(o=r.onReorderChange)==null?void 0:o.call(r,null)})}u(this,D,rs).call(this,!0,!0,!1)},jl=function(t=s(this,St).value){if(!t)return;const r=Math.max(0,t.scrollWidth-t.clientWidth);t.toggleAttribute("data-overflow",r>Rl)};const AU=Mt(_U);function EU(n,e){if(!n||!e)return[];const t=new Map(n.artifacts.map(r=>[r.id,r]));return e.map((r,i)=>{var a;const o=r.artifactIds[0]??null;return{page:r,artifactId:o,label:o===null?"":((a=t.get(o))==null?void 0:a.title)??"",key:o??`empty-page-${i}`}})}function kU(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}function fh(n){const e=Number.parseFloat(n);return Number.isFinite(e)?e:0}let CU=0;var Qs,_t,mu,st,Fr,Yn,Fa,Zr,gu,jt,tp,np,vu,Ya,L6,rp,ip,D6,sp,op;class TU extends Ot{constructor(){super(...arguments);f(this,Ya);f(this,Qs,new iU(()=>this.render()));f(this,_t,new c_(()=>this.render()));f(this,mu,`channel-switcher-trigger-${++CU}`);f(this,st,null);f(this,Fr,null);f(this,Yn,!1);f(this,Fa,null);f(this,Zr,null);f(this,gu,vn());f(this,jt,null);f(this,tp,t=>{var r,i,o;(r=s(this,st))==null||r.removeAttribute("open"),((i=s(this,Zr))==null?void 0:i.display.focusedChannelId)!==t&&((o=s(this,Fa))==null||o.focusChannel(t).catch(()=>{}))});f(this,np,t=>{s(this,Yn)||(h(this,Yn,!0),this.render(),t.detail===0&&requestAnimationFrame(()=>{var r;(r=s(this,st))!=null&&r.hasAttribute("open")&&u(this,Ya,L6).call(this,0)}))});f(this,vu,t=>{const r=s(this,st);r===null||!r.hasAttribute("open")||s(this,_t).dragging||r.querySelector("input, tv-menu[open]")||t_(t,[...r.querySelectorAll('.channel[role="option"]')])});f(this,rp,t=>{var r,i;h(this,jt,{channelId:t,scrollTop:((i=(r=s(this,st))==null?void 0:r.querySelector(".channel-switcher-pop-body"))==null?void 0:i.scrollTop)??0,result:null})});f(this,ip,(t,r)=>{var i;((i=s(this,jt))==null?void 0:i.channelId)===t&&(s(this,jt).result=r?"deleted":"cancelled",this.render())});f(this,sp,t=>{var r;(r=s(this,Fr))==null||r.disconnect(),h(this,Fr,null),s(this,st)!==null&&s(this,jt)===null&&s(this,_t).disconnect(),h(this,st,t instanceof HTMLElement?t:null),s(this,st)!==null&&(s(this,_t).connect(),h(this,Fr,new MutationObserver(s(this,op))),s(this,Fr).observe(s(this,st),{attributes:!0,attributeFilter:["open"]}))});f(this,op,()=>{var t;(((t=s(this,st))==null?void 0:t.hasAttribute("open"))??!0)||s(this,jt)===null&&(h(this,Yn,!1),this.render())})}connected(){s(this,Qs).connect(),document.addEventListener("keydown",s(this,vu))}template(t,r,i={}){var l;h(this,Fa,t),h(this,Zr,r);const o=i.collapsed||i.sidebarTransitioning;(i.sidebarTransitioning||!o||r.focusedChannel===null)&&h(this,Yn,!1),s(this,_t).update(t,r,{management:!0,dragging:!0,revealMovedRow:!0,onDeleteStart:s(this,rp),onDeleteEnd:s(this,ip),selectChannel:s(this,tp),highlightOnPointerMove:!0,motionSuppressed:i.sidebarTransitioning});const a=s(this,jt);return a!=null&&a.result&&(r.channels.length===0||r.focusedChannel!==null)&&(a.result==="cancelled"||!r.channels.some(({id:c})=>c===a.channelId))&&queueMicrotask(()=>u(this,Ya,D6).call(this,a)),s(this,Qs).configure({connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,presentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,dismissalStorage:i.dismissalStorage}),i.onRenderComplete&&queueMicrotask(i.onRenderComplete),U`
|
|
710
|
+
<header class="top-bar" ${Je(s(this,gu))}>
|
|
711
|
+
${o?U`
|
|
712
|
+
<div class="top-bar-lead">
|
|
713
|
+
${i.sidebarToggle===void 0?U`
|
|
714
|
+
<button
|
|
715
|
+
class="sidebar-expand"
|
|
716
|
+
variant="ghost"
|
|
717
|
+
icon
|
|
718
|
+
aria-label="Show sidebar"
|
|
719
|
+
title="Show sidebar"
|
|
720
|
+
type="button"
|
|
721
|
+
@click=${i.onExpandSidebar}
|
|
722
|
+
>
|
|
723
|
+
<tv-icon name="sidebar" size="sm"></tv-icon>
|
|
724
|
+
</button>
|
|
725
|
+
`:i.sidebarToggle??U`
|
|
726
|
+
<span class="sidebar-toggle-seat" aria-hidden="true"></span>
|
|
727
|
+
`}
|
|
728
|
+
${r.focusedChannel===null?null:U`
|
|
729
|
+
<button
|
|
730
|
+
class="channel-switcher"
|
|
731
|
+
variant="ghost"
|
|
732
|
+
target
|
|
733
|
+
aria-haspopup="listbox"
|
|
734
|
+
id=${s(this,mu)}
|
|
735
|
+
type="button"
|
|
736
|
+
@click=${s(this,np)}
|
|
737
|
+
>
|
|
738
|
+
<span class="channel-switcher-name">
|
|
739
|
+
${r.focusedChannel.name}
|
|
740
|
+
</span>
|
|
741
|
+
<tv-icon name="select" size="sm"></tv-icon>
|
|
742
|
+
</button>
|
|
743
|
+
${s(this,Yn)?U`
|
|
744
|
+
<tv-popover
|
|
745
|
+
class="channel-switcher-pop"
|
|
746
|
+
?dragging=${s(this,_t).dragging}
|
|
747
|
+
trigger=${s(this,mu)}
|
|
748
|
+
${Je(s(this,sp))}
|
|
749
|
+
>
|
|
750
|
+
<div class="channel-switcher-pop-body">
|
|
751
|
+
${s(this,_t).template()}
|
|
752
|
+
</div>
|
|
753
|
+
<footer class="channel-switcher-pop-footer">
|
|
754
|
+
<button
|
|
755
|
+
class="channel-create"
|
|
756
|
+
variant="ghost"
|
|
757
|
+
icon
|
|
758
|
+
aria-label="New channel"
|
|
759
|
+
title="New channel"
|
|
760
|
+
type="button"
|
|
761
|
+
?disabled=${s(this,_t).creating}
|
|
762
|
+
@click=${s(this,_t).create}
|
|
763
|
+
>
|
|
764
|
+
<tv-icon name="add"></tv-icon>
|
|
765
|
+
</button>
|
|
766
|
+
</footer>
|
|
767
|
+
</tv-popover>
|
|
768
|
+
`:null}
|
|
769
|
+
`}
|
|
770
|
+
</div>
|
|
771
|
+
`:null}
|
|
772
|
+
${AU(t,r.focusedChannel,null,i.onTabReorderChange,i.sidebarTransitioning)}
|
|
773
|
+
<div class="top-bar-controls">
|
|
774
|
+
${pU((l=i.connectionOwner)==null?void 0:l.connection)}
|
|
775
|
+
${bU(t)}
|
|
776
|
+
${s(this,Qs).template()}
|
|
777
|
+
</div>
|
|
778
|
+
</header>
|
|
779
|
+
${s(this,_t).overlayTemplate()}
|
|
780
|
+
`}disconnected(){var t;s(this,Qs).disconnect(),document.removeEventListener("keydown",s(this,vu)),s(this,_t).disconnect(),(t=s(this,Fr))==null||t.disconnect(),h(this,Fr,null),h(this,st,null),h(this,Yn,!1),h(this,Fa,null),h(this,Zr,null),h(this,jt,null)}}Qs=new WeakMap,_t=new WeakMap,mu=new WeakMap,st=new WeakMap,Fr=new WeakMap,Yn=new WeakMap,Fa=new WeakMap,Zr=new WeakMap,gu=new WeakMap,jt=new WeakMap,tp=new WeakMap,np=new WeakMap,vu=new WeakMap,Ya=new WeakSet,L6=function(t){var r;cc((r=s(this,st))==null?void 0:r.querySelectorAll('.channel[role="option"]')[t])},rp=new WeakMap,ip=new WeakMap,D6=function(t){var d,p;if(s(this,jt)!==t||s(this,Zr)===null)return;h(this,jt,null);const r=s(this,Zr).focusedChannel;h(this,Yn,r!==null),this.render();const i=s(this,st);if(i===null){s(this,_t).disconnect(),(p=(d=s(this,gu).value)==null?void 0:d.querySelector(".sidebar-expand"))==null||p.focus();return}i.setAttribute("open","");const o=i.querySelector(".channel-switcher-pop-body");o&&(o.scrollTop=t.scrollTop);const a=t.result==="cancelled"&&s(this,Zr).channels.some(({id:g})=>g===t.channelId)?t.channelId:r==null?void 0:r.id,l=[...i.querySelectorAll(".channel-row")].find(g=>g.dataset.channelId===a),c=l==null?void 0:l.querySelector(".channel");c==null||c.focus({preventScroll:!0}),t.result==="deleted"&&(c==null||c.scrollIntoView({block:"nearest"}))},sp=new WeakMap,op=new WeakMap;const $U=Mt(TU);var Jn,yu,eo,Za,ot,Pt,Gt,Yt,to,me,fn,Di,Ha,Oi,wu,ap,no,lp,cp,up,H,td,Dg,O6,bu,hp,ei,is,Gl,nd,Og,M6,N6,dp,pp,fp,Su,mp,ss,Yl,z6;class RU extends Ot{constructor(){super(...arguments);f(this,H);f(this,Jn,null);f(this,yu);f(this,eo,null);f(this,Za,null);f(this,ot,ih);f(this,Pt,!1);f(this,Gt,null);f(this,Yt,null);f(this,to,null);f(this,me,!1);f(this,fn,!1);f(this,Di,ih);f(this,Ha,0);f(this,Oi,null);f(this,wu,t=>{var r;if(t.key==="Escape"&&s(this,Gt)!==null){t.preventDefault(),t.stopPropagation(),u(this,H,ss).call(this);return}v8(t,navigator.platform)&&(t.preventDefault(),t.stopPropagation(),(r=s(this,Jn))==null||r.handleNavigationKey(t.key))});f(this,ap,t=>{h(this,yu,t??void 0),this.render()});f(this,no,()=>{this.render()});f(this,lp,()=>u(this,H,td).call(this,!0));f(this,cp,()=>u(this,H,td).call(this,!1));f(this,up,()=>{const t=s(this,me)?!s(this,fn):!s(this,Pt);u(this,H,td).call(this,t)});f(this,bu,t=>{const r=s(this,Oi),i=u(this,H,is).call(this).closest("#app");if(!r||!i)return;h(this,Di,t);const o=Kz(1-t/r.expandedSidebarWidth,r),a=(c,d)=>{i.style.setProperty(`--motion-${c}`,`${d}px`)};a("boundary",o.sidebarBoundary),a("toggle-left",o.toggleLeft),a("toggle-top",r.toggleTop),a("toggle-width",r.toggleWidth),a("toggle-height",r.toggleHeight),a("toggle-wipe",o.toggleWipe),a("lead-reservation",o.leadReservation),a("switcher-left",r.collapsedToggleLeft+r.toggleWidth+r.toggleSwitcherGap-o.sidebarBoundary-r.barInset),i.style.setProperty("--motion-titlebar-opacity",String(o.titlebarOpacity)),i.style.setProperty("--motion-switcher-opacity",String(o.switcherOpacity));const l=u(this,H,is).call(this);l.style.removeProperty("left"),l.style.removeProperty("top")});f(this,hp,t=>{var o;if(!s(this,me))return;const r=t===0;if(r!==s(this,fn))return;const i=document.activeElement===s(this,Yt);u(this,H,ei).call(this,r),this.render(),i&&((o=s(this,Yt))==null||o.focus({preventScroll:!0}))});f(this,dp,t=>{if(t.button!==0||s(this,Gt)!==null)return;const r=t.currentTarget,i=r.closest("#app");i!==null&&(r.setPointerCapture(t.pointerId),h(this,Gt,{pointerId:t.pointerId,startX:t.clientX,startWidth:s(this,ot),root:i}),t.preventDefault())});f(this,pp,t=>{const r=s(this,Gt);r===null||t.pointerId!==r.pointerId||u(this,H,Yl).call(this,r.root,r.startWidth+t.clientX-r.startX)});f(this,fp,t=>{var o;const r=s(this,Gt);if(r===null||t.pointerId!==r.pointerId)return;h(this,Gt,null);const i=((o=s(this,eo))==null?void 0:o.commit(s(this,ot)))??s(this,ot);u(this,H,Yl).call(this,r.root,i)});f(this,Su,t=>{const r=s(this,Gt);r===null||t.pointerId!==r.pointerId||u(this,H,ss).call(this)});f(this,mp,t=>{var i;const r=t.currentTarget.closest("#app");r!==null&&((i=s(this,eo))==null||i.clear(),u(this,H,Yl).call(this,r,ih))})}update(t,r){const i=r[0],o=r[1].sidebarWidthPreference,a=r[1].sidebarCollapsedPreference;s(this,Jn)!==i&&(s(this,Jn)!==null&&this.isConnected&&(s(this,Jn).removeEventListener("change",s(this,no)),i.addEventListener("change",s(this,no))),h(this,Jn,i));const l=s(this,eo)!==o,c=s(this,Za)!==a;return l&&(u(this,H,ss).call(this),h(this,eo,o),h(this,ot,o.read()??ih)),c&&(u(this,H,ss).call(this),h(this,Za,a),h(this,Pt,a.read())),(l||c)&&u(this,H,ei).call(this,s(this,Pt)),super.update(t,r)}connected(){var t;(t=s(this,Jn))==null||t.addEventListener("change",s(this,no)),document.addEventListener("keydown",s(this,wu),{capture:!0})}disconnected(){var t,r;u(this,H,ss).call(this),s(this,me)?u(this,H,ei).call(this,s(this,fn)):(t=s(this,to))==null||t.cancel(),(r=s(this,Jn))==null||r.removeEventListener("change",s(this,no)),document.removeEventListener("keydown",s(this,wu),{capture:!0})}template(t,r){const i=qM(t.snapshot,r.runtimeServerURL),o=t.snapshot;return r.onRenderComplete&&queueMicrotask(()=>{var a;this.isConnected&&((a=r.onRenderComplete)==null||a.call(r,i.kind))}),U`
|
|
781
|
+
<div
|
|
782
|
+
id="app"
|
|
783
|
+
tabindex="-1"
|
|
784
|
+
data-app-state=${i.kind}
|
|
785
|
+
?data-sidebar-transition=${s(this,me)}
|
|
786
|
+
?data-sidebar-motion=${s(this,me)}
|
|
787
|
+
style=${u(this,H,N6).call(this)}
|
|
788
|
+
>
|
|
789
|
+
${xU(i)?u(this,H,z6).call(this,t,o,r):null}
|
|
790
|
+
${PU(i)?H7(i,t):null}
|
|
791
|
+
</div>
|
|
792
|
+
<div id="foreground-overlay" inert aria-hidden="true"></div>
|
|
793
|
+
`}}Jn=new WeakMap,yu=new WeakMap,eo=new WeakMap,Za=new WeakMap,ot=new WeakMap,Pt=new WeakMap,Gt=new WeakMap,Yt=new WeakMap,to=new WeakMap,me=new WeakMap,fn=new WeakMap,Di=new WeakMap,Ha=new WeakMap,Oi=new WeakMap,wu=new WeakMap,ap=new WeakMap,no=new WeakMap,lp=new WeakMap,cp=new WeakMap,up=new WeakMap,H=new WeakSet,td=function(t){var c,d;if(!s(this,me)&&s(this,Pt)===t||s(this,me)&&s(this,fn)===t)return;u(this,H,ss).call(this);const r=document.activeElement===s(this,Yt);if((c=s(this,Za))==null||c.setCollapsed(t),matchMedia("(prefers-reduced-motion: reduce)").matches){u(this,H,ei).call(this,t),this.render(),r&&((d=s(this,Yt))==null||d.focus({preventScroll:!0}));return}if(h(this,fn,t),s(this,me)){u(this,H,Gl).call(this),u(this,H,Dg).call(this);return}const i=u(this,H,is).call(this),o=i.closest("#app"),a=i.getBoundingClientRect(),l=o==null?void 0:o.getBoundingClientRect();if(!o||!l||a.width===0){u(this,H,ei).call(this,t),this.render();return}for(const p of o.getAnimations({subtree:!0}))p.cancel();h(this,me,!0),h(this,Ha,a.top-l.top),h(this,Oi,null),i.style.left=`${a.left-l.left}px`,i.style.top=`${s(this,Ha)}px`,u(this,H,Gl).call(this),this.render(),queueMicrotask(()=>{s(this,me)&&(u(this,H,O6).call(this),r&&i.focus({preventScroll:!0}),u(this,H,Dg).call(this))})},Dg=function(){const t=u(this,H,is).call(this).closest("#app"),r=s(this,to);if(!t||!r||!s(this,Oi))return;const i=s(this,fn)?0:s(this,ot);r.move({root:t,width:s(this,ot),target:i,onFrame:s(this,bu),onFinish:s(this,hp)})},O6=function(){const r=u(this,H,is).call(this).closest("#app"),i=r==null?void 0:r.querySelector(".sidebar-titlebar > .sidebar-toggle-seat"),o=r==null?void 0:r.querySelector(".top-bar > .top-bar-lead"),a=o==null?void 0:o.querySelector(":scope > .sidebar-toggle-seat"),l=o==null?void 0:o.querySelector(":scope > .channel-switcher"),c=o==null?void 0:o.closest(".top-bar");if(!r||!i||!o||!a||!c){u(this,H,ei).call(this,s(this,fn)),this.render();return}const d=i.closest(".app-sidebar");r.removeAttribute("data-sidebar-motion");const p=r.getBoundingClientRect(),g=o.style.display;o.style.display="none";const y=i.getBoundingClientRect();d.style.marginLeft=`${-s(this,ot)}px`,o.style.display=g;const v=a.getBoundingClientRect(),A=l==null?void 0:l.getBoundingClientRect();h(this,Oi,{expandedSidebarWidth:s(this,ot),expandedToggleLeft:y.left-p.left,collapsedToggleLeft:v.left-p.left,toggleTop:s(this,Ha),toggleWidth:v.width,toggleHeight:v.height,toggleSwitcherGap:A?A.left-v.right:0,collapsedLeadReservation:o.getBoundingClientRect().width,hasSwitcher:!!l,barInset:c.getBoundingClientRect().left-p.left}),d.style.removeProperty("margin-left"),r.setAttribute("data-sidebar-motion",""),s(this,bu).call(this,s(this,Di))},bu=new WeakMap,hp=new WeakMap,ei=function(t){var r;(r=s(this,to))==null||r.cancel(),h(this,Pt,t),h(this,me,!1),h(this,Di,t?0:s(this,ot)),h(this,to,new Qz(s(this,Di))),h(this,Oi,null),u(this,H,M6).call(this),u(this,H,Gl).call(this)},is=function(){if(s(this,Yt)!==null)return s(this,Yt);const t=document.createElement("button");return t.type="button",t.setAttribute("variant","ghost"),t.setAttribute("icon",""),t.append(u(this,H,nd).call(this)),t.addEventListener("pointerdown",r=>{r.button===0&&t.setPointerCapture(r.pointerId)}),t.addEventListener("click",s(this,up)),h(this,Yt,t),u(this,H,Gl).call(this),t},Gl=function(){var o;const t=s(this,Yt);if(t===null)return;const r=s(this,me)?s(this,fn):s(this,Pt);t.className=s(this,me)?"sidebar-motion-toggle sidebar-toggle":r?"sidebar-expand":"sidebar-collapse",s(this,me)?t.querySelectorAll(":scope > .sidebar-toggle-paint").length!==2&&t.replaceChildren(u(this,H,Og).call(this,"expanded-paint"),u(this,H,Og).call(this,"collapsed-paint")):(t.children.length!==1||!((o=t.firstElementChild)!=null&&o.matches("tv-icon[name='sidebar']")))&&t.replaceChildren(u(this,H,nd).call(this));const i=r?"Show sidebar":"Collapse sidebar";t.setAttribute("aria-label",i),t.title=i},nd=function(){const t=document.createElement("tv-icon");return t.setAttribute("name","sidebar"),t.setAttribute("size","sm"),t},Og=function(t){const r=document.createElement("span");return r.className=`sidebar-toggle-paint ${t}`,r.setAttribute("aria-hidden","true"),r.append(u(this,H,nd).call(this)),r},M6=function(){const t=s(this,Yt);t!==null&&(t.style.removeProperty("left"),t.style.removeProperty("top"))},N6=function(){const t=[`--sidebar-width: ${s(this,ot)}px`];return s(this,me)&&t.push(`--motion-boundary: ${s(this,Di)}px`),t.join("; ")},dp=new WeakMap,pp=new WeakMap,fp=new WeakMap,Su=new WeakMap,mp=new WeakMap,ss=function(){const t=s(this,Gt);if(t===null)return;h(this,Gt,null),u(this,H,Yl).call(this,t.root,t.startWidth);const r=t.root.querySelector(".app-sidebar-resize");r!=null&&r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId)},Yl=function(t,r){h(this,ot,RS(r)),u(this,H,ei).call(this,s(this,Pt)),t.style.setProperty("--sidebar-width",`${s(this,ot)}px`)},z6=function(t,r,i){const o=!s(this,Pt)||s(this,me),a=u(this,H,is).call(this);return U`
|
|
794
|
+
${o?U`
|
|
795
|
+
<aside class="app-sidebar">
|
|
796
|
+
${Fz(t,r,i.electronMode,s(this,lp),s(this,me)?null:a,s(this,me))}
|
|
797
|
+
</aside>
|
|
798
|
+
${s(this,me)?null:U`
|
|
799
|
+
<div
|
|
800
|
+
class="app-sidebar-resize"
|
|
801
|
+
aria-hidden="true"
|
|
802
|
+
@pointerdown=${s(this,dp)}
|
|
803
|
+
@pointermove=${s(this,pp)}
|
|
804
|
+
@pointerup=${s(this,fp)}
|
|
805
|
+
@pointercancel=${s(this,Su)}
|
|
806
|
+
@lostpointercapture=${s(this,Su)}
|
|
807
|
+
@dblclick=${s(this,mp)}
|
|
808
|
+
></div>
|
|
809
|
+
`}
|
|
810
|
+
`:null}
|
|
811
|
+
<main class="app-main">
|
|
812
|
+
${$U(t,r,{connectionOwner:i.connectionOwner,primaryServerURL:i.primaryServerURL,updatePresentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,onTabReorderChange:s(this,ap),collapsed:s(this,Pt),onExpandSidebar:s(this,cp),sidebarToggle:s(this,me)?null:s(this,Pt)?a:void 0,sidebarTransitioning:s(this,me)})}
|
|
813
|
+
${T9(t,r.focusedChannel,s(this,yu),s(this,me))}
|
|
814
|
+
</main>
|
|
815
|
+
${s(this,me)?a:null}
|
|
816
|
+
`};const IU=Mt(RU);function xU(n){return n.kind==="connected"||n.kind==="no-channel"||n.kind==="empty-channel"||n.kind==="disconnected"}function PU(n){return n.kind!=="connected"&&n.kind!=="no-channel"&&n.kind!=="empty-channel"}const U6="television-appearance-mode";function LU(n){return n==="system"||n==="light"||n==="dark"}function DU(){try{const n=window.localStorage.getItem(U6);return LU(n)?n:"system"}catch{return"system"}}function F6(){return window.__televisionAppearanceResolver??CM(DU())}function OU(n,e){return e==="light"||e==="dark"?e:n}function MU(n){F6().setPreference(n);try{window.localStorage.setItem(U6,n)}catch{}}document.documentElement.dataset.tvBundleVersion=A0();Object.defineProperty(window,"__tvVersion",{value:A0(),writable:!1,configurable:!1});F6();const NU=KU(),Qn=Hr();Qn?document.documentElement.dataset.platform="electron":delete document.documentElement.dataset.platform;const U0=qP(),Z6=WP(),zU=new q4(Qn?"television-electron":"television-browser",B4()),UU=new mM(window.localStorage),FU=new pM(window.localStorage),Ew=ES(),ZU=Ew?QP({storage:Ew,clientApp:Qn?"desktop":"browser",desktopAppVersion:Qn?C2():null}):null,F0=Fi(Qn?U0:window.location.origin),Z0=bM({search:window.location.search}),wn=E0(),H6=new kM,H0=EM({detection:Z0,primaryServerURL:F0,navigationLatch:wn,presentation:H6}),Se=new nM({localStore:zU,serverURL:U0,launchToken:Z6,telemetryMeta:ZU,navigationPending:()=>wn.pending,...Z0.electron?{decideBoot:n=>H0.decideBoot(n)}:{}}),HU=n=>{L4(Ke,n)},Ke=new A4({connectionOwner:Se,navigationKeyHandler:HU,retainedGateHalted:()=>H0.gated}),Ho=globalThis.__televisionNativeBridge;Qn&&Ho&&Ho.onNavigationKey(n=>Ke.handleNavigationKey(n));if(Z6){const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`)}wM({owner:Se,primaryServerURL:F0,navigationLatch:wn});H0.attach(Se);const VU=()=>{const n=Se.connection;n.status==="connected"&&n.client.artifacts.list().then(({artifacts:e})=>{const t=new Set(e.map(r=>r.id));hM(t)}).catch(()=>{})},V6=()=>{Se.connection.status==="connected"&&e9(Se.connection.url)};let Ed=null,Mg=null,B6=Se.connection.status;const BU=()=>{wn.pending||wn.begin(()=>{const n=document.querySelector("#settings-popover");if(n!=null&&n.hasAttribute("open")){const e=new URL(window.location.href);e.searchParams.set("reopenSettings","1"),window.history.replaceState(window.history.state,"",`${e.pathname}${e.search}${e.hash}`)}window.location.reload()})},q6=(n,e,t)=>{if(wn.pending||Se.connection.status!=="connected"||Ke.snapshot.connection.status!=="connected"||!Ke.snapshot.ready)return;const r={activeThemeName:n,consentIds:new Set(e)},i=Ed,o=r9(),a=i!==null&&i.activeThemeName!==r.activeThemeName,l=(i==null?void 0:i.activeThemeName)!==null&&(i==null?void 0:i.activeThemeName)!==void 0&&i.consentIds.has(i.activeThemeName),c=r.activeThemeName!==null&&r.consentIds.has(r.activeThemeName),d=i!==null&&!a&&l&&!c,p=i!==null&&J6(i.consentIds,r.consentIds);if(Ed=r,o!==null&&(a||d)){BU();return}if(o===null&&c){Gy(Se.connection.url);return}o!==null&&c&&t&&!a&&p&&Gy(Se.connection.url)},qU=()=>{const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n},W6=(n,e)=>{if(wn.pending||Se.connection.status!=="connected"||Ke.snapshot.connection.status!=="connected"||!Ke.snapshot.ready)return;const t={activeThemeName:n,serverURL:Se.connection.url,appearance:qU()},r=Mg;Mg=t,!(!e&&(r==null?void 0:r.activeThemeName)===t.activeThemeName&&r.serverURL===t.serverURL&&r.appearance===t.appearance)&&i9(t.serverURL,t.activeThemeName,()=>Ke.listThemes())},j6=()=>{if(!wn.pending){if(B6=Se.connection.status,Se.connection.status!=="connected"){t9(),n9(),s9(),Ed=null,Mg=null;return}V6(),VU()}};let Ng,zg;const V0=(n,e)=>{const t=OU(n,e);t!==Ng&&(MU(t),Ng=t),t!==zg&&Qn&&typeof(Ho==null?void 0:Ho.setAppearanceMode)=="function"&&(Ho.setAppearanceMode(t),zg=t)},Up=()=>{const n=Ke.snapshot;if(n.connection.status!=="connected"){Ng=void 0,zg=void 0;return}n.ready&&(V0(n.display.appearanceMode,n.display.activeThemeColorScheme),B6===Se.connection.status&&(q6(n.display.activeThemeName,n.display.themeJavaScriptConsentIds,!1),W6(n.display.activeThemeName,!1)))},WU=n=>{if(wn.pending)return;V0(Ke.snapshot.display.appearanceMode,n.activeThemeColorScheme);const e=Ed,t=e!==null&&e.activeThemeName===n.themeName&&!J6(e.consentIds,new Set(n.themeJavaScriptConsentIds));q6(n.themeName,n.themeJavaScriptConsentIds,!0),!(wn.pending||t)&&(V6(),W6(n.themeName,!0))},jU=n=>{wn.pending||V0(n.appearanceMode,Ke.snapshot.display.activeThemeColorScheme)};j6();Up();Se.addEventListener("change",j6);Ke.addEventListener("change",Up);Ke.addEventListener("theme-changed",WU);Ke.addEventListener("appearance-changed",jU);const GU=new MutationObserver(()=>{Up()});GU.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});Cb.register("ServerConnectionOwner",()=>Se);Cb.register("ApplicationService",()=>Ke);const tc=globalThis.__telepath??(globalThis.__telepath={});tc.applicationService=Ke;tc.connectionOwner=Se;const YU=tc.renderCompleteCallbacks??(tc.renderCompleteCallbacks=new Set);Qn&&document.body.classList.add("electron");let kw=!1,Cw=!1;const JU=n=>{if(!NU||Cw||n!=="connected"&&n!=="no-channel"&&n!=="empty-channel")return;const e=document.querySelector("#settings-popover");e!==null&&(Cw=!0,e.setAttribute("open",""))},G6=()=>{kw||(Dh(IU(Ke,{runtimeServerURL:U0,electronMode:Qn,connectionOwner:Se,primaryServerURL:F0,updatePresentation:H6,desktopRecommendation:Z0,sidebarWidthPreference:UU,sidebarCollapsedPreference:FU,onRenderComplete(n){JU(n);for(const e of YU)e(n)}}),document.body),kw=!0,Up())},Y6=()=>{const n=Se.connection;n.bootState==="pending"&&!n.hasAuthRejected&&Se.connectError===null||(Se.removeEventListener("change",Y6),G6())};Qn?Se.addEventListener("change",Y6):G6();Se.connect();function KU(){const n=new URL(window.location.href);return n.searchParams.get("reopenSettings")!=="1"?!1:(n.searchParams.delete("reopenSettings"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`),!0)}function J6(n,e){if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0}
|