@mkody/twitch-emoticons 2.8.5 → 2.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
var xn=Object.defineProperty;var NC=Object.getOwnPropertyDescriptor;var GC=Object.getOwnPropertyNames;var QC=Object.prototype.hasOwnProperty;var n=(r,e)=>xn(r,"name",{value:e,configurable:!0});var $C=(r,e)=>()=>(r&&(e=r(r=0)),e);var l=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),WC=(r,e)=>{for(var t in e)xn(r,t,{get:e[t],enumerable:!0})},VC=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of GC(e))!QC.call(r,a)&&a!==t&&xn(r,a,{get:()=>e[a],enumerable:!(i=NC(e,a))||i.enumerable});return r};var g=r=>VC(xn({},"__esModule",{value:!0}),r);var yr=l((h2,Oy)=>{var yc=class r{static{n(this,"Emote")}constructor(e,t,i){if(new.target.name===r.name)throw new Error("Base Emote class cannot be used");this.fetcher=e.fetcher,this.channel=e,this.id=t,this.type=null,this._setup(i)}_setup(e){this.code=e.code}toLink(){return null}toString(){return this.code}toObject(){return{code:this.code,id:this.id,channel_id:this.channel.channel_id}}};Oy.exports=yc});var xt=l((m2,By)=>{By.exports={Twitch:{CDN:(r,e)=>`https://static-cdn.jtvnw.net/emoticons/v2/${r}/default/dark/${e+1}.0`},BTTV:{Global:"https://api.betterttv.net/3/cached/emotes/global",Channel:r=>`https://api.betterttv.net/3/cached/users/twitch/${r}`,CDN:(r,e)=>`https://cdn.betterttv.net/emote/${r}/${e+1}x.webp`},SevenTV:{Global:"https://7tv.io/v3/emote-sets/global",Channel:r=>`https://7tv.io/v3/users/twitch/${r}`,CDN:(r,e)=>`https://cdn.7tv.app/emote/${r}/${e}`},FFZ:{sets:{Global:3,Modifiers:1532818},Set:r=>`https://api.frankerfacez.com/v1/set/${r}`,Channel:r=>`https://api.frankerfacez.com/v1/room/id/${r}`,CDN:(r,e)=>`https://cdn.frankerfacez.com/emote/${r}/${e}`,CDNAnimated:(r,e)=>`https://cdn.frankerfacez.com/emote/${r}/animated/${e}.webp`},Templates:{html:'<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',markdown:'',bbcode:"[img]{link}[/img]",plain:"{link}"}}});var gc=l((y2,Uy)=>{var zC=yr(),KC=xt(),_c=class r extends zC{static{n(this,"BTTVEmote")}constructor(e,t,i){super(e,t,i),this.type="bttv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.ownerName="user"in e?e.user.name:null,this.animated=e.animated,this.imageType="webp"}toLink(e=0){return KC.BTTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,ownerName:this.ownerName,type:this.type})}static fromObject(e,t=null){return new r(t,e.id,{code:e.code,animated:e.animated,user:{name:e.ownerName}})}};Uy.exports=_c});var Sn=l((g2,jy)=>{var bc=class extends Map{static{n(this,"Collection")}find(e,t){if(typeof e=="string"){if(typeof t>"u")return null;for(let i of this.values())if(i[e]===t)return i;return null}if(typeof e=="function"){let i=0;for(let a of this.values()){if(e(a,i,this))return a;i++}return null}return null}filter(e,t){t&&(e=e.bind(t));let i=new this.constructor,a=0;for(let[o,s]of this)e(s,a,this)&&i.set(o,s),a++;return i}map(e,t){t&&(e=e.bind(t));let i=new Array(this.size),a=0;for(let o of this.values())i[a]=e(o,a,this),a++;return i}};jy.exports=bc});var wc=l((v2,ky)=>{var JC=Sn(),vc=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new JC}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};ky.exports=vc});var Sc=l((x2,Fy)=>{var ZC=yr(),Ly=xt(),xc=class r extends ZC{static{n(this,"FFZEmote")}constructor(e,t,i){super(e,t,i),this.type="ffz"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.name:null,this.sizes="animated"in e?Object.keys(e.animated):Object.keys(e.urls),this.animated="animated"in e,this.imageType="animated"in e?"webp":"png",this.modifier=e.modifier&&(e.modifier_flags&1)!==0}toLink(e=0){return e=this.sizes[e],this.animated?Ly.FFZ.CDNAnimated(this.id,e):Ly.FFZ.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,modifier:this.modifier})}static fromObject(e,t=null){let i=e.sizes.reduce((a,o)=>(a[o]=o,a),{});return new r(t,e.id,{code:e.code,name:e.code,urls:i,...e.animated?{animated:i}:{},owner:{name:e.ownerName},modifier:e.modifier,modifier_flags:e.modifier})}};Fy.exports=xc});var Pc=l((q2,My)=>{var XC=yr(),YC=xt(),qc=class r extends XC{static{n(this,"SevenTVEmote")}constructor(e,t,i){super(e,t,i),this.type="7tv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.display_name:null,this.sizes=e.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],YC.SevenTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,imageType:this.imageType})}static fromObject(e,t){let i=e.sizes.map(a=>({format:t.format.toUpperCase(),name:a}));return new r(t,e.id,{code:e.code,name:e.code,animated:e.animated,owner:{display_name:e.ownerName},host:{files:i}})}};My.exports=qc});var Hc=l((C2,Ny)=>{var eH=yr(),tH=xt(),Cc=class r extends eH{static{n(this,"TwitchEmote")}constructor(e,t,i){super(e,t,i),this.type="twitch"}get owner(){return this.channel}_setup(e){super._setup(e),this.set=e.emoticon_set,this.animated="animated"in e.formats,this.imageType="animated"in e.formats?"gif":"png"}toLink(e=0){return tH.Twitch.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,set:this.set,type:this.type})}static fromObject(e,t=null){return new r(t,e.id,{code:e.code,animated:e.animated,emoticon_set:e.set,formats:e.animated?{animated:e.animated}:{}})}};Ny.exports=Cc});var x_=l((E2,w_)=>{"use strict";function e_(r,e){return n(function(){return r.apply(e,arguments)},"wrap")}n(e_,"bind");var{toString:rH}=Object.prototype,{getPrototypeOf:Lc}=Object,Hn=(r=>e=>{let t=rH.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ze=n(r=>(r=r.toLowerCase(),e=>Hn(e)===r),"kindOfTest"),En=n(r=>e=>typeof e===r,"typeOfTest"),{isArray:vr}=Array,gi=En("undefined");function iH(r){return r!==null&&!gi(r)&&r.constructor!==null&&!gi(r.constructor)&&Oe(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}n(iH,"isBuffer");var t_=ze("ArrayBuffer");function nH(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&t_(r.buffer),e}n(nH,"isArrayBufferView");var aH=En("string"),Oe=En("function"),r_=En("number"),An=n(r=>r!==null&&typeof r=="object","isObject"),oH=n(r=>r===!0||r===!1,"isBoolean"),qn=n(r=>{if(Hn(r)!=="object")return!1;let e=Lc(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},"isPlainObject"),sH=ze("Date"),uH=ze("File"),lH=ze("Blob"),cH=ze("FileList"),dH=n(r=>An(r)&&Oe(r.pipe),"isStream"),pH=n(r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Oe(r.append)&&((e=Hn(r))==="formdata"||e==="object"&&Oe(r.toString)&&r.toString()==="[object FormData]"))},"isFormData"),hH=ze("URLSearchParams"),fH=n(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function bi(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let i,a;if(typeof r!="object"&&(r=[r]),vr(r))for(i=0,a=r.length;i<a;i++)e.call(null,r[i],i,r);else{let o=t?Object.getOwnPropertyNames(r):Object.keys(r),s=o.length,u;for(i=0;i<s;i++)u=o[i],e.call(null,r[u],u,r)}}n(bi,"forEach");function i_(r,e){e=e.toLowerCase();let t=Object.keys(r),i=t.length,a;for(;i-- >0;)if(a=t[i],e===a.toLowerCase())return a;return null}n(i_,"findKey");var n_=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,a_=n(r=>!gi(r)&&r!==n_,"isContextDefined");function Rc(){let{caseless:r}=a_(this)&&this||{},e={},t=n((i,a)=>{let o=r&&i_(e,a)||a;qn(e[o])&&qn(i)?e[o]=Rc(e[o],i):qn(i)?e[o]=Rc({},i):vr(i)?e[o]=i.slice():e[o]=i},"assignValue");for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&bi(arguments[i],t);return e}n(Rc,"merge");var mH=n((r,e,t,{allOwnKeys:i}={})=>(bi(e,(a,o)=>{t&&Oe(a)?r[o]=e_(a,t):r[o]=a},{allOwnKeys:i}),r),"extend"),yH=n(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),_H=n((r,e,t,i)=>{r.prototype=Object.create(e.prototype,i),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),gH=n((r,e,t,i)=>{let a,o,s,u={};if(e=e||{},r==null)return e;do{for(a=Object.getOwnPropertyNames(r),o=a.length;o-- >0;)s=a[o],(!i||i(s,r,e))&&!u[s]&&(e[s]=r[s],u[s]=!0);r=t!==!1&&Lc(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),bH=n((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let i=r.indexOf(e,t);return i!==-1&&i===t},"endsWith"),vH=n(r=>{if(!r)return null;if(vr(r))return r;let e=r.length;if(!r_(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),wH=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Lc(Uint8Array)),xH=n((r,e)=>{let i=(r&&r[Symbol.iterator]).call(r),a;for(;(a=i.next())&&!a.done;){let o=a.value;e.call(r,o[0],o[1])}},"forEachEntry"),SH=n((r,e)=>{let t,i=[];for(;(t=r.exec(e))!==null;)i.push(t);return i},"matchAll"),qH=ze("HTMLFormElement"),PH=n(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,i,a){return i.toUpperCase()+a},"replacer")),"toCamelCase"),Gy=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),CH=ze("RegExp"),o_=n((r,e)=>{let t=Object.getOwnPropertyDescriptors(r),i={};bi(t,(a,o)=>{let s;(s=e(a,o,r))!==!1&&(i[o]=s||a)}),Object.defineProperties(r,i)},"reduceDescriptors"),HH=n(r=>{o_(r,(e,t)=>{if(Oe(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let i=r[t];if(Oe(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),EH=n((r,e)=>{let t={},i=n(a=>{a.forEach(o=>{t[o]=!0})},"define");return vr(r)?i(r):i(String(r).split(e)),t},"toObjectSet"),AH=n(()=>{},"noop"),TH=n((r,e)=>(r=+r,Number.isFinite(r)?r:e),"toFiniteNumber"),Ec="abcdefghijklmnopqrstuvwxyz",Qy="0123456789",s_={DIGIT:Qy,ALPHA:Ec,ALPHA_DIGIT:Ec+Ec.toUpperCase()+Qy},IH=n((r=16,e=s_.ALPHA_DIGIT)=>{let t="",{length:i}=e;for(;r--;)t+=e[Math.random()*i|0];return t},"generateString");function RH(r){return!!(r&&Oe(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}n(RH,"isSpecCompliantForm");var DH=n(r=>{let e=new Array(10),t=n((i,a)=>{if(An(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[a]=i;let o=vr(i)?[]:{};return bi(i,(s,u)=>{let c=t(s,a+1);!gi(c)&&(o[u]=c)}),e[a]=void 0,o}}return i},"visit");return t(r,0)},"toJSONObject"),OH=ze("AsyncFunction"),BH=n(r=>r&&(An(r)||Oe(r))&&Oe(r.then)&&Oe(r.catch),"isThenable"),v={isArray:vr,isArrayBuffer:t_,isBuffer:iH,isFormData:pH,isArrayBufferView:nH,isString:aH,isNumber:r_,isBoolean:oH,isObject:An,isPlainObject:qn,isUndefined:gi,isDate:sH,isFile:uH,isBlob:lH,isRegExp:CH,isFunction:Oe,isStream:dH,isURLSearchParams:hH,isTypedArray:wH,isFileList:cH,forEach:bi,merge:Rc,extend:mH,trim:fH,stripBOM:yH,inherits:_H,toFlatObject:gH,kindOf:Hn,kindOfTest:ze,endsWith:bH,toArray:vH,forEachEntry:xH,matchAll:SH,isHTMLForm:qH,hasOwnProperty:Gy,hasOwnProp:Gy,reduceDescriptors:o_,freezeMethods:HH,toObjectSet:EH,toCamelCase:PH,noop:AH,toFiniteNumber:TH,findKey:i_,global:n_,isContextDefined:a_,ALPHABET:s_,generateString:IH,isSpecCompliantForm:RH,toJSONObject:DH,isAsyncFn:OH,isThenable:BH};function D(r,e,t,i,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),a&&(this.response=a)}n(D,"AxiosError");v.inherits(D,Error,{toJSON:n(function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:v.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}},"toJSON")});var u_=D.prototype,l_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{l_[r]={value:r}});Object.defineProperties(D,l_);Object.defineProperty(u_,"isAxiosError",{value:!0});D.from=(r,e,t,i,a,o)=>{let s=Object.create(u_);return v.toFlatObject(r,s,n(function(c){return c!==Error.prototype},"filter"),u=>u!=="isAxiosError"),D.call(s,r.message,e,t,i,a),s.cause=r,s.name=r.name,o&&Object.assign(s,o),s};var UH=null;function Dc(r){return v.isPlainObject(r)||v.isArray(r)}n(Dc,"isVisitable");function c_(r){return v.endsWith(r,"[]")?r.slice(0,-2):r}n(c_,"removeBrackets");function $y(r,e,t){return r?r.concat(e).map(n(function(a,o){return a=c_(a),!t&&o?"["+a+"]":a},"each")).join(t?".":""):e}n($y,"renderKey");function jH(r){return v.isArray(r)&&!r.some(Dc)}n(jH,"isFlatArray");var kH=v.toFlatObject(v,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function Tn(r,e,t){if(!v.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=v.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,n(function(x,E){return!v.isUndefined(E[x])},"defined"));let i=t.metaTokens,a=t.visitor||h,o=t.dots,s=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&v.isSpecCompliantForm(e);if(!v.isFunction(a))throw new TypeError("visitor must be a function");function p(w){if(w===null)return"";if(v.isDate(w))return w.toISOString();if(!c&&v.isBlob(w))throw new D("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(w)||v.isTypedArray(w)?c&&typeof Blob=="function"?new Blob([w]):Buffer.from(w):w}n(p,"convertValue");function h(w,x,E){let R=w;if(w&&!E&&typeof w=="object"){if(v.endsWith(x,"{}"))x=i?x:x.slice(0,-2),w=JSON.stringify(w);else if(v.isArray(w)&&jH(w)||(v.isFileList(w)||v.endsWith(x,"[]"))&&(R=v.toArray(w)))return x=c_(x),R.forEach(n(function(z,re){!(v.isUndefined(z)||z===null)&&e.append(s===!0?$y([x],re,o):s===null?x:x+"[]",p(z))},"each")),!1}return Dc(w)?!0:(e.append($y(E,x,o),p(w)),!1)}n(h,"defaultVisitor");let f=[],b=Object.assign(kH,{defaultVisitor:h,convertValue:p,isVisitable:Dc});function P(w,x){if(!v.isUndefined(w)){if(f.indexOf(w)!==-1)throw Error("Circular reference detected in "+x.join("."));f.push(w),v.forEach(w,n(function(R,Y){(!(v.isUndefined(R)||R===null)&&a.call(e,R,v.isString(Y)?Y.trim():Y,x,b))===!0&&P(R,x?x.concat(Y):[Y])},"each")),f.pop()}}if(n(P,"build"),!v.isObject(r))throw new TypeError("data must be an object");return P(r),e}n(Tn,"toFormData");function Wy(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,n(function(i){return e[i]},"replacer"))}n(Wy,"encode$1");function Fc(r,e){this._pairs=[],r&&Tn(r,this,e)}n(Fc,"AxiosURLSearchParams");var d_=Fc.prototype;d_.append=n(function(e,t){this._pairs.push([e,t])},"append");d_.toString=n(function(e){let t=e?function(i){return e.call(this,i,Wy)}:Wy;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function LH(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}n(LH,"encode");function p_(r,e,t){if(!e)return r;let i=t&&t.encode||LH,a=t&&t.serialize,o;if(a?o=a(e,t):o=v.isURLSearchParams(e)?e.toString():new Fc(e,t).toString(i),o){let s=r.indexOf("#");s!==-1&&(r=r.slice(0,s)),r+=(r.indexOf("?")===-1?"?":"&")+o}return r}n(p_,"buildURL");var Oc=class{static{n(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){v.forEach(this.handlers,n(function(i){i!==null&&e(i)},"forEachHandler"))}},Vy=Oc,h_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},FH=typeof URLSearchParams<"u"?URLSearchParams:Fc,MH=typeof FormData<"u"?FormData:null,NH=typeof Blob<"u"?Blob:null,GH={isBrowser:!0,classes:{URLSearchParams:FH,FormData:MH,Blob:NH},protocols:["http","https","file","blob","url","data"]},f_=typeof window<"u"&&typeof document<"u",QH=(r=>f_&&["ReactNative","NativeScript","NS"].indexOf(r)<0)(typeof navigator<"u"&&navigator.product),$H=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",WH=Object.freeze({__proto__:null,hasBrowserEnv:f_,hasStandardBrowserWebWorkerEnv:$H,hasStandardBrowserEnv:QH}),Ve={...WH,...GH};function VH(r,e){return Tn(r,new Ve.classes.URLSearchParams,Object.assign({visitor:function(t,i,a,o){return Ve.isNode&&v.isBuffer(t)?(this.append(i,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}n(VH,"toURLEncodedForm");function zH(r){return v.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(zH,"parsePropPath");function KH(r){let e={},t=Object.keys(r),i,a=t.length,o;for(i=0;i<a;i++)o=t[i],e[o]=r[o];return e}n(KH,"arrayToObject");function m_(r){function e(t,i,a,o){let s=t[o++],u=Number.isFinite(+s),c=o>=t.length;return s=!s&&v.isArray(a)?a.length:s,c?(v.hasOwnProp(a,s)?a[s]=[a[s],i]:a[s]=i,!u):((!a[s]||!v.isObject(a[s]))&&(a[s]=[]),e(t,i,a[s],o)&&v.isArray(a[s])&&(a[s]=KH(a[s])),!u)}if(n(e,"buildPath"),v.isFormData(r)&&v.isFunction(r.entries)){let t={};return v.forEachEntry(r,(i,a)=>{e(zH(i),a,t,0)}),t}return null}n(m_,"formDataToJSON");function JH(r,e,t){if(v.isString(r))try{return(e||JSON.parse)(r),v.trim(r)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(r)}n(JH,"stringifySafely");var Mc={transitional:h_,adapter:["xhr","http"],transformRequest:[n(function(e,t){let i=t.getContentType()||"",a=i.indexOf("application/json")>-1,o=v.isObject(e);if(o&&v.isHTMLForm(e)&&(e=new FormData(e)),v.isFormData(e))return a&&a?JSON.stringify(m_(e)):e;if(v.isArrayBuffer(e)||v.isBuffer(e)||v.isStream(e)||v.isFile(e)||v.isBlob(e))return e;if(v.isArrayBufferView(e))return e.buffer;if(v.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(o){if(i.indexOf("application/x-www-form-urlencoded")>-1)return VH(e,this.formSerializer).toString();if((u=v.isFileList(e))||i.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Tn(u?{"files[]":e}:e,c&&new c,this.formSerializer)}}return o||a?(t.setContentType("application/json",!1),JH(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||Mc.transitional,i=t&&t.forcedJSONParsing,a=this.responseType==="json";if(e&&v.isString(e)&&(i&&!this.responseType||a)){let s=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e)}catch(u){if(s)throw u.name==="SyntaxError"?D.from(u,D.ERR_BAD_RESPONSE,this,null,this.response):u}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],r=>{Mc.headers[r]={}});var Nc=Mc,ZH=v.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),XH=n(r=>{let e={},t,i,a;return r&&r.split(`
|
|
2
|
-
`).forEach(
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let
|
|
4
|
-
`+
|
|
5
|
-
`):" "+Jy(o[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return i},adapters:Bc};function Ic(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new vi(null,r)}n(Ic,"throwIfCancellationRequested");function Zy(r){return Ic(r),r.headers=lt.from(r.headers),r.data=Tc.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),g_.getAdapter(r.adapter||Nc.adapter)(r).then(n(function(i){return Ic(r),i.data=Tc.call(r,r.transformResponse,i),i.headers=lt.from(i.headers),i},"onAdapterResolution"),n(function(i){return y_(i)||(Ic(r),i&&i.response&&(i.response.data=Tc.call(r,r.transformResponse,i.response),i.response.headers=lt.from(i.response.headers))),Promise.reject(i)},"onAdapterRejection"))}n(Zy,"dispatchRequest");var Xy=n(r=>r instanceof lt?r.toJSON():r,"headersToObject");function gr(r,e){e=e||{};let t={};function i(p,h,f){return v.isPlainObject(p)&&v.isPlainObject(h)?v.merge.call({caseless:f},p,h):v.isPlainObject(h)?v.merge({},h):v.isArray(h)?h.slice():h}n(i,"getMergedValue");function a(p,h,f){if(v.isUndefined(h)){if(!v.isUndefined(p))return i(void 0,p,f)}else return i(p,h,f)}n(a,"mergeDeepProperties");function o(p,h){if(!v.isUndefined(h))return i(void 0,h)}n(o,"valueFromConfig2");function s(p,h){if(v.isUndefined(h)){if(!v.isUndefined(p))return i(void 0,p)}else return i(void 0,h)}n(s,"defaultToConfig2");function u(p,h,f){if(f in e)return i(p,h);if(f in r)return i(void 0,p)}n(u,"mergeDirectKeys");let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u,headers:(p,h)=>a(Xy(p),Xy(h),!0)};return v.forEach(Object.keys(Object.assign({},r,e)),n(function(h){let f=c[h]||a,b=f(r[h],e[h],h);v.isUndefined(b)&&f!==u||(t[h]=b)},"computeConfigValue")),t}n(gr,"mergeConfig");var b_="1.6.3",Gc={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Gc[r]=n(function(i){return typeof i===r||"a"+(e<1?"n ":" ")+r},"validator")});var Yy={};Gc.transitional=n(function(e,t,i){function a(o,s){return"[Axios v"+b_+"] Transitional option '"+o+"'"+s+(i?". "+i:"")}return n(a,"formatMessage"),(o,s,u)=>{if(e===!1)throw new D(a(s," has been removed"+(t?" in "+t:"")),D.ERR_DEPRECATED);return t&&!Yy[s]&&(Yy[s]=!0,console.warn(a(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,s,u):!0}},"transitional");function hE(r,e,t){if(typeof r!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);let i=Object.keys(r),a=i.length;for(;a-- >0;){let o=i[a],s=e[o];if(s){let u=r[o],c=u===void 0||s(u,o,r);if(c!==!0)throw new D("option "+o+" must be "+c,D.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new D("Unknown option "+o,D.ERR_BAD_OPTION)}}n(hE,"assertOptions");var Uc={assertOptions:hE,validators:Gc},St=Uc.validators,br=class{static{n(this,"Axios")}constructor(e){this.defaults=e,this.interceptors={request:new Vy,response:new Vy}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=gr(this.defaults,t);let{transitional:i,paramsSerializer:a,headers:o}=t;i!==void 0&&Uc.assertOptions(i,{silentJSONParsing:St.transitional(St.boolean),forcedJSONParsing:St.transitional(St.boolean),clarifyTimeoutError:St.transitional(St.boolean)},!1),a!=null&&(v.isFunction(a)?t.paramsSerializer={serialize:a}:Uc.assertOptions(a,{encode:St.function,serialize:St.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&v.merge(o.common,o[t.method]);o&&v.forEach(["delete","get","head","post","put","patch","common"],w=>{delete o[w]}),t.headers=lt.concat(s,o);let u=[],c=!0;this.interceptors.request.forEach(n(function(x){typeof x.runWhen=="function"&&x.runWhen(t)===!1||(c=c&&x.synchronous,u.unshift(x.fulfilled,x.rejected))},"unshiftRequestInterceptors"));let p=[];this.interceptors.response.forEach(n(function(x){p.push(x.fulfilled,x.rejected)},"pushResponseInterceptors"));let h,f=0,b;if(!c){let w=[Zy.bind(this),void 0];for(w.unshift.apply(w,u),w.push.apply(w,p),b=w.length,h=Promise.resolve(t);f<b;)h=h.then(w[f++],w[f++]);return h}b=u.length;let P=t;for(f=0;f<b;){let w=u[f++],x=u[f++];try{P=w(P)}catch(E){x.call(this,E);break}}try{h=Zy.call(this,P)}catch(w){return Promise.reject(w)}for(f=0,b=p.length;f<b;)h=h.then(p[f++],p[f++]);return h}getUri(e){e=gr(this.defaults,e);let t=__(e.baseURL,e.url);return p_(t,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],n(function(e){br.prototype[e]=function(t,i){return this.request(gr(i||{},{method:e,url:t,data:(i||{}).data}))}},"forEachMethodNoData"));v.forEach(["post","put","patch"],n(function(e){function t(i){return n(function(o,s,u){return this.request(gr(u||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))},"httpMethod")}n(t,"generateHTTPMethod"),br.prototype[e]=t(),br.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var Cn=br,jc=class r{static{n(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(n(function(o){t=o},"promiseExecutor"));let i=this;this.promise.then(a=>{if(!i._listeners)return;let o=i._listeners.length;for(;o-- >0;)i._listeners[o](a);i._listeners=null}),this.promise.then=a=>{let o,s=new Promise(u=>{i.subscribe(u),o=u}).then(a);return s.cancel=n(function(){i.unsubscribe(o)},"reject"),s},e(n(function(o,s,u){i.reason||(i.reason=new vi(o,s,u),t(i.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new r(n(function(a){e=a},"executor")),cancel:e}}},fE=jc;function mE(r){return n(function(t){return r.apply(null,t)},"wrap")}n(mE,"spread");function yE(r){return v.isObject(r)&&r.isAxiosError===!0}n(yE,"isAxiosError");var kc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(kc).forEach(([r,e])=>{kc[e]=r});var _E=kc;function v_(r){let e=new Cn(r),t=e_(Cn.prototype.request,e);return v.extend(t,Cn.prototype,e,{allOwnKeys:!0}),v.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return v_(gr(r,a))},"create"),t}n(v_,"createInstance");var J=v_(Nc);J.Axios=Cn;J.CanceledError=vi;J.CancelToken=fE;J.isCancel=y_;J.VERSION=b_;J.toFormData=Tn;J.AxiosError=D;J.Cancel=J.CanceledError;J.all=n(function(e){return Promise.all(e)},"all");J.spread=mE;J.isAxiosError=yE;J.mergeConfig=gr;J.AxiosHeaders=lt;J.formToJSON=r=>m_(v.isHTMLForm(r)?new FormData(r):r);J.getAdapter=g_.getAdapter;J.HttpStatusCode=_E;J.default=J;w_.exports=J});var y={};WC(y,{__addDisposableResource:()=>G_,__assign:()=>In,__asyncDelegator:()=>B_,__asyncGenerator:()=>O_,__asyncValues:()=>U_,__await:()=>wr,__awaiter:()=>E_,__classPrivateFieldGet:()=>F_,__classPrivateFieldIn:()=>N_,__classPrivateFieldSet:()=>M_,__createBinding:()=>Dn,__decorate:()=>P_,__disposeResources:()=>Q_,__esDecorate:()=>gE,__exportStar:()=>T_,__extends:()=>S_,__generator:()=>A_,__importDefault:()=>L_,__importStar:()=>k_,__makeTemplateObject:()=>j_,__metadata:()=>H_,__param:()=>C_,__propKey:()=>vE,__read:()=>$c,__rest:()=>q_,__runInitializers:()=>bE,__setFunctionName:()=>wE,__spread:()=>I_,__spreadArray:()=>D_,__spreadArrays:()=>R_,__values:()=>Rn,default:()=>qE});function S_(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Qc(r,e);function t(){this.constructor=r}n(t,"__"),r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function q_(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(r);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(r,i[a])&&(t[i[a]]=r[i[a]]);return t}function P_(r,e,t,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var u=r.length-1;u>=0;u--)(s=r[u])&&(o=(a<3?s(o):a>3?s(e,t,o):s(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o}function C_(r,e){return function(t,i){e(t,i,r)}}function gE(r,e,t,i,a,o){function s(R){if(R!==void 0&&typeof R!="function")throw new TypeError("Function expected");return R}n(s,"accept");for(var u=i.kind,c=u==="getter"?"get":u==="setter"?"set":"value",p=!e&&r?i.static?r:r.prototype:null,h=e||(p?Object.getOwnPropertyDescriptor(p,i.name):{}),f,b=!1,P=t.length-1;P>=0;P--){var w={};for(var x in i)w[x]=x==="access"?{}:i[x];for(var x in i.access)w.access[x]=i.access[x];w.addInitializer=function(R){if(b)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(R||null))};var E=(0,t[P])(u==="accessor"?{get:h.get,set:h.set}:h[c],w);if(u==="accessor"){if(E===void 0)continue;if(E===null||typeof E!="object")throw new TypeError("Object expected");(f=s(E.get))&&(h.get=f),(f=s(E.set))&&(h.set=f),(f=s(E.init))&&a.unshift(f)}else(f=s(E))&&(u==="field"?a.unshift(f):h[c]=f)}p&&Object.defineProperty(p,i.name,h),b=!0}function bE(r,e,t){for(var i=arguments.length>2,a=0;a<e.length;a++)t=i?e[a].call(r,t):e[a].call(r);return i?t:void 0}function vE(r){return typeof r=="symbol"?r:"".concat(r)}function wE(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function H_(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function E_(r,e,t,i){function a(o){return o instanceof t?o:new t(function(s){s(o)})}return n(a,"adopt"),new(t||(t=Promise))(function(o,s){function u(h){try{p(i.next(h))}catch(f){s(f)}}n(u,"fulfilled");function c(h){try{p(i.throw(h))}catch(f){s(f)}}n(c,"rejected");function p(h){h.done?o(h.value):a(h.value).then(u,c)}n(p,"step"),p((i=i.apply(r,e||[])).next())})}function A_(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,a,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(p){return function(h){return c([p,h])}}function c(p){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,p[0]&&(t=0)),t;)try{if(i=1,a&&(o=p[0]&2?a.return:p[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,p[1])).done)return o;switch(a=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,a=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){t.label=p[1];break}if(p[0]===6&&t.label<o[1]){t.label=o[1],o=p;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(p);break}o[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(h){p=[6,h],a=0}finally{i=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function T_(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Dn(e,r,t)}function Rn(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function $c(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),a,o=[],s;try{for(;(e===void 0||e-- >0)&&!(a=i.next()).done;)o.push(a.value)}catch(u){s={error:u}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(s)throw s.error}}return o}function I_(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat($c(arguments[e]));return r}function R_(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),a=0,e=0;e<t;e++)for(var o=arguments[e],s=0,u=o.length;s<u;s++,a++)i[a]=o[s];return i}function D_(r,e,t){if(t||arguments.length===2)for(var i=0,a=e.length,o;i<a;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return r.concat(o||Array.prototype.slice.call(e))}function wr(r){return this instanceof wr?(this.v=r,this):new wr(r)}function O_(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),a,o=[];return a={},s("next"),s("throw"),s("return"),a[Symbol.asyncIterator]=function(){return this},a;function s(b){i[b]&&(a[b]=function(P){return new Promise(function(w,x){o.push([b,P,w,x])>1||u(b,P)})})}function u(b,P){try{c(i[b](P))}catch(w){f(o[0][3],w)}}function c(b){b.value instanceof wr?Promise.resolve(b.value.v).then(p,h):f(o[0][2],b)}function p(b){u("next",b)}function h(b){u("throw",b)}function f(b,P){b(P),o.shift(),o.length&&u(o[0][0],o[0][1])}}function B_(r){var e,t;return e={},i("next"),i("throw",function(a){throw a}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(a,o){e[a]=r[a]?function(s){return(t=!t)?{value:wr(r[a](s)),done:!1}:o?o(s):s}:o}}function U_(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Rn=="function"?Rn(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(o){t[o]=r[o]&&function(s){return new Promise(function(u,c){s=r[o](s),a(u,c,s.done,s.value)})}}function a(o,s,u,c){Promise.resolve(c).then(function(p){o({value:p,done:u})},s)}}function j_(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function k_(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Dn(e,r,t);return xE(e,r),e}function L_(r){return r&&r.__esModule?r:{default:r}}function F_(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)}function M_(r,e,t,i,a){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?a.call(r,t):a?a.value=t:e.set(r,t),t}function N_(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}function G_(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var i;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose]}if(typeof i!="function")throw new TypeError("Object not disposable.");r.stack.push({value:e,dispose:i,async:t})}else t&&r.stack.push({async:!0});return e}function Q_(r){function e(i){r.error=r.hasError?new SE(i,r.error,"An error was suppressed during disposal."):i,r.hasError=!0}n(e,"fail");function t(){for(;r.stack.length;){var i=r.stack.pop();try{var a=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(a).then(t,function(o){return e(o),t()})}catch(o){e(o)}}if(r.hasError)throw r.error}return n(t,"next"),t()}var Qc,In,Dn,xE,SE,qE,_=$C(()=>{Qc=n(function(r,e){return Qc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])},Qc(r,e)},"extendStatics");n(S_,"__extends");In=n(function(){return In=Object.assign||n(function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},"__assign"),In.apply(this,arguments)},"__assign");n(q_,"__rest");n(P_,"__decorate");n(C_,"__param");n(gE,"__esDecorate");n(bE,"__runInitializers");n(vE,"__propKey");n(wE,"__setFunctionName");n(H_,"__metadata");n(E_,"__awaiter");n(A_,"__generator");Dn=Object.create?function(r,e,t,i){i===void 0&&(i=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,i,a)}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]};n(T_,"__exportStar");n(Rn,"__values");n($c,"__read");n(I_,"__spread");n(R_,"__spreadArrays");n(D_,"__spreadArray");n(wr,"__await");n(O_,"__asyncGenerator");n(B_,"__asyncDelegator");n(U_,"__asyncValues");n(j_,"__makeTemplateObject");xE=Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e};n(k_,"__importStar");n(L_,"__importDefault");n(F_,"__classPrivateFieldGet");n(M_,"__classPrivateFieldSet");n(N_,"__classPrivateFieldIn");n(G_,"__addDisposableResource");SE=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var i=new Error(t);return i.name="SuppressedError",i.error=r,i.suppressed=e,i};n(Q_,"__disposeResources");qE={__extends:S_,__assign:In,__rest:q_,__decorate:P_,__param:C_,__metadata:H_,__awaiter:E_,__generator:A_,__createBinding:Dn,__exportStar:T_,__values:Rn,__read:$c,__spread:I_,__spreadArrays:R_,__spreadArray:D_,__await:wr,__asyncGenerator:O_,__asyncDelegator:B_,__asyncValues:U_,__makeTemplateObject:j_,__importStar:k_,__importDefault:L_,__classPrivateFieldGet:F_,__classPrivateFieldSet:M_,__classPrivateFieldIn:N_,__addDisposableResource:G_,__disposeResources:Q_}});var wi=l((I2,$_)=>{$_.exports.isNode=!1});var Jt=l(Pt=>{"use strict";var qt;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.LogLevelToConsoleFunction=Pt.resolveLogLevel=Pt.LogLevel=void 0;var PE=wi(),_e;(function(r){r[r.CRITICAL=0]="CRITICAL",r[r.ERROR=1]="ERROR",r[r.WARNING=2]="WARNING",r[r.INFO=3]="INFO",r[r.DEBUG=4]="DEBUG",r[r.TRACE=7]="TRACE"})(_e||(_e={}));Pt.LogLevel=_e;function CE(r){if(typeof r=="number"){if(Object.prototype.hasOwnProperty.call(_e,r))return r;var e=Object.keys(_e).map(function(i){return parseInt(i,10)}).filter(function(i){return!isNaN(i)&&i<r});return e.length?Math.max.apply(Math,e):_e.WARNING}var t=r.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(_e,t))throw new Error("Unknown log level string: ".concat(r));return _e[t]}n(CE,"resolveLogLevel");Pt.resolveLogLevel=CE;var HE=PE.isNode?console.log.bind(console):console.debug.bind(console);Pt.LogLevelToConsoleFunction=(qt={},qt[_e.CRITICAL]=console.error.bind(console),qt[_e.ERROR]=console.error.bind(console),qt[_e.WARNING]=console.warn.bind(console),qt[_e.INFO]=console.info.bind(console),qt[_e.DEBUG]=HE.bind(console),qt[_e.TRACE]=console.trace.bind(console),qt)});var W_=l(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.Enumerable=void 0;function EE(r){return r===void 0&&(r=!0),function(e,t){Object.defineProperty(e,t,{get:function(){},set:function(i){Object.defineProperty(this,t,{value:i,writable:!0,enumerable:r})},enumerable:r})}}n(EE,"Enumerable");On.Enumerable=EE});var z_=l(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.flatten=void 0;var V_=(_(),g(y));function AE(r){var e;return(e=[]).concat.apply(e,V_.__spreadArray([],V_.__read(r),!1))}n(AE,"flatten");Bn.flatten=AE});var K_=l(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.partitionedFlatMap=void 0;var Wc=(_(),g(y));function TE(r,e,t){var i,a,o,s={};try{for(var u=Wc.__values(r),c=u.next();!c.done;c=u.next()){var p=c.value,h=e(p),f=t(p);Array.isArray(f)||(f=[f]),Object.prototype.hasOwnProperty.call(s,h)?(o=s[h]).push.apply(o,Wc.__spreadArray([],Wc.__read(f),!1)):s[h]=f}}catch(b){i={error:b}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}return s}n(TE,"partitionedFlatMap");Un.partitionedFlatMap=TE});var Z_=l(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.resolveConfigValueSync=xr.resolveConfigValue=void 0;var J_=(_(),g(y));function IE(r){return J_.__awaiter(this,void 0,void 0,function(){return J_.__generator(this,function(e){switch(e.label){case 0:return typeof r!="function"?[3,2]:[4,r()];case 1:return[2,e.sent()];case 2:return[2,r]}})})}n(IE,"resolveConfigValue");xr.resolveConfigValue=IE;function RE(r){return typeof r=="function"?r():r}n(RE,"resolveConfigValueSync");xr.resolveConfigValueSync=RE});var X_=l(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.deprecateClass=void 0;var Vc=(_(),g(y));function DE(r,e){var t=!1;return function(i){Vc.__extends(a,i);function a(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return t||(console.warn(e),t=!0),i.apply(this,Vc.__spreadArray([],Vc.__read(o),!1))||this}return n(a,"class_1"),a}(r)}n(DE,"deprecateClass");jn.deprecateClass=DE});var eg=l(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.match=Zt.eq=void 0;var Y_=n(function(r){return{otherwise:function(){return r},on:function(){return Y_(r)}}},"matched"),zc=n(function(r){return{on:function(e,t){return e(r)?Y_(t(r)):zc(r)},otherwise:function(e){return e(r)}}},"match");Zt.match=zc;var OE=n(function(r){return function(e){return r===e}},"eq");Zt.eq=OE;zc.eq=Zt.eq});var rg=l(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.fibWithLimit=void 0;var tg=(_(),g(y));function BE(r){var e,t,i;return tg.__generator(this,function(a){switch(a.label){case 0:e=0,t=1,a.label=1;case 1:return e<r?[4,e]:[3,3];case 2:return a.sent(),i=tg.__read([t,e+t],2),e=i[0],t=i[1],[3,1];case 3:return[4,r];case 4:return a.sent(),[3,3];case 5:return[2]}})}n(BE,"fibWithLimit");kn.fibWithLimit=BE});var Fn=l(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.arrayToObject=void 0;var ig=(_(),g(y));function UE(r,e){return Object.assign.apply(Object,ig.__spreadArray([{}],ig.__read(r.map(e)),!1))}n(UE,"arrayToObject");Ln.arrayToObject=UE});var ng=l(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.entriesToObject=void 0;var jE=(_(),g(y)),kE=Fn();function LE(r){return(0,kE.arrayToObject)(r,function(e){var t,i=jE.__read(e,2),a=i[0],o=i[1];return t={},t[a]=o,t})}n(LE,"entriesToObject");Mn.entriesToObject=LE});var ag=l(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.forEachObjectEntry=void 0;var FE=(_(),g(y));function ME(r,e){Object.entries(r).forEach(function(t){var i=FE.__read(t,2),a=i[0],o=i[1];return e(o,a)})}n(ME,"forEachObjectEntry");Nn.forEachObjectEntry=ME});var og=l(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.groupBy=void 0;var NE=(_(),g(y));function GE(r,e){var t,i,a;if(typeof e!="function"){var o=e;e=n(function(f){return f[o].toString()},"keyFn")}var s={};try{for(var u=NE.__values(r),c=u.next();!c.done;c=u.next()){var p=c.value,h=e(p);((a=s[h])!==null&&a!==void 0?a:s[h]=[]).push(p)}}catch(f){t={error:f}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}return s}n(GE,"groupBy");Gn.groupBy=GE});var sg=l(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.indexBy=void 0;var QE=Fn();function $E(r,e){if(typeof e!="function"){var t=e;e=n(function(i){return i[t].toString()},"keyFn")}return(0,QE.arrayToObject)(r,function(i){var a;return a={},a[e(i)]=i,a})}n($E,"indexBy");Qn.indexBy=$E});var ug=l($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.mapObject=void 0;var Kc=(_(),g(y));function WE(r,e){var t=Object.entries(r).map(function(i){var a,o=Kc.__read(i,2),s=o[0],u=o[1];return a={},a[s]=e(u,s),a});return Object.assign.apply(Object,Kc.__spreadArray([{}],Kc.__read(t),!1))}n(WE,"mapObject");$n.mapObject=WE});var Jc=l(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.pick=void 0;var Wn=(_(),g(y));function VE(r,e){return Object.assign.apply(Object,Wn.__spreadArray([{}],Wn.__read(Object.entries(r).filter(function(t){var i=Wn.__read(t,1),a=i[0];return e.includes(a)}).map(function(t){var i,a=Wn.__read(t,2),o=a[0],s=a[1];return i={},i[o]=s,i})),!1))}n(VE,"pick");Vn.pick=VE});var lg=l(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.omit=void 0;var zE=Jc();function KE(r,e){return(0,zE.pick)(r,Object.keys(r).filter(function(t){return!e.includes(t)}))}n(KE,"omit");zn.omit=KE});var cg=l(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.mapOptional=Ct.mapNullable=Ct.isNullish=void 0;function Zc(r){return r==null}n(Zc,"isNullish");Ct.isNullish=Zc;function JE(r,e){return Zc(r)?null:e(r)}n(JE,"mapNullable");Ct.mapNullable=JE;function ZE(r,e){return Zc(r)?void 0:e(r)}n(ZE,"mapOptional");Ct.mapOptional=ZE});var pg=l(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.delay=void 0;var dg=(_(),g(y));function XE(r){return dg.__awaiter(this,void 0,void 0,function(){return dg.__generator(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t){return setTimeout(t,r)})];case 1:return e.sent(),[2]}})})}n(XE,"delay");Kn.delay=XE});var hg=l(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.promiseWithResolvers=void 0;function YE(){var r,e,t=new Promise(function(i,a){r=i,e=a});return{promise:t,resolve:r,reject:e}}n(YE,"promiseWithResolvers");Jn.promiseWithResolvers=YE});var fg=l(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.padLeft=void 0;function eA(r,e,t){if(typeof r=="number"&&(r=r.toString()),e=e-r.length,e<=0)return r;t===void 0&&(t=" ");var i="";do(e&1)===1&&(i+=t),e>>=1,e&&(t+=t);while(e);return i+r}n(eA,"padLeft");Zn.padLeft=eA});var mg=l(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.splitWithLimit=void 0;var Xc=(_(),g(y));function tA(r,e,t){var i=r.split(e);return i.length<=t?i:Xc.__spreadArray(Xc.__spreadArray([],Xc.__read(i.slice(0,t-1)),!1),[i.slice(t-1).join(e)],!1)}n(tA,"splitWithLimit");Xn.splitWithLimit=tA});var yg=l(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.utf8Substring=Sr.utf8Length=void 0;var Yn=(_(),g(y));function rA(r){return Yn.__spreadArray([],Yn.__read(r),!1).length}n(rA,"utf8Length");Sr.utf8Length=rA;function iA(r,e,t){return Yn.__spreadArray([],Yn.__read(r),!1).slice(e,t).join("")}n(iA,"utf8Substring");Sr.utf8Substring=iA});var S=l(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.utf8Substring=q.utf8Length=q.splitWithLimit=q.padLeft=q.promiseWithResolvers=q.delay=q.mapOptional=q.mapNullable=q.isNullish=q.pick=q.omit=q.mapObject=q.indexBy=q.groupBy=q.forEachObjectEntry=q.entriesToObject=q.arrayToObject=q.fibWithLimit=q.eq=q.match=q.deprecateClass=q.resolveConfigValueSync=q.resolveConfigValue=q.partitionedFlatMap=q.flatten=q.Enumerable=void 0;var nA=W_();Object.defineProperty(q,"Enumerable",{enumerable:!0,get:function(){return nA.Enumerable}});var aA=z_();Object.defineProperty(q,"flatten",{enumerable:!0,get:function(){return aA.flatten}});var oA=K_();Object.defineProperty(q,"partitionedFlatMap",{enumerable:!0,get:function(){return oA.partitionedFlatMap}});var _g=Z_();Object.defineProperty(q,"resolveConfigValue",{enumerable:!0,get:function(){return _g.resolveConfigValue}});Object.defineProperty(q,"resolveConfigValueSync",{enumerable:!0,get:function(){return _g.resolveConfigValueSync}});var sA=X_();Object.defineProperty(q,"deprecateClass",{enumerable:!0,get:function(){return sA.deprecateClass}});var gg=eg();Object.defineProperty(q,"match",{enumerable:!0,get:function(){return gg.match}});Object.defineProperty(q,"eq",{enumerable:!0,get:function(){return gg.eq}});var uA=rg();Object.defineProperty(q,"fibWithLimit",{enumerable:!0,get:function(){return uA.fibWithLimit}});var lA=Fn();Object.defineProperty(q,"arrayToObject",{enumerable:!0,get:function(){return lA.arrayToObject}});var cA=ng();Object.defineProperty(q,"entriesToObject",{enumerable:!0,get:function(){return cA.entriesToObject}});var dA=ag();Object.defineProperty(q,"forEachObjectEntry",{enumerable:!0,get:function(){return dA.forEachObjectEntry}});var pA=og();Object.defineProperty(q,"groupBy",{enumerable:!0,get:function(){return pA.groupBy}});var hA=sg();Object.defineProperty(q,"indexBy",{enumerable:!0,get:function(){return hA.indexBy}});var fA=ug();Object.defineProperty(q,"mapObject",{enumerable:!0,get:function(){return fA.mapObject}});var mA=lg();Object.defineProperty(q,"omit",{enumerable:!0,get:function(){return mA.omit}});var yA=Jc();Object.defineProperty(q,"pick",{enumerable:!0,get:function(){return yA.pick}});var Yc=cg();Object.defineProperty(q,"isNullish",{enumerable:!0,get:function(){return Yc.isNullish}});Object.defineProperty(q,"mapNullable",{enumerable:!0,get:function(){return Yc.mapNullable}});Object.defineProperty(q,"mapOptional",{enumerable:!0,get:function(){return Yc.mapOptional}});var _A=pg();Object.defineProperty(q,"delay",{enumerable:!0,get:function(){return _A.delay}});var gA=hg();Object.defineProperty(q,"promiseWithResolvers",{enumerable:!0,get:function(){return gA.promiseWithResolvers}});var bA=fg();Object.defineProperty(q,"padLeft",{enumerable:!0,get:function(){return bA.padLeft}});var vA=mg();Object.defineProperty(q,"splitWithLimit",{enumerable:!0,get:function(){return vA.splitWithLimit}});var bg=yg();Object.defineProperty(q,"utf8Length",{enumerable:!0,get:function(){return bg.utf8Length}});Object.defineProperty(q,"utf8Substring",{enumerable:!0,get:function(){return bg.utf8Substring}})});var id=l(ta=>{"use strict";var ed,td;Object.defineProperty(ta,"__esModule",{value:!0});ta.getMinLogLevelFromEnv=void 0;var wA=Jt(),ea=typeof process>"u"?[]:(td=(ed=process.env.LOGGING)===null||ed===void 0?void 0:ed.split(";").map(function(r){var e=r.split("=",2),t=e[0],i=e[1];return i?[t==="default"?void 0:t.split(":"),(0,wA.resolveLogLevel)(i)]:null}).filter(function(r){return!!r}).sort(function(r,e){var t,i,a=r[0],o=e[0];return((t=o?.length)!==null&&t!==void 0?t:0)-((i=a?.length)!==null&&i!==void 0?i:0)}))!==null&&td!==void 0?td:[],rd=ea.findIndex(function(r){var e=r[0];return!e}),vg=void 0;rd!==-1&&(vg=ea[rd][1],ea.splice(rd));function xA(r,e){return e.length<=r.length&&e.every(function(t,i){return t===r[i]})}n(xA,"isPrefix");function SA(r){for(var e=r.split(":"),t=0,i=ea;t<i.length;t++){var a=i[t],o=a[0],s=a[1];if(xA(e,o))return s}return vg}n(SA,"getMinLogLevelFromEnv");ta.getMinLogLevelFromEnv=SA});var nd=l(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.BaseLogger=void 0;var qA=S(),PA=wi(),CA=id(),Ht=Jt(),HA=function(){function r(e){var t=e.name,i=e.minLevel,a=e.emoji,o=a===void 0?!1:a,s=e.colors,u=e.timestamps,c=u===void 0?PA.isNode:u,p,h;this._name=t,this._minLevel=(h=(p=(0,qA.mapOptional)(i,function(f){return(0,Ht.resolveLogLevel)(f)}))!==null&&p!==void 0?p:(0,CA.getMinLogLevelFromEnv)(t))!==null&&h!==void 0?h:Ht.LogLevel.WARNING,this._emoji=o,this._colors=s,this._timestamps=c}return n(r,"BaseLogger"),r.prototype.crit=function(e){this.log(Ht.LogLevel.CRITICAL,e)},r.prototype.error=function(e){this.log(Ht.LogLevel.ERROR,e)},r.prototype.warn=function(e){this.log(Ht.LogLevel.WARNING,e)},r.prototype.info=function(e){this.log(Ht.LogLevel.INFO,e)},r.prototype.debug=function(e){this.log(Ht.LogLevel.DEBUG,e)},r.prototype.trace=function(e){this.log(Ht.LogLevel.TRACE,e)},r}();ra.BaseLogger=HA});var wg=l(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.BrowserLogger=void 0;var EA=(_(),g(y)),AA=Jt(),TA=nd(),IA=function(r){EA.__extends(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return n(e,"BrowserLogger"),e.prototype.log=function(t,i){if(!(t>this._minLevel)){var a=AA.LogLevelToConsoleFunction[t],o="[".concat(this._name,"] ").concat(i);this._timestamps&&(o="[".concat(new Date().toISOString(),"] ").concat(i)),a(o)}},e}(TA.BaseLogger);ia.BrowserLogger=IA});var xg=l(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.CustomLoggerWrapper=void 0;var RA=S(),DA=id(),Ce=Jt(),OA=function(){function r(e){var t=e.name,i=e.minLevel,a=e.custom,o;this._minLevel=(o=(0,RA.mapOptional)(i,function(s){return(0,Ce.resolveLogLevel)(s)}))!==null&&o!==void 0?o:(0,DA.getMinLogLevelFromEnv)(t),this._override=typeof a=="function"?{log:a}:a}return n(r,"CustomLoggerWrapper"),r.prototype.log=function(e,t){this._shouldLog(e)&&this._override.log(e,t)},r.prototype.crit=function(e){this._override.crit?this._shouldLog(Ce.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Ce.LogLevel.CRITICAL,e)},r.prototype.error=function(e){this._override.error?this._shouldLog(Ce.LogLevel.ERROR)&&this._override.error(e):this.log(Ce.LogLevel.ERROR,e)},r.prototype.warn=function(e){this._override.warn?this._shouldLog(Ce.LogLevel.WARNING)&&this._override.warn(e):this.log(Ce.LogLevel.WARNING,e)},r.prototype.info=function(e){this._override.info?this._shouldLog(Ce.LogLevel.INFO)&&this._override.info(e):this.log(Ce.LogLevel.INFO,e)},r.prototype.debug=function(e){this._override.debug?this._shouldLog(Ce.LogLevel.DEBUG)&&this._override.debug(e):this.log(Ce.LogLevel.DEBUG,e)},r.prototype.trace=function(e){this._override.trace?this._shouldLog(Ce.LogLevel.TRACE)&&this._override.trace(e):this.log(Ce.LogLevel.TRACE,e)},r.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},r}();na.CustomLoggerWrapper=OA});var Sg=l(ge=>{"use strict";var Et,At,Tt;Object.defineProperty(ge,"__esModule",{value:!0});ge.NodeLogger=ge.LogLevelToBackgroundColor=ge.LogLevelToColor=ge.LogLevelToEmoji=void 0;var BA=(_(),g(y)),K=Jt(),UA=nd();ge.LogLevelToEmoji=(Et={},Et[K.LogLevel.CRITICAL]="\u{1F6D1}",Et[K.LogLevel.ERROR]="\u274C",Et[K.LogLevel.WARNING]="\u26A0\uFE0F ",Et[K.LogLevel.INFO]="\u2139\uFE0F ",Et[K.LogLevel.DEBUG]="\u{1F41E}",Et[K.LogLevel.TRACE]="\u{1F43E}",Et);var jA={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,blackBright:90,redBright:91,greenBright:92,yellowBright:93,blueBright:94,magentaBright:95,cyanBright:96,whiteBright:97},kA={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBlackBright:100,bgRedBright:101,bgGreenBright:102,bgYellowBright:103,bgBlueBright:104,bgMagentaBright:105,bgCyanBright:106,bgWhiteBright:107};function aa(r,e,t){return function(i){return"\x1B[".concat(r,"m").concat(t?t(i):i,"\x1B[").concat(e,"m")}}n(aa,"createGenericWrapper");function Ke(r){return aa(jA[r],39)}n(Ke,"createColorWrapper");function xi(r,e){return aa(kA[r],49,e)}n(xi,"createBgWrapper");ge.LogLevelToColor=(At={},At[K.LogLevel.CRITICAL]=Ke("red"),At[K.LogLevel.ERROR]=Ke("redBright"),At[K.LogLevel.WARNING]=Ke("yellow"),At[K.LogLevel.INFO]=Ke("blue"),At[K.LogLevel.DEBUG]=Ke("magenta"),At[K.LogLevel.TRACE]=aa(0,0),At);ge.LogLevelToBackgroundColor=(Tt={},Tt[K.LogLevel.CRITICAL]=xi("bgRed",Ke("white")),Tt[K.LogLevel.ERROR]=xi("bgRedBright",Ke("white")),Tt[K.LogLevel.WARNING]=xi("bgYellow",Ke("black")),Tt[K.LogLevel.INFO]=xi("bgBlue",Ke("white")),Tt[K.LogLevel.DEBUG]=xi("bgMagenta",Ke("black")),Tt[K.LogLevel.TRACE]=aa(7,27),Tt);var LA=function(r){BA.__extends(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return n(e,"NodeLogger"),e.prototype.log=function(t,i){var a,o,s;if(!(t>this._minLevel)){var u=K.LogLevelToConsoleFunction[t],c="";if(this._timestamps&&(c+="[".concat(new Date().toISOString(),"] ")),this._emoji){var p=ge.LogLevelToEmoji[t];c+="".concat(p," ")}var h=(s=(a=this._colors)!==null&&a!==void 0?a:(o=process.stdout)===null||o===void 0?void 0:o.isTTY)!==null&&s!==void 0?s:!0;h?c+="".concat(ge.LogLevelToBackgroundColor[t](this._name)," ").concat(ge.LogLevelToBackgroundColor[t](K.LogLevel[t])," ").concat(ge.LogLevelToColor[t](i)):c+="[".concat(this._name,":").concat(K.LogLevel[t].toLowerCase(),"] ").concat(i),u(c)}},e}(UA.BaseLogger);ge.NodeLogger=LA});var qg=l(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.createLogger=void 0;var FA=wi(),MA=wg(),NA=xg(),GA=Sg();function QA(r){return r.custom?new NA.CustomLoggerWrapper(r):FA.isNode?new GA.NodeLogger(r):new MA.BrowserLogger(r)}n(QA,"createLogger");oa.createLogger=QA});var Si=l(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.LogLevel=qr.createLogger=void 0;var $A=qg();Object.defineProperty(qr,"createLogger",{enumerable:!0,get:function(){return $A.createLogger}});var WA=Jt();Object.defineProperty(qr,"LogLevel",{enumerable:!0,get:function(){return WA.LogLevel}})});var od=l(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.CustomError=void 0;var ad=(_(),g(y)),VA=function(r){ad.__extends(e,r);function e(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var a=this.constructor,o=this,s;return o=r.apply(this,ad.__spreadArray([],ad.__read(t),!1))||this,Object.setPrototypeOf(o,a.prototype),(s=Error.captureStackTrace)===null||s===void 0||s.call(Error,o,a.constructor),o}return n(e,"CustomError"),Object.defineProperty(e.prototype,"name",{get:function(){return this.constructor.name},enumerable:!1,configurable:!0}),e}(Error);sa.CustomError=VA});var sd=l(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.RetryAfterError=void 0;var zA=(_(),g(y)),KA=od(),JA=function(r){zA.__extends(e,r);function e(t){var i=r.call(this,"Need to retry after ".concat(t," ms"))||this;return i._retryAt=Date.now()+t,i}return n(e,"RetryAfterError"),Object.defineProperty(e.prototype,"retryAt",{get:function(){return this._retryAt},enumerable:!1,configurable:!0}),e}(KA.CustomError);ua.RetryAfterError=JA});var qi=l(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.RateLimitReachedError=void 0;var ZA=(_(),g(y)),XA=od(),YA=function(r){ZA.__extends(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return n(e,"RateLimitReachedError"),e}(XA.CustomError);la.RateLimitReachedError=YA});var Cg=l(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.NullRateLimiter=void 0;var Pg=(_(),g(y)),eT=function(){function r(e){this._callback=e}return n(r,"NullRateLimiter"),r.prototype.request=function(e){return Pg.__awaiter(this,void 0,void 0,function(){return Pg.__generator(this,function(t){switch(t.label){case 0:return[4,this._callback(e)];case 1:return[2,t.sent()]}})})},r.prototype.clear=function(){},r.prototype.pause=function(){},r.prototype.resume=function(){},r}();ca.NullRateLimiter=eT});var Ag=l((Q$,Eg)=>{"use strict";var tT="Function.prototype.bind called on incompatible ",rT=Object.prototype.toString,iT=Math.max,nT="[object Function]",Hg=n(function(e,t){for(var i=[],a=0;a<e.length;a+=1)i[a]=e[a];for(var o=0;o<t.length;o+=1)i[o+e.length]=t[o];return i},"concatty"),aT=n(function(e,t){for(var i=[],a=t||0,o=0;a<e.length;a+=1,o+=1)i[o]=e[a];return i},"slicy"),oT=n(function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t},"joiny");Eg.exports=n(function(e){var t=this;if(typeof t!="function"||rT.apply(t)!==nT)throw new TypeError(tT+t);for(var i=aT(arguments,1),a,o=n(function(){if(this instanceof a){var h=t.apply(this,Hg(i,arguments));return Object(h)===h?h:this}return t.apply(e,Hg(i,arguments))},"binder"),s=iT(0,t.length-i.length),u=[],c=0;c<s;c++)u[c]="$"+c;if(a=Function("binder","return function ("+oT(u,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var p=n(function(){},"Empty");p.prototype=t.prototype,a.prototype=new p,p.prototype=null}return a},"bind")});var da=l((W$,Tg)=>{"use strict";var sT=Ag();Tg.exports=Function.prototype.bind||sT});var pa=l((V$,Ig)=>{"use strict";Ig.exports=n(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==a||s.enumerable!==!0)return!1}return!0},"hasSymbols")});var ha=l((K$,Dg)=>{"use strict";var Rg=typeof Symbol<"u"&&Symbol,uT=pa();Dg.exports=n(function(){return typeof Rg!="function"||typeof Symbol!="function"||typeof Rg("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:uT()},"hasNativeSymbols")});var ud=l((Z$,Bg)=>{"use strict";var Og={foo:{}},lT=Object;Bg.exports=n(function(){return{__proto__:Og}.foo===Og.foo&&!({__proto__:null}instanceof lT)},"hasProto")});var ct=l((Y$,Ug)=>{"use strict";var cT=Function.prototype.call,dT=Object.prototype.hasOwnProperty,pT=da();Ug.exports=pT.call(cT,dT)});var T=l((eW,Mg)=>{"use strict";var I,Er=SyntaxError,Fg=Function,Hr=TypeError,ld=n(function(r){try{return Fg('"use strict"; return ('+r+").constructor;")()}catch{}},"getEvalledConstructor"),Xt=Object.getOwnPropertyDescriptor;if(Xt)try{Xt({},"")}catch{Xt=null}var cd=n(function(){throw new Hr},"throwTypeError"),hT=Xt?function(){try{return arguments.callee,cd}catch{try{return Xt(arguments,"callee").get}catch{return cd}}}():cd,Pr=ha()(),fT=ud()(),ie=Object.getPrototypeOf||(fT?function(r){return r.__proto__}:null),Cr={},mT=typeof Uint8Array>"u"||!ie?I:ie(Uint8Array),Yt={"%AggregateError%":typeof AggregateError>"u"?I:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?I:ArrayBuffer,"%ArrayIteratorPrototype%":Pr&&ie?ie([][Symbol.iterator]()):I,"%AsyncFromSyncIteratorPrototype%":I,"%AsyncFunction%":Cr,"%AsyncGenerator%":Cr,"%AsyncGeneratorFunction%":Cr,"%AsyncIteratorPrototype%":Cr,"%Atomics%":typeof Atomics>"u"?I:Atomics,"%BigInt%":typeof BigInt>"u"?I:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?I:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?I:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?I:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?I:Float32Array,"%Float64Array%":typeof Float64Array>"u"?I:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?I:FinalizationRegistry,"%Function%":Fg,"%GeneratorFunction%":Cr,"%Int8Array%":typeof Int8Array>"u"?I:Int8Array,"%Int16Array%":typeof Int16Array>"u"?I:Int16Array,"%Int32Array%":typeof Int32Array>"u"?I:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Pr&&ie?ie(ie([][Symbol.iterator]())):I,"%JSON%":typeof JSON=="object"?JSON:I,"%Map%":typeof Map>"u"?I:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Pr||!ie?I:ie(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?I:Promise,"%Proxy%":typeof Proxy>"u"?I:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?I:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?I:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Pr||!ie?I:ie(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?I:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Pr&&ie?ie(""[Symbol.iterator]()):I,"%Symbol%":Pr?Symbol:I,"%SyntaxError%":Er,"%ThrowTypeError%":hT,"%TypedArray%":mT,"%TypeError%":Hr,"%Uint8Array%":typeof Uint8Array>"u"?I:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?I:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?I:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?I:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?I:WeakMap,"%WeakRef%":typeof WeakRef>"u"?I:WeakRef,"%WeakSet%":typeof WeakSet>"u"?I:WeakSet};if(ie)try{null.error}catch(r){jg=ie(ie(r)),Yt["%Error.prototype%"]=jg}var jg,yT=n(function r(e){var t;if(e==="%AsyncFunction%")t=ld("async function () {}");else if(e==="%GeneratorFunction%")t=ld("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ld("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&ie&&(t=ie(a.prototype))}return Yt[e]=t,t},"doEval"),kg={"%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"]},Pi=da(),fa=ct(),_T=Pi.call(Function.call,Array.prototype.concat),gT=Pi.call(Function.apply,Array.prototype.splice),Lg=Pi.call(Function.call,String.prototype.replace),ma=Pi.call(Function.call,String.prototype.slice),bT=Pi.call(Function.call,RegExp.prototype.exec),vT=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,wT=/\\(\\)?/g,xT=n(function(e){var t=ma(e,0,1),i=ma(e,-1);if(t==="%"&&i!=="%")throw new Er("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Er("invalid intrinsic syntax, expected opening `%`");var a=[];return Lg(e,vT,function(o,s,u,c){a[a.length]=u?Lg(c,wT,"$1"):s||o}),a},"stringToPath"),ST=n(function(e,t){var i=e,a;if(fa(kg,i)&&(a=kg[i],i="%"+a[0]+"%"),fa(Yt,i)){var o=Yt[i];if(o===Cr&&(o=yT(i)),typeof o>"u"&&!t)throw new Hr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:o}}throw new Er("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");Mg.exports=n(function(e,t){if(typeof e!="string"||e.length===0)throw new Hr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Hr('"allowMissing" argument must be a boolean');if(bT(/^%?[^%]*%?$/,e)===null)throw new Er("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=xT(e),a=i.length>0?i[0]:"",o=ST("%"+a+"%",t),s=o.name,u=o.value,c=!1,p=o.alias;p&&(a=p[0],gT(i,_T([0,1],p)));for(var h=1,f=!0;h<i.length;h+=1){var b=i[h],P=ma(b,0,1),w=ma(b,-1);if((P==='"'||P==="'"||P==="`"||w==='"'||w==="'"||w==="`")&&P!==w)throw new Er("property names with quotes must have matching quotes");if((b==="constructor"||!f)&&(c=!0),a+="."+b,s="%"+a+"%",fa(Yt,s))u=Yt[s];else if(u!=null){if(!(b in u)){if(!t)throw new Hr("base intrinsic for "+e+" exists, but the property is not available.");return}if(Xt&&h+1>=i.length){var x=Xt(u,b);f=!!x,f&&"get"in x&&!("originalValue"in x.get)?u=x.get:u=u[b]}else f=fa(u,b),u=u[b];f&&!c&&(Yt[s]=u)}}return u},"GetIntrinsic")});var Ci=l((rW,Ng)=>{"use strict";var qT=T(),dd=qT("%Object.defineProperty%",!0),pd=n(function(){if(dd)try{return dd({},"a",{value:1}),!0}catch{return!1}return!1},"hasPropertyDescriptors");pd.hasArrayLengthDefineBug=n(function(){if(!pd())return null;try{return dd([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");Ng.exports=pd});var _a=l((nW,Gg)=>{"use strict";var PT=T(),ya=PT("%Object.getOwnPropertyDescriptor%",!0);if(ya)try{ya([],"length")}catch{ya=null}Gg.exports=ya});var fd=l((aW,$g)=>{"use strict";var CT=Ci()(),hd=T(),Hi=CT&&hd("%Object.defineProperty%",!0);if(Hi)try{Hi({},"a",{value:1})}catch{Hi=!1}var HT=hd("%SyntaxError%"),Ar=hd("%TypeError%"),Qg=_a();$g.exports=n(function(e,t,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Ar("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Ar("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ar("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ar("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ar("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ar("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,c=!!Qg&&Qg(e,t);if(Hi)Hi(e,t,{configurable:s===null&&c?c.configurable:!s,enumerable:a===null&&c?c.enumerable:!a,value:i,writable:o===null&&c?c.writable:!o});else if(u||!a&&!o&&!s)e[t]=i;else throw new HT("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var Zg=l((sW,Jg)=>{"use strict";var Kg=T(),Wg=fd(),ET=Ci()(),Vg=_a(),zg=Kg("%TypeError%"),AT=Kg("%Math.floor%");Jg.exports=n(function(e,t){if(typeof e!="function")throw new zg("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||AT(t)!==t)throw new zg("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],a=!0,o=!0;if("length"in e&&Vg){var s=Vg(e,"length");s&&!s.configurable&&(a=!1),s&&!s.writable&&(o=!1)}return(a||o||!i)&&(ET?Wg(e,"length",t,!0,!0):Wg(e,"length",t)),e},"setFunctionLength")});var Ir=l((lW,ga)=>{"use strict";var md=da(),Tr=T(),TT=Zg(),IT=Tr("%TypeError%"),Yg=Tr("%Function.prototype.apply%"),eb=Tr("%Function.prototype.call%"),tb=Tr("%Reflect.apply%",!0)||md.call(eb,Yg),Ei=Tr("%Object.defineProperty%",!0),RT=Tr("%Math.max%");if(Ei)try{Ei({},"a",{value:1})}catch{Ei=null}ga.exports=n(function(e){if(typeof e!="function")throw new IT("a function is required");var t=tb(md,eb,arguments);return TT(t,1+RT(0,e.length-(arguments.length-1)),!0)},"callBind");var Xg=n(function(){return tb(md,Yg,arguments)},"applyBind");Ei?Ei(ga.exports,"apply",{value:Xg}):ga.exports.apply=Xg});var yd=l((dW,ib)=>{"use strict";var rb=Object.prototype.toString;ib.exports=n(function(e){var t=rb.call(e),i=t==="[object Arguments]";return i||(i=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&rb.call(e.callee)==="[object Function]"),i},"isArguments")});var pb=l((hW,db)=>{"use strict";var cb;Object.keys||(Ai=Object.prototype.hasOwnProperty,_d=Object.prototype.toString,nb=yd(),gd=Object.prototype.propertyIsEnumerable,ab=!gd.call({toString:null},"toString"),ob=gd.call(function(){},"prototype"),Ti=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ba=n(function(r){var e=r.constructor;return e&&e.prototype===r},"equalsConstructorPrototype"),sb={$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},ub=function(){if(typeof window>"u")return!1;for(var r in window)try{if(!sb["$"+r]&&Ai.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{ba(window[r])}catch{return!0}}catch{return!0}return!1}(),lb=n(function(r){if(typeof window>"u"||!ub)return ba(r);try{return ba(r)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),cb=n(function(e){var t=e!==null&&typeof e=="object",i=_d.call(e)==="[object Function]",a=nb(e),o=t&&_d.call(e)==="[object String]",s=[];if(!t&&!i&&!a)throw new TypeError("Object.keys called on a non-object");var u=ob&&i;if(o&&e.length>0&&!Ai.call(e,0))for(var c=0;c<e.length;++c)s.push(String(c));if(a&&e.length>0)for(var p=0;p<e.length;++p)s.push(String(p));else for(var h in e)!(u&&h==="prototype")&&Ai.call(e,h)&&s.push(String(h));if(ab)for(var f=lb(e),b=0;b<Ti.length;++b)!(f&&Ti[b]==="constructor")&&Ai.call(e,Ti[b])&&s.push(Ti[b]);return s},"keys"));var Ai,_d,nb,gd,ab,ob,Ti,ba,sb,ub,lb;db.exports=cb});var yb=l((mW,mb)=>{"use strict";var DT=Array.prototype.slice,OT=yd(),hb=Object.keys,va=hb?n(function(e){return hb(e)},"keys"):pb(),fb=Object.keys;va.shim=n(function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=n(function(i){return OT(i)?fb(DT.call(i)):fb(i)},"keys"))}else Object.keys=va;return Object.keys||va},"shimObjectKeys");mb.exports=va});var er=l((_W,vb)=>{"use strict";var BT=yb(),UT=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",jT=Object.prototype.toString,kT=Array.prototype.concat,_b=fd(),LT=n(function(r){return typeof r=="function"&&jT.call(r)==="[object Function]"},"isFunction"),gb=Ci()(),FT=n(function(r,e,t,i){if(e in r){if(i===!0){if(r[e]===t)return}else if(!LT(i)||!i())return}gb?_b(r,e,t,!0):_b(r,e,t)},"defineProperty"),bb=n(function(r,e){var t=arguments.length>2?arguments[2]:{},i=BT(e);UT&&(i=kT.call(i,Object.getOwnPropertySymbols(e)));for(var a=0;a<i.length;a+=1)FT(r,i[a],e[i[a]],t[i[a]])},"defineProperties");bb.supportsDescriptors=!!gb;vb.exports=bb});var Ii=l((bW,wb)=>{"use strict";wb.exports=n(function(){if(typeof Promise!="function")throw new TypeError("`Promise.allSettled` requires a global `Promise` be available.")},"requirePromise")});var Pb=l((wW,qb)=>{"use strict";var MT=T(),NT=Ir(),xb=MT("%Promise.resolve%",!0),Sb=xb&&NT(xb);qb.exports=n(function(e,t){if(!Sb)throw new SyntaxError("This environment does not support Promises.");return Sb(e,t)},"PromiseResolve")});var bd=l((SW,Cb)=>{"use strict";Cb.exports=n(function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(typeof e=="function"||typeof e=="object")return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},"Type")});var Eb=l((PW,Hb)=>{"use strict";var GT=bd();Hb.exports=n(function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":GT(e)},"Type")});var Ri=l((HW,Ab)=>{"use strict";var QT=pa();Ab.exports=n(function(){return QT()&&!!Symbol.toStringTag},"hasToStringTagShams")});var He=l((AW,Rb)=>{"use strict";var Tb=T(),Ib=Ir(),$T=Ib(Tb("String.prototype.indexOf"));Rb.exports=n(function(e,t){var i=Tb(e,!!t);return typeof i=="function"&&$T(e,".prototype.")>-1?Ib(i):i},"callBoundIntrinsic")});var Bb=l((IW,Ob)=>{"use strict";var WT=Ri()(),VT=He(),vd=VT("Object.prototype.toString"),wa=n(function(e){return WT&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:vd(e)==="[object Arguments]"},"isArguments"),Db=n(function(e){return wa(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&vd(e)!=="[object Array]"&&vd(e.callee)==="[object Function]"},"isArguments"),zT=function(){return wa(arguments)}();wa.isLegacyArguments=Db;Ob.exports=zT?wa:Db});var Ub=l(()=>{});var Dd=l((BW,tv)=>{var Td=typeof Map=="function"&&Map.prototype,wd=Object.getOwnPropertyDescriptor&&Td?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Sa=Td&&wd&&typeof wd.get=="function"?wd.get:null,jb=Td&&Map.prototype.forEach,Id=typeof Set=="function"&&Set.prototype,xd=Object.getOwnPropertyDescriptor&&Id?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,qa=Id&&xd&&typeof xd.get=="function"?xd.get:null,kb=Id&&Set.prototype.forEach,KT=typeof WeakMap=="function"&&WeakMap.prototype,Oi=KT?WeakMap.prototype.has:null,JT=typeof WeakSet=="function"&&WeakSet.prototype,Bi=JT?WeakSet.prototype.has:null,ZT=typeof WeakRef=="function"&&WeakRef.prototype,Lb=ZT?WeakRef.prototype.deref:null,XT=Boolean.prototype.valueOf,YT=Object.prototype.toString,e1=Function.prototype.toString,t1=String.prototype.match,Rd=String.prototype.slice,Rt=String.prototype.replace,r1=String.prototype.toUpperCase,Fb=String.prototype.toLowerCase,Kb=RegExp.prototype.test,Mb=Array.prototype.concat,Je=Array.prototype.join,i1=Array.prototype.slice,Nb=Math.floor,Pd=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Sd=Object.getOwnPropertySymbols,Cd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Rr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",he=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Rr||!0)?Symbol.toStringTag:null,Jb=Object.prototype.propertyIsEnumerable,Gb=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Qb(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Kb.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Nb(-r):Nb(r);if(i!==r){var a=String(i),o=Rd.call(e,a.length+1);return Rt.call(a,t,"$&_")+"."+Rt.call(Rt.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Rt.call(e,t,"$&_")}n(Qb,"addNumericSeparator");var Hd=Ub(),$b=Hd.custom,Wb=Xb($b)?$b:null;tv.exports=n(function r(e,t,i,a){var o=t||{};if(It(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(It(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 s=It(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(It(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(It(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=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 ev(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return u?Qb(e,c):c}if(typeof e=="bigint"){var p=String(e)+"n";return u?Qb(e,p):p}var h=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=h&&h>0&&typeof e=="object")return Ed(e)?"[Array]":"[Object]";var f=w1(o,i);if(typeof a>"u")a=[];else if(Yb(a,e)>=0)return"[Circular]";function b(mr,wn,MC){if(wn&&(a=i1.call(a),a.push(wn)),MC){var Dy={depth:o.depth};return It(o,"quoteStyle")&&(Dy.quoteStyle=o.quoteStyle),r(mr,Dy,i+1,a)}return r(mr,o,i+1,a)}if(n(b,"inspect"),typeof e=="function"&&!Vb(e)){var P=p1(e),w=xa(e,b);return"[Function"+(P?": "+P:" (anonymous)")+"]"+(w.length>0?" { "+Je.call(w,", ")+" }":"")}if(Xb(e)){var x=Rr?Rt.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Cd.call(e);return typeof e=="object"&&!Rr?Di(x):x}if(g1(e)){for(var E="<"+Fb.call(String(e.nodeName)),R=e.attributes||[],Y=0;Y<R.length;Y++)E+=" "+R[Y].name+"="+Zb(n1(R[Y].value),"double",o);return E+=">",e.childNodes&&e.childNodes.length&&(E+="..."),E+="</"+Fb.call(String(e.nodeName))+">",E}if(Ed(e)){if(e.length===0)return"[]";var z=xa(e,b);return f&&!v1(z)?"["+Ad(z,f)+"]":"[ "+Je.call(z,", ")+" ]"}if(o1(e)){var re=xa(e,b);return!("cause"in Error.prototype)&&"cause"in e&&!Jb.call(e,"cause")?"{ ["+String(e)+"] "+Je.call(Mb.call("[cause]: "+b(e.cause),re),", ")+" }":re.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Je.call(re,", ")+" }"}if(typeof e=="object"&&s){if(Wb&&typeof e[Wb]=="function"&&Hd)return Hd(e,{depth:h-i});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(h1(e)){var Ay=[];return jb&&jb.call(e,function(mr,wn){Ay.push(b(wn,e,!0)+" => "+b(mr,e))}),zb("Map",Sa.call(e),Ay,f)}if(y1(e)){var Ty=[];return kb&&kb.call(e,function(mr){Ty.push(b(mr,e))}),zb("Set",qa.call(e),Ty,f)}if(f1(e))return qd("WeakMap");if(_1(e))return qd("WeakSet");if(m1(e))return qd("WeakRef");if(u1(e))return Di(b(Number(e)));if(c1(e))return Di(b(Pd.call(e)));if(l1(e))return Di(XT.call(e));if(s1(e))return Di(b(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!a1(e)&&!Vb(e)){var hc=xa(e,b),Iy=Gb?Gb(e)===Object.prototype:e instanceof Object||e.constructor===Object,fc=e instanceof Object?"":"null prototype",Ry=!Iy&&he&&Object(e)===e&&he in e?Rd.call(Dt(e),8,-1):fc?"Object":"",FC=Iy||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",mc=FC+(Ry||fc?"["+Je.call(Mb.call([],Ry||[],fc||[]),": ")+"] ":"");return hc.length===0?mc+"{}":f?mc+"{"+Ad(hc,f)+"}":mc+"{ "+Je.call(hc,", ")+" }"}return String(e)},"inspect_");function Zb(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}n(Zb,"wrapQuotes");function n1(r){return Rt.call(String(r),/"/g,""")}n(n1,"quote");function Ed(r){return Dt(r)==="[object Array]"&&(!he||!(typeof r=="object"&&he in r))}n(Ed,"isArray");function a1(r){return Dt(r)==="[object Date]"&&(!he||!(typeof r=="object"&&he in r))}n(a1,"isDate");function Vb(r){return Dt(r)==="[object RegExp]"&&(!he||!(typeof r=="object"&&he in r))}n(Vb,"isRegExp");function o1(r){return Dt(r)==="[object Error]"&&(!he||!(typeof r=="object"&&he in r))}n(o1,"isError");function s1(r){return Dt(r)==="[object String]"&&(!he||!(typeof r=="object"&&he in r))}n(s1,"isString");function u1(r){return Dt(r)==="[object Number]"&&(!he||!(typeof r=="object"&&he in r))}n(u1,"isNumber");function l1(r){return Dt(r)==="[object Boolean]"&&(!he||!(typeof r=="object"&&he in r))}n(l1,"isBoolean");function Xb(r){if(Rr)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Cd)return!1;try{return Cd.call(r),!0}catch{}return!1}n(Xb,"isSymbol");function c1(r){if(!r||typeof r!="object"||!Pd)return!1;try{return Pd.call(r),!0}catch{}return!1}n(c1,"isBigInt");var d1=Object.prototype.hasOwnProperty||function(r){return r in this};function It(r,e){return d1.call(r,e)}n(It,"has");function Dt(r){return YT.call(r)}n(Dt,"toStr");function p1(r){if(r.name)return r.name;var e=t1.call(e1.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}n(p1,"nameOf");function Yb(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}n(Yb,"indexOf");function h1(r){if(!Sa||!r||typeof r!="object")return!1;try{Sa.call(r);try{qa.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}n(h1,"isMap");function f1(r){if(!Oi||!r||typeof r!="object")return!1;try{Oi.call(r,Oi);try{Bi.call(r,Bi)}catch{return!0}return r instanceof WeakMap}catch{}return!1}n(f1,"isWeakMap");function m1(r){if(!Lb||!r||typeof r!="object")return!1;try{return Lb.call(r),!0}catch{}return!1}n(m1,"isWeakRef");function y1(r){if(!qa||!r||typeof r!="object")return!1;try{qa.call(r);try{Sa.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}n(y1,"isSet");function _1(r){if(!Bi||!r||typeof r!="object")return!1;try{Bi.call(r,Bi);try{Oi.call(r,Oi)}catch{return!0}return r instanceof WeakSet}catch{}return!1}n(_1,"isWeakSet");function g1(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}n(g1,"isElement");function ev(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return ev(Rd.call(r,0,e.maxStringLength),e)+i}var a=Rt.call(Rt.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,b1);return Zb(a,"single",e)}n(ev,"inspectString");function b1(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+r1.call(e.toString(16))}n(b1,"lowbyte");function Di(r){return"Object("+r+")"}n(Di,"markBoxed");function qd(r){return r+" { ? }"}n(qd,"weakCollectionOf");function zb(r,e,t,i){var a=i?Ad(t,i):Je.call(t,", ");return r+" ("+e+") {"+a+"}"}n(zb,"collectionOf");function v1(r){for(var e=0;e<r.length;e++)if(Yb(r[e],`
|
|
6
|
-
`)>=0)return!1;return!0}n(v1,"singleLineValues");function w1(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Je.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Je.call(Array(e+1),t)}}n(w1,"getIndent");function Ad(r,e){if(r.length===0)return"";var t=`
|
|
7
|
-
`+e.prev+e.base;return t+Je.call(r,","+t)+`
|
|
8
|
-
`+e.prev}n(Ad,"indentedJoin");function xa(r,e){var t=Ed(r),i=[];if(t){i.length=r.length;for(var a=0;a<r.length;a++)i[a]=It(r,a)?e(r[a],r):""}var o=typeof Sd=="function"?Sd(r):[],s;if(Rr){s={};for(var u=0;u<o.length;u++)s["$"+o[u]]=o[u]}for(var c in r)It(r,c)&&(t&&String(Number(c))===c&&c<r.length||Rr&&s["$"+c]instanceof Symbol||(Kb.call(/[^\w$]/,c)?i.push(e(c,r)+": "+e(r[c],r)):i.push(c+": "+e(r[c],r))));if(typeof Sd=="function")for(var p=0;p<o.length;p++)Jb.call(r,o[p])&&i.push("["+e(o[p])+"]: "+e(r[o[p]],r));return i}n(xa,"arrObjKeys")});var iv=l((jW,rv)=>{"use strict";var Od=T(),Dr=He(),x1=Dd(),S1=Od("%TypeError%"),Pa=Od("%WeakMap%",!0),Ca=Od("%Map%",!0),q1=Dr("WeakMap.prototype.get",!0),P1=Dr("WeakMap.prototype.set",!0),C1=Dr("WeakMap.prototype.has",!0),H1=Dr("Map.prototype.get",!0),E1=Dr("Map.prototype.set",!0),A1=Dr("Map.prototype.has",!0),Bd=n(function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},"listGetNode"),T1=n(function(r,e){var t=Bd(r,e);return t&&t.value},"listGet"),I1=n(function(r,e,t){var i=Bd(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},"listSet"),R1=n(function(r,e){return!!Bd(r,e)},"listHas");rv.exports=n(function(){var e,t,i,a={assert:function(o){if(!a.has(o))throw new S1("Side channel does not contain "+x1(o))},get:function(o){if(Pa&&o&&(typeof o=="object"||typeof o=="function")){if(e)return q1(e,o)}else if(Ca){if(t)return H1(t,o)}else if(i)return T1(i,o)},has:function(o){if(Pa&&o&&(typeof o=="object"||typeof o=="function")){if(e)return C1(e,o)}else if(Ca){if(t)return A1(t,o)}else if(i)return R1(i,o);return!1},set:function(o,s){Pa&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new Pa),P1(e,o,s)):Ca?(t||(t=new Ca),E1(t,o,s)):(i||(i={key:{},next:null}),I1(i,o,s))}};return a},"getSideChannel")});var av=l((LW,nv)=>{"use strict";var D1=T(),O1=ct(),Ui=iv()(),dt=D1("%TypeError%"),Ud={assert:function(r,e){if(!r||typeof r!="object"&&typeof r!="function")throw new dt("`O` is not an object");if(typeof e!="string")throw new dt("`slot` must be a string");if(Ui.assert(r),!Ud.has(r,e))throw new dt("`"+e+"` is not present on `O`")},get:function(r,e){if(!r||typeof r!="object"&&typeof r!="function")throw new dt("`O` is not an object");if(typeof e!="string")throw new dt("`slot` must be a string");var t=Ui.get(r);return t&&t["$"+e]},has:function(r,e){if(!r||typeof r!="object"&&typeof r!="function")throw new dt("`O` is not an object");if(typeof e!="string")throw new dt("`slot` must be a string");var t=Ui.get(r);return!!t&&O1(t,"$"+e)},set:function(r,e,t){if(!r||typeof r!="object"&&typeof r!="function")throw new dt("`O` is not an object");if(typeof e!="string")throw new dt("`slot` must be a string");var i=Ui.get(r);i||(i={},Ui.set(r,i)),i["$"+e]=t}};Object.freeze&&Object.freeze(Ud);nv.exports=Ud});var uv=l((FW,sv)=>{"use strict";var ji=av(),B1=SyntaxError,ov=typeof StopIteration=="object"?StopIteration:null;sv.exports=n(function(e){if(!ov)throw new B1("this environment lacks StopIteration");ji.set(e,"[[Done]]",!1);var t={next:n(function(){var a=ji.get(this,"[[Iterator]]"),o=ji.get(a,"[[Done]]");try{return{done:o,value:o?void 0:a.next()}}catch(s){if(ji.set(a,"[[Done]]",!0),s!==ov)throw s;return{done:!0,value:void 0}}},"next")};return ji.set(t,"[[Iterator]]",e),t},"getStopIterationIterator")});var cv=l((NW,lv)=>{var U1={}.toString;lv.exports=Array.isArray||function(r){return U1.call(r)=="[object Array]"}});var jd=l((GW,dv)=>{"use strict";var j1=String.prototype.valueOf,k1=n(function(e){try{return j1.call(e),!0}catch{return!1}},"tryStringObject"),L1=Object.prototype.toString,F1="[object String]",M1=Ri()();dv.exports=n(function(e){return typeof e=="string"?!0:typeof e!="object"?!1:M1?k1(e):L1.call(e)===F1},"isString")});var mv=l(($W,fv)=>{"use strict";var kd=typeof Map=="function"&&Map.prototype?Map:null,N1=typeof Set=="function"&&Set.prototype?Set:null,Ha;kd||(Ha=n(function(e){return!1},"isMap"));var hv=kd?Map.prototype.has:null,pv=N1?Set.prototype.has:null;!Ha&&!hv&&(Ha=n(function(e){return!1},"isMap"));fv.exports=Ha||n(function(e){if(!e||typeof e!="object")return!1;try{if(hv.call(e),pv)try{pv.call(e)}catch{return!0}return e instanceof kd}catch{}return!1},"isMap")});var bv=l((VW,gv)=>{"use strict";var G1=typeof Map=="function"&&Map.prototype?Map:null,Ld=typeof Set=="function"&&Set.prototype?Set:null,Ea;Ld||(Ea=n(function(e){return!1},"isSet"));var yv=G1?Map.prototype.has:null,_v=Ld?Set.prototype.has:null;!Ea&&!_v&&(Ea=n(function(e){return!1},"isSet"));gv.exports=Ea||n(function(e){if(!e||typeof e!="object")return!1;try{if(_v.call(e),yv)try{yv.call(e)}catch{return!0}return e instanceof Ld}catch{}return!1},"isSet")});var Iv=l((KW,Ia)=>{"use strict";var vv=Bb(),wv=uv();ha()()||pa()()?(Aa=Symbol.iterator,Ia.exports=n(function(e){if(e!=null&&typeof e[Aa]<"u")return e[Aa]();if(vv(e))return Array.prototype[Aa].call(e)},"getIterator")):(xv=cv(),Sv=jd(),Fd=T(),qv=Fd("%Map%",!0),Pv=Fd("%Set%",!0),Be=He(),Md=Be("Array.prototype.push"),Nd=Be("String.prototype.charCodeAt"),Cv=Be("String.prototype.slice"),Hv=n(function(e,t){var i=e.length;if(t+1>=i)return t+1;var a=Nd(e,t);if(a<55296||a>56319)return t+1;var o=Nd(e,t+1);return o<56320||o>57343?t+1:t+2},"advanceStringIndex"),Ta=n(function(e){var t=0;return{next:n(function(){var a=t>=e.length,o;return a||(o=e[t],t+=1),{done:a,value:o}},"next")}},"getArrayIterator"),Gd=n(function(e,t){if(xv(e)||vv(e))return Ta(e);if(Sv(e)){var i=0;return{next:n(function(){var o=Hv(e,i),s=Cv(e,i,o);return i=o,{done:o>e.length,value:s}},"next")}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()},"getNonCollectionIterator"),!qv&&!Pv?Ia.exports=n(function(e){if(e!=null)return Gd(e,!0)},"getIterator"):(Ev=mv(),Av=bv(),Qd=Be("Map.prototype.forEach",!0),$d=Be("Set.prototype.forEach",!0),(typeof process>"u"||!process.versions||!process.versions.node)&&(Wd=Be("Map.prototype.iterator",!0),Vd=Be("Set.prototype.iterator",!0)),zd=Be("Map.prototype.@@iterator",!0)||Be("Map.prototype._es6-shim iterator_",!0),Kd=Be("Set.prototype.@@iterator",!0)||Be("Set.prototype._es6-shim iterator_",!0),Tv=n(function(e){if(Ev(e)){if(Wd)return wv(Wd(e));if(zd)return zd(e);if(Qd){var t=[];return Qd(e,function(a,o){Md(t,[o,a])}),Ta(t)}}if(Av(e)){if(Vd)return wv(Vd(e));if(Kd)return Kd(e);if($d){var i=[];return $d(e,function(a){Md(i,a)}),Ta(i)}}},"getCollectionIterator"),Ia.exports=n(function(e){return Tv(e)||Gd(e)},"getIterator")));var Aa,xv,Sv,Fd,qv,Pv,Be,Md,Nd,Cv,Hv,Ta,Gd,Ev,Av,Qd,$d,Wd,Vd,zd,Kd,Tv});var Ov=l((ZW,Dv)=>{"use strict";var Rv=TypeError;Dv.exports=n(function(e){if(!e||typeof e.next!="function")throw new Rv("iterator must be an object with a `next` method");if(arguments.length>1){var t=arguments[1];if(typeof t!="function")throw new Rv("`callback`, if provided, must be a function")}for(var i=t||[],a;(a=e.next())&&!a.done;)t?t(a.value):i.push(a.value);if(!t)return i},"iterateIterator")});var jv=l((YW,Uv)=>{"use strict";var Q1=Iv(),$1=TypeError,Bv=Ov();Uv.exports=n(function(e){var t=Q1(e);if(!t)throw new $1("non-iterable value provided");return arguments.length>1?Bv(t,arguments[1]):Bv(t)},"iterateValue")});var Lv=l((tV,kv)=>{"use strict";var W1=T(),V1=W1("%TypeError%");kv.exports=n(function(e,t){if(e==null)throw new V1(t||"Cannot call method on "+e);return e},"CheckObjectCoercible")});var ki=l((iV,Fv)=>{"use strict";Fv.exports=Lv()});var Ra=l((nV,Mv)=>{"use strict";Mv.exports=Number.isNaN||n(function(e){return e!==e},"isNaN")});var Jd=l((oV,Nv)=>{"use strict";var z1=Ra();Nv.exports=function(r){return(typeof r=="number"||typeof r=="bigint")&&!z1(r)&&r!==1/0&&r!==-1/0}});var Da=l((sV,Qv)=>{"use strict";var Gv=T(),K1=Gv("%Math.abs%"),J1=Gv("%Math.floor%"),Z1=Ra(),X1=Jd();Qv.exports=n(function(e){if(typeof e!="number"||Z1(e)||!X1(e))return!1;var t=K1(e);return J1(t)===t},"isInteger")});var zv=l((lV,Vv)=>{"use strict";var Li=T(),$v=Li("%Array.prototype%"),Y1=Li("%RangeError%"),eI=Li("%SyntaxError%"),tI=Li("%TypeError%"),rI=Da(),iI=Math.pow(2,32)-1,nI=ud()(),Wv=Li("%Object.setPrototypeOf%",!0)||(nI?function(r,e){return r.__proto__=e,r}:null);Vv.exports=n(function(e){if(!rI(e)||e<0)throw new tI("Assertion failed: `length` must be an integer Number >= 0");if(e>iI)throw new Y1("length is greater than (2**32 - 1)");var t=arguments.length>1?arguments[1]:$v,i=[];if(t!==$v){if(!Wv)throw new eI("ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]");Wv(i,t)}return e!==0&&(i.length=e),i},"ArrayCreate")});var Ot=l((dV,Kv)=>{"use strict";Kv.exports=n(function(e){return typeof e=="string"||typeof e=="symbol"},"IsPropertyKey")});var fe=l((hV,Jv)=>{"use strict";var aI=bd();Jv.exports=n(function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":aI(e)},"Type")});var Zd=l((mV,Xv)=>{"use strict";var oI=T(),Zv=oI("%TypeError%"),sI=Dd(),uI=Ot(),lI=fe();Xv.exports=n(function(e,t){if(lI(e)!=="Object")throw new Zv("Assertion failed: Type(O) is not Object");if(!uI(t))throw new Zv("Assertion failed: IsPropertyKey(P) is not true, got "+sI(t));return e[t]},"Get")});var Xd=l((_V,ew)=>{"use strict";var cI=T(),Yv=cI("%Array%"),dI=!Yv.isArray&&He()("Object.prototype.toString");ew.exports=Yv.isArray||n(function(e){return dI(e)==="[object Array]"},"IsArray")});var Yd=l((bV,tw)=>{"use strict";tw.exports=Xd()});var iw=l((vV,rw)=>{"use strict";rw.exports=T()});var Oa=l((wV,nw)=>{"use strict";var pI=T(),hI=ct(),fI=pI("%TypeError%");nw.exports=n(function(e,t){if(e.Type(t)!=="Object")return!1;var i={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var a in t)if(hI(t,a)&&!i[a])return!1;if(e.IsDataDescriptor(t)&&e.IsAccessorDescriptor(t))throw new fI("Property Descriptors may not be both accessor and data descriptors");return!0},"IsPropertyDescriptor")});var ep=l((SV,uw)=>{"use strict";var ow=Ci(),mI=T(),aw=ow()&&mI("%Object.defineProperty%",!0),sw=ow.hasArrayLengthDefineBug(),yI=sw&&Xd(),_I=He(),gI=_I("Object.prototype.propertyIsEnumerable");uw.exports=n(function(e,t,i,a,o,s){if(!aw){if(!e(s)||!s["[[Configurable]]"]||!s["[[Writable]]"]||o in a&&gI(a,o)!==!!s["[[Enumerable]]"])return!1;var u=s["[[Value]]"];return a[o]=u,t(a[o],u)}return sw&&o==="length"&&"[[Value]]"in s&&yI(a)&&a.length!==s["[[Value]]"]?(a.length=s["[[Value]]"],a.length===s["[[Value]]"]):(aw(a,o,i(s)),!0)},"DefineOwnProperty")});var dw=l((PV,cw)=>{"use strict";var lw=ct();cw.exports=n(function(e){return lw(e,"[[StartIndex]]")&&lw(e,"[[EndIndex]]")&&e["[[StartIndex]]"]>=0&&e["[[EndIndex]]"]>=e["[[StartIndex]]"]&&String(parseInt(e["[[StartIndex]]"],10))===String(e["[[StartIndex]]"])&&String(parseInt(e["[[EndIndex]]"],10))===String(e["[[EndIndex]]"])},"isMatchRecord")});var Fi=l((HV,mw)=>{"use strict";var pw=T(),hw=pw("%TypeError%"),bI=pw("%SyntaxError%"),ce=ct(),vI=Da(),wI=dw(),fw={"Property Descriptor":n(function(e){var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};if(!e)return!1;for(var i in e)if(ce(e,i)&&!t[i])return!1;var a=ce(e,"[[Value]]"),o=ce(e,"[[Get]]")||ce(e,"[[Set]]");if(a&&o)throw new hw("Property Descriptors may not be both accessor and data descriptors");return!0},"isPropertyDescriptor"),"Match Record":wI,"Iterator Record":n(function(e){return ce(e,"[[Iterator]]")&&ce(e,"[[NextMethod]]")&&ce(e,"[[Done]]")},"isIteratorRecord"),"PromiseCapability Record":n(function(e){return!!e&&ce(e,"[[Resolve]]")&&typeof e["[[Resolve]]"]=="function"&&ce(e,"[[Reject]]")&&typeof e["[[Reject]]"]=="function"&&ce(e,"[[Promise]]")&&e["[[Promise]]"]&&typeof e["[[Promise]]"].then=="function"},"isPromiseCapabilityRecord"),"AsyncGeneratorRequest Record":n(function(e){return!!e&&ce(e,"[[Completion]]")&&ce(e,"[[Capability]]")&&fw["PromiseCapability Record"](e["[[Capability]]"])},"isAsyncGeneratorRequestRecord"),"RegExp Record":n(function(e){return e&&ce(e,"[[IgnoreCase]]")&&typeof e["[[IgnoreCase]]"]=="boolean"&&ce(e,"[[Multiline]]")&&typeof e["[[Multiline]]"]=="boolean"&&ce(e,"[[DotAll]]")&&typeof e["[[DotAll]]"]=="boolean"&&ce(e,"[[Unicode]]")&&typeof e["[[Unicode]]"]=="boolean"&&ce(e,"[[CapturingGroupsCount]]")&&typeof e["[[CapturingGroupsCount]]"]=="number"&&vI(e["[[CapturingGroupsCount]]"])&&e["[[CapturingGroupsCount]]"]>=0},"isRegExpRecord")};mw.exports=n(function(e,t,i,a){var o=fw[t];if(typeof o!="function")throw new bI("unknown record type: "+t);if(e(a)!=="Object"||!o(a))throw new hw(i+" must be a "+t)},"assertRecord")});var _w=l((AV,yw)=>{"use strict";yw.exports=n(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},"fromPropertyDescriptor")});var tp=l((IV,gw)=>{"use strict";var xI=Fi(),SI=_w(),qI=fe();gw.exports=n(function(e){return typeof e<"u"&&xI(qI,"Property Descriptor","Desc",e),SI(e)},"FromPropertyDescriptor")});var Mi=l((DV,vw)=>{"use strict";var bw=ct(),PI=fe(),CI=Fi();vw.exports=n(function(e){return!(typeof e>"u"||(CI(PI,"Property Descriptor","Desc",e),!bw(e,"[[Get]]")&&!bw(e,"[[Set]]")))},"IsAccessorDescriptor")});var Ni=l((BV,xw)=>{"use strict";var ww=ct(),HI=fe(),EI=Fi();xw.exports=n(function(e){return!(typeof e>"u"||(EI(HI,"Property Descriptor","Desc",e),!ww(e,"[[Value]]")&&!ww(e,"[[Writable]]")))},"IsDataDescriptor")});var Ba=l((jV,qw)=>{"use strict";var Sw=Ra();qw.exports=n(function(e,t){return e===t?e===0?1/e===1/t:!0:Sw(e)&&Sw(t)},"SameValue")});var Cw=l((LV,Pw)=>{"use strict";Pw.exports=n(function(e){return!!e},"ToBoolean")});var op=l((MV,Aw)=>{"use strict";var Ew=Function.prototype.toString,Or=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ip,Ua;if(typeof Or=="function"&&typeof Object.defineProperty=="function")try{ip=Object.defineProperty({},"length",{get:function(){throw Ua}}),Ua={},Or(function(){throw 42},null,ip)}catch(r){r!==Ua&&(Or=null)}else Or=null;var AI=/^\s*class\b/,np=n(function(e){try{var t=Ew.call(e);return AI.test(t)}catch{return!1}},"isES6ClassFunction"),rp=n(function(e){try{return np(e)?!1:(Ew.call(e),!0)}catch{return!1}},"tryFunctionToStr"),ja=Object.prototype.toString,TI="[object Object]",II="[object Function]",RI="[object GeneratorFunction]",DI="[object HTMLAllCollection]",OI="[object HTML document.all class]",BI="[object HTMLCollection]",UI=typeof Symbol=="function"&&!!Symbol.toStringTag,jI=!(0 in[,]),ap=n(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Hw=document.all,ja.call(Hw)===ja.call(document.all)&&(ap=n(function(e){if((jI||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=ja.call(e);return(t===DI||t===OI||t===BI||t===TI)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var Hw;Aw.exports=n(Or?function(e){if(ap(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Or(e,null,ip)}catch(t){if(t!==Ua)return!1}return!np(e)&&rp(e)}:function(e){if(ap(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(UI)return rp(e);if(np(e))return!1;var t=ja.call(e);return t!==II&&t!==RI&&!/^\[object HTML/.test(t)?!1:rp(e)},"isCallable")});var sp=l((GV,Tw)=>{"use strict";Tw.exports=op()});var lp=l((QV,Rw)=>{"use strict";var Ze=ct(),kI=T(),ka=kI("%TypeError%"),LI=fe(),up=Cw(),Iw=sp();Rw.exports=n(function(e){if(LI(e)!=="Object")throw new ka("ToPropertyDescriptor requires an object");var t={};if(Ze(e,"enumerable")&&(t["[[Enumerable]]"]=up(e.enumerable)),Ze(e,"configurable")&&(t["[[Configurable]]"]=up(e.configurable)),Ze(e,"value")&&(t["[[Value]]"]=e.value),Ze(e,"writable")&&(t["[[Writable]]"]=up(e.writable)),Ze(e,"get")){var i=e.get;if(typeof i<"u"&&!Iw(i))throw new ka("getter must be a function");t["[[Get]]"]=i}if(Ze(e,"set")){var a=e.set;if(typeof a<"u"&&!Iw(a))throw new ka("setter must be a function");t["[[Set]]"]=a}if((Ze(t,"[[Get]]")||Ze(t,"[[Set]]"))&&(Ze(t,"[[Value]]")||Ze(t,"[[Writable]]")))throw new ka("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},"ToPropertyDescriptor")});var Uw=l((WV,Bw)=>{"use strict";var FI=T(),cp=FI("%TypeError%"),Dw=Oa(),MI=ep(),NI=tp(),Ow=Mi(),dp=Ni(),GI=Ot(),QI=Ba(),$I=lp(),pp=fe();Bw.exports=n(function(e,t,i){if(pp(e)!=="Object")throw new cp("Assertion failed: Type(O) is not Object");if(!GI(t))throw new cp("Assertion failed: IsPropertyKey(P) is not true");var a=Dw({Type:pp,IsDataDescriptor:dp,IsAccessorDescriptor:Ow},i)?i:$I(i);if(!Dw({Type:pp,IsDataDescriptor:dp,IsAccessorDescriptor:Ow},a))throw new cp("Assertion failed: Desc is not a valid Property Descriptor");return MI(dp,QI,NI,e,t,a)},"DefinePropertyOrThrow")});var kw=l((zV,mp)=>{"use strict";var WI=iw(),jw=WI("%Reflect.construct%",!0),La=Uw();try{La({},"",{"[[Get]]":function(){}})}catch{La=null}La&&jw?(hp={},fp={},La(fp,"length",{"[[Get]]":function(){throw hp},"[[Enumerable]]":!0}),mp.exports=n(function(e){try{jw(e,fp)}catch(t){return t===hp}},"IsConstructor")):mp.exports=n(function(e){return typeof e=="function"&&!!e.prototype},"IsConstructor");var hp,fp});var $w=l((JV,Qw)=>{"use strict";var Gw=T(),Lw=Gw("%Symbol.species%",!0),Fw=Gw("%TypeError%"),Mw=zv(),Nw=Zd(),VI=Yd(),zI=kw(),KI=fe(),JI=Da();Qw.exports=n(function(e,t){if(!JI(t)||t<0)throw new Fw("Assertion failed: length must be an integer >= 0");var i=VI(e);if(!i)return Mw(t);var a=Nw(e,"constructor");if(Lw&&KI(a)==="Object"&&(a=Nw(a,Lw),a===null&&(a=void 0)),typeof a>"u")return Mw(t);if(!zI(a))throw new Fw("C must be a constructor");return new a(t)},"ArraySpeciesCreate")});var zw=l((XV,Vw)=>{"use strict";var Ww=T(),ZI=He(),XI=Ww("%TypeError%"),YI=Yd(),eR=Ww("%Reflect.apply%",!0)||ZI("Function.prototype.apply");Vw.exports=n(function(e,t){var i=arguments.length>2?arguments[2]:[];if(!YI(i))throw new XI("Assertion failed: optional `argumentsList`, if provided, must be a List");return eR(e,t,i)},"Call")});var yp=l((e3,Kw)=>{"use strict";Kw.exports=n(function(e){return e===null||typeof e!="function"&&typeof e!="object"},"isPrimitive")});var Yw=l((r3,Xw)=>{"use strict";var Zw=T(),tR=Zw("%Object.preventExtensions%",!0),rR=Zw("%Object.isExtensible%",!0),Jw=yp();Xw.exports=n(tR?function(e){return!Jw(e)&&rR(e)}:function(e){return!Jw(e)},"IsExtensible")});var tx=l((n3,ex)=>{"use strict";ex.exports=n(function(e,t){return!!t&&typeof t=="object"&&"[[Enumerable]]"in t&&"[[Configurable]]"in t&&(e.IsAccessorDescriptor(t)||e.IsDataDescriptor(t))},"isFullyPopulatedPropertyDescriptor")});var ix=l((o3,rx)=>{"use strict";var iR=Fi(),nR=Mi(),aR=Ni(),oR=fe();rx.exports=n(function(e){return typeof e>"u"?!1:(iR(oR,"Property Descriptor","Desc",e),!nR(e)&&!aR(e))},"IsGenericDescriptor")});var ox=l((u3,ax)=>{"use strict";var sR=T(),Br=sR("%TypeError%"),Gi=ep(),uR=tx(),nx=Oa(),Qi=tp(),pt=Mi(),Xe=Ni(),lR=ix(),cR=Ot(),Ye=Ba(),Ur=fe();ax.exports=n(function(e,t,i,a,o){var s=Ur(e);if(s!=="Undefined"&&s!=="Object")throw new Br("Assertion failed: O must be undefined or an Object");if(!cR(t))throw new Br("Assertion failed: P must be a Property Key");if(Ur(i)!=="Boolean")throw new Br("Assertion failed: extensible must be a Boolean");if(!nx({Type:Ur,IsDataDescriptor:Xe,IsAccessorDescriptor:pt},a))throw new Br("Assertion failed: Desc must be a Property Descriptor");if(Ur(o)!=="Undefined"&&!nx({Type:Ur,IsDataDescriptor:Xe,IsAccessorDescriptor:pt},o))throw new Br("Assertion failed: current must be a Property Descriptor, or undefined");if(Ur(o)==="Undefined")return i?s==="Undefined"?!0:pt(a)?Gi(Xe,Ye,Qi,e,t,a):Gi(Xe,Ye,Qi,e,t,{"[[Configurable]]":!!a["[[Configurable]]"],"[[Enumerable]]":!!a["[[Enumerable]]"],"[[Value]]":a["[[Value]]"],"[[Writable]]":!!a["[[Writable]]"]}):!1;if(!uR({IsAccessorDescriptor:pt,IsDataDescriptor:Xe},o))throw new Br("`current`, when present, must be a fully populated and valid Property Descriptor");if(!o["[[Configurable]]"]){if("[[Configurable]]"in a&&a["[[Configurable]]"]||"[[Enumerable]]"in a&&!Ye(a["[[Enumerable]]"],o["[[Enumerable]]"])||!lR(a)&&!Ye(pt(a),pt(o)))return!1;if(pt(o)){if("[[Get]]"in a&&!Ye(a["[[Get]]"],o["[[Get]]"])||"[[Set]]"in a&&!Ye(a["[[Set]]"],o["[[Set]]"]))return!1}else if(!o["[[Writable]]"]&&("[[Writable]]"in a&&a["[[Writable]]"]||"[[Value]]"in a&&!Ye(a["[[Value]]"],o["[[Value]]"])))return!1}if(s!=="Undefined"){var u,c;return Xe(o)&&pt(a)?(u=("[[Configurable]]"in a?a:o)["[[Configurable]]"],c=("[[Enumerable]]"in a?a:o)["[[Enumerable]]"],Gi(Xe,Ye,Qi,e,t,{"[[Configurable]]":!!u,"[[Enumerable]]":!!c,"[[Get]]":("[[Get]]"in a?a:o)["[[Get]]"],"[[Set]]":("[[Set]]"in a?a:o)["[[Set]]"]})):pt(o)&&Xe(a)?(u=("[[Configurable]]"in a?a:o)["[[Configurable]]"],c=("[[Enumerable]]"in a?a:o)["[[Enumerable]]"],Gi(Xe,Ye,Qi,e,t,{"[[Configurable]]":!!u,"[[Enumerable]]":!!c,"[[Value]]":("[[Value]]"in a?a:o)["[[Value]]"],"[[Writable]]":!!("[[Writable]]"in a?a:o)["[[Writable]]"]})):Gi(Xe,Ye,Qi,e,t,a)}return!0},"ValidateAndApplyPropertyDescriptor")});var hx=l((c3,px)=>{"use strict";var dx=T(),sx=_a(),ux=dx("%SyntaxError%"),_p=dx("%TypeError%"),dR=Oa(),lx=Mi(),pR=Ni(),hR=Yw(),fR=Ot(),mR=lp(),yR=Ba(),cx=fe(),_R=ox();px.exports=n(function(e,t,i){if(cx(e)!=="Object")throw new _p("Assertion failed: O must be an Object");if(!fR(t))throw new _p("Assertion failed: P must be a Property Key");if(!dR({Type:cx,IsDataDescriptor:pR,IsAccessorDescriptor:lx},i))throw new _p("Assertion failed: Desc must be a Property Descriptor");if(!sx){if(lx(i))throw new ux("This environment does not support accessor property descriptors.");var a=!(t in e)&&i["[[Writable]]"]&&i["[[Enumerable]]"]&&i["[[Configurable]]"]&&"[[Value]]"in i,o=t in e&&(!("[[Configurable]]"in i)||i["[[Configurable]]"])&&(!("[[Enumerable]]"in i)||i["[[Enumerable]]"])&&(!("[[Writable]]"in i)||i["[[Writable]]"])&&"[[Value]]"in i;if(a||o)return e[t]=i["[[Value]]"],yR(e[t],i["[[Value]]"]);throw new ux("This environment does not support defining non-writable, non-enumerable, or non-configurable properties")}var s=sx(e,t),u=s&&mR(s),c=hR(e);return _R(e,t,c,i,u)},"OrdinaryDefineOwnProperty")});var yx=l((p3,mx)=>{"use strict";var gR=T(),fx=gR("%TypeError%"),bR=Ot(),vR=hx(),wR=fe();mx.exports=n(function(e,t,i){if(wR(e)!=="Object")throw new fx("Assertion failed: Type(O) is not Object");if(!bR(t))throw new fx("Assertion failed: IsPropertyKey(P) is not true");var a={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Value]]":i,"[[Writable]]":!0};return vR(e,t,a)},"CreateDataProperty")});var gx=l((f3,_x)=>{"use strict";var xR=T(),gp=xR("%TypeError%"),SR=yx(),qR=Ot(),PR=fe();_x.exports=n(function(e,t,i){if(PR(e)!=="Object")throw new gp("Assertion failed: Type(O) is not Object");if(!qR(t))throw new gp("Assertion failed: IsPropertyKey(P) is not true");var a=SR(e,t,i);if(!a)throw new gp("unable to create data property")},"CreateDataPropertyOrThrow")});var wx=l((y3,vx)=>{"use strict";var CR=T(),bx=CR("%TypeError%"),HR=Ot(),ER=fe();vx.exports=n(function(e,t){if(ER(e)!=="Object")throw new bx("Assertion failed: `O` must be an Object");if(!HR(t))throw new bx("Assertion failed: `P` must be a Property Key");return t in e},"HasProperty")});var Sx=l((g3,xx)=>{"use strict";var AR=Math.floor;xx.exports=n(function(e,t){var i=e%t;return AR(i>=0?i:i+t)},"mod")});var Px=l((v3,qx)=>{"use strict";var TR=Sx();qx.exports=n(function(e,t){return TR(e,t)},"modulo")});var Hx=l((x3,Cx)=>{"use strict";Cx.exports=n(function(e){return e===null||typeof e!="function"&&typeof e!="object"},"isPrimitive")});var Ax=l((q3,Ex)=>{"use strict";var IR=Date.prototype.getDay,RR=n(function(e){try{return IR.call(e),!0}catch{return!1}},"tryDateGetDayCall"),DR=Object.prototype.toString,OR="[object Date]",BR=Ri()();Ex.exports=n(function(e){return typeof e!="object"||e===null?!1:BR?RR(e):DR.call(e)===OR},"isDateObject")});var Dx=l((C3,bp)=>{"use strict";var UR=Object.prototype.toString,jR=ha()();jR?(Tx=Symbol.prototype.toString,Ix=/^Symbol\(.*\)$/,Rx=n(function(e){return typeof e.valueOf()!="symbol"?!1:Ix.test(Tx.call(e))},"isRealSymbolObject"),bp.exports=n(function(e){if(typeof e=="symbol")return!0;if(UR.call(e)!=="[object Symbol]")return!1;try{return Rx(e)}catch{return!1}},"isSymbol")):bp.exports=n(function(e){return!1},"isSymbol");var Tx,Ix,Rx});var jx=l((E3,Ux)=>{"use strict";var kR=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol",vp=Hx(),Bx=op(),LR=Ax(),Ox=Dx(),FR=n(function(e,t){if(typeof e>"u"||e===null)throw new TypeError("Cannot call method on "+e);if(typeof t!="string"||t!=="number"&&t!=="string")throw new TypeError('hint must be "string" or "number"');var i=t==="string"?["toString","valueOf"]:["valueOf","toString"],a,o,s;for(s=0;s<i.length;++s)if(a=e[i[s]],Bx(a)&&(o=a.call(e),vp(o)))return o;throw new TypeError("No default value")},"OrdinaryToPrimitive"),MR=n(function(e,t){var i=e[t];if(i!==null&&typeof i<"u"){if(!Bx(i))throw new TypeError(i+" returned for property "+t+" of object "+e+" is not a function");return i}},"GetMethod");Ux.exports=n(function(e){if(vp(e))return e;var t="default";arguments.length>1&&(arguments[1]===String?t="string":arguments[1]===Number&&(t="number"));var i;if(kR&&(Symbol.toPrimitive?i=MR(e,Symbol.toPrimitive):Ox(e)&&(i=Symbol.prototype.valueOf)),typeof i<"u"){var a=i.call(e,t);if(vp(a))return a;throw new TypeError("unable to convert exotic object to primitive")}return t==="default"&&(LR(e)||Ox(e))&&(t="string"),FR(e,t==="default"?"number":t)},"ToPrimitive")});var Fx=l((T3,Lx)=>{"use strict";var kx=jx();Lx.exports=n(function(e){return arguments.length>1?kx(e,arguments[1]):kx(e)},"ToPrimitive")});var $x=l((R3,Qx)=>{"use strict";var wp=He(),Mx=Ri()(),Nx,Gx,xp,Sp;Mx&&(Nx=wp("Object.prototype.hasOwnProperty"),Gx=wp("RegExp.prototype.exec"),xp={},Fa=n(function(){throw xp},"throwRegexMarker"),Sp={toString:Fa,valueOf:Fa},typeof Symbol.toPrimitive=="symbol"&&(Sp[Symbol.toPrimitive]=Fa));var Fa,NR=wp("Object.prototype.toString"),GR=Object.getOwnPropertyDescriptor,QR="[object RegExp]";Qx.exports=n(Mx?function(e){if(!e||typeof e!="object")return!1;var t=GR(e,"lastIndex"),i=t&&Nx(t,"value");if(!i)return!1;try{Gx(e,Sp)}catch(a){return a===xp}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:NR(e)===QR},"isRegex")});var Vx=l((O3,Wx)=>{"use strict";var $R=He(),WR=T(),VR=$x(),zR=$R("RegExp.prototype.exec"),KR=WR("%TypeError%");Wx.exports=n(function(e){if(!VR(e))throw new KR("`regex` must be a RegExp");return n(function(i){return zR(e,i)!==null},"test")},"regexTester")});var qp=l((U3,Kx)=>{"use strict";var zx=T(),JR=zx("%String%"),ZR=zx("%TypeError%");Kx.exports=n(function(e){if(typeof e=="symbol")throw new ZR("Cannot convert a Symbol value to a string");return JR(e)},"ToString")});var Pp=l((k3,Xx)=>{"use strict";var XR=ki(),YR=qp(),eD=He(),Jx=eD("String.prototype.replace"),Zx=/^\s$/.test("\u180E"),tD=Zx?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,rD=Zx?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;Xx.exports=n(function(){var e=YR(XR(this));return Jx(Jx(e,tD,""),rD,"")},"trim")});var Cp=l((F3,eS)=>{"use strict";var iD=Pp(),Yx="\u200B",jr="\u180E";eS.exports=n(function(){return String.prototype.trim&&Yx.trim()===Yx&&jr.trim()===jr&&("_"+jr).trim()==="_"+jr&&(jr+"_").trim()===jr+"_"?String.prototype.trim:iD},"getPolyfill")});var rS=l((N3,tS)=>{"use strict";var nD=er(),aD=Cp();tS.exports=n(function(){var e=aD();return nD(String.prototype,{trim:e},{trim:n(function(){return String.prototype.trim!==e},"testTrim")}),e},"shimStringTrim")});var oS=l((Q3,aS)=>{"use strict";var oD=Ir(),sD=er(),uD=ki(),lD=Pp(),iS=Cp(),cD=rS(),dD=oD(iS()),nS=n(function(e){return uD(e),dD(e)},"trim");sD(nS,{getPolyfill:iS,implementation:lD,shim:cD});aS.exports=nS});var cS=l((W3,lS)=>{"use strict";var Ma=T(),Hp=Ma("%Number%"),pD=Ma("%RegExp%"),hD=Ma("%TypeError%"),sS=Ma("%parseInt%"),fD=He(),Na=Vx(),uS=fD("String.prototype.slice"),mD=Na(/^0b[01]+$/i),yD=Na(/^0o[0-7]+$/i),_D=Na(/^[-+]0x[0-9a-f]+$/i),gD=["\x85","\u200B","\uFFFE"].join(""),bD=new pD("["+gD+"]","g"),vD=Na(bD),wD=oS(),xD=fe();lS.exports=n(function r(e){if(xD(e)!=="String")throw new hD("Assertion failed: `argument` is not a String");if(mD(e))return Hp(sS(uS(e,2),2));if(yD(e))return Hp(sS(uS(e,2),8));if(vD(e)||_D(e))return NaN;var t=wD(e);return t!==e?r(t):Hp(e)},"StringToNumber")});var mS=l((z3,fS)=>{"use strict";var hS=T(),dS=hS("%TypeError%"),pS=hS("%Number%"),SD=yp(),qD=Fx(),PD=cS();fS.exports=n(function(e){var t=SD(e)?e:qD(e,pS);if(typeof t=="symbol")throw new dS("Cannot convert a Symbol value to a number");if(typeof t=="bigint")throw new dS("Conversion from 'BigInt' to 'number' is not allowed.");return typeof t=="string"?PD(t):pS(t)},"ToNumber")});var _S=l((J3,yS)=>{"use strict";var CD=fe(),HD=Math.floor;yS.exports=n(function(e){return CD(e)==="BigInt"?e:HD(e)},"floor")});var vS=l((X3,bS)=>{"use strict";var ED=T(),gS=_S(),AD=ED("%TypeError%");bS.exports=n(function(e){if(typeof e!="number"&&typeof e!="bigint")throw new AD("argument must be a Number or a BigInt");var t=e<0?-gS(-e):gS(e);return t===0?0:t},"truncate")});var xS=l((ez,wS)=>{"use strict";var TD=Px(),ID=mS(),RD=vS(),DD=Jd(),OD=4294967296;wS.exports=n(function(e){var t=ID(e);if(!DD(t)||t===0)return 0;var i=RD(t),a=TD(i,OD);return a===0?0:a},"ToUint32")});var qS=l((rz,SS)=>{"use strict";var BD=T(),UD=BD("%Object%"),jD=ki();SS.exports=n(function(e){return jD(e),UD(e)},"ToObject")});var Ep=l((nz,CS)=>{"use strict";var kD=$w(),LD=zw(),FD=gx(),MD=Zd(),ND=wx(),GD=sp(),QD=xS(),$D=qS(),WD=qp(),VD=He(),zD=jd(),PS=Object("a"),KD=PS[0]!=="a"||!(0 in PS),JD=VD("String.prototype.split");CS.exports=n(function(e){var t=$D(this),i=KD&&zD(t)?JD(t,""):t,a=QD(i.length);if(!GD(e))throw new TypeError("Array.prototype.map callback must be a function");var o;arguments.length>1&&(o=arguments[1]);for(var s=kD(t,a),u=0;u<a;){var c=WD(u),p=ND(t,c);if(p){var h=MD(t,c),f=LD(e,o,[h,u,t]);FD(s,c,f)}u+=1}return s},"map")});var ES=l((oz,HS)=>{HS.exports=n(function(e){var t=!0,i=!0,a=!1;if(typeof e=="function"){try{e.call("f",function(o,s,u){typeof u!="object"&&(t=!1)}),e.call([null],function(){"use strict";i=typeof this=="string"},"x")}catch{a=!0}return!a&&t&&i}return!1},"properlyBoxed")});var Ap=l((uz,AS)=>{"use strict";var ZD=ES(),XD=Ep();AS.exports=n(function(){var e=Array.prototype.map;return ZD(e)?e:XD},"getPolyfill")});var IS=l((cz,TS)=>{"use strict";var YD=er(),eO=Ap();TS.exports=n(function(){var e=eO();return YD(Array.prototype,{map:e},{map:function(){return Array.prototype.map!==e}}),e},"shimArrayPrototypeMap")});var BS=l((pz,OS)=>{"use strict";var tO=er(),rO=ki(),iO=He(),nO=Ep(),RS=Ap(),aO=RS(),oO=IS(),sO=iO("Array.prototype.slice"),DS=n(function(e,t){return rO(e),aO.apply(e,sO(arguments,1))},"map");tO(DS,{getPolyfill:RS,implementation:nO,shim:oO});OS.exports=DS});var Tp=l((fz,kS)=>{"use strict";var uO=Ii();uO();var lO=Pb(),cO=Eb(),dO=jv(),pO=BS(),US=T(),jS=Ir(),hO=jS(US("%Promise.all%")),fO=jS(US("%Promise.reject%"));kS.exports=n(function(e){var t=this;if(cO(t)!=="Object")throw new TypeError("`this` value must be an object");var i=dO(e);return hO(t,pO(i,function(a){var o=n(function(c){return{status:"fulfilled",value:c}},"onFulfill"),s=n(function(c){return{status:"rejected",reason:c}},"onReject"),u=lO(t,a);try{return u.then(o,s)}catch(c){return fO(t,c)}}))},"allSettled")});var Ip=l((yz,LS)=>{"use strict";var mO=Ii(),yO=Tp();LS.exports=n(function(){return mO(),typeof Promise.allSettled=="function"?Promise.allSettled:yO},"getPolyfill")});var MS=l((gz,FS)=>{"use strict";var _O=Ii(),gO=Ip(),bO=er();FS.exports=n(function(){_O();var e=gO();return bO(Promise,{allSettled:e},{allSettled:n(function(){return Promise.allSettled!==e},"testAllSettled")}),e},"shimAllSettled")});var GS=l((vz,Dp)=>{"use strict";var vO=Ir(),wO=er(),xO=Ii(),SO=Tp(),NS=Ip(),qO=MS();xO();var PO=vO(NS()),Rp=n(function(e){return PO(typeof this>"u"?Promise:this,e)},"allSettled");wO(Rp,{getPolyfill:NS,implementation:SO,shim:qO});Dp.exports=Rp;Dp.exports.default=Rp});var Op=l(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.ResponseBasedRateLimiter=void 0;var ht=(_(),g(y)),CO=Si(),HO=GS(),EO=S(),AO=qi(),QS=sd(),TO=function(){function r(e){var t=e.logger;this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,CO.createLogger)(ht.__assign({name:"rate-limiter",emoji:!0},t))}return n(r,"ResponseBasedRateLimiter"),r.prototype.request=function(e,t){return ht.__awaiter(this,void 0,void 0,function(){var i=this;return ht.__generator(this,function(a){switch(a.label){case 0:return this._logger.trace("request start"),[4,new Promise(function(o,s){var u,c={req:e,resolve:o,reject:s,limitReachedBehavior:(u=t?.limitReachedBehavior)!==null&&u!==void 0?u:"enqueue"};i._batchRunning||i._nextBatchTimer||i._paused?(i._logger.trace("request queued batchRunning:".concat(i._batchRunning.toString()," hasNextBatchTimer:").concat((!!i._nextBatchTimer).toString()," paused:").concat(i._paused.toString())),i._queue.push(c)):i._runRequestBatch([c])})];case 1:return[2,a.sent()]}})})},r.prototype.clear=function(){this._queue=[]},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){this._paused=!1,this._runNextBatch()},Object.defineProperty(r.prototype,"stats",{get:function(){var e,t,i,a,o;return{lastKnownLimit:(t=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&t!==void 0?t:null,lastKnownRemainingRequests:(a=(i=this._parameters)===null||i===void 0?void 0:i.remaining)!==null&&a!==void 0?a:null,lastKnownResetDate:(0,EO.mapNullable)((o=this._parameters)===null||o===void 0?void 0:o.resetsAt,function(s){return new Date(s)})}},enumerable:!1,configurable:!0}),r.prototype._runRequestBatch=function(e){return ht.__awaiter(this,void 0,void 0,function(){var t,i,a,o,s,u,c,p,h=this;return ht.__generator(this,function(f){switch(f.label){case 0:return this._logger.trace("runRequestBatch start specs:".concat(e.length)),this._batchRunning=!0,this._parameters&&this._logger.debug("Remaining requests: ".concat(this._parameters.remaining)),this._logger.debug("Doing ".concat(e.length," requests, new queue length is ").concat(this._queue.length)),t=e.map(function(b){return ht.__awaiter(h,void 0,void 0,function(){var P,w,x,E,R,Y,z;return ht.__generator(this,function(re){switch(re.label){case 0:P=b.req,w=b.resolve,x=b.reject,re.label=1;case 1:return re.trys.push([1,3,,4]),[4,this.doRequest(P)];case 2:if(E=re.sent(),R=this.needsToRetryAfter(E),R!==null)throw this._queue.unshift(b),this._logger.info("Retrying after ".concat(R," ms")),new QS.RetryAfterError(R);return Y=this.getParametersFromResponse(E),w(E),[2,Y];case 3:if(z=re.sent(),z instanceof QS.RetryAfterError)throw z;return x(z),[2,void 0];case 4:return[2]}})})}),[4,HO.default.call(Promise,t)];case 1:return i=f.sent(),a=i.filter(function(b){return b.status==="rejected"}),o=Date.now(),a.length?(this._logger.trace("runRequestBatch some rejected"),s=Math.max.apply(Math,ht.__spreadArray([o],ht.__read(a.map(function(b){return b.reason.retryAt})),!1)),u=s-o,this._logger.warn("Waiting for ".concat(u," ms because the rate limit was exceeded")),this._nextBatchTimer=setTimeout(function(){h._parameters=void 0,h._runNextBatch()},u)):(this._logger.trace("runRequestBatch none rejected"),c=i.filter(function(b){return b.status==="fulfilled"&&b.value!==void 0}).map(function(b){return b.value}).reduce(function(b,P){return b?P.remaining<b.remaining?P:b:P},void 0),this._batchRunning=!1,c&&(this._parameters=c,c.resetsAt<o||c.remaining>0?(this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch()):(p=c.resetsAt-o,this._logger.trace("runRequestBatch delay:".concat(p)),this._logger.warn("Waiting for ".concat(p," ms because the rate limit was reached")),this._queue=this._queue.filter(function(b){switch(b.limitReachedBehavior){case"enqueue":return!0;case"null":return b.resolve(null),!1;case"throw":return b.reject(new AO.RateLimitReachedError("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(function(){h._parameters=void 0,h._runNextBatch()},p)))),this._logger.trace("runRequestBatch end"),[2]}})})},r.prototype._runNextBatch=function(){if(!this._paused){this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);var e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,t=this._queue.splice(0,e);t.length&&this._runRequestBatch(t),this._logger.trace("runNextBatch end")}},r}();Ga.ResponseBasedRateLimiter=TO});var $S=l(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.PartitionedRateLimiter=void 0;var $i=(_(),g(y)),IO=Op(),RO=function(){function r(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}return n(r,"PartitionedRateLimiter"),r.prototype.request=function(e,t){return $i.__awaiter(this,void 0,void 0,function(){var i,a;return $i.__generator(this,function(o){switch(o.label){case 0:return i=this._partitionKeyCallback(e),a=this._getChild(i),[4,a.request(e,t)];case 1:return[2,o.sent()]}})})},r.prototype.clear=function(){var e,t;try{for(var i=$i.__values(this._children.values()),a=i.next();!a.done;a=i.next()){var o=a.value;o.clear()}}catch(s){e={error:s}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.pause=function(){var e,t;this._paused=!0;try{for(var i=$i.__values(this._children.values()),a=i.next();!a.done;a=i.next()){var o=a.value;o.pause()}}catch(s){e={error:s}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.resume=function(){var e,t;this._paused=!1;try{for(var i=$i.__values(this._children.values()),a=i.next();!a.done;a=i.next()){var o=a.value;o.resume()}}catch(s){e={error:s}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.getChildStats=function(e){if(!this._children.has(e))return null;var t=this._children.get(e);return t instanceof IO.ResponseBasedRateLimiter?t.stats:null},r.prototype._getChild=function(e){if(this._children.has(e))return this._children.get(e);var t=this._createChildCallback(e);return this._paused&&t.pause(),this._children.set(e,t),t},r}();Qa.PartitionedRateLimiter=RO});var WS=l($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.PartitionedTimeBasedRateLimiter=void 0;var kr=(_(),g(y)),DO=Si(),OO=qi(),BO=function(){function r(e){var t=e.logger,i=e.bucketSize,a=e.timeFrame,o=e.doRequest,s=e.getPartitionKey;this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._paused=!1,this._logger=(0,DO.createLogger)(kr.__assign({name:"rate-limiter",emoji:!0},t)),this._bucketSize=i,this._timeFrame=a,this._callback=o,this._partitionKeyCallback=s}return n(r,"PartitionedTimeBasedRateLimiter"),r.prototype.request=function(e,t){return kr.__awaiter(this,void 0,void 0,function(){var i=this;return kr.__generator(this,function(a){switch(a.label){case 0:return[4,new Promise(function(o,s){var u,c,p={req:e,resolve:o,reject:s,limitReachedBehavior:(u=t?.limitReachedBehavior)!==null&&u!==void 0?u:"enqueue"},h=i._partitionKeyCallback(e),f=(c=i._usedFromBucket.get(h))!==null&&c!==void 0?c:0;if(f>=i._bucketSize||i._paused)switch(p.limitReachedBehavior){case"enqueue":{var b=i._getPartitionedQueue(h);b.push(p),f+b.length>=i._bucketSize?i._logger.warn("Rate limit of ".concat(i._bucketSize," for ").concat(h?"partition ".concat(h):"default partition"," was reached, waiting for ").concat(i._paused?"the limiter to be unpaused":"a free bucket entry","; queue size is ").concat(b.length)):i._logger.info("Enqueueing request for ".concat(h?"partition ".concat(h):"default partition"," because the rate limiter is paused; queue size is ").concat(b.length));break}case"null":{p.resolve(null),i._paused?i._logger.info("Returning null for request for ".concat(h?"partition ".concat(h):"default partition"," because the rate limiter is paused")):i._logger.warn("Rate limit of ".concat(i._bucketSize," for ").concat(h?"partition ".concat(h):"default partition"," was reached, dropping request and returning null"));break}case"throw":{p.reject(new OO.RateLimitReachedError("Request dropped because ".concat(i._paused?"the rate limiter is paused":"the rate limit for ".concat(h?"partition ".concat(h):"default partition"," was reached"))));break}default:throw new Error("this should never happen")}else i._runRequest(p,h)})];case 1:return[2,a.sent()]}})})},r.prototype.clear=function(){this._partitionedQueue.clear()},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){var e,t;this._paused=!1;try{for(var i=kr.__values(this._partitionedQueue.keys()),a=i.next();!a.done;a=i.next()){var o=a.value;this._runNextRequest(o)}}catch(s){e={error:s}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype._getPartitionedQueue=function(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);var t=[];return this._partitionedQueue.set(e,t),t},r.prototype._runRequest=function(e,t){var i;return kr.__awaiter(this,void 0,void 0,function(){var a,o,s,u,c,p,h=this;return kr.__generator(this,function(f){switch(f.label){case 0:a=this._getPartitionedQueue(t),this._logger.debug("doing a request for ".concat(t?"partition ".concat(t):"default partition",", new queue length is ").concat(a.length)),this._usedFromBucket.set(t,((i=this._usedFromBucket.get(t))!==null&&i!==void 0?i:0)+1),o=e.req,s=e.resolve,u=e.reject,f.label=1;case 1:return f.trys.push([1,3,4,5]),c=s,[4,this._callback(o)];case 2:return c.apply(void 0,[f.sent()]),[3,5];case 3:return p=f.sent(),u(p),[3,5];case 4:return setTimeout(function(){var b=h._usedFromBucket.get(t)-1;h._usedFromBucket.set(t,b),a.length&&b<h._bucketSize&&h._runNextRequest(t)},this._timeFrame),[7];case 5:return[2]}})})},r.prototype._runNextRequest=function(e){if(!this._paused){var t=this._getPartitionedQueue(e),i=t.shift();i&&this._runRequest(i,e)}},r}();$a.PartitionedTimeBasedRateLimiter=BO});var Bp=l(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.TimeBasedRateLimiter=void 0;var Wi=(_(),g(y)),UO=Si(),jO=qi(),kO=function(){function r(e){var t=e.logger,i=e.bucketSize,a=e.timeFrame,o=e.doRequest;this._queue=[],this._usedFromBucket=0,this._paused=!1,this._logger=(0,UO.createLogger)(Wi.__assign({name:"rate-limiter",emoji:!0},t)),this._bucketSize=i,this._timeFrame=a,this._callback=o}return n(r,"TimeBasedRateLimiter"),r.prototype.request=function(e,t){return Wi.__awaiter(this,void 0,void 0,function(){var i=this;return Wi.__generator(this,function(a){switch(a.label){case 0:return[4,new Promise(function(o,s){var u,c={req:e,resolve:o,reject:s,limitReachedBehavior:(u=t?.limitReachedBehavior)!==null&&u!==void 0?u:"enqueue"};if(i._usedFromBucket>=i._bucketSize||i._paused)switch(c.limitReachedBehavior){case"enqueue":{i._queue.push(c),i._usedFromBucket+i._queue.length>=i._bucketSize?i._logger.warn("Rate limit of ".concat(i._bucketSize," was reached, waiting for ").concat(i._paused?"the limiter to be unpaused":"a free bucket entry","; queue size is ").concat(i._queue.length)):i._logger.info("Enqueueing request because the rate limiter is paused; queue size is ".concat(i._queue.length));break}case"null":{c.resolve(null),i._logger.warn("Rate limit of ".concat(i._bucketSize," was reached, dropping request and returning null")),i._paused?i._logger.info("Returning null for request because the rate limiter is paused"):i._logger.warn("Rate limit of ".concat(i._bucketSize," was reached, dropping request and returning null"));break}case"throw":{c.reject(new jO.RateLimitReachedError("Request dropped because ".concat(i._paused?"the rate limiter is paused":"the rate limit was reached")));break}default:throw new Error("this should never happen")}else i._runRequest(c)})];case 1:return[2,a.sent()]}})})},r.prototype.clear=function(){this._queue=[]},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){this._paused=!1,this._runNextRequest()},r.prototype._runRequest=function(e){return Wi.__awaiter(this,void 0,void 0,function(){var t,i,a,o,s,u=this;return Wi.__generator(this,function(c){switch(c.label){case 0:this._logger.debug("doing a request, new queue length is ".concat(this._queue.length)),this._usedFromBucket+=1,t=e.req,i=e.resolve,a=e.reject,c.label=1;case 1:return c.trys.push([1,3,4,5]),o=i,[4,this._callback(t)];case 2:return o.apply(void 0,[c.sent()]),[3,5];case 3:return s=c.sent(),a(s),[3,5];case 4:return setTimeout(function(){u._usedFromBucket-=1,u._queue.length&&u._usedFromBucket<u._bucketSize&&u._runNextRequest()},this._timeFrame),[7];case 5:return[2]}})})},r.prototype._runNextRequest=function(){if(!this._paused){var e=this._queue.shift();e&&this._runRequest(e)}},r}();Wa.TimeBasedRateLimiter=kO});var VS=l(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.TimedPassthruRateLimiter=void 0;var Vi=(_(),g(y)),LO=Bp(),FO=function(r){Vi.__extends(e,r);function e(t,i){return r.call(this,Vi.__assign(Vi.__assign({},i),{doRequest:function(a,o){return Vi.__awaiter(this,void 0,void 0,function(){return Vi.__generator(this,function(s){switch(s.label){case 0:return[4,t.request(a,o)];case 1:return[2,s.sent()]}})})}}))||this}return n(e,"TimedPassthruRateLimiter"),e}(LO.TimeBasedRateLimiter);Va.TimedPassthruRateLimiter=FO});var za=l(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.TimedPassthruRateLimiter=ne.TimeBasedRateLimiter=ne.ResponseBasedRateLimiter=ne.PartitionedTimeBasedRateLimiter=ne.PartitionedRateLimiter=ne.NullRateLimiter=ne.RateLimitReachedError=ne.RetryAfterError=void 0;var MO=sd();Object.defineProperty(ne,"RetryAfterError",{enumerable:!0,get:function(){return MO.RetryAfterError}});var NO=qi();Object.defineProperty(ne,"RateLimitReachedError",{enumerable:!0,get:function(){return NO.RateLimitReachedError}});var GO=Cg();Object.defineProperty(ne,"NullRateLimiter",{enumerable:!0,get:function(){return GO.NullRateLimiter}});var QO=$S();Object.defineProperty(ne,"PartitionedRateLimiter",{enumerable:!0,get:function(){return QO.PartitionedRateLimiter}});var $O=WS();Object.defineProperty(ne,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:function(){return $O.PartitionedTimeBasedRateLimiter}});var WO=Op();Object.defineProperty(ne,"ResponseBasedRateLimiter",{enumerable:!0,get:function(){return WO.ResponseBasedRateLimiter}});var VO=Bp();Object.defineProperty(ne,"TimeBasedRateLimiter",{enumerable:!0,get:function(){return VO.TimeBasedRateLimiter}});var zO=VS();Object.defineProperty(ne,"TimedPassthruRateLimiter",{enumerable:!0,get:function(){return zO.TimedPassthruRateLimiter}})});var KS=l((Lr,zS)=>{"use strict";var KO=n(function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},"getGlobal"),tr=KO();zS.exports=Lr=tr.fetch;tr.fetch&&(Lr.default=tr.fetch.bind(tr));Lr.Headers=tr.Headers;Lr.Request=tr.Request;Lr.Response=tr.Response});var ZS=l((rr,JS)=>{var zi=KS(),JO=zi.default||zi,Ka=n(function(r,e){return/^\/\//.test(r)&&(r="https:"+r),JO.call(this,r,e)},"fetch");Ka.ponyfill=!0;JS.exports=rr=Ka;rr.fetch=Ka;rr.Headers=zi.Headers;rr.Request=zi.Request;rr.Response=zi.Response;rr.default=Ka});var Ja=l((Bz,YS)=>{"use strict";var Up=Object.prototype.hasOwnProperty,Fr=Array.isArray,et=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),ZO=n(function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(Fr(i)){for(var a=[],o=0;o<i.length;++o)typeof i[o]<"u"&&a.push(i[o]);t.obj[t.prop]=a}}},"compactQueue"),XS=n(function(e,t){for(var i=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(i[a]=e[a]);return i},"arrayToObject"),XO=n(function r(e,t,i){if(!t)return e;if(typeof t!="object"){if(Fr(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Up.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return Fr(e)&&!Fr(t)&&(a=XS(e,i)),Fr(e)&&Fr(t)?(t.forEach(function(o,s){if(Up.call(e,s)){var u=e[s];u&&typeof u=="object"&&o&&typeof o=="object"?e[s]=r(u,o,i):e.push(o)}else e[s]=o}),e):Object.keys(t).reduce(function(o,s){var u=t[s];return Up.call(o,s)?o[s]=r(o[s],u,i):o[s]=u,o},a)},"merge"),YO=n(function(e,t){return Object.keys(t).reduce(function(i,a){return i[a]=t[a],i},e)},"assignSingleSource"),eB=n(function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},"decode"),tB=n(function(e,t,i){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),i==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var o="",s=0;s<a.length;++s){var u=a.charCodeAt(s);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122){o+=a.charAt(s);continue}if(u<128){o=o+et[u];continue}if(u<2048){o=o+(et[192|u>>6]+et[128|u&63]);continue}if(u<55296||u>=57344){o=o+(et[224|u>>12]+et[128|u>>6&63]+et[128|u&63]);continue}s+=1,u=65536+((u&1023)<<10|a.charCodeAt(s)&1023),o+=et[240|u>>18]+et[128|u>>12&63]+et[128|u>>6&63]+et[128|u&63]}return o},"encode"),rB=n(function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],a=0;a<t.length;++a)for(var o=t[a],s=o.obj[o.prop],u=Object.keys(s),c=0;c<u.length;++c){var p=u[c],h=s[p];typeof h=="object"&&h!==null&&i.indexOf(h)===-1&&(t.push({obj:s,prop:p}),i.push(h))}return ZO(t),e},"compact"),iB=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),nB=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),aB=n(function(e,t){return[].concat(e,t)},"combine");YS.exports={arrayToObject:XS,assign:YO,combine:aB,compact:rB,decode:eB,encode:tB,isBuffer:nB,isRegExp:iB,merge:XO}});var jp=l((jz,t0)=>{"use strict";var oB=String.prototype.replace,sB=/%20/g,uB=Ja(),e0={RFC1738:"RFC1738",RFC3986:"RFC3986"};t0.exports=uB.assign({default:e0.RFC3986,formatters:{RFC1738:function(r){return oB.call(r,sB,"+")},RFC3986:function(r){return String(r)}}},e0)});var o0=l((kz,a0)=>{"use strict";var n0=Ja(),Ki=jp(),lB=Object.prototype.hasOwnProperty,r0={brackets:n(function(e){return e+"[]"},"brackets"),comma:"comma",indices:n(function(e,t){return e+"["+t+"]"},"indices"),repeat:n(function(e){return e},"repeat")},Mr=Array.isArray,cB=Array.prototype.push,kp=n(function(r,e){cB.apply(r,Mr(e)?e:[e])},"pushToArray"),dB=Date.prototype.toISOString,i0=Ki.default,me={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n0.encode,encodeValuesOnly:!1,format:i0,formatter:Ki.formatters[i0],indices:!1,serializeDate:n(function(e){return dB.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},pB=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),hB=n(function r(e,t,i,a,o,s,u,c,p,h,f,b,P){var w=e;if(typeof u=="function"?w=u(t,w):w instanceof Date?w=h(w):i==="comma"&&Mr(w)&&(w=w.join(",")),w===null){if(a)return s&&!b?s(t,me.encoder,P,"key"):t;w=""}if(pB(w)||n0.isBuffer(w)){if(s){var x=b?t:s(t,me.encoder,P,"key");return[f(x)+"="+f(s(w,me.encoder,P,"value"))]}return[f(t)+"="+f(String(w))]}var E=[];if(typeof w>"u")return E;var R;if(Mr(u))R=u;else{var Y=Object.keys(w);R=c?Y.sort(c):Y}for(var z=0;z<R.length;++z){var re=R[z];o&&w[re]===null||(Mr(w)?kp(E,r(w[re],typeof i=="function"?i(t,re):t,i,a,o,s,u,c,p,h,f,b,P)):kp(E,r(w[re],t+(p?"."+re:"["+re+"]"),i,a,o,s,u,c,p,h,f,b,P)))}return E},"stringify"),fB=n(function(e){if(!e)return me;if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||me.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Ki.default;if(typeof e.format<"u"){if(!lB.call(Ki.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var a=Ki.formatters[i],o=me.filter;return(typeof e.filter=="function"||Mr(e.filter))&&(o=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:me.addQueryPrefix,allowDots:typeof e.allowDots>"u"?me.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:me.charsetSentinel,delimiter:typeof e.delimiter>"u"?me.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:me.encode,encoder:typeof e.encoder=="function"?e.encoder:me.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:me.encodeValuesOnly,filter:o,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:me.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:me.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:me.strictNullHandling}},"normalizeStringifyOptions");a0.exports=function(r,e){var t=r,i=fB(e),a,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):Mr(i.filter)&&(o=i.filter,a=o);var s=[];if(typeof t!="object"||t===null)return"";var u;e&&e.arrayFormat in r0?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var c=r0[u];a||(a=Object.keys(t)),i.sort&&a.sort(i.sort);for(var p=0;p<a.length;++p){var h=a[p];i.skipNulls&&t[h]===null||kp(s,hB(t[h],h,c,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.formatter,i.encodeValuesOnly,i.charset))}var f=s.join(i.delimiter),b=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?b+="utf8=%26%2310003%3B&":b+="utf8=%E2%9C%93&"),f.length>0?b+f:""}});var c0=l((Fz,l0)=>{"use strict";var Ji=Ja(),Lp=Object.prototype.hasOwnProperty,s0=Array.isArray,de={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ji.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},mB=n(function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),u0=n(function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},"parseArrayValue"),yB=n(function(e,t){if(s0(e)){for(var i=[],a=0;a<e.length;a+=1)i.push(t(e[a]));return i}return t(e)},"maybeMap"),_B="utf8=%26%2310003%3B",gB="utf8=%E2%9C%93",bB=n(function(e,t){var i={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=t.parameterLimit===1/0?void 0:t.parameterLimit,s=a.split(t.delimiter,o),u=-1,c,p=t.charset;if(t.charsetSentinel)for(c=0;c<s.length;++c)s[c].indexOf("utf8=")===0&&(s[c]===gB?p="utf-8":s[c]===_B&&(p="iso-8859-1"),u=c,c=s.length);for(c=0;c<s.length;++c)if(c!==u){var h=s[c],f=h.indexOf("]="),b=f===-1?h.indexOf("="):f+1,P,w;b===-1?(P=t.decoder(h,de.decoder,p,"key"),w=t.strictNullHandling?null:""):(P=t.decoder(h.slice(0,b),de.decoder,p,"key"),w=yB(u0(h.slice(b+1),t),function(x){return t.decoder(x,de.decoder,p,"value")})),w&&t.interpretNumericEntities&&p==="iso-8859-1"&&(w=mB(w)),h.indexOf("[]=")>-1&&(w=s0(w)?[w]:w),Lp.call(i,P)?i[P]=Ji.combine(i[P],w):i[P]=w}return i},"parseQueryStringValues"),vB=n(function(r,e,t,i){for(var a=i?e:u0(e,t),o=r.length-1;o>=0;--o){var s,u=r[o];if(u==="[]"&&t.parseArrays)s=[].concat(a);else{s=t.plainObjects?Object.create(null):{};var c=u.charAt(0)==="["&&u.charAt(u.length-1)==="]"?u.slice(1,-1):u,p=parseInt(c,10);!t.parseArrays&&c===""?s={0:a}:!isNaN(p)&&u!==c&&String(p)===c&&p>=0&&t.parseArrays&&p<=t.arrayLimit?(s=[],s[p]=a):s[c]=a}a=s}return a},"parseObject"),wB=n(function(e,t,i,a){if(e){var o=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,c=i.depth>0&&s.exec(o),p=c?o.slice(0,c.index):o,h=[];if(p){if(!i.plainObjects&&Lp.call(Object.prototype,p)&&!i.allowPrototypes)return;h.push(p)}for(var f=0;i.depth>0&&(c=u.exec(o))!==null&&f<i.depth;){if(f+=1,!i.plainObjects&&Lp.call(Object.prototype,c[1].slice(1,-1))&&!i.allowPrototypes)return;h.push(c[1])}return c&&h.push("["+o.slice(c.index)+"]"),vB(h,t,i,a)}},"parseQueryStringKeys"),xB=n(function(e){if(!e)return de;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?de.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?de.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:de.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:de.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:de.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:de.comma,decoder:typeof e.decoder=="function"?e.decoder:de.decoder,delimiter:typeof e.delimiter=="string"||Ji.isRegExp(e.delimiter)?e.delimiter:de.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:de.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:de.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:de.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:de.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:de.strictNullHandling}},"normalizeParseOptions");l0.exports=function(r,e){var t=xB(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?bB(r,t):r,a=t.plainObjects?Object.create(null):{},o=Object.keys(i),s=0;s<o.length;++s){var u=o[s],c=wB(u,i[u],t,typeof r=="string");a=Ji.merge(a,c,t)}return Ji.compact(a)}});var Fp=l((Nz,d0)=>{"use strict";var SB=o0(),qB=c0(),PB=jp();d0.exports={formats:PB,parse:qB,stringify:SB}});var h0=l(p0=>{function ft(r){if(typeof r!="object")return r;var e,t,i=Object.prototype.toString.call(r);if(i==="[object Object]"){if(r.constructor!==Object&&typeof r.constructor=="function"){t=new r.constructor;for(e in r)r.hasOwnProperty(e)&&t[e]!==r[e]&&(t[e]=ft(r[e]))}else{t={};for(e in r)e==="__proto__"?Object.defineProperty(t,e,{value:ft(r[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=ft(r[e])}return t}if(i==="[object Array]"){for(e=r.length,t=Array(e);e--;)t[e]=ft(r[e]);return t}return i==="[object Set]"?(t=new Set,r.forEach(function(a){t.add(ft(a))}),t):i==="[object Map]"?(t=new Map,r.forEach(function(a,o){t.set(ft(o),ft(a))}),t):i==="[object Date]"?new Date(+r):i==="[object RegExp]"?(t=new RegExp(r.source,r.flags),t.lastIndex=r.lastIndex,t):i==="[object DataView]"?new r.constructor(ft(r.buffer)):i==="[object ArrayBuffer]"?r.slice(0):i.slice(-6)==="Array]"?new r.constructor(r):r}n(ft,"klona");p0.klona=ft});var Np=l(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.DataObject=tt.getRawData=tt.rawDataSymbol=void 0;var CB=h0();tt.rawDataSymbol=Symbol("twurpleRawData");function HB(r){return(0,CB.klona)(r[tt.rawDataSymbol])}n(HB,"getRawData");tt.getRawData=HB;var Mp=class{static{n(this,"DataObject")}constructor(e){this[tt.rawDataSymbol]=e}};tt.DataObject=Mp});var Xa=l(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.CustomError=void 0;var Gp=class extends Error{static{n(this,"CustomError")}constructor(e,t){var i;super(e,t),Object.setPrototypeOf(this,new.target.prototype),(i=Error.captureStackTrace)===null||i===void 0||i.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};Za.CustomError=Gp});var $p=l(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});Ya.RelationAssertionError=void 0;var EB=Xa(),Qp=class extends EB.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};Ya.RelationAssertionError=Qp});var f0=l(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.checkRelationAssertion=void 0;var AB=$p();function TB(r){if(r==null)throw new AB.RelationAssertionError;return r}n(TB,"checkRelationAssertion");eo.checkRelationAssertion=TB});var Wp=l(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.rtfm=void 0;function IB(r,e,t){return i=>{let a=t?function(){return`[${e}#${this[t]} - please check https://twurple.js.org/reference/${r}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${r}/classes/${e}.html for available properties]`};Object.defineProperty(i.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:a,enumerable:!1})}}n(IB,"rtfm");to.rtfm=IB});var m0=l(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.HelixExtension=void 0;var RB=(_(),g(y)),H=Np(),DB=Wp(),Vp=class extends H.DataObject{static{n(this,"HelixExtension")}get authorName(){return this[H.rawDataSymbol].author_name}get bitsEnabled(){return this[H.rawDataSymbol].bits_enabled}get installable(){return this[H.rawDataSymbol].can_install}get configurationLocation(){return this[H.rawDataSymbol].configuration_location}get description(){return this[H.rawDataSymbol].description}get tosUrl(){return this[H.rawDataSymbol].eula_tos_url}get hasChatSupport(){return this[H.rawDataSymbol].has_chat_support}get iconUrl(){return this[H.rawDataSymbol].icon_url}getIconUrl(e){return this[H.rawDataSymbol].icon_urls[e]}get id(){return this[H.rawDataSymbol].id}get name(){return this[H.rawDataSymbol].name}get privacyPolicyUrl(){return this[H.rawDataSymbol].privacy_policy_url}get requestsIdentityLink(){return this[H.rawDataSymbol].request_identity_link}get screenshotUrls(){return this[H.rawDataSymbol].screenshot_urls}get state(){return this[H.rawDataSymbol].state}get subscriptionsSupportLevel(){return this[H.rawDataSymbol].subscriptions_support_level}get summary(){return this[H.rawDataSymbol].summary}get supportEmail(){return this[H.rawDataSymbol].support_email}get version(){return this[H.rawDataSymbol].version}get viewerSummery(){return this[H.rawDataSymbol].viewer_summary}get allowedConfigUrls(){return this[H.rawDataSymbol].allowlisted_config_urls}get allowedPanelUrls(){return this[H.rawDataSymbol].allowlisted_panel_urls}get mobileViewerUrl(){var e,t;return(t=(e=this[H.rawDataSymbol].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelViewerUrl(){var e,t;return(t=(e=this[H.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelHeight(){var e,t;return(t=(e=this[H.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.height)!==null&&t!==void 0?t:null}get panelCanLinkExternalContent(){var e,t;return(t=(e=this[H.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get overlayViewerUrl(){var e,t;return(t=(e=this[H.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get overlayCanLinkExternalContent(){var e,t;return(t=(e=this[H.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get componentViewerUrl(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get componentAspectWidth(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&t!==void 0?t:null}get componentAspectHeight(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&t!==void 0?t:null}get componentAspectRatioX(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&t!==void 0?t:null}get componentAspectRatioY(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&t!==void 0?t:null}get componentAutoScales(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&t!==void 0?t:null}get componentScalePixels(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&t!==void 0?t:null}get componentTargetHeight(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.target_height)!==null&&t!==void 0?t:null}get componentSize(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:null}get componentZoom(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom)!==null&&t!==void 0?t:null}get componentZoomPixels(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&t!==void 0?t:null}get componentCanLinkExternalContent(){var e,t;return(t=(e=this[H.rawDataSymbol].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get configViewerUrl(){var e,t;return(t=(e=this[H.rawDataSymbol].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get configCanLinkExternalContent(){var e,t;return(t=(e=this[H.rawDataSymbol].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}};Vp=RB.__decorate([(0,DB.rtfm)("api","HelixExtension","id")],Vp);ro.HelixExtension=Vp});var y0=l(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.HellFreezesOverError=void 0;var OB=Xa(),zp=class extends OB.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};io.HellFreezesOverError=zp});var _0=l(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.extractUserName=Nr.extractUserId=void 0;function BB(r){return typeof r=="string"?r:typeof r=="number"?r.toString(10):r.id}n(BB,"extractUserId");Nr.extractUserId=BB;function UB(r){return typeof r=="string"?r:r.name}n(UB,"extractUserName");Nr.extractUserName=UB});var m=l(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.extractUserName=N.extractUserId=N.RelationAssertionError=N.HellFreezesOverError=N.CustomError=N.HelixExtension=N.rtfm=N.checkRelationAssertion=N.rawDataSymbol=N.getRawData=N.DataObject=void 0;var Kp=Np();Object.defineProperty(N,"DataObject",{enumerable:!0,get:function(){return Kp.DataObject}});Object.defineProperty(N,"getRawData",{enumerable:!0,get:function(){return Kp.getRawData}});Object.defineProperty(N,"rawDataSymbol",{enumerable:!0,get:function(){return Kp.rawDataSymbol}});var jB=f0();Object.defineProperty(N,"checkRelationAssertion",{enumerable:!0,get:function(){return jB.checkRelationAssertion}});var kB=Wp();Object.defineProperty(N,"rtfm",{enumerable:!0,get:function(){return kB.rtfm}});var LB=m0();Object.defineProperty(N,"HelixExtension",{enumerable:!0,get:function(){return LB.HelixExtension}});var FB=Xa();Object.defineProperty(N,"CustomError",{enumerable:!0,get:function(){return FB.CustomError}});var MB=y0();Object.defineProperty(N,"HellFreezesOverError",{enumerable:!0,get:function(){return MB.HellFreezesOverError}});var NB=$p();Object.defineProperty(N,"RelationAssertionError",{enumerable:!0,get:function(){return NB.RelationAssertionError}});var g0=_0();Object.defineProperty(N,"extractUserId",{enumerable:!0,get:function(){return g0.extractUserId}});Object.defineProperty(N,"extractUserName",{enumerable:!0,get:function(){return g0.extractUserName}})});var Zp=l(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.HttpStatusCodeError=void 0;var GB=m(),Jp=class extends GB.CustomError{static{n(this,"HttpStatusCodeError")}constructor(e,t,i,a,o,s){super(`Encountered HTTP status code ${e}: ${t}
|
|
1
|
+
var Aa=Object.defineProperty;var Xb=Object.getOwnPropertyDescriptor;var Yb=Object.getOwnPropertyNames;var ex=Object.prototype.hasOwnProperty;var a=(i,e)=>Aa(i,"name",{value:e,configurable:!0});var tx=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),rx=(i,e)=>{for(var t in e)Aa(i,t,{get:e[t],enumerable:!0})},ix=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Yb(e))!ex.call(i,n)&&n!==t&&Aa(i,n,{get:()=>e[n],enumerable:!(r=Xb(e,n))||r.enumerable});return i};var b=i=>ix(Aa({},"__esModule",{value:!0}),i);var nr=u((nI,r_)=>{var tu=class i{static{a(this,"Emote")}constructor(e,t,r){if(new.target.name===i.name)throw new Error("Base Emote class cannot be used");this.fetcher=e.fetcher,this.channel=e,this.id=t,this.type=null,this._setup(r)}_setup(e){this.code=e.code}toLink(){return null}toString(){return this.code}toObject(){return{code:this.code,id:this.id,channel_id:this.channel.channel_id}}};r_.exports=tu});var bt=u((sI,i_)=>{i_.exports={Twitch:{CDN:(i,e)=>`https://static-cdn.jtvnw.net/emoticons/v2/${i}/default/dark/${e+1}.0`},BTTV:{Global:"https://api.betterttv.net/3/cached/emotes/global",Channel:i=>`https://api.betterttv.net/3/cached/users/twitch/${i}`,CDN:(i,e)=>`https://cdn.betterttv.net/emote/${i}/${e+1}x.webp`},SevenTV:{Global:"https://7tv.io/v3/emote-sets/global",Channel:i=>`https://7tv.io/v3/users/twitch/${i}`,CDN:(i,e)=>`https://cdn.7tv.app/emote/${i}/${e}`},FFZ:{sets:{Global:3,Modifiers:1532818},Set:i=>`https://api.frankerfacez.com/v1/set/${i}`,Channel:i=>`https://api.frankerfacez.com/v1/room/id/${i}`,CDN:(i,e)=>`https://cdn.frankerfacez.com/emote/${i}/${e}`,CDNAnimated:(i,e)=>`https://cdn.frankerfacez.com/emote/${i}/animated/${e}.webp`},Templates:{html:'<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',markdown:'',bbcode:"[img]{link}[/img]",plain:"{link}"}}});var iu=u((oI,n_)=>{var nx=nr(),ax=bt(),ru=class i extends nx{static{a(this,"BTTVEmote")}constructor(e,t,r){super(e,t,r),this.type="bttv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.ownerName="user"in e?e.user.name:null,this.animated=e.animated,this.imageType="webp"}toLink(e=0){return ax.BTTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,ownerName:this.ownerName,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,user:{name:e.ownerName}})}};n_.exports=ru});var Da=u((uI,a_)=>{var nu=class extends Map{static{a(this,"Collection")}find(e,t){if(typeof e=="string"){if(typeof t>"u")return null;for(let r of this.values())if(r[e]===t)return r;return null}if(typeof e=="function"){let r=0;for(let n of this.values()){if(e(n,r,this))return n;r++}return null}return null}filter(e,t){t&&(e=e.bind(t));let r=new this.constructor,n=0;for(let[s,o]of this)e(o,n,this)&&r.set(s,o),n++;return r}map(e,t){t&&(e=e.bind(t));let r=new Array(this.size),n=0;for(let s of this.values())r[n]=e(s,n,this),n++;return r}};a_.exports=nu});var su=u((dI,s_)=>{var sx=Da(),au=class{static{a(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new sx}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};s_.exports=au});var lu=u((pI,l_)=>{var ox=nr(),o_=bt(),ou=class i extends ox{static{a(this,"FFZEmote")}constructor(e,t,r){super(e,t,r),this.type="ffz"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.name:null,this.sizes="animated"in e?Object.keys(e.animated):Object.keys(e.urls),this.animated="animated"in e,this.imageType="animated"in e?"webp":"png",this.modifier=e.modifier&&(e.modifier_flags&1)!==0}toLink(e=0){return e=this.sizes[e],this.animated?o_.FFZ.CDNAnimated(this.id,e):o_.FFZ.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,modifier:this.modifier})}static fromObject(e,t=null){let r=e.sizes.reduce((n,s)=>(n[s]=s,n),{});return new i(t,e.id,{code:e.code,name:e.code,urls:r,...e.animated?{animated:r}:{},owner:{name:e.ownerName},modifier:e.modifier,modifier_flags:e.modifier})}};l_.exports=ou});var cu=u((mI,u_)=>{var lx=nr(),ux=bt(),uu=class i extends lx{static{a(this,"SevenTVEmote")}constructor(e,t,r){super(e,t,r),this.type="7tv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.display_name:null,this.sizes=e.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],ux.SevenTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,imageType:this.imageType})}static fromObject(e,t){let r=e.sizes.map(n=>({format:t.format.toUpperCase(),name:n}));return new i(t,e.id,{code:e.code,name:e.code,animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}})}};u_.exports=uu});var hu=u((fI,c_)=>{var cx=nr(),dx=bt(),du=class i extends cx{static{a(this,"TwitchEmote")}constructor(e,t,r){super(e,t,r),this.type="twitch"}get owner(){return this.channel}_setup(e){super._setup(e),this.set=e.emoticon_set,this.animated="animated"in e.formats,this.imageType="animated"in e.formats?"gif":"png"}toLink(e=0){return dx.Twitch.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,set:this.set,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,emoticon_set:e.set,formats:e.animated?{animated:e.animated}:{}})}};c_.exports=du});var G_=u((bI,Q_)=>{"use strict";function v_(i,e){return a(function(){return i.apply(e,arguments)},"wrap")}a(v_,"bind");var{toString:hx}=Object.prototype,{getPrototypeOf:Hu}=Object,Ba=(i=>e=>{let t=hx.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ke=a(i=>(i=i.toLowerCase(),e=>Ba(e)===i),"kindOfTest"),Oa=a(i=>e=>typeof e===i,"typeOfTest"),{isArray:lr}=Array,zr=Oa("undefined");function px(i){return i!==null&&!zr(i)&&i.constructor!==null&&!zr(i.constructor)&&Be(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}a(px,"isBuffer");var S_=Ke("ArrayBuffer");function _x(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&S_(i.buffer),e}a(_x,"isArrayBufferView");var mx=Oa("string"),Be=Oa("function"),H_=Oa("number"),Ua=a(i=>i!==null&&typeof i=="object","isObject"),yx=a(i=>i===!0||i===!1,"isBoolean"),Ta=a(i=>{if(Ba(i)!=="object")return!1;let e=Hu(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},"isPlainObject"),fx=Ke("Date"),gx=Ke("File"),bx=Ke("Blob"),xx=Ke("FileList"),wx=a(i=>Ua(i)&&Be(i.pipe),"isStream"),vx=a(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Be(i.append)&&((e=Ba(i))==="formdata"||e==="object"&&Be(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Sx=Ke("URLSearchParams"),Hx=a(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function Kr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,n;if(typeof i!="object"&&(i=[i]),lr(i))for(r=0,n=i.length;r<n;r++)e.call(null,i[r],r,i);else{let s=t?Object.getOwnPropertyNames(i):Object.keys(i),o=s.length,l;for(r=0;r<o;r++)l=s[r],e.call(null,i[l],l,i)}}a(Kr,"forEach");function C_(i,e){e=e.toLowerCase();let t=Object.keys(i),r=t.length,n;for(;r-- >0;)if(n=t[r],e===n.toLowerCase())return n;return null}a(C_,"findKey");var q_=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,E_=a(i=>!zr(i)&&i!==q_,"isContextDefined");function fu(){let{caseless:i}=E_(this)&&this||{},e={},t=a((r,n)=>{let s=i&&C_(e,n)||n;Ta(e[s])&&Ta(r)?e[s]=fu(e[s],r):Ta(r)?e[s]=fu({},r):lr(r)?e[s]=r.slice():e[s]=r},"assignValue");for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&Kr(arguments[r],t);return e}a(fu,"merge");var Cx=a((i,e,t,{allOwnKeys:r}={})=>(Kr(e,(n,s)=>{t&&Be(n)?i[s]=v_(n,t):i[s]=n},{allOwnKeys:r}),i),"extend"),qx=a(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),Ex=a((i,e,t,r)=>{i.prototype=Object.create(e.prototype,r),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},"inherits"),Px=a((i,e,t,r)=>{let n,s,o,l={};if(e=e||{},i==null)return e;do{for(n=Object.getOwnPropertyNames(i),s=n.length;s-- >0;)o=n[s],(!r||r(o,i,e))&&!l[o]&&(e[o]=i[o],l[o]=!0);i=t!==!1&&Hu(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),Ax=a((i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;let r=i.indexOf(e,t);return r!==-1&&r===t},"endsWith"),Dx=a(i=>{if(!i)return null;if(lr(i))return i;let e=i.length;if(!H_(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),Tx=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Hu(Uint8Array)),Ix=a((i,e)=>{let r=(i&&i[Symbol.iterator]).call(i),n;for(;(n=r.next())&&!n.done;){let s=n.value;e.call(i,s[0],s[1])}},"forEachEntry"),Rx=a((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),Bx=Ke("HTMLFormElement"),Ox=a(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,a(function(t,r,n){return r.toUpperCase()+n},"replacer")),"toCamelCase"),d_=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Ux=Ke("RegExp"),P_=a((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};Kr(t,(n,s)=>{let o;(o=e(n,s,i))!==!1&&(r[s]=o||n)}),Object.defineProperties(i,r)},"reduceDescriptors"),kx=a(i=>{P_(i,(e,t)=>{if(Be(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(Be(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),jx=a((i,e)=>{let t={},r=a(n=>{n.forEach(s=>{t[s]=!0})},"define");return lr(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),Mx=a(()=>{},"noop"),Lx=a((i,e)=>(i=+i,Number.isFinite(i)?i:e),"toFiniteNumber"),pu="abcdefghijklmnopqrstuvwxyz",h_="0123456789",A_={DIGIT:h_,ALPHA:pu,ALPHA_DIGIT:pu+pu.toUpperCase()+h_},Fx=a((i=16,e=A_.ALPHA_DIGIT)=>{let t="",{length:r}=e;for(;i--;)t+=e[Math.random()*r|0];return t},"generateString");function Nx(i){return!!(i&&Be(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}a(Nx,"isSpecCompliantForm");var Qx=a(i=>{let e=new Array(10),t=a((r,n)=>{if(Ua(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[n]=r;let s=lr(r)?[]:{};return Kr(r,(o,l)=>{let d=t(o,n+1);!zr(d)&&(s[l]=d)}),e[n]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),Gx=Ke("AsyncFunction"),Vx=a(i=>i&&(Ua(i)||Be(i))&&Be(i.then)&&Be(i.catch),"isThenable"),x={isArray:lr,isArrayBuffer:S_,isBuffer:px,isFormData:vx,isArrayBufferView:_x,isString:mx,isNumber:H_,isBoolean:yx,isObject:Ua,isPlainObject:Ta,isUndefined:zr,isDate:fx,isFile:gx,isBlob:bx,isRegExp:Ux,isFunction:Be,isStream:wx,isURLSearchParams:Sx,isTypedArray:Tx,isFileList:xx,forEach:Kr,merge:fu,extend:Cx,trim:Hx,stripBOM:qx,inherits:Ex,toFlatObject:Px,kindOf:Ba,kindOfTest:Ke,endsWith:Ax,toArray:Dx,forEachEntry:Ix,matchAll:Rx,isHTMLForm:Bx,hasOwnProperty:d_,hasOwnProp:d_,reduceDescriptors:P_,freezeMethods:kx,toObjectSet:jx,toCamelCase:Ox,noop:Mx,toFiniteNumber:Lx,findKey:C_,global:q_,isContextDefined:E_,ALPHABET:A_,generateString:Fx,isSpecCompliantForm:Nx,toJSONObject:Qx,isAsyncFn:Gx,isThenable:Vx};function R(i,e,t,r,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),n&&(this.response=n)}a(R,"AxiosError");x.inherits(R,Error,{toJSON:a(function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:x.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}},"toJSON")});var D_=R.prototype,T_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{T_[i]={value:i}});Object.defineProperties(R,T_);Object.defineProperty(D_,"isAxiosError",{value:!0});R.from=(i,e,t,r,n,s)=>{let o=Object.create(D_);return x.toFlatObject(i,o,a(function(d){return d!==Error.prototype},"filter"),l=>l!=="isAxiosError"),R.call(o,i.message,e,t,r,n),o.cause=i,o.name=i.name,s&&Object.assign(o,s),o};var Wx=null;function gu(i){return x.isPlainObject(i)||x.isArray(i)}a(gu,"isVisitable");function I_(i){return x.endsWith(i,"[]")?i.slice(0,-2):i}a(I_,"removeBrackets");function p_(i,e,t){return i?i.concat(e).map(a(function(n,s){return n=I_(n),!t&&s?"["+n+"]":n},"each")).join(t?".":""):e}a(p_,"renderKey");function $x(i){return x.isArray(i)&&!i.some(gu)}a($x,"isFlatArray");var zx=x.toFlatObject(x,{},null,a(function(e){return/^is[A-Z]/.test(e)},"filter"));function ka(i,e,t){if(!x.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=x.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,a(function(C,D){return!x.isUndefined(D[C])},"defined"));let r=t.metaTokens,n=t.visitor||h,s=t.dots,o=t.indexes,d=(t.Blob||typeof Blob<"u"&&Blob)&&x.isSpecCompliantForm(e);if(!x.isFunction(n))throw new TypeError("visitor must be a function");function p(w){if(w===null)return"";if(x.isDate(w))return w.toISOString();if(!d&&x.isBlob(w))throw new R("Blob is not supported. Use a Buffer instead.");return x.isArrayBuffer(w)||x.isTypedArray(w)?d&&typeof Blob=="function"?new Blob([w]):Buffer.from(w):w}a(p,"convertValue");function h(w,C,D){let O=w;if(w&&!D&&typeof w=="object"){if(x.endsWith(C,"{}"))C=r?C:C.slice(0,-2),w=JSON.stringify(w);else if(x.isArray(w)&&$x(w)||(x.isFileList(w)||x.endsWith(C,"[]"))&&(O=x.toArray(w)))return C=I_(C),O.forEach(a(function(be,_e){!(x.isUndefined(be)||be===null)&&e.append(o===!0?p_([C],_e,s):o===null?C:C+"[]",p(be))},"each")),!1}return gu(w)?!0:(e.append(p_(D,C,s),p(w)),!1)}a(h,"defaultVisitor");let _=[],H=Object.assign(zx,{defaultVisitor:h,convertValue:p,isVisitable:gu});function A(w,C){if(!x.isUndefined(w)){if(_.indexOf(w)!==-1)throw Error("Circular reference detected in "+C.join("."));_.push(w),x.forEach(w,a(function(O,Ee){(!(x.isUndefined(O)||O===null)&&n.call(e,O,x.isString(Ee)?Ee.trim():Ee,C,H))===!0&&A(O,C?C.concat(Ee):[Ee])},"each")),_.pop()}}if(a(A,"build"),!x.isObject(i))throw new TypeError("data must be an object");return A(i),e}a(ka,"toFormData");function __(i){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,a(function(r){return e[r]},"replacer"))}a(__,"encode$1");function Cu(i,e){this._pairs=[],i&&ka(i,this,e)}a(Cu,"AxiosURLSearchParams");var R_=Cu.prototype;R_.append=a(function(e,t){this._pairs.push([e,t])},"append");R_.toString=a(function(e){let t=e?function(r){return e.call(this,r,__)}:__;return this._pairs.map(a(function(n){return t(n[0])+"="+t(n[1])},"each"),"").join("&")},"toString");function Kx(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}a(Kx,"encode");function B_(i,e,t){if(!e)return i;let r=t&&t.encode||Kx,n=t&&t.serialize,s;if(n?s=n(e,t):s=x.isURLSearchParams(e)?e.toString():new Cu(e,t).toString(r),s){let o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}a(B_,"buildURL");var bu=class{static{a(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){x.forEach(this.handlers,a(function(r){r!==null&&e(r)},"forEachHandler"))}},m_=bu,O_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Jx=typeof URLSearchParams<"u"?URLSearchParams:Cu,Zx=typeof FormData<"u"?FormData:null,Xx=typeof Blob<"u"?Blob:null,Yx={isBrowser:!0,classes:{URLSearchParams:Jx,FormData:Zx,Blob:Xx},protocols:["http","https","file","blob","url","data"]},U_=typeof window<"u"&&typeof document<"u",ew=(i=>U_&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),tw=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",rw=Object.freeze({__proto__:null,hasBrowserEnv:U_,hasStandardBrowserWebWorkerEnv:tw,hasStandardBrowserEnv:ew}),ze={...rw,...Yx};function iw(i,e){return ka(i,new ze.classes.URLSearchParams,Object.assign({visitor:function(t,r,n,s){return ze.isNode&&x.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}a(iw,"toURLEncodedForm");function nw(i){return x.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}a(nw,"parsePropPath");function aw(i){let e={},t=Object.keys(i),r,n=t.length,s;for(r=0;r<n;r++)s=t[r],e[s]=i[s];return e}a(aw,"arrayToObject");function k_(i){function e(t,r,n,s){let o=t[s++];if(o==="__proto__")return!0;let l=Number.isFinite(+o),d=s>=t.length;return o=!o&&x.isArray(n)?n.length:o,d?(x.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!l):((!n[o]||!x.isObject(n[o]))&&(n[o]=[]),e(t,r,n[o],s)&&x.isArray(n[o])&&(n[o]=aw(n[o])),!l)}if(a(e,"buildPath"),x.isFormData(i)&&x.isFunction(i.entries)){let t={};return x.forEachEntry(i,(r,n)=>{e(nw(r),n,t,0)}),t}return null}a(k_,"formDataToJSON");function sw(i,e,t){if(x.isString(i))try{return(e||JSON.parse)(i),x.trim(i)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(i)}a(sw,"stringifySafely");var qu={transitional:O_,adapter:["xhr","http"],transformRequest:[a(function(e,t){let r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=x.isObject(e);if(s&&x.isHTMLForm(e)&&(e=new FormData(e)),x.isFormData(e))return n?JSON.stringify(k_(e)):e;if(x.isArrayBuffer(e)||x.isBuffer(e)||x.isStream(e)||x.isFile(e)||x.isBlob(e))return e;if(x.isArrayBufferView(e))return e.buffer;if(x.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return iw(e,this.formSerializer).toString();if((l=x.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return ka(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),sw(e)):e},"transformRequest")],transformResponse:[a(function(e){let t=this.transitional||qu.transitional,r=t&&t.forcedJSONParsing,n=this.responseType==="json";if(e&&x.isString(e)&&(r&&!this.responseType||n)){let o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?R.from(l,R.ERR_BAD_RESPONSE,this,null,this.response):l}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ze.classes.FormData,Blob:ze.classes.Blob},validateStatus:a(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};x.forEach(["delete","get","head","post","put","patch"],i=>{qu.headers[i]={}});var Eu=qu,ow=x.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lw=a(i=>{let e={},t,r,n;return i&&i.split(`
|
|
2
|
+
`).forEach(a(function(o){n=o.indexOf(":"),t=o.substring(0,n).trim().toLowerCase(),r=o.substring(n+1).trim(),!(!t||e[t]&&ow[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),y_=Symbol("internals");function $r(i){return i&&String(i).trim().toLowerCase()}a($r,"normalizeHeader");function Ia(i){return i===!1||i==null?i:x.isArray(i)?i.map(Ia):String(i)}a(Ia,"normalizeValue");function uw(i){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(i);)e[r[1]]=r[2];return e}a(uw,"parseTokens");var cw=a(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function _u(i,e,t,r,n){if(x.isFunction(r))return r.call(this,e,t);if(n&&(e=t),!!x.isString(e)){if(x.isString(r))return e.indexOf(r)!==-1;if(x.isRegExp(r))return r.test(e)}}a(_u,"matchHeaderValue");function dw(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}a(dw,"formatHeader");function hw(i,e){let t=x.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(i,r+t,{value:function(n,s,o){return this[r].call(this,e,n,s,o)},configurable:!0})})}a(hw,"buildAccessors");var ar=class{static{a(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,r){let n=this;function s(l,d,p){let h=$r(d);if(!h)throw new Error("header name must be a non-empty string");let _=x.findKey(n,h);(!_||n[_]===void 0||p===!0||p===void 0&&n[_]!==!1)&&(n[_||d]=Ia(l))}a(s,"setHeader");let o=a((l,d)=>x.forEach(l,(p,h)=>s(p,h,d)),"setHeaders");return x.isPlainObject(e)||e instanceof this.constructor?o(e,t):x.isString(e)&&(e=e.trim())&&!cw(e)?o(lw(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=$r(e),e){let r=x.findKey(this,e);if(r){let n=this[r];if(!t)return n;if(t===!0)return uw(n);if(x.isFunction(t))return t.call(this,n,r);if(x.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=$r(e),e){let r=x.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||_u(this,this[r],r,t)))}return!1}delete(e,t){let r=this,n=!1;function s(o){if(o=$r(o),o){let l=x.findKey(r,o);l&&(!t||_u(r,r[l],l,t))&&(delete r[l],n=!0)}}return a(s,"deleteHeader"),x.isArray(e)?e.forEach(s):s(e),n}clear(e){let t=Object.keys(this),r=t.length,n=!1;for(;r--;){let s=t[r];(!e||_u(this,this[s],s,e,!0))&&(delete this[s],n=!0)}return n}normalize(e){let t=this,r={};return x.forEach(this,(n,s)=>{let o=x.findKey(r,s);if(o){t[o]=Ia(n),delete t[s];return}let l=e?dw(s):String(s).trim();l!==s&&delete t[s],t[l]=Ia(n),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return x.forEach(this,(r,n)=>{r!=null&&r!==!1&&(t[n]=e&&x.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(n=>r.set(n)),r}static accessor(e){let r=(this[y_]=this[y_]={accessors:{}}).accessors,n=this.prototype;function s(o){let l=$r(o);r[l]||(hw(n,o),r[l]=!0)}return a(s,"defineAccessor"),x.isArray(e)?e.forEach(s):s(e),this}};ar.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);x.reduceDescriptors(ar.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(r){this[t]=r}}});x.freezeMethods(ar);var ot=ar;function mu(i,e){let t=this||Eu,r=e||t,n=ot.from(r.headers),s=r.data;return x.forEach(i,a(function(l){s=l.call(t,s,n.normalize(),e?e.status:void 0)},"transform")),n.normalize(),s}a(mu,"transformData");function j_(i){return!!(i&&i.__CANCEL__)}a(j_,"isCancel");function Jr(i,e,t){R.call(this,i??"canceled",R.ERR_CANCELED,e,t),this.name="CanceledError"}a(Jr,"CanceledError");x.inherits(Jr,R,{__CANCEL__:!0});function pw(i,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?i(t):e(new R("Request failed with status code "+t.status,[R.ERR_BAD_REQUEST,R.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}a(pw,"settle");var _w=ze.hasStandardBrowserEnv?{write(i,e,t,r,n,s){let o=[i+"="+encodeURIComponent(e)];x.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),x.isString(r)&&o.push("path="+r),x.isString(n)&&o.push("domain="+n),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(i){let e=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function mw(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}a(mw,"isAbsoluteURL");function yw(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}a(yw,"combineURLs");function M_(i,e){return i&&!mw(e)?yw(i,e):e}a(M_,"buildFullPath");var fw=ze.hasStandardBrowserEnv?a(function(){let e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function n(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return a(n,"resolveURL"),r=n(window.location.href),a(function(o){let l=x.isString(o)?n(o):o;return l.protocol===r.protocol&&l.host===r.host},"isURLSameOrigin")},"standardBrowserEnv")():a(function(){return a(function(){return!0},"isURLSameOrigin")},"nonStandardBrowserEnv")();function gw(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}a(gw,"parseProtocol");function bw(i,e){i=i||10;let t=new Array(i),r=new Array(i),n=0,s=0,o;return e=e!==void 0?e:1e3,a(function(d){let p=Date.now(),h=r[s];o||(o=p),t[n]=d,r[n]=p;let _=s,H=0;for(;_!==n;)H+=t[_++],_=_%i;if(n=(n+1)%i,n===s&&(s=(s+1)%i),p-o<e)return;let A=h&&p-h;return A?Math.round(H*1e3/A):void 0},"push")}a(bw,"speedometer");function f_(i,e){let t=0,r=bw(50,250);return n=>{let s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-t,d=r(l),p=s<=o;t=s;let h={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:d||void 0,estimated:d&&o&&p?(o-s)/d:void 0,event:n};h[e?"download":"upload"]=!0,i(h)}}a(f_,"progressEventReducer");var xw=typeof XMLHttpRequest<"u",ww=xw&&function(i){return new Promise(a(function(t,r){let n=i.data,s=ot.from(i.headers).normalize(),{responseType:o,withXSRFToken:l}=i,d;function p(){i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}a(p,"done");let h;if(x.isFormData(n)){if(ze.hasStandardBrowserEnv||ze.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((h=s.getContentType())!==!1){let[C,...D]=h?h.split(";").map(O=>O.trim()).filter(Boolean):[];s.setContentType([C||"multipart/form-data",...D].join("; "))}}let _=new XMLHttpRequest;if(i.auth){let C=i.auth.username||"",D=i.auth.password?unescape(encodeURIComponent(i.auth.password)):"";s.set("Authorization","Basic "+btoa(C+":"+D))}let H=M_(i.baseURL,i.url);_.open(i.method.toUpperCase(),B_(H,i.params,i.paramsSerializer),!0),_.timeout=i.timeout;function A(){if(!_)return;let C=ot.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),O={data:!o||o==="text"||o==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:C,config:i,request:_};pw(a(function(be){t(be),p()},"_resolve"),a(function(be){r(be),p()},"_reject"),O),_=null}if(a(A,"onloadend"),"onloadend"in _?_.onloadend=A:_.onreadystatechange=a(function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(A)},"handleLoad"),_.onabort=a(function(){_&&(r(new R("Request aborted",R.ECONNABORTED,i,_)),_=null)},"handleAbort"),_.onerror=a(function(){r(new R("Network Error",R.ERR_NETWORK,i,_)),_=null},"handleError"),_.ontimeout=a(function(){let D=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",O=i.transitional||O_;i.timeoutErrorMessage&&(D=i.timeoutErrorMessage),r(new R(D,O.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,i,_)),_=null},"handleTimeout"),ze.hasStandardBrowserEnv&&(l&&x.isFunction(l)&&(l=l(i)),l||l!==!1&&fw(H))){let C=i.xsrfHeaderName&&i.xsrfCookieName&&_w.read(i.xsrfCookieName);C&&s.set(i.xsrfHeaderName,C)}n===void 0&&s.setContentType(null),"setRequestHeader"in _&&x.forEach(s.toJSON(),a(function(D,O){_.setRequestHeader(O,D)},"setRequestHeader")),x.isUndefined(i.withCredentials)||(_.withCredentials=!!i.withCredentials),o&&o!=="json"&&(_.responseType=i.responseType),typeof i.onDownloadProgress=="function"&&_.addEventListener("progress",f_(i.onDownloadProgress,!0)),typeof i.onUploadProgress=="function"&&_.upload&&_.upload.addEventListener("progress",f_(i.onUploadProgress)),(i.cancelToken||i.signal)&&(d=a(C=>{_&&(r(!C||C.type?new Jr(null,i,_):C),_.abort(),_=null)},"onCanceled"),i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));let w=gw(H);if(w&&ze.protocols.indexOf(w)===-1){r(new R("Unsupported protocol "+w+":",R.ERR_BAD_REQUEST,i));return}_.send(n||null)},"dispatchXhrRequest"))},xu={http:Wx,xhr:ww};x.forEach(xu,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var g_=a(i=>`- ${i}`,"renderReason"),vw=a(i=>x.isFunction(i)||i===null||i===!1,"isResolvedHandle"),L_={getAdapter:i=>{i=x.isArray(i)?i:[i];let{length:e}=i,t,r,n={};for(let s=0;s<e;s++){t=i[s];let o;if(r=t,!vw(t)&&(r=xu[(o=String(t)).toLowerCase()],r===void 0))throw new R(`Unknown adapter '${o}'`);if(r)break;n[o||"#"+s]=r}if(!r){let s=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since :
|
|
4
|
+
`+s.map(g_).join(`
|
|
5
|
+
`):" "+g_(s[0]):"as no adapter specified";throw new R("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:xu};function yu(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Jr(null,i)}a(yu,"throwIfCancellationRequested");function b_(i){return yu(i),i.headers=ot.from(i.headers),i.data=mu.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),L_.getAdapter(i.adapter||Eu.adapter)(i).then(a(function(r){return yu(i),r.data=mu.call(i,i.transformResponse,r),r.headers=ot.from(r.headers),r},"onAdapterResolution"),a(function(r){return j_(r)||(yu(i),r&&r.response&&(r.response.data=mu.call(i,i.transformResponse,r.response),r.response.headers=ot.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}a(b_,"dispatchRequest");var x_=a(i=>i instanceof ot?{...i}:i,"headersToObject");function sr(i,e){e=e||{};let t={};function r(p,h,_){return x.isPlainObject(p)&&x.isPlainObject(h)?x.merge.call({caseless:_},p,h):x.isPlainObject(h)?x.merge({},h):x.isArray(h)?h.slice():h}a(r,"getMergedValue");function n(p,h,_){if(x.isUndefined(h)){if(!x.isUndefined(p))return r(void 0,p,_)}else return r(p,h,_)}a(n,"mergeDeepProperties");function s(p,h){if(!x.isUndefined(h))return r(void 0,h)}a(s,"valueFromConfig2");function o(p,h){if(x.isUndefined(h)){if(!x.isUndefined(p))return r(void 0,p)}else return r(void 0,h)}a(o,"defaultToConfig2");function l(p,h,_){if(_ in e)return r(p,h);if(_ in i)return r(void 0,p)}a(l,"mergeDirectKeys");let d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(p,h)=>n(x_(p),x_(h),!0)};return x.forEach(Object.keys(Object.assign({},i,e)),a(function(h){let _=d[h]||n,H=_(i[h],e[h],h);x.isUndefined(H)&&_!==l||(t[h]=H)},"computeConfigValue")),t}a(sr,"mergeConfig");var F_="1.6.8",Pu={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{Pu[i]=a(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var w_={};Pu.transitional=a(function(e,t,r){function n(s,o){return"[Axios v"+F_+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return a(n,"formatMessage"),(s,o,l)=>{if(e===!1)throw new R(n(o," has been removed"+(t?" in "+t:"")),R.ERR_DEPRECATED);return t&&!w_[o]&&(w_[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,l):!0}},"transitional");function Sw(i,e,t){if(typeof i!="object")throw new R("options must be an object",R.ERR_BAD_OPTION_VALUE);let r=Object.keys(i),n=r.length;for(;n-- >0;){let s=r[n],o=e[s];if(o){let l=i[s],d=l===void 0||o(l,s,i);if(d!==!0)throw new R("option "+s+" must be "+d,R.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new R("Unknown option "+s,R.ERR_BAD_OPTION)}}a(Sw,"assertOptions");var wu={assertOptions:Sw,validators:Pu},xt=wu.validators,or=class{static{a(this,"Axios")}constructor(e){this.defaults=e,this.interceptors={request:new m_,response:new m_}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let n;Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error;let s=n.stack?n.stack.replace(/^.+\n/,""):"";r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+s):r.stack=s}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=sr(this.defaults,t);let{transitional:r,paramsSerializer:n,headers:s}=t;r!==void 0&&wu.assertOptions(r,{silentJSONParsing:xt.transitional(xt.boolean),forcedJSONParsing:xt.transitional(xt.boolean),clarifyTimeoutError:xt.transitional(xt.boolean)},!1),n!=null&&(x.isFunction(n)?t.paramsSerializer={serialize:n}:wu.assertOptions(n,{encode:xt.function,serialize:xt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&x.merge(s.common,s[t.method]);s&&x.forEach(["delete","get","head","post","put","patch","common"],w=>{delete s[w]}),t.headers=ot.concat(o,s);let l=[],d=!0;this.interceptors.request.forEach(a(function(C){typeof C.runWhen=="function"&&C.runWhen(t)===!1||(d=d&&C.synchronous,l.unshift(C.fulfilled,C.rejected))},"unshiftRequestInterceptors"));let p=[];this.interceptors.response.forEach(a(function(C){p.push(C.fulfilled,C.rejected)},"pushResponseInterceptors"));let h,_=0,H;if(!d){let w=[b_.bind(this),void 0];for(w.unshift.apply(w,l),w.push.apply(w,p),H=w.length,h=Promise.resolve(t);_<H;)h=h.then(w[_++],w[_++]);return h}H=l.length;let A=t;for(_=0;_<H;){let w=l[_++],C=l[_++];try{A=w(A)}catch(D){C.call(this,D);break}}try{h=b_.call(this,A)}catch(w){return Promise.reject(w)}for(_=0,H=p.length;_<H;)h=h.then(p[_++],p[_++]);return h}getUri(e){e=sr(this.defaults,e);let t=M_(e.baseURL,e.url);return B_(t,e.params,e.paramsSerializer)}};x.forEach(["delete","get","head","options"],a(function(e){or.prototype[e]=function(t,r){return this.request(sr(r||{},{method:e,url:t,data:(r||{}).data}))}},"forEachMethodNoData"));x.forEach(["post","put","patch"],a(function(e){function t(r){return a(function(s,o,l){return this.request(sr(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}a(t,"generateHTTPMethod"),or.prototype[e]=t(),or.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var Ra=or,vu=class i{static{a(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(a(function(s){t=s},"promiseExecutor"));let r=this;this.promise.then(n=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](n);r._listeners=null}),this.promise.then=n=>{let s,o=new Promise(l=>{r.subscribe(l),s=l}).then(n);return o.cancel=a(function(){r.unsubscribe(s)},"reject"),o},e(a(function(s,o,l){r.reason||(r.reason=new Jr(s,o,l),t(r.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new i(a(function(n){e=n},"executor")),cancel:e}}},Hw=vu;function Cw(i){return a(function(t){return i.apply(null,t)},"wrap")}a(Cw,"spread");function qw(i){return x.isObject(i)&&i.isAxiosError===!0}a(qw,"isAxiosError");var Su={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Su).forEach(([i,e])=>{Su[e]=i});var Ew=Su;function N_(i){let e=new Ra(i),t=v_(Ra.prototype.request,e);return x.extend(t,Ra.prototype,e,{allOwnKeys:!0}),x.extend(t,e,null,{allOwnKeys:!0}),t.create=a(function(n){return N_(sr(i,n))},"create"),t}a(N_,"createInstance");var Z=N_(Eu);Z.Axios=Ra;Z.CanceledError=Jr;Z.CancelToken=Hw;Z.isCancel=j_;Z.VERSION=F_;Z.toFormData=ka;Z.AxiosError=R;Z.Cancel=Z.CanceledError;Z.all=a(function(e){return Promise.all(e)},"all");Z.spread=Cw;Z.isAxiosError=qw;Z.mergeConfig=sr;Z.AxiosHeaders=ot;Z.formToJSON=i=>k_(x.isHTMLForm(i)?new FormData(i):i);Z.getAdapter=L_.getAdapter;Z.HttpStatusCode=Ew;Z.default=Z;Q_.exports=Z});var f={};rx(f,{__addDisposableResource:()=>dm,__assign:()=>ja,__asyncDelegator:()=>im,__asyncGenerator:()=>rm,__asyncValues:()=>nm,__await:()=>ur,__awaiter:()=>J_,__classPrivateFieldGet:()=>lm,__classPrivateFieldIn:()=>cm,__classPrivateFieldSet:()=>um,__createBinding:()=>La,__decorate:()=>$_,__disposeResources:()=>hm,__esDecorate:()=>Pw,__exportStar:()=>X_,__extends:()=>V_,__generator:()=>Z_,__importDefault:()=>om,__importStar:()=>sm,__makeTemplateObject:()=>am,__metadata:()=>K_,__param:()=>z_,__propKey:()=>Dw,__read:()=>Du,__rest:()=>W_,__runInitializers:()=>Aw,__setFunctionName:()=>Tw,__spread:()=>Y_,__spreadArray:()=>tm,__spreadArrays:()=>em,__values:()=>Ma,default:()=>Bw});function V_(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Au(i,e);function t(){this.constructor=i}a(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function W_(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(i);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(i,r[n])&&(t[r[n]]=i[r[n]]);return t}function $_(i,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(i,e,t,r);else for(var l=i.length-1;l>=0;l--)(o=i[l])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function z_(i,e){return function(t,r){e(t,r,i)}}function Pw(i,e,t,r,n,s){function o(O){if(O!==void 0&&typeof O!="function")throw new TypeError("Function expected");return O}a(o,"accept");for(var l=r.kind,d=l==="getter"?"get":l==="setter"?"set":"value",p=!e&&i?r.static?i:i.prototype:null,h=e||(p?Object.getOwnPropertyDescriptor(p,r.name):{}),_,H=!1,A=t.length-1;A>=0;A--){var w={};for(var C in r)w[C]=C==="access"?{}:r[C];for(var C in r.access)w.access[C]=r.access[C];w.addInitializer=function(O){if(H)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(O||null))};var D=(0,t[A])(l==="accessor"?{get:h.get,set:h.set}:h[d],w);if(l==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(_=o(D.get))&&(h.get=_),(_=o(D.set))&&(h.set=_),(_=o(D.init))&&n.unshift(_)}else(_=o(D))&&(l==="field"?n.unshift(_):h[d]=_)}p&&Object.defineProperty(p,r.name,h),H=!0}function Aw(i,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(i,t):e[n].call(i);return r?t:void 0}function Dw(i){return typeof i=="symbol"?i:"".concat(i)}function Tw(i,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function K_(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function J_(i,e,t,r){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return a(n,"adopt"),new(t||(t=Promise))(function(s,o){function l(h){try{p(r.next(h))}catch(_){o(_)}}a(l,"fulfilled");function d(h){try{p(r.throw(h))}catch(_){o(_)}}a(d,"rejected");function p(h){h.done?s(h.value):n(h.value).then(l,d)}a(p,"step"),p((r=r.apply(i,e||[])).next())})}function Z_(i,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(p){return function(h){return d([p,h])}}function d(p){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,p[0]&&(t=0)),t;)try{if(r=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,n=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){t.label=p[1];break}if(p[0]===6&&t.label<s[1]){t.label=s[1],s=p;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(p);break}s[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(i,t)}catch(h){p=[6,h],n=0}finally{r=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function X_(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&La(e,i,t)}function Ma(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Du(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(l){o={error:l}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function Y_(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(Du(arguments[e]));return i}function em(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),n=0,e=0;e<t;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,n++)r[n]=s[o];return r}function tm(i,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,s;r<n;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return i.concat(s||Array.prototype.slice.call(e))}function ur(i){return this instanceof ur?(this.v=i,this):new ur(i)}function rm(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(H){r[H]&&(n[H]=function(A){return new Promise(function(w,C){s.push([H,A,w,C])>1||l(H,A)})})}function l(H,A){try{d(r[H](A))}catch(w){_(s[0][3],w)}}function d(H){H.value instanceof ur?Promise.resolve(H.value.v).then(p,h):_(s[0][2],H)}function p(H){l("next",H)}function h(H){l("throw",H)}function _(H,A){H(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function im(i){var e,t;return e={},r("next"),r("throw",function(n){throw n}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(n,s){e[n]=i[n]?function(o){return(t=!t)?{value:ur(i[n](o)),done:!1}:s?s(o):o}:s}}function nm(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof Ma=="function"?Ma(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=i[s]&&function(o){return new Promise(function(l,d){o=i[s](o),n(l,d,o.done,o.value)})}}function n(s,o,l,d){Promise.resolve(d).then(function(p){s({value:p,done:l})},o)}}function am(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function sm(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&La(e,i,t);return Iw(e,i),e}function om(i){return i&&i.__esModule?i:{default:i}}function lm(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)}function um(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t}function cm(i,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?e===i:i.has(e)}function dm(i,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose]}if(typeof r!="function")throw new TypeError("Object not disposable.");i.stack.push({value:e,dispose:r,async:t})}else t&&i.stack.push({async:!0});return e}function hm(i){function e(r){i.error=i.hasError?new Rw(r,i.error,"An error was suppressed during disposal."):r,i.hasError=!0}a(e,"fail");function t(){for(;i.stack.length;){var r=i.stack.pop();try{var n=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(n).then(t,function(s){return e(s),t()})}catch(s){e(s)}}if(i.hasError)throw i.error}return a(t,"next"),t()}var Au,ja,La,Iw,Rw,Bw,g=tx(()=>{Au=a(function(i,e){return Au=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},Au(i,e)},"extendStatics");a(V_,"__extends");ja=a(function(){return ja=Object.assign||a(function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),ja.apply(this,arguments)},"__assign");a(W_,"__rest");a($_,"__decorate");a(z_,"__param");a(Pw,"__esDecorate");a(Aw,"__runInitializers");a(Dw,"__propKey");a(Tw,"__setFunctionName");a(K_,"__metadata");a(J_,"__awaiter");a(Z_,"__generator");La=Object.create?function(i,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,r,n)}:function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]};a(X_,"__exportStar");a(Ma,"__values");a(Du,"__read");a(Y_,"__spread");a(em,"__spreadArrays");a(tm,"__spreadArray");a(ur,"__await");a(rm,"__asyncGenerator");a(im,"__asyncDelegator");a(nm,"__asyncValues");a(am,"__makeTemplateObject");Iw=Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e};a(sm,"__importStar");a(om,"__importDefault");a(lm,"__classPrivateFieldGet");a(um,"__classPrivateFieldSet");a(cm,"__classPrivateFieldIn");a(dm,"__addDisposableResource");Rw=typeof SuppressedError=="function"?SuppressedError:function(i,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=i,r.suppressed=e,r};a(hm,"__disposeResources");Bw={__extends:V_,__assign:ja,__rest:W_,__decorate:$_,__param:z_,__metadata:K_,__awaiter:J_,__generator:Z_,__createBinding:La,__exportStar:X_,__values:Ma,__read:Du,__spread:Y_,__spreadArrays:em,__spreadArray:tm,__await:ur,__asyncGenerator:rm,__asyncDelegator:im,__asyncValues:nm,__makeTemplateObject:am,__importStar:sm,__importDefault:om,__classPrivateFieldGet:lm,__classPrivateFieldSet:um,__classPrivateFieldIn:cm,__addDisposableResource:dm,__disposeResources:hm}});var Zr=u((vI,pm)=>{pm.exports.isNode=!1});var Ft=u(vt=>{"use strict";var wt;Object.defineProperty(vt,"__esModule",{value:!0});vt.LogLevelToConsoleFunction=vt.resolveLogLevel=vt.LogLevel=void 0;var Ow=Zr(),xe;(function(i){i[i.CRITICAL=0]="CRITICAL",i[i.ERROR=1]="ERROR",i[i.WARNING=2]="WARNING",i[i.INFO=3]="INFO",i[i.DEBUG=4]="DEBUG",i[i.TRACE=7]="TRACE"})(xe||(xe={}));vt.LogLevel=xe;function Uw(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(xe,i))return i;var e=Object.keys(xe).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):xe.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(xe,t))throw new Error("Unknown log level string: ".concat(i));return xe[t]}a(Uw,"resolveLogLevel");vt.resolveLogLevel=Uw;var kw=Ow.isNode?console.log.bind(console):console.debug.bind(console);vt.LogLevelToConsoleFunction=(wt={},wt[xe.CRITICAL]=console.error.bind(console),wt[xe.ERROR]=console.error.bind(console),wt[xe.WARNING]=console.warn.bind(console),wt[xe.INFO]=console.info.bind(console),wt[xe.DEBUG]=kw.bind(console),wt[xe.TRACE]=console.trace.bind(console),wt)});var _m=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.Enumerable=void 0;function jw(i){return i===void 0&&(i=!0),function(e,t){Object.defineProperty(e,t,{get:function(){},set:function(r){Object.defineProperty(this,t,{value:r,writable:!0,enumerable:i})},enumerable:i})}}a(jw,"Enumerable");Fa.Enumerable=jw});var ym=u(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.flatten=void 0;var mm=(g(),b(f));function Mw(i){var e;return(e=[]).concat.apply(e,mm.__spreadArray([],mm.__read(i),!1))}a(Mw,"flatten");Na.flatten=Mw});var fm=u(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.partitionedFlatMap=void 0;var Tu=(g(),b(f));function Lw(i,e,t){var r,n,s,o={};try{for(var l=Tu.__values(i),d=l.next();!d.done;d=l.next()){var p=d.value,h=e(p),_=t(p);Array.isArray(_)||(_=[_]),Object.prototype.hasOwnProperty.call(o,h)?(s=o[h]).push.apply(s,Tu.__spreadArray([],Tu.__read(_),!1)):o[h]=_}}catch(H){r={error:H}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return o}a(Lw,"partitionedFlatMap");Qa.partitionedFlatMap=Lw});var bm=u(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.resolveConfigValueSync=cr.resolveConfigValue=void 0;var gm=(g(),b(f));function Fw(i){return gm.__awaiter(this,void 0,void 0,function(){return gm.__generator(this,function(e){switch(e.label){case 0:return typeof i!="function"?[3,2]:[4,i()];case 1:return[2,e.sent()];case 2:return[2,i]}})})}a(Fw,"resolveConfigValue");cr.resolveConfigValue=Fw;function Nw(i){return typeof i=="function"?i():i}a(Nw,"resolveConfigValueSync");cr.resolveConfigValueSync=Nw});var xm=u(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.deprecateClass=void 0;var Iu=(g(),b(f));function Qw(i,e){var t=!1;return function(r){Iu.__extends(n,r);function n(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return t||(console.warn(e),t=!0),r.apply(this,Iu.__spreadArray([],Iu.__read(s),!1))||this}return a(n,"class_1"),n}(i)}a(Qw,"deprecateClass");Ga.deprecateClass=Qw});var vm=u(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.match=Nt.eq=void 0;var wm=a(function(i){return{otherwise:function(){return i},on:function(){return wm(i)}}},"matched"),Ru=a(function(i){return{on:function(e,t){return e(i)?wm(t(i)):Ru(i)},otherwise:function(e){return e(i)}}},"match");Nt.match=Ru;var Gw=a(function(i){return function(e){return i===e}},"eq");Nt.eq=Gw;Ru.eq=Nt.eq});var Hm=u(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.fibWithLimit=void 0;var Sm=(g(),b(f));function Vw(i){var e,t,r;return Sm.__generator(this,function(n){switch(n.label){case 0:e=0,t=1,n.label=1;case 1:return e<i?[4,e]:[3,3];case 2:return n.sent(),r=Sm.__read([t,e+t],2),e=r[0],t=r[1],[3,1];case 3:return[4,i];case 4:return n.sent(),[3,3];case 5:return[2]}})}a(Vw,"fibWithLimit");Va.fibWithLimit=Vw});var $a=u(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.arrayToObject=void 0;var Cm=(g(),b(f));function Ww(i,e){return Object.assign.apply(Object,Cm.__spreadArray([{}],Cm.__read(i.map(e)),!1))}a(Ww,"arrayToObject");Wa.arrayToObject=Ww});var qm=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.entriesToObject=void 0;var $w=(g(),b(f)),zw=$a();function Kw(i){return(0,zw.arrayToObject)(i,function(e){var t,r=$w.__read(e,2),n=r[0],s=r[1];return t={},t[n]=s,t})}a(Kw,"entriesToObject");za.entriesToObject=Kw});var Em=u(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.forEachObjectEntry=void 0;var Jw=(g(),b(f));function Zw(i,e){Object.entries(i).forEach(function(t){var r=Jw.__read(t,2),n=r[0],s=r[1];return e(s,n)})}a(Zw,"forEachObjectEntry");Ka.forEachObjectEntry=Zw});var Pm=u(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.groupBy=void 0;var Xw=(g(),b(f));function Yw(i,e){var t,r,n;if(typeof e!="function"){var s=e;e=a(function(_){return _[s].toString()},"keyFn")}var o={};try{for(var l=Xw.__values(i),d=l.next();!d.done;d=l.next()){var p=d.value,h=e(p);((n=o[h])!==null&&n!==void 0?n:o[h]=[]).push(p)}}catch(_){t={error:_}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return o}a(Yw,"groupBy");Ja.groupBy=Yw});var Am=u(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.indexBy=void 0;var ev=$a();function tv(i,e){if(typeof e!="function"){var t=e;e=a(function(r){return r[t].toString()},"keyFn")}return(0,ev.arrayToObject)(i,function(r){var n;return n={},n[e(r)]=r,n})}a(tv,"indexBy");Za.indexBy=tv});var Dm=u(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.mapObject=void 0;var Bu=(g(),b(f));function rv(i,e){var t=Object.entries(i).map(function(r){var n,s=Bu.__read(r,2),o=s[0],l=s[1];return n={},n[o]=e(l,o),n});return Object.assign.apply(Object,Bu.__spreadArray([{}],Bu.__read(t),!1))}a(rv,"mapObject");Xa.mapObject=rv});var Ou=u(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.pick=void 0;var Ya=(g(),b(f));function iv(i,e){return Object.assign.apply(Object,Ya.__spreadArray([{}],Ya.__read(Object.entries(i).filter(function(t){var r=Ya.__read(t,1),n=r[0];return e.includes(n)}).map(function(t){var r,n=Ya.__read(t,2),s=n[0],o=n[1];return r={},r[s]=o,r})),!1))}a(iv,"pick");es.pick=iv});var Tm=u(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.omit=void 0;var nv=Ou();function av(i,e){return(0,nv.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}a(av,"omit");ts.omit=av});var Im=u(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.mapOptional=St.mapNullable=St.isNullish=void 0;function Uu(i){return i==null}a(Uu,"isNullish");St.isNullish=Uu;function sv(i,e){return Uu(i)?null:e(i)}a(sv,"mapNullable");St.mapNullable=sv;function ov(i,e){return Uu(i)?void 0:e(i)}a(ov,"mapOptional");St.mapOptional=ov});var Bm=u(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.delay=void 0;var Rm=(g(),b(f));function lv(i){return Rm.__awaiter(this,void 0,void 0,function(){return Rm.__generator(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t){return setTimeout(t,i)})];case 1:return e.sent(),[2]}})})}a(lv,"delay");rs.delay=lv});var Om=u(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.promiseWithResolvers=void 0;function uv(){var i,e,t=new Promise(function(r,n){i=r,e=n});return{promise:t,resolve:i,reject:e}}a(uv,"promiseWithResolvers");is.promiseWithResolvers=uv});var Um=u(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.padLeft=void 0;function cv(i,e,t){if(typeof i=="number"&&(i=i.toString()),e=e-i.length,e<=0)return i;t===void 0&&(t=" ");var r="";do(e&1)===1&&(r+=t),e>>=1,e&&(t+=t);while(e);return r+i}a(cv,"padLeft");ns.padLeft=cv});var km=u(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.splitWithLimit=void 0;var ku=(g(),b(f));function dv(i,e,t){var r=i.split(e);return r.length<=t?r:ku.__spreadArray(ku.__spreadArray([],ku.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}a(dv,"splitWithLimit");as.splitWithLimit=dv});var jm=u(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.utf8Substring=dr.utf8Length=void 0;var ss=(g(),b(f));function hv(i){return ss.__spreadArray([],ss.__read(i),!1).length}a(hv,"utf8Length");dr.utf8Length=hv;function pv(i,e,t){return ss.__spreadArray([],ss.__read(i),!1).slice(e,t).join("")}a(pv,"utf8Substring");dr.utf8Substring=pv});var S=u(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.utf8Substring=E.utf8Length=E.splitWithLimit=E.padLeft=E.promiseWithResolvers=E.delay=E.mapOptional=E.mapNullable=E.isNullish=E.pick=E.omit=E.mapObject=E.indexBy=E.groupBy=E.forEachObjectEntry=E.entriesToObject=E.arrayToObject=E.fibWithLimit=E.eq=E.match=E.deprecateClass=E.resolveConfigValueSync=E.resolveConfigValue=E.partitionedFlatMap=E.flatten=E.Enumerable=void 0;var _v=_m();Object.defineProperty(E,"Enumerable",{enumerable:!0,get:function(){return _v.Enumerable}});var mv=ym();Object.defineProperty(E,"flatten",{enumerable:!0,get:function(){return mv.flatten}});var yv=fm();Object.defineProperty(E,"partitionedFlatMap",{enumerable:!0,get:function(){return yv.partitionedFlatMap}});var Mm=bm();Object.defineProperty(E,"resolveConfigValue",{enumerable:!0,get:function(){return Mm.resolveConfigValue}});Object.defineProperty(E,"resolveConfigValueSync",{enumerable:!0,get:function(){return Mm.resolveConfigValueSync}});var fv=xm();Object.defineProperty(E,"deprecateClass",{enumerable:!0,get:function(){return fv.deprecateClass}});var Lm=vm();Object.defineProperty(E,"match",{enumerable:!0,get:function(){return Lm.match}});Object.defineProperty(E,"eq",{enumerable:!0,get:function(){return Lm.eq}});var gv=Hm();Object.defineProperty(E,"fibWithLimit",{enumerable:!0,get:function(){return gv.fibWithLimit}});var bv=$a();Object.defineProperty(E,"arrayToObject",{enumerable:!0,get:function(){return bv.arrayToObject}});var xv=qm();Object.defineProperty(E,"entriesToObject",{enumerable:!0,get:function(){return xv.entriesToObject}});var wv=Em();Object.defineProperty(E,"forEachObjectEntry",{enumerable:!0,get:function(){return wv.forEachObjectEntry}});var vv=Pm();Object.defineProperty(E,"groupBy",{enumerable:!0,get:function(){return vv.groupBy}});var Sv=Am();Object.defineProperty(E,"indexBy",{enumerable:!0,get:function(){return Sv.indexBy}});var Hv=Dm();Object.defineProperty(E,"mapObject",{enumerable:!0,get:function(){return Hv.mapObject}});var Cv=Tm();Object.defineProperty(E,"omit",{enumerable:!0,get:function(){return Cv.omit}});var qv=Ou();Object.defineProperty(E,"pick",{enumerable:!0,get:function(){return qv.pick}});var ju=Im();Object.defineProperty(E,"isNullish",{enumerable:!0,get:function(){return ju.isNullish}});Object.defineProperty(E,"mapNullable",{enumerable:!0,get:function(){return ju.mapNullable}});Object.defineProperty(E,"mapOptional",{enumerable:!0,get:function(){return ju.mapOptional}});var Ev=Bm();Object.defineProperty(E,"delay",{enumerable:!0,get:function(){return Ev.delay}});var Pv=Om();Object.defineProperty(E,"promiseWithResolvers",{enumerable:!0,get:function(){return Pv.promiseWithResolvers}});var Av=Um();Object.defineProperty(E,"padLeft",{enumerable:!0,get:function(){return Av.padLeft}});var Dv=km();Object.defineProperty(E,"splitWithLimit",{enumerable:!0,get:function(){return Dv.splitWithLimit}});var Fm=jm();Object.defineProperty(E,"utf8Length",{enumerable:!0,get:function(){return Fm.utf8Length}});Object.defineProperty(E,"utf8Substring",{enumerable:!0,get:function(){return Fm.utf8Substring}})});var Nu=u(ls=>{"use strict";var Mu,Lu;Object.defineProperty(ls,"__esModule",{value:!0});ls.getMinLogLevelFromEnv=void 0;var Tv=Ft(),os=typeof process>"u"?[]:(Lu=(Mu=process.env.LOGGING)===null||Mu===void 0?void 0:Mu.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,Tv.resolveLogLevel)(r)]:null}).filter(function(i){return!!i}).sort(function(i,e){var t,r,n=i[0],s=e[0];return((t=s?.length)!==null&&t!==void 0?t:0)-((r=n?.length)!==null&&r!==void 0?r:0)}))!==null&&Lu!==void 0?Lu:[],Fu=os.findIndex(function(i){var e=i[0];return!e}),Nm=void 0;Fu!==-1&&(Nm=os[Fu][1],os.splice(Fu));function Iv(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}a(Iv,"isPrefix");function Rv(i){for(var e=i.split(":"),t=0,r=os;t<r.length;t++){var n=r[t],s=n[0],o=n[1];if(Iv(e,s))return o}return Nm}a(Rv,"getMinLogLevelFromEnv");ls.getMinLogLevelFromEnv=Rv});var Qu=u(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.BaseLogger=void 0;var Bv=S(),Ov=Zr(),Uv=Nu(),Ht=Ft(),kv=function(){function i(e){var t=e.name,r=e.minLevel,n=e.emoji,s=n===void 0?!1:n,o=e.colors,l=e.timestamps,d=l===void 0?Ov.isNode:l,p,h;this._name=t,this._minLevel=(h=(p=(0,Bv.mapOptional)(r,function(_){return(0,Ht.resolveLogLevel)(_)}))!==null&&p!==void 0?p:(0,Uv.getMinLogLevelFromEnv)(t))!==null&&h!==void 0?h:Ht.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=d}return a(i,"BaseLogger"),i.prototype.crit=function(e){this.log(Ht.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(Ht.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(Ht.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(Ht.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(Ht.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(Ht.LogLevel.TRACE,e)},i}();us.BaseLogger=kv});var Qm=u(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.BrowserLogger=void 0;var jv=(g(),b(f)),Mv=Ft(),Lv=Qu(),Fv=function(i){jv.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return a(e,"BrowserLogger"),e.prototype.log=function(t,r){if(!(t>this._minLevel)){var n=Mv.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),n(s)}},e}(Lv.BaseLogger);cs.BrowserLogger=Fv});var Gm=u(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.CustomLoggerWrapper=void 0;var Nv=S(),Qv=Nu(),Pe=Ft(),Gv=function(){function i(e){var t=e.name,r=e.minLevel,n=e.custom,s;this._minLevel=(s=(0,Nv.mapOptional)(r,function(o){return(0,Pe.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,Qv.getMinLogLevelFromEnv)(t),this._override=typeof n=="function"?{log:n}:n}return a(i,"CustomLoggerWrapper"),i.prototype.log=function(e,t){this._shouldLog(e)&&this._override.log(e,t)},i.prototype.crit=function(e){this._override.crit?this._shouldLog(Pe.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Pe.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this._override.error?this._shouldLog(Pe.LogLevel.ERROR)&&this._override.error(e):this.log(Pe.LogLevel.ERROR,e)},i.prototype.warn=function(e){this._override.warn?this._shouldLog(Pe.LogLevel.WARNING)&&this._override.warn(e):this.log(Pe.LogLevel.WARNING,e)},i.prototype.info=function(e){this._override.info?this._shouldLog(Pe.LogLevel.INFO)&&this._override.info(e):this.log(Pe.LogLevel.INFO,e)},i.prototype.debug=function(e){this._override.debug?this._shouldLog(Pe.LogLevel.DEBUG)&&this._override.debug(e):this.log(Pe.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this._override.trace?this._shouldLog(Pe.LogLevel.TRACE)&&this._override.trace(e):this.log(Pe.LogLevel.TRACE,e)},i.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},i}();ds.CustomLoggerWrapper=Gv});var Vm=u(we=>{"use strict";var Ct,qt,Et;Object.defineProperty(we,"__esModule",{value:!0});we.NodeLogger=we.LogLevelToBackgroundColor=we.LogLevelToColor=we.LogLevelToEmoji=void 0;var Vv=(g(),b(f)),J=Ft(),Wv=Qu();we.LogLevelToEmoji=(Ct={},Ct[J.LogLevel.CRITICAL]="\u{1F6D1}",Ct[J.LogLevel.ERROR]="\u274C",Ct[J.LogLevel.WARNING]="\u26A0\uFE0F ",Ct[J.LogLevel.INFO]="\u2139\uFE0F ",Ct[J.LogLevel.DEBUG]="\u{1F41E}",Ct[J.LogLevel.TRACE]="\u{1F43E}",Ct);var $v={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,blackBright:90,redBright:91,greenBright:92,yellowBright:93,blueBright:94,magentaBright:95,cyanBright:96,whiteBright:97},zv={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBlackBright:100,bgRedBright:101,bgGreenBright:102,bgYellowBright:103,bgBlueBright:104,bgMagentaBright:105,bgCyanBright:106,bgWhiteBright:107};function hs(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}a(hs,"createGenericWrapper");function Je(i){return hs($v[i],39)}a(Je,"createColorWrapper");function Xr(i,e){return hs(zv[i],49,e)}a(Xr,"createBgWrapper");we.LogLevelToColor=(qt={},qt[J.LogLevel.CRITICAL]=Je("red"),qt[J.LogLevel.ERROR]=Je("redBright"),qt[J.LogLevel.WARNING]=Je("yellow"),qt[J.LogLevel.INFO]=Je("blue"),qt[J.LogLevel.DEBUG]=Je("magenta"),qt[J.LogLevel.TRACE]=hs(0,0),qt);we.LogLevelToBackgroundColor=(Et={},Et[J.LogLevel.CRITICAL]=Xr("bgRed",Je("white")),Et[J.LogLevel.ERROR]=Xr("bgRedBright",Je("white")),Et[J.LogLevel.WARNING]=Xr("bgYellow",Je("black")),Et[J.LogLevel.INFO]=Xr("bgBlue",Je("white")),Et[J.LogLevel.DEBUG]=Xr("bgMagenta",Je("black")),Et[J.LogLevel.TRACE]=hs(7,27),Et);var Kv=function(i){Vv.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return a(e,"NodeLogger"),e.prototype.log=function(t,r){var n,s,o;if(!(t>this._minLevel)){var l=J.LogLevelToConsoleFunction[t],d="";if(this._timestamps&&(d+="[".concat(new Date().toISOString(),"] ")),this._emoji){var p=we.LogLevelToEmoji[t];d+="".concat(p," ")}var h=(o=(n=this._colors)!==null&&n!==void 0?n:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;h?d+="".concat(we.LogLevelToBackgroundColor[t](this._name)," ").concat(we.LogLevelToBackgroundColor[t](J.LogLevel[t])," ").concat(we.LogLevelToColor[t](r)):d+="[".concat(this._name,":").concat(J.LogLevel[t].toLowerCase(),"] ").concat(r),l(d)}},e}(Wv.BaseLogger);we.NodeLogger=Kv});var Wm=u(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.createLogger=void 0;var Jv=Zr(),Zv=Qm(),Xv=Gm(),Yv=Vm();function eS(i){return i.custom?new Xv.CustomLoggerWrapper(i):Jv.isNode?new Yv.NodeLogger(i):new Zv.BrowserLogger(i)}a(eS,"createLogger");ps.createLogger=eS});var Yr=u(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.LogLevel=hr.createLogger=void 0;var tS=Wm();Object.defineProperty(hr,"createLogger",{enumerable:!0,get:function(){return tS.createLogger}});var rS=Ft();Object.defineProperty(hr,"LogLevel",{enumerable:!0,get:function(){return rS.LogLevel}})});var Vu=u(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.CustomError=void 0;var Gu=class extends Error{static{a(this,"CustomError")}constructor(...e){var t;super(...e),Object.setPrototypeOf(this,new.target.prototype),(t=Error.captureStackTrace)===null||t===void 0||t.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};_s.CustomError=Gu});var $u=u(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.RetryAfterError=void 0;var iS=Vu(),Wu=class extends iS.CustomError{static{a(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};ms.RetryAfterError=Wu});var ei=u(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.RateLimitReachedError=void 0;var nS=Vu(),zu=class extends nS.CustomError{static{a(this,"RateLimitReachedError")}};ys.RateLimitReachedError=zu});var $m=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.NullRateLimiter=void 0;var Ku=class{static{a(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};fs.NullRateLimiter=Ku});var Zu=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.ResponseBasedRateLimiter=void 0;var aS=Yr(),sS=S(),oS=ei(),zm=$u(),Ju=class{static{a(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,aS.createLogger)({name:"rate-limiter",emoji:!0,...e})}async request(e,t){return this._logger.trace("request start"),await new Promise((r,n)=>{var s;let o={req:e,resolve:r,reject:n,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};this._batchRunning||this._nextBatchTimer||this._paused?(this._logger.trace(`request queued batchRunning:${this._batchRunning.toString()} hasNextBatchTimer:${(!!this._nextBatchTimer).toString()} paused:${this._paused.toString()}`),this._queue.push(o)):this._runRequestBatch([o])})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextBatch()}get stats(){var e,t,r,n,s;return{lastKnownLimit:(t=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&t!==void 0?t:null,lastKnownRemainingRequests:(n=(r=this._parameters)===null||r===void 0?void 0:r.remaining)!==null&&n!==void 0?n:null,lastKnownResetDate:(0,sS.mapNullable)((s=this._parameters)===null||s===void 0?void 0:s.resetsAt,o=>new Date(o))}}async _runRequestBatch(e){this._logger.trace(`runRequestBatch start specs:${e.length}`),this._batchRunning=!0,this._parameters&&this._logger.debug(`Remaining requests: ${this._parameters.remaining}`),this._logger.debug(`Doing ${e.length} requests, new queue length is ${this._queue.length}`);let t=e.map(async o=>{let{req:l,resolve:d,reject:p}=o;try{let h=await this.doRequest(l),_=this.needsToRetryAfter(h);if(_!==null)throw this._queue.unshift(o),this._logger.info(`Retrying after ${_} ms`),new zm.RetryAfterError(_);let H=this.getParametersFromResponse(h);return d(h),H}catch(h){if(h instanceof zm.RetryAfterError)throw h;p(h);return}}),r=await Promise.allSettled(t),n=r.filter(o=>o.status==="rejected"),s=Date.now();if(n.length){this._logger.trace("runRequestBatch some rejected");let l=Math.max(s,...n.map(d=>d.reason.retryAt))-s;this._logger.warn(`Waiting for ${l} ms because the rate limit was exceeded`),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}else{this._logger.trace("runRequestBatch none rejected");let o=r.filter(l=>l.status==="fulfilled"&&l.value!==void 0).map(l=>l.value).reduce((l,d)=>l?d.remaining<l.remaining?d:l:d,void 0);if(this._batchRunning=!1,o)if(this._parameters=o,o.resetsAt<s||o.remaining>0)this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch();else{let l=o.resetsAt-s;this._logger.trace(`runRequestBatch delay:${l}`),this._logger.warn(`Waiting for ${l} ms because the rate limit was reached`),this._queue=this._queue.filter(d=>{switch(d.limitReachedBehavior){case"enqueue":return!0;case"null":return d.resolve(null),!1;case"throw":return d.reject(new oS.RateLimitReachedError("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}}this._logger.trace("runRequestBatch end")}_runNextBatch(){if(this._paused)return;this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);let e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,t=this._queue.splice(0,e);t.length&&this._runRequestBatch(t),this._logger.trace("runNextBatch end")}};gs.ResponseBasedRateLimiter=Ju});var Km=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.PartitionedRateLimiter=void 0;var lS=Zu(),Xu=class{static{a(this,"PartitionedRateLimiter")}constructor(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}async request(e,t){let r=this._partitionKeyCallback(e);return await this._getChild(r).request(e,t)}clear(){for(let e of this._children.values())e.clear()}pause(){this._paused=!0;for(let e of this._children.values())e.pause()}resume(){this._paused=!1;for(let e of this._children.values())e.resume()}getChildStats(e){if(!this._children.has(e))return null;let t=this._children.get(e);return t instanceof lS.ResponseBasedRateLimiter?t.stats:null}_getChild(e){if(this._children.has(e))return this._children.get(e);let t=this._createChildCallback(e);return this._paused&&t.pause(),this._children.set(e,t),t}};bs.PartitionedRateLimiter=Xu});var Jm=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.PartitionedTimeBasedRateLimiter=void 0;var uS=Yr(),cS=ei(),Yu=class{static{a(this,"PartitionedTimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:n,getPartitionKey:s}){this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._paused=!1,this._logger=(0,uS.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=n,this._partitionKeyCallback=s}async request(e,t){return await new Promise((r,n)=>{var s,o;let l={req:e,resolve:r,reject:n,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"},d=this._partitionKeyCallback(e),p=(o=this._usedFromBucket.get(d))!==null&&o!==void 0?o:0;if(p>=this._bucketSize||this._paused)switch(l.limitReachedBehavior){case"enqueue":{let h=this._getPartitionedQueue(d);h.push(l),p+h.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${h.length}`):this._logger.info(`Enqueueing request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused; queue size is ${h.length}`);break}case"null":{l.resolve(null),this._paused?this._logger.info(`Returning null for request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused`):this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, dropping request and returning null`);break}case"throw":{l.reject(new cS.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":`the rate limit for ${d?`partition ${d}`:"default partition"} was reached`}`));break}default:throw new Error("this should never happen")}else this._runRequest(l,d)})}clear(){this._partitionedQueue.clear()}pause(){this._paused=!0}resume(){this._paused=!1;for(let e of this._partitionedQueue.keys())this._runNextRequest(e)}_getPartitionedQueue(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);let t=[];return this._partitionedQueue.set(e,t),t}async _runRequest(e,t){var r;let n=this._getPartitionedQueue(t);this._logger.debug(`doing a request for ${t?`partition ${t}`:"default partition"}, new queue length is ${n.length}`),this._usedFromBucket.set(t,((r=this._usedFromBucket.get(t))!==null&&r!==void 0?r:0)+1);let{req:s,resolve:o,reject:l}=e;try{o(await this._callback(s))}catch(d){l(d)}finally{setTimeout(()=>{let d=this._usedFromBucket.get(t)-1;this._usedFromBucket.set(t,d),n.length&&d<this._bucketSize&&this._runNextRequest(t)},this._timeFrame)}}_runNextRequest(e){if(this._paused)return;let r=this._getPartitionedQueue(e).shift();r&&this._runRequest(r,e)}};xs.PartitionedTimeBasedRateLimiter=Yu});var tc=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.TimeBasedRateLimiter=void 0;var dS=Yr(),hS=ei(),ec=class{static{a(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:n}){this._queue=[],this._usedFromBucket=0,this._paused=!1,this._logger=(0,dS.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=n}async request(e,t){return await new Promise((r,n)=>{var s;let o={req:e,resolve:r,reject:n,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};if(this._usedFromBucket>=this._bucketSize||this._paused)switch(o.limitReachedBehavior){case"enqueue":{this._queue.push(o),this._usedFromBucket+this._queue.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${this._queue.length}`):this._logger.info(`Enqueueing request because the rate limiter is paused; queue size is ${this._queue.length}`);break}case"null":{o.resolve(null),this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`),this._paused?this._logger.info("Returning null for request because the rate limiter is paused"):this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`);break}case"throw":{o.reject(new hS.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":"the rate limit was reached"}`));break}default:throw new Error("this should never happen")}else this._runRequest(o)})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextRequest()}async _runRequest(e){this._logger.debug(`doing a request, new queue length is ${this._queue.length}`),this._usedFromBucket+=1;let{req:t,resolve:r,reject:n}=e;try{r(await this._callback(t))}catch(s){n(s)}finally{setTimeout(()=>{this._usedFromBucket-=1,this._queue.length&&this._usedFromBucket<this._bucketSize&&this._runNextRequest()},this._timeFrame)}}_runNextRequest(){if(this._paused)return;let e=this._queue.shift();e&&this._runRequest(e)}};ws.TimeBasedRateLimiter=ec});var Zm=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.TimedPassthruRateLimiter=void 0;var pS=tc(),rc=class extends pS.TimeBasedRateLimiter{static{a(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,n){return await e.request(r,n)}})}};vs.TimedPassthruRateLimiter=rc});var Ss=u(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.TimedPassthruRateLimiter=ae.TimeBasedRateLimiter=ae.ResponseBasedRateLimiter=ae.PartitionedTimeBasedRateLimiter=ae.PartitionedRateLimiter=ae.NullRateLimiter=ae.RateLimitReachedError=ae.RetryAfterError=void 0;var _S=$u();Object.defineProperty(ae,"RetryAfterError",{enumerable:!0,get:function(){return _S.RetryAfterError}});var mS=ei();Object.defineProperty(ae,"RateLimitReachedError",{enumerable:!0,get:function(){return mS.RateLimitReachedError}});var yS=$m();Object.defineProperty(ae,"NullRateLimiter",{enumerable:!0,get:function(){return yS.NullRateLimiter}});var fS=Km();Object.defineProperty(ae,"PartitionedRateLimiter",{enumerable:!0,get:function(){return fS.PartitionedRateLimiter}});var gS=Jm();Object.defineProperty(ae,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:function(){return gS.PartitionedTimeBasedRateLimiter}});var bS=Zu();Object.defineProperty(ae,"ResponseBasedRateLimiter",{enumerable:!0,get:function(){return bS.ResponseBasedRateLimiter}});var xS=tc();Object.defineProperty(ae,"TimeBasedRateLimiter",{enumerable:!0,get:function(){return xS.TimeBasedRateLimiter}});var wS=Zm();Object.defineProperty(ae,"TimedPassthruRateLimiter",{enumerable:!0,get:function(){return wS.TimedPassthruRateLimiter}})});var ey=u((lt,Ym)=>{var Xm=typeof self<"u"?self:lt,Hs=function(){function i(){this.fetch=!1,this.DOMException=Xm.DOMException}return a(i,"F"),i.prototype=Xm,new i}();(function(i){var e=function(t){var r={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function n(y){return y&&DataView.prototype.isPrototypeOf(y)}if(a(n,"isDataView"),r.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(y){return y&&s.indexOf(Object.prototype.toString.call(y))>-1};function l(y){if(typeof y!="string"&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(y))throw new TypeError("Invalid character in header field name");return y.toLowerCase()}a(l,"normalizeName");function d(y){return typeof y!="string"&&(y=String(y)),y}a(d,"normalizeValue");function p(y){var v={next:function(){var I=y.shift();return{done:I===void 0,value:I}}};return r.iterable&&(v[Symbol.iterator]=function(){return v}),v}a(p,"iteratorFor");function h(y){this.map={},y instanceof h?y.forEach(function(v,I){this.append(I,v)},this):Array.isArray(y)?y.forEach(function(v){this.append(v[0],v[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(v){this.append(v,y[v])},this)}a(h,"Headers"),h.prototype.append=function(y,v){y=l(y),v=d(v);var I=this.map[y];this.map[y]=I?I+", "+v:v},h.prototype.delete=function(y){delete this.map[l(y)]},h.prototype.get=function(y){return y=l(y),this.has(y)?this.map[y]:null},h.prototype.has=function(y){return this.map.hasOwnProperty(l(y))},h.prototype.set=function(y,v){this.map[l(y)]=d(v)},h.prototype.forEach=function(y,v){for(var I in this.map)this.map.hasOwnProperty(I)&&y.call(v,this.map[I],I,this)},h.prototype.keys=function(){var y=[];return this.forEach(function(v,I){y.push(I)}),p(y)},h.prototype.values=function(){var y=[];return this.forEach(function(v){y.push(v)}),p(y)},h.prototype.entries=function(){var y=[];return this.forEach(function(v,I){y.push([I,v])}),p(y)},r.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function _(y){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}a(_,"consumed");function H(y){return new Promise(function(v,I){y.onload=function(){v(y.result)},y.onerror=function(){I(y.error)}})}a(H,"fileReaderReady");function A(y){var v=new FileReader,I=H(v);return v.readAsArrayBuffer(y),I}a(A,"readBlobAsArrayBuffer");function w(y){var v=new FileReader,I=H(v);return v.readAsText(y),I}a(w,"readBlobAsText");function C(y){for(var v=new Uint8Array(y),I=new Array(v.length),me=0;me<v.length;me++)I[me]=String.fromCharCode(v[me]);return I.join("")}a(C,"readArrayBufferAsText");function D(y){if(y.slice)return y.slice(0);var v=new Uint8Array(y.byteLength);return v.set(new Uint8Array(y)),v.buffer}a(D,"bufferClone");function O(){return this.bodyUsed=!1,this._initBody=function(y){this._bodyInit=y,y?typeof y=="string"?this._bodyText=y:r.blob&&Blob.prototype.isPrototypeOf(y)?this._bodyBlob=y:r.formData&&FormData.prototype.isPrototypeOf(y)?this._bodyFormData=y:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)?this._bodyText=y.toString():r.arrayBuffer&&r.blob&&n(y)?(this._bodyArrayBuffer=D(y.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(y)||o(y))?this._bodyArrayBuffer=D(y):this._bodyText=y=Object.prototype.toString.call(y):this._bodyText="",this.headers.get("content-type")||(typeof y=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var y=_(this);if(y)return y;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?_(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(A)}),this.text=function(){var y=_(this);if(y)return y;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(Kb)}),this.json=function(){return this.text().then(JSON.parse)},this}a(O,"Body");var Ee=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function be(y){var v=y.toUpperCase();return Ee.indexOf(v)>-1?v:y}a(be,"normalizeMethod");function _e(y,v){v=v||{};var I=v.body;if(y instanceof _e){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,v.headers||(this.headers=new h(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!I&&y._bodyInit!=null&&(I=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new h(v.headers)),this.method=be(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(I)}a(_e,"Request"),_e.prototype.clone=function(){return new _e(this,{body:this._bodyInit})};function Kb(y){var v=new FormData;return y.trim().split("&").forEach(function(I){if(I){var me=I.split("="),ce=me.shift().replace(/\+/g," "),M=me.join("=").replace(/\+/g," ");v.append(decodeURIComponent(ce),decodeURIComponent(M))}}),v}a(Kb,"decode");function Jb(y){var v=new h,I=y.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(me){var ce=me.split(":"),M=ce.shift().trim();if(M){var Pa=ce.join(":").trim();v.append(M,Pa)}}),v}a(Jb,"parseHeaders"),O.call(_e.prototype);function $e(y,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new h(v.headers),this.url=v.url||"",this._initBody(y)}a($e,"Response"),O.call($e.prototype),$e.prototype.clone=function(){return new $e(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},$e.error=function(){var y=new $e(null,{status:0,statusText:""});return y.type="error",y};var Zb=[301,302,303,307,308];$e.redirect=function(y,v){if(Zb.indexOf(v)===-1)throw new RangeError("Invalid status code");return new $e(null,{status:v,headers:{location:y}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(v,I){this.message=v,this.name=I;var me=Error(v);this.stack=me.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function Yl(y,v){return new Promise(function(I,me){var ce=new _e(y,v);if(ce.signal&&ce.signal.aborted)return me(new t.DOMException("Aborted","AbortError"));var M=new XMLHttpRequest;function Pa(){M.abort()}a(Pa,"abortXhr"),M.onload=function(){var Wr={status:M.status,statusText:M.statusText,headers:Jb(M.getAllResponseHeaders()||"")};Wr.url="responseURL"in M?M.responseURL:Wr.headers.get("X-Request-URL");var eu="response"in M?M.response:M.responseText;I(new $e(eu,Wr))},M.onerror=function(){me(new TypeError("Network request failed"))},M.ontimeout=function(){me(new TypeError("Network request failed"))},M.onabort=function(){me(new t.DOMException("Aborted","AbortError"))},M.open(ce.method,ce.url,!0),ce.credentials==="include"?M.withCredentials=!0:ce.credentials==="omit"&&(M.withCredentials=!1),"responseType"in M&&r.blob&&(M.responseType="blob"),ce.headers.forEach(function(Wr,eu){M.setRequestHeader(eu,Wr)}),ce.signal&&(ce.signal.addEventListener("abort",Pa),M.onreadystatechange=function(){M.readyState===4&&ce.signal.removeEventListener("abort",Pa)}),M.send(typeof ce._bodyInit>"u"?null:ce._bodyInit)})}return a(Yl,"fetch"),Yl.polyfill=!0,i.fetch||(i.fetch=Yl,i.Headers=h,i.Request=_e,i.Response=$e),t.Headers=h,t.Request=_e,t.Response=$e,t.fetch=Yl,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(Hs);Hs.fetch.ponyfill=!0;delete Hs.fetch.polyfill;var pr=Hs;lt=pr.fetch;lt.default=pr.fetch;lt.fetch=pr.fetch;lt.Headers=pr.Headers;lt.Request=pr.Request;lt.Response=pr.Response;Ym.exports=lt});var Cs=u(($R,ry)=>{"use strict";var ic=Object.prototype.hasOwnProperty,_r=Array.isArray,Ze=function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i}(),vS=a(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(_r(r)){for(var n=[],s=0;s<r.length;++s)typeof r[s]<"u"&&n.push(r[s]);t.obj[t.prop]=n}}},"compactQueue"),ty=a(function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)typeof e[n]<"u"&&(r[n]=e[n]);return r},"arrayToObject"),SS=a(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(_r(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!ic.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var n=e;return _r(e)&&!_r(t)&&(n=ty(e,r)),_r(e)&&_r(t)?(t.forEach(function(s,o){if(ic.call(e,o)){var l=e[o];l&&typeof l=="object"&&s&&typeof s=="object"?e[o]=i(l,s,r):e.push(s)}else e[o]=s}),e):Object.keys(t).reduce(function(s,o){var l=t[o];return ic.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},n)},"merge"),HS=a(function(e,t){return Object.keys(t).reduce(function(r,n){return r[n]=t[n],r},e)},"assignSingleSource"),CS=a(function(i,e,t){var r=i.replace(/\+/g," ");if(t==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode"),qS=a(function(e,t,r){if(e.length===0)return e;var n=e;if(typeof e=="symbol"?n=Symbol.prototype.toString.call(e):typeof e!="string"&&(n=String(e)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var s="",o=0;o<n.length;++o){var l=n.charCodeAt(o);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122){s+=n.charAt(o);continue}if(l<128){s=s+Ze[l];continue}if(l<2048){s=s+(Ze[192|l>>6]+Ze[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Ze[224|l>>12]+Ze[128|l>>6&63]+Ze[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|n.charCodeAt(o)&1023),s+=Ze[240|l>>18]+Ze[128|l>>12&63]+Ze[128|l>>6&63]+Ze[128|l&63]}return s},"encode"),ES=a(function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var s=t[n],o=s.obj[s.prop],l=Object.keys(o),d=0;d<l.length;++d){var p=l[d],h=o[p];typeof h=="object"&&h!==null&&r.indexOf(h)===-1&&(t.push({obj:o,prop:p}),r.push(h))}return vS(t),e},"compact"),PS=a(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),AS=a(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),DS=a(function(e,t){return[].concat(e,t)},"combine");ry.exports={arrayToObject:ty,assign:HS,combine:DS,compact:ES,decode:CS,encode:qS,isBuffer:AS,isRegExp:PS,merge:SS}});var nc=u((KR,ny)=>{"use strict";var TS=String.prototype.replace,IS=/%20/g,RS=Cs(),iy={RFC1738:"RFC1738",RFC3986:"RFC3986"};ny.exports=RS.assign({default:iy.RFC3986,formatters:{RFC1738:function(i){return TS.call(i,IS,"+")},RFC3986:function(i){return String(i)}}},iy)});var uy=u((JR,ly)=>{"use strict";var oy=Cs(),ti=nc(),BS=Object.prototype.hasOwnProperty,ay={brackets:a(function(e){return e+"[]"},"brackets"),comma:"comma",indices:a(function(e,t){return e+"["+t+"]"},"indices"),repeat:a(function(e){return e},"repeat")},mr=Array.isArray,OS=Array.prototype.push,ac=a(function(i,e){OS.apply(i,mr(e)?e:[e])},"pushToArray"),US=Date.prototype.toISOString,sy=ti.default,ye={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:oy.encode,encodeValuesOnly:!1,format:sy,formatter:ti.formatters[sy],indices:!1,serializeDate:a(function(e){return US.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},kS=a(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),jS=a(function i(e,t,r,n,s,o,l,d,p,h,_,H,A){var w=e;if(typeof l=="function"?w=l(t,w):w instanceof Date?w=h(w):r==="comma"&&mr(w)&&(w=w.join(",")),w===null){if(n)return o&&!H?o(t,ye.encoder,A,"key"):t;w=""}if(kS(w)||oy.isBuffer(w)){if(o){var C=H?t:o(t,ye.encoder,A,"key");return[_(C)+"="+_(o(w,ye.encoder,A,"value"))]}return[_(t)+"="+_(String(w))]}var D=[];if(typeof w>"u")return D;var O;if(mr(l))O=l;else{var Ee=Object.keys(w);O=d?Ee.sort(d):Ee}for(var be=0;be<O.length;++be){var _e=O[be];s&&w[_e]===null||(mr(w)?ac(D,i(w[_e],typeof r=="function"?r(t,_e):t,r,n,s,o,l,d,p,h,_,H,A)):ac(D,i(w[_e],t+(p?"."+_e:"["+_e+"]"),r,n,s,o,l,d,p,h,_,H,A)))}return D},"stringify"),MS=a(function(e){if(!e)return ye;if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||ye.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=ti.default;if(typeof e.format<"u"){if(!BS.call(ti.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=ti.formatters[r],s=ye.filter;return(typeof e.filter=="function"||mr(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:ye.addQueryPrefix,allowDots:typeof e.allowDots>"u"?ye.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ye.charsetSentinel,delimiter:typeof e.delimiter>"u"?ye.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ye.encode,encoder:typeof e.encoder=="function"?e.encoder:ye.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ye.encodeValuesOnly,filter:s,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ye.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ye.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ye.strictNullHandling}},"normalizeStringifyOptions");ly.exports=function(i,e){var t=i,r=MS(e),n,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):mr(r.filter)&&(s=r.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in ay?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=ay[l];n||(n=Object.keys(t)),r.sort&&n.sort(r.sort);for(var p=0;p<n.length;++p){var h=n[p];r.skipNulls&&t[h]===null||ac(o,jS(t[h],h,d,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.formatter,r.encodeValuesOnly,r.charset))}var _=o.join(r.delimiter),H=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?H+="utf8=%26%2310003%3B&":H+="utf8=%E2%9C%93&"),_.length>0?H+_:""}});var py=u((XR,hy)=>{"use strict";var ri=Cs(),sc=Object.prototype.hasOwnProperty,cy=Array.isArray,de={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ri.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},LS=a(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),dy=a(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),FS=a(function(e,t){if(cy(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},"maybeMap"),NS="utf8=%26%2310003%3B",QS="utf8=%E2%9C%93",GS=a(function(e,t){var r={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),l=-1,d,p=t.charset;if(t.charsetSentinel)for(d=0;d<o.length;++d)o[d].indexOf("utf8=")===0&&(o[d]===QS?p="utf-8":o[d]===NS&&(p="iso-8859-1"),l=d,d=o.length);for(d=0;d<o.length;++d)if(d!==l){var h=o[d],_=h.indexOf("]="),H=_===-1?h.indexOf("="):_+1,A,w;H===-1?(A=t.decoder(h,de.decoder,p,"key"),w=t.strictNullHandling?null:""):(A=t.decoder(h.slice(0,H),de.decoder,p,"key"),w=FS(dy(h.slice(H+1),t),function(C){return t.decoder(C,de.decoder,p,"value")})),w&&t.interpretNumericEntities&&p==="iso-8859-1"&&(w=LS(w)),h.indexOf("[]=")>-1&&(w=cy(w)?[w]:w),sc.call(r,A)?r[A]=ri.combine(r[A],w):r[A]=w}return r},"parseQueryStringValues"),VS=a(function(i,e,t,r){for(var n=r?e:dy(e,t),s=i.length-1;s>=0;--s){var o,l=i[s];if(l==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var d=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,p=parseInt(d,10);!t.parseArrays&&d===""?o={0:n}:!isNaN(p)&&l!==d&&String(p)===d&&p>=0&&t.parseArrays&&p<=t.arrayLimit?(o=[],o[p]=n):o[d]=n}n=o}return n},"parseObject"),WS=a(function(e,t,r,n){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,d=r.depth>0&&o.exec(s),p=d?s.slice(0,d.index):s,h=[];if(p){if(!r.plainObjects&&sc.call(Object.prototype,p)&&!r.allowPrototypes)return;h.push(p)}for(var _=0;r.depth>0&&(d=l.exec(s))!==null&&_<r.depth;){if(_+=1,!r.plainObjects&&sc.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;h.push(d[1])}return d&&h.push("["+s.slice(d.index)+"]"),VS(h,t,r,n)}},"parseQueryStringKeys"),$S=a(function(e){if(!e)return de;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?de.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?de.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:de.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:de.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:de.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:de.comma,decoder:typeof e.decoder=="function"?e.decoder:de.decoder,delimiter:typeof e.delimiter=="string"||ri.isRegExp(e.delimiter)?e.delimiter:de.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:de.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:de.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:de.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:de.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:de.strictNullHandling}},"normalizeParseOptions");hy.exports=function(i,e){var t=$S(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?GS(i,t):i,n=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=WS(l,r[l],t,typeof i=="string");n=ri.merge(n,d,t)}return ri.compact(n)}});var oc=u((eB,_y)=>{"use strict";var zS=uy(),KS=py(),JS=nc();_y.exports={formats:JS,parse:KS,stringify:zS}});var yy=u(my=>{function ut(i){if(typeof i!="object")return i;var e,t,r=Object.prototype.toString.call(i);if(r==="[object Object]"){if(i.constructor!==Object&&typeof i.constructor=="function"){t=new i.constructor;for(e in i)i.hasOwnProperty(e)&&t[e]!==i[e]&&(t[e]=ut(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:ut(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=ut(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=ut(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(n){t.add(ut(n))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(n,s){t.set(ut(s),ut(n))}),t):r==="[object Date]"?new Date(+i):r==="[object RegExp]"?(t=new RegExp(i.source,i.flags),t.lastIndex=i.lastIndex,t):r==="[object DataView]"?new i.constructor(ut(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}a(ut,"klona");my.klona=ut});var uc=u(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.DataObject=Xe.getRawData=Xe.rawDataSymbol=void 0;var ZS=yy();Xe.rawDataSymbol=Symbol("twurpleRawData");function XS(i){return(0,ZS.klona)(i[Xe.rawDataSymbol])}a(XS,"getRawData");Xe.getRawData=XS;var lc=class{static{a(this,"DataObject")}constructor(e){this[Xe.rawDataSymbol]=e}};Xe.DataObject=lc});var Es=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.CustomError=void 0;var cc=class extends Error{static{a(this,"CustomError")}constructor(e,t){var r;super(e,t),Object.setPrototypeOf(this,new.target.prototype),(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};qs.CustomError=cc});var hc=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.RelationAssertionError=void 0;var YS=Es(),dc=class extends YS.CustomError{static{a(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};Ps.RelationAssertionError=dc});var fy=u(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.checkRelationAssertion=void 0;var e0=hc();function t0(i){if(i==null)throw new e0.RelationAssertionError;return i}a(t0,"checkRelationAssertion");As.checkRelationAssertion=t0});var pc=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.rtfm=void 0;function r0(i,e,t){return r=>{let n=t?function(){return`[${e}#${this[t]} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`};Object.defineProperty(r.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:n,enumerable:!1})}}a(r0,"rtfm");Ds.rtfm=r0});var gy=u(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.HelixExtension=void 0;var i0=(g(),b(f)),P=uc(),n0=pc(),_c=class extends P.DataObject{static{a(this,"HelixExtension")}get authorName(){return this[P.rawDataSymbol].author_name}get bitsEnabled(){return this[P.rawDataSymbol].bits_enabled}get installable(){return this[P.rawDataSymbol].can_install}get configurationLocation(){return this[P.rawDataSymbol].configuration_location}get description(){return this[P.rawDataSymbol].description}get tosUrl(){return this[P.rawDataSymbol].eula_tos_url}get hasChatSupport(){return this[P.rawDataSymbol].has_chat_support}get iconUrl(){return this[P.rawDataSymbol].icon_url}getIconUrl(e){return this[P.rawDataSymbol].icon_urls[e]}get id(){return this[P.rawDataSymbol].id}get name(){return this[P.rawDataSymbol].name}get privacyPolicyUrl(){return this[P.rawDataSymbol].privacy_policy_url}get requestsIdentityLink(){return this[P.rawDataSymbol].request_identity_link}get screenshotUrls(){return this[P.rawDataSymbol].screenshot_urls}get state(){return this[P.rawDataSymbol].state}get subscriptionsSupportLevel(){return this[P.rawDataSymbol].subscriptions_support_level}get summary(){return this[P.rawDataSymbol].summary}get supportEmail(){return this[P.rawDataSymbol].support_email}get version(){return this[P.rawDataSymbol].version}get viewerSummery(){return this[P.rawDataSymbol].viewer_summary}get allowedConfigUrls(){return this[P.rawDataSymbol].allowlisted_config_urls}get allowedPanelUrls(){return this[P.rawDataSymbol].allowlisted_panel_urls}get mobileViewerUrl(){var e,t;return(t=(e=this[P.rawDataSymbol].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelViewerUrl(){var e,t;return(t=(e=this[P.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelHeight(){var e,t;return(t=(e=this[P.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.height)!==null&&t!==void 0?t:null}get panelCanLinkExternalContent(){var e,t;return(t=(e=this[P.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get overlayViewerUrl(){var e,t;return(t=(e=this[P.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get overlayCanLinkExternalContent(){var e,t;return(t=(e=this[P.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get componentViewerUrl(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get componentAspectWidth(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&t!==void 0?t:null}get componentAspectHeight(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&t!==void 0?t:null}get componentAspectRatioX(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&t!==void 0?t:null}get componentAspectRatioY(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&t!==void 0?t:null}get componentAutoScales(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&t!==void 0?t:null}get componentScalePixels(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&t!==void 0?t:null}get componentTargetHeight(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.target_height)!==null&&t!==void 0?t:null}get componentSize(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:null}get componentZoom(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom)!==null&&t!==void 0?t:null}get componentZoomPixels(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&t!==void 0?t:null}get componentCanLinkExternalContent(){var e,t;return(t=(e=this[P.rawDataSymbol].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get configViewerUrl(){var e,t;return(t=(e=this[P.rawDataSymbol].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get configCanLinkExternalContent(){var e,t;return(t=(e=this[P.rawDataSymbol].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}};ii.HelixExtension=_c;ii.HelixExtension=_c=i0.__decorate([(0,n0.rtfm)("api","HelixExtension","id")],_c)});var by=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.HellFreezesOverError=void 0;var a0=Es(),mc=class extends a0.CustomError{static{a(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};Ts.HellFreezesOverError=mc});var xy=u(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extractUserName=yr.extractUserId=void 0;function s0(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}a(s0,"extractUserId");yr.extractUserId=s0;function o0(i){return typeof i=="string"?i:i.name}a(o0,"extractUserName");yr.extractUserName=o0});var m=u(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.extractUserName=G.extractUserId=G.RelationAssertionError=G.HellFreezesOverError=G.CustomError=G.HelixExtension=G.rtfm=G.checkRelationAssertion=G.rawDataSymbol=G.getRawData=G.DataObject=void 0;var yc=uc();Object.defineProperty(G,"DataObject",{enumerable:!0,get:function(){return yc.DataObject}});Object.defineProperty(G,"getRawData",{enumerable:!0,get:function(){return yc.getRawData}});Object.defineProperty(G,"rawDataSymbol",{enumerable:!0,get:function(){return yc.rawDataSymbol}});var l0=fy();Object.defineProperty(G,"checkRelationAssertion",{enumerable:!0,get:function(){return l0.checkRelationAssertion}});var u0=pc();Object.defineProperty(G,"rtfm",{enumerable:!0,get:function(){return u0.rtfm}});var c0=gy();Object.defineProperty(G,"HelixExtension",{enumerable:!0,get:function(){return c0.HelixExtension}});var d0=Es();Object.defineProperty(G,"CustomError",{enumerable:!0,get:function(){return d0.CustomError}});var h0=by();Object.defineProperty(G,"HellFreezesOverError",{enumerable:!0,get:function(){return h0.HellFreezesOverError}});var p0=hc();Object.defineProperty(G,"RelationAssertionError",{enumerable:!0,get:function(){return p0.RelationAssertionError}});var wy=xy();Object.defineProperty(G,"extractUserId",{enumerable:!0,get:function(){return wy.extractUserId}});Object.defineProperty(G,"extractUserName",{enumerable:!0,get:function(){return wy.extractUserName}})});var gc=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.HttpStatusCodeError=void 0;var _0=m(),fc=class extends _0.CustomError{static{a(this,"HttpStatusCodeError")}constructor(e,t,r,n,s,o){super(`Encountered HTTP status code ${e}: ${t}
|
|
9
7
|
|
|
10
|
-
URL: ${
|
|
11
|
-
Method: ${
|
|
8
|
+
URL: ${r}
|
|
9
|
+
Method: ${n}
|
|
12
10
|
Body:
|
|
13
|
-
${!s&&o.length>150?`${o.slice(0,147)}...`:o}`),this._statusCode=e,this._url=i,this._method=a,this._body=o}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}};no.HttpStatusCodeError=Jp});var Xp=l(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.transformTwitchApiResponse=Gr.handleTwitchApiResponseError=void 0;var QB=Fp(),$B=Zp();async function WB(r,e){var t;if(!r.ok){let i=r.headers.get("Content-Type")==="application/json",a=i?JSON.stringify(await r.json(),null,2):await r.text(),o=(0,QB.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),s=`${e.url}${o}`;throw new $B.HttpStatusCodeError(r.status,r.statusText,s,(t=e.method)!==null&&t!==void 0?t:"GET",a,i)}}n(WB,"handleTwitchApiResponseError");Gr.handleTwitchApiResponseError=WB;async function VB(r){if(r.status===204)return;let e=await r.text();if(e)return JSON.parse(e)}n(VB,"transformTwitchApiResponse");Gr.transformTwitchApiResponse=VB});var b0=l(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.getTwitchApiUrl=void 0;function zB(r,e){switch(e){case"helix":return`https://api.twitch.tv/helix/${r.replace(/^\//,"")}`;case"auth":return`https://id.twitch.tv/oauth2/${r.replace(/^\//,"")}`;case"custom":return r;default:return r}}n(zB,"getTwitchApiUrl");ao.getTwitchApiUrl=zB});var S0=l(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.callTwitchApi=Qr.callTwitchApiRaw=void 0;var v0=ZS(),KB=Fp(),w0=Xp(),JB=b0();async function x0(r,e,t,i,a={}){var o,s;let u=(o=r.type)!==null&&o!==void 0?o:"helix",c=(0,JB.getTwitchApiUrl)(r.url,u),p=(0,KB.stringify)(r.query,{arrayFormat:"repeat",addQueryPrefix:!0}),h=new v0.Headers({Accept:"application/json"}),f;r.jsonBody&&(f=JSON.stringify(r.jsonBody),h.append("Content-Type","application/json")),e&&u!=="auth"&&h.append("Client-ID",e),t&&h.append("Authorization",`${u==="helix"?i??"Bearer":"OAuth"} ${t}`);let b={...a,method:(s=r.method)!==null&&s!==void 0?s:"GET",headers:h,body:f};return await(0,v0.default)(`${c}${p}`,b)}n(x0,"callTwitchApiRaw");Qr.callTwitchApiRaw=x0;async function ZB(r,e,t,i,a={}){let o=await x0(r,e,t,i,a);return await(0,w0.handleTwitchApiResponseError)(o,r),await(0,w0.transformTwitchApiResponse)(o)}n(ZB,"callTwitchApi");Qr.callTwitchApi=ZB});var q0=l(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.createBroadcasterQuery=void 0;var XB=m();function YB(r){return{broadcaster_id:(0,XB.extractUserId)(r)}}n(YB,"createBroadcasterQuery");oo.createBroadcasterQuery=YB});var G=l(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.HttpStatusCodeError=be.transformTwitchApiResponse=be.handleTwitchApiResponseError=be.createBroadcasterQuery=be.callTwitchApiRaw=be.callTwitchApi=void 0;var P0=S0();Object.defineProperty(be,"callTwitchApi",{enumerable:!0,get:function(){return P0.callTwitchApi}});Object.defineProperty(be,"callTwitchApiRaw",{enumerable:!0,get:function(){return P0.callTwitchApiRaw}});var eU=q0();Object.defineProperty(be,"createBroadcasterQuery",{enumerable:!0,get:function(){return eU.createBroadcasterQuery}});var C0=Xp();Object.defineProperty(be,"handleTwitchApiResponseError",{enumerable:!0,get:function(){return C0.handleTwitchApiResponseError}});Object.defineProperty(be,"transformTwitchApiResponse",{enumerable:!0,get:function(){return C0.transformTwitchApiResponse}});var tU=Zp();Object.defineProperty(be,"HttpStatusCodeError",{enumerable:!0,get:function(){return tU.HttpStatusCodeError}})});var eh=l(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.ConfigError=void 0;var rU=m(),Yp=class extends rU.CustomError{static{n(this,"ConfigError")}};so.ConfigError=Yp});var H0=l(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.HelixRateLimiter=void 0;var iU=za(),nU=G(),th=class extends iU.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:i,authorizationType:a,fetchOptions:o}){return await(0,nU.callTwitchApiRaw)(e,t,i,a,o)}needsToRetryAfter(e){return e.status===429&&(!e.headers.has("ratelimit-remaining")||Number(e.headers.get("ratelimit-remaining"))===0)?+e.headers.get("ratelimit-reset")*1e3-Date.now():null}getParametersFromResponse(e){let{headers:t}=e;return{limit:+t.get("ratelimit-limit"),remaining:+t.get("ratelimit-remaining"),resetsAt:+t.get("ratelimit-reset")*1e3}}};uo.HelixRateLimiter=th});var Zi=l(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.createCacheKey=void 0;function aU(r){switch(typeof r){case"undefined":return"";case"object":{if(r===null)return"";if("cacheKey"in r)return r.cacheKey;let e=JSON.stringify(r);if(e!=="{}")return e}default:return r.toString()}}n(aU,"createSingleCacheKey");function oU(r,e,t){return[r,...e.map(aU)].join("/")+(t?"/":"")}n(oU,"createCacheKey");lo.createCacheKey=oU});var E0=l(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.Cacheable=void 0;var sU=Zi();function uU(r){return class extends r{constructor(){super(...arguments),this.cache=new Map}getFromCache(e){if(this._cleanCache(),this.cache.has(e)){let t=this.cache.get(e);if(t)return t.value}}setCache(e,t,i){this.cache.set(e,{value:t,expires:Date.now()+i*1e3})}removeFromCache(e,t){let i=this._getInternalCacheKey(e,t);t?this.cache.forEach((a,o)=>{o.startsWith(i)&&this.cache.delete(o)}):this.cache.delete(i)}_cleanCache(){let e=Date.now();this.cache.forEach((t,i)=>{t.expires<e&&this.cache.delete(i)})}_getInternalCacheKey(e,t){if(typeof e=="string"){let i=e;return i.endsWith("/")||(i+="/"),i}else{let i=e.shift();return sU.createCacheKey(i,e,t)}}}}n(uU,"Cacheable");co.Cacheable=uU});var A0=l(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.Cached=void 0;var lU=Zi();function cU(r=1/0,e=!1){return function(t,i,a){let o=a.value;return a.value=async function(...s){let u=lU.createCacheKey(i,s),c=this.getFromCache(u);if(c)return c;let p=await o.apply(this,s);return(p!=null||e)&&this.setCache(u,p,r),p},a}}n(cU,"Cached");po.Cached=cU});var T0=l(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.CachedGetter=void 0;var dU=Zi();function pU(r=1/0){return function(e,t,i){if(i.get){let a=i.get;i.get=function(){let o=dU.createCacheKey(t,[]),s=this.getFromCache(o);if(s)return s;let u=a.call(this);return this.setCache(o,u,r),u}}return i}}n(pU,"CachedGetter");ho.CachedGetter=pU});var I0=l(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.ClearsCache=void 0;function hU(r,e){return function(t,i,a){let o=a.value;return a.value=async function(...s){let u=await o.apply(this,s),c=e===void 0?s.slice():s.slice(0,e);return this.removeFromCache([r,...c],!0),u},a}}n(hU,"ClearsCache");fo.ClearsCache=hU});var Xi=l(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.createCacheKey=Ue.ClearsCache=Ue.CachedGetter=Ue.Cached=Ue.Cacheable=void 0;var fU=E0();Object.defineProperty(Ue,"Cacheable",{enumerable:!0,get:function(){return fU.Cacheable}});var mU=A0();Object.defineProperty(Ue,"Cached",{enumerable:!0,get:function(){return mU.Cached}});var yU=T0();Object.defineProperty(Ue,"CachedGetter",{enumerable:!0,get:function(){return yU.CachedGetter}});var _U=I0();Object.defineProperty(Ue,"ClearsCache",{enumerable:!0,get:function(){return _U.ClearsCache}});var gU=Zi();Object.defineProperty(Ue,"createCacheKey",{enumerable:!0,get:function(){return gU.createCacheKey}})});var ih=l(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.Listener=void 0;var rh=class{static{n(this,"Listener")}constructor(e,t,i,a=!1){this.owner=e,this.event=t,this.listener=i,this._internal=a}unbind(){this.owner.removeListener(this)}};mo.Listener=rh});var R0=l(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.EventEmitter=void 0;var bU=ih(),nh=class{static{n(this,"EventEmitter")}constructor(){this._eventListeners=new Map,this._internalEventListeners=new Map}on(e,t){return this._addListener(!1,e,t)}addListener(e,t){return this._addListener(!1,e,t)}removeListener(e,t){this._removeListener(!1,e,t)}registerEvent(){let e=n(t=>this.addListener(e,t),"eventBinder");return e}emit(e,...t){if(this._eventListeners.has(e))for(let i of this._eventListeners.get(e))i(...t);if(this._internalEventListeners.has(e))for(let i of this._internalEventListeners.get(e))i(...t)}registerInternalEvent(){let e=n(t=>this.addInternalListener(e,t),"eventBinder");return e}addInternalListener(e,t){return this._addListener(!0,e,t)}removeInternalListener(e,t){this._removeListener(!0,e,t)}_addListener(e,t,i){let a=e?this._eventListeners:this._internalEventListeners;return a.has(t)?a.get(t).push(i):a.set(t,[i]),new bU.Listener(this,t,i,e)}_removeListener(e,t,i){let a=e?this._eventListeners:this._internalEventListeners;if(!t)a.clear();else if(typeof t=="object"){let o=t;this._removeListener(o._internal,o.event,o.listener)}else{let o=t;if(a.has(o))if(i){let s=a.get(o),u=0;for(;(u=s.indexOf(i))!==-1;)s.splice(u,1)}else a.delete(o)}}};yo.EventEmitter=nh});var ah=l($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.Listener=$r.EventEmitter=void 0;var vU=R0();Object.defineProperty($r,"EventEmitter",{enumerable:!0,get:function(){return vU.EventEmitter}});var wU=ih();Object.defineProperty($r,"Listener",{enumerable:!0,get:function(){return wU.Listener}})});var _o=l(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.accessTokenIsExpired=Wr.getExpiryDateOfAccessToken=void 0;var oh=S(),xU=6e4;function D0(r){return(0,oh.mapNullable)(r.expiresIn,e=>r.obtainmentTimestamp+e*1e3-xU)}n(D0,"getExpiryMillis");function SU(r){return(0,oh.mapNullable)(D0(r),e=>new Date(e))}n(SU,"getExpiryDateOfAccessToken");Wr.getExpiryDateOfAccessToken=SU;function qU(r){var e;return(e=(0,oh.mapNullable)(D0(r),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(qU,"accessTokenIsExpired");Wr.accessTokenIsExpired=qU});var bo=l(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.InvalidTokenError=void 0;var PU=m(),sh=class extends PU.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};go.InvalidTokenError=sh});var wo=l(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.InvalidTokenTypeError=void 0;var CU=m(),uh=class extends CU.CustomError{static{n(this,"InvalidTokenTypeError")}};vo.InvalidTokenTypeError=uh});var O0=l(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.createRevokeTokenQuery=rt.createRefreshTokenQuery=rt.createGetAppTokenQuery=rt.createExchangeCodeQuery=void 0;function HU(r,e,t,i){return{grant_type:"authorization_code",client_id:r,client_secret:e,code:t,redirect_uri:i}}n(HU,"createExchangeCodeQuery");rt.createExchangeCodeQuery=HU;function EU(r,e){return{grant_type:"client_credentials",client_id:r,client_secret:e}}n(EU,"createGetAppTokenQuery");rt.createGetAppTokenQuery=EU;function AU(r,e,t){return{grant_type:"refresh_token",client_id:r,client_secret:e,refresh_token:t}}n(AU,"createRefreshTokenQuery");rt.createRefreshTokenQuery=AU;function TU(r,e){return{client_id:r,token:e}}n(TU,"createRevokeTokenQuery");rt.createRevokeTokenQuery=TU});var ch=l(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.TokenInfo=void 0;var IU=(_(),g(y)),RU=S(),ir=m(),lh=class extends ir.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[ir.rawDataSymbol].client_id}get userId(){var e;return(e=this[ir.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[ir.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[ir.rawDataSymbol].scopes}get expiryDate(){return(0,RU.mapNullable)(this[ir.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};lh=IU.__decorate([(0,ir.rtfm)("auth","TokenInfo","clientId")],lh);xo.TokenInfo=lh});var en=l(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.loadAndCompareTokenInfo=Q.compareScopeSets=Q.compareScopes=Q.getValidTokenFromProviderForIntent=Q.getValidTokenFromProviderForUser=Q.getTokenInfo=Q.revokeToken=Q.refreshUserToken=Q.getAppToken=Q.exchangeCode=void 0;var Vr=G(),Yi=bo(),DU=wo(),So=O0(),OU=ch();function dh(r){var e,t;return{accessToken:r.access_token,refreshToken:r.refresh_token||null,scope:(e=r.scope)!==null&&e!==void 0?e:[],expiresIn:(t=r.expires_in)!==null&&t!==void 0?t:null,obtainmentTimestamp:Date.now()}}n(dh,"createAccessTokenFromData");async function BU(r,e,t,i){return dh(await(0,Vr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,So.createExchangeCodeQuery)(r,e,t,i)}))}n(BU,"exchangeCode");Q.exchangeCode=BU;async function UU(r,e){return dh(await(0,Vr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,So.createGetAppTokenQuery)(r,e)}))}n(UU,"getAppToken");Q.getAppToken=UU;async function jU(r,e,t){return dh(await(0,Vr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,So.createRefreshTokenQuery)(r,e,t)}))}n(jU,"refreshUserToken");Q.refreshUserToken=jU;async function kU(r,e){await(0,Vr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,So.createRevokeTokenQuery)(r,e)})}n(kU,"revokeToken");Q.revokeToken=kU;async function zr(r,e){try{let t=await(0,Vr.callTwitchApi)({type:"auth",url:"validate"},e,r);return new OU.TokenInfo(t)}catch(t){throw t instanceof Vr.HttpStatusCodeError&&t.statusCode===401?new Yi.InvalidTokenError({cause:t}):t}}n(zr,"getTokenInfo");Q.getTokenInfo=zr;async function LU(r,e,t,i){let a=null,o=!1;try{let s=await r.getAccessTokenForUser(e,t);if(s){o=!0;let u=await zr(s.accessToken);return{accessToken:s,tokenInfo:u}}}catch(s){s instanceof Yi.InvalidTokenError?a=s:i?.error(`Retrieving an access token failed: ${s.message}`)}if(o&&(i?.warn("No valid token available; trying to refresh"),r.refreshAccessTokenForUser))try{let s=await r.refreshAccessTokenForUser(e),u=await zr(s.accessToken);return{accessToken:s,tokenInfo:u}}catch(s){s instanceof Yi.InvalidTokenError?a=s:i?.error(`Refreshing the access token failed: ${s.message}`)}throw a??new Error("Could not retrieve a valid token")}n(LU,"getValidTokenFromProviderForUser");Q.getValidTokenFromProviderForUser=LU;async function FU(r,e,t,i){let a=null,o=!1;if(!r.getAccessTokenForIntent)throw new DU.InvalidTokenTypeError("This call requires an AuthProvider that supports intents.\nPlease use an auth provider that does, such as `RefreshingAuthProvider`.");try{let s=await r.getAccessTokenForIntent(e,t);if(s){o=!0;let u=await zr(s.accessToken);return{accessToken:s,tokenInfo:u}}}catch(s){s instanceof Yi.InvalidTokenError?a=s:i?.error(`Retrieving an access token failed: ${s.message}`)}if(o&&(i?.warn("No valid token available; trying to refresh"),r.refreshAccessTokenForIntent))try{let s=await r.refreshAccessTokenForIntent(e),u=await zr(s.accessToken);return{accessToken:s,tokenInfo:u}}catch(s){s instanceof Yi.InvalidTokenError?a=s:i?.error(`Refreshing the access token failed: ${s.message}`)}throw a??new Error("Could not retrieve a valid token")}n(FU,"getValidTokenFromProviderForIntent");Q.getValidTokenFromProviderForIntent=FU;var MU=new Map([["channel_commercial",["channel:edit:commercial"]],["channel_editor",["channel:manage:broadcast"]],["channel_read",["channel:read:stream_key"]],["channel_subscriptions",["channel:read:subscriptions"]],["user_blocks_read",["user:read:blocked_users"]],["user_blocks_edit",["user:manage:blocked_users"]],["user_follows_edit",["user:edit:follows"]],["user_read",["user:read:email"]],["user_subscriptions",["user:read:subscriptions"]],["user:edit:broadcast",["channel:manage:broadcast","channel:manage:extensions"]]]);function B0(r,e){if(e?.length){let t=new Set(r.flatMap(i=>{var a;return[i,...(a=MU.get(i))!==null&&a!==void 0?a:[]]}));if(e.every(i=>!t.has(i))){let i=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${i}) and can not be upgraded.
|
|
11
|
+
${!o&&s.length>150?`${s.slice(0,147)}...`:s}`),this._statusCode=e,this._url=r,this._method=n,this._body=s}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}};Is.HttpStatusCodeError=fc});var bc=u(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.transformTwitchApiResponse=fr.handleTwitchApiResponseError=void 0;var m0=oc(),y0=gc();async function f0(i,e){var t;if(!i.ok){let r=i.headers.get("Content-Type")==="application/json",n=r?JSON.stringify(await i.json(),null,2):await i.text(),s=(0,m0.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new y0.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",n,r)}}a(f0,"handleTwitchApiResponseError");fr.handleTwitchApiResponseError=f0;async function g0(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}a(g0,"transformTwitchApiResponse");fr.transformTwitchApiResponse=g0});var vy=u(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.getTwitchApiUrl=void 0;function b0(i,e,t){switch(e){case"helix":{let r=i.replace(/^\//,"");return t?r==="eventsub/subscriptions"?`http://localhost:${t}/${r}`:`http://localhost:${t}/mock/${r}`:`https://api.twitch.tv/helix/${r}`}case"auth":return`https://id.twitch.tv/oauth2/${i.replace(/^\//,"")}`;case"custom":return i;default:return i}}a(b0,"getTwitchApiUrl");Rs.getTwitchApiUrl=b0});var qy=u(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.callTwitchApi=gr.callTwitchApiRaw=void 0;var Sy=ey(),x0=oc(),Hy=bc(),w0=vy();async function Cy(i,e,t,r,n={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",p=(0,w0.getTwitchApiUrl)(i.url,d,s),h=(0,x0.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),_=new Sy.Headers({Accept:"application/json"}),H;i.jsonBody&&(H=JSON.stringify(i.jsonBody),_.append("Content-Type","application/json")),e&&d!=="auth"&&_.append("Client-ID",e),t&&_.append("Authorization",`${d==="helix"?r??"Bearer":"OAuth"} ${t}`);let A={...n,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:_,body:H};return await(0,Sy.default)(`${p}${h}`,A)}a(Cy,"callTwitchApiRaw");gr.callTwitchApiRaw=Cy;async function v0(i,e,t,r,n={}){let s=await Cy(i,e,t,r,n);return await(0,Hy.handleTwitchApiResponseError)(s,i),await(0,Hy.transformTwitchApiResponse)(s)}a(v0,"callTwitchApi");gr.callTwitchApi=v0});var Ey=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.createBroadcasterQuery=void 0;var S0=m();function H0(i){return{broadcaster_id:(0,S0.extractUserId)(i)}}a(H0,"createBroadcasterQuery");Bs.createBroadcasterQuery=H0});var W=u(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.HttpStatusCodeError=ve.transformTwitchApiResponse=ve.handleTwitchApiResponseError=ve.createBroadcasterQuery=ve.callTwitchApiRaw=ve.callTwitchApi=void 0;var Py=qy();Object.defineProperty(ve,"callTwitchApi",{enumerable:!0,get:function(){return Py.callTwitchApi}});Object.defineProperty(ve,"callTwitchApiRaw",{enumerable:!0,get:function(){return Py.callTwitchApiRaw}});var C0=Ey();Object.defineProperty(ve,"createBroadcasterQuery",{enumerable:!0,get:function(){return C0.createBroadcasterQuery}});var Ay=bc();Object.defineProperty(ve,"handleTwitchApiResponseError",{enumerable:!0,get:function(){return Ay.handleTwitchApiResponseError}});Object.defineProperty(ve,"transformTwitchApiResponse",{enumerable:!0,get:function(){return Ay.transformTwitchApiResponse}});var q0=gc();Object.defineProperty(ve,"HttpStatusCodeError",{enumerable:!0,get:function(){return q0.HttpStatusCodeError}})});var wc=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.ConfigError=void 0;var E0=m(),xc=class extends E0.CustomError{static{a(this,"ConfigError")}};Os.ConfigError=xc});var Dy=u(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.HelixRateLimiter=void 0;var P0=Ss(),A0=W(),vc=class extends P0.ResponseBasedRateLimiter{static{a(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:n,fetchOptions:s,mockServerPort:o}){return await(0,A0.callTwitchApiRaw)(e,t,r,n,s,o)}needsToRetryAfter(e){return e.status===429&&(!e.headers.has("ratelimit-remaining")||Number(e.headers.get("ratelimit-remaining"))===0)?+e.headers.get("ratelimit-reset")*1e3-Date.now():null}getParametersFromResponse(e){let{headers:t}=e;return{limit:+t.get("ratelimit-limit"),remaining:+t.get("ratelimit-remaining"),resetsAt:+t.get("ratelimit-reset")*1e3}}};Us.HelixRateLimiter=vc});var ni=u(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.createCacheKey=void 0;function D0(i){switch(typeof i){case"undefined":return"";case"object":{if(i===null)return"";if("cacheKey"in i)return i.cacheKey;let e=JSON.stringify(i);if(e!=="{}")return e}default:return i.toString()}}a(D0,"createSingleCacheKey");function T0(i,e,t){return[i,...e.map(D0)].join("/")+(t?"/":"")}a(T0,"createCacheKey");ks.createCacheKey=T0});var Ty=u(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.Cacheable=void 0;var I0=ni(),ct=Symbol("cache");function R0(i){var e,t;return t=class extends i{static{a(this,"_b")}constructor(){super(...arguments),this[e]=new Map}getFromCache(r){if(this._cleanCache(),this[ct].has(r)){let n=this[ct].get(r);if(n)return n.value}}setCache(r,n,s){this[ct].set(r,{value:n,expires:Date.now()+s*1e3})}removeFromCache(r,n){let s=this._getInternalCacheKey(r,n);n?this[ct].forEach((o,l)=>{l.startsWith(s)&&this[ct].delete(l)}):this[ct].delete(s)}_cleanCache(){let r=Date.now();this[ct].forEach((n,s)=>{n.expires<r&&this[ct].delete(s)})}_getInternalCacheKey(r,n){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,I0.createCacheKey)(s,r,n)}}},e=ct,t}a(R0,"Cacheable");js.Cacheable=R0});var Iy=u(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.Cached=void 0;var B0=ni();function O0(i=1/0,e=!1){return function(t,r,n){let s=n.value;return n.value=async function(...o){let l=(0,B0.createCacheKey)(r,o),d=this.getFromCache(l);if(d)return d;let p=await s.apply(this,o);return(p!=null||e)&&this.setCache(l,p,i),p},n}}a(O0,"Cached");Ms.Cached=O0});var Ry=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.CachedGetter=void 0;var U0=ni();function k0(i=1/0){return function(e,t,r){if(r.get){let n=r.get;r.get=function(){let s=(0,U0.createCacheKey)(t,[]),o=this.getFromCache(s);if(o)return o;let l=n.call(this);return this.setCache(s,l,i),l}}return r}}a(k0,"CachedGetter");Ls.CachedGetter=k0});var By=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ClearsCache=void 0;function j0(i,e){return function(t,r,n){let s=n.value;return n.value=async function(...o){let l=await s.apply(this,o),d=e===void 0?o.slice():o.slice(0,e);return this.removeFromCache([i,...d],!0),l},n}}a(j0,"ClearsCache");Fs.ClearsCache=j0});var ai=u(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.createCacheKey=Oe.ClearsCache=Oe.CachedGetter=Oe.Cached=Oe.Cacheable=void 0;var M0=Ty();Object.defineProperty(Oe,"Cacheable",{enumerable:!0,get:function(){return M0.Cacheable}});var L0=Iy();Object.defineProperty(Oe,"Cached",{enumerable:!0,get:function(){return L0.Cached}});var F0=Ry();Object.defineProperty(Oe,"CachedGetter",{enumerable:!0,get:function(){return F0.CachedGetter}});var N0=By();Object.defineProperty(Oe,"ClearsCache",{enumerable:!0,get:function(){return N0.ClearsCache}});var Q0=ni();Object.defineProperty(Oe,"createCacheKey",{enumerable:!0,get:function(){return Q0.createCacheKey}})});var Hc=u(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.Listener=void 0;var Sc=class{static{a(this,"Listener")}constructor(e,t,r,n=!1){this.owner=e,this.event=t,this.listener=r,this._internal=n}unbind(){this.owner.removeListener(this)}};Ns.Listener=Sc});var Oy=u(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.EventEmitter=void 0;var G0=Hc(),Cc=class{static{a(this,"EventEmitter")}constructor(){this._eventListeners=new Map,this._internalEventListeners=new Map}on(e,t){return this._addListener(!1,e,t)}addListener(e,t){return this._addListener(!1,e,t)}removeListener(e,t){this._removeListener(!1,e,t)}registerEvent(){let e=a(t=>this.addListener(e,t),"eventBinder");return e}emit(e,...t){if(this._eventListeners.has(e))for(let r of this._eventListeners.get(e))r(...t);if(this._internalEventListeners.has(e))for(let r of this._internalEventListeners.get(e))r(...t)}registerInternalEvent(){let e=a(t=>this.addInternalListener(e,t),"eventBinder");return e}addInternalListener(e,t){return this._addListener(!0,e,t)}removeInternalListener(e,t){this._removeListener(!0,e,t)}_addListener(e,t,r){let n=e?this._eventListeners:this._internalEventListeners;return n.has(t)?n.get(t).push(r):n.set(t,[r]),new G0.Listener(this,t,r,e)}_removeListener(e,t,r){let n=e?this._eventListeners:this._internalEventListeners;if(!t)n.clear();else if(typeof t=="object"){let s=t;this._removeListener(s._internal,s.event,s.listener)}else{let s=t;if(n.has(s))if(r){let o=n.get(s),l=0;for(;(l=o.indexOf(r))!==-1;)o.splice(l,1)}else n.delete(s)}}};Qs.EventEmitter=Cc});var qc=u(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.Listener=br.EventEmitter=void 0;var V0=Oy();Object.defineProperty(br,"EventEmitter",{enumerable:!0,get:function(){return V0.EventEmitter}});var W0=Hc();Object.defineProperty(br,"Listener",{enumerable:!0,get:function(){return W0.Listener}})});var Gs=u(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.accessTokenIsExpired=xr.getExpiryDateOfAccessToken=void 0;var Ec=S(),$0=6e4;function Uy(i){return(0,Ec.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-$0)}a(Uy,"getExpiryMillis");function z0(i){return(0,Ec.mapNullable)(Uy(i),e=>new Date(e))}a(z0,"getExpiryDateOfAccessToken");xr.getExpiryDateOfAccessToken=z0;function K0(i){var e;return(e=(0,Ec.mapNullable)(Uy(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}a(K0,"accessTokenIsExpired");xr.accessTokenIsExpired=K0});var Ws=u(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.InvalidTokenError=void 0;var J0=m(),Pc=class extends J0.CustomError{static{a(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};Vs.InvalidTokenError=Pc});var zs=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.InvalidTokenTypeError=void 0;var Z0=m(),Ac=class extends Z0.CustomError{static{a(this,"InvalidTokenTypeError")}};$s.InvalidTokenTypeError=Ac});var ky=u(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createRevokeTokenQuery=Ye.createRefreshTokenQuery=Ye.createGetAppTokenQuery=Ye.createExchangeCodeQuery=void 0;function X0(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}a(X0,"createExchangeCodeQuery");Ye.createExchangeCodeQuery=X0;function Y0(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}a(Y0,"createGetAppTokenQuery");Ye.createGetAppTokenQuery=Y0;function eH(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}a(eH,"createRefreshTokenQuery");Ye.createRefreshTokenQuery=eH;function tH(i,e){return{client_id:i,token:e}}a(tH,"createRevokeTokenQuery");Ye.createRevokeTokenQuery=tH});var Tc=u(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.TokenInfo=void 0;var rH=(g(),b(f)),iH=S(),Qt=m(),Dc=class extends Qt.DataObject{static{a(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[Qt.rawDataSymbol].client_id}get userId(){var e;return(e=this[Qt.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[Qt.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[Qt.rawDataSymbol].scopes}get expiryDate(){return(0,iH.mapNullable)(this[Qt.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};si.TokenInfo=Dc;si.TokenInfo=Dc=rH.__decorate([(0,Qt.rtfm)("auth","TokenInfo","clientId")],Dc)});var li=u($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.loadAndCompareTokenInfo=$.compareScopeSets=$.compareScopes=$.getValidTokenFromProviderForIntent=$.getValidTokenFromProviderForUser=$.getTokenInfo=$.revokeToken=$.refreshUserToken=$.getAppToken=$.exchangeCode=void 0;var wr=W(),oi=Ws(),nH=zs(),Ks=ky(),aH=Tc();function Ic(i){var e,t;return{accessToken:i.access_token,refreshToken:i.refresh_token||null,scope:(e=i.scope)!==null&&e!==void 0?e:[],expiresIn:(t=i.expires_in)!==null&&t!==void 0?t:null,obtainmentTimestamp:Date.now()}}a(Ic,"createAccessTokenFromData");async function sH(i,e,t,r){return Ic(await(0,wr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ks.createExchangeCodeQuery)(i,e,t,r)}))}a(sH,"exchangeCode");$.exchangeCode=sH;async function oH(i,e){return Ic(await(0,wr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ks.createGetAppTokenQuery)(i,e)}))}a(oH,"getAppToken");$.getAppToken=oH;async function lH(i,e,t){return Ic(await(0,wr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ks.createRefreshTokenQuery)(i,e,t)}))}a(lH,"refreshUserToken");$.refreshUserToken=lH;async function uH(i,e){await(0,wr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,Ks.createRevokeTokenQuery)(i,e)})}a(uH,"revokeToken");$.revokeToken=uH;async function vr(i,e){try{let t=await(0,wr.callTwitchApi)({type:"auth",url:"validate"},e,i);return new aH.TokenInfo(t)}catch(t){throw t instanceof wr.HttpStatusCodeError&&t.statusCode===401?new oi.InvalidTokenError({cause:t}):t}}a(vr,"getTokenInfo");$.getTokenInfo=vr;async function cH(i,e,t,r){let n=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await vr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof oi.InvalidTokenError?n=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForUser))try{let o=await i.refreshAccessTokenForUser(e),l=await vr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof oi.InvalidTokenError?n=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw n??new Error("Could not retrieve a valid token")}a(cH,"getValidTokenFromProviderForUser");$.getValidTokenFromProviderForUser=cH;async function dH(i,e,t,r){let n=null,s=!1;if(!i.getAccessTokenForIntent)throw new nH.InvalidTokenTypeError("This call requires an AuthProvider that supports intents.\nPlease use an auth provider that does, such as `RefreshingAuthProvider`.");try{let o=await i.getAccessTokenForIntent(e,t);if(o){s=!0;let l=await vr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof oi.InvalidTokenError?n=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForIntent))try{let o=await i.refreshAccessTokenForIntent(e),l=await vr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof oi.InvalidTokenError?n=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw n??new Error("Could not retrieve a valid token")}a(dH,"getValidTokenFromProviderForIntent");$.getValidTokenFromProviderForIntent=dH;var hH=new Map([["channel_commercial",["channel:edit:commercial"]],["channel_editor",["channel:manage:broadcast"]],["channel_read",["channel:read:stream_key"]],["channel_subscriptions",["channel:read:subscriptions"]],["user_blocks_read",["user:read:blocked_users"]],["user_blocks_edit",["user:manage:blocked_users"]],["user_follows_edit",["user:edit:follows"]],["user_read",["user:read:email"]],["user_subscriptions",["user:read:subscriptions"]],["user:edit:broadcast",["channel:manage:broadcast","channel:manage:extensions"]]]);function jy(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var n;return[r,...(n=hH.get(r))!==null&&n!==void 0?n:[]]}));if(e.every(r=>!t.has(r))){let r=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${r}) and can not be upgraded.
|
|
14
12
|
If you need dynamically upgrading scopes, please implement the AuthProvider interface accordingly:
|
|
15
13
|
|
|
16
|
-
https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}
|
|
14
|
+
https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}a(jy,"compareScopes");$.compareScopes=jy;function My(i,e){for(let t of e)jy(i,t)}a(My,"compareScopeSets");$.compareScopeSets=My;async function pH(i,e,t,r,n){if(n?.length||!t){let s=await vr(e,i);if(!s.userId)throw new Error("Trying to use an app access token as a user access token");let o=r??s.scopes;return n&&My(o,n.filter(l=>!!l)),[o,s.userId]}return[r,t]}a(pH,"loadAndCompareTokenInfo");$.loadAndCompareTokenInfo=pH});var Zs=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.TokenFetcher=void 0;var Ly=S(),Rc=class{static{a(this,"TokenFetcher")}constructor(e){this._newTokenScopeSets=[],this._newTokenPromise=null,this._queuedScopeSets=[],this._queueExecutor=null,this._queuePromise=null,this._executor=e}async fetch(...e){var t;let r=e.filter(l=>!!l);if(this._newTokenPromise){if(!r.length)return await this._newTokenPromise;if(this._queueExecutor?this._queuedScopeSets.push(...r):this._queuedScopeSets=[...r],!this._queuePromise){let{promise:l,resolve:d,reject:p}=(0,Ly.promiseWithResolvers)();this._queuePromise=l,this._queueExecutor=async()=>{var h;if(this._queuePromise){this._newTokenScopeSets=this._queuedScopeSets,this._queuedScopeSets=[],this._newTokenPromise=this._queuePromise,this._queuePromise=null,this._queueExecutor=null;try{d(await this._executor(this._newTokenScopeSets))}catch(_){p(_)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(h=this._queueExecutor)===null||h===void 0||h.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...r];let{promise:n,resolve:s,reject:o}=(0,Ly.promiseWithResolvers)();this._newTokenPromise=n;try{s(await this._executor(this._newTokenScopeSets))}catch(l){o(l)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(t=this._queueExecutor)===null||t===void 0||t.call(this)}return await n}};Js.TokenFetcher=Rc});var Fy=u(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.AppTokenAuthProvider=void 0;var Xs=(g(),b(f)),Bc=S(),_H=m(),mH=Gs(),yH=li(),fH=Zs(),Sr=class{static{a(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new fH.TokenFetcher(async n=>await this._fetch(n))}get clientId(){return this._clientId}get currentScopes(){return this._impliedScopes}async getAccessTokenForUser(){throw new Error("Can not get user access token for AppTokenAuthProvider")}getCurrentScopesForUser(){throw new Error("Can not get user scopes for AppTokenAuthProvider")}async getAnyAccessToken(){return await this._fetcher.fetch()}async getAppAccessToken(e=!1){return e&&(this._token=void 0),await this._fetcher.fetch()}async _fetch(e){if(e.length>0)for(let t of e)if(this._impliedScopes.length){if(t.every(r=>!this._impliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._impliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._token||(0,mH.accessTokenIsExpired)(this._token)?this._token=await(0,yH.getAppToken)(this._clientId,this._clientSecret):this._token}};ui.AppTokenAuthProvider=Sr;Xs.__decorate([(0,Bc.Enumerable)(!1)],Sr.prototype,"_clientSecret",void 0);Xs.__decorate([(0,Bc.Enumerable)(!1)],Sr.prototype,"_token",void 0);Xs.__decorate([(0,Bc.Enumerable)(!1)],Sr.prototype,"_fetcher",void 0);ui.AppTokenAuthProvider=Sr=Xs.__decorate([(0,_H.rtfm)("auth","AppTokenAuthProvider","clientId")],Sr)});var Uc=u(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.CachedRefreshFailureError=void 0;var gH=m(),Oc=class extends gH.CustomError{static{a(this,"CachedRefreshFailureError")}constructor(e){super(`The user context for the user ${e} has been disabled.
|
|
17
15
|
This happened because the access token became invalid (e.g. by expiry) and refreshing it failed (e.g. because the account's password was changed).
|
|
18
16
|
|
|
19
|
-
Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}};
|
|
17
|
+
Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}};Ys.CachedRefreshFailureError=Oc});var jc=u(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.IntermediateUserRemovalError=void 0;var bH=m(),kc=class extends bH.CustomError{static{a(this,"IntermediateUserRemovalError")}constructor(e){super(`User ${e} was removed while trying to fetch a token.
|
|
20
18
|
|
|
21
|
-
Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}};Ao.IntermediateUserRemovalError=yh});var bh=l(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.UnknownIntentError=void 0;var KU=m(),gh=class extends KU.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};To.UnknownIntentError=gh});var M0=l(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.RefreshingAuthProvider=void 0;var Jr=(_(),g(y)),tn=S(),JU=ah(),je=m(),vh=_o(),L0=mh(),ZU=_h(),wh=bo(),XU=wo(),YU=bh(),mt=en(),F0=Po(),Bt=class extends JU.EventEmitter{static{n(this,"RefreshingAuthProvider")}constructor(e){var t;super(),this._userAccessTokens=new Map,this._userTokenFetchers=new Map,this._intentToUserId=new Map,this._userIdToIntents=new Map,this._cachedRefreshFailures=new Set,this.onRefresh=this.registerEvent(),this.onRefreshFailure=this.registerEvent(),this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._redirectUri=e.redirectUri,this._appImpliedScopes=(t=e.appImpliedScopes)!==null&&t!==void 0?t:[],this._appTokenFetcher=new F0.TokenFetcher(async i=>await this._fetchAppToken(i))}addUser(e,t,i){let a=(0,je.extractUserId)(e);if(!t.refreshToken)throw new Error(`Trying to add user ${a} without refresh token`);this._cachedRefreshFailures.delete(a),this._userAccessTokens.set(a,{...t,userId:a}),this._userTokenFetchers.has(a)||this._userTokenFetchers.set(a,new F0.TokenFetcher(async o=>await this._fetchUserToken(a,o))),i&&this.addIntentsToUser(e,i)}async addUserForToken(e,t){let i=null;if(e.accessToken&&!(0,vh.accessTokenIsExpired)(e))try{let u=await(0,mt.getTokenInfo)(e.accessToken);i=[e,u]}catch(u){if(!(u instanceof wh.InvalidTokenError))throw u}if(!i){if(!e.refreshToken)throw new wh.InvalidTokenError;let u=await(0,mt.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),c=await(0,mt.getTokenInfo)(u.accessToken);this.emit(this.onRefresh,c.userId,u),i=[u,c]}let[a,o]=i;if(!o.userId)throw new XU.InvalidTokenTypeError("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");let s=a.scope?a:{...a,scope:o.scopes};return this.addUser(o.userId,s,t),o.userId}async addUserForCode(e,t){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");let i=await(0,mt.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(i,t)}hasUser(e){return this._userTokenFetchers.has((0,je.extractUserId)(e))}removeUser(e){let t=(0,je.extractUserId)(e);if(this._userIdToIntents.has(t)){let i=this._userIdToIntents.get(t);for(let a of i)this._intentToUserId.delete(a);this._userIdToIntents.delete(t)}this._userAccessTokens.delete(t),this._userTokenFetchers.delete(t),this._cachedRefreshFailures.delete(t)}addIntentsToUser(e,t){let i=(0,je.extractUserId)(e);if(!this._userAccessTokens.has(i))throw new Error("Trying to add intents to a user that was not added to this provider");for(let a of t)this._intentToUserId.has(a)&&this._userIdToIntents.get(this._intentToUserId.get(a)).delete(a),this._intentToUserId.set(a,i),this._userIdToIntents.has(i)?this._userIdToIntents.get(i).add(a):this._userIdToIntents.set(i,new Set([a]))}getIntentsForUser(e){let t=(0,je.extractUserId)(e);return this._userIdToIntents.has(t)?Array.from(this._userIdToIntents.get(t)):[]}removeIntents(e){var t;for(let i of e)if(this._intentToUserId.has(i)){let a=this._intentToUserId.get(i);(t=this._userIdToIntents.get(a))===null||t===void 0||t.delete(i),this._intentToUserId.delete(i)}}async refreshAccessTokenForUser(e){let t=(0,je.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new L0.CachedRefreshFailureError(t);let i=this._userAccessTokens.get(t);if(!i)throw new Error("Trying to refresh token for user that was not added to the provider");let a=await this._refreshUserTokenWithCallback(t,i.refreshToken);return this._checkIntermediateUserRemoval(t),this._userAccessTokens.set(t,{...a,userId:t}),this.emit(this.onRefresh,t,a),{...a,userId:t}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new YU.UnknownIntentError(e);let t=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(t)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var t;let i=this._userAccessTokens.get((0,je.extractUserId)(e));if(!i)throw new Error("Trying to get scopes for user that was not added to the provider");return(t=i.scope)!==null&&t!==void 0?t:[]}async getAccessTokenForUser(e,...t){let i=(0,je.extractUserId)(e),a=this._userTokenFetchers.get(i);if(!a)return null;if(this._cachedRefreshFailures.has(i))throw new L0.CachedRefreshFailureError(i);return await a.fetch(...t)}async getAccessTokenForIntent(e,...t){if(!this._intentToUserId.has(e))return null;let i=this._intentToUserId.get(e),a=await this.getAccessTokenForUser(i,...t);if(!a)throw new je.HellFreezesOverError(`Found intent ${e} corresponding to user ID ${i} but no token was found`);return{...a,userId:i}}async getAnyAccessToken(e){if(e){let t=(0,je.extractUserId)(e);if(this._userAccessTokens.has(t)){let i=await this.getAccessTokenForUser(t);if(!i)throw new je.HellFreezesOverError(`Token for user ID ${t} exists but nothing was returned by getAccessTokenForUser`);return{...i,userId:t}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(t=>[t]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new ZU.IntermediateUserRemovalError(e)}async _fetchUserToken(e,t){let i=this._userAccessTokens.get(e);if(!i)throw new Error("Trying to get token for user that was not added to the provider");if(i.accessToken&&!(0,vh.accessTokenIsExpired)(i))try{if(i.scope)return(0,mt.compareScopeSets)(i.scope,t),i;let[o=[]]=await(0,mt.loadAndCompareTokenInfo)(this._clientId,i.accessToken,e,i.scope,t),s={...i,scope:o};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,s),s}catch(o){if(!(o instanceof wh.InvalidTokenError))throw o}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,mt.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,mt.refreshUserToken)(this.clientId,this._clientSecret,t)}catch(i){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e),i}}async _fetchAppToken(e){if(e.length>0)for(let t of e)if(this._appImpliedScopes.length){if(t.every(i=>!this._appImpliedScopes.includes(i)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||(0,vh.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,mt.getAppToken)(this._clientId,this._clientSecret)}};Jr.__decorate([(0,tn.Enumerable)(!1)],Bt.prototype,"_clientSecret",void 0);Jr.__decorate([(0,tn.Enumerable)(!1)],Bt.prototype,"_userAccessTokens",void 0);Jr.__decorate([(0,tn.Enumerable)(!1)],Bt.prototype,"_userTokenFetchers",void 0);Jr.__decorate([(0,tn.Enumerable)(!1)],Bt.prototype,"_appAccessToken",void 0);Jr.__decorate([(0,tn.Enumerable)(!1)],Bt.prototype,"_appTokenFetcher",void 0);Bt=Jr.__decorate([(0,je.rtfm)("auth","RefreshingAuthProvider","clientId")],Bt);Io.RefreshingAuthProvider=Bt});var G0=l(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.StaticAuthProvider=void 0;var xh=(_(),g(y)),N0=S(),ej=m(),tj=en(),rn=class{static{n(this,"StaticAuthProvider")}constructor(e,t,i){this._clientId=e||"",this._accessToken=typeof t=="string"?{accessToken:t,refreshToken:null,scope:i??[],expiresIn:null,obtainmentTimestamp:Date.now()}:t,this._scopes=i}get clientId(){return this._clientId}async getAccessTokenForUser(e,...t){return await this._getAccessToken(t)}async getAccessTokenForIntent(e,...t){return await this._getAccessToken(t)}async getAnyAccessToken(){return await this._getAccessToken()}getCurrentScopesForUser(){var e;return(e=this._scopes)!==null&&e!==void 0?e:[]}async _getAccessToken(e){let[t,i]=await(0,tj.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=i,{...this._accessToken,userId:i}}};xh.__decorate([(0,N0.Enumerable)(!1)],rn.prototype,"_clientId",void 0);xh.__decorate([(0,N0.Enumerable)(!1)],rn.prototype,"_accessToken",void 0);rn=xh.__decorate([(0,ej.rtfm)("auth","StaticAuthProvider","clientId")],rn);Ro.StaticAuthProvider=rn});var Sh=l(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.UnknownIntentError=A.InvalidTokenTypeError=A.InvalidTokenError=A.IntermediateUserRemovalError=A.CachedRefreshFailureError=A.StaticAuthProvider=A.RefreshingAuthProvider=A.AppTokenAuthProvider=A.TokenInfo=A.TokenFetcher=A.revokeToken=A.refreshUserToken=A.getValidTokenFromProviderForIntent=A.getValidTokenFromProviderForUser=A.getTokenInfo=A.getAppToken=A.exchangeCode=A.getExpiryDateOfAccessToken=A.accessTokenIsExpired=void 0;var Q0=_o();Object.defineProperty(A,"accessTokenIsExpired",{enumerable:!0,get:function(){return Q0.accessTokenIsExpired}});Object.defineProperty(A,"getExpiryDateOfAccessToken",{enumerable:!0,get:function(){return Q0.getExpiryDateOfAccessToken}});var nr=en();Object.defineProperty(A,"exchangeCode",{enumerable:!0,get:function(){return nr.exchangeCode}});Object.defineProperty(A,"getAppToken",{enumerable:!0,get:function(){return nr.getAppToken}});Object.defineProperty(A,"getTokenInfo",{enumerable:!0,get:function(){return nr.getTokenInfo}});Object.defineProperty(A,"getValidTokenFromProviderForUser",{enumerable:!0,get:function(){return nr.getValidTokenFromProviderForUser}});Object.defineProperty(A,"getValidTokenFromProviderForIntent",{enumerable:!0,get:function(){return nr.getValidTokenFromProviderForIntent}});Object.defineProperty(A,"refreshUserToken",{enumerable:!0,get:function(){return nr.refreshUserToken}});Object.defineProperty(A,"revokeToken",{enumerable:!0,get:function(){return nr.revokeToken}});var rj=Po();Object.defineProperty(A,"TokenFetcher",{enumerable:!0,get:function(){return rj.TokenFetcher}});var ij=ch();Object.defineProperty(A,"TokenInfo",{enumerable:!0,get:function(){return ij.TokenInfo}});var nj=k0();Object.defineProperty(A,"AppTokenAuthProvider",{enumerable:!0,get:function(){return nj.AppTokenAuthProvider}});var aj=M0();Object.defineProperty(A,"RefreshingAuthProvider",{enumerable:!0,get:function(){return aj.RefreshingAuthProvider}});var oj=G0();Object.defineProperty(A,"StaticAuthProvider",{enumerable:!0,get:function(){return oj.StaticAuthProvider}});var sj=mh();Object.defineProperty(A,"CachedRefreshFailureError",{enumerable:!0,get:function(){return sj.CachedRefreshFailureError}});var uj=_h();Object.defineProperty(A,"IntermediateUserRemovalError",{enumerable:!0,get:function(){return uj.IntermediateUserRemovalError}});var lj=bo();Object.defineProperty(A,"InvalidTokenError",{enumerable:!0,get:function(){return lj.InvalidTokenError}});var cj=wo();Object.defineProperty(A,"InvalidTokenTypeError",{enumerable:!0,get:function(){return cj.InvalidTokenTypeError}});var dj=bh();Object.defineProperty(A,"UnknownIntentError",{enumerable:!0,get:function(){return dj.UnknownIntentError}})});var W0=l((g4,$0)=>{function ke(r,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(r)),this._timeouts=r,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}n(ke,"RetryOperation");$0.exports=ke;ke.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};ke.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};ke.prototype.retry=function(r){if(this._timeout&&clearTimeout(this._timeout),!r)return!1;var e=new Date().getTime();if(r&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(r),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(r);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},t),this._options.unref&&this._timer.unref(),!0};ke.prototype.attempt=function(r,e){this._fn=r,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};ke.prototype.try=function(r){console.log("Using RetryOperation.try() is deprecated"),this.attempt(r)};ke.prototype.start=function(r){console.log("Using RetryOperation.start() is deprecated"),this.attempt(r)};ke.prototype.start=ke.prototype.try;ke.prototype.errors=function(){return this._errors};ke.prototype.attempts=function(){return this._attempts};ke.prototype.mainError=function(){if(this._errors.length===0)return null;for(var r={},e=null,t=0,i=0;i<this._errors.length;i++){var a=this._errors[i],o=a.message,s=(r[o]||0)+1;r[o]=s,s>=t&&(e=a,t=s)}return e}});var V0=l(ar=>{var pj=W0();ar.operation=function(r){var e=ar.timeouts(r);return new pj(e,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};ar.timeouts=function(r){if(r instanceof Array)return[].concat(r);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in r)e[t]=r[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],a=0;a<e.retries;a++)i.push(this.createTimeout(a,e));return r&&r.forever&&!i.length&&i.push(this.createTimeout(a,e)),i.sort(function(o,s){return o-s}),i};ar.createTimeout=function(r,e){var t=e.randomize?Math.random()+1:1,i=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,r));return i=Math.min(i,e.maxTimeout),i};ar.wrap=function(r,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var i in r)typeof r[i]=="function"&&t.push(i)}for(var a=0;a<t.length;a++){var o=t[a],s=r[o];r[o]=n(function(c){var p=ar.operation(e),h=Array.prototype.slice.call(arguments,1),f=h.pop();h.push(function(b){p.retry(b)||(b&&(arguments[0]=p.mainError()),f.apply(this,arguments))}),p.attempt(function(){c.apply(r,h)})},"retryWrapper").bind(r,s),r[o].options=e}}});var K0=l((x4,z0)=>{z0.exports=V0()});var J0=l(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.createBitsLeaderboardQuery=void 0;function hj(r={}){let{count:e=10,period:t="all",startDate:i,contextUserId:a}=r;return{count:e.toString(),period:t,started_at:i?.toISOString(),user_id:a}}n(hj,"createBitsLeaderboardQuery");Do.createBitsLeaderboardQuery=hj});var L=l(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BaseApi=void 0;var fj=(_(),g(y)),mj=S(),Oo=class{static{n(this,"BaseApi")}constructor(e){this._client=e}_getUserContextIdWithDefault(e){var t;return(t=this._client._getUserIdFromRequestContext(e))!==null&&t!==void 0?t:e}};fj.__decorate([(0,mj.Enumerable)(!1)],Oo.prototype,"_client",void 0);Bo.BaseApi=Oo});var qh=l(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.HelixBitsLeaderboardEntry=void 0;var Z0=(_(),g(y)),yj=S(),yt=m(),Uo=class extends yt.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[yt.rawDataSymbol].user_id}get userName(){return this[yt.rawDataSymbol].user_login}get userDisplayName(){return this[yt.rawDataSymbol].user_name}get rank(){return this[yt.rawDataSymbol].rank}get amount(){return this[yt.rawDataSymbol].score}async getUser(){return(0,yt.checkRelationAssertion)(await this._client.users.getUserById(this[yt.rawDataSymbol].user_id))}};Z0.__decorate([(0,yj.Enumerable)(!1)],Uo.prototype,"_client",void 0);Uo=Z0.__decorate([(0,yt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Uo);jo.HelixBitsLeaderboardEntry=Uo});var Ch=l(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.HelixBitsLeaderboard=void 0;var Ph=(_(),g(y)),X0=Xi(),_j=S(),ko=m(),gj=qh(),nn=class extends ko.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[ko.rawDataSymbol].data.map(e=>new gj.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[ko.rawDataSymbol].total}};Ph.__decorate([(0,_j.Enumerable)(!1)],nn.prototype,"_client",void 0);Ph.__decorate([(0,X0.CachedGetter)()],nn.prototype,"entries",null);nn=Ph.__decorate([X0.Cacheable,(0,ko.rtfm)("api","HelixBitsLeaderboard")],nn);Lo.HelixBitsLeaderboard=nn});var Eh=l(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.HelixCheermoteList=void 0;var bj=(_(),g(y)),vj=S(),an=m(),Hh=class extends an.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,vj.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,i){e=e.toLowerCase();let{background:a,state:o,scale:s}=i,{tiers:u}=this[an.rawDataSymbol][e],c=u.sort((p,h)=>h.min_bits-p.min_bits).find(p=>p.min_bits<=t);if(!c)throw new an.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:c.images[a][o][s],color:c.color}}getPossibleNames(){return Object.keys(this[an.rawDataSymbol])}};Hh=bj.__decorate([(0,an.rtfm)("api","HelixCheermoteList")],Hh);Fo.HelixCheermoteList=Hh});var Ih=l(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.HelixBitsApi=void 0;var wj=(_(),g(y)),Y0=S(),xj=G(),Ah=m(),Sj=J0(),qj=L(),Pj=Ch(),Cj=Eh(),Th=class extends qj.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let i=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Ah.extractUserId)(e),scopes:["bits:read"],query:(0,Sj.createBitsLeaderboardQuery)(t)});return new Pj.HelixBitsLeaderboard(i,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,Y0.mapOptional)(e,Ah.extractUserId),query:(0,Y0.mapOptional)(e,xj.createBroadcasterQuery)});return new Cj.HelixCheermoteList(t.data)}};Th=wj.__decorate([(0,Ah.rtfm)("api","HelixBitsApi")],Th);Mo.HelixBitsApi=Th});var tq=l(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.createFollowedChannelQuery=Le.createChannelFollowerQuery=Le.createChannelVipUpdateQuery=Le.createChannelCommercialBody=Le.createChannelUpdateBody=void 0;var eq=S(),or=m();function Hj(r){var e;return{game_id:r.gameId,broadcaster_language:r.language,title:r.title,delay:(e=r.delay)===null||e===void 0?void 0:e.toString(),tags:r.tags,content_classification_labels:r.contentClassificationLabels,is_branded_content:r.isBrandedContent}}n(Hj,"createChannelUpdateBody");Le.createChannelUpdateBody=Hj;function Ej(r,e){return{broadcaster_id:(0,or.extractUserId)(r),length:e}}n(Ej,"createChannelCommercialBody");Le.createChannelCommercialBody=Ej;function Aj(r,e){return{broadcaster_id:(0,or.extractUserId)(r),user_id:(0,or.extractUserId)(e)}}n(Aj,"createChannelVipUpdateQuery");Le.createChannelVipUpdateQuery=Aj;function Tj(r,e){return{broadcaster_id:(0,or.extractUserId)(r),user_id:(0,eq.mapOptional)(e,or.extractUserId)}}n(Tj,"createChannelFollowerQuery");Le.createChannelFollowerQuery=Tj;function Ij(r,e){return{broadcaster_id:(0,eq.mapOptional)(e,or.extractUserId),user_id:(0,or.extractUserId)(r)}}n(Ij,"createFollowedChannelQuery");Le.createFollowedChannelQuery=Ij});var Ee=l(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createChannelUsersCheckQuery=Fe.createGetByIdsQuery=Fe.createModeratorActionQuery=Fe.createUserQuery=Fe.createSingleKeyQuery=void 0;var No=m();function Rj(r,e){return{[r]:e}}n(Rj,"createSingleKeyQuery");Fe.createSingleKeyQuery=Rj;function Dj(r){return{user_id:(0,No.extractUserId)(r)}}n(Dj,"createUserQuery");Fe.createUserQuery=Dj;function Oj(r,e){return{broadcaster_id:r,moderator_id:e}}n(Oj,"createModeratorActionQuery");Fe.createModeratorActionQuery=Oj;function Bj(r,e){return{broadcaster_id:(0,No.extractUserId)(r),id:e}}n(Bj,"createGetByIdsQuery");Fe.createGetByIdsQuery=Bj;function Uj(r,e){return{broadcaster_id:(0,No.extractUserId)(r),user_id:e.map(No.extractUserId)}}n(Uj,"createChannelUsersCheckQuery");Fe.createChannelUsersCheckQuery=Uj});var $o=l(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.HelixUserRelation=void 0;var rq=(_(),g(y)),jj=S(),sr=m(),Go=class extends sr.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[sr.rawDataSymbol].user_id}get name(){return this[sr.rawDataSymbol].user_login}get displayName(){return this[sr.rawDataSymbol].user_name}async getUser(){return(0,sr.checkRelationAssertion)(await this._client.users.getUserById(this[sr.rawDataSymbol].user_id))}};rq.__decorate([(0,jj.Enumerable)(!1)],Go.prototype,"_client",void 0);Go=rq.__decorate([(0,sr.rtfm)("api","HelixUserRelation","id")],Go);Qo.HelixUserRelation=Go});var Ut=l(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.HelixRequestBatcher=void 0;var kj=(_(),g(y)),Rh=S(),Wo=class{static{n(this,"HelixRequestBatcher")}constructor(e,t,i,a,o,s=100){this._callOptions=e,this._queryParamName=t,this._matchKey=i,this._mapper=o,this._limitPerRequest=s,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=a,this._delay=a._batchDelay}async request(e){let{promise:t,resolve:i,reject:a}=(0,Rh.promiseWithResolvers)();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:i,reject:a}):this._requestResolversById.set(e,[{resolve:i,reject:a}]),this._waitTimer&&(clearTimeout(this._waitTimer),this._waitTimer=null),this._requestedIds.length>=this._limitPerRequest?this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest)):this._waitTimer=setTimeout(()=>{this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest))},this._delay),await t}async _handleBatch(e){var t;try{let{data:i}=await this._doRequest(e),a=(0,Rh.indexBy)(i,this._matchKey);for(let o of e){for(let s of(t=this._requestResolversById.get(o))!==null&&t!==void 0?t:[])Object.prototype.hasOwnProperty.call(a,o)?s.resolve(this._mapper(a[o])):s.resolve(null);this._requestResolversById.delete(o)}}catch{await Promise.all(e.map(async a=>{var o,s;try{let u=await this._doRequest([a]);for(let c of(o=this._requestResolversById.get(a))!==null&&o!==void 0?o:[])c.resolve(u.data.length?this._mapper(u.data[0]):null)}catch(u){for(let c of(s=this._requestResolversById.get(a))!==null&&s!==void 0?s:[])c.reject(u)}this._requestResolversById.delete(a)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}};kj.__decorate([(0,Rh.Enumerable)(!1)],Wo.prototype,"_client",void 0);Vo.HelixRequestBatcher=Wo});var ae=l(Ko=>{"use strict";var Dh;Object.defineProperty(Ko,"__esModule",{value:!0});Ko.HelixPaginatedRequest=void 0;var iq=(_(),g(y)),Lj=S(),Fj=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Dh=Symbol.asyncIterator)!==null&&Dh!==void 0?Dh:Symbol.for("Symbol.asyncIterator"));var zo=class{static{n(this,"HelixPaginatedRequest")}constructor(e,t,i,a=100){this._callOptions=e,this._mapper=i,this._limitPerPage=a,this._isFinished=!1,this._client=t}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];let t=await this._fetchData();return!((e=t.data)===null||e===void 0)&&e.length?this._processResult(t):(this._isFinished=!0,[])}async getAll(){this.reset();let e=[];do{let t=await this.getNext();if(!t.length)break;e.push(...t)}while(this._currentCursor);return this.reset(),e}get currentCursor(){return this._currentCursor}reset(){this._currentCursor=void 0,this._isFinished=!1,this._currentData=void 0}async*[Symbol.asyncIterator](){for(this.reset();;){let e=await this.getNext();if(!e.length)break;yield*e[Symbol.iterator]()}}async _fetchData(e={}){return await this._client.callApi({type:"helix",...this._callOptions,...e,query:{...this._callOptions.query,after:this._currentCursor,first:this._limitPerPage.toString(),...e.query}})}_processResult(e){var t;return this._currentCursor=typeof e.pagination=="string"?e.pagination:(t=e.pagination)===null||t===void 0?void 0:t.cursor,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((i,a)=>{let o=this._mapper(a);return Array.isArray(o)?[...i,...o]:[...i,o]},[])}};iq.__decorate([(0,Lj.Enumerable)(!1)],zo.prototype,"_client",void 0);zo=iq.__decorate([(0,Fj.rtfm)("api","HelixPaginatedRequest")],zo);Ko.HelixPaginatedRequest=zo});var Zr=l(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.HelixPaginatedRequestWithTotal=void 0;var Mj=(_(),g(y)),Nj=m(),Gj=ae(),Oh=class extends Gj.HelixPaginatedRequest{static{n(this,"HelixPaginatedRequestWithTotal")}async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};Oh=Mj.__decorate([(0,Nj.rtfm)("api","HelixPaginatedRequestWithTotal")],Oh);Jo.HelixPaginatedRequestWithTotal=Oh});var ee=l(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.createPaginatedResultWithTotal=Xr.createPaginatedResult=void 0;function Qj(r,e,t){var i;let a;return{get data(){var o,s;return a??(a=(s=(o=r.data)===null||o===void 0?void 0:o.map(u=>new e(u,t)))!==null&&s!==void 0?s:[])},cursor:typeof r.pagination=="string"?r.pagination:(i=r.pagination)===null||i===void 0?void 0:i.cursor}}n(Qj,"createPaginatedResult");Xr.createPaginatedResult=Qj;function $j(r,e,t){let i;return{get data(){var a,o;return i??(i=(o=(a=r.data)===null||a===void 0?void 0:a.map(s=>new e(s,t)))!==null&&o!==void 0?o:[])},cursor:r.pagination.cursor,total:r.total}}n($j,"createPaginatedResultWithTotal");Xr.createPaginatedResultWithTotal=$j});var Z=l(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.createPaginationQuery=void 0;function Wj({after:r,before:e,limit:t}={}){return{after:r,before:e,first:t?.toString()}}n(Wj,"createPaginationQuery");Zo.createPaginationQuery=Wj});var Bh=l(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.HelixChannel=void 0;var nq=(_(),g(y)),Vj=S(),oe=m(),Xo=class extends oe.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[oe.rawDataSymbol].broadcaster_id}get name(){return this[oe.rawDataSymbol].broadcaster_login}get displayName(){return this[oe.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,oe.checkRelationAssertion)(await this._client.users.getUserById(this[oe.rawDataSymbol].broadcaster_id))}get language(){return this[oe.rawDataSymbol].broadcaster_language}get gameId(){return this[oe.rawDataSymbol].game_id}get gameName(){return this[oe.rawDataSymbol].game_name}async getGame(){return this[oe.rawDataSymbol].game_id?(0,oe.checkRelationAssertion)(await this._client.games.getGameById(this[oe.rawDataSymbol].game_id)):null}get title(){return this[oe.rawDataSymbol].title}get delay(){return this[oe.rawDataSymbol].delay}get tags(){return this[oe.rawDataSymbol].tags}get contentClassificationLabels(){return this[oe.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[oe.rawDataSymbol].is_branded_content}};nq.__decorate([(0,Vj.Enumerable)(!1)],Xo.prototype,"_client",void 0);Xo=nq.__decorate([(0,oe.rtfm)("api","HelixChannel","id")],Xo);Yo.HelixChannel=Xo});var Uh=l(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.HelixChannelEditor=void 0;var aq=(_(),g(y)),zj=S(),ur=m(),es=class extends ur.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[ur.rawDataSymbol].user_id}get userDisplayName(){return this[ur.rawDataSymbol].user_name}async getUser(){return(0,ur.checkRelationAssertion)(await this._client.users.getUserById(this[ur.rawDataSymbol].user_id))}get creationDate(){return new Date(this[ur.rawDataSymbol].created_at)}};aq.__decorate([(0,zj.Enumerable)(!1)],es.prototype,"_client",void 0);es=aq.__decorate([(0,ur.rtfm)("api","HelixChannelEditor","userId")],es);ts.HelixChannelEditor=es});var jh=l(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.HelixChannelFollower=void 0;var oq=(_(),g(y)),Kj=S(),jt=m(),rs=class extends jt.DataObject{static{n(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[jt.rawDataSymbol].user_id}get userName(){return this[jt.rawDataSymbol].user_login}get userDisplayName(){return this[jt.rawDataSymbol].user_name}async getUser(){return(0,jt.checkRelationAssertion)(await this._client.users.getUserById(this[jt.rawDataSymbol].user_id))}get followDate(){return new Date(this[jt.rawDataSymbol].followed_at)}};oq.__decorate([(0,Kj.Enumerable)(!1)],rs.prototype,"_client",void 0);rs=oq.__decorate([(0,jt.rtfm)("api","HelixChannelFollower","userId")],rs);is.HelixChannelFollower=rs});var kh=l(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.HelixFollowedChannel=void 0;var sq=(_(),g(y)),Jj=S(),kt=m(),ns=class extends kt.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[kt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[kt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[kt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,kt.checkRelationAssertion)(await this._client.users.getUserById(this[kt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[kt.rawDataSymbol].followed_at)}};sq.__decorate([(0,Jj.Enumerable)(!1)],ns.prototype,"_client",void 0);ns=sq.__decorate([(0,kt.rtfm)("api","HelixFollowedChannel","broadcasterId")],ns);as.HelixFollowedChannel=ns});var Nh=l(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.HelixChannelApi=void 0;var pq=(_(),g(y)),hq=S(),on=G(),se=m(),_t=tq(),uq=Ee(),Lh=$o(),Zj=Ut(),Xj=ae(),lq=Zr(),Fh=ee(),os=Z(),Yj=L(),Mh=Bh(),ek=Uh(),cq=jh(),dq=kh(),ss=class extends Yj.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new Zj.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Mh.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,se.extractUserId)(e),i=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,on.createBroadcasterQuery)(t)});return(0,hq.mapNullable)(i.data[0],a=>new Mh.HelixChannel(a,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,se.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(se.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,uq.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Mh.HelixChannel(a,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,se.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,on.createBroadcasterQuery)(e),jsonBody:(0,_t.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,se.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,_t.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,se.extractUserId)(e),scopes:["channel:read:editors"],query:(0,on.createBroadcasterQuery)(e)})).data.map(i=>new ek.HelixChannelEditor(i,this._client))}async getVips(e,t){let i=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,se.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,on.createBroadcasterQuery)(e),...(0,os.createPaginationQuery)(t)}});return(0,Fh.createPaginatedResult)(i,Lh.HelixUserRelation,this._client)}getVipsPaginated(e){return new Xj.HelixPaginatedRequest({url:"channels/vips",userId:(0,se.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,on.createBroadcasterQuery)(e)},this._client,t=>new Lh.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,se.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,uq.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Lh.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let i=(0,se.extractUserId)(t);return(await this.checkVipForUsers(e,[i])).some(o=>o.id===i)}async addVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:(0,se.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,_t.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,se.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,_t.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,se.extractUserId)(e),query:{...(0,_t.createChannelFollowerQuery)(e),...(0,os.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,i){let a=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,se.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,_t.createChannelFollowerQuery)(e,t),...(0,os.createPaginationQuery)(i)}});return(0,Fh.createPaginatedResultWithTotal)(a,cq.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new lq.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,se.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,_t.createChannelFollowerQuery)(e)},this._client,t=>new cq.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,i){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,se.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,_t.createFollowedChannelQuery)(e,t),...(0,os.createPaginationQuery)(i)}});return(0,Fh.createPaginatedResultWithTotal)(a,dq.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new lq.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,se.extractUserId)(e),scopes:["user:read:follows"],query:(0,_t.createFollowedChannelQuery)(e,t)},this._client,i=>new dq.HelixFollowedChannel(i,this._client))}};pq.__decorate([(0,hq.Enumerable)(!1)],ss.prototype,"_getChannelByIdBatcher",void 0);ss=pq.__decorate([(0,se.rtfm)("api","HelixChannelApi")],ss);us.HelixChannelApi=ss});var fq=l(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.createRedemptionsForBroadcasterQuery=Me.createRewardRedemptionsByIdsQuery=Me.createCustomRewardBody=Me.createCustomRewardChangeQuery=Me.createCustomRewardsQuery=void 0;var ls=m();function tk(r,e){return{broadcaster_id:(0,ls.extractUserId)(r),only_manageable_rewards:e?.toString()}}n(tk,"createCustomRewardsQuery");Me.createCustomRewardsQuery=tk;function rk(r,e){return{broadcaster_id:(0,ls.extractUserId)(r),id:e}}n(rk,"createCustomRewardChangeQuery");Me.createCustomRewardChangeQuery=rk;function ik(r){var e,t,i;let a={title:r.title,cost:r.cost,prompt:r.prompt,background_color:r.backgroundColor,is_enabled:r.isEnabled,is_user_input_required:r.userInputRequired,should_redemptions_skip_request_queue:r.autoFulfill};return r.maxRedemptionsPerStream!==void 0&&(a.is_max_per_stream_enabled=!!r.maxRedemptionsPerStream,a.max_per_stream=(e=r.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),r.maxRedemptionsPerUserPerStream!==void 0&&(a.is_max_per_user_per_stream_enabled=!!r.maxRedemptionsPerUserPerStream,a.max_per_user_per_stream=(t=r.maxRedemptionsPerUserPerStream)!==null&&t!==void 0?t:0),r.globalCooldown!==void 0&&(a.is_global_cooldown_enabled=!!r.globalCooldown,a.global_cooldown_seconds=(i=r.globalCooldown)!==null&&i!==void 0?i:0),"isPaused"in r&&(a.is_paused=r.isPaused),a}n(ik,"createCustomRewardBody");Me.createCustomRewardBody=ik;function nk(r,e,t){return{broadcaster_id:(0,ls.extractUserId)(r),reward_id:e,id:t}}n(nk,"createRewardRedemptionsByIdsQuery");Me.createRewardRedemptionsByIdsQuery=nk;function ak(r,e,t,i){return{broadcaster_id:(0,ls.extractUserId)(r),reward_id:e,status:t,sort:i.newestFirst?"NEWEST":"OLDEST"}}n(ak,"createRedemptionsForBroadcasterQuery");Me.createRedemptionsForBroadcasterQuery=ak});var Gh=l(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.HelixCustomReward=void 0;var mq=(_(),g(y)),ok=S(),B=m(),cs=class extends B.DataObject{static{n(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[B.rawDataSymbol].id}get broadcasterId(){return this[B.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[B.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[B.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,B.checkRelationAssertion)(await this._client.users.getUserById(this[B.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,i;let a=`url_${e}x`;return(i=(t=this[B.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&i!==void 0?i:this[B.rawDataSymbol].default_image[a]}get backgroundColor(){return this[B.rawDataSymbol].background_color}get isEnabled(){return this[B.rawDataSymbol].is_enabled}get cost(){return this[B.rawDataSymbol].cost}get title(){return this[B.rawDataSymbol].title}get prompt(){return this[B.rawDataSymbol].prompt}get userInputRequired(){return this[B.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[B.rawDataSymbol].max_per_stream_setting.is_enabled?this[B.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[B.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[B.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[B.rawDataSymbol].global_cooldown_setting.is_enabled?this[B.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[B.rawDataSymbol].is_paused}get isInStock(){return this[B.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[B.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[B.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[B.rawDataSymbol].cooldown_expires_at?new Date(this[B.rawDataSymbol].cooldown_expires_at):null}};mq.__decorate([(0,ok.Enumerable)(!1)],cs.prototype,"_client",void 0);cs=mq.__decorate([(0,B.rtfm)("api","HelixCustomReward","id")],cs);ds.HelixCustomReward=cs});var Qh=l(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.HelixCustomRewardRedemption=void 0;var yq=(_(),g(y)),sk=S(),k=m(),ps=class extends k.DataObject{static{n(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[k.rawDataSymbol].id}get broadcasterId(){return this[k.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[k.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[k.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,k.checkRelationAssertion)(await this._client.users.getUserById(this[k.rawDataSymbol].broadcaster_id))}get userId(){return this[k.rawDataSymbol].user_id}get userName(){return this[k.rawDataSymbol].user_login}get userDisplayName(){return this[k.rawDataSymbol].user_name}async getUser(){return(0,k.checkRelationAssertion)(await this._client.users.getUserById(this[k.rawDataSymbol].user_id))}get userInput(){return this[k.rawDataSymbol].user_input}get isFulfilled(){return this[k.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[k.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[k.rawDataSymbol].redeemed_at)}get rewardId(){return this[k.rawDataSymbol].reward.id}get rewardTitle(){return this[k.rawDataSymbol].reward.title}get rewardPrompt(){return this[k.rawDataSymbol].reward.prompt}get rewardCost(){return this[k.rawDataSymbol].reward.cost}async getReward(){return(0,k.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[k.rawDataSymbol].broadcaster_id,this[k.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[k.rawDataSymbol].broadcaster_id,this[k.rawDataSymbol].reward.id,[this[k.rawDataSymbol].id],e))[0]}};yq.__decorate([(0,sk.Enumerable)(!1)],ps.prototype,"_client",void 0);ps=yq.__decorate([(0,k.rtfm)("api","HelixCustomRewardRedemption","id")],ps);hs.HelixCustomRewardRedemption=ps});var Wh=l(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.HelixChannelPointsApi=void 0;var uk=(_(),g(y)),lk=G(),it=m(),gt=fq(),ck=Ee(),dk=ae(),pk=ee(),hk=Z(),fk=L(),fs=Gh(),ms=Qh(),$h=class extends fk.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,it.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,gt.createCustomRewardsQuery)(e,t)})).data.map(a=>new fs.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,it.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,ck.createGetByIdsQuery)(e,t)})).data.map(a=>new fs.HelixCustomReward(a,this._client)):[]}async getCustomRewardById(e,t){let i=await this.getCustomRewardsByIds(e,[t]);return i.length?i[0]:null}async createCustomReward(e,t){let i=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:(0,it.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,lk.createBroadcasterQuery)(e),jsonBody:(0,gt.createCustomRewardBody)(t)});return new fs.HelixCustomReward(i.data[0],this._client)}async updateCustomReward(e,t,i){let a=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:(0,it.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,gt.createCustomRewardChangeQuery)(e,t),jsonBody:(0,gt.createCustomRewardBody)(i)});return new fs.HelixCustomReward(a.data[0],this._client)}async deleteCustomReward(e,t){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:(0,it.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,gt.createCustomRewardChangeQuery)(e,t)})}async getRedemptionsByIds(e,t,i){return i.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,it.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,gt.createRewardRedemptionsByIdsQuery)(e,t,i)})).data.map(o=>new ms.HelixCustomRewardRedemption(o,this._client)):[]}async getRedemptionById(e,t,i){let a=await this.getRedemptionsByIds(e,t,[i]);return a.length?a[0]:null}async getRedemptionsForBroadcaster(e,t,i,a){let o=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,it.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,gt.createRedemptionsForBroadcasterQuery)(e,t,i,a),...(0,hk.createPaginationQuery)(a)}});return(0,pk.createPaginatedResult)(o,ms.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,i,a){return new dk.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,it.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,gt.createRedemptionsForBroadcasterQuery)(e,t,i,a)},this._client,o=>new ms.HelixCustomRewardRedemption(o,this._client),50)}async updateRedemptionStatusByIds(e,t,i,a){return i.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:(0,it.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,gt.createRewardRedemptionsByIdsQuery)(e,t,i),jsonBody:{status:a}})).data.map(s=>new ms.HelixCustomRewardRedemption(s,this._client)):[]}};$h=uk.__decorate([(0,it.rtfm)("api","HelixChannelPointsApi")],$h);ys.HelixChannelPointsApi=$h});var gs=l(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.HelixCharityCampaignAmount=void 0;var mk=(_(),g(y)),sn=m(),Vh=class extends sn.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[sn.rawDataSymbol].value}get decimalPlaces(){return this[sn.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[sn.rawDataSymbol].currency}};Vh=mk.__decorate([(0,sn.rtfm)("api","HelixCharityCampaignAmount")],Vh);_s.HelixCharityCampaignAmount=Vh});var zh=l(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.HelixCharityCampaign=void 0;var gq=(_(),g(y)),yk=S(),ve=m(),_q=gs(),bs=class extends ve.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[ve.rawDataSymbol].id}get broadcasterId(){return this[ve.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ve.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ve.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ve.checkRelationAssertion)(await this._client.users.getUserById(this[ve.rawDataSymbol].broadcaster_id))}get charityName(){return this[ve.rawDataSymbol].charity_name}get charityDescription(){return this[ve.rawDataSymbol].charity_description}get charityLogo(){return this[ve.rawDataSymbol].charity_logo}get charityWebsite(){return this[ve.rawDataSymbol].charity_website}get currentAmount(){return new _q.HelixCharityCampaignAmount(this[ve.rawDataSymbol].current_amount)}get targetAmount(){return new _q.HelixCharityCampaignAmount(this[ve.rawDataSymbol].target_amount)}};gq.__decorate([(0,yk.Enumerable)(!1)],bs.prototype,"_client",void 0);bs=gq.__decorate([(0,ve.rtfm)("api","HelixCharityCampaign","id")],bs);vs.HelixCharityCampaign=bs});var Kh=l(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.HelixCharityCampaignDonation=void 0;var bq=(_(),g(y)),_k=S(),bt=m(),gk=gs(),ws=class extends bt.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[bt.rawDataSymbol].campaign_id}get donorId(){return this[bt.rawDataSymbol].user_id}get donorName(){return this[bt.rawDataSymbol].user_login}get donorDisplayName(){return this[bt.rawDataSymbol].user_name}async getDonor(){return(0,bt.checkRelationAssertion)(await this._client.users.getUserById(this[bt.rawDataSymbol].user_id))}get amount(){return new gk.HelixCharityCampaignAmount(this[bt.rawDataSymbol].amount)}};bq.__decorate([(0,_k.Enumerable)(!1)],ws.prototype,"_client",void 0);ws=bq.__decorate([(0,bt.rtfm)("api","HelixCharityCampaignDonation")],ws);xs.HelixCharityCampaignDonation=ws});var Xh=l(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.HelixCharityApi=void 0;var bk=(_(),g(y)),vq=G(),Jh=m(),vk=ee(),wk=Z(),xk=L(),Sk=zh(),qk=Kh(),Zh=class extends xk.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,Jh.extractUserId)(e),scopes:["channel:read:charity"],query:(0,vq.createBroadcasterQuery)(e)});return new Sk.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let i=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,Jh.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,vq.createBroadcasterQuery)(e),...(0,wk.createPaginationQuery)(t)}});return(0,vk.createPaginatedResult)(i,qk.HelixCharityCampaignDonation,this._client)}};Zh=bk.__decorate([(0,Jh.rtfm)("api","HelixCharityApi")],Zh);Ss.HelixCharityApi=Zh});var wq=l(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.createShoutoutQuery=Lt.createChatColorUpdateQuery=Lt.createChatSettingsUpdateBody=void 0;var Yh=m();function Pk(r){return{slow_mode:r.slowModeEnabled,slow_mode_wait_time:r.slowModeDelay,follower_mode:r.followerOnlyModeEnabled,follower_mode_duration:r.followerOnlyModeDelay,subscriber_mode:r.subscriberOnlyModeEnabled,emote_mode:r.emoteOnlyModeEnabled,unique_chat_mode:r.uniqueChatModeEnabled,non_moderator_chat_delay:r.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:r.nonModeratorChatDelay}}n(Pk,"createChatSettingsUpdateBody");Lt.createChatSettingsUpdateBody=Pk;function Ck(r,e){return{user_id:(0,Yh.extractUserId)(r),color:e}}n(Ck,"createChatColorUpdateQuery");Lt.createChatColorUpdateQuery=Ck;function Hk(r,e,t){return{from_broadcaster_id:(0,Yh.extractUserId)(r),to_broadcaster_id:(0,Yh.extractUserId)(e),moderator_id:t}}n(Hk,"createShoutoutQuery");Lt.createShoutoutQuery=Hk});var un=l(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.HelixEmote=void 0;var Ek=(_(),g(y)),Ae=m(),ef=class extends Ae.DataObject{static{n(this,"HelixEmote")}get id(){return this[Ae.rawDataSymbol].id}get name(){return this[Ae.rawDataSymbol].name}get formats(){return this[Ae.rawDataSymbol].format}get scales(){return this[Ae.rawDataSymbol].scale}get themeModes(){return this[Ae.rawDataSymbol].theme_mode}getImageUrl(e){return this[Ae.rawDataSymbol].images[`url_${e}x`]}getStaticImageUrl(e="1.0",t="light"){return this[Ae.rawDataSymbol].format.includes("static")&&this[Ae.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[Ae.rawDataSymbol].format.includes("animated")&&this[Ae.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"animated",t):null}getFormattedImageUrl(e="1.0",t="static",i="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[Ae.rawDataSymbol].id}/${t}/${i}/${e}`}};ef=Ek.__decorate([(0,Ae.rtfm)("api","HelixEmote","id")],ef);qs.HelixEmote=ef});var tf=l(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.HelixChannelEmote=void 0;var xq=(_(),g(y)),Ak=S(),ln=m(),Tk=un(),Ps=class extends Tk.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[ln.rawDataSymbol].tier||null}get type(){return this[ln.rawDataSymbol].emote_type}get emoteSetId(){return this[ln.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[ln.rawDataSymbol].emote_set_id])}};xq.__decorate([(0,Ak.Enumerable)(!1)],Ps.prototype,"_client",void 0);Ps=xq.__decorate([(0,ln.rtfm)("api","HelixChannelEmote","id")],Ps);Cs.HelixChannelEmote=Ps});var nf=l(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.HelixChatBadgeVersion=void 0;var Ik=(_(),g(y)),Ft=m(),rf=class extends Ft.DataObject{static{n(this,"HelixChatBadgeVersion")}get id(){return this[Ft.rawDataSymbol].id}getImageUrl(e){return this[Ft.rawDataSymbol][`image_url_${e}x`]}get title(){return this[Ft.rawDataSymbol].title}get description(){return this[Ft.rawDataSymbol].description}get clickAction(){return this[Ft.rawDataSymbol].click_action}get clickUrl(){return this[Ft.rawDataSymbol].click_url}};rf=Ik.__decorate([(0,Ft.rtfm)("api","HelixChatBadgeVersion","id")],rf);Hs.HelixChatBadgeVersion=rf});var af=l(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.HelixChatBadgeSet=void 0;var Sq=(_(),g(y)),qq=Xi(),Es=m(),Rk=nf(),As=class extends Es.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[Es.rawDataSymbol].set_id}get versions(){return this[Es.rawDataSymbol].versions.map(e=>new Rk.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(i=>i.id===e))!==null&&t!==void 0?t:null}};Sq.__decorate([(0,qq.CachedGetter)()],As.prototype,"versions",null);As=Sq.__decorate([qq.Cacheable,(0,Es.rtfm)("api","HelixChatBadgeSet","id")],As);Ts.HelixChatBadgeSet=As});var of=l(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.HelixChatChatter=void 0;var Pq=(_(),g(y)),Dk=S(),lr=m(),Is=class extends lr.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[lr.rawDataSymbol].user_id}get userName(){return this[lr.rawDataSymbol].user_login}get userDisplayName(){return this[lr.rawDataSymbol].user_name}async getUser(){return(0,lr.checkRelationAssertion)(await this._client.users.getUserById(this[lr.rawDataSymbol].user_id))}};Pq.__decorate([(0,Dk.Enumerable)(!1)],Is.prototype,"_client",void 0);Is=Pq.__decorate([(0,lr.rtfm)("api","HelixChatChatter")],Is);Rs.HelixChatChatter=Is});var Os=l(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.HelixChatSettings=void 0;var Ok=(_(),g(y)),nt=m(),sf=class extends nt.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[nt.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[nt.rawDataSymbol].slow_mode}get slowModeDelay(){return this[nt.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[nt.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[nt.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[nt.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[nt.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[nt.rawDataSymbol].unique_chat_mode}};sf=Ok.__decorate([(0,nt.rtfm)("api","HelixChatSettings","broadcasterId")],sf);Ds.HelixChatSettings=sf});var uf=l(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.HelixEmoteFromSet=void 0;var Cq=(_(),g(y)),Bk=S(),cr=m(),Uk=un(),Bs=class extends Uk.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[cr.rawDataSymbol].emote_type}get emoteSetId(){return this[cr.rawDataSymbol].emote_set_id}get ownerId(){switch(this[cr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[cr.rawDataSymbol].owner_id}}async getOwner(){switch(this[cr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[cr.rawDataSymbol].owner_id)}}};Cq.__decorate([(0,Bk.Enumerable)(!1)],Bs.prototype,"_client",void 0);Bs=Cq.__decorate([(0,cr.rtfm)("api","HelixEmoteFromSet","id")],Bs);Us.HelixEmoteFromSet=Bs});var df=l(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.HelixPrivilegedChatSettings=void 0;var jk=(_(),g(y)),lf=m(),kk=Os(),cf=class extends kk.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[lf.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[lf.rawDataSymbol].non_moderator_chat_delay_duration}};cf=jk.__decorate([(0,lf.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],cf);js.HelixPrivilegedChatSettings=cf});var mf=l(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.HelixChatApi=void 0;var Lk=(_(),g(y)),pf=G(),we=m(),hf=wq(),ks=Ee(),Fk=Zr(),Mk=ee(),Nk=Z(),Gk=L(),Qk=tf(),Hq=af(),Eq=of(),$k=Os(),Wk=un(),Vk=uf(),Aq=df(),ff=class extends Gk.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let i=(0,we.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/chatters",userId:i,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(i),...(0,Nk.createPaginationQuery)(t)}});return(0,Mk.createPaginatedResultWithTotal)(a,Eq.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,we.extractUserId)(e);return new Fk.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,i=>new Eq.HelixChatChatter(i,this._client))}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new Hq.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,we.extractUserId)(e),query:(0,pf.createBroadcasterQuery)(e)})).data.map(i=>new Hq.HelixChatBadgeSet(i))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new Wk.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,we.extractUserId)(e),query:(0,pf.createBroadcasterQuery)(e)})).data.map(i=>new Qk.HelixChannelEmote(i,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,ks.createSingleKeyQuery)("emote_set_id",e)})).data.map(i=>new Vk.HelixEmoteFromSet(i,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,we.extractUserId)(e),query:(0,pf.createBroadcasterQuery)(e)});return new $k.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,we.extractUserId)(e),i=await this._client.callApi({type:"helix",url:"chat/settings",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(t)});return new Aq.HelixPrivilegedChatSettings(i.data[0])}async updateSettings(e,t){let i=(0,we.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:i,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(i),jsonBody:(0,hf.createChatSettingsUpdateBody)(t)});return new Aq.HelixPrivilegedChatSettings(a.data[0])}async sendAnnouncement(e,t){let i=(0,we.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:i,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(i),jsonBody:{message:t.message,color:t.color}})}async getColorsForUsers(e){let t=await this._client.callApi({type:"helix",url:"chat/color",query:(0,ks.createSingleKeyQuery)("user_id",e.map(we.extractUserId))});return new Map(t.data.map(i=>[i.user_id,i.color||null]))}async getColorForUser(e){let t=await this._client.callApi({type:"helix",url:"chat/color",userId:(0,we.extractUserId)(e),query:(0,ks.createSingleKeyQuery)("user_id",(0,we.extractUserId)(e))});if(t.data.length)return t.data[0].color||null}async setColorForUser(e,t){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:(0,we.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,hf.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let i=(0,we.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:i,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,hf.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(i))})}_createModeratorActionQuery(e){return(0,ks.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};ff=Lk.__decorate([(0,we.rtfm)("api","HelixChatApi")],ff);Ls.HelixChatApi=ff});var Tq=l(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.createClipQuery=Yr.createClipCreateQuery=void 0;var zk=m();function Kk(r,e){return{broadcaster_id:(0,zk.extractUserId)(r),has_delay:e.toString()}}n(Kk,"createClipCreateQuery");Yr.createClipCreateQuery=Kk;function Jk(r){let{filterType:e,ids:t,startDate:i,endDate:a,isFeatured:o}=r;return{[e]:t,started_at:i,ended_at:a,is_featured:o?.toString()}}n(Jk,"createClipQuery");Yr.createClipQuery=Jk});var yf=l(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.HelixClip=void 0;var Iq=(_(),g(y)),Zk=S(),U=m(),Fs=class extends U.DataObject{static{n(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[U.rawDataSymbol].id}get url(){return this[U.rawDataSymbol].url}get embedUrl(){return this[U.rawDataSymbol].embed_url}get broadcasterId(){return this[U.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[U.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,U.checkRelationAssertion)(await this._client.users.getUserById(this[U.rawDataSymbol].broadcaster_id))}get creatorId(){return this[U.rawDataSymbol].creator_id}get creatorDisplayName(){return this[U.rawDataSymbol].creator_name}async getCreator(){return(0,U.checkRelationAssertion)(await this._client.users.getUserById(this[U.rawDataSymbol].creator_id))}get videoId(){return this[U.rawDataSymbol].video_id}async getVideo(){return(0,U.checkRelationAssertion)(await this._client.videos.getVideoById(this[U.rawDataSymbol].video_id))}get gameId(){return this[U.rawDataSymbol].game_id}async getGame(){return this[U.rawDataSymbol].game_id?(0,U.checkRelationAssertion)(await this._client.games.getGameById(this[U.rawDataSymbol].game_id)):null}get language(){return this[U.rawDataSymbol].language}get title(){return this[U.rawDataSymbol].title}get views(){return this[U.rawDataSymbol].view_count}get creationDate(){return new Date(this[U.rawDataSymbol].created_at)}get thumbnailUrl(){return this[U.rawDataSymbol].thumbnail_url}get duration(){return this[U.rawDataSymbol].duration}get vodOffset(){return this[U.rawDataSymbol].vod_offset}get isFeatured(){return this[U.rawDataSymbol].is_featured}};Iq.__decorate([(0,Zk.Enumerable)(!1)],Fs.prototype,"_client",void 0);Fs=Iq.__decorate([(0,U.rtfm)("api","HelixClip","id")],Fs);Ms.HelixClip=Fs});var bf=l(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.HelixClipApi=void 0;var Rq=(_(),g(y)),Xk=S(),ei=m(),_f=Tq(),Yk=Ut(),eL=ae(),tL=ee(),rL=Z(),iL=L(),gf=yf(),Ns=class extends iL.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new Yk.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new gf.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,ei.extractUserId)(e),userId:(0,ei.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,ei.extractUserId)(e),userId:(0,ei.extractUserId)(e)})}async getClipsForGame(e,t={}){return await this._getClips({...t,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){let t=await this.getClipsByIds([e]);return t.length?t[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){let{channel:t,createAfterDelay:i=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:(0,ei.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,_f.createClipCreateQuery)(t,i)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};let t=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...(0,_f.createClipQuery)(e),...(0,rL.createPaginationQuery)(e)}});return(0,tL.createPaginatedResult)(t,gf.HelixClip,this._client)}_getClipsPaginated(e){return new eL.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,_f.createClipQuery)(e)},this._client,t=>new gf.HelixClip(t,this._client))}};Rq.__decorate([(0,Xk.Enumerable)(!1)],Ns.prototype,"_getClipByIdBatcher",void 0);Ns=Rq.__decorate([(0,ei.rtfm)("api","HelixClipApi")],Ns);Gs.HelixClipApi=Ns});var wf=l($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.HelixContentClassificationLabel=void 0;var Qs=m(),vf=class extends Qs.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[Qs.rawDataSymbol].id}get name(){return this[Qs.rawDataSymbol].name}get description(){return this[Qs.rawDataSymbol].description}};$s.HelixContentClassificationLabel=vf});var Sf=l(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.HelixContentClassificationLabelApi=void 0;var nL=(_(),g(y)),aL=m(),oL=L(),sL=wf(),xf=class extends oL.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(i=>new sL.HelixContentClassificationLabel(i))}};xf=nL.__decorate([(0,aL.rtfm)("api","HelixContentClassificationLabelApi")],xf);Ws.HelixContentClassificationLabelApi=xf});var Dq=l(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.createDropsEntitlementUpdateBody=ti.createDropsEntitlementQuery=void 0;var uL=S(),lL=m();function cL(r,e){return{user_id:e?(0,uL.mapOptional)(r.user,lL.extractUserId):void 0,game_id:r.gameId,fulfillment_status:r.fulfillmentStatus}}n(cL,"createDropsEntitlementQuery");ti.createDropsEntitlementQuery=cL;function dL(r,e){return{fulfillment_status:e,entitlement_ids:r}}n(dL,"createDropsEntitlementUpdateBody");ti.createDropsEntitlementUpdateBody=dL});var qf=l(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.HelixDropsEntitlement=void 0;var Oq=(_(),g(y)),pL=S(),Te=m(),Vs=class extends Te.DataObject{static{n(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[Te.rawDataSymbol].id}get rewardId(){return this[Te.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[Te.rawDataSymbol].timestamp)}get userId(){return this[Te.rawDataSymbol].user_id}async getUser(){return(0,Te.checkRelationAssertion)(await this._client.users.getUserById(this[Te.rawDataSymbol].user_id))}get gameId(){return this[Te.rawDataSymbol].game_id}async getGame(){return(0,Te.checkRelationAssertion)(await this._client.games.getGameById(this[Te.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[Te.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[Te.rawDataSymbol].last_updated)}};Oq.__decorate([(0,pL.Enumerable)(!1)],Vs.prototype,"_client",void 0);Vs=Oq.__decorate([(0,Te.rtfm)("api","HelixDropsEntitlement")],Vs);zs.HelixDropsEntitlement=Vs});var Ef=l(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.HelixEntitlementApi=void 0;var Bq=(_(),g(y)),Cf=S(),Hf=m(),Pf=Dq(),hL=Ut(),fL=ae(),mL=ee(),yL=Z(),_L=L(),Ks=qf(),Js=class extends _L.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new hL.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new Ks.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let i=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Cf.mapOptional)(e.user,Hf.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,Pf.createDropsEntitlementQuery)(e,t),...(0,yL.createPaginationQuery)(e)}});return(0,mL.createPaginatedResult)(i,Ks.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new fL.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Cf.mapOptional)(e.user,Hf.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,Pf.createDropsEntitlementQuery)(e,t)},this._client,i=>new Ks.HelixDropsEntitlement(i,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(i=>new Ks.HelixDropsEntitlement(i,this._client))}async getDropsEntitlementById(e){var t;return(t=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&t!==void 0?t:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,t){let i=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:(0,Pf.createDropsEntitlementUpdateBody)(e,t)});return new Map(i.data.flatMap(a=>a.ids.map(o=>[o,a.status])))}};Bq.__decorate([(0,Cf.Enumerable)(!1)],Js.prototype,"_getDropsEntitlementByIdBatcher",void 0);Js=Bq.__decorate([(0,Hf.rtfm)("api","HelixEntitlementApi")],Js);Zs.HelixEntitlementApi=Js});var jq=l(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.createEventSubDropEntitlementGrantCondition=at.createEventSubModeratorCondition=at.createEventSubRewardCondition=at.createEventSubBroadcasterCondition=void 0;var Uq=m();function gL(r){return{broadcaster_user_id:(0,Uq.extractUserId)(r)}}n(gL,"createEventSubBroadcasterCondition");at.createEventSubBroadcasterCondition=gL;function bL(r,e){return{broadcaster_user_id:(0,Uq.extractUserId)(r),reward_id:e}}n(bL,"createEventSubRewardCondition");at.createEventSubRewardCondition=bL;function vL(r,e){return{broadcaster_user_id:r,moderator_user_id:e}}n(vL,"createEventSubModeratorCondition");at.createEventSubModeratorCondition=vL;function wL(r){return{organization_id:r.organizationId,category_id:r.categoryId,campaign_id:r.campaignId}}n(wL,"createEventSubDropEntitlementGrantCondition");at.createEventSubDropEntitlementGrantCondition=wL});var eu=l(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.HelixEventSubSubscription=void 0;var kq=(_(),g(y)),xL=S(),Ge=m(),Xs=class extends Ge.DataObject{static{n(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[Ge.rawDataSymbol].id}get status(){return this[Ge.rawDataSymbol].status}get type(){return this[Ge.rawDataSymbol].type}get cost(){return this[Ge.rawDataSymbol].cost}get condition(){return this[Ge.rawDataSymbol].condition}get creationDate(){return new Date(this[Ge.rawDataSymbol].created_at)}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[Ge.rawDataSymbol].id)}get _transport(){return this[Ge.rawDataSymbol].transport}set _status(e){this[Ge.rawDataSymbol].status=e}};kq.__decorate([(0,xL.Enumerable)(!1)],Xs.prototype,"_client",void 0);Xs=kq.__decorate([(0,Ge.rtfm)("api","HelixEventSubSubscription","id")],Xs);Ys.HelixEventSubSubscription=Xs});var Tf=l(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.HelixPaginatedEventSubSubscriptionsRequest=void 0;var SL=(_(),g(y)),qL=m(),PL=Zr(),CL=eu(),Af=class extends PL.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,i){super({url:"eventsub/subscriptions",userId:t,query:e},i,a=>new CL.HelixEventSubSubscription(a,i))}async getTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total_cost}async getMaxTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).max_total_cost}};Af=SL.__decorate([(0,qL.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Af);tu.HelixPaginatedEventSubSubscriptionsRequest=Af});var Rf=l(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.HelixEventSubApi=void 0;var HL=(_(),g(y)),EL=S(),Ie=m(),C=jq(),Mt=Ee(),ru=ee(),iu=Z(),AL=L(),cn=eu(),nu=Tf(),If=class extends AL.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,iu.createPaginationQuery)(e)});return{...(0,ru.createPaginatedResultWithTotal)(t,cn.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new nu.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let i=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,iu.createPaginationQuery)(t),status:e}});return{...(0,ru.createPaginatedResultWithTotal)(i,cn.HelixEventSubSubscription,this._client),totalCost:i.total_cost,maxTotalCost:i.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new nu.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let i=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,iu.createPaginationQuery)(t),type:e}});return{...(0,ru.createPaginatedResultWithTotal)(i,cn.HelixEventSubSubscription,this._client),totalCost:i.total_cost,maxTotalCost:i.max_total_cost}}getSubscriptionsForTypePaginated(e){return new nu.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let i=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,Ie.extractUserId)(e),query:{...(0,Mt.createSingleKeyQuery)("user_id",(0,Ie.extractUserId)(e)),...(0,iu.createPaginationQuery)(t)}});return{...(0,ru.createPaginatedResultWithTotal)(i,cn.HelixEventSubSubscription,this._client),totalCost:i.total_cost,maxTotalCost:i.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,Ie.extractUserId)(e);return new nu.HelixPaginatedEventSubSubscriptionsRequest((0,Mt.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,i,a,o,s,u,c){let p=a.method==="webhook",h=p?void 0:s;if(!p&&!o)throw new Error(`Transport ${a.method} can only handle subscriptions with user context`);let f={type:e,version:t,condition:i,transport:a};c&&(f.is_batching_enabled=!0);let b=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:h,userId:(0,EL.mapOptional)(o,Ie.extractUserId),forceType:p?"app":"user",jsonBody:f});return new cn.HelixEventSubSubscription(b.data[0],this._client)}async deleteSubscription(e){await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"DELETE",query:{id:e}})}async deleteAllSubscriptions(){await this._deleteSubscriptionsWithCondition()}async deleteBrokenSubscriptions(){await this._deleteSubscriptionsWithCondition(e=>e.status!=="enabled"&&e.status!=="webhook_callback_verification_pending")}async subscribeToStreamOnlineEvents(e,t){return await this.createSubscription("stream.online","1",(0,C.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,C.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","1",(0,C.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let i=(0,Ie.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,C.createEventSubModeratorCondition)(i,this._getUserContextIdWithDefault(i)),t,i,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let i=(0,Ie.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,C.createEventSubModeratorCondition)(i,this._getUserContextIdWithDefault(i)),t,i,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let i=(0,Ie.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,C.createEventSubModeratorCondition)(i,this._getUserContextIdWithDefault(i)),t,i,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,t){return await this.createSubscription("channel.moderator.add","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,t){return await this.createSubscription("channel.raid","1",(0,Mt.createSingleKeyQuery)("from_broadcaster_user_id",(0,Ie.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,Mt.createSingleKeyQuery)("to_broadcaster_user_id",(0,Ie.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,t,i){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,C.createEventSubRewardCondition)(e,t),i,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,t,i){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,C.createEventSubRewardCondition)(e,t),i,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,t,i){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,C.createEventSubRewardCondition)(e,t),i,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,t,i){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,C.createEventSubRewardCondition)(e,t),i,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let i=(0,Ie.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,C.createEventSubModeratorCondition)(i,this._getUserContextIdWithDefault(i)),t,i,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let i=(0,Ie.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,C.createEventSubModeratorCondition)(i,this._getUserContextIdWithDefault(i)),t,i,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,Mt.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,Mt.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,Mt.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,i){return await this.createSubscription("user.update","1",(0,Mt.createSingleKeyQuery)("user_id",(0,Ie.extractUserId)(e)),t,e,i?["user:read:email"]:void 0)}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,C.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let i of t)(!e||e(i))&&await i.unsubscribe()}};If=HL.__decorate([(0,Ie.rtfm)("api","HelixEventSubApi")],If);au.HelixEventSubApi=If});var Lq=l(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.createExtensionTransactionQuery=Nt.createExtensionProductBody=Nt.createReleasedExtensionFilter=void 0;function TL(r,e){return{extension_id:r,extension_version:e}}n(TL,"createReleasedExtensionFilter");Nt.createReleasedExtensionFilter=TL;function IL(r){return{sku:r.sku,cost:{amount:r.cost,type:"bits"},display_name:r.displayName,in_development:r.inDevelopment,expiration:r.expirationDate,is_broadcast:r.broadcast}}n(IL,"createExtensionProductBody");Nt.createExtensionProductBody=IL;function RL(r,e){return{extension_id:r,id:e.transactionIds}}n(RL,"createExtensionTransactionQuery");Nt.createExtensionTransactionQuery=RL});var Df=l(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.HelixChannelReference=void 0;var Fq=(_(),g(y)),DL=S(),xe=m(),ou=class extends xe.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[xe.rawDataSymbol].broadcaster_id}get displayName(){return this[xe.rawDataSymbol].broadcaster_name}async getChannel(){return(0,xe.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[xe.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,xe.checkRelationAssertion)(await this._client.users.getUserById(this[xe.rawDataSymbol].broadcaster_id))}get gameId(){return this[xe.rawDataSymbol].game_id}get gameName(){return this[xe.rawDataSymbol].game_name}async getGame(){return this[xe.rawDataSymbol].game_id?(0,xe.checkRelationAssertion)(await this._client.games.getGameById(this[xe.rawDataSymbol].game_id)):null}get title(){return this[xe.rawDataSymbol].title}};Fq.__decorate([(0,DL.Enumerable)(!1)],ou.prototype,"_client",void 0);ou=Fq.__decorate([(0,xe.rtfm)("api","HelixChannelReference","id")],ou);su.HelixChannelReference=ou});var Bf=l(uu=>{"use strict";Object.defineProperty(uu,"__esModule",{value:!0});uu.HelixExtensionBitsProduct=void 0;var OL=(_(),g(y)),BL=S(),Gt=m(),Of=class extends Gt.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[Gt.rawDataSymbol].sku}get cost(){return this[Gt.rawDataSymbol].cost.amount}get displayName(){return this[Gt.rawDataSymbol].display_name}get inDevelopment(){return this[Gt.rawDataSymbol].in_development}get isBroadcast(){return this[Gt.rawDataSymbol].is_broadcast}get expirationDate(){return(0,BL.mapNullable)(this[Gt.rawDataSymbol].expiration,e=>new Date(e))}};Of=OL.__decorate([(0,Gt.rtfm)("api","HelixExtensionBitsProduct","sku")],Of);uu.HelixExtensionBitsProduct=Of});var Uf=l(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.HelixExtensionTransaction=void 0;var Mq=(_(),g(y)),UL=S(),te=m(),lu=class extends te.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[te.rawDataSymbol].id}get transactionDate(){return new Date(this[te.rawDataSymbol].timestamp)}get broadcasterId(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[te.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[te.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].broadcaster_id))}get userId(){return this[te.rawDataSymbol].user_id}get userName(){return this[te.rawDataSymbol].user_login}get userDisplayName(){return this[te.rawDataSymbol].user_name}async getUser(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].user_id))}get productType(){return this[te.rawDataSymbol].product_type}get productSku(){return this[te.rawDataSymbol].product_data.sku}get productCost(){return this[te.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[te.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[te.rawDataSymbol].product_data.inDevelopment}};Mq.__decorate([(0,UL.Enumerable)(!1)],lu.prototype,"_client",void 0);lu=Mq.__decorate([(0,te.rtfm)("api","HelixExtensionTransaction","id")],lu);cu.HelixExtensionTransaction=lu});var Lf=l(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.HelixExtensionsApi=void 0;var jL=(_(),g(y)),zq=m(),du=Lq(),jf=Ee(),Nq=ae(),Gq=ee(),Qq=Z(),kL=L(),$q=Df(),Wq=Bf(),Vq=Uf(),kf=class extends kL.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let i=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,du.createReleasedExtensionFilter)(e,t)});return new zq.HelixExtension(i.data[0])}async getLiveChannelsWithExtension(e,t){let i=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,jf.createSingleKeyQuery)("extension_id",e),...(0,Qq.createPaginationQuery)(t)}});return(0,Gq.createPaginatedResult)(i,$q.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new Nq.HelixPaginatedRequest({url:"extensions/live",query:(0,jf.createSingleKeyQuery)("extension_id",e)},this._client,t=>new $q.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,jf.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(i=>new Wq.HelixExtensionBitsProduct(i))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,du.createExtensionProductBody)(e)});return new Wq.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let i=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,du.createExtensionTransactionQuery)(e,t),...(0,Qq.createPaginationQuery)(t)}});return(0,Gq.createPaginatedResult)(i,Vq.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new Nq.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,du.createExtensionTransactionQuery)(e,t)},this._client,i=>new Vq.HelixExtensionTransaction(i,this._client))}};kf=jL.__decorate([(0,zq.rtfm)("api","HelixExtensionsApi")],kf);pu.HelixExtensionsApi=kf});var mu=l(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.HelixGame=void 0;var Kq=(_(),g(y)),LL=S(),vt=m(),hu=class extends vt.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[vt.rawDataSymbol].id}get name(){return this[vt.rawDataSymbol].name}get boxArtUrl(){return this[vt.rawDataSymbol].box_art_url}get igdbId(){return this[vt.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[vt.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[vt.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[vt.rawDataSymbol].id})}};Kq.__decorate([(0,LL.Enumerable)(!1)],hu.prototype,"_client",void 0);hu=Kq.__decorate([(0,vt.rtfm)("api","HelixGame","id")],hu);fu.HelixGame=hu});var Nf=l(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.HelixGameApi=void 0;var yu=(_(),g(y)),Mf=S(),FL=m(),Ff=Ut(),ML=ae(),NL=ee(),GL=Z(),QL=L(),ri=mu(),ii=class extends QL.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new Ff.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new ri.HelixGame(e,this._client)),this._getGameByNameBatcher=new Ff.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new ri.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new Ff.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new ri.HelixGame(e,this._client))}async getGamesByIds(e){return await this._getGames("id",e)}async getGamesByNames(e){return await this._getGames("name",e)}async getGamesByIgdbIds(e){return await this._getGames("igdb_id",e)}async getGameById(e){var t;return(t=(await this._getGames("id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByName(e){var t;return(t=(await this._getGames("name",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIgdbId(e){var t;return(t=(await this._getGames("igdb_id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIdBatched(e){return await this._getGameByIdBatcher.request(e)}async getGameByNameBatched(e){return await this._getGameByNameBatcher.request(e)}async getGameByIgdbIdBatched(e){return await this._getGameByIgdbIdBatcher.request(e)}async getTopGames(e){let t=await this._client.callApi({type:"helix",url:"games/top",query:(0,GL.createPaginationQuery)(e)});return(0,NL.createPaginatedResult)(t,ri.HelixGame,this._client)}getTopGamesPaginated(){return new ML.HelixPaginatedRequest({url:"games/top"},this._client,e=>new ri.HelixGame(e,this._client))}async _getGames(e,t){return t.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:t}})).data.map(a=>new ri.HelixGame(a,this._client)):[]}};yu.__decorate([(0,Mf.Enumerable)(!1)],ii.prototype,"_getGameByIdBatcher",void 0);yu.__decorate([(0,Mf.Enumerable)(!1)],ii.prototype,"_getGameByNameBatcher",void 0);yu.__decorate([(0,Mf.Enumerable)(!1)],ii.prototype,"_getGameByIgdbIdBatcher",void 0);ii=yu.__decorate([(0,FL.rtfm)("api","HelixGameApi")],ii);_u.HelixGameApi=ii});var Gf=l(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.HelixGoal=void 0;var Jq=(_(),g(y)),$L=S(),Re=m(),gu=class extends Re.DataObject{static{n(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[Re.rawDataSymbol].id}get broadcasterId(){return this[Re.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Re.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[Re.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,Re.checkRelationAssertion)(await this._client.users.getUserById(this[Re.rawDataSymbol].broadcaster_id))}get type(){return this[Re.rawDataSymbol].type}get description(){return this[Re.rawDataSymbol].description}get currentAmount(){return this[Re.rawDataSymbol].current_amount}get targetAmount(){return this[Re.rawDataSymbol].target_amount}get creationDate(){return this[Re.rawDataSymbol].created_at}};Jq.__decorate([(0,$L.Enumerable)(!1)],gu.prototype,"_client",void 0);gu=Jq.__decorate([(0,Re.rtfm)("api","HelixGoal","id")],gu);bu.HelixGoal=gu});var $f=l(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.HelixGoalApi=void 0;var WL=(_(),g(y)),VL=G(),Zq=m(),zL=L(),KL=Gf(),Qf=class extends zL.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,Zq.extractUserId)(e),scopes:["channel:read:goals"],query:(0,VL.createBroadcasterQuery)(e)})).data.map(i=>new KL.HelixGoal(i,this._client))}};Qf=WL.__decorate([(0,Zq.rtfm)("api","HelixGoalApi")],Qf);vu.HelixGoalApi=Qf});var Wf=l(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.HelixHypeTrainContribution=void 0;var Xq=(_(),g(y)),JL=S(),dr=m(),wu=class extends dr.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[dr.rawDataSymbol].user}async getUser(){return(0,dr.checkRelationAssertion)(await this._client.users.getUserById(this[dr.rawDataSymbol].user))}get type(){return this[dr.rawDataSymbol].type}get total(){return this[dr.rawDataSymbol].total}};Xq.__decorate([(0,JL.Enumerable)(!1)],wu.prototype,"_client",void 0);wu=Xq.__decorate([(0,dr.rtfm)("api","HelixHypeTrainContribution","userId")],wu);xu.HelixHypeTrainContribution=wu});var Vf=l(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.HelixHypeTrainEvent=void 0;var eP=(_(),g(y)),ZL=S(),ue=m(),Yq=Wf(),Su=class extends ue.DataObject{static{n(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[ue.rawDataSymbol].id}get eventType(){return this[ue.rawDataSymbol].event_type}get eventDate(){return new Date(this[ue.rawDataSymbol].event_timestamp)}get eventVersion(){return this[ue.rawDataSymbol].version}get id(){return this[ue.rawDataSymbol].event_data.id}get broadcasterId(){return this[ue.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[ue.rawDataSymbol].event_data.level}get startDate(){return new Date(this[ue.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[ue.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[ue.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[ue.rawDataSymbol].event_data.total}get goal(){return this[ue.rawDataSymbol].event_data.goal}get lastContribution(){return new Yq.HelixHypeTrainContribution(this[ue.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[ue.rawDataSymbol].event_data.top_contributions.map(e=>new Yq.HelixHypeTrainContribution(e,this._client))}};eP.__decorate([(0,ZL.Enumerable)(!1)],Su.prototype,"_client",void 0);Su=eP.__decorate([(0,ue.rtfm)("api","HelixHypeTrainEvent","id")],Su);qu.HelixHypeTrainEvent=Su});var Kf=l(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.HelixHypeTrainApi=void 0;var tP=G(),rP=m(),XL=ae(),YL=ee(),eF=Z(),tF=L(),iP=Vf(),zf=class extends tF.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let i=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,rP.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,tP.createBroadcasterQuery)(e),...(0,eF.createPaginationQuery)(t)}});return(0,YL.createPaginatedResult)(i,iP.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new XL.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,rP.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,tP.createBroadcasterQuery)(e)},this._client,t=>new iP.HelixHypeTrainEvent(t,this._client))}};Pu.HelixHypeTrainApi=zf});var nP=l(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.createUpdateShieldModeStatusBody=Se.createBanUserBody=Se.createAutoModSettingsBody=Se.createAutoModProcessBody=Se.createModeratorModifyQuery=Se.createModerationUserListQuery=void 0;var dn=m();function rF(r,e){return{broadcaster_id:(0,dn.extractUserId)(r),user_id:e?.userId}}n(rF,"createModerationUserListQuery");Se.createModerationUserListQuery=rF;function iF(r,e){return{broadcaster_id:(0,dn.extractUserId)(r),user_id:(0,dn.extractUserId)(e)}}n(iF,"createModeratorModifyQuery");Se.createModeratorModifyQuery=iF;function nF(r,e,t){return{user_id:(0,dn.extractUserId)(r),msg_id:e,action:t?"ALLOW":"DENY"}}n(nF,"createAutoModProcessBody");Se.createAutoModProcessBody=nF;function aF(r){return{overall_level:r.overallLevel,aggression:r.aggression,bullying:r.bullying,disability:r.disability,misogyny:r.misogyny,race_ethnicity_or_religion:r.raceEthnicityOrReligion,sex_based_terms:r.sexBasedTerms,sexuality_sex_or_gender:r.sexualitySexOrGender,swearing:r.swearing}}n(aF,"createAutoModSettingsBody");Se.createAutoModSettingsBody=aF;function oF(r){return{data:{duration:r.duration,reason:r.reason,user_id:(0,dn.extractUserId)(r.user)}}}n(oF,"createBanUserBody");Se.createBanUserBody=oF;function sF(r){return{is_active:r}}n(sF,"createUpdateShieldModeStatusBody");Se.createUpdateShieldModeStatusBody=sF});var aP=l(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.HelixAutoModSettings=void 0;var uF=(_(),g(y)),qe=m(),Jf=class extends qe.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[qe.rawDataSymbol].broadcaster_id}get moderatorId(){return this[qe.rawDataSymbol].moderator_id}get overallLevel(){return this[qe.rawDataSymbol].overall_level?this[qe.rawDataSymbol].overall_level:null}get disability(){return this[qe.rawDataSymbol].disability}get aggression(){return this[qe.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[qe.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[qe.rawDataSymbol].misogyny}get bullying(){return this[qe.rawDataSymbol].bullying}get swearing(){return this[qe.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[qe.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[qe.rawDataSymbol].sex_based_terms}};Jf=uF.__decorate([(0,qe.rtfm)("api","HelixAutoModSettings","broadcasterId")],Jf);Cu.HelixAutoModSettings=Jf});var oP=l(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.HelixAutoModStatus=void 0;var lF=(_(),g(y)),Hu=m(),Zf=class extends Hu.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[Hu.rawDataSymbol].msg_id}get isPermitted(){return this[Hu.rawDataSymbol].is_permitted}};Zf=lF.__decorate([(0,Hu.rtfm)("api","HelixAutoModStatus","messageId")],Zf);Eu.HelixAutoModStatus=Zf});var Tu=l(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.HelixBanUser=void 0;var Xf=(_(),g(y)),Yf=S(),wt=m(),pn=class extends wt.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,i){super(e),this._expiryTimestamp=t,this._client=i}get creationDate(){return new Date(this[wt.rawDataSymbol].created_at)}get expiryDate(){return(0,Yf.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[wt.rawDataSymbol].moderator_id}async getModerator(){return(0,wt.checkRelationAssertion)(await this._client.users.getUserById(this[wt.rawDataSymbol].moderator_id))}get userId(){return this[wt.rawDataSymbol].user_id}async getUser(){return(0,wt.checkRelationAssertion)(await this._client.users.getUserById(this[wt.rawDataSymbol].user_id))}};Xf.__decorate([(0,Yf.Enumerable)(!1)],pn.prototype,"_client",void 0);Xf.__decorate([(0,Yf.Enumerable)(!1)],pn.prototype,"_expiryTimestamp",void 0);pn=Xf.__decorate([(0,wt.rtfm)("api","HelixBanUser","userId")],pn);Au.HelixBanUser=pn});var tm=l(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.HelixBan=void 0;var cF=(_(),g(y)),ni=m(),dF=Tu(),em=class extends dF.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[ni.rawDataSymbol].user_login}get userDisplayName(){return this[ni.rawDataSymbol].user_name}get moderatorName(){return this[ni.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[ni.rawDataSymbol].moderator_name}get reason(){return this[ni.rawDataSymbol].reason||null}};em=cF.__decorate([(0,ni.rtfm)("api","HelixBan","userId")],em);Iu.HelixBan=em});var im=l(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.HelixBlockedTerm=void 0;var pF=(_(),g(y)),ot=m(),rm=class extends ot.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[ot.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[ot.rawDataSymbol].created_at)}get expirationDate(){return this[ot.rawDataSymbol].expires_at?new Date(this[ot.rawDataSymbol].expires_at):null}get id(){return this[ot.rawDataSymbol].id}get moderatorId(){return this[ot.rawDataSymbol].moderator_id}get text(){return this[ot.rawDataSymbol].text}get updatedDate(){return new Date(this[ot.rawDataSymbol].updated_at)}};rm=pF.__decorate([(0,ot.rtfm)("api","HelixBlockedTerm","id")],rm);Ru.HelixBlockedTerm=rm});var nm=l(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.HelixModerator=void 0;var sP=(_(),g(y)),hF=S(),pr=m(),Du=class extends pr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[pr.rawDataSymbol].user_id}get userName(){return this[pr.rawDataSymbol].user_login}get userDisplayName(){return this[pr.rawDataSymbol].user_name}async getUser(){return(0,pr.checkRelationAssertion)(await this._client.users.getUserById(this[pr.rawDataSymbol].user_id))}};sP.__decorate([(0,hF.Enumerable)(!1)],Du.prototype,"_client",void 0);Du=sP.__decorate([(0,pr.rtfm)("api","HelixModerator","userId")],Du);Ou.HelixModerator=Du});var am=l(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.HelixShieldModeStatus=void 0;var uP=(_(),g(y)),fF=S(),st=m(),Bu=class extends st.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[st.rawDataSymbol].is_active}get moderatorId(){return this[st.rawDataSymbol].moderator_id}get moderatorName(){return this[st.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[st.rawDataSymbol].moderator_name}async getModerator(){return(0,st.checkRelationAssertion)(await this._client.users.getUserById(this[st.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[st.rawDataSymbol].last_activated_at===""?null:new Date(this[st.rawDataSymbol].last_activated_at)}};uP.__decorate([(0,fF.Enumerable)(!1)],Bu.prototype,"_client",void 0);Bu=uP.__decorate([(0,st.rtfm)("api","HelixShieldModeStatus")],Bu);Uu.HelixShieldModeStatus=Bu});var dm=l(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.HelixModerationApi=void 0;var mF=(_(),g(y)),om=G(),$=m(),sm=Ee(),Qt=nP(),lP=ae(),um=ee(),lm=Z(),yF=L(),cP=aP(),_F=oP(),dP=tm(),gF=Tu(),pP=im(),hP=nm(),fP=am(),cm=class extends yF.BaseApi{static{n(this,"HelixModerationApi")}async getBannedUsers(e,t){let i=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,$.extractUserId)(e),scopes:["moderation:read"],query:{...(0,Qt.createModerationUserListQuery)(e,t),...(0,lm.createPaginationQuery)(t)}});return(0,um.createPaginatedResult)(i,dP.HelixBan,this._client)}getBannedUsersPaginated(e){return new lP.HelixPaginatedRequest({url:"moderation/banned",userId:(0,$.extractUserId)(e),scopes:["moderation:read"],query:(0,om.createBroadcasterQuery)(e)},this._client,t=>new dP.HelixBan(t,this._client),50)}async checkUserBan(e,t){let i=(0,$.extractUserId)(t);return(await this.getBannedUsers(e,{userId:i})).data.some(o=>o.userId===i)}async getModerators(e,t){let i=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:(0,$.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,Qt.createModerationUserListQuery)(e,t),...(0,lm.createPaginationQuery)(t)}});return(0,um.createPaginatedResult)(i,hP.HelixModerator,this._client)}getModeratorsPaginated(e){return new lP.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,$.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,om.createBroadcasterQuery)(e)},this._client,t=>new hP.HelixModerator(t,this._client))}async checkUserMod(e,t){let i=(0,$.extractUserId)(t);return(await this.getModerators(e,{userId:i})).data.some(o=>o.userId===i)}async addModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:(0,$.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,Qt.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,$.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,Qt.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,$.extractUserId)(e),scopes:["moderation:read"],query:(0,om.createBroadcasterQuery)(e),jsonBody:{data:t}})).data.map(a=>new _F.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,i){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,$.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,Qt.createAutoModProcessBody)(e,t,i)})}async getAutoModSettings(e){let t=(0,$.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:t,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)})).data.map(a=>new cP.HelixAutoModSettings(a))}async updateAutoModSettings(e,t){let i=(0,$.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:i,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(i),jsonBody:(0,Qt.createAutoModSettingsBody)(t)})).data.map(o=>new cP.HelixAutoModSettings(o))}async banUser(e,t){let i=(0,$.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:i,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(i),jsonBody:(0,Qt.createBanUserBody)(t)})).data.map(o=>new gF.HelixBanUser(o,o.end_time,this._client))}async unbanUser(e,t){let i=(0,$.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:i,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(i),...(0,sm.createSingleKeyQuery)("user_id",(0,$.extractUserId)(t))}})}async getBlockedTerms(e,t){let i=(0,$.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:i,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(i),...(0,lm.createPaginationQuery)(t)}});return(0,um.createPaginatedResult)(a,pP.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let i=(0,$.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:i,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(i),jsonBody:{text:t}})).data.map(o=>new pP.HelixBlockedTerm(o))}async removeBlockedTerm(e,t,i){let a=(0,$.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:a,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),id:i}})}async deleteChatMessages(e,t){let i=(0,$.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:i,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(i),...(0,sm.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,$.extractUserId)(e),i=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:t,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)});return new fP.HelixShieldModeStatus(i.data[0],this._client)}async updateShieldModeStatus(e,t){let i=(0,$.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:i,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(i),jsonBody:(0,Qt.createUpdateShieldModeStatusBody)(t)});return new fP.HelixShieldModeStatus(a.data[0],this._client)}_createModeratorActionQuery(e){return(0,sm.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};cm=mF.__decorate([(0,$.rtfm)("api","HelixModerationApi")],cm);ju.HelixModerationApi=cm});var yP=l(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.createPollEndBody=ai.createPollBody=void 0;var mP=m();function bF(r,e){var t;return{broadcaster_id:(0,mP.extractUserId)(r),title:e.title,choices:e.choices.map(i=>({title:i})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(t=e.channelPointsPerVote)!==null&&t!==void 0?t:0}}n(bF,"createPollBody");ai.createPollBody=bF;function vF(r,e,t){return{broadcaster_id:(0,mP.extractUserId)(r),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(vF,"createPollEndBody");ai.createPollEndBody=vF});var hm=l(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.HelixPollChoice=void 0;var wF=(_(),g(y)),oi=m(),pm=class extends oi.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[oi.rawDataSymbol].id}get title(){return this[oi.rawDataSymbol].title}get totalVotes(){return this[oi.rawDataSymbol].votes}get channelPointsVotes(){return this[oi.rawDataSymbol].channel_points_votes}};pm=wF.__decorate([(0,oi.rtfm)("api","HelixPollChoice","id")],pm);ku.HelixPollChoice=pm});var fm=l(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.HelixPoll=void 0;var _P=(_(),g(y)),xF=S(),ye=m(),SF=hm(),Lu=class extends ye.DataObject{static{n(this,"HelixPoll")}constructor(e,t){super(e),this._client=t}get id(){return this[ye.rawDataSymbol].id}get broadcasterId(){return this[ye.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ye.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ye.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ye.checkRelationAssertion)(await this._client.users.getUserById(this[ye.rawDataSymbol].broadcaster_id))}get title(){return this[ye.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[ye.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[ye.rawDataSymbol].channel_points_per_vote}get status(){return this[ye.rawDataSymbol].status}get durationInSeconds(){return this[ye.rawDataSymbol].duration}get startDate(){return new Date(this[ye.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[ye.rawDataSymbol].duration*1e3)}get choices(){return this[ye.rawDataSymbol].choices.map(e=>new SF.HelixPollChoice(e))}};_P.__decorate([(0,xF.Enumerable)(!1)],Lu.prototype,"_client",void 0);Lu=_P.__decorate([(0,ye.rtfm)("api","HelixPoll","id")],Lu);Fu.HelixPoll=Lu});var ym=l(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.HelixPollApi=void 0;var qF=(_(),g(y)),gP=G(),si=m(),PF=Ee(),bP=yP(),CF=ae(),HF=ee(),EF=Z(),AF=L(),hn=fm(),mm=class extends AF.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let i=await this._client.callApi({type:"helix",url:"polls",userId:(0,si.extractUserId)(e),scopes:["channel:read:polls"],query:{...(0,gP.createBroadcasterQuery)(e),...(0,EF.createPaginationQuery)(t)}});return(0,HF.createPaginatedResult)(i,hn.HelixPoll,this._client)}getPollsPaginated(e){return new CF.HelixPaginatedRequest({url:"polls",userId:(0,si.extractUserId)(e),scopes:["channel:read:polls"],query:(0,gP.createBroadcasterQuery)(e)},this._client,t=>new hn.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,si.extractUserId)(e),scopes:["channel:read:polls"],query:(0,PF.createGetByIdsQuery)(e,t)})).data.map(a=>new hn.HelixPoll(a,this._client)):[]}async getPollById(e,t){let i=await this.getPollsByIds(e,[t]);return i.length?i[0]:null}async createPoll(e,t){let i=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:(0,si.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,bP.createPollBody)(e,t)});return new hn.HelixPoll(i.data[0],this._client)}async endPoll(e,t,i=!0){let a=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:(0,si.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,bP.createPollEndBody)(e,t,i)});return new hn.HelixPoll(a.data[0],this._client)}};mm=qF.__decorate([(0,si.rtfm)("api","HelixPollApi")],mm);Mu.HelixPollApi=mm});var wP=l(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createEndPredictionBody=ui.createPredictionBody=void 0;var vP=m();function TF(r,e){return{broadcaster_id:(0,vP.extractUserId)(r),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(TF,"createPredictionBody");ui.createPredictionBody=TF;function IF(r,e,t,i){return{broadcaster_id:(0,vP.extractUserId)(r),id:e,status:t,winning_outcome_id:i}}n(IF,"createEndPredictionBody");ui.createEndPredictionBody=IF});var _m=l(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.HelixPredictor=void 0;var xP=(_(),g(y)),RF=S(),$t=m(),Nu=class extends $t.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[$t.rawDataSymbol].id}get userName(){return this[$t.rawDataSymbol].login}get userDisplayName(){return this[$t.rawDataSymbol].name}async getUser(){return await this._client.users.getUserById(this[$t.rawDataSymbol].id)}get channelPointsUsed(){return this[$t.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[$t.rawDataSymbol].channel_points_won}};xP.__decorate([(0,RF.Enumerable)(!1)],Nu.prototype,"_client",void 0);Nu=xP.__decorate([(0,$t.rtfm)("api","HelixPredictor","userId")],Nu);Gu.HelixPredictor=Nu});var gm=l($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.HelixPredictionOutcome=void 0;var SP=(_(),g(y)),DF=S(),Wt=m(),OF=_m(),Qu=class extends Wt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Wt.rawDataSymbol].id}get title(){return this[Wt.rawDataSymbol].title}get users(){return this[Wt.rawDataSymbol].users}get totalChannelPoints(){return this[Wt.rawDataSymbol].channel_points}get color(){return this[Wt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Wt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(i=>new OF.HelixPredictor(i,this._client)))!==null&&t!==void 0?t:[]}};SP.__decorate([(0,DF.Enumerable)(!1)],Qu.prototype,"_client",void 0);Qu=SP.__decorate([(0,Wt.rtfm)("api","HelixPredictionOutcome","id")],Qu);$u.HelixPredictionOutcome=Qu});var bm=l(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.HelixPrediction=void 0;var PP=(_(),g(y)),BF=S(),W=m(),qP=gm(),Wu=class extends W.DataObject{static{n(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[W.rawDataSymbol].id}get broadcasterId(){return this[W.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[W.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[W.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,W.checkRelationAssertion)(await this._client.users.getUserById(this[W.rawDataSymbol].broadcaster_id))}get title(){return this[W.rawDataSymbol].title}get status(){return this[W.rawDataSymbol].status}get autoLockAfter(){return this[W.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[W.rawDataSymbol].created_at)}get endDate(){return this[W.rawDataSymbol].ended_at?new Date(this[W.rawDataSymbol].ended_at):null}get lockDate(){return this[W.rawDataSymbol].locked_at?new Date(this[W.rawDataSymbol].locked_at):null}get outcomes(){return this[W.rawDataSymbol].outcomes.map(e=>new qP.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[W.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[W.rawDataSymbol].winning_outcome_id)return null;let e=this[W.rawDataSymbol].outcomes.find(t=>t.id===this[W.rawDataSymbol].winning_outcome_id);if(!e)throw new W.HellFreezesOverError("Winning outcome not found in outcomes array");return new qP.HelixPredictionOutcome(e,this._client)}};PP.__decorate([(0,BF.Enumerable)(!1)],Wu.prototype,"_client",void 0);Wu=PP.__decorate([(0,W.rtfm)("api","HelixPrediction","id")],Wu);Vu.HelixPrediction=Wu});var wm=l(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.HelixPredictionApi=void 0;var UF=(_(),g(y)),CP=G(),li=m(),jF=Ee(),HP=wP(),kF=ae(),LF=ee(),FF=Z(),MF=L(),fn=bm(),vm=class extends MF.BaseApi{static{n(this,"HelixPredictionApi")}async getPredictions(e,t){let i=await this._client.callApi({type:"helix",url:"predictions",userId:(0,li.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,CP.createBroadcasterQuery)(e),...(0,FF.createPaginationQuery)(t)}});return(0,LF.createPaginatedResult)(i,fn.HelixPrediction,this._client)}getPredictionsPaginated(e){return new kF.HelixPaginatedRequest({url:"predictions",userId:(0,li.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,CP.createBroadcasterQuery)(e)},this._client,t=>new fn.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,li.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,jF.createGetByIdsQuery)(e,t)})).data.map(a=>new fn.HelixPrediction(a,this._client)):[]}async getPredictionById(e,t){let i=await this.getPredictionsByIds(e,[t]);return i.length?i[0]:null}async createPrediction(e,t){let i=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:(0,li.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,HP.createPredictionBody)(e,t)});return new fn.HelixPrediction(i.data[0],this._client)}async lockPrediction(e,t){return await this._endPrediction(e,t,"LOCKED")}async resolvePrediction(e,t,i){return await this._endPrediction(e,t,"RESOLVED",i)}async cancelPrediction(e,t){return await this._endPrediction(e,t,"CANCELED")}async _endPrediction(e,t,i,a){let o=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:(0,li.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,HP.createEndPredictionBody)(e,t,i,a)});return new fn.HelixPrediction(o.data[0],this._client)}};vm=UF.__decorate([(0,li.rtfm)("api","HelixPredictionApi")],vm);zu.HelixPredictionApi=vm});var AP=l(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.createRaidStartQuery=void 0;var EP=m();function NF(r,e){return{from_broadcaster_id:(0,EP.extractUserId)(r),to_broadcaster_id:(0,EP.extractUserId)(e)}}n(NF,"createRaidStartQuery");Ku.createRaidStartQuery=NF});var Sm=l(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.HelixRaid=void 0;var GF=(_(),g(y)),Ju=m(),xm=class extends Ju.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[Ju.rawDataSymbol].created_at)}get targetIsMature(){return this[Ju.rawDataSymbol].is_mature}};xm=GF.__decorate([(0,Ju.rtfm)("api","HelixRaid")],xm);Zu.HelixRaid=xm});var Cm=l(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.HelixRaidApi=void 0;var QF=(_(),g(y)),$F=G(),qm=m(),WF=AP(),VF=L(),zF=Sm(),Pm=class extends VF.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let i=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,qm.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,WF.createRaidStartQuery)(e,t)});return new zF.HelixRaid(i.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,qm.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,$F.createBroadcasterQuery)(e)})}};Pm=QF.__decorate([(0,qm.rtfm)("api","HelixRaidApi")],Pm);Xu.HelixRaidApi=Pm});var Hm=l(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.createScheduleSegmentUpdateBody=Ne.createScheduleSegmentModifyQuery=Ne.createScheduleSegmentBody=Ne.createScheduleSettingsUpdateQuery=Ne.createScheduleQuery=void 0;var Yu=m();function KF(r,e){var t;return{broadcaster_id:(0,Yu.extractUserId)(r),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(KF,"createScheduleQuery");Ne.createScheduleQuery=KF;function JF(r,e){return e.vacation?{broadcaster_id:(0,Yu.extractUserId)(r),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:(0,Yu.extractUserId)(r),is_vacation_enabled:"false"}}n(JF,"createScheduleSettingsUpdateQuery");Ne.createScheduleSettingsUpdateQuery=JF;function ZF(r){return{start_time:r.startDate,timezone:r.timezone,is_recurring:r.isRecurring,duration:r.duration,category_id:r.categoryId,title:r.title}}n(ZF,"createScheduleSegmentBody");Ne.createScheduleSegmentBody=ZF;function XF(r,e){return{broadcaster_id:(0,Yu.extractUserId)(r),id:e}}n(XF,"createScheduleSegmentModifyQuery");Ne.createScheduleSegmentModifyQuery=XF;function YF(r){return{start_time:r.startDate,timezone:r.timezone,is_canceled:r.isCanceled,duration:r.duration,category_id:r.categoryId,title:r.title}}n(YF,"createScheduleSegmentUpdateBody");Ne.createScheduleSegmentUpdateBody=YF});var mn=l(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.HelixScheduleSegment=void 0;var TP=(_(),g(y)),IP=S(),Qe=m(),el=class extends Qe.DataObject{static{n(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[Qe.rawDataSymbol].id}get startDate(){return new Date(this[Qe.rawDataSymbol].start_time)}get endDate(){return new Date(this[Qe.rawDataSymbol].end_time)}get title(){return this[Qe.rawDataSymbol].title}get cancelEndDate(){return(0,IP.mapNullable)(this[Qe.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[Qe.rawDataSymbol].category)===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null}get categoryName(){var e,t;return(t=(e=this[Qe.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[Qe.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[Qe.rawDataSymbol].is_recurring}};TP.__decorate([(0,IP.Enumerable)(!1)],el.prototype,"_client",void 0);el=TP.__decorate([(0,Qe.rtfm)("api","HelixScheduleSegment","id")],el);tl.HelixScheduleSegment=el});var Am=l(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.HelixPaginatedScheduleSegmentRequest=void 0;var eM=(_(),g(y)),tM=m(),rM=Hm(),iM=ae(),nM=mn(),Em=class extends iM.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,i){super({url:"schedule",query:(0,rM.createScheduleQuery)(e,i)},t,a=>new nM.HelixScheduleSegment(a,t),25)}async _fetchData(e={}){var t;let i=await super._fetchData(e);return{data:(t=i.data.segments)!==null&&t!==void 0?t:[],pagination:i.pagination}}};Em=eM.__decorate([(0,tM.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Em);rl.HelixPaginatedScheduleSegmentRequest=Em});var Tm=l(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.HelixSchedule=void 0;var RP=(_(),g(y)),aM=S(),ut=m(),oM=mn(),il=class extends ut.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[ut.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(i=>new oM.HelixScheduleSegment(i,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[ut.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ut.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ut.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ut.checkRelationAssertion)(await this._client.users.getUserById(this[ut.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[ut.rawDataSymbol].vacation)===null||e===void 0?void 0:e.start_time;return t?new Date(t):null}get vacationEndDate(){var e;let t=(e=this[ut.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};RP.__decorate([(0,aM.Enumerable)(!1)],il.prototype,"_client",void 0);il=RP.__decorate([(0,ut.rtfm)("api","HelixSchedule","broadcasterId")],il);nl.HelixSchedule=il});var Dm=l(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.HelixScheduleApi=void 0;var DP=G(),ci=m(),sM=Ee(),di=Hm(),uM=Z(),lM=L(),cM=Am(),dM=Tm(),Im=mn(),Rm=class extends lM.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let i=await this._client.callApi({type:"helix",url:"schedule",userId:(0,ci.extractUserId)(e),query:{...(0,di.createScheduleQuery)(e,t),...(0,uM.createPaginationQuery)(t)}});return{data:new dM.HelixSchedule(i.data,this._client),cursor:i.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new cM.HelixPaginatedScheduleSegmentRequest(e,this._client,t)}async getScheduleSegmentsByIds(e,t){var i,a;return(a=(i=(await this._client.callApi({type:"helix",url:"schedule",userId:(0,ci.extractUserId)(e),query:(0,sM.createGetByIdsQuery)(e,t)})).data.segments)===null||i===void 0?void 0:i.map(s=>new Im.HelixScheduleSegment(s,this._client)))!==null&&a!==void 0?a:[]}async getScheduleSegmentById(e,t){let i=await this.getScheduleSegmentsByIds(e,[t]);return i.length?i[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:(0,DP.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,ci.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,di.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let i=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,ci.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,DP.createBroadcasterQuery)(e),jsonBody:(0,di.createScheduleSegmentBody)(t)});return new Im.HelixScheduleSegment(i.data.segments[0],this._client)}async updateScheduleSegment(e,t,i){let a=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:(0,ci.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,di.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,di.createScheduleSegmentUpdateBody)(i)});return new Im.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,ci.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,di.createScheduleSegmentModifyQuery)(e,t)})}};al.HelixScheduleApi=Rm});var OP=l(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.createSearchChannelsQuery=void 0;function pM(r,e){var t;return{query:r,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(pM,"createSearchChannelsQuery");ol.createSearchChannelsQuery=pM});var Om=l(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.HelixChannelSearchResult=void 0;var BP=(_(),g(y)),hM=S(),le=m(),sl=class extends le.DataObject{static{n(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[le.rawDataSymbol].broadcaster_language}get id(){return this[le.rawDataSymbol].id}get name(){return this[le.rawDataSymbol].broadcaster_login}get displayName(){return this[le.rawDataSymbol].display_name}async getUser(){return(0,le.checkRelationAssertion)(await this._client.users.getUserById(this[le.rawDataSymbol].id))}get gameId(){return this[le.rawDataSymbol].game_id}get gameName(){return this[le.rawDataSymbol].game_name}async getGame(){return this[le.rawDataSymbol].game_id?(0,le.checkRelationAssertion)(await this._client.games.getGameById(this[le.rawDataSymbol].game_id)):null}get isLive(){return this[le.rawDataSymbol].is_live}get tags(){return this[le.rawDataSymbol].tags}get thumbnailUrl(){return this[le.rawDataSymbol].thumbnail_url}get startDate(){return this[le.rawDataSymbol].is_live?new Date(this[le.rawDataSymbol].started_at):null}};BP.__decorate([(0,hM.Enumerable)(!1)],sl.prototype,"_client",void 0);sl=BP.__decorate([(0,le.rtfm)("api","HelixChannelSearchResult","id")],sl);ul.HelixChannelSearchResult=sl});var Um=l(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.HelixSearchApi=void 0;var fM=(_(),g(y)),mM=m(),UP=OP(),jP=ae(),kP=ee(),LP=Z(),yM=L(),FP=mu(),MP=Om(),Bm=class extends yM.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let i=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,LP.createPaginationQuery)(t)}});return(0,kP.createPaginatedResult)(i,FP.HelixGame,this._client)}searchCategoriesPaginated(e){return new jP.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new FP.HelixGame(t,this._client))}async searchChannels(e,t={}){let i=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,UP.createSearchChannelsQuery)(e,t),...(0,LP.createPaginationQuery)(t)}});return(0,kP.createPaginatedResult)(i,MP.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new jP.HelixPaginatedRequest({url:"search/channels",query:(0,UP.createSearchChannelsQuery)(e,t)},this._client,i=>new MP.HelixChannelSearchResult(i,this._client))}};Bm=fM.__decorate([(0,mM.rtfm)("api","HelixSearchApi")],Bm);ll.HelixSearchApi=Bm});var km=l(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.StreamNotLiveError=void 0;var _M=m(),jm=class extends _M.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};cl.StreamNotLiveError=jm});var NP=l(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.createVideoQuery=Vt.createStreamMarkerBody=Vt.createStreamQuery=void 0;var gM=m();function bM(r){return{game_id:r.game,language:r.language,type:r.type,user_id:r.userId,user_login:r.userName}}n(bM,"createStreamQuery");Vt.createStreamQuery=bM;function vM(r,e){return{user_id:(0,gM.extractUserId)(r),description:e}}n(vM,"createStreamMarkerBody");Vt.createStreamMarkerBody=vM;function wM(r){return{video_id:r}}n(wM,"createVideoQuery");Vt.createVideoQuery=wM});var Lm=l(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.HelixStream=void 0;var GP=(_(),g(y)),xM=S(),V=m(),dl=class extends V.DataObject{static{n(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[V.rawDataSymbol].id}get userId(){return this[V.rawDataSymbol].user_id}get userName(){return this[V.rawDataSymbol].user_login}get userDisplayName(){return this[V.rawDataSymbol].user_name}async getUser(){return(0,V.checkRelationAssertion)(await this._client.users.getUserById(this[V.rawDataSymbol].user_id))}get gameId(){return this[V.rawDataSymbol].game_id}get gameName(){return this[V.rawDataSymbol].game_name}async getGame(){return this[V.rawDataSymbol].game_id?(0,V.checkRelationAssertion)(await this._client.games.getGameById(this[V.rawDataSymbol].game_id)):null}get type(){return this[V.rawDataSymbol].type}get title(){return this[V.rawDataSymbol].title}get viewers(){return this[V.rawDataSymbol].viewer_count}get startDate(){return new Date(this[V.rawDataSymbol].started_at)}get language(){return this[V.rawDataSymbol].language}get thumbnailUrl(){return this[V.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[V.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[V.rawDataSymbol].tags}get isMature(){return this[V.rawDataSymbol].is_mature}};GP.__decorate([(0,xM.Enumerable)(!1)],dl.prototype,"_client",void 0);dl=GP.__decorate([(0,V.rtfm)("api","HelixStream","id")],dl);pl.HelixStream=dl});var ml=l(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.HelixStreamMarker=void 0;var QP=(_(),g(y)),SM=S(),pi=m(),hl=class extends pi.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[pi.rawDataSymbol].id}get creationDate(){return new Date(this[pi.rawDataSymbol].created_at)}get description(){return this[pi.rawDataSymbol].description}get positionInSeconds(){return this[pi.rawDataSymbol].position_seconds}};QP.__decorate([(0,SM.Enumerable)(!1)],hl.prototype,"_client",void 0);hl=QP.__decorate([(0,pi.rtfm)("api","HelixStreamMarker","id")],hl);fl.HelixStreamMarker=hl});var Nm=l(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.HelixStreamMarkerWithVideo=void 0;var qM=(_(),g(y)),Fm=m(),PM=ml(),Mm=class extends PM.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,i){super(e,i),this._videoId=t}get url(){return this[Fm.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,Fm.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};Mm=qM.__decorate([(0,Fm.rtfm)("api","HelixStreamMarkerWithVideo","id")],Mm);yl.HelixStreamMarkerWithVideo=Mm});var Qm=l(vl=>{"use strict";var fi;Object.defineProperty(vl,"__esModule",{value:!0});vl.HelixStreamApi=void 0;var Gm=(_(),g(y)),yn=S(),$P=G(),Pe=m(),CM=km(),_l=Ee(),hi=NP(),WP=Ut(),gl=ae(),VP=ee(),bl=Z(),HM=L(),hr=Lm(),EM=ml(),AM=Nm(),_n=fi=class extends HM.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new WP.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new hr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new WP.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new hr.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,hi.createStreamQuery)(e),...(0,bl.createPaginationQuery)(e)}});return(0,VP.createPaginatedResult)(t,hr.HelixStream,this._client)}getStreamsPaginated(e={}){return new gl.HelixPaginatedRequest({url:"streams",query:(0,hi.createStreamQuery)(e)},this._client,t=>new hr.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Pe.extractUserName)})).data}async getStreamByUserName(e){var t;return(t=(await this.getStreamsByUserNames([e]))[0])!==null&&t!==void 0?t:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request((0,Pe.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Pe.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Pe.extractUserId)(e),i=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,hi.createStreamQuery)({userId:t})});return(0,yn.mapNullable)(i.data[0],a=>new hr.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Pe.extractUserId)(e))}async getStreamMarkersForUser(e,t){var i;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,_l.createUserQuery)(e),...(0,bl.createPaginationQuery)(t)},userId:(0,Pe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,yn.flatten)(a.data.map(o=>fi._mapGetStreamMarkersResult(o,this._client))),cursor:(i=a.pagination)===null||i===void 0?void 0:i.cursor}}getStreamMarkersForUserPaginated(e){return new gl.HelixPaginatedRequest({url:"streams/markers",query:(0,_l.createUserQuery)(e),userId:(0,Pe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>fi._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,i){var a;let o=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,hi.createVideoQuery)(t),...(0,bl.createPaginationQuery)(i)},userId:(0,Pe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,yn.flatten)(o.data.map(s=>fi._mapGetStreamMarkersResult(s,this._client))),cursor:(a=o.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new gl.HelixPaginatedRequest({url:"streams/markers",query:(0,hi.createVideoQuery)(t),userId:(0,Pe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,i=>fi._mapGetStreamMarkersResult(i,this._client))}async createStreamMarker(e,t){try{let i=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Pe.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,hi.createStreamMarkerBody)(e,t)});return new EM.HelixStreamMarker(i.data[0],this._client)}catch(i){throw i instanceof $P.HttpStatusCodeError&&i.statusCode===404?new CM.StreamNotLiveError({cause:i}):i}}async getStreamKey(e){let t=(0,Pe.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,$P.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let i=(0,Pe.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:i,scopes:["user:read:follows"],query:{...(0,_l.createSingleKeyQuery)("user_id",i),...(0,bl.createPaginationQuery)(t)}});return(0,VP.createPaginatedResult)(a,hr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Pe.extractUserId)(e);return new gl.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,_l.createSingleKeyQuery)("user_id",t)},this._client,i=>new hr.HelixStream(i,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((i,a)=>[...i,...a.markers.map(o=>new AM.HelixStreamMarkerWithVideo(o,a.video_id,t))],[])}};Gm.__decorate([(0,yn.Enumerable)(!1)],_n.prototype,"_getStreamByUserIdBatcher",void 0);Gm.__decorate([(0,yn.Enumerable)(!1)],_n.prototype,"_getStreamByUserNameBatcher",void 0);_n=fi=Gm.__decorate([(0,Pe.rtfm)("api","HelixStreamApi")],_n);vl.HelixStreamApi=_n});var KP=l(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.createSubscriptionCheckQuery=void 0;var zP=m();function TM(r,e){return{broadcaster_id:(0,zP.extractUserId)(r),user_id:(0,zP.extractUserId)(e)}}n(TM,"createSubscriptionCheckQuery");wl.createSubscriptionCheckQuery=TM});var ql=l(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.HelixUserSubscription=void 0;var JP=(_(),g(y)),IM=S(),zt=m(),xl=class extends zt.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[zt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[zt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[zt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[zt.rawDataSymbol].broadcaster_id)}get isGift(){return this[zt.rawDataSymbol].is_gift}get tier(){return this[zt.rawDataSymbol].tier}};JP.__decorate([(0,IM.Enumerable)(!1)],xl.prototype,"_client",void 0);xl=JP.__decorate([(0,zt.rtfm)("api","HelixUserSubscription","broadcasterId")],xl);Sl.HelixUserSubscription=xl});var Cl=l(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.HelixSubscription=void 0;var RM=(_(),g(y)),X=m(),DM=ql(),$m=class extends DM.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[X.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[X.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[X.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,X.checkRelationAssertion)(await this._client.users.getUserById(this[X.rawDataSymbol].broadcaster_id))}get gifterId(){return this[X.rawDataSymbol].is_gift?this[X.rawDataSymbol].gifter_id:null}get gifterName(){return this[X.rawDataSymbol].is_gift?this[X.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[X.rawDataSymbol].is_gift?this[X.rawDataSymbol].gifter_name:null}async getGifter(){return this[X.rawDataSymbol].is_gift?(0,X.checkRelationAssertion)(await this._client.users.getUserById(this[X.rawDataSymbol].gifter_id)):null}get userId(){return this[X.rawDataSymbol].user_id}get userName(){return this[X.rawDataSymbol].user_login}get userDisplayName(){return this[X.rawDataSymbol].user_name}async getUser(){return(0,X.checkRelationAssertion)(await this._client.users.getUserById(this[X.rawDataSymbol].user_id))}};$m=RM.__decorate([(0,X.rtfm)("api","HelixSubscription","userId")],$m);Pl.HelixSubscription=$m});var Vm=l(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.HelixPaginatedSubscriptionsRequest=void 0;var OM=(_(),g(y)),BM=G(),ZP=m(),UM=Zr(),jM=Cl(),Wm=class extends UM.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,ZP.extractUserId)(e),query:(0,BM.createBroadcasterQuery)(e)},t,i=>new jM.HelixSubscription(i,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Wm=OM.__decorate([(0,ZP.rtfm)("api","HelixPaginatedSubscriptionsRequest")],Wm);Hl.HelixPaginatedSubscriptionsRequest=Wm});var Km=l(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.HelixSubscriptionApi=void 0;var kM=(_(),g(y)),XP=G(),El=m(),LM=Ee(),FM=KP(),MM=ee(),NM=Z(),GM=L(),QM=Vm(),YP=Cl(),$M=ql(),zm=class extends GM.BaseApi{static{n(this,"HelixSubscriptionApi")}async getSubscriptions(e,t){let i=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:(0,El.extractUserId)(e),query:{...(0,XP.createBroadcasterQuery)(e),...(0,NM.createPaginationQuery)(t)}});return{...(0,MM.createPaginatedResultWithTotal)(i,YP.HelixSubscription,this._client),points:i.points}}getSubscriptionsPaginated(e){return new QM.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,El.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,LM.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new YP.HelixSubscription(a,this._client))}async getSubscriptionForUser(e,t){let i=await this.getSubscriptionsForUsers(e,[t]);return i.length?i[0]:null}async checkUserSubscription(e,t){try{let i=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:(0,El.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,FM.createSubscriptionCheckQuery)(t,e)});return new $M.HelixUserSubscription(i.data[0],this._client)}catch(i){if(i instanceof XP.HttpStatusCodeError&&i.statusCode===404)return null;throw i}}};zm=kM.__decorate([(0,El.rtfm)("api","HelixSubscriptionApi")],zm);Al.HelixSubscriptionApi=zm});var Rl=l(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.HelixTeam=void 0;var eC=(_(),g(y)),WM=S(),$e=m(),Tl=class extends $e.DataObject{static{n(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[$e.rawDataSymbol].id}get name(){return this[$e.rawDataSymbol].team_name}get displayName(){return this[$e.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[$e.rawDataSymbol].background_image_url}get bannerUrl(){return this[$e.rawDataSymbol].banner}get creationDate(){return new Date(this[$e.rawDataSymbol].created_at)}get updateDate(){return new Date(this[$e.rawDataSymbol].updated_at)}get info(){return this[$e.rawDataSymbol].info}get logoThumbnailUrl(){return this[$e.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};eC.__decorate([(0,WM.Enumerable)(!1)],Tl.prototype,"_client",void 0);Tl=eC.__decorate([(0,$e.rtfm)("api","HelixTeam","id")],Tl);Il.HelixTeam=Tl});var Zm=l(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.HelixTeamWithUsers=void 0;var VM=(_(),g(y)),tC=m(),zM=$o(),KM=Rl(),Jm=class extends KM.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[tC.rawDataSymbol].users.map(e=>new zM.HelixUserRelation(e,this._client))}};Jm=VM.__decorate([(0,tC.rtfm)("api","HelixTeamWithUsers","id")],Jm);Dl.HelixTeamWithUsers=Jm});var ey=l(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.HelixTeamApi=void 0;var JM=(_(),g(y)),Xm=G(),iC=m(),ZM=L(),XM=Rl(),rC=Zm(),Ym=class extends ZM.BaseApi{static{n(this,"HelixTeamApi")}async getTeamsForBroadcaster(e){var t,i;return(i=(t=(await this._client.callApi({type:"helix",url:"teams/channel",userId:(0,iC.extractUserId)(e),query:(0,Xm.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(o=>new XM.HelixTeam(o,this._client)))!==null&&i!==void 0?i:[]}async getTeamById(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new rC.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof Xm.HttpStatusCodeError&&t.statusCode===500)return null;throw t}}async getTeamByName(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new rC.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof Xm.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Ym=JM.__decorate([(0,iC.rtfm)("api","HelixTeamApi")],Ym);Ol.HelixTeamApi=Ym});var aC=l(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.createUserBlockDeleteQuery=mi.createUserBlockCreateQuery=void 0;var nC=m();function YM(r,e){return{target_user_id:(0,nC.extractUserId)(r),source_context:e.sourceContext,reason:e.reason}}n(YM,"createUserBlockCreateQuery");mi.createUserBlockCreateQuery=YM;function eN(r){return{target_user_id:(0,nC.extractUserId)(r)}}n(eN,"createUserBlockDeleteQuery");mi.createUserBlockDeleteQuery=eN});var jl=l(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.HelixBaseExtension=void 0;var Bl=m(),ty=class extends Bl.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[Bl.rawDataSymbol].id}get version(){return this[Bl.rawDataSymbol].version}get name(){return this[Bl.rawDataSymbol].name}};Ul.HelixBaseExtension=ty});var iy=l(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.HelixInstalledExtension=void 0;var tN=(_(),g(y)),rN=m(),iN=jl(),ry=class extends iN.HelixBaseExtension{static{n(this,"HelixInstalledExtension")}constructor(e,t,i){super(i),this._slotType=e,this._slotId=t}get slotType(){return this._slotType}get slotId(){return this._slotId}};ry=tN.__decorate([(0,rN.rtfm)("api","HelixInstalledExtension","id")],ry);kl.HelixInstalledExtension=ry});var oy=l(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.HelixInstalledExtensionList=void 0;var nN=(_(),g(y)),gn=m(),ny=iy(),ay=class extends gn.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let i=this[gn.rawDataSymbol][e][t];return i.active?new ny.HelixInstalledExtension(e,t,i):null}getExtensionsForSlotType(e){return[...Object.entries(this[gn.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,i])=>new ny.HelixInstalledExtension(e,t,i))}getAllExtensions(){return[...Object.entries(this[gn.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(i=>i[1].active).map(([i,a])=>new ny.HelixInstalledExtension(e,i,a)))}};ay=nN.__decorate([(0,gn.rtfm)("api","HelixInstalledExtensionList")],ay);Ll.HelixInstalledExtensionList=ay});var ly=l(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.HelixUserExtension=void 0;var aN=(_(),g(y)),sy=m(),oN=jl(),uy=class extends oN.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[sy.rawDataSymbol].can_activate}get types(){return this[sy.rawDataSymbol].type}};uy=aN.__decorate([(0,sy.rtfm)("api","HelixUserExtension","id")],uy);Fl.HelixUserExtension=uy});var Gl=l(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.HelixUser=void 0;var oC=(_(),g(y)),sN=S(),We=m(),Ml=class extends We.DataObject{static{n(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[We.rawDataSymbol].id}get name(){return this[We.rawDataSymbol].login}get displayName(){return this[We.rawDataSymbol].display_name}get description(){return this[We.rawDataSymbol].description}get type(){return this[We.rawDataSymbol].type}get broadcasterType(){return this[We.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[We.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[We.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[We.rawDataSymbol].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var t;return(t=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&t!==void 0?t:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var t;return(t=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&t!==void 0?t:null}async isFollowedBy(e){return await this.getChannelFollower(e)!==null}async getSubscriptionTo(e){return await this._client.subscriptions.checkUserSubscription(this,e)}async isSubscribedTo(e){return await this.getSubscriptionTo(e)!==null}async getSubscriber(e){return await this._client.subscriptions.getSubscriptionForUser(this,e)}async hasSubscriber(e){return await this.getSubscriber(e)!==null}};oC.__decorate([(0,sN.Enumerable)(!1)],Ml.prototype,"_client",void 0);Ml=oC.__decorate([(0,We.rtfm)("api","HelixUser","id")],Ml);Nl.HelixUser=Ml});var dy=l(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.HelixPrivilegedUser=void 0;var uN=(_(),g(y)),sC=m(),lN=Gl(),cy=class extends lN.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[sC.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};cy=uN.__decorate([(0,sC.rtfm)("api","HelixPrivilegedUser","id")],cy);Ql.HelixPrivilegedUser=cy});var py=l(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.HelixUserBlock=void 0;var uC=(_(),g(y)),cN=S(),fr=m(),$l=class extends fr.DataObject{static{n(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[fr.rawDataSymbol].user_id}get userName(){return this[fr.rawDataSymbol].user_login}get userDisplayName(){return this[fr.rawDataSymbol].display_name}async getUser(){return(0,fr.checkRelationAssertion)(await this._client.users.getUserById(this[fr.rawDataSymbol].user_id))}};uC.__decorate([(0,cN.Enumerable)(!1)],$l.prototype,"_client",void 0);$l=uC.__decorate([(0,fr.rtfm)("api","HelixUserBlock","userId")],$l);Wl.HelixUserBlock=$l});var my=l(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.HelixUserApi=void 0;var hy=(_(),g(y)),fy=S(),lC=G(),pe=m(),dN=Ee(),cC=aC(),dC=Ut(),pN=ae(),hN=ee(),fN=Z(),mN=L(),pC=oy(),yN=ly(),hC=dy(),Vl=Gl(),fC=py(),bn=class extends mN.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new dC.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new Vl.HelixUser(e,this._client)),this._getUserByNameBatcher=new dC.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new Vl.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(pe.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(pe.extractUserName))}async getUserById(e){let t=(0,pe.extractUserId)(e),i=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,fy.mapNullable)(i.data[0],a=>new Vl.HelixUser(a,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,pe.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,pe.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,pe.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var i;let a=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,pe.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((i=a.data)===null||i===void 0)&&i.length))throw new pe.HellFreezesOverError("Could not get authenticated user");return new hC.HelixPrivilegedUser(a.data[0],this._client)}async updateAuthenticatedUser(e,t){let i=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,pe.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new hC.HelixPrivilegedUser(i.data[0],this._client)}async getBlocks(e,t){let i=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,pe.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,lC.createBroadcasterQuery)(e),...(0,fN.createPaginationQuery)(t)}});return(0,hN.createPaginatedResult)(i,fC.HelixUserBlock,this._client)}getBlocksPaginated(e){return new pN.HelixPaginatedRequest({url:"users/blocks",userId:(0,pe.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,lC.createBroadcasterQuery)(e)},this._client,t=>new fC.HelixUserBlock(t,this._client))}async createBlock(e,t,i={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,pe.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,cC.createUserBlockCreateQuery)(t,i)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,pe.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,cC.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,pe.extractUserId)(e),scopes:t?["user:edit:broadcast"]:["user:read:broadcast","user:edit:broadcast"]})).data.map(a=>new yN.HelixUserExtension(a))}async getActiveExtensions(e,t=!1){let i=(0,pe.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"users/extensions",userId:i,scopes:t?["user:read:broadcast","user:edit:broadcast"]:void 0,query:(0,dN.createSingleKeyQuery)("user_id",i)});return new pC.HelixInstalledExtensionList(a.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let i=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,pe.extractUserId)(e),scopes:["user:edit:broadcast"],jsonBody:{data:t}});return new pC.HelixInstalledExtensionList(i.data)}async _getUsers(e,t){if(t.length===0)return[];let i={[e]:t};return(await this._client.callApi({type:"helix",url:"users",query:i})).data.map(o=>new Vl.HelixUser(o,this._client))}};hy.__decorate([(0,fy.Enumerable)(!1)],bn.prototype,"_getUserByIdBatcher",void 0);hy.__decorate([(0,fy.Enumerable)(!1)],bn.prototype,"_getUserByNameBatcher",void 0);bn=hy.__decorate([(0,pe.rtfm)("api","HelixUserApi")],bn);zl.HelixUserApi=bn});var _y=l(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.HelixVideo=void 0;var yy=(_(),g(y)),mC=Xi(),_N=S(),O=m(),vn=class extends O.DataObject{static{n(this,"HelixVideo")}constructor(e,t){super(e),this._client=t}get id(){return this[O.rawDataSymbol].id}get userId(){return this[O.rawDataSymbol].user_id}get userName(){return this[O.rawDataSymbol].user_login}get userDisplayName(){return this[O.rawDataSymbol].user_name}async getUser(){return(0,O.checkRelationAssertion)(await this._client.users.getUserById(this[O.rawDataSymbol].user_id))}get title(){return this[O.rawDataSymbol].title}get description(){return this[O.rawDataSymbol].description}get creationDate(){return new Date(this[O.rawDataSymbol].created_at)}get publishDate(){return new Date(this[O.rawDataSymbol].published_at)}get url(){return this[O.rawDataSymbol].url}get thumbnailUrl(){return this[O.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[O.rawDataSymbol].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",t.toString())}get isPublic(){return this[O.rawDataSymbol].viewable==="public"}get views(){return this[O.rawDataSymbol].view_count}get language(){return this[O.rawDataSymbol].language}get type(){return this[O.rawDataSymbol].type}get duration(){return this[O.rawDataSymbol].duration}get durationInSeconds(){let e=this[O.rawDataSymbol].duration.match(/\d+[hms]/g);if(!e)throw new O.HellFreezesOverError(`Could not parse duration string: ${this[O.rawDataSymbol].duration}`);return e.map(t=>{let i=/(\d+)([hms])/.exec(t);if(!i)throw new O.HellFreezesOverError(`Could not parse partial duration string: ${t}`);let[,a,o]=i;return parseInt(a,10)*{h:3600,m:60,s:1}[o]}).reduce((t,i)=>t+i)}get streamId(){return this[O.rawDataSymbol].stream_id}get mutedSegmentData(){var e,t;return(t=(e=this[O.rawDataSymbol].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&t!==void 0?t:[]}isMutedAt(e,t,i=!1){if(this[O.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[O.rawDataSymbol].muted_segments.some(o=>o.offset<=e&&e<=o.offset+o.duration);let a=e+t;return i?this[O.rawDataSymbol].muted_segments.some(o=>{let s=o.offset+o.duration;return e<s&&o.offset<a}):this[O.rawDataSymbol].muted_segments.some(o=>{let s=o.offset+o.duration;return o.offset<=e&&a<=s})}};yy.__decorate([(0,_N.Enumerable)(!1)],vn.prototype,"_client",void 0);yy.__decorate([(0,mC.CachedGetter)()],vn.prototype,"durationInSeconds",null);vn=yy.__decorate([mC.Cacheable,(0,O.rtfm)("api","HelixVideo","id")],vn);Kl.HelixVideo=vn});var by=l(Yl=>{"use strict";var Jl;Object.defineProperty(Yl,"__esModule",{value:!0});Yl.HelixVideoApi=void 0;var yC=(_(),g(y)),gN=S(),Zl=m(),bN=Ut(),vN=ae(),wN=ee(),xN=Z(),SN=L(),gy=_y(),Xl=Jl=class extends SN.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new bN.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new gy.HelixVideo(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){let t=await this.getVideosByIds([e]);return t.length?t[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,t={}){let i=(0,Zl.extractUserId)(e);return await this._getVideos("user_id",[i],t)}getVideosByUserPaginated(e,t={}){let i=(0,Zl.extractUserId)(e);return this._getVideosPaginated("user_id",[i],t)}async getVideosByGame(e,t={}){return await this._getVideos("game_id",[e],t)}getVideosByGamePaginated(e,t={}){return this._getVideosPaginated("game_id",[e],t)}async deleteVideosByIds(e,t){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:(0,Zl.extractUserId)(e),query:{id:t}})}async _getVideos(e,t,i={}){if(!t.length)return{data:[]};let a=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?t[0]:void 0,query:{...Jl._makeVideosQuery(e,t,i),...(0,xN.createPaginationQuery)(i)}});return(0,wN.createPaginatedResult)(a,gy.HelixVideo,this._client)}_getVideosPaginated(e,t,i={}){return new vN.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Jl._makeVideosQuery(e,t,i)},this._client,a=>new gy.HelixVideo(a,this._client))}static _makeVideosQuery(e,t,i={}){let{language:a,period:o,orderBy:s,type:u}=i;return{[e]:t,language:a,period:o,sort:s,type:u}}};yC.__decorate([(0,gN.Enumerable)(!1)],Xl.prototype,"_getVideoByIdBatcher",void 0);Xl=Jl=yC.__decorate([(0,Zl.rtfm)("api","HelixVideoApi")],Xl);Yl.HelixVideoApi=Xl});var gC=l(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.createWhisperQuery=void 0;var _C=m();function qN(r,e){return{from_user_id:(0,_C.extractUserId)(r),to_user_id:(0,_C.extractUserId)(e)}}n(qN,"createWhisperQuery");ec.createWhisperQuery=qN});var wy=l(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.HelixWhisperApi=void 0;var PN=(_(),g(y)),bC=m(),CN=gC(),HN=L(),vy=class extends HN.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,i){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,bC.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,CN.createWhisperQuery)(e,t),jsonBody:{message:i}})}};vy=PN.__decorate([(0,bC.rtfm)("api","HelixWhisperApi")],vy);tc.HelixWhisperApi=vy});var Sy=l(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.ApiReportedRequest=void 0;var xy=class{static{n(this,"ApiReportedRequest")}constructor(e,t,i){this._options=e,this._httpStatus=t,this._resolvedUserId=i}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}};rc.ApiReportedRequest=xy});var ac=l(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.BaseApiClient=void 0;var F=(_(),g(y)),M=Xi(),EN=za(),AN=S(),TN=ah(),yi=G(),ic=Sh(),vC=m(),IN=K0(),RN=Ih(),DN=Nh(),ON=Wh(),BN=Xh(),UN=mf(),jN=bf(),kN=Sf(),LN=Ef(),FN=Rf(),MN=Lf(),NN=Nf(),GN=$f(),QN=Kf(),$N=dm(),WN=ym(),VN=wm(),zN=Cm(),KN=Dm(),JN=Um(),ZN=Qm(),XN=Km(),YN=ey(),eG=my(),tG=by(),rG=wy(),iG=Sy(),j=class extends TN.EventEmitter{static{n(this,"BaseApiClient")}constructor(e,t,i){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=t,this._rateLimiter=i}async requestScopesForUser(e,t){await this._config.authProvider.getAccessTokenForUser(e,...t.map(i=>[i]))}async getTokenInfo(){try{let e=await this.callApi({type:"auth",url:"validate"});return new ic.TokenInfo(e)}catch(e){throw e instanceof yi.HttpStatusCodeError&&e.statusCode===401?new ic.InvalidTokenError({cause:e}):e}}async callApi(e){var t;let{authProvider:i}=this._config;if(!((t=e.auth)!==null&&t!==void 0?t:!0))return await(0,yi.callTwitchApi)(e,i.clientId,void 0,void 0,this._config.fetchOptions);let o=!1;if(e.forceType)switch(e.forceType){case"app":{if(!i.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");let c=await i.getAppAccessToken();return await this._callApiUsingInitialToken(e,c)}case"user":{o=!0;break}default:throw new vC.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(o=!0),o){let c=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!c)throw new Error("Tried to make an API call with a user context but no context user ID");let p=await i.getAccessTokenForUser(c,e.scopes);if(!p)throw new Error(`Tried to make an API call with a user context for user ID ${c} but no token was found`);if((0,ic.accessTokenIsExpired)(p)&&i.refreshAccessTokenForUser){let h=await i.refreshAccessTokenForUser(c);return await this._callApiUsingInitialToken(e,h,!0)}return await this._callApiUsingInitialToken(e,p)}let s=this._getUserIdFromRequestContext(e.userId),u=s===null?await i.getAnyAccessToken():await i.getAnyAccessToken(s??e.userId);if((0,ic.accessTokenIsExpired)(u)&&u.userId&&i.refreshAccessTokenForUser){let c=await i.refreshAccessTokenForUser(u.userId);return await this._callApiUsingInitialToken(e,c,!0)}return await this._callApiUsingInitialToken(e,u)}get bits(){return new RN.HelixBitsApi(this)}get channels(){return new DN.HelixChannelApi(this)}get channelPoints(){return new ON.HelixChannelPointsApi(this)}get charity(){return new BN.HelixCharityApi(this)}get chat(){return new UN.HelixChatApi(this)}get clips(){return new jN.HelixClipApi(this)}get contentClassificationLabels(){return new kN.HelixContentClassificationLabelApi(this)}get entitlements(){return new LN.HelixEntitlementApi(this)}get eventSub(){return new FN.HelixEventSubApi(this)}get extensions(){return new MN.HelixExtensionsApi(this)}get games(){return new NN.HelixGameApi(this)}get hypeTrain(){return new QN.HelixHypeTrainApi(this)}get goals(){return new GN.HelixGoalApi(this)}get moderation(){return new $N.HelixModerationApi(this)}get polls(){return new WN.HelixPollApi(this)}get predictions(){return new VN.HelixPredictionApi(this)}get raids(){return new zN.HelixRaidApi(this)}get schedule(){return new KN.HelixScheduleApi(this)}get search(){return new JN.HelixSearchApi(this)}get streams(){return new ZN.HelixStreamApi(this)}get subscriptions(){return new XN.HelixSubscriptionApi(this)}get teams(){return new YN.HelixTeamApi(this)}get users(){return new eG.HelixUserApi(this)}get videos(){return new tG.HelixVideoApi(this)}get whispers(){return new rG.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof EN.ResponseBasedRateLimiter?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,t,i=!1){var a;let{authProvider:o}=this._config,{authorizationType:s}=o,u=await this._callApiInternal(e,o.clientId,t.accessToken,s);if(u.status===401&&!i){if(t.userId){if(o.refreshAccessTokenForUser){let c=await o.refreshAccessTokenForUser(t.userId);u=await this._callApiInternal(e,o.clientId,c.accessToken,s)}}else if(o.getAppAccessToken){let c=await o.getAppAccessToken(!0);u=await this._callApiInternal(e,o.clientId,c.accessToken,s)}}return this.emit(this.onRequest,new iG.ApiReportedRequest(e,u.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,yi.handleTwitchApiResponseError)(u,e),await(0,yi.transformTwitchApiResponse)(u)}async _callApiInternal(e,t,i,a){var o,s,u;let{fetchOptions:c}=this._config,p=(o=e.type)!==null&&o!==void 0?o:"helix";this._logger.debug(`Calling ${p} API: ${(s=e.method)!==null&&s!==void 0?s:"GET"} ${e.url}`),this._logger.trace(`Query: ${JSON.stringify(e.query)}`),e.jsonBody&&this._logger.trace(`Request body: ${JSON.stringify(e.jsonBody)}`);let h=IN.operation({retries:3,minTimeout:500,factor:2}),{promise:f,resolve:b,reject:P}=(0,AN.promiseWithResolvers)();h.attempt(async()=>{try{let x=p==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:i,authorizationType:a,fetchOptions:c}):await(0,yi.callTwitchApiRaw)(e,t,i,a,c);!x.ok&&x.status>=500&&x.status<600&&await(0,yi.handleTwitchApiResponseError)(x,e),b(x)}catch(x){if(h.retry(x))return;P(h.mainError())}});let w=await f;return this._logger.debug(`Called ${p} API: ${(u=e.method)!==null&&u!==void 0?u:"GET"} ${e.url} - result: ${w.status}`),w}};F.__decorate([(0,M.CachedGetter)()],j.prototype,"bits",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"channels",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"channelPoints",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"charity",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"chat",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"clips",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"contentClassificationLabels",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"entitlements",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"eventSub",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"extensions",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"games",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"hypeTrain",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"goals",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"moderation",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"polls",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"predictions",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"raids",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"schedule",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"search",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"streams",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"subscriptions",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"teams",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"users",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"videos",null);F.__decorate([(0,M.CachedGetter)()],j.prototype,"whispers",null);j=F.__decorate([M.Cacheable,(0,vC.rtfm)("api","ApiClient")],j);nc.BaseApiClient=j});var wC=l(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.NoContextApiClient=void 0;var nG=(_(),g(y)),aG=m(),oG=ac(),qy=class extends oG.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};qy=nG.__decorate([(0,aG.rtfm)("api","ApiClient")],qy);oc.NoContextApiClient=qy});var xC=l(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.UserContextApiClient=void 0;var sG=(_(),g(y)),uG=m(),lG=ac(),Py=class extends lG.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,i,a){super(e,t,i),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Py=sG.__decorate([(0,uG.rtfm)("api","ApiClient")],Py);sc.UserContextApiClient=Py});var CC=l(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.ApiClient=void 0;var cG=(_(),g(y)),dG=wi(),pG=Si(),SC=za(),hG=G(),PC=m(),fG=eh(),mG=H0(),yG=ac(),_G=wC(),qC=xC(),Cy=class extends yG.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new fG.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,pG.createLogger)({name:"twurple:api:client",...e.logger}),dG.isNode?new SC.PartitionedRateLimiter({getPartitionKey:i=>{var a;return(a=i.userId)!==null&&a!==void 0?a:null},createChild:()=>new mG.HelixRateLimiter({logger:t})}):new SC.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:async({options:i,clientId:a,accessToken:o,authorizationType:s,fetchOptions:u})=>await(0,hG.callTwitchApiRaw)(i,a,o,s,u),getPartitionKey:i=>{var a;return(a=i.userId)!==null&&a!==void 0?a:null}}))}async asUser(e,t){let i=new qC.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,PC.extractUserId)(e));return await t(i)}async asIntent(e,t){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(let i of e){let a=await this._authProvider.getAccessTokenForIntent(i);if(a){let o=new qC.UserContextApiClient(this._config,this._logger,this._rateLimiter,a.userId);return await t(o)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){let t=new _G.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};Cy=cG.__decorate([(0,PC.rtfm)("api","ApiClient")],Cy);uc.ApiClient=Cy});var EC=l(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.HelixFollow=void 0;var HC=(_(),g(y)),gG=S(),De=m(),lc=class extends De.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[De.rawDataSymbol].from_id}get userName(){return this[De.rawDataSymbol].from_login}get userDisplayName(){return this[De.rawDataSymbol].from_name}async getUser(){return(0,De.checkRelationAssertion)(await this._client.users.getUserById(this[De.rawDataSymbol].from_id))}get followedUserId(){return this[De.rawDataSymbol].to_id}get followedUserName(){return this[De.rawDataSymbol].to_login}get followedUserDisplayName(){return this[De.rawDataSymbol].to_name}async getFollowedUser(){return(0,De.checkRelationAssertion)(await this._client.users.getUserById(this[De.rawDataSymbol].to_id))}get followDate(){return new Date(this[De.rawDataSymbol].followed_at)}};HC.__decorate([(0,gG.Enumerable)(!1)],lc.prototype,"_client",void 0);lc=HC.__decorate([(0,De.rtfm)("api","HelixFollow")],lc);cc.HelixFollow=lc});var AC=l(d=>{"use strict";Object.defineProperty(d,"__esModule",{value:!0});d.HelixBanUser=d.HelixModerator=d.HelixBan=d.HelixModerationApi=d.HelixHypeTrainEvent=d.HelixHypeTrainContribution=d.HelixHypeTrainApi=d.HelixGoal=d.HelixGoalApi=d.HelixGame=d.HelixGameApi=d.HelixExtensionTransaction=d.HelixExtensionBitsProduct=d.HelixExtensionsApi=d.HelixPaginatedEventSubSubscriptionsRequest=d.HelixEventSubSubscription=d.HelixEventSubApi=d.HelixDropsEntitlement=d.HelixEntitlementApi=d.HelixContentClassificationLabel=d.HelixContentClassificationLabelApi=d.HelixClip=d.HelixClipApi=d.HelixPrivilegedChatSettings=d.HelixEmoteFromSet=d.HelixChannelEmote=d.HelixEmote=d.HelixChatChatter=d.HelixChatSettings=d.HelixChatBadgeVersion=d.HelixChatBadgeSet=d.HelixChatApi=d.HelixCharityCampaignAmount=d.HelixCharityCampaignDonation=d.HelixCharityCampaign=d.HelixCharityApi=d.HelixCustomRewardRedemption=d.HelixCustomReward=d.HelixChannelPointsApi=d.HelixChannelReference=d.HelixFollowedChannel=d.HelixChannelFollower=d.HelixChannelEditor=d.HelixChannel=d.HelixChannelApi=d.HelixCheermoteList=d.HelixBitsLeaderboardEntry=d.HelixBitsLeaderboard=d.HelixBitsApi=d.ApiClient=void 0;d.HellFreezesOverError=d.HelixExtension=d.extractUserName=d.extractUserId=d.HelixPaginatedRequestWithTotal=d.HelixPaginatedRequest=d.ApiReportedRequest=d.StreamNotLiveError=d.ConfigError=d.HelixWhisperApi=d.HelixVideo=d.HelixVideoApi=d.HelixUserExtension=d.HelixInstalledExtensionList=d.HelixInstalledExtension=d.HelixBaseExtension=d.HelixUser=d.HelixPrivilegedUser=d.HelixFollow=d.HelixUserBlock=d.HelixUserApi=d.HelixTeamWithUsers=d.HelixTeam=d.HelixTeamApi=d.HelixUserSubscription=d.HelixSubscription=d.HelixSubscriptionApi=d.HelixPaginatedSubscriptionsRequest=d.HelixStreamMarkerWithVideo=d.HelixStreamMarker=d.HelixStream=d.HelixStreamApi=d.HelixChannelSearchResult=d.HelixSearchApi=d.HelixPaginatedScheduleSegmentRequest=d.HelixScheduleSegment=d.HelixSchedule=d.HelixScheduleApi=d.HelixUserRelation=d.HelixRaid=d.HelixRaidApi=d.HelixPredictor=d.HelixPredictionOutcome=d.HelixPrediction=d.HelixPredictionApi=d.HelixPollChoice=d.HelixPoll=d.HelixPollApi=d.HelixShieldModeStatus=d.HelixBlockedTerm=void 0;var bG=CC();Object.defineProperty(d,"ApiClient",{enumerable:!0,get:function(){return bG.ApiClient}});var vG=Ih();Object.defineProperty(d,"HelixBitsApi",{enumerable:!0,get:function(){return vG.HelixBitsApi}});var wG=Ch();Object.defineProperty(d,"HelixBitsLeaderboard",{enumerable:!0,get:function(){return wG.HelixBitsLeaderboard}});var xG=qh();Object.defineProperty(d,"HelixBitsLeaderboardEntry",{enumerable:!0,get:function(){return xG.HelixBitsLeaderboardEntry}});var SG=Eh();Object.defineProperty(d,"HelixCheermoteList",{enumerable:!0,get:function(){return SG.HelixCheermoteList}});var qG=Nh();Object.defineProperty(d,"HelixChannelApi",{enumerable:!0,get:function(){return qG.HelixChannelApi}});var PG=Bh();Object.defineProperty(d,"HelixChannel",{enumerable:!0,get:function(){return PG.HelixChannel}});var CG=Uh();Object.defineProperty(d,"HelixChannelEditor",{enumerable:!0,get:function(){return CG.HelixChannelEditor}});var HG=jh();Object.defineProperty(d,"HelixChannelFollower",{enumerable:!0,get:function(){return HG.HelixChannelFollower}});var EG=kh();Object.defineProperty(d,"HelixFollowedChannel",{enumerable:!0,get:function(){return EG.HelixFollowedChannel}});var AG=Df();Object.defineProperty(d,"HelixChannelReference",{enumerable:!0,get:function(){return AG.HelixChannelReference}});var TG=Wh();Object.defineProperty(d,"HelixChannelPointsApi",{enumerable:!0,get:function(){return TG.HelixChannelPointsApi}});var IG=Gh();Object.defineProperty(d,"HelixCustomReward",{enumerable:!0,get:function(){return IG.HelixCustomReward}});var RG=Qh();Object.defineProperty(d,"HelixCustomRewardRedemption",{enumerable:!0,get:function(){return RG.HelixCustomRewardRedemption}});var DG=Xh();Object.defineProperty(d,"HelixCharityApi",{enumerable:!0,get:function(){return DG.HelixCharityApi}});var OG=zh();Object.defineProperty(d,"HelixCharityCampaign",{enumerable:!0,get:function(){return OG.HelixCharityCampaign}});var BG=Kh();Object.defineProperty(d,"HelixCharityCampaignDonation",{enumerable:!0,get:function(){return BG.HelixCharityCampaignDonation}});var UG=gs();Object.defineProperty(d,"HelixCharityCampaignAmount",{enumerable:!0,get:function(){return UG.HelixCharityCampaignAmount}});var jG=mf();Object.defineProperty(d,"HelixChatApi",{enumerable:!0,get:function(){return jG.HelixChatApi}});var kG=af();Object.defineProperty(d,"HelixChatBadgeSet",{enumerable:!0,get:function(){return kG.HelixChatBadgeSet}});var LG=nf();Object.defineProperty(d,"HelixChatBadgeVersion",{enumerable:!0,get:function(){return LG.HelixChatBadgeVersion}});var FG=Os();Object.defineProperty(d,"HelixChatSettings",{enumerable:!0,get:function(){return FG.HelixChatSettings}});var MG=of();Object.defineProperty(d,"HelixChatChatter",{enumerable:!0,get:function(){return MG.HelixChatChatter}});var NG=un();Object.defineProperty(d,"HelixEmote",{enumerable:!0,get:function(){return NG.HelixEmote}});var GG=tf();Object.defineProperty(d,"HelixChannelEmote",{enumerable:!0,get:function(){return GG.HelixChannelEmote}});var QG=uf();Object.defineProperty(d,"HelixEmoteFromSet",{enumerable:!0,get:function(){return QG.HelixEmoteFromSet}});var $G=df();Object.defineProperty(d,"HelixPrivilegedChatSettings",{enumerable:!0,get:function(){return $G.HelixPrivilegedChatSettings}});var WG=bf();Object.defineProperty(d,"HelixClipApi",{enumerable:!0,get:function(){return WG.HelixClipApi}});var VG=yf();Object.defineProperty(d,"HelixClip",{enumerable:!0,get:function(){return VG.HelixClip}});var zG=Sf();Object.defineProperty(d,"HelixContentClassificationLabelApi",{enumerable:!0,get:function(){return zG.HelixContentClassificationLabelApi}});var KG=wf();Object.defineProperty(d,"HelixContentClassificationLabel",{enumerable:!0,get:function(){return KG.HelixContentClassificationLabel}});var JG=Ef();Object.defineProperty(d,"HelixEntitlementApi",{enumerable:!0,get:function(){return JG.HelixEntitlementApi}});var ZG=qf();Object.defineProperty(d,"HelixDropsEntitlement",{enumerable:!0,get:function(){return ZG.HelixDropsEntitlement}});var XG=Rf();Object.defineProperty(d,"HelixEventSubApi",{enumerable:!0,get:function(){return XG.HelixEventSubApi}});var YG=eu();Object.defineProperty(d,"HelixEventSubSubscription",{enumerable:!0,get:function(){return YG.HelixEventSubSubscription}});var eQ=Tf();Object.defineProperty(d,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:function(){return eQ.HelixPaginatedEventSubSubscriptionsRequest}});var tQ=Lf();Object.defineProperty(d,"HelixExtensionsApi",{enumerable:!0,get:function(){return tQ.HelixExtensionsApi}});var rQ=Bf();Object.defineProperty(d,"HelixExtensionBitsProduct",{enumerable:!0,get:function(){return rQ.HelixExtensionBitsProduct}});var iQ=Uf();Object.defineProperty(d,"HelixExtensionTransaction",{enumerable:!0,get:function(){return iQ.HelixExtensionTransaction}});var nQ=Nf();Object.defineProperty(d,"HelixGameApi",{enumerable:!0,get:function(){return nQ.HelixGameApi}});var aQ=mu();Object.defineProperty(d,"HelixGame",{enumerable:!0,get:function(){return aQ.HelixGame}});var oQ=$f();Object.defineProperty(d,"HelixGoalApi",{enumerable:!0,get:function(){return oQ.HelixGoalApi}});var sQ=Gf();Object.defineProperty(d,"HelixGoal",{enumerable:!0,get:function(){return sQ.HelixGoal}});var uQ=Kf();Object.defineProperty(d,"HelixHypeTrainApi",{enumerable:!0,get:function(){return uQ.HelixHypeTrainApi}});var lQ=Wf();Object.defineProperty(d,"HelixHypeTrainContribution",{enumerable:!0,get:function(){return lQ.HelixHypeTrainContribution}});var cQ=Vf();Object.defineProperty(d,"HelixHypeTrainEvent",{enumerable:!0,get:function(){return cQ.HelixHypeTrainEvent}});var dQ=dm();Object.defineProperty(d,"HelixModerationApi",{enumerable:!0,get:function(){return dQ.HelixModerationApi}});var pQ=tm();Object.defineProperty(d,"HelixBan",{enumerable:!0,get:function(){return pQ.HelixBan}});var hQ=nm();Object.defineProperty(d,"HelixModerator",{enumerable:!0,get:function(){return hQ.HelixModerator}});var fQ=Tu();Object.defineProperty(d,"HelixBanUser",{enumerable:!0,get:function(){return fQ.HelixBanUser}});var mQ=im();Object.defineProperty(d,"HelixBlockedTerm",{enumerable:!0,get:function(){return mQ.HelixBlockedTerm}});var yQ=am();Object.defineProperty(d,"HelixShieldModeStatus",{enumerable:!0,get:function(){return yQ.HelixShieldModeStatus}});var _Q=ym();Object.defineProperty(d,"HelixPollApi",{enumerable:!0,get:function(){return _Q.HelixPollApi}});var gQ=fm();Object.defineProperty(d,"HelixPoll",{enumerable:!0,get:function(){return gQ.HelixPoll}});var bQ=hm();Object.defineProperty(d,"HelixPollChoice",{enumerable:!0,get:function(){return bQ.HelixPollChoice}});var vQ=wm();Object.defineProperty(d,"HelixPredictionApi",{enumerable:!0,get:function(){return vQ.HelixPredictionApi}});var wQ=bm();Object.defineProperty(d,"HelixPrediction",{enumerable:!0,get:function(){return wQ.HelixPrediction}});var xQ=gm();Object.defineProperty(d,"HelixPredictionOutcome",{enumerable:!0,get:function(){return xQ.HelixPredictionOutcome}});var SQ=_m();Object.defineProperty(d,"HelixPredictor",{enumerable:!0,get:function(){return SQ.HelixPredictor}});var qQ=Cm();Object.defineProperty(d,"HelixRaidApi",{enumerable:!0,get:function(){return qQ.HelixRaidApi}});var PQ=Sm();Object.defineProperty(d,"HelixRaid",{enumerable:!0,get:function(){return PQ.HelixRaid}});var CQ=$o();Object.defineProperty(d,"HelixUserRelation",{enumerable:!0,get:function(){return CQ.HelixUserRelation}});var HQ=Dm();Object.defineProperty(d,"HelixScheduleApi",{enumerable:!0,get:function(){return HQ.HelixScheduleApi}});var EQ=Tm();Object.defineProperty(d,"HelixSchedule",{enumerable:!0,get:function(){return EQ.HelixSchedule}});var AQ=mn();Object.defineProperty(d,"HelixScheduleSegment",{enumerable:!0,get:function(){return AQ.HelixScheduleSegment}});var TQ=Am();Object.defineProperty(d,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:function(){return TQ.HelixPaginatedScheduleSegmentRequest}});var IQ=Um();Object.defineProperty(d,"HelixSearchApi",{enumerable:!0,get:function(){return IQ.HelixSearchApi}});var RQ=Om();Object.defineProperty(d,"HelixChannelSearchResult",{enumerable:!0,get:function(){return RQ.HelixChannelSearchResult}});var DQ=Qm();Object.defineProperty(d,"HelixStreamApi",{enumerable:!0,get:function(){return DQ.HelixStreamApi}});var OQ=Lm();Object.defineProperty(d,"HelixStream",{enumerable:!0,get:function(){return OQ.HelixStream}});var BQ=ml();Object.defineProperty(d,"HelixStreamMarker",{enumerable:!0,get:function(){return BQ.HelixStreamMarker}});var UQ=Nm();Object.defineProperty(d,"HelixStreamMarkerWithVideo",{enumerable:!0,get:function(){return UQ.HelixStreamMarkerWithVideo}});var jQ=Vm();Object.defineProperty(d,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:function(){return jQ.HelixPaginatedSubscriptionsRequest}});var kQ=Km();Object.defineProperty(d,"HelixSubscriptionApi",{enumerable:!0,get:function(){return kQ.HelixSubscriptionApi}});var LQ=Cl();Object.defineProperty(d,"HelixSubscription",{enumerable:!0,get:function(){return LQ.HelixSubscription}});var FQ=ql();Object.defineProperty(d,"HelixUserSubscription",{enumerable:!0,get:function(){return FQ.HelixUserSubscription}});var MQ=ey();Object.defineProperty(d,"HelixTeamApi",{enumerable:!0,get:function(){return MQ.HelixTeamApi}});var NQ=Rl();Object.defineProperty(d,"HelixTeam",{enumerable:!0,get:function(){return NQ.HelixTeam}});var GQ=Zm();Object.defineProperty(d,"HelixTeamWithUsers",{enumerable:!0,get:function(){return GQ.HelixTeamWithUsers}});var QQ=my();Object.defineProperty(d,"HelixUserApi",{enumerable:!0,get:function(){return QQ.HelixUserApi}});var $Q=py();Object.defineProperty(d,"HelixUserBlock",{enumerable:!0,get:function(){return $Q.HelixUserBlock}});var WQ=EC();Object.defineProperty(d,"HelixFollow",{enumerable:!0,get:function(){return WQ.HelixFollow}});var VQ=dy();Object.defineProperty(d,"HelixPrivilegedUser",{enumerable:!0,get:function(){return VQ.HelixPrivilegedUser}});var zQ=Gl();Object.defineProperty(d,"HelixUser",{enumerable:!0,get:function(){return zQ.HelixUser}});var KQ=jl();Object.defineProperty(d,"HelixBaseExtension",{enumerable:!0,get:function(){return KQ.HelixBaseExtension}});var JQ=iy();Object.defineProperty(d,"HelixInstalledExtension",{enumerable:!0,get:function(){return JQ.HelixInstalledExtension}});var ZQ=oy();Object.defineProperty(d,"HelixInstalledExtensionList",{enumerable:!0,get:function(){return ZQ.HelixInstalledExtensionList}});var XQ=ly();Object.defineProperty(d,"HelixUserExtension",{enumerable:!0,get:function(){return XQ.HelixUserExtension}});var YQ=by();Object.defineProperty(d,"HelixVideoApi",{enumerable:!0,get:function(){return YQ.HelixVideoApi}});var e2=_y();Object.defineProperty(d,"HelixVideo",{enumerable:!0,get:function(){return e2.HelixVideo}});var t2=wy();Object.defineProperty(d,"HelixWhisperApi",{enumerable:!0,get:function(){return t2.HelixWhisperApi}});var r2=eh();Object.defineProperty(d,"ConfigError",{enumerable:!0,get:function(){return r2.ConfigError}});var i2=km();Object.defineProperty(d,"StreamNotLiveError",{enumerable:!0,get:function(){return i2.StreamNotLiveError}});var n2=Sy();Object.defineProperty(d,"ApiReportedRequest",{enumerable:!0,get:function(){return n2.ApiReportedRequest}});var a2=ae();Object.defineProperty(d,"HelixPaginatedRequest",{enumerable:!0,get:function(){return a2.HelixPaginatedRequest}});var o2=Zr();Object.defineProperty(d,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:function(){return o2.HelixPaginatedRequestWithTotal}});var dc=m();Object.defineProperty(d,"extractUserId",{enumerable:!0,get:function(){return dc.extractUserId}});Object.defineProperty(d,"extractUserName",{enumerable:!0,get:function(){return dc.extractUserName}});Object.defineProperty(d,"HelixExtension",{enumerable:!0,get:function(){return dc.HelixExtension}});Object.defineProperty(d,"HellFreezesOverError",{enumerable:!0,get:function(){return dc.HellFreezesOverError}})});var UC=l((F7,BC)=>{var TC=gc(),s2=wc(),IC=Sn(),Kt=xt(),RC=Sc(),DC=Pc(),OC=Hc(),pc=x_(),{ApiClient:u2}=AC(),{AppTokenAuthProvider:l2}=Sh(),Hy=class{static{n(this,"EmoteFetcher")}constructor(e,t,i){if(i&&i.apiClient)this.apiClient=i.apiClient;else if(e!==void 0&&t!==void 0){let a=new l2(e,t);this.apiClient=new u2({authProvider:a})}this.emotes=new IC,this.channels=new IC,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let i=this.channels.get(e);return i||(i=new s2(this,e),this.channels.set(e,i)),t&&(i.format=t),i}_getRawTwitchEmotes(e){if(!this.apiClient)throw new Error("Client id or client secret not provided.");return e?this.apiClient.chat.getChannelEmotes(e):this.apiClient.chat.getGlobalEmotes()}_cacheTwitchEmote(e,t,i=null){let a=this._setupChannel(e),o=i||new OC(a,t.id,t);return this.emotes.set(o.code,o),a.emotes.set(o.code,o),o}_getRawBTTVEmotes(e){let t=e?Kt.BTTV.Channel(e):Kt.BTTV.Global;return pc.get(t).then(i=>i.data instanceof Array?i.data:[...i.data.channelEmotes,...i.data.sharedEmotes])}_cacheBTTVEmote(e,t,i=null){let a=this._setupChannel(e),o=i||new TC(a,t.id,t);return this.emotes.set(o.code,o),a.emotes.set(o.code,o),o}_getRawFFZEmoteSet(e){let t=Kt.FFZ.Set(e);return pc.get(t).then(i=>i.data.set.emoticons)}_getRawFFZEmotes(e){let t=Kt.FFZ.Channel(e);return pc.get(t).then(i=>{let a=[];for(let o of Object.keys(i.data.sets)){let s=i.data.sets[o];a.push(...s.emoticons)}return a})}_cacheFFZEmote(e,t,i=null){let a=this._setupChannel(e),o=i||new RC(a,t.id,t);return this.emotes.set(o.code,o),a.emotes.set(o.code,o),o}_getRawSevenTVEmotes(e){let t=e?Kt.SevenTV.Channel(e):Kt.SevenTV.Global;return pc.get(t).then(i=>i.data)}_cacheSevenTVEmote(e,t,i,a=null){let o=this._setupChannel(e,i),s=a||new DC(o,t.id,t);return this.emotes.set(s.code,s),o.emotes.set(s.code,s),s}fetchTwitchEmotes(e=null){return this._getRawTwitchEmotes(e).then(t=>{for(let i of t)this._cacheTwitchEmote(e,{code:i.name,id:i.id,formats:i.formats});return this.channels.get(e).emotes.filter(i=>i.type==="twitch")})}fetchBTTVEmotes(e=null){return this._getRawBTTVEmotes(e).then(t=>{for(let i of t)this._cacheBTTVEmote(e,i);return this.channels.get(e).emotes.filter(i=>i.type==="bttv")})}async fetchFFZEmotes(e=null){return this.ffzModifiersFetched||(this.ffzModifiersFetched=!0,await this._getRawFFZEmoteSet(Kt.FFZ.sets.Modifiers).then(t=>{for(let i of t)this._cacheFFZEmote(null,i)})),e?this._getRawFFZEmotes(e).then(t=>{for(let i of t)this._cacheFFZEmote(e,i);return this.channels.get(e).emotes.filter(i=>i.type==="ffz")}):this._getRawFFZEmoteSet(Kt.FFZ.sets.Global).then(t=>{for(let i of t)this._cacheFFZEmote(e,i);return this.channels.get(e).emotes.filter(i=>i.type==="ffz")})}fetchSevenTVEmotes(e=null,t="webp"){return this._getRawSevenTVEmotes(e).then(i=>{if("emotes"in i)for(let a of i.emotes)this._cacheSevenTVEmote(e,a.data,t);else for(let a of i.emote_set.emotes)this._cacheSevenTVEmote(e,a.data,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],i={bttv:{class:TC,cache:(a,o,s)=>this._cacheBTTVEmote(o,null,s)},ffz:{class:RC,cache:(a,o,s)=>this._cacheFFZEmote(o,null,s)},"7tv":{class:DC,cache:(a,o,s)=>this._cacheSevenTVEmote(o,null,a.imageType,s)},twitch:{class:OC,cache:(a,o,s)=>this._cacheTwitchEmote(o,null,s)}};for(let a of e){let{type:o}=a;if(!Object.keys(i).includes(o))throw new TypeError(`Unknown type: ${o}`);let s=i[o].class;this._setupChannel(a.channel_id,o==="7tv"?a.imageType:null);let u=s.fromObject(a,this.channels.get(a.channel_id));i[o].cache(a,a.channel_id,u),t.push(u)}return t}};BC.exports=Hy});var kC=l((N7,jC)=>{var c2=xt(),Ey=class{static{n(this,"EmoteParser")}constructor(e,t={}){this.fetcher=e,this.options=Object.assign({template:"",type:"markdown",match:/:(.+?):/g},t),this._validateOptions(this.options)}_validateOptions(e){if(e.template&&typeof e.template!="string")throw new TypeError("Template must be a string");if(!["markdown","html","bbcode","plain"].includes(e.type))throw new TypeError("Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`");if(!(e.match instanceof RegExp)||!e.match.global)throw new TypeError("Match must be a global RegExp.")}parse(e,t=0){return e.replace(this.options.match,(a,o)=>{let s=this.fetcher.emotes.get(o);if(!s)return a;if(s.modifier)return"";let u=this.options.template||c2.Templates[this.options.type],c=s.toLink(t);return u.replace(/{link}/g,c).replace(/{name}/g,s.code).replace(/{size}/g,t).replace(/{creator}/g,s.ownerName||"global")})}};jC.exports=Ey});var d2=l((Q7,LC)=>{LC.exports={BTTVEmote:gc(),Channel:wc(),Collection:Sn(),Constants:xt(),Emote:yr(),EmoteFetcher:UC(),EmoteParser:kC(),FFZEmote:Sc(),SevenTVEmote:Pc(),TwitchEmote:Hc()}});export default d2();
|
|
19
|
+
Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}};eo.IntermediateUserRemovalError=kc});var Lc=u(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.UnknownIntentError=void 0;var xH=m(),Mc=class extends xH.CustomError{static{a(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};to.UnknownIntentError=Mc});var Gy=u(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.RefreshingAuthProvider=void 0;var Hr=(g(),b(f)),ci=S(),wH=qc(),Ue=m(),Fc=Gs(),Ny=Uc(),vH=jc(),Nc=Ws(),SH=zs(),HH=Lc(),et=li(),Qy=Zs(),Pt=class extends wH.EventEmitter{static{a(this,"RefreshingAuthProvider")}constructor(e){var t;super(),this._userAccessTokens=new Map,this._userTokenFetchers=new Map,this._intentToUserId=new Map,this._userIdToIntents=new Map,this._cachedRefreshFailures=new Set,this.onRefresh=this.registerEvent(),this.onRefreshFailure=this.registerEvent(),this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._redirectUri=e.redirectUri,this._appImpliedScopes=(t=e.appImpliedScopes)!==null&&t!==void 0?t:[],this._appTokenFetcher=new Qy.TokenFetcher(async r=>await this._fetchAppToken(r))}addUser(e,t,r){let n=(0,Ue.extractUserId)(e);if(!t.refreshToken)throw new Error(`Trying to add user ${n} without refresh token`);this._cachedRefreshFailures.delete(n),this._userAccessTokens.set(n,{...t,userId:n}),this._userTokenFetchers.has(n)||this._userTokenFetchers.set(n,new Qy.TokenFetcher(async s=>await this._fetchUserToken(n,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,Fc.accessTokenIsExpired)(e))try{let l=await(0,et.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof Nc.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new Nc.InvalidTokenError;let l=await(0,et.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),d=await(0,et.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,d.userId,l),r=[l,d]}let[n,s]=r;if(!s.userId)throw new SH.InvalidTokenTypeError("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");let o=n.scope?n:{...n,scope:s.scopes};return this.addUser(s.userId,o,t),s.userId}async addUserForCode(e,t){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");let r=await(0,et.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(r,t)}hasUser(e){return this._userTokenFetchers.has((0,Ue.extractUserId)(e))}removeUser(e){let t=(0,Ue.extractUserId)(e);if(this._userIdToIntents.has(t)){let r=this._userIdToIntents.get(t);for(let n of r)this._intentToUserId.delete(n);this._userIdToIntents.delete(t)}this._userAccessTokens.delete(t),this._userTokenFetchers.delete(t),this._cachedRefreshFailures.delete(t)}addIntentsToUser(e,t){let r=(0,Ue.extractUserId)(e);if(!this._userAccessTokens.has(r))throw new Error("Trying to add intents to a user that was not added to this provider");for(let n of t)this._intentToUserId.has(n)&&this._userIdToIntents.get(this._intentToUserId.get(n)).delete(n),this._intentToUserId.set(n,r),this._userIdToIntents.has(r)?this._userIdToIntents.get(r).add(n):this._userIdToIntents.set(r,new Set([n]))}getIntentsForUser(e){let t=(0,Ue.extractUserId)(e);return this._userIdToIntents.has(t)?Array.from(this._userIdToIntents.get(t)):[]}removeIntents(e){var t;for(let r of e)if(this._intentToUserId.has(r)){let n=this._intentToUserId.get(r);(t=this._userIdToIntents.get(n))===null||t===void 0||t.delete(r),this._intentToUserId.delete(r)}}async refreshAccessTokenForUser(e){let t=(0,Ue.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new Ny.CachedRefreshFailureError(t);let r=this._userAccessTokens.get(t);if(!r)throw new Error("Trying to refresh token for user that was not added to the provider");let n=await this._refreshUserTokenWithCallback(t,r.refreshToken);return this._checkIntermediateUserRemoval(t),this._userAccessTokens.set(t,{...n,userId:t}),this.emit(this.onRefresh,t,n),{...n,userId:t}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new HH.UnknownIntentError(e);let t=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(t)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var t;let r=this._userAccessTokens.get((0,Ue.extractUserId)(e));if(!r)throw new Error("Trying to get scopes for user that was not added to the provider");return(t=r.scope)!==null&&t!==void 0?t:[]}async getAccessTokenForUser(e,...t){let r=(0,Ue.extractUserId)(e),n=this._userTokenFetchers.get(r);if(!n)return null;if(this._cachedRefreshFailures.has(r))throw new Ny.CachedRefreshFailureError(r);return(0,et.compareScopeSets)(this.getCurrentScopesForUser(r),t.filter(Boolean)),await n.fetch(...t)}async getAccessTokenForIntent(e,...t){if(!this._intentToUserId.has(e))return null;let r=this._intentToUserId.get(e),n=await this.getAccessTokenForUser(r,...t);if(!n)throw new Ue.HellFreezesOverError(`Found intent ${e} corresponding to user ID ${r} but no token was found`);return{...n,userId:r}}async getAnyAccessToken(e){if(e){let t=(0,Ue.extractUserId)(e);if(this._userAccessTokens.has(t)){let r=await this.getAccessTokenForUser(t);if(!r)throw new Ue.HellFreezesOverError(`Token for user ID ${t} exists but nothing was returned by getAccessTokenForUser`);return{...r,userId:t}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(t=>[t]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new vH.IntermediateUserRemovalError(e)}async _fetchUserToken(e,t){let r=this._userAccessTokens.get(e);if(!r)throw new Error("Trying to get token for user that was not added to the provider");if(r.accessToken&&!(0,Fc.accessTokenIsExpired)(r))try{if(r.scope)return(0,et.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,et.loadAndCompareTokenInfo)(this._clientId,r.accessToken,e,r.scope,t),o={...r,scope:s};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,o),o}catch(s){if(!(s instanceof Nc.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let n=await this.refreshAccessTokenForUser(e);return(0,et.compareScopeSets)(n.scope,t),n}async _refreshUserTokenWithCallback(e,t){try{return await(0,et.refreshUserToken)(this.clientId,this._clientSecret,t)}catch(r){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e,r),r}}async _fetchAppToken(e){if(e.length>0)for(let t of e)if(this._appImpliedScopes.length){if(t.every(r=>!this._appImpliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||(0,Fc.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,et.getAppToken)(this._clientId,this._clientSecret)}};di.RefreshingAuthProvider=Pt;Hr.__decorate([(0,ci.Enumerable)(!1)],Pt.prototype,"_clientSecret",void 0);Hr.__decorate([(0,ci.Enumerable)(!1)],Pt.prototype,"_userAccessTokens",void 0);Hr.__decorate([(0,ci.Enumerable)(!1)],Pt.prototype,"_userTokenFetchers",void 0);Hr.__decorate([(0,ci.Enumerable)(!1)],Pt.prototype,"_appAccessToken",void 0);Hr.__decorate([(0,ci.Enumerable)(!1)],Pt.prototype,"_appTokenFetcher",void 0);di.RefreshingAuthProvider=Pt=Hr.__decorate([(0,Ue.rtfm)("auth","RefreshingAuthProvider","clientId")],Pt)});var Wy=u(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.StaticAuthProvider=void 0;var Qc=(g(),b(f)),Vy=S(),CH=m(),qH=li(),hi=class{static{a(this,"StaticAuthProvider")}constructor(e,t,r){this._clientId=e||"",this._accessToken=typeof t=="string"?{accessToken:t,refreshToken:null,scope:r??[],expiresIn:null,obtainmentTimestamp:Date.now()}:t,this._scopes=r}get clientId(){return this._clientId}async getAccessTokenForUser(e,...t){return await this._getAccessToken(t)}async getAccessTokenForIntent(e,...t){return await this._getAccessToken(t)}async getAnyAccessToken(){return await this._getAccessToken()}getCurrentScopesForUser(){var e;return(e=this._scopes)!==null&&e!==void 0?e:[]}async _getAccessToken(e){let[t,r]=await(0,qH.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};pi.StaticAuthProvider=hi;Qc.__decorate([(0,Vy.Enumerable)(!1)],hi.prototype,"_clientId",void 0);Qc.__decorate([(0,Vy.Enumerable)(!1)],hi.prototype,"_accessToken",void 0);pi.StaticAuthProvider=hi=Qc.__decorate([(0,CH.rtfm)("auth","StaticAuthProvider","clientId")],hi)});var Gc=u(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.UnknownIntentError=T.InvalidTokenTypeError=T.InvalidTokenError=T.IntermediateUserRemovalError=T.CachedRefreshFailureError=T.StaticAuthProvider=T.RefreshingAuthProvider=T.AppTokenAuthProvider=T.TokenInfo=T.TokenFetcher=T.revokeToken=T.refreshUserToken=T.getValidTokenFromProviderForIntent=T.getValidTokenFromProviderForUser=T.getTokenInfo=T.getAppToken=T.exchangeCode=T.getExpiryDateOfAccessToken=T.accessTokenIsExpired=void 0;var $y=Gs();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:function(){return $y.accessTokenIsExpired}});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:function(){return $y.getExpiryDateOfAccessToken}});var Gt=li();Object.defineProperty(T,"exchangeCode",{enumerable:!0,get:function(){return Gt.exchangeCode}});Object.defineProperty(T,"getAppToken",{enumerable:!0,get:function(){return Gt.getAppToken}});Object.defineProperty(T,"getTokenInfo",{enumerable:!0,get:function(){return Gt.getTokenInfo}});Object.defineProperty(T,"getValidTokenFromProviderForUser",{enumerable:!0,get:function(){return Gt.getValidTokenFromProviderForUser}});Object.defineProperty(T,"getValidTokenFromProviderForIntent",{enumerable:!0,get:function(){return Gt.getValidTokenFromProviderForIntent}});Object.defineProperty(T,"refreshUserToken",{enumerable:!0,get:function(){return Gt.refreshUserToken}});Object.defineProperty(T,"revokeToken",{enumerable:!0,get:function(){return Gt.revokeToken}});var EH=Zs();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:function(){return EH.TokenFetcher}});var PH=Tc();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:function(){return PH.TokenInfo}});var AH=Fy();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:function(){return AH.AppTokenAuthProvider}});var DH=Gy();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:function(){return DH.RefreshingAuthProvider}});var TH=Wy();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:function(){return TH.StaticAuthProvider}});var IH=Uc();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:function(){return IH.CachedRefreshFailureError}});var RH=jc();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:function(){return RH.IntermediateUserRemovalError}});var BH=Ws();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:function(){return BH.InvalidTokenError}});var OH=zs();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:function(){return OH.InvalidTokenTypeError}});var UH=Lc();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:function(){return UH.UnknownIntentError}})});var Ky=u((DO,zy)=>{function ke(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}a(ke,"RetryOperation");zy.exports=ke;ke.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};ke.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};ke.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};ke.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};ke.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};ke.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};ke.prototype.start=ke.prototype.try;ke.prototype.errors=function(){return this._errors};ke.prototype.attempts=function(){return this._attempts};ke.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var n=this._errors[r],s=n.message,o=(i[s]||0)+1;i[s]=o,o>=t&&(e=n,t=o)}return e}});var Jy=u(Vt=>{var kH=Ky();Vt.operation=function(i){var e=Vt.timeouts(i);return new kH(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};Vt.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],n=0;n<e.retries;n++)r.push(this.createTimeout(n,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(n,e)),r.sort(function(s,o){return s-o}),r};Vt.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};Vt.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var n=0;n<t.length;n++){var s=t[n],o=i[s];i[s]=a(function(d){var p=Vt.operation(e),h=Array.prototype.slice.call(arguments,1),_=h.pop();h.push(function(H){p.retry(H)||(H&&(arguments[0]=p.mainError()),_.apply(this,arguments))}),p.attempt(function(){d.apply(i,h)})},"retryWrapper").bind(i,o),i[s].options=e}}});var Xy=u((BO,Zy)=>{Zy.exports=Jy()});var Yy=u(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.createBitsLeaderboardQuery=void 0;function jH(i={}){let{count:e=10,period:t="all",startDate:r,contextUserId:n}=i;return{count:e.toString(),period:t,started_at:r?.toISOString(),user_id:n}}a(jH,"createBitsLeaderboardQuery");ro.createBitsLeaderboardQuery=jH});var F=u(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.BaseApi=void 0;var MH=(g(),b(f)),LH=S(),io=class{static{a(this,"BaseApi")}constructor(e){this._client=e}_getUserContextIdWithDefault(e){var t;return(t=this._client._getUserIdFromRequestContext(e))!==null&&t!==void 0?t:e}};no.BaseApi=io;MH.__decorate([(0,LH.Enumerable)(!1)],io.prototype,"_client",void 0)});var Vc=u(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.HelixBitsLeaderboardEntry=void 0;var ef=(g(),b(f)),FH=S(),dt=m(),ao=class extends dt.DataObject{static{a(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[dt.rawDataSymbol].user_id}get userName(){return this[dt.rawDataSymbol].user_login}get userDisplayName(){return this[dt.rawDataSymbol].user_name}get rank(){return this[dt.rawDataSymbol].rank}get amount(){return this[dt.rawDataSymbol].score}async getUser(){return(0,dt.checkRelationAssertion)(await this._client.users.getUserById(this[dt.rawDataSymbol].user_id))}};_i.HelixBitsLeaderboardEntry=ao;ef.__decorate([(0,FH.Enumerable)(!1)],ao.prototype,"_client",void 0);_i.HelixBitsLeaderboardEntry=ao=ef.__decorate([(0,dt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],ao)});var $c=u(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.HelixBitsLeaderboard=void 0;var Wc=(g(),b(f)),tf=ai(),NH=S(),so=m(),QH=Vc(),mi=class extends so.DataObject{static{a(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[so.rawDataSymbol].data.map(e=>new QH.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[so.rawDataSymbol].total}};yi.HelixBitsLeaderboard=mi;Wc.__decorate([(0,NH.Enumerable)(!1)],mi.prototype,"_client",void 0);Wc.__decorate([(0,tf.CachedGetter)()],mi.prototype,"entries",null);yi.HelixBitsLeaderboard=mi=Wc.__decorate([tf.Cacheable,(0,so.rtfm)("api","HelixBitsLeaderboard")],mi)});var Kc=u(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.HelixCheermoteList=void 0;var GH=(g(),b(f)),VH=S(),fi=m(),zc=class extends fi.DataObject{static{a(this,"HelixCheermoteList")}constructor(e){super((0,VH.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:n,state:s,scale:o}=r,{tiers:l}=this[fi.rawDataSymbol][e],d=l.sort((p,h)=>h.min_bits-p.min_bits).find(p=>p.min_bits<=t);if(!d)throw new fi.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:d.images[n][s][o],color:d.color}}getPossibleNames(){return Object.keys(this[fi.rawDataSymbol])}};gi.HelixCheermoteList=zc;gi.HelixCheermoteList=zc=GH.__decorate([(0,fi.rtfm)("api","HelixCheermoteList")],zc)});var Xc=u(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.HelixBitsApi=void 0;var WH=(g(),b(f)),rf=S(),$H=W(),Jc=m(),zH=Yy(),KH=F(),JH=$c(),ZH=Kc(),Zc=class extends KH.BaseApi{static{a(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Jc.extractUserId)(e),scopes:["bits:read"],query:(0,zH.createBitsLeaderboardQuery)(t)});return new JH.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,rf.mapOptional)(e,Jc.extractUserId),query:(0,rf.mapOptional)(e,$H.createBroadcasterQuery)});return new ZH.HelixCheermoteList(t.data)}};bi.HelixBitsApi=Zc;bi.HelixBitsApi=Zc=WH.__decorate([(0,Jc.rtfm)("api","HelixBitsApi")],Zc)});var af=u(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.createFollowedChannelQuery=je.createChannelFollowerQuery=je.createChannelVipUpdateQuery=je.createChannelCommercialBody=je.createChannelUpdateBody=void 0;var nf=S(),Wt=m();function XH(i){var e;return{game_id:i.gameId,broadcaster_language:i.language,title:i.title,delay:(e=i.delay)===null||e===void 0?void 0:e.toString(),tags:i.tags,content_classification_labels:i.contentClassificationLabels,is_branded_content:i.isBrandedContent}}a(XH,"createChannelUpdateBody");je.createChannelUpdateBody=XH;function YH(i,e){return{broadcaster_id:(0,Wt.extractUserId)(i),length:e}}a(YH,"createChannelCommercialBody");je.createChannelCommercialBody=YH;function eC(i,e){return{broadcaster_id:(0,Wt.extractUserId)(i),user_id:(0,Wt.extractUserId)(e)}}a(eC,"createChannelVipUpdateQuery");je.createChannelVipUpdateQuery=eC;function tC(i,e){return{broadcaster_id:(0,Wt.extractUserId)(i),user_id:(0,nf.mapOptional)(e,Wt.extractUserId)}}a(tC,"createChannelFollowerQuery");je.createChannelFollowerQuery=tC;function rC(i,e){return{broadcaster_id:(0,nf.mapOptional)(e,Wt.extractUserId),user_id:(0,Wt.extractUserId)(i)}}a(rC,"createFollowedChannelQuery");je.createFollowedChannelQuery=rC});var Ae=u(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.createChannelUsersCheckQuery=Me.createGetByIdsQuery=Me.createModeratorActionQuery=Me.createUserQuery=Me.createSingleKeyQuery=void 0;var oo=m();function iC(i,e){return{[i]:e}}a(iC,"createSingleKeyQuery");Me.createSingleKeyQuery=iC;function nC(i){return{user_id:(0,oo.extractUserId)(i)}}a(nC,"createUserQuery");Me.createUserQuery=nC;function aC(i,e){return{broadcaster_id:i,moderator_id:e}}a(aC,"createModeratorActionQuery");Me.createModeratorActionQuery=aC;function sC(i,e){return{broadcaster_id:(0,oo.extractUserId)(i),id:e}}a(sC,"createGetByIdsQuery");Me.createGetByIdsQuery=sC;function oC(i,e){return{broadcaster_id:(0,oo.extractUserId)(i),user_id:e.map(oo.extractUserId)}}a(oC,"createChannelUsersCheckQuery");Me.createChannelUsersCheckQuery=oC});var uo=u(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.HelixUserRelation=void 0;var sf=(g(),b(f)),lC=S(),$t=m(),lo=class extends $t.DataObject{static{a(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[$t.rawDataSymbol].user_id}get name(){return this[$t.rawDataSymbol].user_login}get displayName(){return this[$t.rawDataSymbol].user_name}async getUser(){return(0,$t.checkRelationAssertion)(await this._client.users.getUserById(this[$t.rawDataSymbol].user_id))}};xi.HelixUserRelation=lo;sf.__decorate([(0,lC.Enumerable)(!1)],lo.prototype,"_client",void 0);xi.HelixUserRelation=lo=sf.__decorate([(0,$t.rtfm)("api","HelixUserRelation","id")],lo)});var At=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.HelixRequestBatcher=void 0;var uC=(g(),b(f)),Yc=S(),co=class{static{a(this,"HelixRequestBatcher")}constructor(e,t,r,n,s,o=100){this._callOptions=e,this._queryParamName=t,this._matchKey=r,this._mapper=s,this._limitPerRequest=o,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=n,this._delay=n._batchDelay}async request(e){let{promise:t,resolve:r,reject:n}=(0,Yc.promiseWithResolvers)();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:r,reject:n}):this._requestResolversById.set(e,[{resolve:r,reject:n}]),this._waitTimer&&(clearTimeout(this._waitTimer),this._waitTimer=null),this._requestedIds.length>=this._limitPerRequest?this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest)):this._waitTimer=setTimeout(()=>{this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest))},this._delay),await t}async _handleBatch(e){var t;try{let{data:r}=await this._doRequest(e),n=(0,Yc.indexBy)(r,this._matchKey);for(let s of e){for(let o of(t=this._requestResolversById.get(s))!==null&&t!==void 0?t:[])Object.prototype.hasOwnProperty.call(n,s)?o.resolve(this._mapper(n[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async n=>{var s,o;try{let l=await this._doRequest([n]);for(let d of(s=this._requestResolversById.get(n))!==null&&s!==void 0?s:[])d.resolve(l.data.length?this._mapper(l.data[0]):null)}catch(l){for(let d of(o=this._requestResolversById.get(n))!==null&&o!==void 0?o:[])d.reject(l)}this._requestResolversById.delete(n)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}};ho.HelixRequestBatcher=co;uC.__decorate([(0,Yc.Enumerable)(!1)],co.prototype,"_client",void 0)});var te=u(wi=>{"use strict";var ed;Object.defineProperty(wi,"__esModule",{value:!0});wi.HelixPaginatedRequest=void 0;var of=(g(),b(f)),cC=S(),dC=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(ed=Symbol.asyncIterator)!==null&&ed!==void 0?ed:Symbol.for("Symbol.asyncIterator"));var po=class{static{a(this,"HelixPaginatedRequest")}constructor(e,t,r,n=100){this._callOptions=e,this._mapper=r,this._limitPerPage=n,this._isFinished=!1,this._client=t}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];let t=await this._fetchData();return!((e=t.data)===null||e===void 0)&&e.length?this._processResult(t):(this._isFinished=!0,[])}async getAll(){this.reset();let e=[];do{let t=await this.getNext();if(!t.length)break;e.push(...t)}while(this._currentCursor);return this.reset(),e}get currentCursor(){return this._currentCursor}reset(){this._currentCursor=void 0,this._isFinished=!1,this._currentData=void 0}async*[Symbol.asyncIterator](){for(this.reset();;){let e=await this.getNext();if(!e.length)break;yield*e[Symbol.iterator]()}}async _fetchData(e={}){return await this._client.callApi({type:"helix",...this._callOptions,...e,query:{...this._callOptions.query,after:this._currentCursor,first:this._limitPerPage.toString(),...e.query}})}_processResult(e){var t;return this._currentCursor=typeof e.pagination=="string"?e.pagination:(t=e.pagination)===null||t===void 0?void 0:t.cursor,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((r,n)=>{let s=this._mapper(n);return Array.isArray(s)?[...r,...s]:[...r,s]},[])}};wi.HelixPaginatedRequest=po;of.__decorate([(0,cC.Enumerable)(!1)],po.prototype,"_client",void 0);wi.HelixPaginatedRequest=po=of.__decorate([(0,dC.rtfm)("api","HelixPaginatedRequest")],po)});var Cr=u(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.HelixPaginatedRequestWithTotal=void 0;var hC=(g(),b(f)),pC=m(),_C=te(),td=class extends _C.HelixPaginatedRequest{static{a(this,"HelixPaginatedRequestWithTotal")}async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};vi.HelixPaginatedRequestWithTotal=td;vi.HelixPaginatedRequestWithTotal=td=hC.__decorate([(0,pC.rtfm)("api","HelixPaginatedRequestWithTotal")],td)});var re=u(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.createPaginatedResultWithTotal=qr.createPaginatedResult=void 0;function mC(i,e,t){var r;let n;return{get data(){var s,o;return n??(n=(o=(s=i.data)===null||s===void 0?void 0:s.map(l=>new e(l,t)))!==null&&o!==void 0?o:[])},cursor:typeof i.pagination=="string"?i.pagination:(r=i.pagination)===null||r===void 0?void 0:r.cursor}}a(mC,"createPaginatedResult");qr.createPaginatedResult=mC;function yC(i,e,t){let r;return{get data(){var n,s;return r??(r=(s=(n=i.data)===null||n===void 0?void 0:n.map(o=>new e(o,t)))!==null&&s!==void 0?s:[])},cursor:i.pagination.cursor,total:i.total}}a(yC,"createPaginatedResultWithTotal");qr.createPaginatedResultWithTotal=yC});var X=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.createPaginationQuery=void 0;function fC({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}a(fC,"createPaginationQuery");_o.createPaginationQuery=fC});var rd=u(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.HelixChannel=void 0;var lf=(g(),b(f)),gC=S(),se=m(),mo=class extends se.DataObject{static{a(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[se.rawDataSymbol].broadcaster_id}get name(){return this[se.rawDataSymbol].broadcaster_login}get displayName(){return this[se.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,se.checkRelationAssertion)(await this._client.users.getUserById(this[se.rawDataSymbol].broadcaster_id))}get language(){return this[se.rawDataSymbol].broadcaster_language}get gameId(){return this[se.rawDataSymbol].game_id}get gameName(){return this[se.rawDataSymbol].game_name}async getGame(){return this[se.rawDataSymbol].game_id?(0,se.checkRelationAssertion)(await this._client.games.getGameById(this[se.rawDataSymbol].game_id)):null}get title(){return this[se.rawDataSymbol].title}get delay(){return this[se.rawDataSymbol].delay}get tags(){return this[se.rawDataSymbol].tags}get contentClassificationLabels(){return this[se.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[se.rawDataSymbol].is_branded_content}};Si.HelixChannel=mo;lf.__decorate([(0,gC.Enumerable)(!1)],mo.prototype,"_client",void 0);Si.HelixChannel=mo=lf.__decorate([(0,se.rtfm)("api","HelixChannel","id")],mo)});var id=u(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.HelixChannelEditor=void 0;var uf=(g(),b(f)),bC=S(),zt=m(),yo=class extends zt.DataObject{static{a(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[zt.rawDataSymbol].user_id}get userDisplayName(){return this[zt.rawDataSymbol].user_name}async getUser(){return(0,zt.checkRelationAssertion)(await this._client.users.getUserById(this[zt.rawDataSymbol].user_id))}get creationDate(){return new Date(this[zt.rawDataSymbol].created_at)}};Hi.HelixChannelEditor=yo;uf.__decorate([(0,bC.Enumerable)(!1)],yo.prototype,"_client",void 0);Hi.HelixChannelEditor=yo=uf.__decorate([(0,zt.rtfm)("api","HelixChannelEditor","userId")],yo)});var nd=u(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.HelixChannelFollower=void 0;var cf=(g(),b(f)),xC=S(),Dt=m(),fo=class extends Dt.DataObject{static{a(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[Dt.rawDataSymbol].user_id}get userName(){return this[Dt.rawDataSymbol].user_login}get userDisplayName(){return this[Dt.rawDataSymbol].user_name}async getUser(){return(0,Dt.checkRelationAssertion)(await this._client.users.getUserById(this[Dt.rawDataSymbol].user_id))}get followDate(){return new Date(this[Dt.rawDataSymbol].followed_at)}};Ci.HelixChannelFollower=fo;cf.__decorate([(0,xC.Enumerable)(!1)],fo.prototype,"_client",void 0);Ci.HelixChannelFollower=fo=cf.__decorate([(0,Dt.rtfm)("api","HelixChannelFollower","userId")],fo)});var ad=u(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.HelixFollowedChannel=void 0;var df=(g(),b(f)),wC=S(),Tt=m(),go=class extends Tt.DataObject{static{a(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Tt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Tt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Tt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Tt.checkRelationAssertion)(await this._client.users.getUserById(this[Tt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[Tt.rawDataSymbol].followed_at)}};qi.HelixFollowedChannel=go;df.__decorate([(0,wC.Enumerable)(!1)],go.prototype,"_client",void 0);qi.HelixFollowedChannel=go=df.__decorate([(0,Tt.rtfm)("api","HelixFollowedChannel","broadcasterId")],go)});var hf=u(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.HelixAdSchedule=void 0;var vC=(g(),b(f)),It=m(),sd=class extends It.DataObject{static{a(this,"HelixAdSchedule")}get snoozeCount(){return this[It.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[It.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[It.rawDataSymbol].next_ad_at*1e3)}get duration(){return this[It.rawDataSymbol].duration}get lastAdDate(){return new Date(this[It.rawDataSymbol].last_ad_at*1e3)}get prerollFreeTime(){return this[It.rawDataSymbol].preroll_free_time}};Ei.HelixAdSchedule=sd;Ei.HelixAdSchedule=sd=vC.__decorate([(0,It.rtfm)("api","HelixAdSchedule")],sd)});var pf=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.HelixSnoozeNextAdResult=void 0;var SC=(g(),b(f)),Pi=m(),od=class extends Pi.DataObject{static{a(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[Pi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[Pi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[Pi.rawDataSymbol].next_ad_at*1e3)}};Ai.HelixSnoozeNextAdResult=od;Ai.HelixSnoozeNextAdResult=od=SC.__decorate([(0,Pi.rtfm)("api","HelixSnoozeNextAdResult")],od)});var dd=u(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.HelixChannelApi=void 0;var gf=(g(),b(f)),bf=S(),Kt=W(),Y=m(),ht=af(),_f=Ae(),ld=uo(),HC=At(),CC=te(),mf=Cr(),ud=re(),bo=X(),qC=F(),cd=rd(),EC=id(),yf=nd(),ff=ad(),PC=hf(),AC=pf(),xo=class extends qC.BaseApi{static{a(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new HC.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new cd.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,Y.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,Kt.createBroadcasterQuery)(t)});return(0,bf.mapNullable)(r.data[0],n=>new cd.HelixChannel(n,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,Y.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(Y.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,_f.createSingleKeyQuery)("broadcaster_id",t)})).data.map(n=>new cd.HelixChannel(n,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,Y.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,Kt.createBroadcasterQuery)(e),jsonBody:(0,ht.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,Y.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,ht.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,Y.extractUserId)(e),scopes:["channel:read:editors"],query:(0,Kt.createBroadcasterQuery)(e)})).data.map(r=>new EC.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,Y.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,Kt.createBroadcasterQuery)(e),...(0,bo.createPaginationQuery)(t)}});return(0,ud.createPaginatedResult)(r,ld.HelixUserRelation,this._client)}getVipsPaginated(e){return new CC.HelixPaginatedRequest({url:"channels/vips",userId:(0,Y.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,Kt.createBroadcasterQuery)(e)},this._client,t=>new ld.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,Y.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,_f.createChannelUsersCheckQuery)(e,t)})).data.map(n=>new ld.HelixUserRelation(n,this._client))}async checkVipForUser(e,t){let r=(0,Y.extractUserId)(t);return(await this.checkVipForUsers(e,[r])).some(s=>s.id===r)}async addVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:(0,Y.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,ht.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,Y.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,ht.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,Y.extractUserId)(e),query:{...(0,ht.createChannelFollowerQuery)(e),...(0,bo.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){let n=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,Y.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,ht.createChannelFollowerQuery)(e,t),...(0,bo.createPaginationQuery)(r)}});return(0,ud.createPaginatedResultWithTotal)(n,yf.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new mf.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,Y.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,ht.createChannelFollowerQuery)(e)},this._client,t=>new yf.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let n=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,Y.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,ht.createFollowedChannelQuery)(e,t),...(0,bo.createPaginationQuery)(r)}});return(0,ud.createPaginatedResultWithTotal)(n,ff.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new mf.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,Y.extractUserId)(e),scopes:["user:read:follows"],query:(0,ht.createFollowedChannelQuery)(e,t)},this._client,r=>new ff.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,Y.extractUserId)(e),scopes:["channel:read:ads"],query:(0,Kt.createBroadcasterQuery)(e)});return new PC.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,Y.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,Kt.createBroadcasterQuery)(e)});return new AC.HelixSnoozeNextAdResult(t.data[0])}};Di.HelixChannelApi=xo;gf.__decorate([(0,bf.Enumerable)(!1)],xo.prototype,"_getChannelByIdBatcher",void 0);Di.HelixChannelApi=xo=gf.__decorate([(0,Y.rtfm)("api","HelixChannelApi")],xo)});var xf=u(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.createRedemptionsForBroadcasterQuery=Le.createRewardRedemptionsByIdsQuery=Le.createCustomRewardBody=Le.createCustomRewardChangeQuery=Le.createCustomRewardsQuery=void 0;var wo=m();function DC(i,e){return{broadcaster_id:(0,wo.extractUserId)(i),only_manageable_rewards:e?.toString()}}a(DC,"createCustomRewardsQuery");Le.createCustomRewardsQuery=DC;function TC(i,e){return{broadcaster_id:(0,wo.extractUserId)(i),id:e}}a(TC,"createCustomRewardChangeQuery");Le.createCustomRewardChangeQuery=TC;function IC(i){var e,t,r;let n={title:i.title,cost:i.cost,prompt:i.prompt,background_color:i.backgroundColor,is_enabled:i.isEnabled,is_user_input_required:i.userInputRequired,should_redemptions_skip_request_queue:i.autoFulfill};return i.maxRedemptionsPerStream!==void 0&&(n.is_max_per_stream_enabled=!!i.maxRedemptionsPerStream,n.max_per_stream=(e=i.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),i.maxRedemptionsPerUserPerStream!==void 0&&(n.is_max_per_user_per_stream_enabled=!!i.maxRedemptionsPerUserPerStream,n.max_per_user_per_stream=(t=i.maxRedemptionsPerUserPerStream)!==null&&t!==void 0?t:0),i.globalCooldown!==void 0&&(n.is_global_cooldown_enabled=!!i.globalCooldown,n.global_cooldown_seconds=(r=i.globalCooldown)!==null&&r!==void 0?r:0),"isPaused"in i&&(n.is_paused=i.isPaused),n}a(IC,"createCustomRewardBody");Le.createCustomRewardBody=IC;function RC(i,e,t){return{broadcaster_id:(0,wo.extractUserId)(i),reward_id:e,id:t}}a(RC,"createRewardRedemptionsByIdsQuery");Le.createRewardRedemptionsByIdsQuery=RC;function BC(i,e,t,r){return{broadcaster_id:(0,wo.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}a(BC,"createRedemptionsForBroadcasterQuery");Le.createRedemptionsForBroadcasterQuery=BC});var hd=u(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.HelixCustomReward=void 0;var wf=(g(),b(f)),OC=S(),U=m(),vo=class extends U.DataObject{static{a(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[U.rawDataSymbol].id}get broadcasterId(){return this[U.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[U.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[U.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,U.checkRelationAssertion)(await this._client.users.getUserById(this[U.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,r;let n=`url_${e}x`;return(r=(t=this[U.rawDataSymbol].image)===null||t===void 0?void 0:t[n])!==null&&r!==void 0?r:this[U.rawDataSymbol].default_image[n]}get backgroundColor(){return this[U.rawDataSymbol].background_color}get isEnabled(){return this[U.rawDataSymbol].is_enabled}get cost(){return this[U.rawDataSymbol].cost}get title(){return this[U.rawDataSymbol].title}get prompt(){return this[U.rawDataSymbol].prompt}get userInputRequired(){return this[U.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[U.rawDataSymbol].max_per_stream_setting.is_enabled?this[U.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[U.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[U.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[U.rawDataSymbol].global_cooldown_setting.is_enabled?this[U.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[U.rawDataSymbol].is_paused}get isInStock(){return this[U.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[U.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[U.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[U.rawDataSymbol].cooldown_expires_at?new Date(this[U.rawDataSymbol].cooldown_expires_at):null}};Ti.HelixCustomReward=vo;wf.__decorate([(0,OC.Enumerable)(!1)],vo.prototype,"_client",void 0);Ti.HelixCustomReward=vo=wf.__decorate([(0,U.rtfm)("api","HelixCustomReward","id")],vo)});var pd=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.HelixCustomRewardRedemption=void 0;var vf=(g(),b(f)),UC=S(),L=m(),So=class extends L.DataObject{static{a(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[L.rawDataSymbol].id}get broadcasterId(){return this[L.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[L.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[L.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].broadcaster_id))}get userId(){return this[L.rawDataSymbol].user_id}get userName(){return this[L.rawDataSymbol].user_login}get userDisplayName(){return this[L.rawDataSymbol].user_name}async getUser(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].user_id))}get userInput(){return this[L.rawDataSymbol].user_input}get isFulfilled(){return this[L.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[L.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[L.rawDataSymbol].redeemed_at)}get rewardId(){return this[L.rawDataSymbol].reward.id}get rewardTitle(){return this[L.rawDataSymbol].reward.title}get rewardPrompt(){return this[L.rawDataSymbol].reward.prompt}get rewardCost(){return this[L.rawDataSymbol].reward.cost}async getReward(){return(0,L.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[L.rawDataSymbol].broadcaster_id,this[L.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[L.rawDataSymbol].broadcaster_id,this[L.rawDataSymbol].reward.id,[this[L.rawDataSymbol].id],e))[0]}};Ii.HelixCustomRewardRedemption=So;vf.__decorate([(0,UC.Enumerable)(!1)],So.prototype,"_client",void 0);Ii.HelixCustomRewardRedemption=So=vf.__decorate([(0,L.rtfm)("api","HelixCustomRewardRedemption","id")],So)});var md=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.HelixChannelPointsApi=void 0;var kC=(g(),b(f)),jC=W(),tt=m(),pt=xf(),MC=Ae(),LC=te(),FC=re(),NC=X(),QC=F(),Ho=hd(),Co=pd(),_d=class extends QC.BaseApi{static{a(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,tt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,pt.createCustomRewardsQuery)(e,t)})).data.map(n=>new Ho.HelixCustomReward(n,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,tt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,MC.createGetByIdsQuery)(e,t)})).data.map(n=>new Ho.HelixCustomReward(n,this._client)):[]}async getCustomRewardById(e,t){let r=await this.getCustomRewardsByIds(e,[t]);return r.length?r[0]:null}async createCustomReward(e,t){let r=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:(0,tt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,jC.createBroadcasterQuery)(e),jsonBody:(0,pt.createCustomRewardBody)(t)});return new Ho.HelixCustomReward(r.data[0],this._client)}async updateCustomReward(e,t,r){let n=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:(0,tt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,pt.createCustomRewardChangeQuery)(e,t),jsonBody:(0,pt.createCustomRewardBody)(r)});return new Ho.HelixCustomReward(n.data[0],this._client)}async deleteCustomReward(e,t){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:(0,tt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,pt.createCustomRewardChangeQuery)(e,t)})}async getRedemptionsByIds(e,t,r){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,tt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,pt.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new Co.HelixCustomRewardRedemption(s,this._client)):[]}async getRedemptionById(e,t,r){let n=await this.getRedemptionsByIds(e,t,[r]);return n.length?n[0]:null}async getRedemptionsForBroadcaster(e,t,r,n){let s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,tt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,pt.createRedemptionsForBroadcasterQuery)(e,t,r,n),...(0,NC.createPaginationQuery)(n)}});return(0,FC.createPaginatedResult)(s,Co.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,n){return new LC.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,tt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,pt.createRedemptionsForBroadcasterQuery)(e,t,r,n)},this._client,s=>new Co.HelixCustomRewardRedemption(s,this._client),50)}async updateRedemptionStatusByIds(e,t,r,n){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:(0,tt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,pt.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:n}})).data.map(o=>new Co.HelixCustomRewardRedemption(o,this._client)):[]}};Ri.HelixChannelPointsApi=_d;Ri.HelixChannelPointsApi=_d=kC.__decorate([(0,tt.rtfm)("api","HelixChannelPointsApi")],_d)});var qo=u(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.HelixCharityCampaignAmount=void 0;var GC=(g(),b(f)),Bi=m(),yd=class extends Bi.DataObject{static{a(this,"HelixCharityCampaignAmount")}get value(){return this[Bi.rawDataSymbol].value}get decimalPlaces(){return this[Bi.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[Bi.rawDataSymbol].currency}};Oi.HelixCharityCampaignAmount=yd;Oi.HelixCharityCampaignAmount=yd=GC.__decorate([(0,Bi.rtfm)("api","HelixCharityCampaignAmount")],yd)});var fd=u(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixCharityCampaign=void 0;var Hf=(g(),b(f)),VC=S(),Se=m(),Sf=qo(),Eo=class extends Se.DataObject{static{a(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[Se.rawDataSymbol].id}get broadcasterId(){return this[Se.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Se.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Se.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Se.checkRelationAssertion)(await this._client.users.getUserById(this[Se.rawDataSymbol].broadcaster_id))}get charityName(){return this[Se.rawDataSymbol].charity_name}get charityDescription(){return this[Se.rawDataSymbol].charity_description}get charityLogo(){return this[Se.rawDataSymbol].charity_logo}get charityWebsite(){return this[Se.rawDataSymbol].charity_website}get currentAmount(){return new Sf.HelixCharityCampaignAmount(this[Se.rawDataSymbol].current_amount)}get targetAmount(){return new Sf.HelixCharityCampaignAmount(this[Se.rawDataSymbol].target_amount)}};Ui.HelixCharityCampaign=Eo;Hf.__decorate([(0,VC.Enumerable)(!1)],Eo.prototype,"_client",void 0);Ui.HelixCharityCampaign=Eo=Hf.__decorate([(0,Se.rtfm)("api","HelixCharityCampaign","id")],Eo)});var gd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixCharityCampaignDonation=void 0;var Cf=(g(),b(f)),WC=S(),_t=m(),$C=qo(),Po=class extends _t.DataObject{static{a(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[_t.rawDataSymbol].campaign_id}get donorId(){return this[_t.rawDataSymbol].user_id}get donorName(){return this[_t.rawDataSymbol].user_login}get donorDisplayName(){return this[_t.rawDataSymbol].user_name}async getDonor(){return(0,_t.checkRelationAssertion)(await this._client.users.getUserById(this[_t.rawDataSymbol].user_id))}get amount(){return new $C.HelixCharityCampaignAmount(this[_t.rawDataSymbol].amount)}};ki.HelixCharityCampaignDonation=Po;Cf.__decorate([(0,WC.Enumerable)(!1)],Po.prototype,"_client",void 0);ki.HelixCharityCampaignDonation=Po=Cf.__decorate([(0,_t.rtfm)("api","HelixCharityCampaignDonation")],Po)});var wd=u(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.HelixCharityApi=void 0;var zC=(g(),b(f)),qf=W(),bd=m(),KC=re(),JC=X(),ZC=F(),XC=fd(),YC=gd(),xd=class extends ZC.BaseApi{static{a(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,bd.extractUserId)(e),scopes:["channel:read:charity"],query:(0,qf.createBroadcasterQuery)(e)});return new XC.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,bd.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,qf.createBroadcasterQuery)(e),...(0,JC.createPaginationQuery)(t)}});return(0,KC.createPaginatedResult)(r,YC.HelixCharityCampaignDonation,this._client)}};ji.HelixCharityApi=xd;ji.HelixCharityApi=xd=zC.__decorate([(0,bd.rtfm)("api","HelixCharityApi")],xd)});var Ef=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createSendChatMessageBody=Fe.createSendChatMessageQuery=Fe.createShoutoutQuery=Fe.createChatColorUpdateQuery=Fe.createChatSettingsUpdateBody=void 0;var vd=m();function eq(i){return{slow_mode:i.slowModeEnabled,slow_mode_wait_time:i.slowModeDelay,follower_mode:i.followerOnlyModeEnabled,follower_mode_duration:i.followerOnlyModeDelay,subscriber_mode:i.subscriberOnlyModeEnabled,emote_mode:i.emoteOnlyModeEnabled,unique_chat_mode:i.uniqueChatModeEnabled,non_moderator_chat_delay:i.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:i.nonModeratorChatDelay}}a(eq,"createChatSettingsUpdateBody");Fe.createChatSettingsUpdateBody=eq;function tq(i,e){return{user_id:(0,vd.extractUserId)(i),color:e}}a(tq,"createChatColorUpdateQuery");Fe.createChatColorUpdateQuery=tq;function rq(i,e,t){return{from_broadcaster_id:(0,vd.extractUserId)(i),to_broadcaster_id:(0,vd.extractUserId)(e),moderator_id:t}}a(rq,"createShoutoutQuery");Fe.createShoutoutQuery=rq;function iq(i,e){return{broadcaster_id:i,sender_id:e}}a(iq,"createSendChatMessageQuery");Fe.createSendChatMessageQuery=iq;function nq(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}a(nq,"createSendChatMessageBody");Fe.createSendChatMessageBody=nq});var Li=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixEmote=void 0;var aq=(g(),b(f)),De=m(),Sd=class extends De.DataObject{static{a(this,"HelixEmote")}get id(){return this[De.rawDataSymbol].id}get name(){return this[De.rawDataSymbol].name}get formats(){return this[De.rawDataSymbol].format}get scales(){return this[De.rawDataSymbol].scale}get themeModes(){return this[De.rawDataSymbol].theme_mode}getImageUrl(e){return this[De.rawDataSymbol].images[`url_${e}x`]}getStaticImageUrl(e="1.0",t="light"){return this[De.rawDataSymbol].format.includes("static")&&this[De.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[De.rawDataSymbol].format.includes("animated")&&this[De.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"animated",t):null}getFormattedImageUrl(e="1.0",t="static",r="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[De.rawDataSymbol].id}/${t}/${r}/${e}`}};Mi.HelixEmote=Sd;Mi.HelixEmote=Sd=aq.__decorate([(0,De.rtfm)("api","HelixEmote","id")],Sd)});var Hd=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixChannelEmote=void 0;var Pf=(g(),b(f)),sq=S(),Fi=m(),oq=Li(),Ao=class extends oq.HelixEmote{static{a(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[Fi.rawDataSymbol].tier||null}get type(){return this[Fi.rawDataSymbol].emote_type}get emoteSetId(){return this[Fi.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[Fi.rawDataSymbol].emote_set_id])}};Ni.HelixChannelEmote=Ao;Pf.__decorate([(0,sq.Enumerable)(!1)],Ao.prototype,"_client",void 0);Ni.HelixChannelEmote=Ao=Pf.__decorate([(0,Fi.rtfm)("api","HelixChannelEmote","id")],Ao)});var qd=u(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.HelixChatBadgeVersion=void 0;var lq=(g(),b(f)),Rt=m(),Cd=class extends Rt.DataObject{static{a(this,"HelixChatBadgeVersion")}get id(){return this[Rt.rawDataSymbol].id}getImageUrl(e){return this[Rt.rawDataSymbol][`image_url_${e}x`]}get title(){return this[Rt.rawDataSymbol].title}get description(){return this[Rt.rawDataSymbol].description}get clickAction(){return this[Rt.rawDataSymbol].click_action}get clickUrl(){return this[Rt.rawDataSymbol].click_url}};Qi.HelixChatBadgeVersion=Cd;Qi.HelixChatBadgeVersion=Cd=lq.__decorate([(0,Rt.rtfm)("api","HelixChatBadgeVersion","id")],Cd)});var Ed=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixChatBadgeSet=void 0;var Af=(g(),b(f)),Df=ai(),Do=m(),uq=qd(),To=class extends Do.DataObject{static{a(this,"HelixChatBadgeSet")}get id(){return this[Do.rawDataSymbol].set_id}get versions(){return this[Do.rawDataSymbol].versions.map(e=>new uq.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};Gi.HelixChatBadgeSet=To;Af.__decorate([(0,Df.CachedGetter)()],To.prototype,"versions",null);Gi.HelixChatBadgeSet=To=Af.__decorate([Df.Cacheable,(0,Do.rtfm)("api","HelixChatBadgeSet","id")],To)});var Pd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixChatChatter=void 0;var Tf=(g(),b(f)),cq=S(),Jt=m(),Io=class extends Jt.DataObject{static{a(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[Jt.rawDataSymbol].user_id}get userName(){return this[Jt.rawDataSymbol].user_login}get userDisplayName(){return this[Jt.rawDataSymbol].user_name}async getUser(){return(0,Jt.checkRelationAssertion)(await this._client.users.getUserById(this[Jt.rawDataSymbol].user_id))}};Vi.HelixChatChatter=Io;Tf.__decorate([(0,cq.Enumerable)(!1)],Io.prototype,"_client",void 0);Vi.HelixChatChatter=Io=Tf.__decorate([(0,Jt.rtfm)("api","HelixChatChatter")],Io)});var Ro=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixChatSettings=void 0;var dq=(g(),b(f)),rt=m(),Ad=class extends rt.DataObject{static{a(this,"HelixChatSettings")}get broadcasterId(){return this[rt.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[rt.rawDataSymbol].slow_mode}get slowModeDelay(){return this[rt.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[rt.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[rt.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[rt.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[rt.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[rt.rawDataSymbol].unique_chat_mode}};Wi.HelixChatSettings=Ad;Wi.HelixChatSettings=Ad=dq.__decorate([(0,rt.rtfm)("api","HelixChatSettings","broadcasterId")],Ad)});var Dd=u($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.HelixEmoteFromSet=void 0;var If=(g(),b(f)),hq=S(),Zt=m(),pq=Li(),Bo=class extends pq.HelixEmote{static{a(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[Zt.rawDataSymbol].emote_type}get emoteSetId(){return this[Zt.rawDataSymbol].emote_set_id}get ownerId(){switch(this[Zt.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[Zt.rawDataSymbol].owner_id}}async getOwner(){switch(this[Zt.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[Zt.rawDataSymbol].owner_id)}}};$i.HelixEmoteFromSet=Bo;If.__decorate([(0,hq.Enumerable)(!1)],Bo.prototype,"_client",void 0);$i.HelixEmoteFromSet=Bo=If.__decorate([(0,Zt.rtfm)("api","HelixEmoteFromSet","id")],Bo)});var Rd=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixPrivilegedChatSettings=void 0;var _q=(g(),b(f)),Td=m(),mq=Ro(),Id=class extends mq.HelixChatSettings{static{a(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[Td.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[Td.rawDataSymbol].non_moderator_chat_delay_duration}};zi.HelixPrivilegedChatSettings=Id;zi.HelixPrivilegedChatSettings=Id=_q.__decorate([(0,Td.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],Id)});var Od=u(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.HelixSentChatMessage=void 0;var yq=(g(),b(f)),Er=m(),Bd=class extends Er.DataObject{static{a(this,"HelixSentChatMessage")}get id(){return this[Er.rawDataSymbol].message_id}get isSent(){return this[Er.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Er.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Er.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};Ki.HelixSentChatMessage=Bd;Ki.HelixSentChatMessage=Bd=yq.__decorate([(0,Er.rtfm)("api","HelixSentChatMessage","id")],Bd)});var jd=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixChatApi=void 0;var fq=(g(),b(f)),Ud=W(),he=m(),Xt=Ef(),Oo=Ae(),gq=Cr(),bq=re(),xq=X(),wq=F(),vq=Hd(),Rf=Ed(),Bf=Pd(),Sq=Ro(),Hq=Li(),Cq=Dd(),Of=Rd(),Uf=Od(),kd=class extends wq.BaseApi{static{a(this,"HelixChatApi")}async getChatters(e,t){let r=(0,he.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(r),...(0,xq.createPaginationQuery)(t)}});return(0,bq.createPaginatedResultWithTotal)(n,Bf.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,he.extractUserId)(e);return new gq.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Bf.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new Rf.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,he.extractUserId)(e),query:(0,Ud.createBroadcasterQuery)(e)})).data.map(r=>new Rf.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new Hq.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,he.extractUserId)(e),query:(0,Ud.createBroadcasterQuery)(e)})).data.map(r=>new vq.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Oo.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new Cq.HelixEmoteFromSet(r,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,he.extractUserId)(e),query:(0,Ud.createBroadcasterQuery)(e)});return new Sq.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,he.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"chat/settings",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(t)});return new Of.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,he.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(r),jsonBody:(0,Xt.createChatSettingsUpdateBody)(t)});return new Of.HelixPrivilegedChatSettings(n.data[0])}async sendChatMessage(e,t,r){let n=(0,he.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:n,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,Xt.createSendChatMessageQuery)(n,this._getUserContextIdWithDefault(n)),jsonBody:(0,Xt.createSendChatMessageBody)(t,r)});return new Uf.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,n){let s=(0,he.extractUserId)(e),o=(0,he.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,Xt.createSendChatMessageQuery)(o,s),jsonBody:(0,Xt.createSendChatMessageBody)(r,n)});return new Uf.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,he.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(r),jsonBody:{message:t.message,color:t.color}})}async getColorsForUsers(e){let t=await this._client.callApi({type:"helix",url:"chat/color",query:(0,Oo.createSingleKeyQuery)("user_id",e.map(he.extractUserId))});return new Map(t.data.map(r=>[r.user_id,r.color||null]))}async getColorForUser(e){let t=await this._client.callApi({type:"helix",url:"chat/color",userId:(0,he.extractUserId)(e),query:(0,Oo.createSingleKeyQuery)("user_id",(0,he.extractUserId)(e))});if(t.data.length)return t.data[0].color||null}async setColorForUser(e,t){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:(0,he.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,Xt.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,he.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,Xt.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}_createModeratorActionQuery(e){return(0,Oo.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};Ji.HelixChatApi=kd;Ji.HelixChatApi=kd=fq.__decorate([(0,he.rtfm)("api","HelixChatApi")],kd)});var kf=u(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.createClipQuery=Pr.createClipCreateQuery=void 0;var qq=m();function Eq(i,e){return{broadcaster_id:(0,qq.extractUserId)(i),has_delay:e.toString()}}a(Eq,"createClipCreateQuery");Pr.createClipCreateQuery=Eq;function Pq(i){let{filterType:e,ids:t,startDate:r,endDate:n,isFeatured:s}=i;return{[e]:t,started_at:r,ended_at:n,is_featured:s?.toString()}}a(Pq,"createClipQuery");Pr.createClipQuery=Pq});var Md=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixClip=void 0;var jf=(g(),b(f)),Aq=S(),k=m(),Uo=class extends k.DataObject{static{a(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[k.rawDataSymbol].id}get url(){return this[k.rawDataSymbol].url}get embedUrl(){return this[k.rawDataSymbol].embed_url}get broadcasterId(){return this[k.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[k.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,k.checkRelationAssertion)(await this._client.users.getUserById(this[k.rawDataSymbol].broadcaster_id))}get creatorId(){return this[k.rawDataSymbol].creator_id}get creatorDisplayName(){return this[k.rawDataSymbol].creator_name}async getCreator(){return(0,k.checkRelationAssertion)(await this._client.users.getUserById(this[k.rawDataSymbol].creator_id))}get videoId(){return this[k.rawDataSymbol].video_id}async getVideo(){return(0,k.checkRelationAssertion)(await this._client.videos.getVideoById(this[k.rawDataSymbol].video_id))}get gameId(){return this[k.rawDataSymbol].game_id}async getGame(){return this[k.rawDataSymbol].game_id?(0,k.checkRelationAssertion)(await this._client.games.getGameById(this[k.rawDataSymbol].game_id)):null}get language(){return this[k.rawDataSymbol].language}get title(){return this[k.rawDataSymbol].title}get views(){return this[k.rawDataSymbol].view_count}get creationDate(){return new Date(this[k.rawDataSymbol].created_at)}get thumbnailUrl(){return this[k.rawDataSymbol].thumbnail_url}get duration(){return this[k.rawDataSymbol].duration}get vodOffset(){return this[k.rawDataSymbol].vod_offset}get isFeatured(){return this[k.rawDataSymbol].is_featured}};Zi.HelixClip=Uo;jf.__decorate([(0,Aq.Enumerable)(!1)],Uo.prototype,"_client",void 0);Zi.HelixClip=Uo=jf.__decorate([(0,k.rtfm)("api","HelixClip","id")],Uo)});var Nd=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixClipApi=void 0;var Mf=(g(),b(f)),Dq=S(),Ar=m(),Ld=kf(),Tq=At(),Iq=te(),Rq=re(),Bq=X(),Oq=F(),Fd=Md(),ko=class extends Oq.BaseApi{static{a(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new Tq.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Fd.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,Ar.extractUserId)(e),userId:(0,Ar.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,Ar.extractUserId)(e),userId:(0,Ar.extractUserId)(e)})}async getClipsForGame(e,t={}){return await this._getClips({...t,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){let t=await this.getClipsByIds([e]);return t.length?t[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){let{channel:t,createAfterDelay:r=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:(0,Ar.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,Ld.createClipCreateQuery)(t,r)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};let t=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...(0,Ld.createClipQuery)(e),...(0,Bq.createPaginationQuery)(e)}});return(0,Rq.createPaginatedResult)(t,Fd.HelixClip,this._client)}_getClipsPaginated(e){return new Iq.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,Ld.createClipQuery)(e)},this._client,t=>new Fd.HelixClip(t,this._client))}};Xi.HelixClipApi=ko;Mf.__decorate([(0,Dq.Enumerable)(!1)],ko.prototype,"_getClipByIdBatcher",void 0);Xi.HelixClipApi=ko=Mf.__decorate([(0,Ar.rtfm)("api","HelixClipApi")],ko)});var Gd=u(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.HelixContentClassificationLabel=void 0;var jo=m(),Qd=class extends jo.DataObject{static{a(this,"HelixContentClassificationLabel")}get id(){return this[jo.rawDataSymbol].id}get name(){return this[jo.rawDataSymbol].name}get description(){return this[jo.rawDataSymbol].description}};Mo.HelixContentClassificationLabel=Qd});var Wd=u(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.HelixContentClassificationLabelApi=void 0;var Uq=(g(),b(f)),kq=m(),jq=F(),Mq=Gd(),Vd=class extends jq.BaseApi{static{a(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new Mq.HelixContentClassificationLabel(r))}};Yi.HelixContentClassificationLabelApi=Vd;Yi.HelixContentClassificationLabelApi=Vd=Uq.__decorate([(0,kq.rtfm)("api","HelixContentClassificationLabelApi")],Vd)});var Lf=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.createDropsEntitlementUpdateBody=Dr.createDropsEntitlementQuery=void 0;var Lq=S(),Fq=m();function Nq(i,e){return{user_id:e?(0,Lq.mapOptional)(i.user,Fq.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}a(Nq,"createDropsEntitlementQuery");Dr.createDropsEntitlementQuery=Nq;function Qq(i,e){return{fulfillment_status:e,entitlement_ids:i}}a(Qq,"createDropsEntitlementUpdateBody");Dr.createDropsEntitlementUpdateBody=Qq});var $d=u(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.HelixDropsEntitlement=void 0;var Ff=(g(),b(f)),Gq=S(),Te=m(),Lo=class extends Te.DataObject{static{a(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[Te.rawDataSymbol].id}get rewardId(){return this[Te.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[Te.rawDataSymbol].timestamp)}get userId(){return this[Te.rawDataSymbol].user_id}async getUser(){return(0,Te.checkRelationAssertion)(await this._client.users.getUserById(this[Te.rawDataSymbol].user_id))}get gameId(){return this[Te.rawDataSymbol].game_id}async getGame(){return(0,Te.checkRelationAssertion)(await this._client.games.getGameById(this[Te.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[Te.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[Te.rawDataSymbol].last_updated)}};en.HelixDropsEntitlement=Lo;Ff.__decorate([(0,Gq.Enumerable)(!1)],Lo.prototype,"_client",void 0);en.HelixDropsEntitlement=Lo=Ff.__decorate([(0,Te.rtfm)("api","HelixDropsEntitlement")],Lo)});var Zd=u(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.HelixEntitlementApi=void 0;var Nf=(g(),b(f)),Kd=S(),Jd=m(),zd=Lf(),Vq=At(),Wq=te(),$q=re(),zq=X(),Kq=F(),Fo=$d(),No=class extends Kq.BaseApi{static{a(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new Vq.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new Fo.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Kd.mapOptional)(e.user,Jd.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,zd.createDropsEntitlementQuery)(e,t),...(0,zq.createPaginationQuery)(e)}});return(0,$q.createPaginatedResult)(r,Fo.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new Wq.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Kd.mapOptional)(e.user,Jd.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,zd.createDropsEntitlementQuery)(e,t)},this._client,r=>new Fo.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new Fo.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementById(e){var t;return(t=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&t!==void 0?t:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,t){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:(0,zd.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(n=>n.ids.map(s=>[s,n.status])))}};tn.HelixEntitlementApi=No;Nf.__decorate([(0,Kd.Enumerable)(!1)],No.prototype,"_getDropsEntitlementByIdBatcher",void 0);tn.HelixEntitlementApi=No=Nf.__decorate([(0,Jd.rtfm)("api","HelixEntitlementApi")],No)});var Gf=u(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.createEventSubConduitShardsUpdateCondition=oe.createEventSubConduitUpdateCondition=oe.createEventSubConduitCondition=oe.createEventSubDropEntitlementGrantCondition=oe.createEventSubUserCondition=oe.createEventSubModeratorCondition=oe.createEventSubRewardCondition=oe.createEventSubBroadcasterCondition=void 0;var Qf=m();function Jq(i){return{broadcaster_user_id:(0,Qf.extractUserId)(i)}}a(Jq,"createEventSubBroadcasterCondition");oe.createEventSubBroadcasterCondition=Jq;function Zq(i,e){return{broadcaster_user_id:(0,Qf.extractUserId)(i),reward_id:e}}a(Zq,"createEventSubRewardCondition");oe.createEventSubRewardCondition=Zq;function Xq(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}a(Xq,"createEventSubModeratorCondition");oe.createEventSubModeratorCondition=Xq;function Yq(i,e){return{broadcaster_user_id:i,user_id:e}}a(Yq,"createEventSubUserCondition");oe.createEventSubUserCondition=Yq;function eE(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}a(eE,"createEventSubDropEntitlementGrantCondition");oe.createEventSubDropEntitlementGrantCondition=eE;function tE(i,e){return{conduit_id:i,status:e}}a(tE,"createEventSubConduitCondition");oe.createEventSubConduitCondition=tE;function rE(i,e){return{id:i,shard_count:e.toString()}}a(rE,"createEventSubConduitUpdateCondition");oe.createEventSubConduitUpdateCondition=rE;function iE(i,e){return{conduit_id:i,shards:e}}a(iE,"createEventSubConduitShardsUpdateCondition");oe.createEventSubConduitShardsUpdateCondition=iE});var Go=u(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.HelixEventSubSubscription=void 0;var Vf=(g(),b(f)),nE=S(),Ne=m(),Qo=class extends Ne.DataObject{static{a(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[Ne.rawDataSymbol].id}get status(){return this[Ne.rawDataSymbol].status}get type(){return this[Ne.rawDataSymbol].type}get cost(){return this[Ne.rawDataSymbol].cost}get condition(){return this[Ne.rawDataSymbol].condition}get creationDate(){return new Date(this[Ne.rawDataSymbol].created_at)}get transportMethod(){return this[Ne.rawDataSymbol].transport.method}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[Ne.rawDataSymbol].id)}get _transport(){return this[Ne.rawDataSymbol].transport}set _status(e){this[Ne.rawDataSymbol].status=e}};rn.HelixEventSubSubscription=Qo;Vf.__decorate([(0,nE.Enumerable)(!1)],Qo.prototype,"_client",void 0);rn.HelixEventSubSubscription=Qo=Vf.__decorate([(0,Ne.rtfm)("api","HelixEventSubSubscription","id")],Qo)});var Yd=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var aE=(g(),b(f)),sE=m(),oE=Cr(),lE=Go(),Xd=class extends oE.HelixPaginatedRequestWithTotal{static{a(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,n=>new lE.HelixEventSubSubscription(n,r))}async getTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total_cost}async getMaxTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).max_total_cost}};nn.HelixPaginatedEventSubSubscriptionsRequest=Xd;nn.HelixPaginatedEventSubSubscriptionsRequest=Xd=aE.__decorate([(0,sE.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Xd)});var eh=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixEventSubConduit=void 0;var Wf=(g(),b(f)),uE=S(),Yt=m(),Vo=class extends Yt.DataObject{static{a(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[Yt.rawDataSymbol].id}get shardCount(){return this[Yt.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[Yt.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[Yt.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[Yt.rawDataSymbol].id)}};an.HelixEventSubConduit=Vo;Wf.__decorate([(0,uE.Enumerable)(!1)],Vo.prototype,"_client",void 0);an.HelixEventSubConduit=Vo=Wf.__decorate([(0,Yt.rtfm)("api","HelixEventSubConduit")],Vo)});var rh=u(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.HelixEventSubConduitShard=void 0;var cE=(g(),b(f)),sn=m(),th=class extends sn.DataObject{static{a(this,"HelixEventSubConduitShard")}get id(){return this[sn.rawDataSymbol].id}get status(){return this[sn.rawDataSymbol].status}get transportMethod(){return this[sn.rawDataSymbol].transport.method}};on.HelixEventSubConduitShard=th;on.HelixEventSubConduitShard=th=cE.__decorate([(0,sn.rtfm)("api","HelixEventSubConduitShard")],th)});var sh=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixEventSubApi=void 0;var dE=(g(),b(f)),hE=S(),ie=m(),q=Gf(),it=Ae(),pE=te(),ln=re(),un=X(),_E=F(),cn=Go(),Wo=Yd(),ih=eh(),nh=rh(),ah=class extends _E.BaseApi{static{a(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,un.createPaginationQuery)(e)});return{...(0,ln.createPaginatedResultWithTotal)(t,cn.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new Wo.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,un.createPaginationQuery)(t),status:e}});return{...(0,ln.createPaginatedResultWithTotal)(r,cn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Wo.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,un.createPaginationQuery)(t),type:e}});return{...(0,ln.createPaginatedResultWithTotal)(r,cn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Wo.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,ie.extractUserId)(e),query:{...(0,it.createSingleKeyQuery)("user_id",(0,ie.extractUserId)(e)),...(0,un.createPaginationQuery)(t)}});return{...(0,ln.createPaginatedResultWithTotal)(r,cn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,ie.extractUserId)(e);return new Wo.HelixPaginatedEventSubSubscriptionsRequest((0,it.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,n,s,o,l,d){let p=n.method==="webhook"||n.method==="conduit",h=p?void 0:o;if(!p&&!s)throw new Error(`Transport ${n.method} can only handle subscriptions with user context`);let _={type:e,version:t,condition:r,transport:n};d&&(_.is_batching_enabled=!0);let H=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:h,userId:(0,hE.mapOptional)(s,ie.extractUserId),canOverrideScopedUserContext:l,forceType:p?"app":"user",jsonBody:_});return new cn.HelixEventSubSubscription(H.data[0],this._client)}async deleteSubscription(e){await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"DELETE",query:{id:e}})}async deleteAllSubscriptions(){await this._deleteSubscriptionsWithCondition()}async deleteBrokenSubscriptions(){await this._deleteSubscriptionsWithCondition(e=>e.status!=="enabled"&&e.status!=="webhook_callback_verification_pending")}async subscribeToStreamOnlineEvents(e,t){return await this.createSubscription("stream.online","1",(0,q.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,q.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","1",(0,q.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,q.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,q.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,q.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,t){return await this.createSubscription("channel.moderator.add","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,t){return await this.createSubscription("channel.raid","1",(0,it.createSingleKeyQuery)("from_broadcaster_user_id",(0,ie.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,it.createSingleKeyQuery)("to_broadcaster_user_id",(0,ie.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,q.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,q.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,q.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,q.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,q.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,q.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelAdBreakBeginEvents(e,t){return await this.createSubscription("channel.ad_break.begin","1",(0,q.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,q.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,q.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,q.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,q.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,q.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,ie.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,q.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,it.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,it.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,it.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,r){return await this.createSubscription("user.update","1",(0,it.createSingleKeyQuery)("user_id",(0,ie.extractUserId)(e)),t,e,r?["user:read:email"]:void 0)}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,q.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new ih.HelixEventSubConduit(t,this._client))}async createConduit(e){let t=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"POST",query:{...(0,it.createSingleKeyQuery)("shard_count",e.toString())}});return new ih.HelixEventSubConduit(t.data[0],this._client)}async updateConduit(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"PATCH",query:(0,q.createEventSubConduitUpdateCondition)(e,t)});return new ih.HelixEventSubConduit(r.data[0],this._client)}async deleteConduit(e){await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"DELETE",query:{...(0,it.createSingleKeyQuery)("id",e)}})}async getConduitShards(e,t,r){let n=await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",query:{...(0,q.createEventSubConduitCondition)(e,t),...(0,un.createPaginationQuery)(r)}});return{...(0,ln.createPaginatedResult)(n,nh.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new pE.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,q.createEventSubConduitCondition)(e,t)},this._client,r=>new nh.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,q.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(n=>new nh.HelixEventSubConduitShard(n))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};dn.HelixEventSubApi=ah;dn.HelixEventSubApi=ah=dE.__decorate([(0,ie.rtfm)("api","HelixEventSubApi")],ah)});var $f=u(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.createExtensionTransactionQuery=Bt.createExtensionProductBody=Bt.createReleasedExtensionFilter=void 0;function mE(i,e){return{extension_id:i,extension_version:e}}a(mE,"createReleasedExtensionFilter");Bt.createReleasedExtensionFilter=mE;function yE(i){return{sku:i.sku,cost:{amount:i.cost,type:"bits"},display_name:i.displayName,in_development:i.inDevelopment,expiration:i.expirationDate,is_broadcast:i.broadcast}}a(yE,"createExtensionProductBody");Bt.createExtensionProductBody=yE;function fE(i,e){return{extension_id:i,id:e.transactionIds}}a(fE,"createExtensionTransactionQuery");Bt.createExtensionTransactionQuery=fE});var oh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixChannelReference=void 0;var zf=(g(),b(f)),gE=S(),He=m(),$o=class extends He.DataObject{static{a(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[He.rawDataSymbol].broadcaster_id}get displayName(){return this[He.rawDataSymbol].broadcaster_name}async getChannel(){return(0,He.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[He.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,He.checkRelationAssertion)(await this._client.users.getUserById(this[He.rawDataSymbol].broadcaster_id))}get gameId(){return this[He.rawDataSymbol].game_id}get gameName(){return this[He.rawDataSymbol].game_name}async getGame(){return this[He.rawDataSymbol].game_id?(0,He.checkRelationAssertion)(await this._client.games.getGameById(this[He.rawDataSymbol].game_id)):null}get title(){return this[He.rawDataSymbol].title}};hn.HelixChannelReference=$o;zf.__decorate([(0,gE.Enumerable)(!1)],$o.prototype,"_client",void 0);hn.HelixChannelReference=$o=zf.__decorate([(0,He.rtfm)("api","HelixChannelReference","id")],$o)});var uh=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixExtensionBitsProduct=void 0;var bE=(g(),b(f)),xE=S(),Ot=m(),lh=class extends Ot.DataObject{static{a(this,"HelixExtensionBitsProduct")}get sku(){return this[Ot.rawDataSymbol].sku}get cost(){return this[Ot.rawDataSymbol].cost.amount}get displayName(){return this[Ot.rawDataSymbol].display_name}get inDevelopment(){return this[Ot.rawDataSymbol].in_development}get isBroadcast(){return this[Ot.rawDataSymbol].is_broadcast}get expirationDate(){return(0,xE.mapNullable)(this[Ot.rawDataSymbol].expiration,e=>new Date(e))}};pn.HelixExtensionBitsProduct=lh;pn.HelixExtensionBitsProduct=lh=bE.__decorate([(0,Ot.rtfm)("api","HelixExtensionBitsProduct","sku")],lh)});var ch=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixExtensionTransaction=void 0;var Kf=(g(),b(f)),wE=S(),ne=m(),zo=class extends ne.DataObject{static{a(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[ne.rawDataSymbol].id}get transactionDate(){return new Date(this[ne.rawDataSymbol].timestamp)}get broadcasterId(){return this[ne.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ne.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[ne.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ne.checkRelationAssertion)(await this._client.users.getUserById(this[ne.rawDataSymbol].broadcaster_id))}get userId(){return this[ne.rawDataSymbol].user_id}get userName(){return this[ne.rawDataSymbol].user_login}get userDisplayName(){return this[ne.rawDataSymbol].user_name}async getUser(){return(0,ne.checkRelationAssertion)(await this._client.users.getUserById(this[ne.rawDataSymbol].user_id))}get productType(){return this[ne.rawDataSymbol].product_type}get productSku(){return this[ne.rawDataSymbol].product_data.sku}get productCost(){return this[ne.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[ne.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[ne.rawDataSymbol].product_data.inDevelopment}};_n.HelixExtensionTransaction=zo;Kf.__decorate([(0,wE.Enumerable)(!1)],zo.prototype,"_client",void 0);_n.HelixExtensionTransaction=zo=Kf.__decorate([(0,ne.rtfm)("api","HelixExtensionTransaction","id")],zo)});var ph=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixExtensionsApi=void 0;var vE=(g(),b(f)),rg=m(),Ko=$f(),dh=Ae(),Jf=te(),Zf=re(),Xf=X(),SE=F(),Yf=oh(),eg=uh(),tg=ch(),hh=class extends SE.BaseApi{static{a(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Ko.createReleasedExtensionFilter)(e,t)});return new rg.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,dh.createSingleKeyQuery)("extension_id",e),...(0,Xf.createPaginationQuery)(t)}});return(0,Zf.createPaginatedResult)(r,Yf.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new Jf.HelixPaginatedRequest({url:"extensions/live",query:(0,dh.createSingleKeyQuery)("extension_id",e)},this._client,t=>new Yf.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,dh.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new eg.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Ko.createExtensionProductBody)(e)});return new eg.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Ko.createExtensionTransactionQuery)(e,t),...(0,Xf.createPaginationQuery)(t)}});return(0,Zf.createPaginatedResult)(r,tg.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new Jf.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Ko.createExtensionTransactionQuery)(e,t)},this._client,r=>new tg.HelixExtensionTransaction(r,this._client))}};mn.HelixExtensionsApi=hh;mn.HelixExtensionsApi=hh=vE.__decorate([(0,rg.rtfm)("api","HelixExtensionsApi")],hh)});var Zo=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixGame=void 0;var ig=(g(),b(f)),HE=S(),mt=m(),Jo=class extends mt.DataObject{static{a(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[mt.rawDataSymbol].id}get name(){return this[mt.rawDataSymbol].name}get boxArtUrl(){return this[mt.rawDataSymbol].box_art_url}get igdbId(){return this[mt.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[mt.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[mt.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[mt.rawDataSymbol].id})}};yn.HelixGame=Jo;ig.__decorate([(0,HE.Enumerable)(!1)],Jo.prototype,"_client",void 0);yn.HelixGame=Jo=ig.__decorate([(0,mt.rtfm)("api","HelixGame","id")],Jo)});var yh=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixGameApi=void 0;var Xo=(g(),b(f)),mh=S(),CE=m(),_h=At(),qE=te(),EE=re(),PE=X(),AE=F(),Tr=Zo(),Ir=class extends AE.BaseApi{static{a(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new _h.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Tr.HelixGame(e,this._client)),this._getGameByNameBatcher=new _h.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Tr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new _h.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Tr.HelixGame(e,this._client))}async getGamesByIds(e){return await this._getGames("id",e)}async getGamesByNames(e){return await this._getGames("name",e)}async getGamesByIgdbIds(e){return await this._getGames("igdb_id",e)}async getGameById(e){var t;return(t=(await this._getGames("id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByName(e){var t;return(t=(await this._getGames("name",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIgdbId(e){var t;return(t=(await this._getGames("igdb_id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIdBatched(e){return await this._getGameByIdBatcher.request(e)}async getGameByNameBatched(e){return await this._getGameByNameBatcher.request(e)}async getGameByIgdbIdBatched(e){return await this._getGameByIgdbIdBatcher.request(e)}async getTopGames(e){let t=await this._client.callApi({type:"helix",url:"games/top",query:(0,PE.createPaginationQuery)(e)});return(0,EE.createPaginatedResult)(t,Tr.HelixGame,this._client)}getTopGamesPaginated(){return new qE.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Tr.HelixGame(e,this._client))}async _getGames(e,t){return t.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:t}})).data.map(n=>new Tr.HelixGame(n,this._client)):[]}};fn.HelixGameApi=Ir;Xo.__decorate([(0,mh.Enumerable)(!1)],Ir.prototype,"_getGameByIdBatcher",void 0);Xo.__decorate([(0,mh.Enumerable)(!1)],Ir.prototype,"_getGameByNameBatcher",void 0);Xo.__decorate([(0,mh.Enumerable)(!1)],Ir.prototype,"_getGameByIgdbIdBatcher",void 0);fn.HelixGameApi=Ir=Xo.__decorate([(0,CE.rtfm)("api","HelixGameApi")],Ir)});var fh=u(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.HelixGoal=void 0;var ng=(g(),b(f)),DE=S(),Ie=m(),Yo=class extends Ie.DataObject{static{a(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[Ie.rawDataSymbol].id}get broadcasterId(){return this[Ie.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Ie.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[Ie.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,Ie.checkRelationAssertion)(await this._client.users.getUserById(this[Ie.rawDataSymbol].broadcaster_id))}get type(){return this[Ie.rawDataSymbol].type}get description(){return this[Ie.rawDataSymbol].description}get currentAmount(){return this[Ie.rawDataSymbol].current_amount}get targetAmount(){return this[Ie.rawDataSymbol].target_amount}get creationDate(){return this[Ie.rawDataSymbol].created_at}};gn.HelixGoal=Yo;ng.__decorate([(0,DE.Enumerable)(!1)],Yo.prototype,"_client",void 0);gn.HelixGoal=Yo=ng.__decorate([(0,Ie.rtfm)("api","HelixGoal","id")],Yo)});var bh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixGoalApi=void 0;var TE=(g(),b(f)),IE=W(),ag=m(),RE=F(),BE=fh(),gh=class extends RE.BaseApi{static{a(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,ag.extractUserId)(e),scopes:["channel:read:goals"],query:(0,IE.createBroadcasterQuery)(e)})).data.map(r=>new BE.HelixGoal(r,this._client))}};bn.HelixGoalApi=gh;bn.HelixGoalApi=gh=TE.__decorate([(0,ag.rtfm)("api","HelixGoalApi")],gh)});var xh=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixHypeTrainContribution=void 0;var sg=(g(),b(f)),OE=S(),er=m(),el=class extends er.DataObject{static{a(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[er.rawDataSymbol].user}async getUser(){return(0,er.checkRelationAssertion)(await this._client.users.getUserById(this[er.rawDataSymbol].user))}get type(){return this[er.rawDataSymbol].type}get total(){return this[er.rawDataSymbol].total}};xn.HelixHypeTrainContribution=el;sg.__decorate([(0,OE.Enumerable)(!1)],el.prototype,"_client",void 0);xn.HelixHypeTrainContribution=el=sg.__decorate([(0,er.rtfm)("api","HelixHypeTrainContribution","userId")],el)});var wh=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixHypeTrainEvent=void 0;var lg=(g(),b(f)),UE=S(),le=m(),og=xh(),tl=class extends le.DataObject{static{a(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[le.rawDataSymbol].id}get eventType(){return this[le.rawDataSymbol].event_type}get eventDate(){return new Date(this[le.rawDataSymbol].event_timestamp)}get eventVersion(){return this[le.rawDataSymbol].version}get id(){return this[le.rawDataSymbol].event_data.id}get broadcasterId(){return this[le.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,le.checkRelationAssertion)(await this._client.users.getUserById(this[le.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[le.rawDataSymbol].event_data.level}get startDate(){return new Date(this[le.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[le.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[le.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[le.rawDataSymbol].event_data.total}get goal(){return this[le.rawDataSymbol].event_data.goal}get lastContribution(){return new og.HelixHypeTrainContribution(this[le.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[le.rawDataSymbol].event_data.top_contributions.map(e=>new og.HelixHypeTrainContribution(e,this._client))}};wn.HelixHypeTrainEvent=tl;lg.__decorate([(0,UE.Enumerable)(!1)],tl.prototype,"_client",void 0);wn.HelixHypeTrainEvent=tl=lg.__decorate([(0,le.rtfm)("api","HelixHypeTrainEvent","id")],tl)});var Sh=u(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.HelixHypeTrainApi=void 0;var ug=W(),cg=m(),kE=te(),jE=re(),ME=X(),LE=F(),dg=wh(),vh=class extends LE.BaseApi{static{a(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,cg.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,ug.createBroadcasterQuery)(e),...(0,ME.createPaginationQuery)(t)}});return(0,jE.createPaginatedResult)(r,dg.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new kE.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,cg.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,ug.createBroadcasterQuery)(e)},this._client,t=>new dg.HelixHypeTrainEvent(t,this._client))}};rl.HelixHypeTrainApi=vh});var hg=u(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.createCheckAutoModStatusBody=fe.createUpdateShieldModeStatusBody=fe.createBanUserBody=fe.createAutoModSettingsBody=fe.createAutoModProcessBody=fe.createModeratorModifyQuery=fe.createModerationUserListQuery=void 0;var vn=m();function FE(i,e){return{broadcaster_id:(0,vn.extractUserId)(i),user_id:e?.userId}}a(FE,"createModerationUserListQuery");fe.createModerationUserListQuery=FE;function NE(i,e){return{broadcaster_id:(0,vn.extractUserId)(i),user_id:(0,vn.extractUserId)(e)}}a(NE,"createModeratorModifyQuery");fe.createModeratorModifyQuery=NE;function QE(i,e,t){return{user_id:(0,vn.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}a(QE,"createAutoModProcessBody");fe.createAutoModProcessBody=QE;function GE(i){return{overall_level:i.overallLevel,aggression:i.aggression,bullying:i.bullying,disability:i.disability,misogyny:i.misogyny,race_ethnicity_or_religion:i.raceEthnicityOrReligion,sex_based_terms:i.sexBasedTerms,sexuality_sex_or_gender:i.sexualitySexOrGender,swearing:i.swearing}}a(GE,"createAutoModSettingsBody");fe.createAutoModSettingsBody=GE;function VE(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,vn.extractUserId)(i.user)}}}a(VE,"createBanUserBody");fe.createBanUserBody=VE;function WE(i){return{is_active:i}}a(WE,"createUpdateShieldModeStatusBody");fe.createUpdateShieldModeStatusBody=WE;function $E(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}a($E,"createCheckAutoModStatusBody");fe.createCheckAutoModStatusBody=$E});var pg=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixAutoModSettings=void 0;var zE=(g(),b(f)),Ce=m(),Hh=class extends Ce.DataObject{static{a(this,"HelixAutoModSettings")}get broadcasterId(){return this[Ce.rawDataSymbol].broadcaster_id}get moderatorId(){return this[Ce.rawDataSymbol].moderator_id}get overallLevel(){return this[Ce.rawDataSymbol].overall_level?this[Ce.rawDataSymbol].overall_level:null}get disability(){return this[Ce.rawDataSymbol].disability}get aggression(){return this[Ce.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[Ce.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[Ce.rawDataSymbol].misogyny}get bullying(){return this[Ce.rawDataSymbol].bullying}get swearing(){return this[Ce.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[Ce.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[Ce.rawDataSymbol].sex_based_terms}};Sn.HelixAutoModSettings=Hh;Sn.HelixAutoModSettings=Hh=zE.__decorate([(0,Ce.rtfm)("api","HelixAutoModSettings","broadcasterId")],Hh)});var _g=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixAutoModStatus=void 0;var KE=(g(),b(f)),il=m(),Ch=class extends il.DataObject{static{a(this,"HelixAutoModStatus")}get messageId(){return this[il.rawDataSymbol].msg_id}get isPermitted(){return this[il.rawDataSymbol].is_permitted}};Hn.HelixAutoModStatus=Ch;Hn.HelixAutoModStatus=Ch=KE.__decorate([(0,il.rtfm)("api","HelixAutoModStatus","messageId")],Ch)});var nl=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixBanUser=void 0;var qh=(g(),b(f)),Eh=S(),yt=m(),Cn=class extends yt.DataObject{static{a(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[yt.rawDataSymbol].created_at)}get expiryDate(){return(0,Eh.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[yt.rawDataSymbol].moderator_id}async getModerator(){return(0,yt.checkRelationAssertion)(await this._client.users.getUserById(this[yt.rawDataSymbol].moderator_id))}get userId(){return this[yt.rawDataSymbol].user_id}async getUser(){return(0,yt.checkRelationAssertion)(await this._client.users.getUserById(this[yt.rawDataSymbol].user_id))}};qn.HelixBanUser=Cn;qh.__decorate([(0,Eh.Enumerable)(!1)],Cn.prototype,"_client",void 0);qh.__decorate([(0,Eh.Enumerable)(!1)],Cn.prototype,"_expiryTimestamp",void 0);qn.HelixBanUser=Cn=qh.__decorate([(0,yt.rtfm)("api","HelixBanUser","userId")],Cn)});var Ah=u(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.HelixBan=void 0;var JE=(g(),b(f)),Rr=m(),ZE=nl(),Ph=class extends ZE.HelixBanUser{static{a(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[Rr.rawDataSymbol].user_login}get userDisplayName(){return this[Rr.rawDataSymbol].user_name}get moderatorName(){return this[Rr.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Rr.rawDataSymbol].moderator_name}get reason(){return this[Rr.rawDataSymbol].reason||null}};En.HelixBan=Ph;En.HelixBan=Ph=JE.__decorate([(0,Rr.rtfm)("api","HelixBan","userId")],Ph)});var Th=u(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.HelixBlockedTerm=void 0;var XE=(g(),b(f)),nt=m(),Dh=class extends nt.DataObject{static{a(this,"HelixBlockedTerm")}get broadcasterId(){return this[nt.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[nt.rawDataSymbol].created_at)}get expirationDate(){return this[nt.rawDataSymbol].expires_at?new Date(this[nt.rawDataSymbol].expires_at):null}get id(){return this[nt.rawDataSymbol].id}get moderatorId(){return this[nt.rawDataSymbol].moderator_id}get text(){return this[nt.rawDataSymbol].text}get updatedDate(){return new Date(this[nt.rawDataSymbol].updated_at)}};Pn.HelixBlockedTerm=Dh;Pn.HelixBlockedTerm=Dh=XE.__decorate([(0,nt.rtfm)("api","HelixBlockedTerm","id")],Dh)});var Ih=u(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.HelixModerator=void 0;var mg=(g(),b(f)),YE=S(),tr=m(),al=class extends tr.DataObject{static{a(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[tr.rawDataSymbol].user_id}get userName(){return this[tr.rawDataSymbol].user_login}get userDisplayName(){return this[tr.rawDataSymbol].user_name}async getUser(){return(0,tr.checkRelationAssertion)(await this._client.users.getUserById(this[tr.rawDataSymbol].user_id))}};An.HelixModerator=al;mg.__decorate([(0,YE.Enumerable)(!1)],al.prototype,"_client",void 0);An.HelixModerator=al=mg.__decorate([(0,tr.rtfm)("api","HelixModerator","userId")],al)});var Rh=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixModeratedChannel=void 0;var yg=(g(),b(f)),eP=S(),ft=m(),sl=class extends ft.DataObject{static{a(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[ft.rawDataSymbol].broadcaster_id}get name(){return this[ft.rawDataSymbol].broadcaster_login}get displayName(){return this[ft.rawDataSymbol].broadcaster_name}async getChannel(){return(0,ft.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[ft.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,ft.checkRelationAssertion)(await this._client.users.getUserById(this[ft.rawDataSymbol].broadcaster_id))}};Dn.HelixModeratedChannel=sl;yg.__decorate([(0,eP.Enumerable)(!1)],sl.prototype,"_client",void 0);Dn.HelixModeratedChannel=sl=yg.__decorate([(0,ft.rtfm)("api","HelixModeratedChannel","id")],sl)});var Bh=u(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.HelixShieldModeStatus=void 0;var fg=(g(),b(f)),tP=S(),at=m(),ol=class extends at.DataObject{static{a(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[at.rawDataSymbol].is_active}get moderatorId(){return this[at.rawDataSymbol].moderator_id}get moderatorName(){return this[at.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[at.rawDataSymbol].moderator_name}async getModerator(){return(0,at.checkRelationAssertion)(await this._client.users.getUserById(this[at.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[at.rawDataSymbol].last_activated_at===""?null:new Date(this[at.rawDataSymbol].last_activated_at)}};Tn.HelixShieldModeStatus=ol;fg.__decorate([(0,tP.Enumerable)(!1)],ol.prototype,"_client",void 0);Tn.HelixShieldModeStatus=ol=fg.__decorate([(0,at.rtfm)("api","HelixShieldModeStatus")],ol)});var jh=u(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.HelixModerationApi=void 0;var rP=(g(),b(f)),Oh=W(),V=m(),In=Ae(),gt=hg(),Uh=te(),ll=re(),ul=X(),iP=F(),gg=pg(),nP=_g(),bg=Ah(),aP=nl(),xg=Th(),wg=Ih(),vg=Rh(),Sg=Bh(),kh=class extends iP.BaseApi{static{a(this,"HelixModerationApi")}async getBannedUsers(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,V.extractUserId)(e),scopes:["moderation:read"],query:{...(0,gt.createModerationUserListQuery)(e,t),...(0,ul.createPaginationQuery)(t)}});return(0,ll.createPaginatedResult)(r,bg.HelixBan,this._client)}getBannedUsersPaginated(e){return new Uh.HelixPaginatedRequest({url:"moderation/banned",userId:(0,V.extractUserId)(e),scopes:["moderation:read"],query:(0,Oh.createBroadcasterQuery)(e)},this._client,t=>new bg.HelixBan(t,this._client),50)}async checkUserBan(e,t){let r=(0,V.extractUserId)(t);return(await this.getBannedUsers(e,{userId:r})).data.some(s=>s.userId===r)}async getModerators(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:(0,V.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,gt.createModerationUserListQuery)(e,t),...(0,ul.createPaginationQuery)(t)}});return(0,ll.createPaginatedResult)(r,wg.HelixModerator,this._client)}getModeratorsPaginated(e){return new Uh.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,V.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,Oh.createBroadcasterQuery)(e)},this._client,t=>new wg.HelixModerator(t,this._client))}async getModeratedChannels(e,t){let r=(0,V.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"moderation/channels",userId:r,scopes:["user:read:moderated_channels"],query:{...(0,In.createSingleKeyQuery)("user_id",r),...(0,ul.createPaginationQuery)(t)}});return(0,ll.createPaginatedResult)(n,vg.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,V.extractUserId)(e);return new Uh.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,In.createSingleKeyQuery)("user_id",t)},this._client,r=>new vg.HelixModeratedChannel(r,this._client))}async checkUserMod(e,t){let r=(0,V.extractUserId)(t);return(await this.getModerators(e,{userId:r})).data.some(s=>s.userId===r)}async addModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:(0,V.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,gt.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,V.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,gt.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,V.extractUserId)(e),scopes:["moderation:read"],query:(0,Oh.createBroadcasterQuery)(e),jsonBody:(0,gt.createCheckAutoModStatusBody)(t)})).data.map(n=>new nP.HelixAutoModStatus(n))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,V.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,gt.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,V.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:t,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)})).data.map(n=>new gg.HelixAutoModSettings(n))}async updateAutoModSettings(e,t){let r=(0,V.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:r,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,gt.createAutoModSettingsBody)(t)})).data.map(s=>new gg.HelixAutoModSettings(s))}async banUser(e,t){let r=(0,V.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,gt.createBanUserBody)(t)})).data.map(s=>new aP.HelixBanUser(s,s.end_time,this._client))}async unbanUser(e,t){let r=(0,V.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,In.createSingleKeyQuery)("user_id",(0,V.extractUserId)(t))}})}async getBlockedTerms(e,t){let r=(0,V.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:r,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,ul.createPaginationQuery)(t)}});return(0,ll.createPaginatedResult)(n,xg.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let r=(0,V.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:r,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:{text:t}})).data.map(s=>new xg.HelixBlockedTerm(s))}async removeBlockedTerm(e,t,r){let n=(0,V.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:n,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(n),id:r}})}async deleteChatMessages(e,t){let r=(0,V.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:r,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,In.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,V.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:t,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)});return new Sg.HelixShieldModeStatus(r.data[0],this._client)}async updateShieldModeStatus(e,t){let r=(0,V.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:r,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,gt.createUpdateShieldModeStatusBody)(t)});return new Sg.HelixShieldModeStatus(n.data[0],this._client)}_createModeratorActionQuery(e){return(0,In.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};Rn.HelixModerationApi=kh;Rn.HelixModerationApi=kh=rP.__decorate([(0,V.rtfm)("api","HelixModerationApi")],kh)});var Cg=u(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.createPollEndBody=Br.createPollBody=void 0;var Hg=m();function sP(i,e){var t;return{broadcaster_id:(0,Hg.extractUserId)(i),title:e.title,choices:e.choices.map(r=>({title:r})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(t=e.channelPointsPerVote)!==null&&t!==void 0?t:0}}a(sP,"createPollBody");Br.createPollBody=sP;function oP(i,e,t){return{broadcaster_id:(0,Hg.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}a(oP,"createPollEndBody");Br.createPollEndBody=oP});var Lh=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixPollChoice=void 0;var lP=(g(),b(f)),Or=m(),Mh=class extends Or.DataObject{static{a(this,"HelixPollChoice")}get id(){return this[Or.rawDataSymbol].id}get title(){return this[Or.rawDataSymbol].title}get totalVotes(){return this[Or.rawDataSymbol].votes}get channelPointsVotes(){return this[Or.rawDataSymbol].channel_points_votes}};Bn.HelixPollChoice=Mh;Bn.HelixPollChoice=Mh=lP.__decorate([(0,Or.rtfm)("api","HelixPollChoice","id")],Mh)});var Fh=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixPoll=void 0;var qg=(g(),b(f)),uP=S(),ge=m(),cP=Lh(),cl=class extends ge.DataObject{static{a(this,"HelixPoll")}constructor(e,t){super(e),this._client=t}get id(){return this[ge.rawDataSymbol].id}get broadcasterId(){return this[ge.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ge.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ge.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ge.checkRelationAssertion)(await this._client.users.getUserById(this[ge.rawDataSymbol].broadcaster_id))}get title(){return this[ge.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[ge.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[ge.rawDataSymbol].channel_points_per_vote}get status(){return this[ge.rawDataSymbol].status}get durationInSeconds(){return this[ge.rawDataSymbol].duration}get startDate(){return new Date(this[ge.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[ge.rawDataSymbol].duration*1e3)}get choices(){return this[ge.rawDataSymbol].choices.map(e=>new cP.HelixPollChoice(e))}};On.HelixPoll=cl;qg.__decorate([(0,uP.Enumerable)(!1)],cl.prototype,"_client",void 0);On.HelixPoll=cl=qg.__decorate([(0,ge.rtfm)("api","HelixPoll","id")],cl)});var Qh=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixPollApi=void 0;var dP=(g(),b(f)),Eg=W(),Ur=m(),hP=Ae(),Pg=Cg(),pP=te(),_P=re(),mP=X(),yP=F(),Un=Fh(),Nh=class extends yP.BaseApi{static{a(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,Ur.extractUserId)(e),scopes:["channel:read:polls"],query:{...(0,Eg.createBroadcasterQuery)(e),...(0,mP.createPaginationQuery)(t)}});return(0,_P.createPaginatedResult)(r,Un.HelixPoll,this._client)}getPollsPaginated(e){return new pP.HelixPaginatedRequest({url:"polls",userId:(0,Ur.extractUserId)(e),scopes:["channel:read:polls"],query:(0,Eg.createBroadcasterQuery)(e)},this._client,t=>new Un.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,Ur.extractUserId)(e),scopes:["channel:read:polls"],query:(0,hP.createGetByIdsQuery)(e,t)})).data.map(n=>new Un.HelixPoll(n,this._client)):[]}async getPollById(e,t){let r=await this.getPollsByIds(e,[t]);return r.length?r[0]:null}async createPoll(e,t){let r=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:(0,Ur.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Pg.createPollBody)(e,t)});return new Un.HelixPoll(r.data[0],this._client)}async endPoll(e,t,r=!0){let n=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:(0,Ur.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Pg.createPollEndBody)(e,t,r)});return new Un.HelixPoll(n.data[0],this._client)}};kn.HelixPollApi=Nh;kn.HelixPollApi=Nh=dP.__decorate([(0,Ur.rtfm)("api","HelixPollApi")],Nh)});var Dg=u(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.createEndPredictionBody=kr.createPredictionBody=void 0;var Ag=m();function fP(i,e){return{broadcaster_id:(0,Ag.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}a(fP,"createPredictionBody");kr.createPredictionBody=fP;function gP(i,e,t,r){return{broadcaster_id:(0,Ag.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}a(gP,"createEndPredictionBody");kr.createEndPredictionBody=gP});var Gh=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixPredictor=void 0;var Tg=(g(),b(f)),bP=S(),Ut=m(),dl=class extends Ut.DataObject{static{a(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Ut.rawDataSymbol].user_id}get userName(){return this[Ut.rawDataSymbol].user_login}get userDisplayName(){return this[Ut.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Ut.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Ut.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Ut.rawDataSymbol].channel_points_won}};jn.HelixPredictor=dl;Tg.__decorate([(0,bP.Enumerable)(!1)],dl.prototype,"_client",void 0);jn.HelixPredictor=dl=Tg.__decorate([(0,Ut.rtfm)("api","HelixPredictor","userId")],dl)});var Vh=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixPredictionOutcome=void 0;var Ig=(g(),b(f)),xP=S(),kt=m(),wP=Gh(),hl=class extends kt.DataObject{static{a(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[kt.rawDataSymbol].id}get title(){return this[kt.rawDataSymbol].title}get users(){return this[kt.rawDataSymbol].users}get totalChannelPoints(){return this[kt.rawDataSymbol].channel_points}get color(){return this[kt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[kt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new wP.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};Mn.HelixPredictionOutcome=hl;Ig.__decorate([(0,xP.Enumerable)(!1)],hl.prototype,"_client",void 0);Mn.HelixPredictionOutcome=hl=Ig.__decorate([(0,kt.rtfm)("api","HelixPredictionOutcome","id")],hl)});var Wh=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixPrediction=void 0;var Bg=(g(),b(f)),vP=S(),z=m(),Rg=Vh(),pl=class extends z.DataObject{static{a(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[z.rawDataSymbol].id}get broadcasterId(){return this[z.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[z.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[z.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,z.checkRelationAssertion)(await this._client.users.getUserById(this[z.rawDataSymbol].broadcaster_id))}get title(){return this[z.rawDataSymbol].title}get status(){return this[z.rawDataSymbol].status}get autoLockAfter(){return this[z.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[z.rawDataSymbol].created_at)}get endDate(){return this[z.rawDataSymbol].ended_at?new Date(this[z.rawDataSymbol].ended_at):null}get lockDate(){return this[z.rawDataSymbol].locked_at?new Date(this[z.rawDataSymbol].locked_at):null}get outcomes(){return this[z.rawDataSymbol].outcomes.map(e=>new Rg.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[z.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[z.rawDataSymbol].winning_outcome_id)return null;let e=this[z.rawDataSymbol].outcomes.find(t=>t.id===this[z.rawDataSymbol].winning_outcome_id);if(!e)throw new z.HellFreezesOverError("Winning outcome not found in outcomes array");return new Rg.HelixPredictionOutcome(e,this._client)}};Ln.HelixPrediction=pl;Bg.__decorate([(0,vP.Enumerable)(!1)],pl.prototype,"_client",void 0);Ln.HelixPrediction=pl=Bg.__decorate([(0,z.rtfm)("api","HelixPrediction","id")],pl)});var zh=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixPredictionApi=void 0;var SP=(g(),b(f)),Og=W(),jr=m(),HP=Ae(),Ug=Dg(),CP=te(),qP=re(),EP=X(),PP=F(),Fn=Wh(),$h=class extends PP.BaseApi{static{a(this,"HelixPredictionApi")}async getPredictions(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",userId:(0,jr.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,Og.createBroadcasterQuery)(e),...(0,EP.createPaginationQuery)(t)}});return(0,qP.createPaginatedResult)(r,Fn.HelixPrediction,this._client)}getPredictionsPaginated(e){return new CP.HelixPaginatedRequest({url:"predictions",userId:(0,jr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,Og.createBroadcasterQuery)(e)},this._client,t=>new Fn.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,jr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,HP.createGetByIdsQuery)(e,t)})).data.map(n=>new Fn.HelixPrediction(n,this._client)):[]}async getPredictionById(e,t){let r=await this.getPredictionsByIds(e,[t]);return r.length?r[0]:null}async createPrediction(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:(0,jr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,Ug.createPredictionBody)(e,t)});return new Fn.HelixPrediction(r.data[0],this._client)}async lockPrediction(e,t){return await this._endPrediction(e,t,"LOCKED")}async resolvePrediction(e,t,r){return await this._endPrediction(e,t,"RESOLVED",r)}async cancelPrediction(e,t){return await this._endPrediction(e,t,"CANCELED")}async _endPrediction(e,t,r,n){let s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:(0,jr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,Ug.createEndPredictionBody)(e,t,r,n)});return new Fn.HelixPrediction(s.data[0],this._client)}};Nn.HelixPredictionApi=$h;Nn.HelixPredictionApi=$h=SP.__decorate([(0,jr.rtfm)("api","HelixPredictionApi")],$h)});var jg=u(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.createRaidStartQuery=void 0;var kg=m();function AP(i,e){return{from_broadcaster_id:(0,kg.extractUserId)(i),to_broadcaster_id:(0,kg.extractUserId)(e)}}a(AP,"createRaidStartQuery");_l.createRaidStartQuery=AP});var Jh=u(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.HelixRaid=void 0;var DP=(g(),b(f)),ml=m(),Kh=class extends ml.DataObject{static{a(this,"HelixRaid")}get creationDate(){return new Date(this[ml.rawDataSymbol].created_at)}get targetIsMature(){return this[ml.rawDataSymbol].is_mature}};Qn.HelixRaid=Kh;Qn.HelixRaid=Kh=DP.__decorate([(0,ml.rtfm)("api","HelixRaid")],Kh)});var Yh=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixRaidApi=void 0;var TP=(g(),b(f)),IP=W(),Zh=m(),RP=jg(),BP=F(),OP=Jh(),Xh=class extends BP.BaseApi{static{a(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Zh.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,RP.createRaidStartQuery)(e,t)});return new OP.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Zh.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,IP.createBroadcasterQuery)(e)})}};Gn.HelixRaidApi=Xh;Gn.HelixRaidApi=Xh=TP.__decorate([(0,Zh.rtfm)("api","HelixRaidApi")],Xh)});var ep=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createScheduleSegmentUpdateBody=Qe.createScheduleSegmentModifyQuery=Qe.createScheduleSegmentBody=Qe.createScheduleSettingsUpdateQuery=Qe.createScheduleQuery=void 0;var yl=m();function UP(i,e){var t;return{broadcaster_id:(0,yl.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}a(UP,"createScheduleQuery");Qe.createScheduleQuery=UP;function kP(i,e){return e.vacation?{broadcaster_id:(0,yl.extractUserId)(i),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:(0,yl.extractUserId)(i),is_vacation_enabled:"false"}}a(kP,"createScheduleSettingsUpdateQuery");Qe.createScheduleSettingsUpdateQuery=kP;function jP(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}a(jP,"createScheduleSegmentBody");Qe.createScheduleSegmentBody=jP;function MP(i,e){return{broadcaster_id:(0,yl.extractUserId)(i),id:e}}a(MP,"createScheduleSegmentModifyQuery");Qe.createScheduleSegmentModifyQuery=MP;function LP(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}a(LP,"createScheduleSegmentUpdateBody");Qe.createScheduleSegmentUpdateBody=LP});var Wn=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixScheduleSegment=void 0;var Mg=(g(),b(f)),Lg=S(),Ge=m(),fl=class extends Ge.DataObject{static{a(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[Ge.rawDataSymbol].id}get startDate(){return new Date(this[Ge.rawDataSymbol].start_time)}get endDate(){return new Date(this[Ge.rawDataSymbol].end_time)}get title(){return this[Ge.rawDataSymbol].title}get cancelEndDate(){return(0,Lg.mapNullable)(this[Ge.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[Ge.rawDataSymbol].category)===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null}get categoryName(){var e,t;return(t=(e=this[Ge.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[Ge.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[Ge.rawDataSymbol].is_recurring}};Vn.HelixScheduleSegment=fl;Mg.__decorate([(0,Lg.Enumerable)(!1)],fl.prototype,"_client",void 0);Vn.HelixScheduleSegment=fl=Mg.__decorate([(0,Ge.rtfm)("api","HelixScheduleSegment","id")],fl)});var rp=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixPaginatedScheduleSegmentRequest=void 0;var FP=(g(),b(f)),NP=m(),QP=ep(),GP=te(),VP=Wn(),tp=class extends GP.HelixPaginatedRequest{static{a(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,QP.createScheduleQuery)(e,r)},t,n=>new VP.HelixScheduleSegment(n,t),25)}async _fetchData(e={}){var t;let r=await super._fetchData(e);return{data:(t=r.data.segments)!==null&&t!==void 0?t:[],pagination:r.pagination}}};$n.HelixPaginatedScheduleSegmentRequest=tp;$n.HelixPaginatedScheduleSegmentRequest=tp=FP.__decorate([(0,NP.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],tp)});var ip=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixSchedule=void 0;var Fg=(g(),b(f)),WP=S(),st=m(),$P=Wn(),gl=class extends st.DataObject{static{a(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[st.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new $P.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[st.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[st.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[st.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,st.checkRelationAssertion)(await this._client.users.getUserById(this[st.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[st.rawDataSymbol].vacation)===null||e===void 0?void 0:e.start_time;return t?new Date(t):null}get vacationEndDate(){var e;let t=(e=this[st.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};zn.HelixSchedule=gl;Fg.__decorate([(0,WP.Enumerable)(!1)],gl.prototype,"_client",void 0);zn.HelixSchedule=gl=Fg.__decorate([(0,st.rtfm)("api","HelixSchedule","broadcasterId")],gl)});var sp=u(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.HelixScheduleApi=void 0;var Ng=W(),Mr=m(),zP=Ae(),Lr=ep(),KP=X(),JP=F(),ZP=rp(),XP=ip(),np=Wn(),ap=class extends JP.BaseApi{static{a(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,Mr.extractUserId)(e),query:{...(0,Lr.createScheduleQuery)(e,t),...(0,KP.createPaginationQuery)(t)}});return{data:new XP.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new ZP.HelixPaginatedScheduleSegmentRequest(e,this._client,t)}async getScheduleSegmentsByIds(e,t){var r,n;return(n=(r=(await this._client.callApi({type:"helix",url:"schedule",userId:(0,Mr.extractUserId)(e),query:(0,zP.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new np.HelixScheduleSegment(o,this._client)))!==null&&n!==void 0?n:[]}async getScheduleSegmentById(e,t){let r=await this.getScheduleSegmentsByIds(e,[t]);return r.length?r[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:(0,Ng.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,Mr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Lr.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,Mr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Ng.createBroadcasterQuery)(e),jsonBody:(0,Lr.createScheduleSegmentBody)(t)});return new np.HelixScheduleSegment(r.data.segments[0],this._client)}async updateScheduleSegment(e,t,r){let n=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:(0,Mr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Lr.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,Lr.createScheduleSegmentUpdateBody)(r)});return new np.HelixScheduleSegment(n.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,Mr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Lr.createScheduleSegmentModifyQuery)(e,t)})}};bl.HelixScheduleApi=ap});var Qg=u(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.createSearchChannelsQuery=void 0;function YP(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}a(YP,"createSearchChannelsQuery");xl.createSearchChannelsQuery=YP});var op=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixChannelSearchResult=void 0;var Gg=(g(),b(f)),eA=S(),ue=m(),wl=class extends ue.DataObject{static{a(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[ue.rawDataSymbol].broadcaster_language}get id(){return this[ue.rawDataSymbol].id}get name(){return this[ue.rawDataSymbol].broadcaster_login}get displayName(){return this[ue.rawDataSymbol].display_name}async getUser(){return(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].id))}get gameId(){return this[ue.rawDataSymbol].game_id}get gameName(){return this[ue.rawDataSymbol].game_name}async getGame(){return this[ue.rawDataSymbol].game_id?(0,ue.checkRelationAssertion)(await this._client.games.getGameById(this[ue.rawDataSymbol].game_id)):null}get isLive(){return this[ue.rawDataSymbol].is_live}get tags(){return this[ue.rawDataSymbol].tags}get thumbnailUrl(){return this[ue.rawDataSymbol].thumbnail_url}get startDate(){return this[ue.rawDataSymbol].is_live?new Date(this[ue.rawDataSymbol].started_at):null}};Kn.HelixChannelSearchResult=wl;Gg.__decorate([(0,eA.Enumerable)(!1)],wl.prototype,"_client",void 0);Kn.HelixChannelSearchResult=wl=Gg.__decorate([(0,ue.rtfm)("api","HelixChannelSearchResult","id")],wl)});var up=u(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.HelixSearchApi=void 0;var tA=(g(),b(f)),rA=m(),Vg=Qg(),Wg=te(),$g=re(),zg=X(),iA=F(),Kg=Zo(),Jg=op(),lp=class extends iA.BaseApi{static{a(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,zg.createPaginationQuery)(t)}});return(0,$g.createPaginatedResult)(r,Kg.HelixGame,this._client)}searchCategoriesPaginated(e){return new Wg.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new Kg.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,Vg.createSearchChannelsQuery)(e,t),...(0,zg.createPaginationQuery)(t)}});return(0,$g.createPaginatedResult)(r,Jg.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new Wg.HelixPaginatedRequest({url:"search/channels",query:(0,Vg.createSearchChannelsQuery)(e,t)},this._client,r=>new Jg.HelixChannelSearchResult(r,this._client))}};Jn.HelixSearchApi=lp;Jn.HelixSearchApi=lp=tA.__decorate([(0,rA.rtfm)("api","HelixSearchApi")],lp)});var dp=u(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.StreamNotLiveError=void 0;var nA=m(),cp=class extends nA.CustomError{static{a(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};vl.StreamNotLiveError=cp});var Zg=u(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.createVideoQuery=jt.createStreamMarkerBody=jt.createStreamQuery=void 0;var aA=m();function sA(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}a(sA,"createStreamQuery");jt.createStreamQuery=sA;function oA(i,e){return{user_id:(0,aA.extractUserId)(i),description:e}}a(oA,"createStreamMarkerBody");jt.createStreamMarkerBody=oA;function lA(i){return{video_id:i}}a(lA,"createVideoQuery");jt.createVideoQuery=lA});var hp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixStream=void 0;var Xg=(g(),b(f)),uA=S(),K=m(),Sl=class extends K.DataObject{static{a(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[K.rawDataSymbol].id}get userId(){return this[K.rawDataSymbol].user_id}get userName(){return this[K.rawDataSymbol].user_login}get userDisplayName(){return this[K.rawDataSymbol].user_name}async getUser(){return(0,K.checkRelationAssertion)(await this._client.users.getUserById(this[K.rawDataSymbol].user_id))}get gameId(){return this[K.rawDataSymbol].game_id}get gameName(){return this[K.rawDataSymbol].game_name}async getGame(){return this[K.rawDataSymbol].game_id?(0,K.checkRelationAssertion)(await this._client.games.getGameById(this[K.rawDataSymbol].game_id)):null}get type(){return this[K.rawDataSymbol].type}get title(){return this[K.rawDataSymbol].title}get viewers(){return this[K.rawDataSymbol].viewer_count}get startDate(){return new Date(this[K.rawDataSymbol].started_at)}get language(){return this[K.rawDataSymbol].language}get thumbnailUrl(){return this[K.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[K.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[K.rawDataSymbol].tags}get isMature(){return this[K.rawDataSymbol].is_mature}};Zn.HelixStream=Sl;Xg.__decorate([(0,uA.Enumerable)(!1)],Sl.prototype,"_client",void 0);Zn.HelixStream=Sl=Xg.__decorate([(0,K.rtfm)("api","HelixStream","id")],Sl)});var Cl=u(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.HelixStreamMarker=void 0;var Yg=(g(),b(f)),cA=S(),Fr=m(),Hl=class extends Fr.DataObject{static{a(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[Fr.rawDataSymbol].id}get creationDate(){return new Date(this[Fr.rawDataSymbol].created_at)}get description(){return this[Fr.rawDataSymbol].description}get positionInSeconds(){return this[Fr.rawDataSymbol].position_seconds}};Xn.HelixStreamMarker=Hl;Yg.__decorate([(0,cA.Enumerable)(!1)],Hl.prototype,"_client",void 0);Xn.HelixStreamMarker=Hl=Yg.__decorate([(0,Fr.rtfm)("api","HelixStreamMarker","id")],Hl)});var mp=u(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.HelixStreamMarkerWithVideo=void 0;var dA=(g(),b(f)),pp=m(),hA=Cl(),_p=class extends hA.HelixStreamMarker{static{a(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[pp.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,pp.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};Yn.HelixStreamMarkerWithVideo=_p;Yn.HelixStreamMarkerWithVideo=_p=dA.__decorate([(0,pp.rtfm)("api","HelixStreamMarkerWithVideo","id")],_p)});var fp=u(ra=>{"use strict";var Qr;Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixStreamApi=void 0;var yp=(g(),b(f)),ea=S(),eb=W(),qe=m(),pA=dp(),ql=Ae(),Nr=Zg(),tb=At(),El=te(),rb=re(),Pl=X(),_A=F(),rr=hp(),mA=Cl(),yA=mp(),ta=Qr=class extends _A.BaseApi{static{a(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new tb.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new rr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new tb.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new rr.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,Nr.createStreamQuery)(e),...(0,Pl.createPaginationQuery)(e)}});return(0,rb.createPaginatedResult)(t,rr.HelixStream,this._client)}getStreamsPaginated(e={}){return new El.HelixPaginatedRequest({url:"streams",query:(0,Nr.createStreamQuery)(e)},this._client,t=>new rr.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(qe.extractUserName)})).data}async getStreamByUserName(e){var t;return(t=(await this.getStreamsByUserNames([e]))[0])!==null&&t!==void 0?t:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request((0,qe.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(qe.extractUserId)})).data}async getStreamByUserId(e){let t=(0,qe.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,Nr.createStreamQuery)({userId:t})});return(0,ea.mapNullable)(r.data[0],n=>new rr.HelixStream(n,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,qe.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let n=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,ql.createUserQuery)(e),...(0,Pl.createPaginationQuery)(t)},userId:(0,qe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,ea.flatten)(n.data.map(s=>Qr._mapGetStreamMarkersResult(s,this._client))),cursor:(r=n.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new El.HelixPaginatedRequest({url:"streams/markers",query:(0,ql.createUserQuery)(e),userId:(0,qe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>Qr._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var n;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,Nr.createVideoQuery)(t),...(0,Pl.createPaginationQuery)(r)},userId:(0,qe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,ea.flatten)(s.data.map(o=>Qr._mapGetStreamMarkersResult(o,this._client))),cursor:(n=s.pagination)===null||n===void 0?void 0:n.cursor}}getStreamMarkersForVideoPaginated(e,t){return new El.HelixPaginatedRequest({url:"streams/markers",query:(0,Nr.createVideoQuery)(t),userId:(0,qe.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>Qr._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,qe.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,Nr.createStreamMarkerBody)(e,t)});return new mA.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof eb.HttpStatusCodeError&&r.statusCode===404?new pA.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,qe.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,eb.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,qe.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,ql.createSingleKeyQuery)("user_id",r),...(0,Pl.createPaginationQuery)(t)}});return(0,rb.createPaginatedResult)(n,rr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,qe.extractUserId)(e);return new El.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,ql.createSingleKeyQuery)("user_id",t)},this._client,r=>new rr.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,n)=>[...r,...n.markers.map(s=>new yA.HelixStreamMarkerWithVideo(s,n.video_id,t))],[])}};ra.HelixStreamApi=ta;yp.__decorate([(0,ea.Enumerable)(!1)],ta.prototype,"_getStreamByUserIdBatcher",void 0);yp.__decorate([(0,ea.Enumerable)(!1)],ta.prototype,"_getStreamByUserNameBatcher",void 0);ra.HelixStreamApi=ta=Qr=yp.__decorate([(0,qe.rtfm)("api","HelixStreamApi")],ta)});var nb=u(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.createSubscriptionCheckQuery=void 0;var ib=m();function fA(i,e){return{broadcaster_id:(0,ib.extractUserId)(i),user_id:(0,ib.extractUserId)(e)}}a(fA,"createSubscriptionCheckQuery");Al.createSubscriptionCheckQuery=fA});var Tl=u(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.HelixUserSubscription=void 0;var ab=(g(),b(f)),gA=S(),Mt=m(),Dl=class extends Mt.DataObject{static{a(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Mt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Mt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Mt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[Mt.rawDataSymbol].broadcaster_id)}get isGift(){return this[Mt.rawDataSymbol].is_gift}get tier(){return this[Mt.rawDataSymbol].tier}};ia.HelixUserSubscription=Dl;ab.__decorate([(0,gA.Enumerable)(!1)],Dl.prototype,"_client",void 0);ia.HelixUserSubscription=Dl=ab.__decorate([(0,Mt.rtfm)("api","HelixUserSubscription","broadcasterId")],Dl)});var Il=u(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.HelixSubscription=void 0;var bA=(g(),b(f)),ee=m(),xA=Tl(),gp=class extends xA.HelixUserSubscription{static{a(this,"HelixSubscription")}get broadcasterId(){return this[ee.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ee.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ee.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ee.checkRelationAssertion)(await this._client.users.getUserById(this[ee.rawDataSymbol].broadcaster_id))}get gifterId(){return this[ee.rawDataSymbol].is_gift?this[ee.rawDataSymbol].gifter_id:null}get gifterName(){return this[ee.rawDataSymbol].is_gift?this[ee.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[ee.rawDataSymbol].is_gift?this[ee.rawDataSymbol].gifter_name:null}async getGifter(){return this[ee.rawDataSymbol].is_gift?(0,ee.checkRelationAssertion)(await this._client.users.getUserById(this[ee.rawDataSymbol].gifter_id)):null}get userId(){return this[ee.rawDataSymbol].user_id}get userName(){return this[ee.rawDataSymbol].user_login}get userDisplayName(){return this[ee.rawDataSymbol].user_name}async getUser(){return(0,ee.checkRelationAssertion)(await this._client.users.getUserById(this[ee.rawDataSymbol].user_id))}};na.HelixSubscription=gp;na.HelixSubscription=gp=bA.__decorate([(0,ee.rtfm)("api","HelixSubscription","userId")],gp)});var xp=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixPaginatedSubscriptionsRequest=void 0;var wA=(g(),b(f)),vA=W(),sb=m(),SA=Cr(),HA=Il(),bp=class extends SA.HelixPaginatedRequestWithTotal{static{a(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,sb.extractUserId)(e),query:(0,vA.createBroadcasterQuery)(e)},t,r=>new HA.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};aa.HelixPaginatedSubscriptionsRequest=bp;aa.HelixPaginatedSubscriptionsRequest=bp=wA.__decorate([(0,sb.rtfm)("api","HelixPaginatedSubscriptionsRequest")],bp)});var vp=u(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.HelixSubscriptionApi=void 0;var CA=(g(),b(f)),ob=W(),Rl=m(),qA=Ae(),EA=nb(),PA=re(),AA=X(),DA=F(),TA=xp(),lb=Il(),IA=Tl(),wp=class extends DA.BaseApi{static{a(this,"HelixSubscriptionApi")}async getSubscriptions(e,t){let r=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:(0,Rl.extractUserId)(e),query:{...(0,ob.createBroadcasterQuery)(e),...(0,AA.createPaginationQuery)(t)}});return{...(0,PA.createPaginatedResultWithTotal)(r,lb.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new TA.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,Rl.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,qA.createChannelUsersCheckQuery)(e,t)})).data.map(n=>new lb.HelixSubscription(n,this._client))}async getSubscriptionForUser(e,t){let r=await this.getSubscriptionsForUsers(e,[t]);return r.length?r[0]:null}async checkUserSubscription(e,t){try{let r=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:(0,Rl.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,EA.createSubscriptionCheckQuery)(t,e)});return new IA.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof ob.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};sa.HelixSubscriptionApi=wp;sa.HelixSubscriptionApi=wp=CA.__decorate([(0,Rl.rtfm)("api","HelixSubscriptionApi")],wp)});var Ol=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixTeam=void 0;var ub=(g(),b(f)),RA=S(),Ve=m(),Bl=class extends Ve.DataObject{static{a(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[Ve.rawDataSymbol].id}get name(){return this[Ve.rawDataSymbol].team_name}get displayName(){return this[Ve.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[Ve.rawDataSymbol].background_image_url}get bannerUrl(){return this[Ve.rawDataSymbol].banner}get creationDate(){return new Date(this[Ve.rawDataSymbol].created_at)}get updateDate(){return new Date(this[Ve.rawDataSymbol].updated_at)}get info(){return this[Ve.rawDataSymbol].info}get logoThumbnailUrl(){return this[Ve.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};oa.HelixTeam=Bl;ub.__decorate([(0,RA.Enumerable)(!1)],Bl.prototype,"_client",void 0);oa.HelixTeam=Bl=ub.__decorate([(0,Ve.rtfm)("api","HelixTeam","id")],Bl)});var Hp=u(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.HelixTeamWithUsers=void 0;var BA=(g(),b(f)),cb=m(),OA=uo(),UA=Ol(),Sp=class extends UA.HelixTeam{static{a(this,"HelixTeamWithUsers")}get userRelations(){return this[cb.rawDataSymbol].users.map(e=>new OA.HelixUserRelation(e,this._client))}};la.HelixTeamWithUsers=Sp;la.HelixTeamWithUsers=Sp=BA.__decorate([(0,cb.rtfm)("api","HelixTeamWithUsers","id")],Sp)});var Ep=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixTeamApi=void 0;var kA=(g(),b(f)),Cp=W(),hb=m(),jA=F(),MA=Ol(),db=Hp(),qp=class extends jA.BaseApi{static{a(this,"HelixTeamApi")}async getTeamsForBroadcaster(e){var t,r;return(r=(t=(await this._client.callApi({type:"helix",url:"teams/channel",userId:(0,hb.extractUserId)(e),query:(0,Cp.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new MA.HelixTeam(s,this._client)))!==null&&r!==void 0?r:[]}async getTeamById(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new db.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof Cp.HttpStatusCodeError&&t.statusCode===500)return null;throw t}}async getTeamByName(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new db.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof Cp.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};ua.HelixTeamApi=qp;ua.HelixTeamApi=qp=kA.__decorate([(0,hb.rtfm)("api","HelixTeamApi")],qp)});var _b=u(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createUserBlockDeleteQuery=Gr.createUserBlockCreateQuery=void 0;var pb=m();function LA(i,e){return{target_user_id:(0,pb.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}a(LA,"createUserBlockCreateQuery");Gr.createUserBlockCreateQuery=LA;function FA(i){return{target_user_id:(0,pb.extractUserId)(i)}}a(FA,"createUserBlockDeleteQuery");Gr.createUserBlockDeleteQuery=FA});var jl=u(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.HelixBaseExtension=void 0;var Ul=m(),Pp=class extends Ul.DataObject{static{a(this,"HelixBaseExtension")}get id(){return this[Ul.rawDataSymbol].id}get version(){return this[Ul.rawDataSymbol].version}get name(){return this[Ul.rawDataSymbol].name}};kl.HelixBaseExtension=Pp});var Dp=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixInstalledExtension=void 0;var NA=(g(),b(f)),QA=m(),GA=jl(),Ap=class extends GA.HelixBaseExtension{static{a(this,"HelixInstalledExtension")}constructor(e,t,r){super(r),this._slotType=e,this._slotId=t}get slotType(){return this._slotType}get slotId(){return this._slotId}};ca.HelixInstalledExtension=Ap;ca.HelixInstalledExtension=Ap=NA.__decorate([(0,QA.rtfm)("api","HelixInstalledExtension","id")],Ap)});var Rp=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixInstalledExtensionList=void 0;var VA=(g(),b(f)),da=m(),Tp=Dp(),Ip=class extends da.DataObject{static{a(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[da.rawDataSymbol][e][t];return r.active?new Tp.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[da.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new Tp.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[da.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,n])=>new Tp.HelixInstalledExtension(e,r,n)))}};ha.HelixInstalledExtensionList=Ip;ha.HelixInstalledExtensionList=Ip=VA.__decorate([(0,da.rtfm)("api","HelixInstalledExtensionList")],Ip)});var Up=u(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.HelixUserExtension=void 0;var WA=(g(),b(f)),Bp=m(),$A=jl(),Op=class extends $A.HelixBaseExtension{static{a(this,"HelixUserExtension")}get canActivate(){return this[Bp.rawDataSymbol].can_activate}get types(){return this[Bp.rawDataSymbol].type}};pa.HelixUserExtension=Op;pa.HelixUserExtension=Op=WA.__decorate([(0,Bp.rtfm)("api","HelixUserExtension","id")],Op)});var Ll=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixUser=void 0;var mb=(g(),b(f)),zA=S(),We=m(),Ml=class extends We.DataObject{static{a(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[We.rawDataSymbol].id}get name(){return this[We.rawDataSymbol].login}get displayName(){return this[We.rawDataSymbol].display_name}get description(){return this[We.rawDataSymbol].description}get type(){return this[We.rawDataSymbol].type}get broadcasterType(){return this[We.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[We.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[We.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[We.rawDataSymbol].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var t;return(t=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&t!==void 0?t:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var t;return(t=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&t!==void 0?t:null}async isFollowedBy(e){return await this.getChannelFollower(e)!==null}async getSubscriptionTo(e){return await this._client.subscriptions.checkUserSubscription(this,e)}async isSubscribedTo(e){return await this.getSubscriptionTo(e)!==null}async getSubscriber(e){return await this._client.subscriptions.getSubscriptionForUser(this,e)}async hasSubscriber(e){return await this.getSubscriber(e)!==null}};_a.HelixUser=Ml;mb.__decorate([(0,zA.Enumerable)(!1)],Ml.prototype,"_client",void 0);_a.HelixUser=Ml=mb.__decorate([(0,We.rtfm)("api","HelixUser","id")],Ml)});var jp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixPrivilegedUser=void 0;var KA=(g(),b(f)),yb=m(),JA=Ll(),kp=class extends JA.HelixUser{static{a(this,"HelixPrivilegedUser")}get email(){return this[yb.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};ma.HelixPrivilegedUser=kp;ma.HelixPrivilegedUser=kp=KA.__decorate([(0,yb.rtfm)("api","HelixPrivilegedUser","id")],kp)});var Mp=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixUserBlock=void 0;var fb=(g(),b(f)),ZA=S(),ir=m(),Fl=class extends ir.DataObject{static{a(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[ir.rawDataSymbol].user_id}get userName(){return this[ir.rawDataSymbol].user_login}get userDisplayName(){return this[ir.rawDataSymbol].display_name}async getUser(){return(0,ir.checkRelationAssertion)(await this._client.users.getUserById(this[ir.rawDataSymbol].user_id))}};ya.HelixUserBlock=Fl;fb.__decorate([(0,ZA.Enumerable)(!1)],Fl.prototype,"_client",void 0);ya.HelixUserBlock=Fl=fb.__decorate([(0,ir.rtfm)("api","HelixUserBlock","userId")],Fl)});var Np=u(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.HelixUserApi=void 0;var Lp=(g(),b(f)),Fp=S(),gb=W(),pe=m(),XA=Ae(),bb=_b(),xb=At(),YA=te(),e1=re(),t1=X(),r1=F(),wb=Rp(),i1=Up(),vb=jp(),Nl=Ll(),Sb=Mp(),fa=class extends r1.BaseApi{static{a(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new xb.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new Nl.HelixUser(e,this._client)),this._getUserByNameBatcher=new xb.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new Nl.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(pe.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(pe.extractUserName))}async getUserById(e){let t=(0,pe.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,Fp.mapNullable)(r.data[0],n=>new Nl.HelixUser(n,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,pe.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,pe.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,pe.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var r;let n=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,pe.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((r=n.data)===null||r===void 0)&&r.length))throw new pe.HellFreezesOverError("Could not get authenticated user");return new vb.HelixPrivilegedUser(n.data[0],this._client)}async updateAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,pe.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new vb.HelixPrivilegedUser(r.data[0],this._client)}async getBlocks(e,t){let r=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,pe.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,gb.createBroadcasterQuery)(e),...(0,t1.createPaginationQuery)(t)}});return(0,e1.createPaginatedResult)(r,Sb.HelixUserBlock,this._client)}getBlocksPaginated(e){return new YA.HelixPaginatedRequest({url:"users/blocks",userId:(0,pe.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,gb.createBroadcasterQuery)(e)},this._client,t=>new Sb.HelixUserBlock(t,this._client))}async createBlock(e,t,r={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,pe.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,bb.createUserBlockCreateQuery)(t,r)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,pe.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,bb.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,pe.extractUserId)(e),scopes:t?["channel:manage:extensions"]:["user:read:broadcast","channel:manage:extensions"]})).data.map(n=>new i1.HelixUserExtension(n))}async getActiveExtensions(e,t=!1){let r=(0,pe.extractUserId)(e),n=await this._client.callApi({type:"helix",url:"users/extensions",userId:r,scopes:t?["user:read:broadcast","channel:manage:extensions"]:void 0,query:(0,XA.createSingleKeyQuery)("user_id",r)});return new wb.HelixInstalledExtensionList(n.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,pe.extractUserId)(e),scopes:["channel:manage:extensions"],jsonBody:{data:t}});return new wb.HelixInstalledExtensionList(r.data)}async _getUsers(e,t){if(t.length===0)return[];let r={[e]:t};return(await this._client.callApi({type:"helix",url:"users",query:r})).data.map(s=>new Nl.HelixUser(s,this._client))}};ga.HelixUserApi=fa;Lp.__decorate([(0,Fp.Enumerable)(!1)],fa.prototype,"_getUserByIdBatcher",void 0);Lp.__decorate([(0,Fp.Enumerable)(!1)],fa.prototype,"_getUserByNameBatcher",void 0);ga.HelixUserApi=fa=Lp.__decorate([(0,pe.rtfm)("api","HelixUserApi")],fa)});var Gp=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixVideo=void 0;var Qp=(g(),b(f)),Hb=ai(),n1=S(),B=m(),ba=class extends B.DataObject{static{a(this,"HelixVideo")}constructor(e,t){super(e),this._client=t}get id(){return this[B.rawDataSymbol].id}get userId(){return this[B.rawDataSymbol].user_id}get userName(){return this[B.rawDataSymbol].user_login}get userDisplayName(){return this[B.rawDataSymbol].user_name}async getUser(){return(0,B.checkRelationAssertion)(await this._client.users.getUserById(this[B.rawDataSymbol].user_id))}get title(){return this[B.rawDataSymbol].title}get description(){return this[B.rawDataSymbol].description}get creationDate(){return new Date(this[B.rawDataSymbol].created_at)}get publishDate(){return new Date(this[B.rawDataSymbol].published_at)}get url(){return this[B.rawDataSymbol].url}get thumbnailUrl(){return this[B.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[B.rawDataSymbol].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",t.toString())}get isPublic(){return this[B.rawDataSymbol].viewable==="public"}get views(){return this[B.rawDataSymbol].view_count}get language(){return this[B.rawDataSymbol].language}get type(){return this[B.rawDataSymbol].type}get duration(){return this[B.rawDataSymbol].duration}get durationInSeconds(){let e=this[B.rawDataSymbol].duration.match(/\d+[hms]/g);if(!e)throw new B.HellFreezesOverError(`Could not parse duration string: ${this[B.rawDataSymbol].duration}`);return e.map(t=>{let r=/(\d+)([hms])/.exec(t);if(!r)throw new B.HellFreezesOverError(`Could not parse partial duration string: ${t}`);let[,n,s]=r;return parseInt(n,10)*{h:3600,m:60,s:1}[s]}).reduce((t,r)=>t+r)}get streamId(){return this[B.rawDataSymbol].stream_id}get mutedSegmentData(){var e,t;return(t=(e=this[B.rawDataSymbol].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&t!==void 0?t:[]}isMutedAt(e,t,r=!1){if(this[B.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[B.rawDataSymbol].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);let n=e+t;return r?this[B.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return e<o&&s.offset<n}):this[B.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return s.offset<=e&&n<=o})}};xa.HelixVideo=ba;Qp.__decorate([(0,n1.Enumerable)(!1)],ba.prototype,"_client",void 0);Qp.__decorate([(0,Hb.CachedGetter)()],ba.prototype,"durationInSeconds",null);xa.HelixVideo=ba=Qp.__decorate([Hb.Cacheable,(0,B.rtfm)("api","HelixVideo","id")],ba)});var Wp=u(wa=>{"use strict";var Ql;Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixVideoApi=void 0;var Cb=(g(),b(f)),a1=S(),Gl=m(),s1=At(),o1=te(),l1=re(),u1=X(),c1=F(),Vp=Gp(),Vl=Ql=class extends c1.BaseApi{static{a(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new s1.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new Vp.HelixVideo(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){let t=await this.getVideosByIds([e]);return t.length?t[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,t={}){let r=(0,Gl.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Gl.extractUserId)(e);return this._getVideosPaginated("user_id",[r],t)}async getVideosByGame(e,t={}){return await this._getVideos("game_id",[e],t)}getVideosByGamePaginated(e,t={}){return this._getVideosPaginated("game_id",[e],t)}async deleteVideosByIds(e,t){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:(0,Gl.extractUserId)(e),query:{id:t}})}async _getVideos(e,t,r={}){if(!t.length)return{data:[]};let n=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?t[0]:void 0,query:{...Ql._makeVideosQuery(e,t,r),...(0,u1.createPaginationQuery)(r)}});return(0,l1.createPaginatedResult)(n,Vp.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new o1.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Ql._makeVideosQuery(e,t,r)},this._client,n=>new Vp.HelixVideo(n,this._client))}static _makeVideosQuery(e,t,r={}){let{language:n,period:s,orderBy:o,type:l}=r;return{[e]:t,language:n,period:s,sort:o,type:l}}};wa.HelixVideoApi=Vl;Cb.__decorate([(0,a1.Enumerable)(!1)],Vl.prototype,"_getVideoByIdBatcher",void 0);wa.HelixVideoApi=Vl=Ql=Cb.__decorate([(0,Gl.rtfm)("api","HelixVideoApi")],Vl)});var Eb=u(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.createWhisperQuery=void 0;var qb=m();function d1(i,e){return{from_user_id:(0,qb.extractUserId)(i),to_user_id:(0,qb.extractUserId)(e)}}a(d1,"createWhisperQuery");Wl.createWhisperQuery=d1});var zp=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixWhisperApi=void 0;var h1=(g(),b(f)),Pb=m(),p1=Eb(),_1=F(),$p=class extends _1.BaseApi{static{a(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,Pb.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,p1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};va.HelixWhisperApi=$p;va.HelixWhisperApi=$p=h1.__decorate([(0,Pb.rtfm)("api","HelixWhisperApi")],$p)});var Jp=u($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.ApiReportedRequest=void 0;var Kp=class{static{a(this,"ApiReportedRequest")}constructor(e,t,r){this._options=e,this._httpStatus=t,this._resolvedUserId=r}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}};$l.ApiReportedRequest=Kp});var Kl=u(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.BaseApiClient=void 0;var N=(g(),b(f)),Q=ai(),m1=Ss(),y1=S(),f1=qc(),Vr=W(),zl=Gc(),Ab=m(),g1=Xy(),b1=Xc(),x1=dd(),w1=md(),v1=wd(),S1=jd(),H1=Nd(),C1=Wd(),q1=Zd(),E1=sh(),P1=ph(),A1=yh(),D1=bh(),T1=Sh(),I1=jh(),R1=Qh(),B1=zh(),O1=Yh(),U1=sp(),k1=up(),j1=fp(),M1=vp(),L1=Ep(),F1=Np(),N1=Wp(),Q1=zp(),G1=Jp(),j=class extends f1.EventEmitter{static{a(this,"BaseApiClient")}constructor(e,t,r){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=t,this._rateLimiter=r}async requestScopesForUser(e,t){await this._config.authProvider.getAccessTokenForUser(e,...t.map(r=>[r]))}async getTokenInfo(){try{let e=await this.callApi({type:"auth",url:"validate"});return new zl.TokenInfo(e)}catch(e){throw e instanceof Vr.HttpStatusCodeError&&e.statusCode===401?new zl.InvalidTokenError({cause:e}):e}}async callApi(e){var t;let{authProvider:r}=this._config;if(!((t=e.auth)!==null&&t!==void 0?t:!0))return await(0,Vr.callTwitchApi)(e,r.clientId,void 0,void 0,this._config.fetchOptions);let s=!1;if(e.forceType)switch(e.forceType){case"app":{if(!r.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");let d=await r.getAppAccessToken();return await this._callApiUsingInitialToken(e,d)}case"user":{s=!0;break}default:throw new Ab.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){let d=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!d)throw new Error("Tried to make an API call with a user context but no context user ID");let p=await r.getAccessTokenForUser(d,e.scopes);if(!p)throw new Error(`Tried to make an API call with a user context for user ID ${d} but no token was found`);if((0,zl.accessTokenIsExpired)(p)&&r.refreshAccessTokenForUser){let h=await r.refreshAccessTokenForUser(d);return await this._callApiUsingInitialToken(e,h,!0)}return await this._callApiUsingInitialToken(e,p)}let o=this._getUserIdFromRequestContext(e.userId),l=o===null?await r.getAnyAccessToken():await r.getAnyAccessToken(o??e.userId);if((0,zl.accessTokenIsExpired)(l)&&l.userId&&r.refreshAccessTokenForUser){let d=await r.refreshAccessTokenForUser(l.userId);return await this._callApiUsingInitialToken(e,d,!0)}return await this._callApiUsingInitialToken(e,l)}get bits(){return new b1.HelixBitsApi(this)}get channels(){return new x1.HelixChannelApi(this)}get channelPoints(){return new w1.HelixChannelPointsApi(this)}get charity(){return new v1.HelixCharityApi(this)}get chat(){return new S1.HelixChatApi(this)}get clips(){return new H1.HelixClipApi(this)}get contentClassificationLabels(){return new C1.HelixContentClassificationLabelApi(this)}get entitlements(){return new q1.HelixEntitlementApi(this)}get eventSub(){return new E1.HelixEventSubApi(this)}get extensions(){return new P1.HelixExtensionsApi(this)}get games(){return new A1.HelixGameApi(this)}get hypeTrain(){return new T1.HelixHypeTrainApi(this)}get goals(){return new D1.HelixGoalApi(this)}get moderation(){return new I1.HelixModerationApi(this)}get polls(){return new R1.HelixPollApi(this)}get predictions(){return new B1.HelixPredictionApi(this)}get raids(){return new O1.HelixRaidApi(this)}get schedule(){return new U1.HelixScheduleApi(this)}get search(){return new k1.HelixSearchApi(this)}get streams(){return new j1.HelixStreamApi(this)}get subscriptions(){return new M1.HelixSubscriptionApi(this)}get teams(){return new L1.HelixTeamApi(this)}get users(){return new F1.HelixUserApi(this)}get videos(){return new N1.HelixVideoApi(this)}get whispers(){return new Q1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof m1.ResponseBasedRateLimiter?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _mockServerPort(){return this._config.mockServerPort}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,t,r=!1){var n;let{authProvider:s}=this._config,{authorizationType:o}=s,l=await this._callApiInternal(e,s.clientId,t.accessToken,o);if(l.status===401&&!r){if(t.userId){if(s.refreshAccessTokenForUser){let d=await s.refreshAccessTokenForUser(t.userId);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}else if(s.getAppAccessToken){let d=await s.getAppAccessToken(!0);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}return this.emit(this.onRequest,new G1.ApiReportedRequest(e,l.status,(n=t.userId)!==null&&n!==void 0?n:null)),await(0,Vr.handleTwitchApiResponseError)(l,e),await(0,Vr.transformTwitchApiResponse)(l)}async _callApiInternal(e,t,r,n){var s,o,l;let{fetchOptions:d,mockServerPort:p}=this._config,h=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${h} API: ${(o=e.method)!==null&&o!==void 0?o:"GET"} ${e.url}`),this._logger.trace(`Query: ${JSON.stringify(e.query)}`),e.jsonBody&&this._logger.trace(`Request body: ${JSON.stringify(e.jsonBody)}`);let _=g1.operation({retries:3,minTimeout:500,factor:2}),{promise:H,resolve:A,reject:w}=(0,y1.promiseWithResolvers)();_.attempt(async()=>{try{let D=h==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:r,authorizationType:n,fetchOptions:d,mockServerPort:p}):await(0,Vr.callTwitchApiRaw)(e,t,r,n,d,p);!D.ok&&D.status>=500&&D.status<600&&await(0,Vr.handleTwitchApiResponseError)(D,e),A(D)}catch(D){if(_.retry(D))return;w(_.mainError())}});let C=await H;return this._logger.debug(`Called ${h} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${C.status}`),C}};Sa.BaseApiClient=j;N.__decorate([(0,Q.CachedGetter)()],j.prototype,"bits",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"channels",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"channelPoints",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"charity",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"chat",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"clips",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"contentClassificationLabels",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"entitlements",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"eventSub",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"extensions",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"games",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"hypeTrain",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"goals",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"moderation",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"polls",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"predictions",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"raids",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"schedule",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"search",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"streams",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"subscriptions",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"teams",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"users",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"videos",null);N.__decorate([(0,Q.CachedGetter)()],j.prototype,"whispers",null);Sa.BaseApiClient=j=N.__decorate([Q.Cacheable,(0,Ab.rtfm)("api","ApiClient")],j)});var Db=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.NoContextApiClient=void 0;var V1=(g(),b(f)),W1=m(),$1=Kl(),Zp=class extends $1.BaseApiClient{static{a(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Ha.NoContextApiClient=Zp;Ha.NoContextApiClient=Zp=V1.__decorate([(0,W1.rtfm)("api","ApiClient")],Zp)});var Tb=u(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.UserContextApiClient=void 0;var z1=(g(),b(f)),K1=m(),J1=Kl(),Xp=class extends J1.BaseApiClient{static{a(this,"UserContextApiClient")}constructor(e,t,r,n){super(e,t,r),this._userId=n}_getUserIdFromRequestContext(){return this._userId}};Ca.UserContextApiClient=Xp;Ca.UserContextApiClient=Xp=z1.__decorate([(0,K1.rtfm)("api","ApiClient")],Xp)});var Ob=u(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.ApiClient=void 0;var Z1=(g(),b(f)),X1=Zr(),Y1=Yr(),Ib=Ss(),eD=W(),Bb=m(),tD=wc(),rD=Dy(),iD=Kl(),nD=Db(),Rb=Tb(),Yp=class extends iD.BaseApiClient{static{a(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new tD.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,Y1.createLogger)({name:"twurple:api:client",...e.logger}),X1.isNode?new Ib.PartitionedRateLimiter({getPartitionKey:r=>{var n;return(n=r.userId)!==null&&n!==void 0?n:null},createChild:()=>new rD.HelixRateLimiter({logger:t})}):new Ib.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:async({options:r,clientId:n,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,eD.callTwitchApiRaw)(r,n,s,o,l,d),getPartitionKey:r=>{var n;return(n=r.userId)!==null&&n!==void 0?n:null}}))}async asUser(e,t){let r=new Rb.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,Bb.extractUserId)(e));return await t(r)}async asIntent(e,t){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(let r of e){let n=await this._authProvider.getAccessTokenForIntent(r);if(n){let s=new Rb.UserContextApiClient(this._config,this._logger,this._rateLimiter,n.userId);return await t(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){let t=new nD.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};qa.ApiClient=Yp;qa.ApiClient=Yp=Z1.__decorate([(0,Bb.rtfm)("api","ApiClient")],Yp)});var kb=u(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixFollow=void 0;var Ub=(g(),b(f)),aD=S(),Re=m(),Jl=class extends Re.DataObject{static{a(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[Re.rawDataSymbol].from_id}get userName(){return this[Re.rawDataSymbol].from_login}get userDisplayName(){return this[Re.rawDataSymbol].from_name}async getUser(){return(0,Re.checkRelationAssertion)(await this._client.users.getUserById(this[Re.rawDataSymbol].from_id))}get followedUserId(){return this[Re.rawDataSymbol].to_id}get followedUserName(){return this[Re.rawDataSymbol].to_login}get followedUserDisplayName(){return this[Re.rawDataSymbol].to_name}async getFollowedUser(){return(0,Re.checkRelationAssertion)(await this._client.users.getUserById(this[Re.rawDataSymbol].to_id))}get followDate(){return new Date(this[Re.rawDataSymbol].followed_at)}};Ea.HelixFollow=Jl;Ub.__decorate([(0,aD.Enumerable)(!1)],Jl.prototype,"_client",void 0);Ea.HelixFollow=Jl=Ub.__decorate([(0,Re.rtfm)("api","HelixFollow")],Jl)});var jb=u(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.HelixModerationApi=c.HelixHypeTrainEvent=c.HelixHypeTrainContribution=c.HelixHypeTrainApi=c.HelixGoal=c.HelixGoalApi=c.HelixGame=c.HelixGameApi=c.HelixExtensionTransaction=c.HelixExtensionBitsProduct=c.HelixExtensionsApi=c.HelixPaginatedEventSubSubscriptionsRequest=c.HelixEventSubSubscription=c.HelixEventSubConduitShard=c.HelixEventSubConduit=c.HelixEventSubApi=c.HelixDropsEntitlement=c.HelixEntitlementApi=c.HelixContentClassificationLabel=c.HelixContentClassificationLabelApi=c.HelixClip=c.HelixClipApi=c.HelixSentChatMessage=c.HelixPrivilegedChatSettings=c.HelixEmoteFromSet=c.HelixChannelEmote=c.HelixEmote=c.HelixChatChatter=c.HelixChatSettings=c.HelixChatBadgeVersion=c.HelixChatBadgeSet=c.HelixChatApi=c.HelixCharityCampaignAmount=c.HelixCharityCampaignDonation=c.HelixCharityCampaign=c.HelixCharityApi=c.HelixCustomRewardRedemption=c.HelixCustomReward=c.HelixChannelPointsApi=c.HelixChannelReference=c.HelixFollowedChannel=c.HelixChannelFollower=c.HelixChannelEditor=c.HelixChannel=c.HelixChannelApi=c.HelixCheermoteList=c.HelixBitsLeaderboardEntry=c.HelixBitsLeaderboard=c.HelixBitsApi=c.ApiClient=void 0;c.HelixPaginatedRequestWithTotal=c.HelixPaginatedRequest=c.ApiReportedRequest=c.StreamNotLiveError=c.ConfigError=c.HelixWhisperApi=c.HelixVideo=c.HelixVideoApi=c.HelixUserExtension=c.HelixInstalledExtensionList=c.HelixInstalledExtension=c.HelixBaseExtension=c.HelixUser=c.HelixPrivilegedUser=c.HelixFollow=c.HelixUserBlock=c.HelixUserApi=c.HelixTeamWithUsers=c.HelixTeam=c.HelixTeamApi=c.HelixUserSubscription=c.HelixSubscription=c.HelixSubscriptionApi=c.HelixPaginatedSubscriptionsRequest=c.HelixStreamMarkerWithVideo=c.HelixStreamMarker=c.HelixStream=c.HelixStreamApi=c.HelixChannelSearchResult=c.HelixSearchApi=c.HelixPaginatedScheduleSegmentRequest=c.HelixScheduleSegment=c.HelixSchedule=c.HelixScheduleApi=c.HelixUserRelation=c.HelixRaid=c.HelixRaidApi=c.HelixPredictor=c.HelixPredictionOutcome=c.HelixPrediction=c.HelixPredictionApi=c.HelixPollChoice=c.HelixPoll=c.HelixPollApi=c.HelixShieldModeStatus=c.HelixBlockedTerm=c.HelixBanUser=c.HelixModeratedChannel=c.HelixModerator=c.HelixBan=void 0;c.HellFreezesOverError=c.HelixExtension=c.extractUserName=c.extractUserId=void 0;var sD=Ob();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:function(){return sD.ApiClient}});var oD=Xc();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:function(){return oD.HelixBitsApi}});var lD=$c();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:function(){return lD.HelixBitsLeaderboard}});var uD=Vc();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:function(){return uD.HelixBitsLeaderboardEntry}});var cD=Kc();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:function(){return cD.HelixCheermoteList}});var dD=dd();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:function(){return dD.HelixChannelApi}});var hD=rd();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:function(){return hD.HelixChannel}});var pD=id();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:function(){return pD.HelixChannelEditor}});var _D=nd();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:function(){return _D.HelixChannelFollower}});var mD=ad();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:function(){return mD.HelixFollowedChannel}});var yD=oh();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:function(){return yD.HelixChannelReference}});var fD=md();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:function(){return fD.HelixChannelPointsApi}});var gD=hd();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:function(){return gD.HelixCustomReward}});var bD=pd();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:function(){return bD.HelixCustomRewardRedemption}});var xD=wd();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:function(){return xD.HelixCharityApi}});var wD=fd();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:function(){return wD.HelixCharityCampaign}});var vD=gd();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:function(){return vD.HelixCharityCampaignDonation}});var SD=qo();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:function(){return SD.HelixCharityCampaignAmount}});var HD=jd();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:function(){return HD.HelixChatApi}});var CD=Ed();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:function(){return CD.HelixChatBadgeSet}});var qD=qd();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:function(){return qD.HelixChatBadgeVersion}});var ED=Ro();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:function(){return ED.HelixChatSettings}});var PD=Pd();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:function(){return PD.HelixChatChatter}});var AD=Li();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:function(){return AD.HelixEmote}});var DD=Hd();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:function(){return DD.HelixChannelEmote}});var TD=Dd();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:function(){return TD.HelixEmoteFromSet}});var ID=Rd();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:function(){return ID.HelixPrivilegedChatSettings}});var RD=Od();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:function(){return RD.HelixSentChatMessage}});var BD=Nd();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:function(){return BD.HelixClipApi}});var OD=Md();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:function(){return OD.HelixClip}});var UD=Wd();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:function(){return UD.HelixContentClassificationLabelApi}});var kD=Gd();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:function(){return kD.HelixContentClassificationLabel}});var jD=Zd();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:function(){return jD.HelixEntitlementApi}});var MD=$d();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:function(){return MD.HelixDropsEntitlement}});var LD=sh();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:function(){return LD.HelixEventSubApi}});var FD=eh();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:function(){return FD.HelixEventSubConduit}});var ND=rh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:function(){return ND.HelixEventSubConduitShard}});var QD=Go();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:function(){return QD.HelixEventSubSubscription}});var GD=Yd();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:function(){return GD.HelixPaginatedEventSubSubscriptionsRequest}});var VD=ph();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:function(){return VD.HelixExtensionsApi}});var WD=uh();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:function(){return WD.HelixExtensionBitsProduct}});var $D=ch();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:function(){return $D.HelixExtensionTransaction}});var zD=yh();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:function(){return zD.HelixGameApi}});var KD=Zo();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:function(){return KD.HelixGame}});var JD=bh();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:function(){return JD.HelixGoalApi}});var ZD=fh();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:function(){return ZD.HelixGoal}});var XD=Sh();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:function(){return XD.HelixHypeTrainApi}});var YD=xh();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:function(){return YD.HelixHypeTrainContribution}});var eT=wh();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:function(){return eT.HelixHypeTrainEvent}});var tT=jh();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:function(){return tT.HelixModerationApi}});var rT=Ah();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:function(){return rT.HelixBan}});var iT=Ih();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:function(){return iT.HelixModerator}});var nT=Rh();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:function(){return nT.HelixModeratedChannel}});var aT=nl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:function(){return aT.HelixBanUser}});var sT=Th();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:function(){return sT.HelixBlockedTerm}});var oT=Bh();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:function(){return oT.HelixShieldModeStatus}});var lT=Qh();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:function(){return lT.HelixPollApi}});var uT=Fh();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:function(){return uT.HelixPoll}});var cT=Lh();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:function(){return cT.HelixPollChoice}});var dT=zh();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:function(){return dT.HelixPredictionApi}});var hT=Wh();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:function(){return hT.HelixPrediction}});var pT=Vh();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:function(){return pT.HelixPredictionOutcome}});var _T=Gh();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:function(){return _T.HelixPredictor}});var mT=Yh();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:function(){return mT.HelixRaidApi}});var yT=Jh();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:function(){return yT.HelixRaid}});var fT=uo();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:function(){return fT.HelixUserRelation}});var gT=sp();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:function(){return gT.HelixScheduleApi}});var bT=ip();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:function(){return bT.HelixSchedule}});var xT=Wn();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:function(){return xT.HelixScheduleSegment}});var wT=rp();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:function(){return wT.HelixPaginatedScheduleSegmentRequest}});var vT=up();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:function(){return vT.HelixSearchApi}});var ST=op();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:function(){return ST.HelixChannelSearchResult}});var HT=fp();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:function(){return HT.HelixStreamApi}});var CT=hp();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:function(){return CT.HelixStream}});var qT=Cl();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:function(){return qT.HelixStreamMarker}});var ET=mp();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:function(){return ET.HelixStreamMarkerWithVideo}});var PT=xp();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:function(){return PT.HelixPaginatedSubscriptionsRequest}});var AT=vp();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:function(){return AT.HelixSubscriptionApi}});var DT=Il();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:function(){return DT.HelixSubscription}});var TT=Tl();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:function(){return TT.HelixUserSubscription}});var IT=Ep();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:function(){return IT.HelixTeamApi}});var RT=Ol();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:function(){return RT.HelixTeam}});var BT=Hp();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:function(){return BT.HelixTeamWithUsers}});var OT=Np();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:function(){return OT.HelixUserApi}});var UT=Mp();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:function(){return UT.HelixUserBlock}});var kT=kb();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:function(){return kT.HelixFollow}});var jT=jp();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:function(){return jT.HelixPrivilegedUser}});var MT=Ll();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:function(){return MT.HelixUser}});var LT=jl();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:function(){return LT.HelixBaseExtension}});var FT=Dp();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:function(){return FT.HelixInstalledExtension}});var NT=Rp();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:function(){return NT.HelixInstalledExtensionList}});var QT=Up();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:function(){return QT.HelixUserExtension}});var GT=Wp();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:function(){return GT.HelixVideoApi}});var VT=Gp();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:function(){return VT.HelixVideo}});var WT=zp();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:function(){return WT.HelixWhisperApi}});var $T=wc();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:function(){return $T.ConfigError}});var zT=dp();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:function(){return zT.StreamNotLiveError}});var KT=Jp();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:function(){return KT.ApiReportedRequest}});var JT=te();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:function(){return JT.HelixPaginatedRequest}});var ZT=Cr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:function(){return ZT.HelixPaginatedRequestWithTotal}});var Zl=m();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:function(){return Zl.extractUserId}});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:function(){return Zl.extractUserName}});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:function(){return Zl.HelixExtension}});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:function(){return Zl.HellFreezesOverError}})});var Vb=u((yN,Gb)=>{var Mb=iu(),XT=su(),Lb=Da(),Lt=bt(),Fb=lu(),Nb=cu(),Qb=hu(),Xl=G_(),{ApiClient:YT}=jb(),{AppTokenAuthProvider:eI}=Gc(),e_=class{static{a(this,"EmoteFetcher")}constructor(e,t,r){if(r&&r.apiClient)this.apiClient=r.apiClient;else if(e!==void 0&&t!==void 0){let n=new eI(e,t);this.apiClient=new YT({authProvider:n})}this.emotes=new Lb,this.channels=new Lb,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new XT(this,e),this.channels.set(e,r)),t&&(r.format=t),r}_getRawTwitchEmotes(e){if(!this.apiClient)throw new Error("Client id or client secret not provided.");return e?this.apiClient.chat.getChannelEmotes(e):this.apiClient.chat.getGlobalEmotes()}_cacheTwitchEmote(e,t,r=null){let n=this._setupChannel(e),s=r||new Qb(n,t.id,t);return this.emotes.set(s.code,s),n.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?Lt.BTTV.Channel(e):Lt.BTTV.Global;return Xl.get(t).then(r=>r.data instanceof Array?r.data:[...r.data.channelEmotes,...r.data.sharedEmotes])}_cacheBTTVEmote(e,t,r=null){let n=this._setupChannel(e),s=r||new Mb(n,t.id,t);return this.emotes.set(s.code,s),n.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=Lt.FFZ.Set(e);return Xl.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=Lt.FFZ.Channel(e);return Xl.get(t).then(r=>{let n=[];for(let s of Object.keys(r.data.sets)){let o=r.data.sets[s];n.push(...o.emoticons)}return n})}_cacheFFZEmote(e,t,r=null){let n=this._setupChannel(e),s=r||new Fb(n,t.id,t);return this.emotes.set(s.code,s),n.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?Lt.SevenTV.Channel(e):Lt.SevenTV.Global;return Xl.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,n=null){let s=this._setupChannel(e,r),o=n||new Nb(s,t.id,t);return this.emotes.set(o.code,o),s.emotes.set(o.code,o),o}fetchTwitchEmotes(e=null){return this._getRawTwitchEmotes(e).then(t=>{for(let r of t)this._cacheTwitchEmote(e,{code:r.name,id:r.id,formats:r.formats});return this.channels.get(e).emotes.filter(r=>r.type==="twitch")})}fetchBTTVEmotes(e=null){return this._getRawBTTVEmotes(e).then(t=>{for(let r of t)this._cacheBTTVEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="bttv")})}async fetchFFZEmotes(e=null){return this.ffzModifiersFetched||(this.ffzModifiersFetched=!0,await this._getRawFFZEmoteSet(Lt.FFZ.sets.Modifiers).then(t=>{for(let r of t)this._cacheFFZEmote(null,r)})),e?this._getRawFFZEmotes(e).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")}):this._getRawFFZEmoteSet(Lt.FFZ.sets.Global).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")})}fetchSevenTVEmotes(e=null,t="webp"){return this._getRawSevenTVEmotes(e).then(r=>{if("emotes"in r)for(let n of r.emotes)this._cacheSevenTVEmote(e,n.data,t);else for(let n of r.emote_set.emotes)this._cacheSevenTVEmote(e,n.data,t);return this.channels.get(e).emotes.filter(n=>n.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:Mb,cache:(n,s,o)=>this._cacheBTTVEmote(s,null,o)},ffz:{class:Fb,cache:(n,s,o)=>this._cacheFFZEmote(s,null,o)},"7tv":{class:Nb,cache:(n,s,o)=>this._cacheSevenTVEmote(s,null,n.imageType,o)},twitch:{class:Qb,cache:(n,s,o)=>this._cacheTwitchEmote(s,null,o)}};for(let n of e){let{type:s}=n;if(!Object.keys(r).includes(s))throw new TypeError(`Unknown type: ${s}`);let o=r[s].class;this._setupChannel(n.channel_id,s==="7tv"?n.imageType:null);let l=o.fromObject(n,this.channels.get(n.channel_id));r[s].cache(n,n.channel_id,l),t.push(l)}return t}};Gb.exports=e_});var $b=u((gN,Wb)=>{var tI=bt(),t_=class{static{a(this,"EmoteParser")}constructor(e,t={}){this.fetcher=e,this.options=Object.assign({template:"",type:"markdown",match:/:(.+?):/g},t),this._validateOptions(this.options)}_validateOptions(e){if(e.template&&typeof e.template!="string")throw new TypeError("Template must be a string");if(!["markdown","html","bbcode","plain"].includes(e.type))throw new TypeError("Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`");if(!(e.match instanceof RegExp)||!e.match.global)throw new TypeError("Match must be a global RegExp.")}parse(e,t=0){return e.replace(this.options.match,(n,s)=>{let o=this.fetcher.emotes.get(s);if(!o)return n;if(o.modifier)return"";let l=this.options.template||tI.Templates[this.options.type],d=o.toLink(t);return l.replace(/{link}/g,d).replace(/{name}/g,o.code).replace(/{size}/g,t).replace(/{creator}/g,o.ownerName||"global")})}};Wb.exports=t_});var rI=u((xN,zb)=>{zb.exports={BTTVEmote:iu(),Channel:su(),Collection:Da(),Constants:bt(),Emote:nr(),EmoteFetcher:Vb(),EmoteParser:$b(),FFZEmote:lu(),SevenTVEmote:cu(),TwitchEmote:hu()}});export default rI();
|
|
22
20
|
//# sourceMappingURL=TwitchEmoticons.min.js.map
|