@mkody/twitch-emoticons 2.8.7 → 2.8.9

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,20 +1,20 @@
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:'![{name}]({link} "{name}")',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}
1
+ var Qa=Object.defineProperty;var Bx=Object.getOwnPropertyDescriptor;var Ox=Object.getOwnPropertyNames;var kx=Object.prototype.hasOwnProperty;var n=(i,e)=>Qa(i,"name",{value:e,configurable:!0});var jx=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Mx=(i,e)=>{for(var t in e)Qa(i,t,{get:e[t],enumerable:!0})},Lx=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ox(e))!kx.call(i,a)&&a!==t&&Qa(i,a,{get:()=>e[a],enumerable:!(r=Bx(e,a))||r.enumerable});return i};var b=i=>Lx(Qa({},"__esModule",{value:!0}),i);var yr=u((pR,Am)=>{var bu=class i{static{n(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}}};Am.exports=bu});var Ht=u((_R,Dm)=>{Dm.exports={Twitch:{CDN:n((i,e)=>`https://static-cdn.jtvnw.net/emoticons/v2/${i}/default/dark/${e+1}.0`,"CDN")},BTTV:{Global:"https://api.betterttv.net/3/cached/emotes/global",Channel:n(i=>`https://api.betterttv.net/3/cached/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.betterttv.net/emote/${i}/${e+1}x.webp`,"CDN")},SevenTV:{Global:"https://7tv.io/v3/emote-sets/global",Channel:n(i=>`https://7tv.io/v3/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.7tv.app/emote/${i}/${e}`,"CDN")},FFZ:{sets:{Global:3,Modifiers:1532818},Set:n(i=>`https://api.frankerfacez.com/v1/set/${i}`,"Set"),Channel:n(i=>`https://api.frankerfacez.com/v1/room/id/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/${e}`,"CDN"),CDNAnimated:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/animated/${e}.webp`,"CDNAnimated")},Templates:{html:'<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',markdown:'![{name}]({link} "{name}")',bbcode:"[img]{link}[/img]",plain:"{link}"}}});var wu=u((fR,Im)=>{var Fx=yr(),Nx=Ht(),xu=class i extends Fx{static{n(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 Nx.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}})}};Im.exports=xu});var Ga=u((bR,Tm)=>{var vu=class extends Map{static{n(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 a of this.values()){if(e(a,r,this))return a;r++}return null}return null}filter(e,t){t&&(e=e.bind(t));let r=new this.constructor,a=0;for(let[s,o]of this)e(o,a,this)&&r.set(s,o),a++;return r}map(e,t){t&&(e=e.bind(t));let r=new Array(this.size),a=0;for(let s of this.values())r[a]=e(s,a,this),a++;return r}};Tm.exports=vu});var Hu=u((wR,Rm)=>{var Qx=Ga(),Su=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new Qx}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};Rm.exports=Su});var qu=u((SR,Bm)=>{var Gx=yr(),Um=Ht(),Cu=class i extends Gx{static{n(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?Um.FFZ.CDNAnimated(this.id,e):Um.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((a,s)=>(a[s]=s,a),{});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})}};Bm.exports=Cu});var Pu=u((CR,Om)=>{var Wx=yr(),Vx=Ht(),Eu=class i extends Wx{static{n(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],Vx.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(a=>({format:t.format.toUpperCase(),name:a}));return new i(t,e.id,{code:e.code,name:e.code,animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}})}};Om.exports=Eu});var Du=u((ER,km)=>{var $x=yr(),zx=Ht(),Au=class i extends $x{static{n(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 zx.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}:{}})}};km.exports=Au});var S_=u((AR,v_)=>{"use strict";function Xm(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(Xm,"bind");var{toString:Kx}=Object.prototype,{getPrototypeOf:Gu}=Object,Ja=(i=>e=>{let t=Kx.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ke=n(i=>(i=i.toLowerCase(),e=>Ja(e)===i),"kindOfTest"),Za=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:br}=Array,si=Za("undefined");function Jx(i){return i!==null&&!si(i)&&i.constructor!==null&&!si(i.constructor)&&Te(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(Jx,"isBuffer");var Ym=Ke("ArrayBuffer");function Zx(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Ym(i.buffer),e}n(Zx,"isArrayBufferView");var Xx=Za("string"),Te=Za("function"),e_=Za("number"),Xa=n(i=>i!==null&&typeof i=="object","isObject"),Yx=n(i=>i===!0||i===!1,"isBoolean"),Wa=n(i=>{if(Ja(i)!=="object")return!1;let e=Gu(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},"isPlainObject"),ew=Ke("Date"),tw=Ke("File"),rw=Ke("Blob"),iw=Ke("FileList"),nw=n(i=>Xa(i)&&Te(i.pipe),"isStream"),aw=n(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Te(i.append)&&((e=Ja(i))==="formdata"||e==="object"&&Te(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),sw=Ke("URLSearchParams"),[ow,lw,uw,cw]=["ReadableStream","Request","Response","Headers"].map(Ke),dw=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function oi(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,a;if(typeof i!="object"&&(i=[i]),br(i))for(r=0,a=i.length;r<a;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)}}n(oi,"forEach");function t_(i,e){e=e.toLowerCase();let t=Object.keys(i),r=t.length,a;for(;r-- >0;)if(a=t[r],e===a.toLowerCase())return a;return null}n(t_,"findKey");var zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,r_=n(i=>!si(i)&&i!==zt,"isContextDefined");function Bu(){let{caseless:i}=r_(this)&&this||{},e={},t=n((r,a)=>{let s=i&&t_(e,a)||a;Wa(e[s])&&Wa(r)?e[s]=Bu(e[s],r):Wa(r)?e[s]=Bu({},r):br(r)?e[s]=r.slice():e[s]=r},"assignValue");for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&oi(arguments[r],t);return e}n(Bu,"merge");var hw=n((i,e,t,{allOwnKeys:r}={})=>(oi(e,(a,s)=>{t&&Te(a)?i[s]=Xm(a,t):i[s]=a},{allOwnKeys:r}),i),"extend"),pw=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),mw=n((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"),_w=n((i,e,t,r)=>{let a,s,o,l={};if(e=e||{},i==null)return e;do{for(a=Object.getOwnPropertyNames(i),s=a.length;s-- >0;)o=a[s],(!r||r(o,i,e))&&!l[o]&&(e[o]=i[o],l[o]=!0);i=t!==!1&&Gu(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),yw=n((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"),fw=n(i=>{if(!i)return null;if(br(i))return i;let e=i.length;if(!e_(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),gw=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Gu(Uint8Array)),bw=n((i,e)=>{let r=(i&&i[Symbol.iterator]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),xw=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),ww=Ke("HTMLFormElement"),vw=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),jm=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Sw=Ke("RegExp"),i_=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};oi(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),Hw=n(i=>{i_(i,(e,t)=>{if(Te(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(Te(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"),Cw=n((i,e)=>{let t={},r=n(a=>{a.forEach(s=>{t[s]=!0})},"define");return br(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),qw=n(()=>{},"noop"),Ew=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber"),Iu="abcdefghijklmnopqrstuvwxyz",Mm="0123456789",n_={DIGIT:Mm,ALPHA:Iu,ALPHA_DIGIT:Iu+Iu.toUpperCase()+Mm},Pw=n((i=16,e=n_.ALPHA_DIGIT)=>{let t="",{length:r}=e;for(;i--;)t+=e[Math.random()*r|0];return t},"generateString");function Aw(i){return!!(i&&Te(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}n(Aw,"isSpecCompliantForm");var Dw=n(i=>{let e=new Array(10),t=n((r,a)=>{if(Xa(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[a]=r;let s=br(r)?[]:{};return oi(r,(o,l)=>{let d=t(o,a+1);!si(d)&&(s[l]=d)}),e[a]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),Iw=Ke("AsyncFunction"),Tw=n(i=>i&&(Xa(i)||Te(i))&&Te(i.then)&&Te(i.catch),"isThenable"),a_=((i,e)=>i?setImmediate:e?((t,r)=>(zt.addEventListener("message",({source:a,data:s})=>{a===zt&&s===t&&r.length&&r.shift()()},!1),a=>{r.push(a),zt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Te(zt.postMessage)),Rw=typeof queueMicrotask<"u"?queueMicrotask.bind(zt):typeof process<"u"&&process.nextTick||a_,_={isArray:br,isArrayBuffer:Ym,isBuffer:Jx,isFormData:aw,isArrayBufferView:Zx,isString:Xx,isNumber:e_,isBoolean:Yx,isObject:Xa,isPlainObject:Wa,isReadableStream:ow,isRequest:lw,isResponse:uw,isHeaders:cw,isUndefined:si,isDate:ew,isFile:tw,isBlob:rw,isRegExp:Sw,isFunction:Te,isStream:nw,isURLSearchParams:sw,isTypedArray:gw,isFileList:iw,forEach:oi,merge:Bu,extend:hw,trim:dw,stripBOM:pw,inherits:mw,toFlatObject:_w,kindOf:Ja,kindOfTest:Ke,endsWith:yw,toArray:fw,forEachEntry:bw,matchAll:xw,isHTMLForm:ww,hasOwnProperty:jm,hasOwnProp:jm,reduceDescriptors:i_,freezeMethods:Hw,toObjectSet:Cw,toCamelCase:vw,noop:qw,toFiniteNumber:Ew,findKey:t_,global:zt,isContextDefined:r_,ALPHABET:n_,generateString:Pw,isSpecCompliantForm:Aw,toJSONObject:Dw,isAsyncFn:Iw,isThenable:Tw,setImmediate:a_,asap:Rw};function I(i,e,t,r,a){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),a&&(this.response=a,this.status=a.status?a.status:null)}n(I,"AxiosError");_.inherits(I,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:_.toJSONObject(this.config),code:this.code,status:this.status}},"toJSON")});var s_=I.prototype,o_={};["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=>{o_[i]={value:i}});Object.defineProperties(I,o_);Object.defineProperty(s_,"isAxiosError",{value:!0});I.from=(i,e,t,r,a,s)=>{let o=Object.create(s_);return _.toFlatObject(i,o,n(function(d){return d!==Error.prototype},"filter"),l=>l!=="isAxiosError"),I.call(o,i.message,e,t,r,a),o.cause=i,o.name=i.name,s&&Object.assign(o,s),o};var Uw=null;function Ou(i){return _.isPlainObject(i)||_.isArray(i)}n(Ou,"isVisitable");function l_(i){return _.endsWith(i,"[]")?i.slice(0,-2):i}n(l_,"removeBrackets");function Lm(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=l_(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(Lm,"renderKey");function Bw(i){return _.isArray(i)&&!i.some(Ou)}n(Bw,"isFlatArray");var Ow=_.toFlatObject(_,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function Ya(i,e,t){if(!_.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=_.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,n(function(E,v){return!_.isUndefined(v[E])},"defined"));let r=t.metaTokens,a=t.visitor||p,s=t.dots,o=t.indexes,d=(t.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(e);if(!_.isFunction(a))throw new TypeError("visitor must be a function");function h(w){if(w===null)return"";if(_.isDate(w))return w.toISOString();if(!d&&_.isBlob(w))throw new I("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(w)||_.isTypedArray(w)?d&&typeof Blob=="function"?new Blob([w]):Buffer.from(w):w}n(h,"convertValue");function p(w,E,v){let U=w;if(w&&!v&&typeof w=="object"){if(_.endsWith(E,"{}"))E=r?E:E.slice(0,-2),w=JSON.stringify(w);else if(_.isArray(w)&&Bw(w)||(_.isFileList(w)||_.endsWith(E,"[]"))&&(U=_.toArray(w)))return E=l_(E),U.forEach(n(function($,z){!(_.isUndefined($)||$===null)&&e.append(o===!0?Lm([E],z,s):o===null?E:E+"[]",h($))},"each")),!1}return Ou(w)?!0:(e.append(Lm(v,E,s),h(w)),!1)}n(p,"defaultVisitor");let x=[],P=Object.assign(Ow,{defaultVisitor:p,convertValue:h,isVisitable:Ou});function q(w,E){if(!_.isUndefined(w)){if(x.indexOf(w)!==-1)throw Error("Circular reference detected in "+E.join("."));x.push(w),_.forEach(w,n(function(U,V){(!(_.isUndefined(U)||U===null)&&a.call(e,U,_.isString(V)?V.trim():V,E,P))===!0&&q(U,E?E.concat(V):[V])},"each")),x.pop()}}if(n(q,"build"),!_.isObject(i))throw new TypeError("data must be an object");return q(i),e}n(Ya,"toFormData");function Fm(i){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,n(function(r){return e[r]},"replacer"))}n(Fm,"encode$1");function Wu(i,e){this._pairs=[],i&&Ya(i,this,e)}n(Wu,"AxiosURLSearchParams");var u_=Wu.prototype;u_.append=n(function(e,t){this._pairs.push([e,t])},"append");u_.toString=n(function(e){let t=e?function(r){return e.call(this,r,Fm)}:Fm;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function kw(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}n(kw,"encode");function c_(i,e,t){if(!e)return i;let r=t&&t.encode||kw,a=t&&t.serialize,s;if(a?s=a(e,t):s=_.isURLSearchParams(e)?e.toString():new Wu(e,t).toString(r),s){let o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}n(c_,"buildURL");var ku=class{static{n(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){_.forEach(this.handlers,n(function(r){r!==null&&e(r)},"forEachHandler"))}},Nm=ku,d_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jw=typeof URLSearchParams<"u"?URLSearchParams:Wu,Mw=typeof FormData<"u"?FormData:null,Lw=typeof Blob<"u"?Blob:null,Fw={isBrowser:!0,classes:{URLSearchParams:jw,FormData:Mw,Blob:Lw},protocols:["http","https","file","blob","url","data"]},Vu=typeof window<"u"&&typeof document<"u",ju=typeof navigator=="object"&&navigator||void 0,Nw=Vu&&(!ju||["ReactNative","NativeScript","NS"].indexOf(ju.product)<0),Qw=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gw=Vu&&window.location.href||"http://localhost",Ww=Object.freeze({__proto__:null,hasBrowserEnv:Vu,hasStandardBrowserWebWorkerEnv:Qw,hasStandardBrowserEnv:Nw,navigator:ju,origin:Gw}),He={...Ww,...Fw};function Vw(i,e){return Ya(i,new He.classes.URLSearchParams,Object.assign({visitor:n(function(t,r,a,s){return He.isNode&&_.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor")},e))}n(Vw,"toURLEncodedForm");function $w(i){return _.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n($w,"parsePropPath");function zw(i){let e={},t=Object.keys(i),r,a=t.length,s;for(r=0;r<a;r++)s=t[r],e[s]=i[s];return e}n(zw,"arrayToObject");function h_(i){function e(t,r,a,s){let o=t[s++];if(o==="__proto__")return!0;let l=Number.isFinite(+o),d=s>=t.length;return o=!o&&_.isArray(a)?a.length:o,d?(_.hasOwnProp(a,o)?a[o]=[a[o],r]:a[o]=r,!l):((!a[o]||!_.isObject(a[o]))&&(a[o]=[]),e(t,r,a[o],s)&&_.isArray(a[o])&&(a[o]=zw(a[o])),!l)}if(n(e,"buildPath"),_.isFormData(i)&&_.isFunction(i.entries)){let t={};return _.forEachEntry(i,(r,a)=>{e($w(r),a,t,0)}),t}return null}n(h_,"formDataToJSON");function Kw(i,e,t){if(_.isString(i))try{return(e||JSON.parse)(i),_.trim(i)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(i)}n(Kw,"stringifySafely");var $u={transitional:d_,adapter:["xhr","http","fetch"],transformRequest:[n(function(e,t){let r=t.getContentType()||"",a=r.indexOf("application/json")>-1,s=_.isObject(e);if(s&&_.isHTMLForm(e)&&(e=new FormData(e)),_.isFormData(e))return a?JSON.stringify(h_(e)):e;if(_.isArrayBuffer(e)||_.isBuffer(e)||_.isStream(e)||_.isFile(e)||_.isBlob(e)||_.isReadableStream(e))return e;if(_.isArrayBufferView(e))return e.buffer;if(_.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 Vw(e,this.formSerializer).toString();if((l=_.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return Ya(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),Kw(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||$u.transitional,r=t&&t.forcedJSONParsing,a=this.responseType==="json";if(_.isResponse(e)||_.isReadableStream(e))return e;if(e&&_.isString(e)&&(r&&!this.responseType||a)){let o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?I.from(l,I.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:He.classes.FormData,Blob:He.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],i=>{$u.headers[i]={}});var zu=$u,Jw=_.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"]),Zw=n(i=>{let e={},t,r,a;return i&&i.split(`
2
+ `).forEach(n(function(o){a=o.indexOf(":"),t=o.substring(0,a).trim().toLowerCase(),r=o.substring(a+1).trim(),!(!t||e[t]&&Jw[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),Qm=Symbol("internals");function ai(i){return i&&String(i).trim().toLowerCase()}n(ai,"normalizeHeader");function Va(i){return i===!1||i==null?i:_.isArray(i)?i.map(Va):String(i)}n(Va,"normalizeValue");function Xw(i){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(i);)e[r[1]]=r[2];return e}n(Xw,"parseTokens");var Yw=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function Tu(i,e,t,r,a){if(_.isFunction(r))return r.call(this,e,t);if(a&&(e=t),!!_.isString(e)){if(_.isString(r))return e.indexOf(r)!==-1;if(_.isRegExp(r))return r.test(e)}}n(Tu,"matchHeaderValue");function ev(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(ev,"formatHeader");function tv(i,e){let t=_.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(i,r+t,{value:n(function(a,s,o){return this[r].call(this,e,a,s,o)},"value"),configurable:!0})})}n(tv,"buildAccessors");var fr=class{static{n(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,r){let a=this;function s(l,d,h){let p=ai(d);if(!p)throw new Error("header name must be a non-empty string");let x=_.findKey(a,p);(!x||a[x]===void 0||h===!0||h===void 0&&a[x]!==!1)&&(a[x||d]=Va(l))}n(s,"setHeader");let o=n((l,d)=>_.forEach(l,(h,p)=>s(h,p,d)),"setHeaders");if(_.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(_.isString(e)&&(e=e.trim())&&!Yw(e))o(Zw(e),t);else if(_.isHeaders(e))for(let[l,d]of e.entries())s(d,l,r);else e!=null&&s(t,e,r);return this}get(e,t){if(e=ai(e),e){let r=_.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return Xw(a);if(_.isFunction(t))return t.call(this,a,r);if(_.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ai(e),e){let r=_.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Tu(this,this[r],r,t)))}return!1}delete(e,t){let r=this,a=!1;function s(o){if(o=ai(o),o){let l=_.findKey(r,o);l&&(!t||Tu(r,r[l],l,t))&&(delete r[l],a=!0)}}return n(s,"deleteHeader"),_.isArray(e)?e.forEach(s):s(e),a}clear(e){let t=Object.keys(this),r=t.length,a=!1;for(;r--;){let s=t[r];(!e||Tu(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,r={};return _.forEach(this,(a,s)=>{let o=_.findKey(r,s);if(o){t[o]=Va(a),delete t[s];return}let l=e?ev(s):String(s).trim();l!==s&&delete t[s],t[l]=Va(a),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return _.forEach(this,(r,a)=>{r!=null&&r!==!1&&(t[a]=e&&_.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(a=>r.set(a)),r}static accessor(e){let r=(this[Qm]=this[Qm]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=ai(o);r[l]||(tv(a,o),r[l]=!0)}return n(s,"defineAccessor"),_.isArray(e)?e.forEach(s):s(e),this}};fr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(fr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});_.freezeMethods(fr);var ze=fr;function Ru(i,e){let t=this||zu,r=e||t,a=ze.from(r.headers),s=r.data;return _.forEach(i,n(function(l){s=l.call(t,s,a.normalize(),e?e.status:void 0)},"transform")),a.normalize(),s}n(Ru,"transformData");function p_(i){return!!(i&&i.__CANCEL__)}n(p_,"isCancel");function xr(i,e,t){I.call(this,i??"canceled",I.ERR_CANCELED,e,t),this.name="CanceledError"}n(xr,"CanceledError");_.inherits(xr,I,{__CANCEL__:!0});function m_(i,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?i(t):e(new I("Request failed with status code "+t.status,[I.ERR_BAD_REQUEST,I.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}n(m_,"settle");function rv(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(rv,"parseProtocol");function iv(i,e){i=i||10;let t=new Array(i),r=new Array(i),a=0,s=0,o;return e=e!==void 0?e:1e3,n(function(d){let h=Date.now(),p=r[s];o||(o=h),t[a]=d,r[a]=h;let x=s,P=0;for(;x!==a;)P+=t[x++],x=x%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),h-o<e)return;let q=p&&h-p;return q?Math.round(P*1e3/q):void 0},"push")}n(iv,"speedometer");function nv(i,e){let t=0,r=1e3/e,a,s,o=n((h,p=Date.now())=>{t=p,a=null,s&&(clearTimeout(s),s=null),i.apply(null,h)},"invoke");return[n((...h)=>{let p=Date.now(),x=p-t;x>=r?o(h,p):(a=h,s||(s=setTimeout(()=>{s=null,o(a)},r-x)))},"throttled"),n(()=>a&&o(a),"flush")]}n(nv,"throttle");var za=n((i,e,t=3)=>{let r=0,a=iv(50,250);return nv(s=>{let o=s.loaded,l=s.lengthComputable?s.total:void 0,d=o-r,h=a(d),p=o<=l;r=o;let x={loaded:o,total:l,progress:l?o/l:void 0,bytes:d,rate:h||void 0,estimated:h&&l&&p?(l-o)/h:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};i(x)},t)},"progressEventReducer"),Gm=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),Wm=n(i=>(...e)=>_.asap(()=>i(...e)),"asyncDecorator"),av=He.hasStandardBrowserEnv?n(function(){let e=He.navigator&&/(msie|trident)/i.test(He.navigator.userAgent),t=document.createElement("a"),r;function a(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 n(a,"resolveURL"),r=a(window.location.href),n(function(o){let l=_.isString(o)?a(o):o;return l.protocol===r.protocol&&l.host===r.host},"isURLSameOrigin")},"standardBrowserEnv")():n(function(){return n(function(){return!0},"isURLSameOrigin")},"nonStandardBrowserEnv")(),sv=He.hasStandardBrowserEnv?{write(i,e,t,r,a,s){let o=[i+"="+encodeURIComponent(e)];_.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),_.isString(r)&&o.push("path="+r),_.isString(a)&&o.push("domain="+a),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 ov(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(ov,"isAbsoluteURL");function lv(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n(lv,"combineURLs");function __(i,e){return i&&!ov(e)?lv(i,e):e}n(__,"buildFullPath");var Vm=n(i=>i instanceof ze?{...i}:i,"headersToObject");function Kt(i,e){e=e||{};let t={};function r(h,p,x){return _.isPlainObject(h)&&_.isPlainObject(p)?_.merge.call({caseless:x},h,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,x){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h,x)}else return r(h,p,x)}n(a,"mergeDeepProperties");function s(h,p){if(!_.isUndefined(p))return r(void 0,p)}n(s,"valueFromConfig2");function o(h,p){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h)}else return r(void 0,p)}n(o,"defaultToConfig2");function l(h,p,x){if(x in e)return r(h,p);if(x in i)return r(void 0,h)}n(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:n((h,p)=>a(Vm(h),Vm(p),!0),"headers")};return _.forEach(Object.keys(Object.assign({},i,e)),n(function(p){let x=d[p]||a,P=x(i[p],e[p],p);_.isUndefined(P)&&x!==l||(t[p]=P)},"computeConfigValue")),t}n(Kt,"mergeConfig");var y_=n(i=>{let e=Kt({},i),{data:t,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:l}=e;e.headers=o=ze.from(o),e.url=c_(__(e.baseURL,e.url),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(_.isFormData(t)){if(He.hasStandardBrowserEnv||He.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((d=o.getContentType())!==!1){let[h,...p]=d?d.split(";").map(x=>x.trim()).filter(Boolean):[];o.setContentType([h||"multipart/form-data",...p].join("; "))}}if(He.hasStandardBrowserEnv&&(r&&_.isFunction(r)&&(r=r(e)),r||r!==!1&&av(e.url))){let h=a&&s&&sv.read(s);h&&o.set(a,h)}return e},"resolveConfig"),uv=typeof XMLHttpRequest<"u",cv=uv&&function(i){return new Promise(n(function(t,r){let a=y_(i),s=a.data,o=ze.from(a.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:h}=a,p,x,P,q,w;function E(){q&&q(),w&&w(),a.cancelToken&&a.cancelToken.unsubscribe(p),a.signal&&a.signal.removeEventListener("abort",p)}n(E,"done");let v=new XMLHttpRequest;v.open(a.method.toUpperCase(),a.url,!0),v.timeout=a.timeout;function U(){if(!v)return;let $=ze.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),xe={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:$,config:i,request:v};m_(n(function(de){t(de),E()},"_resolve"),n(function(de){r(de),E()},"_reject"),xe),v=null}n(U,"onloadend"),"onloadend"in v?v.onloadend=U:v.onreadystatechange=n(function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(U)},"handleLoad"),v.onabort=n(function(){v&&(r(new I("Request aborted",I.ECONNABORTED,i,v)),v=null)},"handleAbort"),v.onerror=n(function(){r(new I("Network Error",I.ERR_NETWORK,i,v)),v=null},"handleError"),v.ontimeout=n(function(){let z=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded",xe=a.transitional||d_;a.timeoutErrorMessage&&(z=a.timeoutErrorMessage),r(new I(z,xe.clarifyTimeoutError?I.ETIMEDOUT:I.ECONNABORTED,i,v)),v=null},"handleTimeout"),s===void 0&&o.setContentType(null),"setRequestHeader"in v&&_.forEach(o.toJSON(),n(function(z,xe){v.setRequestHeader(xe,z)},"setRequestHeader")),_.isUndefined(a.withCredentials)||(v.withCredentials=!!a.withCredentials),l&&l!=="json"&&(v.responseType=a.responseType),h&&([P,w]=za(h,!0),v.addEventListener("progress",P)),d&&v.upload&&([x,q]=za(d),v.upload.addEventListener("progress",x),v.upload.addEventListener("loadend",q)),(a.cancelToken||a.signal)&&(p=n($=>{v&&(r(!$||$.type?new xr(null,i,v):$),v.abort(),v=null)},"onCanceled"),a.cancelToken&&a.cancelToken.subscribe(p),a.signal&&(a.signal.aborted?p():a.signal.addEventListener("abort",p)));let V=rv(a.url);if(V&&He.protocols.indexOf(V)===-1){r(new I("Unsupported protocol "+V+":",I.ERR_BAD_REQUEST,i));return}v.send(s||null)},"dispatchXhrRequest"))},dv=n((i,e)=>{let{length:t}=i=i?i.filter(Boolean):[];if(e||t){let r=new AbortController,a,s=n(function(h){if(!a){a=!0,l();let p=h instanceof Error?h:this.reason;r.abort(p instanceof I?p:new xr(p instanceof Error?p.message:p))}},"onabort"),o=e&&setTimeout(()=>{o=null,s(new I(`timeout ${e} of ms exceeded`,I.ETIMEDOUT))},e),l=n(()=>{i&&(o&&clearTimeout(o),o=null,i.forEach(h=>{h.unsubscribe?h.unsubscribe(s):h.removeEventListener("abort",s)}),i=null)},"unsubscribe");i.forEach(h=>h.addEventListener("abort",s));let{signal:d}=r;return d.unsubscribe=()=>_.asap(l),d}},"composeSignals"),hv=dv,pv=n(function*(i,e){let t=i.byteLength;if(!e||t<e){yield i;return}let r=0,a;for(;r<t;)a=r+e,yield i.slice(r,a),r=a},"streamChunk"),mv=n(async function*(i,e){for await(let t of _v(i))yield*pv(t,e)},"readBytes"),_v=n(async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}let e=i.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},"readStream"),$m=n((i,e,t,r)=>{let a=mv(i,e),s=0,o,l=n(d=>{o||(o=!0,r&&r(d))},"_onFinish");return new ReadableStream({async pull(d){try{let{done:h,value:p}=await a.next();if(h){l(),d.close();return}let x=p.byteLength;if(t){let P=s+=x;t(P)}d.enqueue(new Uint8Array(p))}catch(h){throw l(h),h}},cancel(d){return l(d),a.return()}},{highWaterMark:2})},"trackStream"),es=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",f_=es&&typeof ReadableStream=="function",yv=es&&(typeof TextEncoder=="function"?(i=>e=>i.encode(e))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),g_=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),fv=f_&&g_(()=>{let i=!1,e=new Request(He.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!e}),zm=64*1024,Mu=f_&&g_(()=>_.isReadableStream(new Response("").body)),Ka={stream:Mu&&(i=>i.body)};es&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ka[e]&&(Ka[e]=_.isFunction(i[e])?t=>t[e]():(t,r)=>{throw new I(`Response type '${e}' is not supported`,I.ERR_NOT_SUPPORT,r)})})})(new Response);var gv=n(async i=>{if(i==null)return 0;if(_.isBlob(i))return i.size;if(_.isSpecCompliantForm(i))return(await new Request(He.origin,{method:"POST",body:i}).arrayBuffer()).byteLength;if(_.isArrayBufferView(i)||_.isArrayBuffer(i))return i.byteLength;if(_.isURLSearchParams(i)&&(i=i+""),_.isString(i))return(await yv(i)).byteLength},"getBodyLength"),bv=n(async(i,e)=>{let t=_.toFiniteNumber(i.getContentLength());return t??gv(e)},"resolveBodyLength"),xv=es&&(async i=>{let{url:e,method:t,data:r,signal:a,cancelToken:s,timeout:o,onDownloadProgress:l,onUploadProgress:d,responseType:h,headers:p,withCredentials:x="same-origin",fetchOptions:P}=y_(i);h=h?(h+"").toLowerCase():"text";let q=hv([a,s&&s.toAbortSignal()],o),w,E=q&&q.unsubscribe&&(()=>{q.unsubscribe()}),v;try{if(d&&fv&&t!=="get"&&t!=="head"&&(v=await bv(p,r))!==0){let xe=new Request(e,{method:"POST",body:r,duplex:"half"}),it;if(_.isFormData(r)&&(it=xe.headers.get("content-type"))&&p.setContentType(it),xe.body){let[de,mr]=Gm(v,za(Wm(d)));r=$m(xe.body,zm,de,mr)}}_.isString(x)||(x=x?"include":"omit");let U="credentials"in Request.prototype;w=new Request(e,{...P,signal:q,method:t.toUpperCase(),headers:p.normalize().toJSON(),body:r,duplex:"half",credentials:U?x:void 0});let V=await fetch(w),$=Mu&&(h==="stream"||h==="response");if(Mu&&(l||$&&E)){let xe={};["status","statusText","headers"].forEach(_r=>{xe[_r]=V[_r]});let it=_.toFiniteNumber(V.headers.get("content-length")),[de,mr]=l&&Gm(it,za(Wm(l),!0))||[];V=new Response($m(V.body,zm,de,()=>{mr&&mr(),E&&E()}),xe)}h=h||"text";let z=await Ka[_.findKey(Ka,h)||"text"](V,i);return!$&&E&&E(),await new Promise((xe,it)=>{m_(xe,it,{data:z,headers:ze.from(V.headers),status:V.status,statusText:V.statusText,config:i,request:w})})}catch(U){throw E&&E(),U&&U.name==="TypeError"&&/fetch/i.test(U.message)?Object.assign(new I("Network Error",I.ERR_NETWORK,i,w),{cause:U.cause||U}):I.from(U,U&&U.code,i,w)}}),Lu={http:Uw,xhr:cv,fetch:xv};_.forEach(Lu,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var Km=n(i=>`- ${i}`,"renderReason"),wv=n(i=>_.isFunction(i)||i===null||i===!1,"isResolvedHandle"),b_={getAdapter:n(i=>{i=_.isArray(i)?i:[i];let{length:e}=i,t,r,a={};for(let s=0;s<e;s++){t=i[s];let o;if(r=t,!wv(t)&&(r=Lu[(o=String(t)).toLowerCase()],r===void 0))throw new I(`Unknown adapter '${o}'`);if(r)break;a[o||"#"+s]=r}if(!r){let s=Object.entries(a).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(Km).join(`
5
+ `):" "+Km(s[0]):"as no adapter specified";throw new I("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},"getAdapter"),adapters:Lu};function Uu(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new xr(null,i)}n(Uu,"throwIfCancellationRequested");function Jm(i){return Uu(i),i.headers=ze.from(i.headers),i.data=Ru.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),b_.getAdapter(i.adapter||zu.adapter)(i).then(n(function(r){return Uu(i),r.data=Ru.call(i,i.transformResponse,r),r.headers=ze.from(r.headers),r},"onAdapterResolution"),n(function(r){return p_(r)||(Uu(i),r&&r.response&&(r.response.data=Ru.call(i,i.transformResponse,r.response),r.response.headers=ze.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(Jm,"dispatchRequest");var x_="1.7.7",Ku={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{Ku[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var Zm={};Ku.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+x_+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return n(a,"formatMessage"),(s,o,l)=>{if(e===!1)throw new I(a(o," has been removed"+(t?" in "+t:"")),I.ERR_DEPRECATED);return t&&!Zm[o]&&(Zm[o]=!0,console.warn(a(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,l):!0}},"transitional");function vv(i,e,t){if(typeof i!="object")throw new I("options must be an object",I.ERR_BAD_OPTION_VALUE);let r=Object.keys(i),a=r.length;for(;a-- >0;){let s=r[a],o=e[s];if(o){let l=i[s],d=l===void 0||o(l,s,i);if(d!==!0)throw new I("option "+s+" must be "+d,I.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new I("Unknown option "+s,I.ERR_BAD_OPTION)}}n(vv,"assertOptions");var Fu={assertOptions:vv,validators:Ku},Ct=Fu.validators,gr=class{static{n(this,"Axios")}constructor(e){this.defaults=e,this.interceptors={request:new Nm,response:new Nm}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let a;Error.captureStackTrace?Error.captureStackTrace(a={}):a=new Error;let s=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
+ `+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Kt(this.defaults,t);let{transitional:r,paramsSerializer:a,headers:s}=t;r!==void 0&&Fu.assertOptions(r,{silentJSONParsing:Ct.transitional(Ct.boolean),forcedJSONParsing:Ct.transitional(Ct.boolean),clarifyTimeoutError:Ct.transitional(Ct.boolean)},!1),a!=null&&(_.isFunction(a)?t.paramsSerializer={serialize:a}:Fu.assertOptions(a,{encode:Ct.function,serialize:Ct.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&_.merge(s.common,s[t.method]);s&&_.forEach(["delete","get","head","post","put","patch","common"],w=>{delete s[w]}),t.headers=ze.concat(o,s);let l=[],d=!0;this.interceptors.request.forEach(n(function(E){typeof E.runWhen=="function"&&E.runWhen(t)===!1||(d=d&&E.synchronous,l.unshift(E.fulfilled,E.rejected))},"unshiftRequestInterceptors"));let h=[];this.interceptors.response.forEach(n(function(E){h.push(E.fulfilled,E.rejected)},"pushResponseInterceptors"));let p,x=0,P;if(!d){let w=[Jm.bind(this),void 0];for(w.unshift.apply(w,l),w.push.apply(w,h),P=w.length,p=Promise.resolve(t);x<P;)p=p.then(w[x++],w[x++]);return p}P=l.length;let q=t;for(x=0;x<P;){let w=l[x++],E=l[x++];try{q=w(q)}catch(v){E.call(this,v);break}}try{p=Jm.call(this,q)}catch(w){return Promise.reject(w)}for(x=0,P=h.length;x<P;)p=p.then(h[x++],h[x++]);return p}getUri(e){e=Kt(this.defaults,e);let t=__(e.baseURL,e.url);return c_(t,e.params,e.paramsSerializer)}};_.forEach(["delete","get","head","options"],n(function(e){gr.prototype[e]=function(t,r){return this.request(Kt(r||{},{method:e,url:t,data:(r||{}).data}))}},"forEachMethodNoData"));_.forEach(["post","put","patch"],n(function(e){function t(r){return n(function(s,o,l){return this.request(Kt(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}n(t,"generateHTTPMethod"),gr.prototype[e]=t(),gr.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var $a=gr,Nu=class i{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(s){t=s},"promiseExecutor"));let r=this;this.promise.then(a=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](a);r._listeners=null}),this.promise.then=a=>{let s,o=new Promise(l=>{r.subscribe(l),s=l}).then(a);return o.cancel=n(function(){r.unsubscribe(s)},"reject"),o},e(n(function(s,o,l){r.reason||(r.reason=new xr(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)}toAbortSignal(){let e=new AbortController,t=n(r=>{e.abort(r)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new i(n(function(a){e=a},"executor")),cancel:e}}},Sv=Nu;function Hv(i){return n(function(t){return i.apply(null,t)},"wrap")}n(Hv,"spread");function Cv(i){return _.isObject(i)&&i.isAxiosError===!0}n(Cv,"isAxiosError");var Qu={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(Qu).forEach(([i,e])=>{Qu[e]=i});var qv=Qu;function w_(i){let e=new $a(i),t=Xm($a.prototype.request,e);return _.extend(t,$a.prototype,e,{allOwnKeys:!0}),_.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return w_(Kt(i,a))},"create"),t}n(w_,"createInstance");var ie=w_(zu);ie.Axios=$a;ie.CanceledError=xr;ie.CancelToken=Sv;ie.isCancel=p_;ie.VERSION=x_;ie.toFormData=Ya;ie.AxiosError=I;ie.Cancel=ie.CanceledError;ie.all=n(function(e){return Promise.all(e)},"all");ie.spread=Hv;ie.isAxiosError=Cv;ie.mergeConfig=Kt;ie.AxiosHeaders=ze;ie.formToJSON=i=>h_(_.isHTMLForm(i)?new FormData(i):i);ie.getAdapter=b_.getAdapter;ie.HttpStatusCode=qv;ie.default=ie;v_.exports=ie});var f={};Mx(f,{__addDisposableResource:()=>G_,__assign:()=>ts,__asyncDelegator:()=>O_,__asyncGenerator:()=>B_,__asyncValues:()=>k_,__await:()=>wr,__awaiter:()=>A_,__classPrivateFieldGet:()=>F_,__classPrivateFieldIn:()=>Q_,__classPrivateFieldSet:()=>N_,__createBinding:()=>is,__decorate:()=>q_,__disposeResources:()=>W_,__esDecorate:()=>Ev,__exportStar:()=>I_,__extends:()=>H_,__generator:()=>D_,__importDefault:()=>L_,__importStar:()=>M_,__makeTemplateObject:()=>j_,__metadata:()=>P_,__param:()=>E_,__propKey:()=>Av,__read:()=>Zu,__rest:()=>C_,__runInitializers:()=>Pv,__setFunctionName:()=>Dv,__spread:()=>T_,__spreadArray:()=>U_,__spreadArrays:()=>R_,__values:()=>rs,default:()=>Rv});function H_(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ju(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function C_(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 a=0,r=Object.getOwnPropertySymbols(i);a<r.length;a++)e.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(i,r[a])&&(t[r[a]]=i[r[a]]);return t}function q_(i,e,t,r){var a=arguments.length,s=a<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=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}function E_(i,e){return function(t,r){e(t,r,i)}}function Ev(i,e,t,r,a,s){function o(U){if(U!==void 0&&typeof U!="function")throw new TypeError("Function expected");return U}n(o,"accept");for(var l=r.kind,d=l==="getter"?"get":l==="setter"?"set":"value",h=!e&&i?r.static?i:i.prototype:null,p=e||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),x,P=!1,q=t.length-1;q>=0;q--){var w={};for(var E in r)w[E]=E==="access"?{}:r[E];for(var E in r.access)w.access[E]=r.access[E];w.addInitializer=function(U){if(P)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(U||null))};var v=(0,t[q])(l==="accessor"?{get:p.get,set:p.set}:p[d],w);if(l==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(x=o(v.get))&&(p.get=x),(x=o(v.set))&&(p.set=x),(x=o(v.init))&&a.unshift(x)}else(x=o(v))&&(l==="field"?a.unshift(x):p[d]=x)}h&&Object.defineProperty(h,r.name,p),P=!0}function Pv(i,e,t){for(var r=arguments.length>2,a=0;a<e.length;a++)t=r?e[a].call(i,t):e[a].call(i);return r?t:void 0}function Av(i){return typeof i=="symbol"?i:"".concat(i)}function Dv(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 P_(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function A_(i,e,t,r){function a(s){return s instanceof t?s:new t(function(o){o(s)})}return n(a,"adopt"),new(t||(t=Promise))(function(s,o){function l(p){try{h(r.next(p))}catch(x){o(x)}}n(l,"fulfilled");function d(p){try{h(r.throw(p))}catch(x){o(x)}}n(d,"rejected");function h(p){p.done?s(p.value):a(p.value).then(l,d)}n(h,"step"),h((r=r.apply(i,e||[])).next())})}function D_(i,e){var t={label:0,sent:n(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,a,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(h){return function(p){return d([h,p])}}function d(h){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(t=0)),t;)try{if(r=1,a&&(s=h[0]&2?a.return:h[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,h[1])).done)return s;switch(a=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,a=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){t.label=h[1];break}if(h[0]===6&&t.label<s[1]){t.label=s[1],s=h;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(h);break}s[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(i,t)}catch(p){h=[6,p],a=0}finally{r=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function I_(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&is(e,i,t)}function rs(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:n(function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zu(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),a,s=[],o;try{for(;(e===void 0||e-- >0)&&!(a=r.next()).done;)s.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function T_(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(Zu(arguments[e]));return i}function R_(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),a=0,e=0;e<t;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,a++)r[a]=s[o];return r}function U_(i,e,t){if(t||arguments.length===2)for(var r=0,a=e.length,s;r<a;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 wr(i){return this instanceof wr?(this.v=i,this):new wr(i)}function B_(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(q){return function(w){return Promise.resolve(w).then(q,x)}}function l(q,w){r[q]&&(a[q]=function(E){return new Promise(function(v,U){s.push([q,E,v,U])>1||d(q,E)})},w&&(a[q]=w(a[q])))}function d(q,w){try{h(r[q](w))}catch(E){P(s[0][3],E)}}function h(q){q.value instanceof wr?Promise.resolve(q.value.v).then(p,x):P(s[0][2],q)}function p(q){d("next",q)}function x(q){d("throw",q)}function P(q,w){q(w),s.shift(),s.length&&d(s[0][0],s[0][1])}}function O_(i){var e,t;return e={},r("next"),r("throw",function(a){throw a}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(a,s){e[a]=i[a]?function(o){return(t=!t)?{value:wr(i[a](o)),done:!1}:s?s(o):o}:s}}function k_(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 rs=="function"?rs(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),a(l,d,o.done,o.value)})}}function a(s,o,l,d){Promise.resolve(d).then(function(h){s({value:h,done:l})},o)}}function j_(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function M_(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)&&is(e,i,t);return Iv(e,i),e}function L_(i){return i&&i.__esModule?i:{default:i}}function F_(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 N_(i,e,t,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(i,t):a?a.value=t:e.set(i,t),t}function Q_(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 G_(i,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,a;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],t&&(a=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");a&&(r=n(function(){try{a.call(this)}catch(s){return Promise.reject(s)}},"dispose")),i.stack.push({value:e,dispose:r,async:t})}else t&&i.stack.push({async:!0});return e}function W_(i){function e(s){i.error=i.hasError?new Tv(s,i.error,"An error was suppressed during disposal."):s,i.hasError=!0}n(e,"fail");var t,r=0;function a(){for(;t=i.stack.pop();)try{if(!t.async&&r===1)return r=0,i.stack.push(t),Promise.resolve().then(a);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(s).then(a,function(o){return e(o),a()})}else r|=1}catch(o){e(o)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return n(a,"next"),a()}var Ju,ts,is,Iv,Tv,Rv,g=jx(()=>{Ju=n(function(i,e){return Ju=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},Ju(i,e)},"extendStatics");n(H_,"__extends");ts=n(function(){return ts=Object.assign||n(function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),ts.apply(this,arguments)},"__assign");n(C_,"__rest");n(q_,"__decorate");n(E_,"__param");n(Ev,"__esDecorate");n(Pv,"__runInitializers");n(Av,"__propKey");n(Dv,"__setFunctionName");n(P_,"__metadata");n(A_,"__awaiter");n(D_,"__generator");is=Object.create?function(i,e,t,r){r===void 0&&(r=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:n(function(){return e[t]},"get")}),Object.defineProperty(i,r,a)}:function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]};n(I_,"__exportStar");n(rs,"__values");n(Zu,"__read");n(T_,"__spread");n(R_,"__spreadArrays");n(U_,"__spreadArray");n(wr,"__await");n(B_,"__asyncGenerator");n(O_,"__asyncDelegator");n(k_,"__asyncValues");n(j_,"__makeTemplateObject");Iv=Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e};n(M_,"__importStar");n(L_,"__importDefault");n(F_,"__classPrivateFieldGet");n(N_,"__classPrivateFieldSet");n(Q_,"__classPrivateFieldIn");n(G_,"__addDisposableResource");Tv=typeof SuppressedError=="function"?SuppressedError:function(i,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=i,r.suppressed=e,r};n(W_,"__disposeResources");Rv={__extends:H_,__assign:ts,__rest:C_,__decorate:q_,__param:E_,__metadata:P_,__awaiter:A_,__generator:D_,__createBinding:is,__exportStar:I_,__values:rs,__read:Zu,__spread:T_,__spreadArrays:R_,__spreadArray:U_,__await:wr,__asyncGenerator:B_,__asyncDelegator:O_,__asyncValues:k_,__makeTemplateObject:j_,__importStar:M_,__importDefault:L_,__classPrivateFieldGet:F_,__classPrivateFieldSet:N_,__classPrivateFieldIn:Q_,__addDisposableResource:G_,__disposeResources:W_}});var li=u((TR,V_)=>{V_.exports.isNode=!1});var Jt=u(Et=>{"use strict";var qt;Object.defineProperty(Et,"__esModule",{value:!0});Et.LogLevelToConsoleFunction=Et.resolveLogLevel=Et.LogLevel=void 0;var Uv=li(),Ce;(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"})(Ce||(Ce={}));Et.LogLevel=Ce;function Bv(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(Ce,i))return i;var e=Object.keys(Ce).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):Ce.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(Ce,t))throw new Error("Unknown log level string: ".concat(i));return Ce[t]}n(Bv,"resolveLogLevel");Et.resolveLogLevel=Bv;var Ov=Uv.isNode?console.log.bind(console):console.debug.bind(console);Et.LogLevelToConsoleFunction=(qt={},qt[Ce.CRITICAL]=console.error.bind(console),qt[Ce.ERROR]=console.error.bind(console),qt[Ce.WARNING]=console.warn.bind(console),qt[Ce.INFO]=console.info.bind(console),qt[Ce.DEBUG]=Ov.bind(console),qt[Ce.TRACE]=console.trace.bind(console),qt)});var $_=u(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.Enumerable=void 0;function kv(i){return i===void 0&&(i=!0),function(e,t){Object.defineProperty(e,t,{get:n(function(){},"get"),set:n(function(r){Object.defineProperty(this,t,{value:r,writable:!0,enumerable:i})},"set"),enumerable:i})}}n(kv,"Enumerable");ns.Enumerable=kv});var K_=u(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.flatten=void 0;var z_=(g(),b(f));function jv(i){var e;return(e=[]).concat.apply(e,z_.__spreadArray([],z_.__read(i),!1))}n(jv,"flatten");as.flatten=jv});var J_=u(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.partitionedFlatMap=void 0;var Xu=(g(),b(f));function Mv(i,e,t){var r,a,s,o={};try{for(var l=Xu.__values(i),d=l.next();!d.done;d=l.next()){var h=d.value,p=e(h),x=t(h);Array.isArray(x)||(x=[x]),Object.prototype.hasOwnProperty.call(o,p)?(s=o[p]).push.apply(s,Xu.__spreadArray([],Xu.__read(x),!1)):o[p]=x}}catch(P){r={error:P}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(Mv,"partitionedFlatMap");ss.partitionedFlatMap=Mv});var X_=u(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.resolveConfigValueSync=vr.resolveConfigValue=void 0;var Z_=(g(),b(f));function Lv(i){return Z_.__awaiter(this,void 0,void 0,function(){return Z_.__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]}})})}n(Lv,"resolveConfigValue");vr.resolveConfigValue=Lv;function Fv(i){return typeof i=="function"?i():i}n(Fv,"resolveConfigValueSync");vr.resolveConfigValueSync=Fv});var Y_=u(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.deprecateClass=void 0;var Yu=(g(),b(f));function Nv(i,e){var t=!1;return function(r){Yu.__extends(a,r);function a(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return t||(console.warn(e),t=!0),r.apply(this,Yu.__spreadArray([],Yu.__read(s),!1))||this}return n(a,"class_1"),a}(i)}n(Nv,"deprecateClass");os.deprecateClass=Nv});var ty=u(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.match=Zt.eq=void 0;var ey=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return ey(i)},"on")}},"matched"),ec=n(function(i){return{on:n(function(e,t){return e(i)?ey(t(i)):ec(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");Zt.match=ec;var Qv=n(function(i){return function(e){return i===e}},"eq");Zt.eq=Qv;ec.eq=Zt.eq});var iy=u(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.fibWithLimit=void 0;var ry=(g(),b(f));function Gv(i){var e,t,r;return ry.__generator(this,function(a){switch(a.label){case 0:e=0,t=1,a.label=1;case 1:return e<i?[4,e]:[3,3];case 2:return a.sent(),r=ry.__read([t,e+t],2),e=r[0],t=r[1],[3,1];case 3:return[4,i];case 4:return a.sent(),[3,3];case 5:return[2]}})}n(Gv,"fibWithLimit");ls.fibWithLimit=Gv});var cs=u(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.arrayToObject=void 0;var ny=(g(),b(f));function Wv(i,e){return Object.assign.apply(Object,ny.__spreadArray([{}],ny.__read(i.map(e)),!1))}n(Wv,"arrayToObject");us.arrayToObject=Wv});var ay=u(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.entriesToObject=void 0;var Vv=(g(),b(f)),$v=cs();function zv(i){return(0,$v.arrayToObject)(i,function(e){var t,r=Vv.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(zv,"entriesToObject");ds.entriesToObject=zv});var sy=u(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.forEachObjectEntry=void 0;var Kv=(g(),b(f));function Jv(i,e){Object.entries(i).forEach(function(t){var r=Kv.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(Jv,"forEachObjectEntry");hs.forEachObjectEntry=Jv});var oy=u(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.groupBy=void 0;var Zv=(g(),b(f));function Xv(i,e){var t,r,a;if(typeof e!="function"){var s=e;e=n(function(x){return x[s].toString()},"keyFn")}var o={};try{for(var l=Zv.__values(i),d=l.next();!d.done;d=l.next()){var h=d.value,p=e(h);((a=o[p])!==null&&a!==void 0?a:o[p]=[]).push(h)}}catch(x){t={error:x}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return o}n(Xv,"groupBy");ps.groupBy=Xv});var ly=u(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.indexBy=void 0;var Yv=cs();function eS(i,e){if(typeof e!="function"){var t=e;e=n(function(r){return r[t].toString()},"keyFn")}return(0,Yv.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(eS,"indexBy");ms.indexBy=eS});var uy=u(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.mapObject=void 0;var tc=(g(),b(f));function tS(i,e){var t=Object.entries(i).map(function(r){var a,s=tc.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,tc.__spreadArray([{}],tc.__read(t),!1))}n(tS,"mapObject");_s.mapObject=tS});var rc=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.pick=void 0;var ys=(g(),b(f));function rS(i,e){return Object.assign.apply(Object,ys.__spreadArray([{}],ys.__read(Object.entries(i).filter(function(t){var r=ys.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=ys.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(rS,"pick");fs.pick=rS});var cy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.omit=void 0;var iS=rc();function nS(i,e){return(0,iS.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(nS,"omit");gs.omit=nS});var dy=u(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.mapOptional=Pt.mapNullable=Pt.isNullish=void 0;function ic(i){return i==null}n(ic,"isNullish");Pt.isNullish=ic;function aS(i,e){return ic(i)?null:e(i)}n(aS,"mapNullable");Pt.mapNullable=aS;function sS(i,e){return ic(i)?void 0:e(i)}n(sS,"mapOptional");Pt.mapOptional=sS});var py=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.delay=void 0;var hy=(g(),b(f));function oS(i){return hy.__awaiter(this,void 0,void 0,function(){return hy.__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]}})})}n(oS,"delay");bs.delay=oS});var my=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.promiseWithResolvers=void 0;function lS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(lS,"promiseWithResolvers");xs.promiseWithResolvers=lS});var _y=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.padLeft=void 0;function uS(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}n(uS,"padLeft");ws.padLeft=uS});var yy=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.splitWithLimit=void 0;var nc=(g(),b(f));function cS(i,e,t){var r=i.split(e);return r.length<=t?r:nc.__spreadArray(nc.__spreadArray([],nc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(cS,"splitWithLimit");vs.splitWithLimit=cS});var fy=u(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.utf8Substring=Sr.utf8Length=void 0;var Ss=(g(),b(f));function dS(i){return Ss.__spreadArray([],Ss.__read(i),!1).length}n(dS,"utf8Length");Sr.utf8Length=dS;function hS(i,e,t){return Ss.__spreadArray([],Ss.__read(i),!1).slice(e,t).join("")}n(hS,"utf8Substring");Sr.utf8Substring=hS});var H=u(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.utf8Substring=A.utf8Length=A.splitWithLimit=A.padLeft=A.promiseWithResolvers=A.delay=A.mapOptional=A.mapNullable=A.isNullish=A.pick=A.omit=A.mapObject=A.indexBy=A.groupBy=A.forEachObjectEntry=A.entriesToObject=A.arrayToObject=A.fibWithLimit=A.eq=A.match=A.deprecateClass=A.resolveConfigValueSync=A.resolveConfigValue=A.partitionedFlatMap=A.flatten=A.Enumerable=void 0;var pS=$_();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return pS.Enumerable},"get")});var mS=K_();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return mS.flatten},"get")});var _S=J_();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return _S.partitionedFlatMap},"get")});var gy=X_();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return gy.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return gy.resolveConfigValueSync},"get")});var yS=Y_();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return yS.deprecateClass},"get")});var by=ty();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return by.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return by.eq},"get")});var fS=iy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return fS.fibWithLimit},"get")});var gS=cs();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return gS.arrayToObject},"get")});var bS=ay();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return bS.entriesToObject},"get")});var xS=sy();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return xS.forEachObjectEntry},"get")});var wS=oy();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return wS.groupBy},"get")});var vS=ly();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return vS.indexBy},"get")});var SS=uy();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return SS.mapObject},"get")});var HS=cy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return HS.omit},"get")});var CS=rc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return CS.pick},"get")});var ac=dy();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return ac.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return ac.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return ac.mapOptional},"get")});var qS=py();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return qS.delay},"get")});var ES=my();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return ES.promiseWithResolvers},"get")});var PS=_y();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return PS.padLeft},"get")});var AS=yy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return AS.splitWithLimit},"get")});var xy=fy();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return xy.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return xy.utf8Substring},"get")})});var uc=u(Cs=>{"use strict";var sc,oc;Object.defineProperty(Cs,"__esModule",{value:!0});Cs.getMinLogLevelFromEnv=void 0;var DS=Jt(),Hs=typeof process>"u"?[]:(oc=(sc=process.env.LOGGING)===null||sc===void 0?void 0:sc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,DS.resolveLogLevel)(r)]:null}).filter(function(i){return!!i}).sort(function(i,e){var t,r,a=i[0],s=e[0];return((t=s?.length)!==null&&t!==void 0?t:0)-((r=a?.length)!==null&&r!==void 0?r:0)}))!==null&&oc!==void 0?oc:[],lc=Hs.findIndex(function(i){var e=i[0];return!e}),wy=void 0;lc!==-1&&(wy=Hs[lc][1],Hs.splice(lc));function IS(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(IS,"isPrefix");function TS(i){for(var e=i.split(":"),t=0,r=Hs;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(IS(e,s))return o}return wy}n(TS,"getMinLogLevelFromEnv");Cs.getMinLogLevelFromEnv=TS});var cc=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.BaseLogger=void 0;var RS=H(),US=li(),BS=uc(),At=Jt(),OS=function(){function i(e){var t=e.name,r=e.minLevel,a=e.emoji,s=a===void 0?!1:a,o=e.colors,l=e.timestamps,d=l===void 0?US.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,RS.mapOptional)(r,function(x){return(0,At.resolveLogLevel)(x)}))!==null&&h!==void 0?h:(0,BS.getMinLogLevelFromEnv)(t))!==null&&p!==void 0?p:At.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=d}return n(i,"BaseLogger"),i.prototype.crit=function(e){this.log(At.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(At.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(At.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(At.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(At.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(At.LogLevel.TRACE,e)},i}();qs.BaseLogger=OS});var vy=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.BrowserLogger=void 0;var kS=(g(),b(f)),jS=Jt(),MS=cc(),LS=function(i){kS.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"BrowserLogger"),e.prototype.log=function(t,r){if(!(t>this._minLevel)){var a=jS.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e}(MS.BaseLogger);Es.BrowserLogger=LS});var Sy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.CustomLoggerWrapper=void 0;var FS=H(),NS=uc(),Re=Jt(),QS=function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,FS.mapOptional)(r,function(o){return(0,Re.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,NS.getMinLogLevelFromEnv)(t),this._override=typeof a=="function"?{log:a}:a}return n(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(Re.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Re.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this._override.error?this._shouldLog(Re.LogLevel.ERROR)&&this._override.error(e):this.log(Re.LogLevel.ERROR,e)},i.prototype.warn=function(e){this._override.warn?this._shouldLog(Re.LogLevel.WARNING)&&this._override.warn(e):this.log(Re.LogLevel.WARNING,e)},i.prototype.info=function(e){this._override.info?this._shouldLog(Re.LogLevel.INFO)&&this._override.info(e):this.log(Re.LogLevel.INFO,e)},i.prototype.debug=function(e){this._override.debug?this._shouldLog(Re.LogLevel.DEBUG)&&this._override.debug(e):this.log(Re.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this._override.trace?this._shouldLog(Re.LogLevel.TRACE)&&this._override.trace(e):this.log(Re.LogLevel.TRACE,e)},i.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},i}();Ps.CustomLoggerWrapper=QS});var Hy=u(qe=>{"use strict";var Dt,It,Tt;Object.defineProperty(qe,"__esModule",{value:!0});qe.NodeLogger=qe.LogLevelToBackgroundColor=qe.LogLevelToColor=qe.LogLevelToEmoji=void 0;var GS=(g(),b(f)),re=Jt(),WS=cc();qe.LogLevelToEmoji=(Dt={},Dt[re.LogLevel.CRITICAL]="\u{1F6D1}",Dt[re.LogLevel.ERROR]="\u274C",Dt[re.LogLevel.WARNING]="\u26A0\uFE0F ",Dt[re.LogLevel.INFO]="\u2139\uFE0F ",Dt[re.LogLevel.DEBUG]="\u{1F41E}",Dt[re.LogLevel.TRACE]="\u{1F43E}",Dt);var VS={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},$S={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 As(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(As,"createGenericWrapper");function nt(i){return As(VS[i],39)}n(nt,"createColorWrapper");function ui(i,e){return As($S[i],49,e)}n(ui,"createBgWrapper");qe.LogLevelToColor=(It={},It[re.LogLevel.CRITICAL]=nt("red"),It[re.LogLevel.ERROR]=nt("redBright"),It[re.LogLevel.WARNING]=nt("yellow"),It[re.LogLevel.INFO]=nt("blue"),It[re.LogLevel.DEBUG]=nt("magenta"),It[re.LogLevel.TRACE]=As(0,0),It);qe.LogLevelToBackgroundColor=(Tt={},Tt[re.LogLevel.CRITICAL]=ui("bgRed",nt("white")),Tt[re.LogLevel.ERROR]=ui("bgRedBright",nt("white")),Tt[re.LogLevel.WARNING]=ui("bgYellow",nt("black")),Tt[re.LogLevel.INFO]=ui("bgBlue",nt("white")),Tt[re.LogLevel.DEBUG]=ui("bgMagenta",nt("black")),Tt[re.LogLevel.TRACE]=As(7,27),Tt);var zS=function(i){GS.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"NodeLogger"),e.prototype.log=function(t,r){var a,s,o;if(!(t>this._minLevel)){var l=re.LogLevelToConsoleFunction[t],d="";if(this._timestamps&&(d+="[".concat(new Date().toISOString(),"] ")),this._emoji){var h=qe.LogLevelToEmoji[t];d+="".concat(h," ")}var p=(o=(a=this._colors)!==null&&a!==void 0?a:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;p?d+="".concat(qe.LogLevelToBackgroundColor[t](this._name)," ").concat(qe.LogLevelToBackgroundColor[t](re.LogLevel[t])," ").concat(qe.LogLevelToColor[t](r)):d+="[".concat(this._name,":").concat(re.LogLevel[t].toLowerCase(),"] ").concat(r),l(d)}},e}(WS.BaseLogger);qe.NodeLogger=zS});var Cy=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.createLogger=void 0;var KS=li(),JS=vy(),ZS=Sy(),XS=Hy();function YS(i){return i.custom?new ZS.CustomLoggerWrapper(i):KS.isNode?new XS.NodeLogger(i):new JS.BrowserLogger(i)}n(YS,"createLogger");Ds.createLogger=YS});var ci=u(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LogLevel=Hr.createLogger=void 0;var e0=Cy();Object.defineProperty(Hr,"createLogger",{enumerable:!0,get:n(function(){return e0.createLogger},"get")});var t0=Jt();Object.defineProperty(Hr,"LogLevel",{enumerable:!0,get:n(function(){return t0.LogLevel},"get")})});var hc=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.CustomError=void 0;var dc=class extends Error{static{n(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}};Is.CustomError=dc});var mc=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.RetryAfterError=void 0;var r0=hc(),pc=class extends r0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Ts.RetryAfterError=pc});var di=u(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.RateLimitReachedError=void 0;var i0=hc(),_c=class extends i0.CustomError{static{n(this,"RateLimitReachedError")}};Rs.RateLimitReachedError=_c});var qy=u(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.NullRateLimiter=void 0;var yc=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};Us.NullRateLimiter=yc});var gc=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.ResponseBasedRateLimiter=void 0;var n0=ci(),a0=H(),s0=di(),Ey=mc(),fc=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,n0.createLogger)({name:"rate-limiter",emoji:!0,...e})}async request(e,t){return this._logger.trace("request start"),await new Promise((r,a)=>{var s;let o={req:e,resolve:r,reject:a,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,a,s;return{lastKnownLimit:(t=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&t!==void 0?t:null,lastKnownRemainingRequests:(a=(r=this._parameters)===null||r===void 0?void 0:r.remaining)!==null&&a!==void 0?a:null,lastKnownResetDate:(0,a0.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:h}=o;try{let p=await this.doRequest(l),x=this.needsToRetryAfter(p);if(x!==null)throw this._queue.unshift(o),this._logger.info(`Retrying after ${x} ms`),new Ey.RetryAfterError(x);let P=this.getParametersFromResponse(p);return d(p),P}catch(p){if(p instanceof Ey.RetryAfterError)throw p;h(p);return}}),r=await Promise.allSettled(t),a=r.filter(o=>o.status==="rejected"),s=Date.now();if(a.length){this._logger.trace("runRequestBatch some rejected");let l=Math.max(s,...a.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 s0.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")}};Bs.ResponseBasedRateLimiter=fc});var Py=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.PartitionedRateLimiter=void 0;var o0=gc(),bc=class{static{n(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 o0.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}};Os.PartitionedRateLimiter=bc});var Ay=u(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.PartitionedTimeBasedRateLimiter=void 0;var l0=ci(),u0=di(),xc=class{static{n(this,"PartitionedTimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a,getPartitionKey:s}){this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._paused=!1,this._logger=(0,l0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a,this._partitionKeyCallback=s}async request(e,t){return await new Promise((r,a)=>{var s,o;let l={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"},d=this._partitionKeyCallback(e),h=(o=this._usedFromBucket.get(d))!==null&&o!==void 0?o:0;if(h>=this._bucketSize||this._paused)switch(l.limitReachedBehavior){case"enqueue":{let p=this._getPartitionedQueue(d);p.push(l),h+p.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 ${p.length}`):this._logger.info(`Enqueueing request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused; queue size is ${p.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 u0.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 a=this._getPartitionedQueue(t);this._logger.debug(`doing a request for ${t?`partition ${t}`:"default partition"}, new queue length is ${a.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),a.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)}};ks.PartitionedTimeBasedRateLimiter=xc});var vc=u(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.TimeBasedRateLimiter=void 0;var c0=ci(),d0=di(),wc=class{static{n(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a}){this._queue=[],this._usedFromBucket=0,this._paused=!1,this._logger=(0,c0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a}async request(e,t){return await new Promise((r,a)=>{var s;let o={req:e,resolve:r,reject:a,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 d0.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:a}=e;try{r(await this._callback(t))}catch(s){a(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)}};js.TimeBasedRateLimiter=wc});var Dy=u(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.TimedPassthruRateLimiter=void 0;var h0=vc(),Sc=class extends h0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};Ms.TimedPassthruRateLimiter=Sc});var Ls=u(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.TimedPassthruRateLimiter=he.TimeBasedRateLimiter=he.ResponseBasedRateLimiter=he.PartitionedTimeBasedRateLimiter=he.PartitionedRateLimiter=he.NullRateLimiter=he.RateLimitReachedError=he.RetryAfterError=void 0;var p0=mc();Object.defineProperty(he,"RetryAfterError",{enumerable:!0,get:n(function(){return p0.RetryAfterError},"get")});var m0=di();Object.defineProperty(he,"RateLimitReachedError",{enumerable:!0,get:n(function(){return m0.RateLimitReachedError},"get")});var _0=qy();Object.defineProperty(he,"NullRateLimiter",{enumerable:!0,get:n(function(){return _0.NullRateLimiter},"get")});var y0=Py();Object.defineProperty(he,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return y0.PartitionedRateLimiter},"get")});var f0=Ay();Object.defineProperty(he,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return f0.PartitionedTimeBasedRateLimiter},"get")});var g0=gc();Object.defineProperty(he,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return g0.ResponseBasedRateLimiter},"get")});var b0=vc();Object.defineProperty(he,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return b0.TimeBasedRateLimiter},"get")});var x0=Dy();Object.defineProperty(he,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return x0.TimedPassthruRateLimiter},"get")})});var Ry=u((mt,Ty)=>{var Iy=typeof self<"u"?self:mt,Fs=function(){function i(){this.fetch=!1,this.DOMException=Iy.DOMException}return n(i,"F"),i.prototype=Iy,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 a(y){return y&&DataView.prototype.isPrototypeOf(y)}if(n(a,"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()}n(l,"normalizeName");function d(y){return typeof y!="string"&&(y=String(y)),y}n(d,"normalizeValue");function h(y){var S={next:n(function(){var R=y.shift();return{done:R===void 0,value:R}},"next")};return r.iterable&&(S[Symbol.iterator]=function(){return S}),S}n(h,"iteratorFor");function p(y){this.map={},y instanceof p?y.forEach(function(S,R){this.append(R,S)},this):Array.isArray(y)?y.forEach(function(S){this.append(S[0],S[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(S){this.append(S,y[S])},this)}n(p,"Headers"),p.prototype.append=function(y,S){y=l(y),S=d(S);var R=this.map[y];this.map[y]=R?R+", "+S:S},p.prototype.delete=function(y){delete this.map[l(y)]},p.prototype.get=function(y){return y=l(y),this.has(y)?this.map[y]:null},p.prototype.has=function(y){return this.map.hasOwnProperty(l(y))},p.prototype.set=function(y,S){this.map[l(y)]=d(S)},p.prototype.forEach=function(y,S){for(var R in this.map)this.map.hasOwnProperty(R)&&y.call(S,this.map[R],R,this)},p.prototype.keys=function(){var y=[];return this.forEach(function(S,R){y.push(R)}),h(y)},p.prototype.values=function(){var y=[];return this.forEach(function(S){y.push(S)}),h(y)},p.prototype.entries=function(){var y=[];return this.forEach(function(S,R){y.push([R,S])}),h(y)},r.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function x(y){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}n(x,"consumed");function P(y){return new Promise(function(S,R){y.onload=function(){S(y.result)},y.onerror=function(){R(y.error)}})}n(P,"fileReaderReady");function q(y){var S=new FileReader,R=P(S);return S.readAsArrayBuffer(y),R}n(q,"readBlobAsArrayBuffer");function w(y){var S=new FileReader,R=P(S);return S.readAsText(y),R}n(w,"readBlobAsText");function E(y){for(var S=new Uint8Array(y),R=new Array(S.length),we=0;we<S.length;we++)R[we]=String.fromCharCode(S[we]);return R.join("")}n(E,"readArrayBufferAsText");function v(y){if(y.slice)return y.slice(0);var S=new Uint8Array(y.byteLength);return S.set(new Uint8Array(y)),S.buffer}n(v,"bufferClone");function U(){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&&a(y)?(this._bodyArrayBuffer=v(y.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(y)||o(y))?this._bodyArrayBuffer=v(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=x(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?x(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(q)}),this.text=function(){var y=x(this);if(y)return y;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(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(xe)}),this.json=function(){return this.text().then(JSON.parse)},this}n(U,"Body");var V=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(y){var S=y.toUpperCase();return V.indexOf(S)>-1?S:y}n($,"normalizeMethod");function z(y,S){S=S||{};var R=S.body;if(y instanceof z){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,S.headers||(this.headers=new p(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!R&&y._bodyInit!=null&&(R=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=S.credentials||this.credentials||"same-origin",(S.headers||!this.headers)&&(this.headers=new p(S.headers)),this.method=$(S.method||this.method||"GET"),this.mode=S.mode||this.mode||null,this.signal=S.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(R)}n(z,"Request"),z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function xe(y){var S=new FormData;return y.trim().split("&").forEach(function(R){if(R){var we=R.split("="),fe=we.shift().replace(/\+/g," "),F=we.join("=").replace(/\+/g," ");S.append(decodeURIComponent(fe),decodeURIComponent(F))}}),S}n(xe,"decode");function it(y){var S=new p,R=y.replace(/\r?\n[\t ]+/g," ");return R.split(/\r?\n/).forEach(function(we){var fe=we.split(":"),F=fe.shift().trim();if(F){var Na=fe.join(":").trim();S.append(F,Na)}}),S}n(it,"parseHeaders"),U.call(z.prototype);function de(y,S){S||(S={}),this.type="default",this.status=S.status===void 0?200:S.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in S?S.statusText:"OK",this.headers=new p(S.headers),this.url=S.url||"",this._initBody(y)}n(de,"Response"),U.call(de.prototype),de.prototype.clone=function(){return new de(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},de.error=function(){var y=new de(null,{status:0,statusText:""});return y.type="error",y};var mr=[301,302,303,307,308];de.redirect=function(y,S){if(mr.indexOf(S)===-1)throw new RangeError("Invalid status code");return new de(null,{status:S,headers:{location:y}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(S,R){this.message=S,this.name=R;var we=Error(S);this.stack=we.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function _r(y,S){return new Promise(function(R,we){var fe=new z(y,S);if(fe.signal&&fe.signal.aborted)return we(new t.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function Na(){F.abort()}n(Na,"abortXhr"),F.onload=function(){var ni={status:F.status,statusText:F.statusText,headers:it(F.getAllResponseHeaders()||"")};ni.url="responseURL"in F?F.responseURL:ni.headers.get("X-Request-URL");var gu="response"in F?F.response:F.responseText;R(new de(gu,ni))},F.onerror=function(){we(new TypeError("Network request failed"))},F.ontimeout=function(){we(new TypeError("Network request failed"))},F.onabort=function(){we(new t.DOMException("Aborted","AbortError"))},F.open(fe.method,fe.url,!0),fe.credentials==="include"?F.withCredentials=!0:fe.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&r.blob&&(F.responseType="blob"),fe.headers.forEach(function(ni,gu){F.setRequestHeader(gu,ni)}),fe.signal&&(fe.signal.addEventListener("abort",Na),F.onreadystatechange=function(){F.readyState===4&&fe.signal.removeEventListener("abort",Na)}),F.send(typeof fe._bodyInit>"u"?null:fe._bodyInit)})}return n(_r,"fetch"),_r.polyfill=!0,i.fetch||(i.fetch=_r,i.Headers=p,i.Request=z,i.Response=de),t.Headers=p,t.Request=z,t.Response=de,t.fetch=_r,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(Fs);Fs.fetch.ponyfill=!0;delete Fs.fetch.polyfill;var Cr=Fs;mt=Cr.fetch;mt.default=Cr.fetch;mt.fetch=Cr.fetch;mt.Headers=Cr.Headers;mt.Request=Cr.Request;mt.Response=Cr.Response;Ty.exports=mt});var Ns=u((sB,By)=>{"use strict";var Hc=Object.prototype.hasOwnProperty,qr=Array.isArray,at=function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i}(),w0=n(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(qr(r)){for(var a=[],s=0;s<r.length;++s)typeof r[s]<"u"&&a.push(r[s]);t.obj[t.prop]=a}}},"compactQueue"),Uy=n(function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(r[a]=e[a]);return r},"arrayToObject"),v0=n(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(qr(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!Hc.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 qr(e)&&!qr(t)&&(a=Uy(e,r)),qr(e)&&qr(t)?(t.forEach(function(s,o){if(Hc.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 Hc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),S0=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),H0=n(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"),C0=n(function(e,t,r){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)),r==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var s="",o=0;o<a.length;++o){var l=a.charCodeAt(o);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122){s+=a.charAt(o);continue}if(l<128){s=s+at[l];continue}if(l<2048){s=s+(at[192|l>>6]+at[128|l&63]);continue}if(l<55296||l>=57344){s=s+(at[224|l>>12]+at[128|l>>6&63]+at[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|a.charCodeAt(o)&1023),s+=at[240|l>>18]+at[128|l>>12&63]+at[128|l>>6&63]+at[128|l&63]}return s},"encode"),q0=n(function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],a=0;a<t.length;++a)for(var s=t[a],o=s.obj[s.prop],l=Object.keys(o),d=0;d<l.length;++d){var h=l[d],p=o[h];typeof p=="object"&&p!==null&&r.indexOf(p)===-1&&(t.push({obj:o,prop:h}),r.push(p))}return w0(t),e},"compact"),E0=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),P0=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),A0=n(function(e,t){return[].concat(e,t)},"combine");By.exports={arrayToObject:Uy,assign:S0,combine:A0,compact:q0,decode:H0,encode:C0,isBuffer:P0,isRegExp:E0,merge:v0}});var Cc=u((lB,ky)=>{"use strict";var D0=String.prototype.replace,I0=/%20/g,T0=Ns(),Oy={RFC1738:"RFC1738",RFC3986:"RFC3986"};ky.exports=T0.assign({default:Oy.RFC3986,formatters:{RFC1738:n(function(i){return D0.call(i,I0,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},Oy)});var Ny=u((cB,Fy)=>{"use strict";var Ly=Ns(),hi=Cc(),R0=Object.prototype.hasOwnProperty,jy={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")},Er=Array.isArray,U0=Array.prototype.push,qc=n(function(i,e){U0.apply(i,Er(e)?e:[e])},"pushToArray"),B0=Date.prototype.toISOString,My=hi.default,ve={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Ly.encode,encodeValuesOnly:!1,format:My,formatter:hi.formatters[My],indices:!1,serializeDate:n(function(e){return B0.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},O0=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),k0=n(function i(e,t,r,a,s,o,l,d,h,p,x,P,q){var w=e;if(typeof l=="function"?w=l(t,w):w instanceof Date?w=p(w):r==="comma"&&Er(w)&&(w=w.join(",")),w===null){if(a)return o&&!P?o(t,ve.encoder,q,"key"):t;w=""}if(O0(w)||Ly.isBuffer(w)){if(o){var E=P?t:o(t,ve.encoder,q,"key");return[x(E)+"="+x(o(w,ve.encoder,q,"value"))]}return[x(t)+"="+x(String(w))]}var v=[];if(typeof w>"u")return v;var U;if(Er(l))U=l;else{var V=Object.keys(w);U=d?V.sort(d):V}for(var $=0;$<U.length;++$){var z=U[$];s&&w[z]===null||(Er(w)?qc(v,i(w[z],typeof r=="function"?r(t,z):t,r,a,s,o,l,d,h,p,x,P,q)):qc(v,i(w[z],t+(h?"."+z:"["+z+"]"),r,a,s,o,l,d,h,p,x,P,q)))}return v},"stringify"),j0=n(function(e){if(!e)return ve;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||ve.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=hi.default;if(typeof e.format<"u"){if(!R0.call(hi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=hi.formatters[r],s=ve.filter;return(typeof e.filter=="function"||Er(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:ve.addQueryPrefix,allowDots:typeof e.allowDots>"u"?ve.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ve.charsetSentinel,delimiter:typeof e.delimiter>"u"?ve.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ve.encode,encoder:typeof e.encoder=="function"?e.encoder:ve.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ve.encodeValuesOnly,filter:s,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ve.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ve.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ve.strictNullHandling}},"normalizeStringifyOptions");Fy.exports=function(i,e){var t=i,r=j0(e),a,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):Er(r.filter)&&(s=r.filter,a=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in jy?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=jy[l];a||(a=Object.keys(t)),r.sort&&a.sort(r.sort);for(var h=0;h<a.length;++h){var p=a[h];r.skipNulls&&t[p]===null||qc(o,k0(t[p],p,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 x=o.join(r.delimiter),P=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?P+="utf8=%26%2310003%3B&":P+="utf8=%E2%9C%93&"),x.length>0?P+x:""}});var Vy=u((hB,Wy)=>{"use strict";var pi=Ns(),Ec=Object.prototype.hasOwnProperty,Qy=Array.isArray,ge={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:pi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},M0=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),Gy=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),L0=n(function(e,t){if(Qy(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),F0="utf8=%26%2310003%3B",N0="utf8=%E2%9C%93",Q0=n(function(e,t){var r={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=a.split(t.delimiter,s),l=-1,d,h=t.charset;if(t.charsetSentinel)for(d=0;d<o.length;++d)o[d].indexOf("utf8=")===0&&(o[d]===N0?h="utf-8":o[d]===F0&&(h="iso-8859-1"),l=d,d=o.length);for(d=0;d<o.length;++d)if(d!==l){var p=o[d],x=p.indexOf("]="),P=x===-1?p.indexOf("="):x+1,q,w;P===-1?(q=t.decoder(p,ge.decoder,h,"key"),w=t.strictNullHandling?null:""):(q=t.decoder(p.slice(0,P),ge.decoder,h,"key"),w=L0(Gy(p.slice(P+1),t),function(E){return t.decoder(E,ge.decoder,h,"value")})),w&&t.interpretNumericEntities&&h==="iso-8859-1"&&(w=M0(w)),p.indexOf("[]=")>-1&&(w=Qy(w)?[w]:w),Ec.call(r,q)?r[q]=pi.combine(r[q],w):r[q]=w}return r},"parseQueryStringValues"),G0=n(function(i,e,t,r){for(var a=r?e:Gy(e,t),s=i.length-1;s>=0;--s){var o,l=i[s];if(l==="[]"&&t.parseArrays)o=[].concat(a);else{o=t.plainObjects?Object.create(null):{};var d=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,h=parseInt(d,10);!t.parseArrays&&d===""?o={0:a}:!isNaN(h)&&l!==d&&String(h)===d&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=a):o[d]=a}a=o}return a},"parseObject"),W0=n(function(e,t,r,a){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,d=r.depth>0&&o.exec(s),h=d?s.slice(0,d.index):s,p=[];if(h){if(!r.plainObjects&&Ec.call(Object.prototype,h)&&!r.allowPrototypes)return;p.push(h)}for(var x=0;r.depth>0&&(d=l.exec(s))!==null&&x<r.depth;){if(x+=1,!r.plainObjects&&Ec.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(d[1])}return d&&p.push("["+s.slice(d.index)+"]"),G0(p,t,r,a)}},"parseQueryStringKeys"),V0=n(function(e){if(!e)return ge;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"?ge.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?ge.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ge.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ge.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ge.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ge.comma,decoder:typeof e.decoder=="function"?e.decoder:ge.decoder,delimiter:typeof e.delimiter=="string"||pi.isRegExp(e.delimiter)?e.delimiter:ge.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ge.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ge.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ge.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ge.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ge.strictNullHandling}},"normalizeParseOptions");Wy.exports=function(i,e){var t=V0(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?Q0(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=W0(l,r[l],t,typeof i=="string");a=pi.merge(a,d,t)}return pi.compact(a)}});var Pc=u((mB,$y)=>{"use strict";var $0=Ny(),z0=Vy(),K0=Cc();$y.exports={formats:K0,parse:z0,stringify:$0}});var Ky=u(zy=>{function _t(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]=_t(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:_t(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=_t(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=_t(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(a){t.add(_t(a))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(a,s){t.set(_t(s),_t(a))}),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(_t(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}n(_t,"klona");zy.klona=_t});var Dc=u(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.DataObject=st.getRawData=st.rawDataSymbol=void 0;var J0=Ky();st.rawDataSymbol=Symbol("twurpleRawData");function Z0(i){return(0,J0.klona)(i[st.rawDataSymbol])}n(Z0,"getRawData");st.getRawData=Z0;var Ac=class{static{n(this,"DataObject")}constructor(e){this[st.rawDataSymbol]=e}};st.DataObject=Ac});var Gs=u(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.CustomError=void 0;var Ic=class extends Error{static{n(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=Ic});var Rc=u(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.RelationAssertionError=void 0;var X0=Gs(),Tc=class extends X0.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};Ws.RelationAssertionError=Tc});var Jy=u(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.checkRelationAssertion=void 0;var Y0=Rc();function eH(i){if(i==null)throw new Y0.RelationAssertionError;return i}n(eH,"checkRelationAssertion");Vs.checkRelationAssertion=eH});var Uc=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.rtfm=void 0;function tH(i,e,t){return r=>{let a=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:a,enumerable:!1})}}n(tH,"rtfm");$s.rtfm=tH});var Zy=u(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.HelixExtension=void 0;var rH=(g(),b(f)),D=Dc(),iH=Uc(),Bc=class extends D.DataObject{static{n(this,"HelixExtension")}get authorName(){return this[D.rawDataSymbol].author_name}get bitsEnabled(){return this[D.rawDataSymbol].bits_enabled}get installable(){return this[D.rawDataSymbol].can_install}get configurationLocation(){return this[D.rawDataSymbol].configuration_location}get description(){return this[D.rawDataSymbol].description}get tosUrl(){return this[D.rawDataSymbol].eula_tos_url}get hasChatSupport(){return this[D.rawDataSymbol].has_chat_support}get iconUrl(){return this[D.rawDataSymbol].icon_url}getIconUrl(e){return this[D.rawDataSymbol].icon_urls[e]}get id(){return this[D.rawDataSymbol].id}get name(){return this[D.rawDataSymbol].name}get privacyPolicyUrl(){return this[D.rawDataSymbol].privacy_policy_url}get requestsIdentityLink(){return this[D.rawDataSymbol].request_identity_link}get screenshotUrls(){return this[D.rawDataSymbol].screenshot_urls}get state(){return this[D.rawDataSymbol].state}get subscriptionsSupportLevel(){return this[D.rawDataSymbol].subscriptions_support_level}get summary(){return this[D.rawDataSymbol].summary}get supportEmail(){return this[D.rawDataSymbol].support_email}get version(){return this[D.rawDataSymbol].version}get viewerSummery(){return this[D.rawDataSymbol].viewer_summary}get allowedConfigUrls(){return this[D.rawDataSymbol].allowlisted_config_urls}get allowedPanelUrls(){return this[D.rawDataSymbol].allowlisted_panel_urls}get mobileViewerUrl(){var e,t;return(t=(e=this[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.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[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}};mi.HelixExtension=Bc;mi.HelixExtension=Bc=rH.__decorate([(0,iH.rtfm)("api","HelixExtension","id")],Bc)});var Xy=u(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.HellFreezesOverError=void 0;var nH=Gs(),Oc=class extends nH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};zs.HellFreezesOverError=Oc});var Yy=u(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.extractUserName=Pr.extractUserId=void 0;function aH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(aH,"extractUserId");Pr.extractUserId=aH;function sH(i){return typeof i=="string"?i:i.name}n(sH,"extractUserName");Pr.extractUserName=sH});var m=u(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.extractUserName=K.extractUserId=K.RelationAssertionError=K.HellFreezesOverError=K.CustomError=K.HelixExtension=K.rtfm=K.checkRelationAssertion=K.rawDataSymbol=K.getRawData=K.DataObject=void 0;var kc=Dc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return kc.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return kc.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return kc.rawDataSymbol},"get")});var oH=Jy();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return oH.checkRelationAssertion},"get")});var lH=Uc();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return lH.rtfm},"get")});var uH=Zy();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return uH.HelixExtension},"get")});var cH=Gs();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return cH.CustomError},"get")});var dH=Xy();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return dH.HellFreezesOverError},"get")});var hH=Rc();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return hH.RelationAssertionError},"get")});var ef=Yy();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return ef.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return ef.extractUserName},"get")})});var Mc=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.HttpStatusCodeError=void 0;var pH=m(),jc=class extends pH.CustomError{static{n(this,"HttpStatusCodeError")}constructor(e,t,r,a,s,o){super(`Encountered HTTP status code ${e}: ${t}
7
7
 
8
8
  URL: ${r}
9
- Method: ${n}
9
+ Method: ${a}
10
10
  Body:
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.
11
+ ${!o&&s.length>150?`${s.slice(0,147)}...`:s}`),this._statusCode=e,this._url=r,this._method=a,this._body=s}get statusCode(){return this._statusCode}get url(){return this._url}get method(){return this._method}get body(){return this._body}};Ks.HttpStatusCodeError=jc});var Lc=u(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.transformTwitchApiResponse=Ar.handleTwitchApiResponseError=void 0;var mH=Pc(),_H=Mc();async function yH(i,e){var t;if(!i.ok){let r=i.headers.get("Content-Type")==="application/json",a=r?JSON.stringify(await i.json(),null,2):await i.text(),s=(0,mH.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new _H.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(yH,"handleTwitchApiResponseError");Ar.handleTwitchApiResponseError=yH;async function fH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(fH,"transformTwitchApiResponse");Ar.transformTwitchApiResponse=fH});var tf=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.getTwitchApiUrl=void 0;function gH(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}}n(gH,"getTwitchApiUrl");Js.getTwitchApiUrl=gH});var sf=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.callTwitchApi=Dr.callTwitchApiRaw=void 0;var rf=Ry(),bH=Pc(),nf=Lc(),xH=tf();async function af(i,e,t,r,a={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",h=(0,xH.getTwitchApiUrl)(i.url,d,s),p=(0,bH.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),x=new rf.Headers({Accept:"application/json"}),P;i.jsonBody&&(P=JSON.stringify(i.jsonBody),x.append("Content-Type","application/json")),e&&d!=="auth"&&x.append("Client-ID",e),t&&x.append("Authorization",`${d==="helix"?r??"Bearer":"OAuth"} ${t}`);let q={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:x,body:P};return await(0,rf.default)(`${h}${p}`,q)}n(af,"callTwitchApiRaw");Dr.callTwitchApiRaw=af;async function wH(i,e,t,r,a={}){let s=await af(i,e,t,r,a);return await(0,nf.handleTwitchApiResponseError)(s,i),await(0,nf.transformTwitchApiResponse)(s)}n(wH,"callTwitchApi");Dr.callTwitchApi=wH});var of=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.createBroadcasterQuery=void 0;var vH=m();function SH(i){return{broadcaster_id:(0,vH.extractUserId)(i)}}n(SH,"createBroadcasterQuery");Zs.createBroadcasterQuery=SH});var J=u(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.HttpStatusCodeError=Ee.transformTwitchApiResponse=Ee.handleTwitchApiResponseError=Ee.createBroadcasterQuery=Ee.callTwitchApiRaw=Ee.callTwitchApi=void 0;var lf=sf();Object.defineProperty(Ee,"callTwitchApi",{enumerable:!0,get:n(function(){return lf.callTwitchApi},"get")});Object.defineProperty(Ee,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return lf.callTwitchApiRaw},"get")});var HH=of();Object.defineProperty(Ee,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return HH.createBroadcasterQuery},"get")});var uf=Lc();Object.defineProperty(Ee,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return uf.handleTwitchApiResponseError},"get")});Object.defineProperty(Ee,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return uf.transformTwitchApiResponse},"get")});var CH=Mc();Object.defineProperty(Ee,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return CH.HttpStatusCodeError},"get")})});var Nc=u(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.ConfigError=void 0;var qH=m(),Fc=class extends qH.CustomError{static{n(this,"ConfigError")}};Xs.ConfigError=Fc});var cf=u(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.HelixRateLimiter=void 0;var EH=Ls(),PH=J(),Qc=class extends EH.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,PH.callTwitchApiRaw)(e,t,r,a,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}}};Ys.HelixRateLimiter=Qc});var _i=u(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.createCacheKey=void 0;function AH(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()}}n(AH,"createSingleCacheKey");function DH(i,e,t){return[i,...e.map(AH)].join("/")+(t?"/":"")}n(DH,"createCacheKey");eo.createCacheKey=DH});var df=u(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.Cacheable=void 0;var IH=_i(),yt=Symbol("cache");function TH(i){var e,t;return t=class extends i{static{n(this,"_b")}constructor(){super(...arguments),this[e]=new Map}getFromCache(r){if(this._cleanCache(),this[yt].has(r)){let a=this[yt].get(r);if(a)return a.value}}setCache(r,a,s){this[yt].set(r,{value:a,expires:Date.now()+s*1e3})}removeFromCache(r,a){let s=this._getInternalCacheKey(r,a);a?this[yt].forEach((o,l)=>{l.startsWith(s)&&this[yt].delete(l)}):this[yt].delete(s)}_cleanCache(){let r=Date.now();this[yt].forEach((a,s)=>{a.expires<r&&this[yt].delete(s)})}_getInternalCacheKey(r,a){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,IH.createCacheKey)(s,r,a)}}},e=yt,t}n(TH,"Cacheable");to.Cacheable=TH});var hf=u(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.Cached=void 0;var RH=_i();function UH(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,RH.createCacheKey)(r,o),d=this.getFromCache(l);if(d)return d;let h=await s.apply(this,o);return(h!=null||e)&&this.setCache(l,h,i),h},a}}n(UH,"Cached");ro.Cached=UH});var pf=u(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.CachedGetter=void 0;var BH=_i();function OH(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,BH.createCacheKey)(t,[]),o=this.getFromCache(s);if(o)return o;let l=a.call(this);return this.setCache(s,l,i),l}}return r}}n(OH,"CachedGetter");io.CachedGetter=OH});var mf=u(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.ClearsCache=void 0;function kH(i,e){return function(t,r,a){let s=a.value;return a.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},a}}n(kH,"ClearsCache");no.ClearsCache=kH});var yi=u(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.createCacheKey=je.ClearsCache=je.CachedGetter=je.Cached=je.Cacheable=void 0;var jH=df();Object.defineProperty(je,"Cacheable",{enumerable:!0,get:n(function(){return jH.Cacheable},"get")});var MH=hf();Object.defineProperty(je,"Cached",{enumerable:!0,get:n(function(){return MH.Cached},"get")});var LH=pf();Object.defineProperty(je,"CachedGetter",{enumerable:!0,get:n(function(){return LH.CachedGetter},"get")});var FH=mf();Object.defineProperty(je,"ClearsCache",{enumerable:!0,get:n(function(){return FH.ClearsCache},"get")});var NH=_i();Object.defineProperty(je,"createCacheKey",{enumerable:!0,get:n(function(){return NH.createCacheKey},"get")})});var Wc=u(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.Listener=void 0;var Gc=class{static{n(this,"Listener")}constructor(e,t,r,a=!1){this.owner=e,this.event=t,this.listener=r,this._internal=a}unbind(){this.owner.removeListener(this)}};ao.Listener=Gc});var _f=u(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.EventEmitter=void 0;var QH=Wc(),Vc=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 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=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,r){let a=e?this._eventListeners:this._internalEventListeners;return a.has(t)?a.get(t).push(r):a.set(t,[r]),new QH.Listener(this,t,r,e)}_removeListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;if(!t)a.clear();else if(typeof t=="object"){let s=t;this._removeListener(s._internal,s.event,s.listener)}else{let s=t;if(a.has(s))if(r){let o=a.get(s),l=0;for(;(l=o.indexOf(r))!==-1;)o.splice(l,1)}else a.delete(s)}}};so.EventEmitter=Vc});var $c=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.Listener=Ir.EventEmitter=void 0;var GH=_f();Object.defineProperty(Ir,"EventEmitter",{enumerable:!0,get:n(function(){return GH.EventEmitter},"get")});var WH=Wc();Object.defineProperty(Ir,"Listener",{enumerable:!0,get:n(function(){return WH.Listener},"get")})});var oo=u(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.accessTokenIsExpired=Tr.getExpiryDateOfAccessToken=void 0;var zc=H(),VH=6e4;function yf(i){return(0,zc.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-VH)}n(yf,"getExpiryMillis");function $H(i){return(0,zc.mapNullable)(yf(i),e=>new Date(e))}n($H,"getExpiryDateOfAccessToken");Tr.getExpiryDateOfAccessToken=$H;function zH(i){var e;return(e=(0,zc.mapNullable)(yf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(zH,"accessTokenIsExpired");Tr.accessTokenIsExpired=zH});var uo=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.InvalidTokenError=void 0;var KH=m(),Kc=class extends KH.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};lo.InvalidTokenError=Kc});var ho=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.InvalidTokenTypeError=void 0;var JH=m(),Jc=class extends JH.CustomError{static{n(this,"InvalidTokenTypeError")}};co.InvalidTokenTypeError=Jc});var ff=u(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.createRevokeTokenQuery=ot.createRefreshTokenQuery=ot.createGetAppTokenQuery=ot.createExchangeCodeQuery=void 0;function ZH(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(ZH,"createExchangeCodeQuery");ot.createExchangeCodeQuery=ZH;function XH(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(XH,"createGetAppTokenQuery");ot.createGetAppTokenQuery=XH;function YH(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(YH,"createRefreshTokenQuery");ot.createRefreshTokenQuery=YH;function eC(i,e){return{client_id:i,token:e}}n(eC,"createRevokeTokenQuery");ot.createRevokeTokenQuery=eC});var Xc=u(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.TokenInfo=void 0;var tC=(g(),b(f)),rC=H(),Xt=m(),Zc=class extends Xt.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[Xt.rawDataSymbol].client_id}get userId(){var e;return(e=this[Xt.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[Xt.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[Xt.rawDataSymbol].scopes}get expiryDate(){return(0,rC.mapNullable)(this[Xt.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};fi.TokenInfo=Zc;fi.TokenInfo=Zc=tC.__decorate([(0,Xt.rtfm)("auth","TokenInfo","clientId")],Zc)});var bi=u(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.loadAndCompareTokenInfo=Z.compareScopeSets=Z.compareScopes=Z.getValidTokenFromProviderForIntent=Z.getValidTokenFromProviderForUser=Z.getTokenInfo=Z.revokeToken=Z.refreshUserToken=Z.getAppToken=Z.exchangeCode=void 0;var Rr=J(),gi=uo(),iC=ho(),po=ff(),nC=Xc();function Yc(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()}}n(Yc,"createAccessTokenFromData");async function aC(i,e,t,r){return Yc(await(0,Rr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,po.createExchangeCodeQuery)(i,e,t,r)}))}n(aC,"exchangeCode");Z.exchangeCode=aC;async function sC(i,e){return Yc(await(0,Rr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,po.createGetAppTokenQuery)(i,e)}))}n(sC,"getAppToken");Z.getAppToken=sC;async function oC(i,e,t){return Yc(await(0,Rr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,po.createRefreshTokenQuery)(i,e,t)}))}n(oC,"refreshUserToken");Z.refreshUserToken=oC;async function lC(i,e){await(0,Rr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,po.createRevokeTokenQuery)(i,e)})}n(lC,"revokeToken");Z.revokeToken=lC;async function Ur(i,e){try{let t=await(0,Rr.callTwitchApi)({type:"auth",url:"validate"},e,i);return new nC.TokenInfo(t)}catch(t){throw t instanceof Rr.HttpStatusCodeError&&t.statusCode===401?new gi.InvalidTokenError({cause:t}):t}}n(Ur,"getTokenInfo");Z.getTokenInfo=Ur;async function uC(i,e,t,r){let a=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await Ur(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof gi.InvalidTokenError?a=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 Ur(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof gi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(uC,"getValidTokenFromProviderForUser");Z.getValidTokenFromProviderForUser=uC;async function cC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new iC.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 Ur(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof gi.InvalidTokenError?a=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 Ur(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof gi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(cC,"getValidTokenFromProviderForIntent");Z.getValidTokenFromProviderForIntent=cC;var dC=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 gf(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=dC.get(r))!==null&&a!==void 0?a:[]]}));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.
12
12
  If you need dynamically upgrading scopes, please implement the AuthProvider interface accordingly:
13
13
 
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.
14
+ https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}n(gf,"compareScopes");Z.compareScopes=gf;function bf(i,e){for(let t of e)gf(i,t)}n(bf,"compareScopeSets");Z.compareScopeSets=bf;async function hC(i,e,t,r,a){if(a?.length||!t){let s=await Ur(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 a&&bf(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(hC,"loadAndCompareTokenInfo");Z.loadAndCompareTokenInfo=hC});var _o=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.TokenFetcher=void 0;var xf=H(),ed=class{static{n(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:h}=(0,xf.promiseWithResolvers)();this._queuePromise=l,this._queueExecutor=async()=>{var p;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(x){h(x)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(p=this._queueExecutor)===null||p===void 0||p.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...r];let{promise:a,resolve:s,reject:o}=(0,xf.promiseWithResolvers)();this._newTokenPromise=a;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 a}};mo.TokenFetcher=ed});var wf=u(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.AppTokenAuthProvider=void 0;var yo=(g(),b(f)),td=H(),pC=m(),mC=oo(),_C=bi(),yC=_o(),Br=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new yC.TokenFetcher(async a=>await this._fetch(a))}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,mC.accessTokenIsExpired)(this._token)?this._token=await(0,_C.getAppToken)(this._clientId,this._clientSecret):this._token}};xi.AppTokenAuthProvider=Br;yo.__decorate([(0,td.Enumerable)(!1)],Br.prototype,"_clientSecret",void 0);yo.__decorate([(0,td.Enumerable)(!1)],Br.prototype,"_token",void 0);yo.__decorate([(0,td.Enumerable)(!1)],Br.prototype,"_fetcher",void 0);xi.AppTokenAuthProvider=Br=yo.__decorate([(0,pC.rtfm)("auth","AppTokenAuthProvider","clientId")],Br)});var id=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.CachedRefreshFailureError=void 0;var fC=m(),rd=class extends fC.CustomError{static{n(this,"CachedRefreshFailureError")}constructor(e){super(`The user context for the user ${e} has been disabled.
15
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).
16
16
 
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.
17
+ Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}};fo.CachedRefreshFailureError=rd});var ad=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.IntermediateUserRemovalError=void 0;var gC=m(),nd=class extends gC.CustomError{static{n(this,"IntermediateUserRemovalError")}constructor(e){super(`User ${e} was removed while trying to fetch a token.
18
18
 
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();
19
+ Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}};go.IntermediateUserRemovalError=nd});var od=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.UnknownIntentError=void 0;var bC=m(),sd=class extends bC.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};bo.UnknownIntentError=sd});var Hf=u(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.RefreshingAuthProvider=void 0;var Or=(g(),b(f)),wi=H(),xC=$c(),Me=m(),ld=oo(),vf=id(),wC=ad(),ud=uo(),vC=ho(),SC=od(),lt=bi(),Sf=_o(),Rt=class extends xC.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 Sf.TokenFetcher(async r=>await this._fetchAppToken(r))}addUser(e,t,r){let a=(0,Me.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 Sf.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,ld.accessTokenIsExpired)(e))try{let l=await(0,lt.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof ud.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new ud.InvalidTokenError;let l=await(0,lt.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),d=await(0,lt.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,d.userId,l),r=[l,d]}let[a,s]=r;if(!s.userId)throw new vC.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=a.scope?a:{...a,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,lt.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(r,t)}hasUser(e){return this._userTokenFetchers.has((0,Me.extractUserId)(e))}removeUser(e){let t=(0,Me.extractUserId)(e);if(this._userIdToIntents.has(t)){let r=this._userIdToIntents.get(t);for(let a of r)this._intentToUserId.delete(a);this._userIdToIntents.delete(t)}this._userAccessTokens.delete(t),this._userTokenFetchers.delete(t),this._cachedRefreshFailures.delete(t)}addIntentsToUser(e,t){let r=(0,Me.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 a of t)this._intentToUserId.has(a)&&this._userIdToIntents.get(this._intentToUserId.get(a)).delete(a),this._intentToUserId.set(a,r),this._userIdToIntents.has(r)?this._userIdToIntents.get(r).add(a):this._userIdToIntents.set(r,new Set([a]))}getIntentsForUser(e){let t=(0,Me.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 a=this._intentToUserId.get(r);(t=this._userIdToIntents.get(a))===null||t===void 0||t.delete(r),this._intentToUserId.delete(r)}}async refreshAccessTokenForUser(e){let t=(0,Me.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new vf.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 a=await this._refreshUserTokenWithCallback(t,r.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 SC.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,Me.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,Me.extractUserId)(e),a=this._userTokenFetchers.get(r);if(!a)return null;if(this._cachedRefreshFailures.has(r))throw new vf.CachedRefreshFailureError(r);return(0,lt.compareScopeSets)(this.getCurrentScopesForUser(r),t.filter(Boolean)),await a.fetch(...t)}async getAccessTokenForIntent(e,...t){if(!this._intentToUserId.has(e))return null;let r=this._intentToUserId.get(e),a=await this.getAccessTokenForUser(r,...t);if(!a)throw new Me.HellFreezesOverError(`Found intent ${e} corresponding to user ID ${r} but no token was found`);return{...a,userId:r}}async getAnyAccessToken(e){if(e){let t=(0,Me.extractUserId)(e);if(this._userAccessTokens.has(t)){let r=await this.getAccessTokenForUser(t);if(!r)throw new Me.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 wC.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,ld.accessTokenIsExpired)(r))try{if(r.scope)return(0,lt.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,lt.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 ud.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,lt.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,lt.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,ld.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,lt.getAppToken)(this._clientId,this._clientSecret)}};vi.RefreshingAuthProvider=Rt;Or.__decorate([(0,wi.Enumerable)(!1)],Rt.prototype,"_clientSecret",void 0);Or.__decorate([(0,wi.Enumerable)(!1)],Rt.prototype,"_userAccessTokens",void 0);Or.__decorate([(0,wi.Enumerable)(!1)],Rt.prototype,"_userTokenFetchers",void 0);Or.__decorate([(0,wi.Enumerable)(!1)],Rt.prototype,"_appAccessToken",void 0);Or.__decorate([(0,wi.Enumerable)(!1)],Rt.prototype,"_appTokenFetcher",void 0);vi.RefreshingAuthProvider=Rt=Or.__decorate([(0,Me.rtfm)("auth","RefreshingAuthProvider","clientId")],Rt)});var qf=u(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.StaticAuthProvider=void 0;var cd=(g(),b(f)),Cf=H(),HC=m(),CC=bi(),Si=class{static{n(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,CC.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};Hi.StaticAuthProvider=Si;cd.__decorate([(0,Cf.Enumerable)(!1)],Si.prototype,"_clientId",void 0);cd.__decorate([(0,Cf.Enumerable)(!1)],Si.prototype,"_accessToken",void 0);Hi.StaticAuthProvider=Si=cd.__decorate([(0,HC.rtfm)("auth","StaticAuthProvider","clientId")],Si)});var dd=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 Ef=oo();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return Ef.accessTokenIsExpired},"get")});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return Ef.getExpiryDateOfAccessToken},"get")});var Yt=bi();Object.defineProperty(T,"exchangeCode",{enumerable:!0,get:n(function(){return Yt.exchangeCode},"get")});Object.defineProperty(T,"getAppToken",{enumerable:!0,get:n(function(){return Yt.getAppToken},"get")});Object.defineProperty(T,"getTokenInfo",{enumerable:!0,get:n(function(){return Yt.getTokenInfo},"get")});Object.defineProperty(T,"getValidTokenFromProviderForUser",{enumerable:!0,get:n(function(){return Yt.getValidTokenFromProviderForUser},"get")});Object.defineProperty(T,"getValidTokenFromProviderForIntent",{enumerable:!0,get:n(function(){return Yt.getValidTokenFromProviderForIntent},"get")});Object.defineProperty(T,"refreshUserToken",{enumerable:!0,get:n(function(){return Yt.refreshUserToken},"get")});Object.defineProperty(T,"revokeToken",{enumerable:!0,get:n(function(){return Yt.revokeToken},"get")});var qC=_o();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:n(function(){return qC.TokenFetcher},"get")});var EC=Xc();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:n(function(){return EC.TokenInfo},"get")});var PC=wf();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return PC.AppTokenAuthProvider},"get")});var AC=Hf();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return AC.RefreshingAuthProvider},"get")});var DC=qf();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:n(function(){return DC.StaticAuthProvider},"get")});var IC=id();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return IC.CachedRefreshFailureError},"get")});var TC=ad();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return TC.IntermediateUserRemovalError},"get")});var RC=uo();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:n(function(){return RC.InvalidTokenError},"get")});var UC=ho();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return UC.InvalidTokenTypeError},"get")});var BC=od();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:n(function(){return BC.UnknownIntentError},"get")})});var Af=u((KO,Pf)=>{function Le(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))}n(Le,"RetryOperation");Pf.exports=Le;Le.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Le.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Le.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};Le.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)};Le.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};Le.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};Le.prototype.start=Le.prototype.try;Le.prototype.errors=function(){return this._errors};Le.prototype.attempts=function(){return this._attempts};Le.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 a=this._errors[r],s=a.message,o=(i[s]||0)+1;i[s]=o,o>=t&&(e=a,t=o)}return e}});var Df=u(er=>{var OC=Af();er.operation=function(i){var e=er.timeouts(i);return new OC(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};er.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=[],a=0;a<e.retries;a++)r.push(this.createTimeout(a,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(a,e)),r.sort(function(s,o){return s-o}),r};er.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};er.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 a=0;a<t.length;a++){var s=t[a],o=i[s];i[s]=n(function(d){var h=er.operation(e),p=Array.prototype.slice.call(arguments,1),x=p.pop();p.push(function(P){h.retry(P)||(P&&(arguments[0]=h.mainError()),x.apply(this,arguments))}),h.attempt(function(){d.apply(i,p)})},"retryWrapper").bind(i,o),i[s].options=e}}});var Tf=u((YO,If)=>{If.exports=Df()});var Rf=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.createBitsLeaderboardQuery=void 0;function kC(i={}){let{count:e=10,period:t="all",startDate:r,contextUserId:a}=i;return{count:e.toString(),period:t,started_at:r?.toISOString(),user_id:a}}n(kC,"createBitsLeaderboardQuery");xo.createBitsLeaderboardQuery=kC});var Q=u(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.BaseApi=void 0;var jC=(g(),b(f)),MC=H(),wo=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}};vo.BaseApi=wo;jC.__decorate([(0,MC.Enumerable)(!1)],wo.prototype,"_client",void 0)});var hd=u(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.HelixBitsLeaderboardEntry=void 0;var Uf=(g(),b(f)),LC=H(),ft=m(),So=class extends ft.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[ft.rawDataSymbol].user_id}get userName(){return this[ft.rawDataSymbol].user_login}get userDisplayName(){return this[ft.rawDataSymbol].user_name}get rank(){return this[ft.rawDataSymbol].rank}get amount(){return this[ft.rawDataSymbol].score}async getUser(){return(0,ft.checkRelationAssertion)(await this._client.users.getUserById(this[ft.rawDataSymbol].user_id))}};Ci.HelixBitsLeaderboardEntry=So;Uf.__decorate([(0,LC.Enumerable)(!1)],So.prototype,"_client",void 0);Ci.HelixBitsLeaderboardEntry=So=Uf.__decorate([(0,ft.rtfm)("api","HelixBitsLeaderboardEntry","userId")],So)});var md=u(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.HelixBitsLeaderboard=void 0;var pd=(g(),b(f)),Bf=yi(),FC=H(),Ho=m(),NC=hd(),qi=class extends Ho.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[Ho.rawDataSymbol].data.map(e=>new NC.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[Ho.rawDataSymbol].total}};Ei.HelixBitsLeaderboard=qi;pd.__decorate([(0,FC.Enumerable)(!1)],qi.prototype,"_client",void 0);pd.__decorate([(0,Bf.CachedGetter)()],qi.prototype,"entries",null);Ei.HelixBitsLeaderboard=qi=pd.__decorate([Bf.Cacheable,(0,Ho.rtfm)("api","HelixBitsLeaderboard")],qi)});var yd=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.HelixCheermoteList=void 0;var QC=(g(),b(f)),GC=H(),Pi=m(),_d=class extends Pi.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,GC.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[Pi.rawDataSymbol][e],d=l.sort((h,p)=>p.min_bits-h.min_bits).find(h=>h.min_bits<=t);if(!d)throw new Pi.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:d.images[a][s][o],color:d.color}}getPossibleNames(){return Object.keys(this[Pi.rawDataSymbol])}};Ai.HelixCheermoteList=_d;Ai.HelixCheermoteList=_d=QC.__decorate([(0,Pi.rtfm)("api","HelixCheermoteList")],_d)});var bd=u(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.HelixBitsApi=void 0;var WC=(g(),b(f)),Of=H(),VC=J(),fd=m(),$C=Rf(),zC=Q(),KC=md(),JC=yd(),gd=class extends zC.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,fd.extractUserId)(e),scopes:["bits:read"],query:(0,$C.createBitsLeaderboardQuery)(t)});return new KC.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,Of.mapOptional)(e,fd.extractUserId),query:(0,Of.mapOptional)(e,VC.createBroadcasterQuery)});return new JC.HelixCheermoteList(t.data)}};Di.HelixBitsApi=gd;Di.HelixBitsApi=gd=WC.__decorate([(0,fd.rtfm)("api","HelixBitsApi")],gd)});var jf=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createFollowedChannelQuery=Fe.createChannelFollowerQuery=Fe.createChannelVipUpdateQuery=Fe.createChannelCommercialBody=Fe.createChannelUpdateBody=void 0;var kf=H(),tr=m();function ZC(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}}n(ZC,"createChannelUpdateBody");Fe.createChannelUpdateBody=ZC;function XC(i,e){return{broadcaster_id:(0,tr.extractUserId)(i),length:e}}n(XC,"createChannelCommercialBody");Fe.createChannelCommercialBody=XC;function YC(i,e){return{broadcaster_id:(0,tr.extractUserId)(i),user_id:(0,tr.extractUserId)(e)}}n(YC,"createChannelVipUpdateQuery");Fe.createChannelVipUpdateQuery=YC;function eq(i,e){return{broadcaster_id:(0,tr.extractUserId)(i),user_id:(0,kf.mapOptional)(e,tr.extractUserId)}}n(eq,"createChannelFollowerQuery");Fe.createChannelFollowerQuery=eq;function tq(i,e){return{broadcaster_id:(0,kf.mapOptional)(e,tr.extractUserId),user_id:(0,tr.extractUserId)(i)}}n(tq,"createFollowedChannelQuery");Fe.createFollowedChannelQuery=tq});var Ue=u(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.createChannelUsersCheckQuery=Ne.createGetByIdsQuery=Ne.createModeratorActionQuery=Ne.createUserQuery=Ne.createSingleKeyQuery=void 0;var Co=m();function rq(i,e){return{[i]:e}}n(rq,"createSingleKeyQuery");Ne.createSingleKeyQuery=rq;function iq(i){return{user_id:(0,Co.extractUserId)(i)}}n(iq,"createUserQuery");Ne.createUserQuery=iq;function nq(i,e){return{broadcaster_id:i,moderator_id:e}}n(nq,"createModeratorActionQuery");Ne.createModeratorActionQuery=nq;function aq(i,e){return{broadcaster_id:(0,Co.extractUserId)(i),id:e}}n(aq,"createGetByIdsQuery");Ne.createGetByIdsQuery=aq;function sq(i,e){return{broadcaster_id:(0,Co.extractUserId)(i),user_id:e.map(Co.extractUserId)}}n(sq,"createChannelUsersCheckQuery");Ne.createChannelUsersCheckQuery=sq});var Eo=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.HelixUserRelation=void 0;var Mf=(g(),b(f)),oq=H(),rr=m(),qo=class extends rr.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[rr.rawDataSymbol].user_id}get name(){return this[rr.rawDataSymbol].user_login}get displayName(){return this[rr.rawDataSymbol].user_name}async getUser(){return(0,rr.checkRelationAssertion)(await this._client.users.getUserById(this[rr.rawDataSymbol].user_id))}};Ii.HelixUserRelation=qo;Mf.__decorate([(0,oq.Enumerable)(!1)],qo.prototype,"_client",void 0);Ii.HelixUserRelation=qo=Mf.__decorate([(0,rr.rtfm)("api","HelixUserRelation","id")],qo)});var Ut=u(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.HelixRequestBatcher=void 0;var lq=(g(),b(f)),xd=H(),Po=class{static{n(this,"HelixRequestBatcher")}constructor(e,t,r,a,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=a,this._delay=a._batchDelay}async request(e){let{promise:t,resolve:r,reject:a}=(0,xd.promiseWithResolvers)();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:r,reject:a}):this._requestResolversById.set(e,[{resolve:r,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:r}=await this._doRequest(e),a=(0,xd.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(a,s)?o.resolve(this._mapper(a[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async a=>{var s,o;try{let l=await this._doRequest([a]);for(let d of(s=this._requestResolversById.get(a))!==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(a))!==null&&o!==void 0?o:[])d.reject(l)}this._requestResolversById.delete(a)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}};Ao.HelixRequestBatcher=Po;lq.__decorate([(0,xd.Enumerable)(!1)],Po.prototype,"_client",void 0)});var ne=u(Ti=>{"use strict";var wd;Object.defineProperty(Ti,"__esModule",{value:!0});Ti.HelixPaginatedRequest=void 0;var Lf=(g(),b(f)),uq=H(),cq=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(wd=Symbol.asyncIterator)!==null&&wd!==void 0?wd:Symbol.for("Symbol.asyncIterator"));var Do=class{static{n(this,"HelixPaginatedRequest")}constructor(e,t,r,a=100){this._callOptions=e,this._mapper=r,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((r,a)=>{let s=this._mapper(a);return Array.isArray(s)?[...r,...s]:[...r,s]},[])}};Ti.HelixPaginatedRequest=Do;Lf.__decorate([(0,uq.Enumerable)(!1)],Do.prototype,"_client",void 0);Ti.HelixPaginatedRequest=Do=Lf.__decorate([(0,cq.rtfm)("api","HelixPaginatedRequest")],Do)});var kr=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.HelixPaginatedRequestWithTotal=void 0;var dq=(g(),b(f)),hq=m(),pq=ne(),vd=class extends pq.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}};Ri.HelixPaginatedRequestWithTotal=vd;Ri.HelixPaginatedRequestWithTotal=vd=dq.__decorate([(0,hq.rtfm)("api","HelixPaginatedRequestWithTotal")],vd)});var ue=u(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.createPaginatedResultWithTotal=jr.createPaginatedResult=void 0;function mq(i,e,t){var r;let a;return{get data(){var s,o;return a??(a=(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}}n(mq,"createPaginatedResult");jr.createPaginatedResult=mq;function _q(i,e,t){let r;return{get data(){var a,s;return r??(r=(s=(a=i.data)===null||a===void 0?void 0:a.map(o=>new e(o,t)))!==null&&s!==void 0?s:[])},cursor:i.pagination.cursor,total:i.total}}n(_q,"createPaginatedResultWithTotal");jr.createPaginatedResultWithTotal=_q});var ae=u(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.createPaginationQuery=void 0;function yq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(yq,"createPaginationQuery");Io.createPaginationQuery=yq});var Sd=u(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixChannel=void 0;var Ff=(g(),b(f)),fq=H(),pe=m(),To=class extends pe.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[pe.rawDataSymbol].broadcaster_id}get name(){return this[pe.rawDataSymbol].broadcaster_login}get displayName(){return this[pe.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,pe.checkRelationAssertion)(await this._client.users.getUserById(this[pe.rawDataSymbol].broadcaster_id))}get language(){return this[pe.rawDataSymbol].broadcaster_language}get gameId(){return this[pe.rawDataSymbol].game_id}get gameName(){return this[pe.rawDataSymbol].game_name}async getGame(){return this[pe.rawDataSymbol].game_id?(0,pe.checkRelationAssertion)(await this._client.games.getGameById(this[pe.rawDataSymbol].game_id)):null}get title(){return this[pe.rawDataSymbol].title}get delay(){return this[pe.rawDataSymbol].delay}get tags(){return this[pe.rawDataSymbol].tags}get contentClassificationLabels(){return this[pe.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[pe.rawDataSymbol].is_branded_content}};Ui.HelixChannel=To;Ff.__decorate([(0,fq.Enumerable)(!1)],To.prototype,"_client",void 0);Ui.HelixChannel=To=Ff.__decorate([(0,pe.rtfm)("api","HelixChannel","id")],To)});var Hd=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixChannelEditor=void 0;var Nf=(g(),b(f)),gq=H(),ir=m(),Ro=class extends ir.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[ir.rawDataSymbol].user_id}get userDisplayName(){return this[ir.rawDataSymbol].user_name}async getUser(){return(0,ir.checkRelationAssertion)(await this._client.users.getUserById(this[ir.rawDataSymbol].user_id))}get creationDate(){return new Date(this[ir.rawDataSymbol].created_at)}};Bi.HelixChannelEditor=Ro;Nf.__decorate([(0,gq.Enumerable)(!1)],Ro.prototype,"_client",void 0);Bi.HelixChannelEditor=Ro=Nf.__decorate([(0,ir.rtfm)("api","HelixChannelEditor","userId")],Ro)});var Cd=u(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.HelixChannelFollower=void 0;var Qf=(g(),b(f)),bq=H(),Bt=m(),Uo=class extends Bt.DataObject{static{n(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[Bt.rawDataSymbol].user_id}get userName(){return this[Bt.rawDataSymbol].user_login}get userDisplayName(){return this[Bt.rawDataSymbol].user_name}async getUser(){return(0,Bt.checkRelationAssertion)(await this._client.users.getUserById(this[Bt.rawDataSymbol].user_id))}get followDate(){return new Date(this[Bt.rawDataSymbol].followed_at)}};Oi.HelixChannelFollower=Uo;Qf.__decorate([(0,bq.Enumerable)(!1)],Uo.prototype,"_client",void 0);Oi.HelixChannelFollower=Uo=Qf.__decorate([(0,Bt.rtfm)("api","HelixChannelFollower","userId")],Uo)});var qd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixFollowedChannel=void 0;var Gf=(g(),b(f)),xq=H(),Ot=m(),Bo=class extends Ot.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Ot.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Ot.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Ot.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Ot.checkRelationAssertion)(await this._client.users.getUserById(this[Ot.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[Ot.rawDataSymbol].followed_at)}};ki.HelixFollowedChannel=Bo;Gf.__decorate([(0,xq.Enumerable)(!1)],Bo.prototype,"_client",void 0);ki.HelixFollowedChannel=Bo=Gf.__decorate([(0,Ot.rtfm)("api","HelixFollowedChannel","broadcasterId")],Bo)});var Pd=u(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.HelixAdSchedule=void 0;var wq=(g(),b(f)),Je=m(),Ed=class extends Je.DataObject{static{n(this,"HelixAdSchedule")}get snoozeCount(){return this[Je.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return this[Je.rawDataSymbol].snooze_refresh_at?new Date(this[Je.rawDataSymbol].snooze_refresh_at*1e3):null}get nextAdDate(){return this[Je.rawDataSymbol].next_ad_at?new Date(this[Je.rawDataSymbol].next_ad_at*1e3):null}get duration(){return this[Je.rawDataSymbol].duration}get lastAdDate(){return this[Je.rawDataSymbol].last_ad_at?new Date(this[Je.rawDataSymbol].last_ad_at*1e3):null}get prerollFreeTime(){return this[Je.rawDataSymbol].preroll_free_time}};ji.HelixAdSchedule=Ed;ji.HelixAdSchedule=Ed=wq.__decorate([(0,Je.rtfm)("api","HelixAdSchedule")],Ed)});var Wf=u(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixSnoozeNextAdResult=void 0;var vq=(g(),b(f)),Mi=m(),Ad=class extends Mi.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[Mi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[Mi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[Mi.rawDataSymbol].next_ad_at*1e3)}};Li.HelixSnoozeNextAdResult=Ad;Li.HelixSnoozeNextAdResult=Ad=vq.__decorate([(0,Mi.rtfm)("api","HelixSnoozeNextAdResult")],Ad)});var Rd=u(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixChannelApi=void 0;var Jf=(g(),b(f)),Zf=H(),nr=J(),se=m(),gt=jf(),Vf=Ue(),Dd=Eo(),Sq=Ut(),Hq=ne(),$f=kr(),Id=ue(),Oo=ae(),Cq=Q(),Td=Sd(),qq=Hd(),zf=Cd(),Kf=qd(),Eq=Pd(),Pq=Wf(),ko=class extends Cq.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new Sq.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Td.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,se.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,nr.createBroadcasterQuery)(t)});return(0,Zf.mapNullable)(r.data[0],a=>new Td.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,Vf.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Td.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,nr.createBroadcasterQuery)(e),jsonBody:(0,gt.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,gt.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,nr.createBroadcasterQuery)(e)})).data.map(r=>new qq.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,se.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,nr.createBroadcasterQuery)(e),...(0,Oo.createPaginationQuery)(t)}});return(0,Id.createPaginatedResult)(r,Dd.HelixUserRelation,this._client)}getVipsPaginated(e){return new Hq.HelixPaginatedRequest({url:"channels/vips",userId:(0,se.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,nr.createBroadcasterQuery)(e)},this._client,t=>new Dd.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,Vf.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Dd.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let r=(0,se.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,se.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,gt.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,gt.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,gt.createChannelFollowerQuery)(e),...(0,Oo.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){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,gt.createChannelFollowerQuery)(e,t),...(0,Oo.createPaginationQuery)(r)}});return(0,Id.createPaginatedResultWithTotal)(a,zf.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new $f.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,se.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,gt.createChannelFollowerQuery)(e)},this._client,t=>new zf.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,se.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,gt.createFollowedChannelQuery)(e,t),...(0,Oo.createPaginationQuery)(r)}});return(0,Id.createPaginatedResultWithTotal)(a,Kf.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new $f.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,se.extractUserId)(e),scopes:["user:read:follows"],query:(0,gt.createFollowedChannelQuery)(e,t)},this._client,r=>new Kf.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,se.extractUserId)(e),scopes:["channel:read:ads"],query:(0,nr.createBroadcasterQuery)(e)});return new Eq.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,se.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,nr.createBroadcasterQuery)(e)});return new Pq.HelixSnoozeNextAdResult(t.data[0])}};Fi.HelixChannelApi=ko;Jf.__decorate([(0,Zf.Enumerable)(!1)],ko.prototype,"_getChannelByIdBatcher",void 0);Fi.HelixChannelApi=ko=Jf.__decorate([(0,se.rtfm)("api","HelixChannelApi")],ko)});var Xf=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createRedemptionsForBroadcasterQuery=Qe.createRewardRedemptionsByIdsQuery=Qe.createCustomRewardBody=Qe.createCustomRewardChangeQuery=Qe.createCustomRewardsQuery=void 0;var jo=m();function Aq(i,e){return{broadcaster_id:(0,jo.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(Aq,"createCustomRewardsQuery");Qe.createCustomRewardsQuery=Aq;function Dq(i,e){return{broadcaster_id:(0,jo.extractUserId)(i),id:e}}n(Dq,"createCustomRewardChangeQuery");Qe.createCustomRewardChangeQuery=Dq;function Iq(i){var e,t,r;let a={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&&(a.is_max_per_stream_enabled=!!i.maxRedemptionsPerStream,a.max_per_stream=(e=i.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),i.maxRedemptionsPerUserPerStream!==void 0&&(a.is_max_per_user_per_stream_enabled=!!i.maxRedemptionsPerUserPerStream,a.max_per_user_per_stream=(t=i.maxRedemptionsPerUserPerStream)!==null&&t!==void 0?t:0),i.globalCooldown!==void 0&&(a.is_global_cooldown_enabled=!!i.globalCooldown,a.global_cooldown_seconds=(r=i.globalCooldown)!==null&&r!==void 0?r:0),"isPaused"in i&&(a.is_paused=i.isPaused),a}n(Iq,"createCustomRewardBody");Qe.createCustomRewardBody=Iq;function Tq(i,e,t){return{broadcaster_id:(0,jo.extractUserId)(i),reward_id:e,id:t}}n(Tq,"createRewardRedemptionsByIdsQuery");Qe.createRewardRedemptionsByIdsQuery=Tq;function Rq(i,e,t,r){return{broadcaster_id:(0,jo.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(Rq,"createRedemptionsForBroadcasterQuery");Qe.createRedemptionsForBroadcasterQuery=Rq});var Ud=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixCustomReward=void 0;var Yf=(g(),b(f)),Uq=H(),k=m(),Mo=class extends k.DataObject{static{n(this,"HelixCustomReward")}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))}getImageUrl(e){var t,r;let a=`url_${e}x`;return(r=(t=this[k.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&r!==void 0?r:this[k.rawDataSymbol].default_image[a]}get backgroundColor(){return this[k.rawDataSymbol].background_color}get isEnabled(){return this[k.rawDataSymbol].is_enabled}get cost(){return this[k.rawDataSymbol].cost}get title(){return this[k.rawDataSymbol].title}get prompt(){return this[k.rawDataSymbol].prompt}get userInputRequired(){return this[k.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[k.rawDataSymbol].max_per_stream_setting.is_enabled?this[k.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[k.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[k.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[k.rawDataSymbol].global_cooldown_setting.is_enabled?this[k.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[k.rawDataSymbol].is_paused}get isInStock(){return this[k.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[k.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[k.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[k.rawDataSymbol].cooldown_expires_at?new Date(this[k.rawDataSymbol].cooldown_expires_at):null}};Ni.HelixCustomReward=Mo;Yf.__decorate([(0,Uq.Enumerable)(!1)],Mo.prototype,"_client",void 0);Ni.HelixCustomReward=Mo=Yf.__decorate([(0,k.rtfm)("api","HelixCustomReward","id")],Mo)});var Bd=u(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.HelixCustomRewardRedemption=void 0;var eg=(g(),b(f)),Bq=H(),N=m(),Lo=class extends N.DataObject{static{n(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[N.rawDataSymbol].id}get broadcasterId(){return this[N.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[N.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[N.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,N.checkRelationAssertion)(await this._client.users.getUserById(this[N.rawDataSymbol].broadcaster_id))}get userId(){return this[N.rawDataSymbol].user_id}get userName(){return this[N.rawDataSymbol].user_login}get userDisplayName(){return this[N.rawDataSymbol].user_name}async getUser(){return(0,N.checkRelationAssertion)(await this._client.users.getUserById(this[N.rawDataSymbol].user_id))}get userInput(){return this[N.rawDataSymbol].user_input}get isFulfilled(){return this[N.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[N.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[N.rawDataSymbol].redeemed_at)}get rewardId(){return this[N.rawDataSymbol].reward.id}get rewardTitle(){return this[N.rawDataSymbol].reward.title}get rewardPrompt(){return this[N.rawDataSymbol].reward.prompt}get rewardCost(){return this[N.rawDataSymbol].reward.cost}async getReward(){return(0,N.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[N.rawDataSymbol].broadcaster_id,this[N.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[N.rawDataSymbol].broadcaster_id,this[N.rawDataSymbol].reward.id,[this[N.rawDataSymbol].id],e))[0]}};Qi.HelixCustomRewardRedemption=Lo;eg.__decorate([(0,Bq.Enumerable)(!1)],Lo.prototype,"_client",void 0);Qi.HelixCustomRewardRedemption=Lo=eg.__decorate([(0,N.rtfm)("api","HelixCustomRewardRedemption","id")],Lo)});var kd=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixChannelPointsApi=void 0;var Oq=(g(),b(f)),kq=J(),ut=m(),bt=Xf(),jq=Ue(),Mq=ne(),Lq=ue(),Fq=ae(),Nq=Q(),Fo=Ud(),No=Bd(),Od=class extends Nq.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ut.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,bt.createCustomRewardsQuery)(e,t)})).data.map(a=>new Fo.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ut.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,jq.createGetByIdsQuery)(e,t)})).data.map(a=>new Fo.HelixCustomReward(a,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,ut.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,kq.createBroadcasterQuery)(e),jsonBody:(0,bt.createCustomRewardBody)(t)});return new Fo.HelixCustomReward(r.data[0],this._client)}async updateCustomReward(e,t,r){let a=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:(0,ut.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,bt.createCustomRewardChangeQuery)(e,t),jsonBody:(0,bt.createCustomRewardBody)(r)});return new Fo.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,ut.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,bt.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,ut.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,bt.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new No.HelixCustomRewardRedemption(s,this._client)):[]}async getRedemptionById(e,t,r){let a=await this.getRedemptionsByIds(e,t,[r]);return a.length?a[0]:null}async getRedemptionsForBroadcaster(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ut.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,bt.createRedemptionsForBroadcasterQuery)(e,t,r,a),...(0,Fq.createPaginationQuery)(a)}});return(0,Lq.createPaginatedResult)(s,No.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new Mq.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,ut.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,bt.createRedemptionsForBroadcasterQuery)(e,t,r,a)},this._client,s=>new No.HelixCustomRewardRedemption(s,this._client),50)}async updateRedemptionStatusByIds(e,t,r,a){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:(0,ut.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,bt.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:a}})).data.map(o=>new No.HelixCustomRewardRedemption(o,this._client)):[]}};Gi.HelixChannelPointsApi=Od;Gi.HelixChannelPointsApi=Od=Oq.__decorate([(0,ut.rtfm)("api","HelixChannelPointsApi")],Od)});var Qo=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixCharityCampaignAmount=void 0;var Qq=(g(),b(f)),Wi=m(),jd=class extends Wi.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[Wi.rawDataSymbol].value}get decimalPlaces(){return this[Wi.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[Wi.rawDataSymbol].currency}};Vi.HelixCharityCampaignAmount=jd;Vi.HelixCharityCampaignAmount=jd=Qq.__decorate([(0,Wi.rtfm)("api","HelixCharityCampaignAmount")],jd)});var Md=u($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.HelixCharityCampaign=void 0;var rg=(g(),b(f)),Gq=H(),Pe=m(),tg=Qo(),Go=class extends Pe.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[Pe.rawDataSymbol].id}get broadcasterId(){return this[Pe.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Pe.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Pe.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Pe.checkRelationAssertion)(await this._client.users.getUserById(this[Pe.rawDataSymbol].broadcaster_id))}get charityName(){return this[Pe.rawDataSymbol].charity_name}get charityDescription(){return this[Pe.rawDataSymbol].charity_description}get charityLogo(){return this[Pe.rawDataSymbol].charity_logo}get charityWebsite(){return this[Pe.rawDataSymbol].charity_website}get currentAmount(){return new tg.HelixCharityCampaignAmount(this[Pe.rawDataSymbol].current_amount)}get targetAmount(){return new tg.HelixCharityCampaignAmount(this[Pe.rawDataSymbol].target_amount)}};$i.HelixCharityCampaign=Go;rg.__decorate([(0,Gq.Enumerable)(!1)],Go.prototype,"_client",void 0);$i.HelixCharityCampaign=Go=rg.__decorate([(0,Pe.rtfm)("api","HelixCharityCampaign","id")],Go)});var Ld=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixCharityCampaignDonation=void 0;var ig=(g(),b(f)),Wq=H(),xt=m(),Vq=Qo(),Wo=class extends xt.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[xt.rawDataSymbol].campaign_id}get donorId(){return this[xt.rawDataSymbol].user_id}get donorName(){return this[xt.rawDataSymbol].user_login}get donorDisplayName(){return this[xt.rawDataSymbol].user_name}async getDonor(){return(0,xt.checkRelationAssertion)(await this._client.users.getUserById(this[xt.rawDataSymbol].user_id))}get amount(){return new Vq.HelixCharityCampaignAmount(this[xt.rawDataSymbol].amount)}};zi.HelixCharityCampaignDonation=Wo;ig.__decorate([(0,Wq.Enumerable)(!1)],Wo.prototype,"_client",void 0);zi.HelixCharityCampaignDonation=Wo=ig.__decorate([(0,xt.rtfm)("api","HelixCharityCampaignDonation")],Wo)});var Qd=u(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.HelixCharityApi=void 0;var $q=(g(),b(f)),ng=J(),Fd=m(),zq=ue(),Kq=ae(),Jq=Q(),Zq=Md(),Xq=Ld(),Nd=class extends Jq.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,Fd.extractUserId)(e),scopes:["channel:read:charity"],query:(0,ng.createBroadcasterQuery)(e)});return new Zq.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,Fd.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,ng.createBroadcasterQuery)(e),...(0,Kq.createPaginationQuery)(t)}});return(0,zq.createPaginatedResult)(r,Xq.HelixCharityCampaignDonation,this._client)}};Ki.HelixCharityApi=Nd;Ki.HelixCharityApi=Nd=$q.__decorate([(0,Fd.rtfm)("api","HelixCharityApi")],Nd)});var ag=u(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.createSendChatMessageBody=Ge.createSendChatMessageQuery=Ge.createShoutoutQuery=Ge.createChatColorUpdateQuery=Ge.createChatSettingsUpdateBody=void 0;var Gd=m();function Yq(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}}n(Yq,"createChatSettingsUpdateBody");Ge.createChatSettingsUpdateBody=Yq;function eE(i,e){return{user_id:(0,Gd.extractUserId)(i),color:e}}n(eE,"createChatColorUpdateQuery");Ge.createChatColorUpdateQuery=eE;function tE(i,e,t){return{from_broadcaster_id:(0,Gd.extractUserId)(i),to_broadcaster_id:(0,Gd.extractUserId)(e),moderator_id:t}}n(tE,"createShoutoutQuery");Ge.createShoutoutQuery=tE;function rE(i,e){return{broadcaster_id:i,sender_id:e}}n(rE,"createSendChatMessageQuery");Ge.createSendChatMessageQuery=rE;function iE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(iE,"createSendChatMessageBody");Ge.createSendChatMessageBody=iE});var Vd=u(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.HelixEmoteBase=void 0;var Ze=m(),Wd=class extends Ze.DataObject{static{n(this,"HelixEmoteBase")}get id(){return this[Ze.rawDataSymbol].id}get name(){return this[Ze.rawDataSymbol].name}get formats(){return this[Ze.rawDataSymbol].format}get scales(){return this[Ze.rawDataSymbol].scale}get themeModes(){return this[Ze.rawDataSymbol].theme_mode}getStaticImageUrl(e="1.0",t="light"){return this[Ze.rawDataSymbol].format.includes("static")&&this[Ze.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[Ze.rawDataSymbol].format.includes("animated")&&this[Ze.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[Ze.rawDataSymbol].id}/${t}/${r}/${e}`}};Vo.HelixEmoteBase=Wd});var Zi=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixEmote=void 0;var nE=(g(),b(f)),sg=m(),aE=Vd(),$d=class extends aE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[sg.rawDataSymbol].images[`url_${e}x`]}};Ji.HelixEmote=$d;Ji.HelixEmote=$d=nE.__decorate([(0,sg.rtfm)("api","HelixEmote","id")],$d)});var zd=u(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.HelixChannelEmote=void 0;var og=(g(),b(f)),sE=H(),Xi=m(),oE=Zi(),$o=class extends oE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[Xi.rawDataSymbol].tier||null}get type(){return this[Xi.rawDataSymbol].emote_type}get emoteSetId(){return this[Xi.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[Xi.rawDataSymbol].emote_set_id])}};Yi.HelixChannelEmote=$o;og.__decorate([(0,sE.Enumerable)(!1)],$o.prototype,"_client",void 0);Yi.HelixChannelEmote=$o=og.__decorate([(0,Xi.rtfm)("api","HelixChannelEmote","id")],$o)});var Jd=u(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.HelixChatBadgeVersion=void 0;var lE=(g(),b(f)),kt=m(),Kd=class extends kt.DataObject{static{n(this,"HelixChatBadgeVersion")}get id(){return this[kt.rawDataSymbol].id}getImageUrl(e){return this[kt.rawDataSymbol][`image_url_${e}x`]}get title(){return this[kt.rawDataSymbol].title}get description(){return this[kt.rawDataSymbol].description}get clickAction(){return this[kt.rawDataSymbol].click_action}get clickUrl(){return this[kt.rawDataSymbol].click_url}};en.HelixChatBadgeVersion=Kd;en.HelixChatBadgeVersion=Kd=lE.__decorate([(0,kt.rtfm)("api","HelixChatBadgeVersion","id")],Kd)});var Zd=u(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.HelixChatBadgeSet=void 0;var lg=(g(),b(f)),ug=yi(),zo=m(),uE=Jd(),Ko=class extends zo.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[zo.rawDataSymbol].set_id}get versions(){return this[zo.rawDataSymbol].versions.map(e=>new uE.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};tn.HelixChatBadgeSet=Ko;lg.__decorate([(0,ug.CachedGetter)()],Ko.prototype,"versions",null);tn.HelixChatBadgeSet=Ko=lg.__decorate([ug.Cacheable,(0,zo.rtfm)("api","HelixChatBadgeSet","id")],Ko)});var Xd=u(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.HelixChatChatter=void 0;var cg=(g(),b(f)),cE=H(),ar=m(),Jo=class extends ar.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[ar.rawDataSymbol].user_id}get userName(){return this[ar.rawDataSymbol].user_login}get userDisplayName(){return this[ar.rawDataSymbol].user_name}async getUser(){return(0,ar.checkRelationAssertion)(await this._client.users.getUserById(this[ar.rawDataSymbol].user_id))}};rn.HelixChatChatter=Jo;cg.__decorate([(0,cE.Enumerable)(!1)],Jo.prototype,"_client",void 0);rn.HelixChatChatter=Jo=cg.__decorate([(0,ar.rtfm)("api","HelixChatChatter")],Jo)});var Zo=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixChatSettings=void 0;var dE=(g(),b(f)),ct=m(),Yd=class extends ct.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[ct.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[ct.rawDataSymbol].slow_mode}get slowModeDelay(){return this[ct.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[ct.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[ct.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[ct.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[ct.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[ct.rawDataSymbol].unique_chat_mode}};nn.HelixChatSettings=Yd;nn.HelixChatSettings=Yd=dE.__decorate([(0,ct.rtfm)("api","HelixChatSettings","broadcasterId")],Yd)});var eh=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixEmoteFromSet=void 0;var dg=(g(),b(f)),hE=H(),sr=m(),pE=Zi(),Xo=class extends pE.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[sr.rawDataSymbol].emote_type}get emoteSetId(){return this[sr.rawDataSymbol].emote_set_id}get ownerId(){switch(this[sr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[sr.rawDataSymbol].owner_id}}async getOwner(){switch(this[sr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[sr.rawDataSymbol].owner_id)}}};an.HelixEmoteFromSet=Xo;dg.__decorate([(0,hE.Enumerable)(!1)],Xo.prototype,"_client",void 0);an.HelixEmoteFromSet=Xo=dg.__decorate([(0,sr.rtfm)("api","HelixEmoteFromSet","id")],Xo)});var th=u(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.HelixUserEmote=void 0;var hg=(g(),b(f)),jt=m(),mE=Vd(),_E=H(),Yo=class extends mE.HelixEmoteBase{static{n(this,"HelixUserEmote")}constructor(e,t){super(e),this._client=t}get type(){return this[jt.rawDataSymbol].emote_type}get emoteSetId(){return this[jt.rawDataSymbol].emote_set_id||null}get ownerId(){return this[jt.rawDataSymbol].owner_id||null}async getAllEmotesFromSet(){return this[jt.rawDataSymbol].emote_set_id?await this._client.chat.getEmotesFromSets([this[jt.rawDataSymbol].emote_set_id]):null}async getOwner(){return this[jt.rawDataSymbol].owner_id?await this._client.users.getUserById(this[jt.rawDataSymbol].owner_id):null}};sn.HelixUserEmote=Yo;hg.__decorate([(0,_E.Enumerable)(!1)],Yo.prototype,"_client",void 0);sn.HelixUserEmote=Yo=hg.__decorate([(0,jt.rtfm)("api","HelixUserEmote","id")],Yo)});var nh=u(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.HelixPrivilegedChatSettings=void 0;var yE=(g(),b(f)),rh=m(),fE=Zo(),ih=class extends fE.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[rh.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[rh.rawDataSymbol].non_moderator_chat_delay_duration}};on.HelixPrivilegedChatSettings=ih;on.HelixPrivilegedChatSettings=ih=yE.__decorate([(0,rh.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],ih)});var sh=u(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.HelixSentChatMessage=void 0;var gE=(g(),b(f)),Mr=m(),ah=class extends Mr.DataObject{static{n(this,"HelixSentChatMessage")}get id(){return this[Mr.rawDataSymbol].message_id}get isSent(){return this[Mr.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Mr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Mr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};ln.HelixSentChatMessage=ah;ln.HelixSentChatMessage=ah=gE.__decorate([(0,Mr.rtfm)("api","HelixSentChatMessage","id")],ah)});var uh=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixChatApi=void 0;var bE=(g(),b(f)),oh=J(),X=m(),or=ag(),Mt=Ue(),xE=ne(),wE=kr(),pg=ue(),mg=ae(),vE=Q(),SE=zd(),_g=Zd(),yg=Xd(),HE=Zo(),CE=Zi(),qE=eh(),fg=th(),gg=nh(),bg=sh(),lh=class extends vE.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let r=(0,X.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(r),...(0,mg.createPaginationQuery)(t)}});return(0,pg.createPaginatedResultWithTotal)(a,yg.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,X.extractUserId)(e);return new wE.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new yg.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new _g.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,X.extractUserId)(e),query:(0,oh.createBroadcasterQuery)(e)})).data.map(r=>new _g.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new CE.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,X.extractUserId)(e),query:(0,oh.createBroadcasterQuery)(e)})).data.map(r=>new SE.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Mt.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new qE.HelixEmoteFromSet(r,this._client))}async getUserEmotes(e,t){let r=(0,X.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/emotes/user",userId:(0,X.extractUserId)(e),scopes:["user:read:emotes"],query:{...(0,Mt.createSingleKeyQuery)("user_id",r),...(0,Mt.createSingleKeyQuery)("broadcasterId",t?.broadcaster?(0,X.extractUserId)(t.broadcaster):void 0),...(0,mg.createPaginationQuery)(t)}});return(0,pg.createPaginatedResult)(a,fg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,X.extractUserId)(e);return new xE.HelixPaginatedRequest({url:"chat/emotes/user",userId:r,scopes:["user:read:emotes"],query:{...(0,Mt.createSingleKeyQuery)("user_id",r),...(0,Mt.createSingleKeyQuery)("broadcasterId",t?(0,X.extractUserId)(t):void 0)}},this._client,a=>new fg.HelixUserEmote(a,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,X.extractUserId)(e),query:(0,oh.createBroadcasterQuery)(e)});return new HE.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,X.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 gg.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,X.extractUserId)(e),a=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,or.createChatSettingsUpdateBody)(t)});return new gg.HelixPrivilegedChatSettings(a.data[0])}async sendChatMessage(e,t,r){let a=(0,X.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:a,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,or.createSendChatMessageQuery)(a,this._getUserContextIdWithDefault(a)),jsonBody:(0,or.createSendChatMessageBody)(t,r)});return new bg.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,a){let s=(0,X.extractUserId)(e),o=(0,X.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,or.createSendChatMessageQuery)(o,s),jsonBody:(0,or.createSendChatMessageBody)(r,a)});return new bg.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,X.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,Mt.createSingleKeyQuery)("user_id",e.map(X.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,X.extractUserId)(e),query:(0,Mt.createSingleKeyQuery)("user_id",(0,X.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,X.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,or.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,X.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,or.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}_createModeratorActionQuery(e){return(0,Mt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};un.HelixChatApi=lh;un.HelixChatApi=lh=bE.__decorate([(0,X.rtfm)("api","HelixChatApi")],lh)});var xg=u(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.createClipQuery=Lr.createClipCreateQuery=void 0;var EE=m();function PE(i,e){return{broadcaster_id:(0,EE.extractUserId)(i),has_delay:e.toString()}}n(PE,"createClipCreateQuery");Lr.createClipCreateQuery=PE;function AE(i){let{filterType:e,ids:t,startDate:r,endDate:a,isFeatured:s}=i;return{[e]:t,started_at:r,ended_at:a,is_featured:s?.toString()}}n(AE,"createClipQuery");Lr.createClipQuery=AE});var ch=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixClip=void 0;var wg=(g(),b(f)),DE=H(),j=m(),el=class extends j.DataObject{static{n(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[j.rawDataSymbol].id}get url(){return this[j.rawDataSymbol].url}get embedUrl(){return this[j.rawDataSymbol].embed_url}get broadcasterId(){return this[j.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[j.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].broadcaster_id))}get creatorId(){return this[j.rawDataSymbol].creator_id}get creatorDisplayName(){return this[j.rawDataSymbol].creator_name}async getCreator(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].creator_id))}get videoId(){return this[j.rawDataSymbol].video_id}async getVideo(){return(0,j.checkRelationAssertion)(await this._client.videos.getVideoById(this[j.rawDataSymbol].video_id))}get gameId(){return this[j.rawDataSymbol].game_id}async getGame(){return this[j.rawDataSymbol].game_id?(0,j.checkRelationAssertion)(await this._client.games.getGameById(this[j.rawDataSymbol].game_id)):null}get language(){return this[j.rawDataSymbol].language}get title(){return this[j.rawDataSymbol].title}get views(){return this[j.rawDataSymbol].view_count}get creationDate(){return new Date(this[j.rawDataSymbol].created_at)}get thumbnailUrl(){return this[j.rawDataSymbol].thumbnail_url}get duration(){return this[j.rawDataSymbol].duration}get vodOffset(){return this[j.rawDataSymbol].vod_offset}get isFeatured(){return this[j.rawDataSymbol].is_featured}};cn.HelixClip=el;wg.__decorate([(0,DE.Enumerable)(!1)],el.prototype,"_client",void 0);cn.HelixClip=el=wg.__decorate([(0,j.rtfm)("api","HelixClip","id")],el)});var ph=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixClipApi=void 0;var vg=(g(),b(f)),IE=H(),Fr=m(),dh=xg(),TE=Ut(),RE=ne(),UE=ue(),BE=ae(),OE=Q(),hh=ch(),tl=class extends OE.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new TE.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new hh.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,Fr.extractUserId)(e),userId:(0,Fr.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,Fr.extractUserId)(e),userId:(0,Fr.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,Fr.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,dh.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,dh.createClipQuery)(e),...(0,BE.createPaginationQuery)(e)}});return(0,UE.createPaginatedResult)(t,hh.HelixClip,this._client)}_getClipsPaginated(e){return new RE.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,dh.createClipQuery)(e)},this._client,t=>new hh.HelixClip(t,this._client))}};dn.HelixClipApi=tl;vg.__decorate([(0,IE.Enumerable)(!1)],tl.prototype,"_getClipByIdBatcher",void 0);dn.HelixClipApi=tl=vg.__decorate([(0,Fr.rtfm)("api","HelixClipApi")],tl)});var _h=u(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.HelixContentClassificationLabel=void 0;var rl=m(),mh=class extends rl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[rl.rawDataSymbol].id}get name(){return this[rl.rawDataSymbol].name}get description(){return this[rl.rawDataSymbol].description}};il.HelixContentClassificationLabel=mh});var fh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixContentClassificationLabelApi=void 0;var kE=(g(),b(f)),jE=m(),ME=Q(),LE=_h(),yh=class extends ME.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new LE.HelixContentClassificationLabel(r))}};hn.HelixContentClassificationLabelApi=yh;hn.HelixContentClassificationLabelApi=yh=kE.__decorate([(0,jE.rtfm)("api","HelixContentClassificationLabelApi")],yh)});var Sg=u(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createDropsEntitlementUpdateBody=Nr.createDropsEntitlementQuery=void 0;var FE=H(),NE=m();function QE(i,e){return{user_id:e?(0,FE.mapOptional)(i.user,NE.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(QE,"createDropsEntitlementQuery");Nr.createDropsEntitlementQuery=QE;function GE(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(GE,"createDropsEntitlementUpdateBody");Nr.createDropsEntitlementUpdateBody=GE});var gh=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixDropsEntitlement=void 0;var Hg=(g(),b(f)),WE=H(),Be=m(),nl=class extends Be.DataObject{static{n(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[Be.rawDataSymbol].id}get rewardId(){return this[Be.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[Be.rawDataSymbol].timestamp)}get userId(){return this[Be.rawDataSymbol].user_id}async getUser(){return(0,Be.checkRelationAssertion)(await this._client.users.getUserById(this[Be.rawDataSymbol].user_id))}get gameId(){return this[Be.rawDataSymbol].game_id}async getGame(){return(0,Be.checkRelationAssertion)(await this._client.games.getGameById(this[Be.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[Be.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[Be.rawDataSymbol].last_updated)}};pn.HelixDropsEntitlement=nl;Hg.__decorate([(0,WE.Enumerable)(!1)],nl.prototype,"_client",void 0);pn.HelixDropsEntitlement=nl=Hg.__decorate([(0,Be.rtfm)("api","HelixDropsEntitlement")],nl)});var vh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixEntitlementApi=void 0;var Cg=(g(),b(f)),xh=H(),wh=m(),bh=Sg(),VE=Ut(),$E=ne(),zE=ue(),KE=ae(),JE=Q(),al=gh(),sl=class extends JE.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new VE.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new al.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,xh.mapOptional)(e.user,wh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,bh.createDropsEntitlementQuery)(e,t),...(0,KE.createPaginationQuery)(e)}});return(0,zE.createPaginatedResult)(r,al.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new $E.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,xh.mapOptional)(e.user,wh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,bh.createDropsEntitlementQuery)(e,t)},this._client,r=>new al.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new al.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,bh.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(a=>a.ids.map(s=>[s,a.status])))}};mn.HelixEntitlementApi=sl;Cg.__decorate([(0,xh.Enumerable)(!1)],sl.prototype,"_getDropsEntitlementByIdBatcher",void 0);mn.HelixEntitlementApi=sl=Cg.__decorate([(0,wh.rtfm)("api","HelixEntitlementApi")],sl)});var Eg=u(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.createEventSubConduitShardsUpdateCondition=me.createEventSubConduitUpdateCondition=me.createEventSubConduitCondition=me.createEventSubDropEntitlementGrantCondition=me.createEventSubUserCondition=me.createEventSubModeratorCondition=me.createEventSubRewardCondition=me.createEventSubBroadcasterCondition=void 0;var qg=m();function ZE(i){return{broadcaster_user_id:(0,qg.extractUserId)(i)}}n(ZE,"createEventSubBroadcasterCondition");me.createEventSubBroadcasterCondition=ZE;function XE(i,e){return{broadcaster_user_id:(0,qg.extractUserId)(i),reward_id:e}}n(XE,"createEventSubRewardCondition");me.createEventSubRewardCondition=XE;function YE(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(YE,"createEventSubModeratorCondition");me.createEventSubModeratorCondition=YE;function eP(i,e){return{broadcaster_user_id:i,user_id:e}}n(eP,"createEventSubUserCondition");me.createEventSubUserCondition=eP;function tP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(tP,"createEventSubDropEntitlementGrantCondition");me.createEventSubDropEntitlementGrantCondition=tP;function rP(i,e){return{conduit_id:i,status:e}}n(rP,"createEventSubConduitCondition");me.createEventSubConduitCondition=rP;function iP(i,e){return{id:i,shard_count:e.toString()}}n(iP,"createEventSubConduitUpdateCondition");me.createEventSubConduitUpdateCondition=iP;function nP(i,e){return{conduit_id:i,shards:e}}n(nP,"createEventSubConduitShardsUpdateCondition");me.createEventSubConduitShardsUpdateCondition=nP});var ll=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixEventSubSubscription=void 0;var Pg=(g(),b(f)),aP=H(),We=m(),ol=class extends We.DataObject{static{n(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[We.rawDataSymbol].id}get status(){return this[We.rawDataSymbol].status}get type(){return this[We.rawDataSymbol].type}get cost(){return this[We.rawDataSymbol].cost}get condition(){return this[We.rawDataSymbol].condition}get creationDate(){return new Date(this[We.rawDataSymbol].created_at)}get transportMethod(){return this[We.rawDataSymbol].transport.method}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[We.rawDataSymbol].id)}get _transport(){return this[We.rawDataSymbol].transport}set _status(e){this[We.rawDataSymbol].status=e}};_n.HelixEventSubSubscription=ol;Pg.__decorate([(0,aP.Enumerable)(!1)],ol.prototype,"_client",void 0);_n.HelixEventSubSubscription=ol=Pg.__decorate([(0,We.rtfm)("api","HelixEventSubSubscription","id")],ol)});var Hh=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var sP=(g(),b(f)),oP=m(),lP=kr(),uP=ll(),Sh=class extends lP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new uP.HelixEventSubSubscription(a,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}};yn.HelixPaginatedEventSubSubscriptionsRequest=Sh;yn.HelixPaginatedEventSubSubscriptionsRequest=Sh=sP.__decorate([(0,oP.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Sh)});var Ch=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixEventSubConduit=void 0;var Ag=(g(),b(f)),cP=H(),lr=m(),ul=class extends lr.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[lr.rawDataSymbol].id}get shardCount(){return this[lr.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[lr.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[lr.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[lr.rawDataSymbol].id)}};fn.HelixEventSubConduit=ul;Ag.__decorate([(0,cP.Enumerable)(!1)],ul.prototype,"_client",void 0);fn.HelixEventSubConduit=ul=Ag.__decorate([(0,lr.rtfm)("api","HelixEventSubConduit")],ul)});var Eh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixEventSubConduitShard=void 0;var dP=(g(),b(f)),gn=m(),qh=class extends gn.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[gn.rawDataSymbol].id}get status(){return this[gn.rawDataSymbol].status}get transportMethod(){return this[gn.rawDataSymbol].transport.method}};bn.HelixEventSubConduitShard=qh;bn.HelixEventSubConduitShard=qh=dP.__decorate([(0,gn.rtfm)("api","HelixEventSubConduitShard")],qh)});var Ih=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixEventSubApi=void 0;var hP=(g(),b(f)),pP=H(),B=m(),C=Eg(),Xe=Ue(),mP=ne(),xn=ue(),wn=ae(),_P=Q(),vn=ll(),cl=Hh(),Ph=Ch(),Ah=Eh(),Dh=class extends _P.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,wn.createPaginationQuery)(e)});return{...(0,xn.createPaginatedResultWithTotal)(t,vn.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new cl.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,wn.createPaginationQuery)(t),status:e}});return{...(0,xn.createPaginatedResultWithTotal)(r,vn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new cl.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,wn.createPaginationQuery)(t),type:e}});return{...(0,xn.createPaginatedResultWithTotal)(r,vn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new cl.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,B.extractUserId)(e),query:{...(0,Xe.createSingleKeyQuery)("user_id",(0,B.extractUserId)(e)),...(0,wn.createPaginationQuery)(t)}});return{...(0,xn.createPaginatedResultWithTotal)(r,vn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,B.extractUserId)(e);return new cl.HelixPaginatedEventSubSubscriptionsRequest((0,Xe.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,a,s,o,l,d){let h=a.method==="webhook"||a.method==="conduit",p=h?void 0:o;if(!h&&!s)throw new Error(`Transport ${a.method} can only handle subscriptions with user context`);let x={type:e,version:t,condition:r,transport:a};d&&(x.is_batching_enabled=!0);let P=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:p,userId:(0,pP.mapOptional)(s,B.extractUserId),canOverrideScopedUserContext:l,forceType:h?"app":"user",jsonBody:x});return new vn.HelixEventSubSubscription(P.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 r=(0,B.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["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 r=(0,B.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,C.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,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,Xe.createSingleKeyQuery)("from_broadcaster_user_id",(0,B.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,Xe.createSingleKeyQuery)("to_broadcaster_user_id",(0,B.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,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,C.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,C.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,C.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,C.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,C.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,C.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,C.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","1",(0,C.createEventSubBroadcasterCondition)(e),t,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 r=(0,B.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,C.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,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelUnbanRequestCreateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.unban_request.create","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelUnbanRequestResolveEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.unban_request.resolve","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelModerateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.moderate","2",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,[],!0)}async subscribeToChannelWarningAcknowledgeEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.warning.acknowledge","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelWarningSendEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.warning.send","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelVipAddEvents(e,t){return await this.createSubscription("channel.vip.add","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToChannelVipRemoveEvents(e,t){return await this.createSubscription("channel.vip.remove","1",(0,C.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,Xe.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,Xe.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,Xe.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,r){return await this.createSubscription("user.update","1",(0,Xe.createSingleKeyQuery)("user_id",(0,B.extractUserId)(e)),t,e,r?["user:read:email"]:void 0)}async subscribeToUserWhisperMessageEvents(e,t){return await this.createSubscription("user.whisper.message","1",(0,Xe.createSingleKeyQuery)("user_id",(0,B.extractUserId)(e)),t,e,["user:read:whispers","user:manage:whispers"])}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,C.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async subscribeToAutoModMessageHoldEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("automod.message.hold","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("automod.message.update","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModSettingsUpdateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("automod.settings.update","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:automod_settings"],!0)}async subscribeToAutoModTermsUpdateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("automod.terms.update","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToChannelChatUserMessageHoldEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_hold","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatUserMessageUpdateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_update","1",(0,C.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelSuspiciousUserUpdateEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.update","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSuspiciousUserMessageEvents(e,t){let r=(0,B.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.message","1",(0,C.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new Ph.HelixEventSubConduit(t,this._client))}async createConduit(e){let t=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"POST",query:{...(0,Xe.createSingleKeyQuery)("shard_count",e.toString())}});return new Ph.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,C.createEventSubConduitUpdateCondition)(e,t)});return new Ph.HelixEventSubConduit(r.data[0],this._client)}async deleteConduit(e){await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"DELETE",query:{...(0,Xe.createSingleKeyQuery)("id",e)}})}async getConduitShards(e,t,r){let a=await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",query:{...(0,C.createEventSubConduitCondition)(e,t),...(0,wn.createPaginationQuery)(r)}});return{...(0,xn.createPaginatedResult)(a,Ah.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new mP.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,C.createEventSubConduitCondition)(e,t)},this._client,r=>new Ah.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,C.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(a=>new Ah.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};Sn.HelixEventSubApi=Dh;Sn.HelixEventSubApi=Dh=hP.__decorate([(0,B.rtfm)("api","HelixEventSubApi")],Dh)});var Dg=u(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.createExtensionTransactionQuery=Lt.createExtensionProductBody=Lt.createReleasedExtensionFilter=void 0;function yP(i,e){return{extension_id:i,extension_version:e}}n(yP,"createReleasedExtensionFilter");Lt.createReleasedExtensionFilter=yP;function fP(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}}n(fP,"createExtensionProductBody");Lt.createExtensionProductBody=fP;function gP(i,e){return{extension_id:i,id:e.transactionIds}}n(gP,"createExtensionTransactionQuery");Lt.createExtensionTransactionQuery=gP});var Th=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixChannelReference=void 0;var Ig=(g(),b(f)),bP=H(),Ae=m(),dl=class extends Ae.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[Ae.rawDataSymbol].broadcaster_id}get displayName(){return this[Ae.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Ae.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Ae.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Ae.checkRelationAssertion)(await this._client.users.getUserById(this[Ae.rawDataSymbol].broadcaster_id))}get gameId(){return this[Ae.rawDataSymbol].game_id}get gameName(){return this[Ae.rawDataSymbol].game_name}async getGame(){return this[Ae.rawDataSymbol].game_id?(0,Ae.checkRelationAssertion)(await this._client.games.getGameById(this[Ae.rawDataSymbol].game_id)):null}get title(){return this[Ae.rawDataSymbol].title}};Hn.HelixChannelReference=dl;Ig.__decorate([(0,bP.Enumerable)(!1)],dl.prototype,"_client",void 0);Hn.HelixChannelReference=dl=Ig.__decorate([(0,Ae.rtfm)("api","HelixChannelReference","id")],dl)});var Uh=u(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.HelixExtensionBitsProduct=void 0;var xP=(g(),b(f)),wP=H(),Ft=m(),Rh=class extends Ft.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[Ft.rawDataSymbol].sku}get cost(){return this[Ft.rawDataSymbol].cost.amount}get displayName(){return this[Ft.rawDataSymbol].display_name}get inDevelopment(){return this[Ft.rawDataSymbol].in_development}get isBroadcast(){return this[Ft.rawDataSymbol].is_broadcast}get expirationDate(){return(0,wP.mapNullable)(this[Ft.rawDataSymbol].expiration,e=>new Date(e))}};Cn.HelixExtensionBitsProduct=Rh;Cn.HelixExtensionBitsProduct=Rh=xP.__decorate([(0,Ft.rtfm)("api","HelixExtensionBitsProduct","sku")],Rh)});var Bh=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixExtensionTransaction=void 0;var Tg=(g(),b(f)),vP=H(),ce=m(),hl=class extends ce.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[ce.rawDataSymbol].id}get transactionDate(){return new Date(this[ce.rawDataSymbol].timestamp)}get broadcasterId(){return this[ce.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ce.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[ce.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ce.checkRelationAssertion)(await this._client.users.getUserById(this[ce.rawDataSymbol].broadcaster_id))}get userId(){return this[ce.rawDataSymbol].user_id}get userName(){return this[ce.rawDataSymbol].user_login}get userDisplayName(){return this[ce.rawDataSymbol].user_name}async getUser(){return(0,ce.checkRelationAssertion)(await this._client.users.getUserById(this[ce.rawDataSymbol].user_id))}get productType(){return this[ce.rawDataSymbol].product_type}get productSku(){return this[ce.rawDataSymbol].product_data.sku}get productCost(){return this[ce.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[ce.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[ce.rawDataSymbol].product_data.inDevelopment}};qn.HelixExtensionTransaction=hl;Tg.__decorate([(0,vP.Enumerable)(!1)],hl.prototype,"_client",void 0);qn.HelixExtensionTransaction=hl=Tg.__decorate([(0,ce.rtfm)("api","HelixExtensionTransaction","id")],hl)});var jh=u(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.HelixExtensionsApi=void 0;var SP=(g(),b(f)),Mg=m(),pl=Dg(),Oh=Ue(),Rg=ne(),Ug=ue(),Bg=ae(),HP=Q(),Og=Th(),kg=Uh(),jg=Bh(),kh=class extends HP.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,pl.createReleasedExtensionFilter)(e,t)});return new Mg.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,Oh.createSingleKeyQuery)("extension_id",e),...(0,Bg.createPaginationQuery)(t)}});return(0,Ug.createPaginatedResult)(r,Og.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new Rg.HelixPaginatedRequest({url:"extensions/live",query:(0,Oh.createSingleKeyQuery)("extension_id",e)},this._client,t=>new Og.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,Oh.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new kg.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,pl.createExtensionProductBody)(e)});return new kg.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,pl.createExtensionTransactionQuery)(e,t),...(0,Bg.createPaginationQuery)(t)}});return(0,Ug.createPaginatedResult)(r,jg.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new Rg.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,pl.createExtensionTransactionQuery)(e,t)},this._client,r=>new jg.HelixExtensionTransaction(r,this._client))}};En.HelixExtensionsApi=kh;En.HelixExtensionsApi=kh=SP.__decorate([(0,Mg.rtfm)("api","HelixExtensionsApi")],kh)});var _l=u(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.HelixGame=void 0;var Lg=(g(),b(f)),CP=H(),wt=m(),ml=class extends wt.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[wt.rawDataSymbol].id}get name(){return this[wt.rawDataSymbol].name}get boxArtUrl(){return this[wt.rawDataSymbol].box_art_url}get igdbId(){return this[wt.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[wt.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[wt.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[wt.rawDataSymbol].id})}};Pn.HelixGame=ml;Lg.__decorate([(0,CP.Enumerable)(!1)],ml.prototype,"_client",void 0);Pn.HelixGame=ml=Lg.__decorate([(0,wt.rtfm)("api","HelixGame","id")],ml)});var Fh=u(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.HelixGameApi=void 0;var yl=(g(),b(f)),Lh=H(),qP=m(),Mh=Ut(),EP=ne(),PP=ue(),AP=ae(),DP=Q(),Qr=_l(),Gr=class extends DP.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new Mh.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Qr.HelixGame(e,this._client)),this._getGameByNameBatcher=new Mh.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Qr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new Mh.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Qr.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,AP.createPaginationQuery)(e)});return(0,PP.createPaginatedResult)(t,Qr.HelixGame,this._client)}getTopGamesPaginated(){return new EP.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Qr.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 Qr.HelixGame(a,this._client)):[]}};An.HelixGameApi=Gr;yl.__decorate([(0,Lh.Enumerable)(!1)],Gr.prototype,"_getGameByIdBatcher",void 0);yl.__decorate([(0,Lh.Enumerable)(!1)],Gr.prototype,"_getGameByNameBatcher",void 0);yl.__decorate([(0,Lh.Enumerable)(!1)],Gr.prototype,"_getGameByIgdbIdBatcher",void 0);An.HelixGameApi=Gr=yl.__decorate([(0,qP.rtfm)("api","HelixGameApi")],Gr)});var Nh=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixGoal=void 0;var Fg=(g(),b(f)),IP=H(),Oe=m(),fl=class extends Oe.DataObject{static{n(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[Oe.rawDataSymbol].id}get broadcasterId(){return this[Oe.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Oe.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[Oe.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,Oe.checkRelationAssertion)(await this._client.users.getUserById(this[Oe.rawDataSymbol].broadcaster_id))}get type(){return this[Oe.rawDataSymbol].type}get description(){return this[Oe.rawDataSymbol].description}get currentAmount(){return this[Oe.rawDataSymbol].current_amount}get targetAmount(){return this[Oe.rawDataSymbol].target_amount}get creationDate(){return this[Oe.rawDataSymbol].created_at}};Dn.HelixGoal=fl;Fg.__decorate([(0,IP.Enumerable)(!1)],fl.prototype,"_client",void 0);Dn.HelixGoal=fl=Fg.__decorate([(0,Oe.rtfm)("api","HelixGoal","id")],fl)});var Gh=u(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.HelixGoalApi=void 0;var TP=(g(),b(f)),RP=J(),Ng=m(),UP=Q(),BP=Nh(),Qh=class extends UP.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,Ng.extractUserId)(e),scopes:["channel:read:goals"],query:(0,RP.createBroadcasterQuery)(e)})).data.map(r=>new BP.HelixGoal(r,this._client))}};In.HelixGoalApi=Qh;In.HelixGoalApi=Qh=TP.__decorate([(0,Ng.rtfm)("api","HelixGoalApi")],Qh)});var Wh=u(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.HelixHypeTrainContribution=void 0;var Qg=(g(),b(f)),OP=H(),ur=m(),gl=class extends ur.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[ur.rawDataSymbol].user}async getUser(){return(0,ur.checkRelationAssertion)(await this._client.users.getUserById(this[ur.rawDataSymbol].user))}get type(){return this[ur.rawDataSymbol].type}get total(){return this[ur.rawDataSymbol].total}};Tn.HelixHypeTrainContribution=gl;Qg.__decorate([(0,OP.Enumerable)(!1)],gl.prototype,"_client",void 0);Tn.HelixHypeTrainContribution=gl=Qg.__decorate([(0,ur.rtfm)("api","HelixHypeTrainContribution","userId")],gl)});var Vh=u(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.HelixHypeTrainEvent=void 0;var Wg=(g(),b(f)),kP=H(),_e=m(),Gg=Wh(),bl=class extends _e.DataObject{static{n(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[_e.rawDataSymbol].id}get eventType(){return this[_e.rawDataSymbol].event_type}get eventDate(){return new Date(this[_e.rawDataSymbol].event_timestamp)}get eventVersion(){return this[_e.rawDataSymbol].version}get id(){return this[_e.rawDataSymbol].event_data.id}get broadcasterId(){return this[_e.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[_e.rawDataSymbol].event_data.level}get startDate(){return new Date(this[_e.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[_e.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[_e.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[_e.rawDataSymbol].event_data.total}get goal(){return this[_e.rawDataSymbol].event_data.goal}get lastContribution(){return new Gg.HelixHypeTrainContribution(this[_e.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[_e.rawDataSymbol].event_data.top_contributions.map(e=>new Gg.HelixHypeTrainContribution(e,this._client))}};Rn.HelixHypeTrainEvent=bl;Wg.__decorate([(0,kP.Enumerable)(!1)],bl.prototype,"_client",void 0);Rn.HelixHypeTrainEvent=bl=Wg.__decorate([(0,_e.rtfm)("api","HelixHypeTrainEvent","id")],bl)});var zh=u(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.HelixHypeTrainApi=void 0;var Vg=J(),$g=m(),jP=ne(),MP=ue(),LP=ae(),FP=Q(),zg=Vh(),$h=class extends FP.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,$g.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,Vg.createBroadcasterQuery)(e),...(0,LP.createPaginationQuery)(t)}});return(0,MP.createPaginatedResult)(r,zg.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new jP.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,$g.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,Vg.createBroadcasterQuery)(e)},this._client,t=>new zg.HelixHypeTrainEvent(t,this._client))}};xl.HelixHypeTrainApi=$h});var Kg=u(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.createWarnUserBody=oe.createCheckAutoModStatusBody=oe.createUpdateShieldModeStatusBody=oe.createBanUserBody=oe.createAutoModSettingsBody=oe.createAutoModProcessBody=oe.createResolveUnbanRequestQuery=oe.createModeratorModifyQuery=oe.createModerationUserListQuery=void 0;var Nt=m();function NP(i,e){return{broadcaster_id:(0,Nt.extractUserId)(i),user_id:e?.userId}}n(NP,"createModerationUserListQuery");oe.createModerationUserListQuery=NP;function QP(i,e){return{broadcaster_id:(0,Nt.extractUserId)(i),user_id:(0,Nt.extractUserId)(e)}}n(QP,"createModeratorModifyQuery");oe.createModeratorModifyQuery=QP;function GP(i,e,t,r,a){return{unban_request_id:t,broadcaster_id:(0,Nt.extractUserId)(i),moderator_id:(0,Nt.extractUserId)(e),status:r?"approved":"denied",resolution_text:a}}n(GP,"createResolveUnbanRequestQuery");oe.createResolveUnbanRequestQuery=GP;function WP(i,e,t){return{user_id:(0,Nt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(WP,"createAutoModProcessBody");oe.createAutoModProcessBody=WP;function VP(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}}n(VP,"createAutoModSettingsBody");oe.createAutoModSettingsBody=VP;function $P(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,Nt.extractUserId)(i.user)}}}n($P,"createBanUserBody");oe.createBanUserBody=$P;function zP(i){return{is_active:i}}n(zP,"createUpdateShieldModeStatusBody");oe.createUpdateShieldModeStatusBody=zP;function KP(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(KP,"createCheckAutoModStatusBody");oe.createCheckAutoModStatusBody=KP;function JP(i,e){return{data:{user_id:(0,Nt.extractUserId)(i),reason:e}}}n(JP,"createWarnUserBody");oe.createWarnUserBody=JP});var Jg=u(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.HelixAutoModSettings=void 0;var ZP=(g(),b(f)),De=m(),Kh=class extends De.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[De.rawDataSymbol].broadcaster_id}get moderatorId(){return this[De.rawDataSymbol].moderator_id}get overallLevel(){return this[De.rawDataSymbol].overall_level?this[De.rawDataSymbol].overall_level:null}get disability(){return this[De.rawDataSymbol].disability}get aggression(){return this[De.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[De.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[De.rawDataSymbol].misogyny}get bullying(){return this[De.rawDataSymbol].bullying}get swearing(){return this[De.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[De.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[De.rawDataSymbol].sex_based_terms}};Un.HelixAutoModSettings=Kh;Un.HelixAutoModSettings=Kh=ZP.__decorate([(0,De.rtfm)("api","HelixAutoModSettings","broadcasterId")],Kh)});var Zg=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixAutoModStatus=void 0;var XP=(g(),b(f)),wl=m(),Jh=class extends wl.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[wl.rawDataSymbol].msg_id}get isPermitted(){return this[wl.rawDataSymbol].is_permitted}};Bn.HelixAutoModStatus=Jh;Bn.HelixAutoModStatus=Jh=XP.__decorate([(0,wl.rtfm)("api","HelixAutoModStatus","messageId")],Jh)});var vl=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixBanUser=void 0;var Zh=(g(),b(f)),Xh=H(),vt=m(),On=class extends vt.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[vt.rawDataSymbol].created_at)}get expiryDate(){return(0,Xh.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[vt.rawDataSymbol].moderator_id}async getModerator(){return(0,vt.checkRelationAssertion)(await this._client.users.getUserById(this[vt.rawDataSymbol].moderator_id))}get userId(){return this[vt.rawDataSymbol].user_id}async getUser(){return(0,vt.checkRelationAssertion)(await this._client.users.getUserById(this[vt.rawDataSymbol].user_id))}};kn.HelixBanUser=On;Zh.__decorate([(0,Xh.Enumerable)(!1)],On.prototype,"_client",void 0);Zh.__decorate([(0,Xh.Enumerable)(!1)],On.prototype,"_expiryTimestamp",void 0);kn.HelixBanUser=On=Zh.__decorate([(0,vt.rtfm)("api","HelixBanUser","userId")],On)});var ep=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixBan=void 0;var YP=(g(),b(f)),Wr=m(),eA=vl(),Yh=class extends eA.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[Wr.rawDataSymbol].user_login}get userDisplayName(){return this[Wr.rawDataSymbol].user_name}get moderatorName(){return this[Wr.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Wr.rawDataSymbol].moderator_name}get reason(){return this[Wr.rawDataSymbol].reason||null}};jn.HelixBan=Yh;jn.HelixBan=Yh=YP.__decorate([(0,Wr.rtfm)("api","HelixBan","userId")],Yh)});var rp=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixBlockedTerm=void 0;var tA=(g(),b(f)),dt=m(),tp=class extends dt.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[dt.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[dt.rawDataSymbol].created_at)}get expirationDate(){return this[dt.rawDataSymbol].expires_at?new Date(this[dt.rawDataSymbol].expires_at):null}get id(){return this[dt.rawDataSymbol].id}get moderatorId(){return this[dt.rawDataSymbol].moderator_id}get text(){return this[dt.rawDataSymbol].text}get updatedDate(){return new Date(this[dt.rawDataSymbol].updated_at)}};Mn.HelixBlockedTerm=tp;Mn.HelixBlockedTerm=tp=tA.__decorate([(0,dt.rtfm)("api","HelixBlockedTerm","id")],tp)});var ip=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixModeratedChannel=void 0;var Xg=(g(),b(f)),rA=H(),St=m(),Sl=class extends St.DataObject{static{n(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[St.rawDataSymbol].broadcaster_id}get name(){return this[St.rawDataSymbol].broadcaster_login}get displayName(){return this[St.rawDataSymbol].broadcaster_name}async getChannel(){return(0,St.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[St.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,St.checkRelationAssertion)(await this._client.users.getUserById(this[St.rawDataSymbol].broadcaster_id))}};Ln.HelixModeratedChannel=Sl;Xg.__decorate([(0,rA.Enumerable)(!1)],Sl.prototype,"_client",void 0);Ln.HelixModeratedChannel=Sl=Xg.__decorate([(0,St.rtfm)("api","HelixModeratedChannel","id")],Sl)});var np=u(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.HelixModerator=void 0;var Yg=(g(),b(f)),iA=H(),cr=m(),Hl=class extends cr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[cr.rawDataSymbol].user_id}get userName(){return this[cr.rawDataSymbol].user_login}get userDisplayName(){return this[cr.rawDataSymbol].user_name}async getUser(){return(0,cr.checkRelationAssertion)(await this._client.users.getUserById(this[cr.rawDataSymbol].user_id))}};Fn.HelixModerator=Hl;Yg.__decorate([(0,iA.Enumerable)(!1)],Hl.prototype,"_client",void 0);Fn.HelixModerator=Hl=Yg.__decorate([(0,cr.rtfm)("api","HelixModerator","userId")],Hl)});var ap=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixShieldModeStatus=void 0;var eb=(g(),b(f)),nA=H(),ht=m(),Cl=class extends ht.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[ht.rawDataSymbol].is_active}get moderatorId(){return this[ht.rawDataSymbol].moderator_id}get moderatorName(){return this[ht.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[ht.rawDataSymbol].moderator_name}async getModerator(){return(0,ht.checkRelationAssertion)(await this._client.users.getUserById(this[ht.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[ht.rawDataSymbol].last_activated_at===""?null:new Date(this[ht.rawDataSymbol].last_activated_at)}};Nn.HelixShieldModeStatus=Cl;eb.__decorate([(0,nA.Enumerable)(!1)],Cl.prototype,"_client",void 0);Nn.HelixShieldModeStatus=Cl=eb.__decorate([(0,ht.rtfm)("api","HelixShieldModeStatus")],Cl)});var sp=u(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.HelixUnbanRequest=void 0;var tb=(g(),b(f)),rb=H(),Y=m(),ql=class extends Y.DataObject{static{n(this,"HelixUnbanRequest")}constructor(e,t){super(e),this._client=t}get id(){return this[Y.rawDataSymbol].id}get broadcasterId(){return this[Y.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Y.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Y.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,Y.checkRelationAssertion)(await this._client.users.getUserById(this[Y.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[Y.rawDataSymbol].moderator_id}get moderatorName(){return this[Y.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Y.rawDataSymbol].moderator_name}async getModerator(){return(0,Y.checkRelationAssertion)(await this._client.users.getUserById(this[Y.rawDataSymbol].moderator_id))}get userId(){return this[Y.rawDataSymbol].user_id}get userName(){return this[Y.rawDataSymbol].user_login}get userDisplayName(){return this[Y.rawDataSymbol].user_name}async getUser(){return(0,Y.checkRelationAssertion)(await this._client.users.getUserById(this[Y.rawDataSymbol].user_id))}get message(){return this[Y.rawDataSymbol].text}get creationDate(){return new Date(this[Y.rawDataSymbol].created_at)}get resolutionMessage(){return this[Y.rawDataSymbol].resolution_text||null}get resolutionDate(){return(0,rb.mapNullable)(this[Y.rawDataSymbol].resolved_at,e=>new Date(e))}};Qn.HelixUnbanRequest=ql;tb.__decorate([(0,rb.Enumerable)(!1)],ql.prototype,"_client",void 0);Qn.HelixUnbanRequest=ql=tb.__decorate([(0,Y.rtfm)("api","HelixUnbanRequest","id")],ql)});var op=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixWarning=void 0;var ib=(g(),b(f)),aA=H(),Ve=m(),El=class extends Ve.DataObject{static{n(this,"HelixWarning")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Ve.rawDataSymbol].user_id}async getBroadcaster(){return(0,Ve.checkRelationAssertion)(await this._client.users.getUserById(this[Ve.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[Ve.rawDataSymbol].moderator_id}async getModerator(){return(0,Ve.checkRelationAssertion)(await this._client.users.getUserById(this[Ve.rawDataSymbol].moderator_id))}get userId(){return this[Ve.rawDataSymbol].user_id}async getUser(){return(0,Ve.checkRelationAssertion)(await this._client.users.getUserById(this[Ve.rawDataSymbol].user_id))}get reason(){return this[Ve.rawDataSymbol].reason}};Gn.HelixWarning=El;ib.__decorate([(0,aA.Enumerable)(!1)],El.prototype,"_client",void 0);Gn.HelixWarning=El=ib.__decorate([(0,Ve.rtfm)("api","HelixWarning","userId")],El)});var dp=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixModerationApi=void 0;var sA=(g(),b(f)),lp=J(),M=m(),dr=Ue(),Ye=Kg(),Pl=ne(),Wn=ue(),Vn=ae(),oA=Q(),nb=Jg(),lA=Zg(),ab=ep(),uA=vl(),sb=rp(),ob=ip(),lb=np(),ub=ap(),up=sp(),cA=op(),cp=class extends oA.BaseApi{static{n(this,"HelixModerationApi")}async getBannedUsers(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:{...(0,Ye.createModerationUserListQuery)(e,t),...(0,Vn.createPaginationQuery)(t)}});return(0,Wn.createPaginatedResult)(r,ab.HelixBan,this._client)}getBannedUsersPaginated(e){return new Pl.HelixPaginatedRequest({url:"moderation/banned",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:(0,lp.createBroadcasterQuery)(e)},this._client,t=>new ab.HelixBan(t,this._client),50)}async checkUserBan(e,t){let r=(0,M.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,M.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,Ye.createModerationUserListQuery)(e,t),...(0,Vn.createPaginationQuery)(t)}});return(0,Wn.createPaginatedResult)(r,lb.HelixModerator,this._client)}getModeratorsPaginated(e){return new Pl.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,M.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,lp.createBroadcasterQuery)(e)},this._client,t=>new lb.HelixModerator(t,this._client))}async getModeratedChannels(e,t){let r=(0,M.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/channels",userId:r,scopes:["user:read:moderated_channels"],query:{...(0,dr.createSingleKeyQuery)("user_id",r),...(0,Vn.createPaginationQuery)(t)}});return(0,Wn.createPaginatedResult)(a,ob.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,M.extractUserId)(e);return new Pl.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,dr.createSingleKeyQuery)("user_id",t)},this._client,r=>new ob.HelixModeratedChannel(r,this._client))}async checkUserMod(e,t){let r=(0,M.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,M.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,Ye.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,M.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,Ye.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:(0,lp.createBroadcasterQuery)(e),jsonBody:(0,Ye.createCheckAutoModStatusBody)(t)})).data.map(a=>new lA.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,M.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,Ye.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,M.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 nb.HelixAutoModSettings(a))}async updateAutoModSettings(e,t){let r=(0,M.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,Ye.createAutoModSettingsBody)(t)})).data.map(s=>new nb.HelixAutoModSettings(s))}async banUser(e,t){let r=(0,M.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,Ye.createBanUserBody)(t)})).data.map(s=>new uA.HelixBanUser(s,s.end_time,this._client))}async unbanUser(e,t){let r=(0,M.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,dr.createSingleKeyQuery)("user_id",(0,M.extractUserId)(t))}})}async getBlockedTerms(e,t){let r=(0,M.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:r,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,Vn.createPaginationQuery)(t)}});return(0,Wn.createPaginatedResult)(a,sb.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let r=(0,M.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 sb.HelixBlockedTerm(s))}async removeBlockedTerm(e,t,r){let a=(0,M.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:r}})}async deleteChatMessages(e,t){let r=(0,M.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,dr.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,M.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 ub.HelixShieldModeStatus(r.data[0],this._client)}async updateShieldModeStatus(e,t){let r=(0,M.extractUserId)(e),a=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,Ye.createUpdateShieldModeStatusBody)(t)});return new ub.HelixShieldModeStatus(a.data[0],this._client)}async getUnbanRequests(e,t,r){let a=(0,M.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"GET",userId:a,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),...(0,dr.createSingleKeyQuery)("status",t),...(0,Vn.createPaginationQuery)(r)}});return(0,Wn.createPaginatedResult)(s,up.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,M.extractUserId)(e);return new Pl.HelixPaginatedRequest({url:"moderation/unban_requests",method:"GET",userId:r,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,dr.createSingleKeyQuery)("status",t)}},this._client,a=>new up.HelixUnbanRequest(a,this._client))}async resolveUnbanRequest(e,t,r,a){let s=(0,M.extractUserId)(e),o=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"PATCH",userId:s,scopes:["moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:(0,Ye.createResolveUnbanRequestQuery)(s,this._getUserContextIdWithDefault(s),t,r,a?.slice(0,500))});return new up.HelixUnbanRequest(o.data[0],this._client)}async warnUser(e,t,r){let a=(0,M.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/warnings",method:"POST",userId:a,scopes:["moderator:manage:warnings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(a),jsonBody:(0,Ye.createWarnUserBody)(t,r.slice(0,500))});return new cA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,dr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};$n.HelixModerationApi=cp;$n.HelixModerationApi=cp=sA.__decorate([(0,M.rtfm)("api","HelixModerationApi")],cp)});var db=u(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.createPollEndBody=Vr.createPollBody=void 0;var cb=m();function dA(i,e){var t;return{broadcaster_id:(0,cb.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}}n(dA,"createPollBody");Vr.createPollBody=dA;function hA(i,e,t){return{broadcaster_id:(0,cb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(hA,"createPollEndBody");Vr.createPollEndBody=hA});var pp=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixPollChoice=void 0;var pA=(g(),b(f)),$r=m(),hp=class extends $r.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[$r.rawDataSymbol].id}get title(){return this[$r.rawDataSymbol].title}get totalVotes(){return this[$r.rawDataSymbol].votes}get channelPointsVotes(){return this[$r.rawDataSymbol].channel_points_votes}};zn.HelixPollChoice=hp;zn.HelixPollChoice=hp=pA.__decorate([(0,$r.rtfm)("api","HelixPollChoice","id")],hp)});var mp=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixPoll=void 0;var hb=(g(),b(f)),mA=H(),Se=m(),_A=pp(),Al=class extends Se.DataObject{static{n(this,"HelixPoll")}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 title(){return this[Se.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[Se.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[Se.rawDataSymbol].channel_points_per_vote}get status(){return this[Se.rawDataSymbol].status}get durationInSeconds(){return this[Se.rawDataSymbol].duration}get startDate(){return new Date(this[Se.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[Se.rawDataSymbol].duration*1e3)}get choices(){return this[Se.rawDataSymbol].choices.map(e=>new _A.HelixPollChoice(e))}};Kn.HelixPoll=Al;hb.__decorate([(0,mA.Enumerable)(!1)],Al.prototype,"_client",void 0);Kn.HelixPoll=Al=hb.__decorate([(0,Se.rtfm)("api","HelixPoll","id")],Al)});var yp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixPollApi=void 0;var yA=(g(),b(f)),pb=J(),zr=m(),fA=Ue(),mb=db(),gA=ne(),bA=ue(),xA=ae(),wA=Q(),Jn=mp(),_p=class extends wA.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,zr.extractUserId)(e),scopes:["channel:read:polls"],query:{...(0,pb.createBroadcasterQuery)(e),...(0,xA.createPaginationQuery)(t)}});return(0,bA.createPaginatedResult)(r,Jn.HelixPoll,this._client)}getPollsPaginated(e){return new gA.HelixPaginatedRequest({url:"polls",userId:(0,zr.extractUserId)(e),scopes:["channel:read:polls"],query:(0,pb.createBroadcasterQuery)(e)},this._client,t=>new Jn.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,zr.extractUserId)(e),scopes:["channel:read:polls"],query:(0,fA.createGetByIdsQuery)(e,t)})).data.map(a=>new Jn.HelixPoll(a,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,zr.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,mb.createPollBody)(e,t)});return new Jn.HelixPoll(r.data[0],this._client)}async endPoll(e,t,r=!0){let a=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:(0,zr.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,mb.createPollEndBody)(e,t,r)});return new Jn.HelixPoll(a.data[0],this._client)}};Zn.HelixPollApi=_p;Zn.HelixPollApi=_p=yA.__decorate([(0,zr.rtfm)("api","HelixPollApi")],_p)});var yb=u(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.createEndPredictionBody=Kr.createPredictionBody=void 0;var _b=m();function vA(i,e){return{broadcaster_id:(0,_b.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(vA,"createPredictionBody");Kr.createPredictionBody=vA;function SA(i,e,t,r){return{broadcaster_id:(0,_b.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(SA,"createEndPredictionBody");Kr.createEndPredictionBody=SA});var fp=u(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.HelixPredictor=void 0;var fb=(g(),b(f)),HA=H(),Qt=m(),Dl=class extends Qt.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Qt.rawDataSymbol].user_id}get userName(){return this[Qt.rawDataSymbol].user_login}get userDisplayName(){return this[Qt.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Qt.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Qt.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Qt.rawDataSymbol].channel_points_won}};Xn.HelixPredictor=Dl;fb.__decorate([(0,HA.Enumerable)(!1)],Dl.prototype,"_client",void 0);Xn.HelixPredictor=Dl=fb.__decorate([(0,Qt.rtfm)("api","HelixPredictor","userId")],Dl)});var gp=u(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.HelixPredictionOutcome=void 0;var gb=(g(),b(f)),CA=H(),Gt=m(),qA=fp(),Il=class extends Gt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Gt.rawDataSymbol].id}get title(){return this[Gt.rawDataSymbol].title}get users(){return this[Gt.rawDataSymbol].users}get totalChannelPoints(){return this[Gt.rawDataSymbol].channel_points}get color(){return this[Gt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Gt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new qA.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};Yn.HelixPredictionOutcome=Il;gb.__decorate([(0,CA.Enumerable)(!1)],Il.prototype,"_client",void 0);Yn.HelixPredictionOutcome=Il=gb.__decorate([(0,Gt.rtfm)("api","HelixPredictionOutcome","id")],Il)});var bp=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixPrediction=void 0;var xb=(g(),b(f)),EA=H(),ee=m(),bb=gp(),Tl=class extends ee.DataObject{static{n(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[ee.rawDataSymbol].id}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 title(){return this[ee.rawDataSymbol].title}get status(){return this[ee.rawDataSymbol].status}get autoLockAfter(){return this[ee.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[ee.rawDataSymbol].created_at)}get endDate(){return this[ee.rawDataSymbol].ended_at?new Date(this[ee.rawDataSymbol].ended_at):null}get lockDate(){return this[ee.rawDataSymbol].locked_at?new Date(this[ee.rawDataSymbol].locked_at):null}get outcomes(){return this[ee.rawDataSymbol].outcomes.map(e=>new bb.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[ee.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[ee.rawDataSymbol].winning_outcome_id)return null;let e=this[ee.rawDataSymbol].outcomes.find(t=>t.id===this[ee.rawDataSymbol].winning_outcome_id);if(!e)throw new ee.HellFreezesOverError("Winning outcome not found in outcomes array");return new bb.HelixPredictionOutcome(e,this._client)}};ea.HelixPrediction=Tl;xb.__decorate([(0,EA.Enumerable)(!1)],Tl.prototype,"_client",void 0);ea.HelixPrediction=Tl=xb.__decorate([(0,ee.rtfm)("api","HelixPrediction","id")],Tl)});var wp=u(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixPredictionApi=void 0;var PA=(g(),b(f)),wb=J(),Jr=m(),AA=Ue(),vb=yb(),DA=ne(),IA=ue(),TA=ae(),RA=Q(),ta=bp(),xp=class extends RA.BaseApi{static{n(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,wb.createBroadcasterQuery)(e),...(0,TA.createPaginationQuery)(t)}});return(0,IA.createPaginatedResult)(r,ta.HelixPrediction,this._client)}getPredictionsPaginated(e){return new DA.HelixPaginatedRequest({url:"predictions",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,wb.createBroadcasterQuery)(e)},this._client,t=>new ta.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,AA.createGetByIdsQuery)(e,t)})).data.map(a=>new ta.HelixPrediction(a,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,vb.createPredictionBody)(e,t)});return new ta.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,a){let s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:(0,Jr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,vb.createEndPredictionBody)(e,t,r,a)});return new ta.HelixPrediction(s.data[0],this._client)}};ra.HelixPredictionApi=xp;ra.HelixPredictionApi=xp=PA.__decorate([(0,Jr.rtfm)("api","HelixPredictionApi")],xp)});var Hb=u(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.createRaidStartQuery=void 0;var Sb=m();function UA(i,e){return{from_broadcaster_id:(0,Sb.extractUserId)(i),to_broadcaster_id:(0,Sb.extractUserId)(e)}}n(UA,"createRaidStartQuery");Rl.createRaidStartQuery=UA});var Sp=u(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.HelixRaid=void 0;var BA=(g(),b(f)),Ul=m(),vp=class extends Ul.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[Ul.rawDataSymbol].created_at)}get targetIsMature(){return this[Ul.rawDataSymbol].is_mature}};ia.HelixRaid=vp;ia.HelixRaid=vp=BA.__decorate([(0,Ul.rtfm)("api","HelixRaid")],vp)});var qp=u(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.HelixRaidApi=void 0;var OA=(g(),b(f)),kA=J(),Hp=m(),jA=Hb(),MA=Q(),LA=Sp(),Cp=class extends MA.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Hp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,jA.createRaidStartQuery)(e,t)});return new LA.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Hp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,kA.createBroadcasterQuery)(e)})}};na.HelixRaidApi=Cp;na.HelixRaidApi=Cp=OA.__decorate([(0,Hp.rtfm)("api","HelixRaidApi")],Cp)});var Ep=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.createScheduleSegmentUpdateBody=$e.createScheduleSegmentModifyQuery=$e.createScheduleSegmentBody=$e.createScheduleSettingsUpdateQuery=$e.createScheduleQuery=void 0;var Bl=m();function FA(i,e){var t;return{broadcaster_id:(0,Bl.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(FA,"createScheduleQuery");$e.createScheduleQuery=FA;function NA(i,e){return e.vacation?{broadcaster_id:(0,Bl.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,Bl.extractUserId)(i),is_vacation_enabled:"false"}}n(NA,"createScheduleSettingsUpdateQuery");$e.createScheduleSettingsUpdateQuery=NA;function QA(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(QA,"createScheduleSegmentBody");$e.createScheduleSegmentBody=QA;function GA(i,e){return{broadcaster_id:(0,Bl.extractUserId)(i),id:e}}n(GA,"createScheduleSegmentModifyQuery");$e.createScheduleSegmentModifyQuery=GA;function WA(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(WA,"createScheduleSegmentUpdateBody");$e.createScheduleSegmentUpdateBody=WA});var sa=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixScheduleSegment=void 0;var Cb=(g(),b(f)),qb=H(),et=m(),Ol=class extends et.DataObject{static{n(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[et.rawDataSymbol].id}get startDate(){return new Date(this[et.rawDataSymbol].start_time)}get endDate(){return new Date(this[et.rawDataSymbol].end_time)}get title(){return this[et.rawDataSymbol].title}get cancelEndDate(){return(0,qb.mapNullable)(this[et.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[et.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[et.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[et.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[et.rawDataSymbol].is_recurring}};aa.HelixScheduleSegment=Ol;Cb.__decorate([(0,qb.Enumerable)(!1)],Ol.prototype,"_client",void 0);aa.HelixScheduleSegment=Ol=Cb.__decorate([(0,et.rtfm)("api","HelixScheduleSegment","id")],Ol)});var Ap=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixPaginatedScheduleSegmentRequest=void 0;var VA=(g(),b(f)),$A=m(),zA=Ep(),KA=ne(),JA=sa(),Pp=class extends KA.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,zA.createScheduleQuery)(e,r)},t,a=>new JA.HelixScheduleSegment(a,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}}};oa.HelixPaginatedScheduleSegmentRequest=Pp;oa.HelixPaginatedScheduleSegmentRequest=Pp=VA.__decorate([(0,$A.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Pp)});var Dp=u(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.HelixSchedule=void 0;var Eb=(g(),b(f)),ZA=H(),pt=m(),XA=sa(),kl=class extends pt.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[pt.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new XA.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[pt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[pt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[pt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,pt.checkRelationAssertion)(await this._client.users.getUserById(this[pt.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[pt.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[pt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};la.HelixSchedule=kl;Eb.__decorate([(0,ZA.Enumerable)(!1)],kl.prototype,"_client",void 0);la.HelixSchedule=kl=Eb.__decorate([(0,pt.rtfm)("api","HelixSchedule","broadcasterId")],kl)});var Rp=u(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.HelixScheduleApi=void 0;var Pb=J(),Zr=m(),YA=Ue(),Xr=Ep(),eD=ae(),tD=Q(),rD=Ap(),iD=Dp(),Ip=sa(),Tp=class extends tD.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,Zr.extractUserId)(e),query:{...(0,Xr.createScheduleQuery)(e,t),...(0,eD.createPaginationQuery)(t)}});return{data:new iD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new rD.HelixPaginatedScheduleSegmentRequest(e,this._client,t)}async getScheduleSegmentsByIds(e,t){var r,a;return(a=(r=(await this._client.callApi({type:"helix",url:"schedule",userId:(0,Zr.extractUserId)(e),query:(0,YA.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new Ip.HelixScheduleSegment(o,this._client)))!==null&&a!==void 0?a:[]}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,Pb.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,Zr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Xr.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,Zr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Pb.createBroadcasterQuery)(e),jsonBody:(0,Xr.createScheduleSegmentBody)(t)});return new Ip.HelixScheduleSegment(r.data.segments[0],this._client)}async updateScheduleSegment(e,t,r){let a=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:(0,Zr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Xr.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,Xr.createScheduleSegmentUpdateBody)(r)});return new Ip.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,Zr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,Xr.createScheduleSegmentModifyQuery)(e,t)})}};jl.HelixScheduleApi=Tp});var Ab=u(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.createSearchChannelsQuery=void 0;function nD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(nD,"createSearchChannelsQuery");Ml.createSearchChannelsQuery=nD});var Up=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixChannelSearchResult=void 0;var Db=(g(),b(f)),aD=H(),ye=m(),Ll=class extends ye.DataObject{static{n(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[ye.rawDataSymbol].broadcaster_language}get id(){return this[ye.rawDataSymbol].id}get name(){return this[ye.rawDataSymbol].broadcaster_login}get displayName(){return this[ye.rawDataSymbol].display_name}async getUser(){return(0,ye.checkRelationAssertion)(await this._client.users.getUserById(this[ye.rawDataSymbol].id))}get gameId(){return this[ye.rawDataSymbol].game_id}get gameName(){return this[ye.rawDataSymbol].game_name}async getGame(){return this[ye.rawDataSymbol].game_id?(0,ye.checkRelationAssertion)(await this._client.games.getGameById(this[ye.rawDataSymbol].game_id)):null}get isLive(){return this[ye.rawDataSymbol].is_live}get tags(){return this[ye.rawDataSymbol].tags}get thumbnailUrl(){return this[ye.rawDataSymbol].thumbnail_url}get startDate(){return this[ye.rawDataSymbol].is_live?new Date(this[ye.rawDataSymbol].started_at):null}};ua.HelixChannelSearchResult=Ll;Db.__decorate([(0,aD.Enumerable)(!1)],Ll.prototype,"_client",void 0);ua.HelixChannelSearchResult=Ll=Db.__decorate([(0,ye.rtfm)("api","HelixChannelSearchResult","id")],Ll)});var Op=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixSearchApi=void 0;var sD=(g(),b(f)),oD=m(),Ib=Ab(),Tb=ne(),Rb=ue(),Ub=ae(),lD=Q(),Bb=_l(),Ob=Up(),Bp=class extends lD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,Ub.createPaginationQuery)(t)}});return(0,Rb.createPaginatedResult)(r,Bb.HelixGame,this._client)}searchCategoriesPaginated(e){return new Tb.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new Bb.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,Ib.createSearchChannelsQuery)(e,t),...(0,Ub.createPaginationQuery)(t)}});return(0,Rb.createPaginatedResult)(r,Ob.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new Tb.HelixPaginatedRequest({url:"search/channels",query:(0,Ib.createSearchChannelsQuery)(e,t)},this._client,r=>new Ob.HelixChannelSearchResult(r,this._client))}};ca.HelixSearchApi=Bp;ca.HelixSearchApi=Bp=sD.__decorate([(0,oD.rtfm)("api","HelixSearchApi")],Bp)});var jp=u(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.StreamNotLiveError=void 0;var uD=m(),kp=class extends uD.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};Fl.StreamNotLiveError=kp});var kb=u(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.createVideoQuery=Wt.createStreamMarkerBody=Wt.createStreamQuery=void 0;var cD=m();function dD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(dD,"createStreamQuery");Wt.createStreamQuery=dD;function hD(i,e){return{user_id:(0,cD.extractUserId)(i),description:e}}n(hD,"createStreamMarkerBody");Wt.createStreamMarkerBody=hD;function pD(i){return{video_id:i}}n(pD,"createVideoQuery");Wt.createVideoQuery=pD});var Mp=u(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.HelixStream=void 0;var jb=(g(),b(f)),mD=H(),te=m(),Nl=class extends te.DataObject{static{n(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[te.rawDataSymbol].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 gameId(){return this[te.rawDataSymbol].game_id}get gameName(){return this[te.rawDataSymbol].game_name}async getGame(){return this[te.rawDataSymbol].game_id?(0,te.checkRelationAssertion)(await this._client.games.getGameById(this[te.rawDataSymbol].game_id)):null}get type(){return this[te.rawDataSymbol].type}get title(){return this[te.rawDataSymbol].title}get viewers(){return this[te.rawDataSymbol].viewer_count}get startDate(){return new Date(this[te.rawDataSymbol].started_at)}get language(){return this[te.rawDataSymbol].language}get thumbnailUrl(){return this[te.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[te.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[te.rawDataSymbol].tags}get isMature(){return this[te.rawDataSymbol].is_mature}};da.HelixStream=Nl;jb.__decorate([(0,mD.Enumerable)(!1)],Nl.prototype,"_client",void 0);da.HelixStream=Nl=jb.__decorate([(0,te.rtfm)("api","HelixStream","id")],Nl)});var Gl=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixStreamMarker=void 0;var Mb=(g(),b(f)),_D=H(),Yr=m(),Ql=class extends Yr.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[Yr.rawDataSymbol].id}get creationDate(){return new Date(this[Yr.rawDataSymbol].created_at)}get description(){return this[Yr.rawDataSymbol].description}get positionInSeconds(){return this[Yr.rawDataSymbol].position_seconds}};ha.HelixStreamMarker=Ql;Mb.__decorate([(0,_D.Enumerable)(!1)],Ql.prototype,"_client",void 0);ha.HelixStreamMarker=Ql=Mb.__decorate([(0,Yr.rtfm)("api","HelixStreamMarker","id")],Ql)});var Np=u(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.HelixStreamMarkerWithVideo=void 0;var yD=(g(),b(f)),Lp=m(),fD=Gl(),Fp=class extends fD.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[Lp.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,Lp.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};pa.HelixStreamMarkerWithVideo=Fp;pa.HelixStreamMarkerWithVideo=Fp=yD.__decorate([(0,Lp.rtfm)("api","HelixStreamMarkerWithVideo","id")],Fp)});var Gp=u(ya=>{"use strict";var ti;Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixStreamApi=void 0;var Qp=(g(),b(f)),ma=H(),Lb=J(),Ie=m(),gD=jp(),Wl=Ue(),ei=kb(),Fb=Ut(),Vl=ne(),Nb=ue(),$l=ae(),bD=Q(),hr=Mp(),xD=Gl(),wD=Np(),_a=ti=class extends bD.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new Fb.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new hr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new Fb.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,ei.createStreamQuery)(e),...(0,$l.createPaginationQuery)(e)}});return(0,Nb.createPaginatedResult)(t,hr.HelixStream,this._client)}getStreamsPaginated(e={}){return new Vl.HelixPaginatedRequest({url:"streams",query:(0,ei.createStreamQuery)(e)},this._client,t=>new hr.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Ie.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,Ie.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Ie.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Ie.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,ei.createStreamQuery)({userId:t})});return(0,ma.mapNullable)(r.data[0],a=>new hr.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Ie.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,Wl.createUserQuery)(e),...(0,$l.createPaginationQuery)(t)},userId:(0,Ie.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,ma.flatten)(a.data.map(s=>ti._mapGetStreamMarkersResult(s,this._client))),cursor:(r=a.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new Vl.HelixPaginatedRequest({url:"streams/markers",query:(0,Wl.createUserQuery)(e),userId:(0,Ie.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>ti._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var a;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,ei.createVideoQuery)(t),...(0,$l.createPaginationQuery)(r)},userId:(0,Ie.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,ma.flatten)(s.data.map(o=>ti._mapGetStreamMarkersResult(o,this._client))),cursor:(a=s.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new Vl.HelixPaginatedRequest({url:"streams/markers",query:(0,ei.createVideoQuery)(t),userId:(0,Ie.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>ti._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Ie.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,ei.createStreamMarkerBody)(e,t)});return new xD.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof Lb.HttpStatusCodeError&&r.statusCode===404?new gD.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,Ie.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,Lb.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,Ie.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,Wl.createSingleKeyQuery)("user_id",r),...(0,$l.createPaginationQuery)(t)}});return(0,Nb.createPaginatedResult)(a,hr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Ie.extractUserId)(e);return new Vl.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,Wl.createSingleKeyQuery)("user_id",t)},this._client,r=>new hr.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,a)=>[...r,...a.markers.map(s=>new wD.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};ya.HelixStreamApi=_a;Qp.__decorate([(0,ma.Enumerable)(!1)],_a.prototype,"_getStreamByUserIdBatcher",void 0);Qp.__decorate([(0,ma.Enumerable)(!1)],_a.prototype,"_getStreamByUserNameBatcher",void 0);ya.HelixStreamApi=_a=ti=Qp.__decorate([(0,Ie.rtfm)("api","HelixStreamApi")],_a)});var Gb=u(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.createSubscriptionCheckQuery=void 0;var Qb=m();function vD(i,e){return{broadcaster_id:(0,Qb.extractUserId)(i),user_id:(0,Qb.extractUserId)(e)}}n(vD,"createSubscriptionCheckQuery");zl.createSubscriptionCheckQuery=vD});var Jl=u(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.HelixUserSubscription=void 0;var Wb=(g(),b(f)),SD=H(),Vt=m(),Kl=class extends Vt.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Vt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Vt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Vt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[Vt.rawDataSymbol].broadcaster_id)}get isGift(){return this[Vt.rawDataSymbol].is_gift}get tier(){return this[Vt.rawDataSymbol].tier}};fa.HelixUserSubscription=Kl;Wb.__decorate([(0,SD.Enumerable)(!1)],Kl.prototype,"_client",void 0);fa.HelixUserSubscription=Kl=Wb.__decorate([(0,Vt.rtfm)("api","HelixUserSubscription","broadcasterId")],Kl)});var Zl=u(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.HelixSubscription=void 0;var HD=(g(),b(f)),le=m(),CD=Jl(),Wp=class extends CD.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[le.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[le.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[le.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,le.checkRelationAssertion)(await this._client.users.getUserById(this[le.rawDataSymbol].broadcaster_id))}get gifterId(){return this[le.rawDataSymbol].is_gift?this[le.rawDataSymbol].gifter_id:null}get gifterName(){return this[le.rawDataSymbol].is_gift?this[le.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[le.rawDataSymbol].is_gift?this[le.rawDataSymbol].gifter_name:null}async getGifter(){return this[le.rawDataSymbol].is_gift?(0,le.checkRelationAssertion)(await this._client.users.getUserById(this[le.rawDataSymbol].gifter_id)):null}get userId(){return this[le.rawDataSymbol].user_id}get userName(){return this[le.rawDataSymbol].user_login}get userDisplayName(){return this[le.rawDataSymbol].user_name}async getUser(){return(0,le.checkRelationAssertion)(await this._client.users.getUserById(this[le.rawDataSymbol].user_id))}};ga.HelixSubscription=Wp;ga.HelixSubscription=Wp=HD.__decorate([(0,le.rtfm)("api","HelixSubscription","userId")],Wp)});var $p=u(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.HelixPaginatedSubscriptionsRequest=void 0;var qD=(g(),b(f)),ED=J(),Vb=m(),PD=kr(),AD=Zl(),Vp=class extends PD.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,Vb.extractUserId)(e),query:(0,ED.createBroadcasterQuery)(e)},t,r=>new AD.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};ba.HelixPaginatedSubscriptionsRequest=Vp;ba.HelixPaginatedSubscriptionsRequest=Vp=qD.__decorate([(0,Vb.rtfm)("api","HelixPaginatedSubscriptionsRequest")],Vp)});var Kp=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixSubscriptionApi=void 0;var DD=(g(),b(f)),$b=J(),Xl=m(),ID=Ue(),TD=Gb(),RD=ue(),UD=ae(),BD=Q(),OD=$p(),zb=Zl(),kD=Jl(),zp=class extends BD.BaseApi{static{n(this,"HelixSubscriptionApi")}async getSubscriptions(e,t){let r=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:(0,Xl.extractUserId)(e),query:{...(0,$b.createBroadcasterQuery)(e),...(0,UD.createPaginationQuery)(t)}});return{...(0,RD.createPaginatedResultWithTotal)(r,zb.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new OD.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,Xl.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,ID.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new zb.HelixSubscription(a,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,Xl.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,TD.createSubscriptionCheckQuery)(t,e)});return new kD.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof $b.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};xa.HelixSubscriptionApi=zp;xa.HelixSubscriptionApi=zp=DD.__decorate([(0,Xl.rtfm)("api","HelixSubscriptionApi")],zp)});var eu=u(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixTeam=void 0;var Kb=(g(),b(f)),jD=H(),tt=m(),Yl=class extends tt.DataObject{static{n(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[tt.rawDataSymbol].id}get name(){return this[tt.rawDataSymbol].team_name}get displayName(){return this[tt.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[tt.rawDataSymbol].background_image_url}get bannerUrl(){return this[tt.rawDataSymbol].banner}get creationDate(){return new Date(this[tt.rawDataSymbol].created_at)}get updateDate(){return new Date(this[tt.rawDataSymbol].updated_at)}get info(){return this[tt.rawDataSymbol].info}get logoThumbnailUrl(){return this[tt.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};wa.HelixTeam=Yl;Kb.__decorate([(0,jD.Enumerable)(!1)],Yl.prototype,"_client",void 0);wa.HelixTeam=Yl=Kb.__decorate([(0,tt.rtfm)("api","HelixTeam","id")],Yl)});var Zp=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixTeamWithUsers=void 0;var MD=(g(),b(f)),Jb=m(),LD=Eo(),FD=eu(),Jp=class extends FD.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Jb.rawDataSymbol].users.map(e=>new LD.HelixUserRelation(e,this._client))}};va.HelixTeamWithUsers=Jp;va.HelixTeamWithUsers=Jp=MD.__decorate([(0,Jb.rtfm)("api","HelixTeamWithUsers","id")],Jp)});var em=u(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixTeamApi=void 0;var ND=(g(),b(f)),Xp=J(),Xb=m(),QD=Q(),GD=eu(),Zb=Zp(),Yp=class extends QD.BaseApi{static{n(this,"HelixTeamApi")}async getTeamsForBroadcaster(e){var t,r;return(r=(t=(await this._client.callApi({type:"helix",url:"teams/channel",userId:(0,Xb.extractUserId)(e),query:(0,Xp.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new GD.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 Zb.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof Xp.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 Zb.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof Xp.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Sa.HelixTeamApi=Yp;Sa.HelixTeamApi=Yp=ND.__decorate([(0,Xb.rtfm)("api","HelixTeamApi")],Yp)});var ex=u(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.createUserBlockDeleteQuery=ri.createUserBlockCreateQuery=void 0;var Yb=m();function WD(i,e){return{target_user_id:(0,Yb.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(WD,"createUserBlockCreateQuery");ri.createUserBlockCreateQuery=WD;function VD(i){return{target_user_id:(0,Yb.extractUserId)(i)}}n(VD,"createUserBlockDeleteQuery");ri.createUserBlockDeleteQuery=VD});var iu=u(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.HelixBaseExtension=void 0;var tu=m(),tm=class extends tu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[tu.rawDataSymbol].id}get version(){return this[tu.rawDataSymbol].version}get name(){return this[tu.rawDataSymbol].name}};ru.HelixBaseExtension=tm});var im=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixInstalledExtension=void 0;var $D=(g(),b(f)),zD=m(),KD=iu(),rm=class extends KD.HelixBaseExtension{static{n(this,"HelixInstalledExtension")}constructor(e,t,r){super(r),this._slotType=e,this._slotId=t}get slotType(){return this._slotType}get slotId(){return this._slotId}};Ha.HelixInstalledExtension=rm;Ha.HelixInstalledExtension=rm=$D.__decorate([(0,zD.rtfm)("api","HelixInstalledExtension","id")],rm)});var sm=u(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.HelixInstalledExtensionList=void 0;var JD=(g(),b(f)),Ca=m(),nm=im(),am=class extends Ca.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[Ca.rawDataSymbol][e][t];return r.active?new nm.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[Ca.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new nm.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[Ca.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new nm.HelixInstalledExtension(e,r,a)))}};qa.HelixInstalledExtensionList=am;qa.HelixInstalledExtensionList=am=JD.__decorate([(0,Ca.rtfm)("api","HelixInstalledExtensionList")],am)});var um=u(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixUserExtension=void 0;var ZD=(g(),b(f)),om=m(),XD=iu(),lm=class extends XD.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[om.rawDataSymbol].can_activate}get types(){return this[om.rawDataSymbol].type}};Ea.HelixUserExtension=lm;Ea.HelixUserExtension=lm=ZD.__decorate([(0,om.rtfm)("api","HelixUserExtension","id")],lm)});var au=u(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixUser=void 0;var tx=(g(),b(f)),YD=H(),rt=m(),nu=class extends rt.DataObject{static{n(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[rt.rawDataSymbol].id}get name(){return this[rt.rawDataSymbol].login}get displayName(){return this[rt.rawDataSymbol].display_name}get description(){return this[rt.rawDataSymbol].description}get type(){return this[rt.rawDataSymbol].type}get broadcasterType(){return this[rt.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[rt.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[rt.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[rt.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}};Pa.HelixUser=nu;tx.__decorate([(0,YD.Enumerable)(!1)],nu.prototype,"_client",void 0);Pa.HelixUser=nu=tx.__decorate([(0,rt.rtfm)("api","HelixUser","id")],nu)});var dm=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixPrivilegedUser=void 0;var e1=(g(),b(f)),rx=m(),t1=au(),cm=class extends t1.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[rx.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};Aa.HelixPrivilegedUser=cm;Aa.HelixPrivilegedUser=cm=e1.__decorate([(0,rx.rtfm)("api","HelixPrivilegedUser","id")],cm)});var hm=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixUserBlock=void 0;var ix=(g(),b(f)),r1=H(),pr=m(),su=class extends pr.DataObject{static{n(this,"HelixUserBlock")}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].display_name}async getUser(){return(0,pr.checkRelationAssertion)(await this._client.users.getUserById(this[pr.rawDataSymbol].user_id))}};Da.HelixUserBlock=su;ix.__decorate([(0,r1.Enumerable)(!1)],su.prototype,"_client",void 0);Da.HelixUserBlock=su=ix.__decorate([(0,pr.rtfm)("api","HelixUserBlock","userId")],su)});var _m=u(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.HelixUserApi=void 0;var pm=(g(),b(f)),mm=H(),nx=J(),be=m(),i1=Ue(),ax=ex(),sx=Ut(),n1=ne(),a1=ue(),s1=ae(),o1=Q(),ox=sm(),l1=um(),lx=dm(),ou=au(),ux=hm(),Ia=class extends o1.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new sx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new ou.HelixUser(e,this._client)),this._getUserByNameBatcher=new sx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new ou.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(be.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(be.extractUserName))}async getUserById(e){let t=(0,be.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,mm.mapNullable)(r.data[0],a=>new ou.HelixUser(a,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,be.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,be.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,be.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var r;let a=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,be.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((r=a.data)===null||r===void 0)&&r.length))throw new be.HellFreezesOverError("Could not get authenticated user");return new lx.HelixPrivilegedUser(a.data[0],this._client)}async updateAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,be.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new lx.HelixPrivilegedUser(r.data[0],this._client)}async getBlocks(e,t){let r=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,be.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,nx.createBroadcasterQuery)(e),...(0,s1.createPaginationQuery)(t)}});return(0,a1.createPaginatedResult)(r,ux.HelixUserBlock,this._client)}getBlocksPaginated(e){return new n1.HelixPaginatedRequest({url:"users/blocks",userId:(0,be.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,nx.createBroadcasterQuery)(e)},this._client,t=>new ux.HelixUserBlock(t,this._client))}async createBlock(e,t,r={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,be.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,ax.createUserBlockCreateQuery)(t,r)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,be.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,ax.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,be.extractUserId)(e),scopes:t?["channel:manage:extensions"]:["user:read:broadcast","channel:manage:extensions"]})).data.map(a=>new l1.HelixUserExtension(a))}async getActiveExtensions(e,t=!1){let r=(0,be.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"users/extensions",userId:r,scopes:t?["user:read:broadcast","channel:manage:extensions"]:void 0,query:(0,i1.createSingleKeyQuery)("user_id",r)});return new ox.HelixInstalledExtensionList(a.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,be.extractUserId)(e),scopes:["channel:manage:extensions"],jsonBody:{data:t}});return new ox.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 ou.HelixUser(s,this._client))}};Ta.HelixUserApi=Ia;pm.__decorate([(0,mm.Enumerable)(!1)],Ia.prototype,"_getUserByIdBatcher",void 0);pm.__decorate([(0,mm.Enumerable)(!1)],Ia.prototype,"_getUserByNameBatcher",void 0);Ta.HelixUserApi=Ia=pm.__decorate([(0,be.rtfm)("api","HelixUserApi")],Ia)});var fm=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixVideo=void 0;var ym=(g(),b(f)),cx=yi(),u1=H(),O=m(),Ra=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 r=/(\d+)([hms])/.exec(t);if(!r)throw new O.HellFreezesOverError(`Could not parse partial duration string: ${t}`);let[,a,s]=r;return parseInt(a,10)*{h:3600,m:60,s:1}[s]}).reduce((t,r)=>t+r)}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,r=!1){if(this[O.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[O.rawDataSymbol].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);let a=e+t;return r?this[O.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return e<o&&s.offset<a}):this[O.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return s.offset<=e&&a<=o})}};Ua.HelixVideo=Ra;ym.__decorate([(0,u1.Enumerable)(!1)],Ra.prototype,"_client",void 0);ym.__decorate([(0,cx.CachedGetter)()],Ra.prototype,"durationInSeconds",null);Ua.HelixVideo=Ra=ym.__decorate([cx.Cacheable,(0,O.rtfm)("api","HelixVideo","id")],Ra)});var bm=u(Ba=>{"use strict";var lu;Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixVideoApi=void 0;var dx=(g(),b(f)),c1=H(),uu=m(),d1=Ut(),h1=ne(),p1=ue(),m1=ae(),_1=Q(),gm=fm(),cu=lu=class extends _1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new d1.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new gm.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,uu.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,uu.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,uu.extractUserId)(e),query:{id:t}})}async _getVideos(e,t,r={}){if(!t.length)return{data:[]};let a=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?t[0]:void 0,query:{...lu._makeVideosQuery(e,t,r),...(0,m1.createPaginationQuery)(r)}});return(0,p1.createPaginatedResult)(a,gm.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new h1.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:lu._makeVideosQuery(e,t,r)},this._client,a=>new gm.HelixVideo(a,this._client))}static _makeVideosQuery(e,t,r={}){let{language:a,period:s,orderBy:o,type:l}=r;return{[e]:t,language:a,period:s,sort:o,type:l}}};Ba.HelixVideoApi=cu;dx.__decorate([(0,c1.Enumerable)(!1)],cu.prototype,"_getVideoByIdBatcher",void 0);Ba.HelixVideoApi=cu=lu=dx.__decorate([(0,uu.rtfm)("api","HelixVideoApi")],cu)});var px=u(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.createWhisperQuery=void 0;var hx=m();function y1(i,e){return{from_user_id:(0,hx.extractUserId)(i),to_user_id:(0,hx.extractUserId)(e)}}n(y1,"createWhisperQuery");du.createWhisperQuery=y1});var wm=u(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HelixWhisperApi=void 0;var f1=(g(),b(f)),mx=m(),g1=px(),b1=Q(),xm=class extends b1.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,mx.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,g1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};Oa.HelixWhisperApi=xm;Oa.HelixWhisperApi=xm=f1.__decorate([(0,mx.rtfm)("api","HelixWhisperApi")],xm)});var Sm=u(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.ApiReportedRequest=void 0;var vm=class{static{n(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}};hu.ApiReportedRequest=vm});var mu=u(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.BaseApiClient=void 0;var G=(g(),b(f)),W=yi(),x1=Ls(),w1=H(),v1=$c(),ii=J(),pu=dd(),_x=m(),S1=Tf(),H1=bd(),C1=Rd(),q1=kd(),E1=Qd(),P1=uh(),A1=ph(),D1=fh(),I1=vh(),T1=Ih(),R1=jh(),U1=Fh(),B1=Gh(),O1=zh(),k1=dp(),j1=yp(),M1=wp(),L1=qp(),F1=Rp(),N1=Op(),Q1=Gp(),G1=Kp(),W1=em(),V1=_m(),$1=bm(),z1=wm(),K1=Sm(),L=class extends v1.EventEmitter{static{n(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 pu.TokenInfo(e)}catch(e){throw e instanceof ii.HttpStatusCodeError&&e.statusCode===401?new pu.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,ii.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 _x.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 h=await r.getAccessTokenForUser(d,e.scopes);if(!h)throw new Error(`Tried to make an API call with a user context for user ID ${d} but no token was found`);if((0,pu.accessTokenIsExpired)(h)&&r.refreshAccessTokenForUser){let p=await r.refreshAccessTokenForUser(d);return await this._callApiUsingInitialToken(e,p,!0)}return await this._callApiUsingInitialToken(e,h)}let o=this._getUserIdFromRequestContext(e.userId),l=o===null?await r.getAnyAccessToken():await r.getAnyAccessToken(o??e.userId);if((0,pu.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 H1.HelixBitsApi(this)}get channels(){return new C1.HelixChannelApi(this)}get channelPoints(){return new q1.HelixChannelPointsApi(this)}get charity(){return new E1.HelixCharityApi(this)}get chat(){return new P1.HelixChatApi(this)}get clips(){return new A1.HelixClipApi(this)}get contentClassificationLabels(){return new D1.HelixContentClassificationLabelApi(this)}get entitlements(){return new I1.HelixEntitlementApi(this)}get eventSub(){return new T1.HelixEventSubApi(this)}get extensions(){return new R1.HelixExtensionsApi(this)}get games(){return new U1.HelixGameApi(this)}get hypeTrain(){return new O1.HelixHypeTrainApi(this)}get goals(){return new B1.HelixGoalApi(this)}get moderation(){return new k1.HelixModerationApi(this)}get polls(){return new j1.HelixPollApi(this)}get predictions(){return new M1.HelixPredictionApi(this)}get raids(){return new L1.HelixRaidApi(this)}get schedule(){return new F1.HelixScheduleApi(this)}get search(){return new N1.HelixSearchApi(this)}get streams(){return new Q1.HelixStreamApi(this)}get subscriptions(){return new G1.HelixSubscriptionApi(this)}get teams(){return new W1.HelixTeamApi(this)}get users(){return new V1.HelixUserApi(this)}get videos(){return new $1.HelixVideoApi(this)}get whispers(){return new z1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof x1.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 a;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 K1.ApiReportedRequest(e,l.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,ii.handleTwitchApiResponseError)(l,e),await(0,ii.transformTwitchApiResponse)(l)}async _callApiInternal(e,t,r,a){var s,o,l;let{fetchOptions:d,mockServerPort:h}=this._config,p=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${p} 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 x=S1.operation({retries:3,minTimeout:500,factor:2}),{promise:P,resolve:q,reject:w}=(0,w1.promiseWithResolvers)();x.attempt(async()=>{try{let v=p==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:d,mockServerPort:h}):await(0,ii.callTwitchApiRaw)(e,t,r,a,d,h);!v.ok&&v.status>=500&&v.status<600&&await(0,ii.handleTwitchApiResponseError)(v,e),q(v)}catch(v){if(x.retry(v))return;w(x.mainError())}});let E=await P;return this._logger.debug(`Called ${p} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${E.status}`),E}};ka.BaseApiClient=L;G.__decorate([(0,W.CachedGetter)()],L.prototype,"bits",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"channels",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"channelPoints",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"charity",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"chat",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"clips",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"contentClassificationLabels",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"entitlements",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"eventSub",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"extensions",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"games",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"hypeTrain",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"goals",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"moderation",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"polls",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"predictions",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"raids",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"schedule",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"search",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"streams",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"subscriptions",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"teams",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"users",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"videos",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"whispers",null);ka.BaseApiClient=L=G.__decorate([W.Cacheable,(0,_x.rtfm)("api","ApiClient")],L)});var yx=u(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.NoContextApiClient=void 0;var J1=(g(),b(f)),Z1=m(),X1=mu(),Hm=class extends X1.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};ja.NoContextApiClient=Hm;ja.NoContextApiClient=Hm=J1.__decorate([(0,Z1.rtfm)("api","ApiClient")],Hm)});var fx=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.UserContextApiClient=void 0;var Y1=(g(),b(f)),eI=m(),tI=mu(),Cm=class extends tI.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Ma.UserContextApiClient=Cm;Ma.UserContextApiClient=Cm=Y1.__decorate([(0,eI.rtfm)("api","ApiClient")],Cm)});var wx=u(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.ApiClient=void 0;var rI=(g(),b(f)),iI=li(),nI=ci(),gx=Ls(),aI=J(),xx=m(),sI=Nc(),oI=cf(),lI=mu(),uI=yx(),bx=fx(),qm=class extends lI.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new sI.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,nI.createLogger)({name:"twurple:api:client",...e.logger}),iI.isNode?new gx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new oI.HelixRateLimiter({logger:t}),"createChild")}):new gx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,aI.callTwitchApiRaw)(r,a,s,o,l,d),"doRequest"),getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey")}))}async asUser(e,t){let r=new bx.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,xx.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 a=await this._authProvider.getAccessTokenForIntent(r);if(a){let s=new bx.UserContextApiClient(this._config,this._logger,this._rateLimiter,a.userId);return await t(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){let t=new uI.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};La.ApiClient=qm;La.ApiClient=qm=rI.__decorate([(0,xx.rtfm)("api","ApiClient")],qm)});var Sx=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixFollow=void 0;var vx=(g(),b(f)),cI=H(),ke=m(),_u=class extends ke.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[ke.rawDataSymbol].from_id}get userName(){return this[ke.rawDataSymbol].from_login}get userDisplayName(){return this[ke.rawDataSymbol].from_name}async getUser(){return(0,ke.checkRelationAssertion)(await this._client.users.getUserById(this[ke.rawDataSymbol].from_id))}get followedUserId(){return this[ke.rawDataSymbol].to_id}get followedUserName(){return this[ke.rawDataSymbol].to_login}get followedUserDisplayName(){return this[ke.rawDataSymbol].to_name}async getFollowedUser(){return(0,ke.checkRelationAssertion)(await this._client.users.getUserById(this[ke.rawDataSymbol].to_id))}get followDate(){return new Date(this[ke.rawDataSymbol].followed_at)}};Fa.HelixFollow=_u;vx.__decorate([(0,cI.Enumerable)(!1)],_u.prototype,"_client",void 0);Fa.HelixFollow=_u=vx.__decorate([(0,ke.rtfm)("api","HelixFollow")],_u)});var Hx=u(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});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.HelixUserEmote=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.HelixAdSchedule=c.HelixChannelApi=c.HelixCheermoteList=c.HelixBitsLeaderboardEntry=c.HelixBitsLeaderboard=c.HelixBitsApi=c.ApiClient=void 0;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.HelixWarning=c.HelixUnbanRequest=c.HelixShieldModeStatus=c.HelixBlockedTerm=c.HelixBanUser=c.HelixModeratedChannel=c.HelixModerator=c.HelixBan=c.HelixModerationApi=c.HelixHypeTrainEvent=void 0;c.HellFreezesOverError=c.HelixExtension=c.extractUserName=c.extractUserId=c.HelixPaginatedRequestWithTotal=c.HelixPaginatedRequest=c.ApiReportedRequest=c.StreamNotLiveError=void 0;var dI=wx();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:n(function(){return dI.ApiClient},"get")});var hI=bd();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:n(function(){return hI.HelixBitsApi},"get")});var pI=md();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return pI.HelixBitsLeaderboard},"get")});var mI=hd();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return mI.HelixBitsLeaderboardEntry},"get")});var _I=yd();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:n(function(){return _I.HelixCheermoteList},"get")});var yI=Rd();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:n(function(){return yI.HelixChannelApi},"get")});var fI=Pd();Object.defineProperty(c,"HelixAdSchedule",{enumerable:!0,get:n(function(){return fI.HelixAdSchedule},"get")});var gI=Sd();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:n(function(){return gI.HelixChannel},"get")});var bI=Hd();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:n(function(){return bI.HelixChannelEditor},"get")});var xI=Cd();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:n(function(){return xI.HelixChannelFollower},"get")});var wI=qd();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return wI.HelixFollowedChannel},"get")});var vI=Th();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:n(function(){return vI.HelixChannelReference},"get")});var SI=kd();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return SI.HelixChannelPointsApi},"get")});var HI=Ud();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:n(function(){return HI.HelixCustomReward},"get")});var CI=Bd();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return CI.HelixCustomRewardRedemption},"get")});var qI=Qd();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:n(function(){return qI.HelixCharityApi},"get")});var EI=Md();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return EI.HelixCharityCampaign},"get")});var PI=Ld();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return PI.HelixCharityCampaignDonation},"get")});var AI=Qo();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return AI.HelixCharityCampaignAmount},"get")});var DI=uh();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:n(function(){return DI.HelixChatApi},"get")});var II=Zd();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return II.HelixChatBadgeSet},"get")});var TI=Jd();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return TI.HelixChatBadgeVersion},"get")});var RI=Zo();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:n(function(){return RI.HelixChatSettings},"get")});var UI=Xd();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:n(function(){return UI.HelixChatChatter},"get")});var BI=Zi();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:n(function(){return BI.HelixEmote},"get")});var OI=zd();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:n(function(){return OI.HelixChannelEmote},"get")});var kI=eh();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return kI.HelixEmoteFromSet},"get")});var jI=th();Object.defineProperty(c,"HelixUserEmote",{enumerable:!0,get:n(function(){return jI.HelixUserEmote},"get")});var MI=nh();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return MI.HelixPrivilegedChatSettings},"get")});var LI=sh();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return LI.HelixSentChatMessage},"get")});var FI=ph();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:n(function(){return FI.HelixClipApi},"get")});var NI=ch();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:n(function(){return NI.HelixClip},"get")});var QI=fh();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return QI.HelixContentClassificationLabelApi},"get")});var GI=_h();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return GI.HelixContentClassificationLabel},"get")});var WI=vh();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return WI.HelixEntitlementApi},"get")});var VI=gh();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return VI.HelixDropsEntitlement},"get")});var $I=Ih();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:n(function(){return $I.HelixEventSubApi},"get")});var zI=Ch();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return zI.HelixEventSubConduit},"get")});var KI=Eh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return KI.HelixEventSubConduitShard},"get")});var JI=ll();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return JI.HelixEventSubSubscription},"get")});var ZI=Hh();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return ZI.HelixPaginatedEventSubSubscriptionsRequest},"get")});var XI=jh();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return XI.HelixExtensionsApi},"get")});var YI=Uh();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return YI.HelixExtensionBitsProduct},"get")});var eT=Bh();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return eT.HelixExtensionTransaction},"get")});var tT=Fh();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:n(function(){return tT.HelixGameApi},"get")});var rT=_l();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:n(function(){return rT.HelixGame},"get")});var iT=Gh();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:n(function(){return iT.HelixGoalApi},"get")});var nT=Nh();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:n(function(){return nT.HelixGoal},"get")});var aT=zh();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return aT.HelixHypeTrainApi},"get")});var sT=Wh();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return sT.HelixHypeTrainContribution},"get")});var oT=Vh();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return oT.HelixHypeTrainEvent},"get")});var lT=dp();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:n(function(){return lT.HelixModerationApi},"get")});var uT=ep();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:n(function(){return uT.HelixBan},"get")});var cT=np();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:n(function(){return cT.HelixModerator},"get")});var dT=ip();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return dT.HelixModeratedChannel},"get")});var hT=vl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:n(function(){return hT.HelixBanUser},"get")});var pT=rp();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return pT.HelixBlockedTerm},"get")});var mT=ap();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return mT.HelixShieldModeStatus},"get")});var _T=sp();Object.defineProperty(c,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return _T.HelixUnbanRequest},"get")});var yT=op();Object.defineProperty(c,"HelixWarning",{enumerable:!0,get:n(function(){return yT.HelixWarning},"get")});var fT=yp();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:n(function(){return fT.HelixPollApi},"get")});var gT=mp();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:n(function(){return gT.HelixPoll},"get")});var bT=pp();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:n(function(){return bT.HelixPollChoice},"get")});var xT=wp();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:n(function(){return xT.HelixPredictionApi},"get")});var wT=bp();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:n(function(){return wT.HelixPrediction},"get")});var vT=gp();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return vT.HelixPredictionOutcome},"get")});var ST=fp();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:n(function(){return ST.HelixPredictor},"get")});var HT=qp();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:n(function(){return HT.HelixRaidApi},"get")});var CT=Sp();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:n(function(){return CT.HelixRaid},"get")});var qT=Eo();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:n(function(){return qT.HelixUserRelation},"get")});var ET=Rp();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:n(function(){return ET.HelixScheduleApi},"get")});var PT=Dp();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:n(function(){return PT.HelixSchedule},"get")});var AT=sa();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return AT.HelixScheduleSegment},"get")});var DT=Ap();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return DT.HelixPaginatedScheduleSegmentRequest},"get")});var IT=Op();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:n(function(){return IT.HelixSearchApi},"get")});var TT=Up();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return TT.HelixChannelSearchResult},"get")});var RT=Gp();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:n(function(){return RT.HelixStreamApi},"get")});var UT=Mp();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:n(function(){return UT.HelixStream},"get")});var BT=Gl();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:n(function(){return BT.HelixStreamMarker},"get")});var OT=Np();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return OT.HelixStreamMarkerWithVideo},"get")});var kT=$p();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return kT.HelixPaginatedSubscriptionsRequest},"get")});var jT=Kp();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return jT.HelixSubscriptionApi},"get")});var MT=Zl();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:n(function(){return MT.HelixSubscription},"get")});var LT=Jl();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:n(function(){return LT.HelixUserSubscription},"get")});var FT=em();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:n(function(){return FT.HelixTeamApi},"get")});var NT=eu();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:n(function(){return NT.HelixTeam},"get")});var QT=Zp();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return QT.HelixTeamWithUsers},"get")});var GT=_m();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:n(function(){return GT.HelixUserApi},"get")});var WT=hm();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:n(function(){return WT.HelixUserBlock},"get")});var VT=Sx();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:n(function(){return VT.HelixFollow},"get")});var $T=dm();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return $T.HelixPrivilegedUser},"get")});var zT=au();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:n(function(){return zT.HelixUser},"get")});var KT=iu();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:n(function(){return KT.HelixBaseExtension},"get")});var JT=im();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return JT.HelixInstalledExtension},"get")});var ZT=sm();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return ZT.HelixInstalledExtensionList},"get")});var XT=um();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:n(function(){return XT.HelixUserExtension},"get")});var YT=bm();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:n(function(){return YT.HelixVideoApi},"get")});var eR=fm();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:n(function(){return eR.HelixVideo},"get")});var tR=wm();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:n(function(){return tR.HelixWhisperApi},"get")});var rR=Nc();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:n(function(){return rR.ConfigError},"get")});var iR=jp();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:n(function(){return iR.StreamNotLiveError},"get")});var nR=Sm();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:n(function(){return nR.ApiReportedRequest},"get")});var aR=ne();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return aR.HelixPaginatedRequest},"get")});var sR=kr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return sR.HelixPaginatedRequestWithTotal},"get")});var yu=m();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:n(function(){return yu.extractUserId},"get")});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:n(function(){return yu.extractUserName},"get")});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:n(function(){return yu.HelixExtension},"get")});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:n(function(){return yu.HellFreezesOverError},"get")})});var Ix=u(($Q,Dx)=>{var Cx=wu(),oR=Hu(),qx=Ga(),$t=Ht(),Ex=qu(),Px=Pu(),Ax=Du(),fu=S_(),{ApiClient:lR}=Hx(),{AppTokenAuthProvider:uR}=dd(),Em=class{static{n(this,"EmoteFetcher")}constructor(e,t,r){if(r&&r.apiClient)this.apiClient=r.apiClient;else if(e!==void 0&&t!==void 0){let a=new uR(e,t);this.apiClient=new lR({authProvider:a})}this.emotes=new qx,this.channels=new qx,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new oR(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 a=this._setupChannel(e),s=r||new Ax(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?$t.BTTV.Channel(e):$t.BTTV.Global;return fu.get(t).then(r=>r.data instanceof Array?r.data:[...r.data.channelEmotes,...r.data.sharedEmotes])}_cacheBTTVEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new Cx(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=$t.FFZ.Set(e);return fu.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=$t.FFZ.Channel(e);return fu.get(t).then(r=>{let a=[];for(let s of Object.keys(r.data.sets)){let o=r.data.sets[s];a.push(...o.emoticons)}return a})}_cacheFFZEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new Ex(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?$t.SevenTV.Channel(e):$t.SevenTV.Global;return fu.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new Px(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($t.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($t.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 a of r.emotes)this._cacheSevenTVEmote(e,a.data,t);else for(let a of r.emote_set.emotes)this._cacheSevenTVEmote(e,a.data,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:Cx,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:Ex,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:Px,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:Ax,cache:n((a,s,o)=>this._cacheTwitchEmote(s,null,o),"cache")}};for(let a of e){let{type:s}=a;if(!Object.keys(r).includes(s))throw new TypeError(`Unknown type: ${s}`);let o=r[s].class;this._setupChannel(a.channel_id,s==="7tv"?a.imageType:null);let l=o.fromObject(a,this.channels.get(a.channel_id));r[s].cache(a,a.channel_id,l),t.push(l)}return t}};Dx.exports=Em});var Rx=u((KQ,Tx)=>{var cR=Ht(),Pm=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,s)=>{let o=this.fetcher.emotes.get(s);if(!o)return a;if(o.modifier)return"";let l=this.options.template||cR.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")})}};Tx.exports=Pm});var dR=u((ZQ,Ux)=>{Ux.exports={BTTVEmote:wu(),Channel:Hu(),Collection:Ga(),Constants:Ht(),Emote:yr(),EmoteFetcher:Ix(),EmoteParser:Rx(),FFZEmote:qu(),SevenTVEmote:Pu(),TwitchEmote:Du()}});export default dR();
20
20
  //# sourceMappingURL=TwitchEmoticons.min.js.map