@mkody/twitch-emoticons 2.9.3 → 2.9.5

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,25 +1,25 @@
1
- var Ja=Object.defineProperty;var lw=Object.getOwnPropertyDescriptor;var uw=Object.getOwnPropertyNames;var cw=Object.prototype.hasOwnProperty;var n=(i,e)=>Ja(i,"name",{value:e,configurable:!0});var dw=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),hw=(i,e)=>{for(var t in e)Ja(i,t,{get:e[t],enumerable:!0})},pw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of uw(e))!cw.call(i,a)&&a!==t&&Ja(i,a,{get:()=>e[a],enumerable:!(r=lw(e,a))||r.enumerable});return i};var b=i=>pw(Ja({},"__esModule",{value:!0}),i);var fr=u((zR,Wm)=>{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}}};Wm.exports=Bu});var qt=u((JR,Vm)=>{Vm.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 ju=u((XR,$m)=>{var mw=fr(),_w=qt(),Ou=class i extends mw{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 _w.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}})}};$m.exports=Ou});var Za=u((eU,zm)=>{var ku=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}};zm.exports=ku});var Lu=u((rU,Km)=>{var yw=Za(),Mu=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new yw}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};Km.exports=Mu});var Nu=u((nU,Zm)=>{var fw=fr(),Jm=qt(),Fu=class i extends fw{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?Jm.FFZ.CDNAnimated(this.id,e):Jm.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})}};Zm.exports=Fu});var Gu=u((sU,Xm)=>{var gw=fr(),bw=qt(),Qu=class i extends gw{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.data?e.data.owner.display_name:null,this.sizes=e.data.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.data.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],bw.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,data:{animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}}})}};Xm.exports=Qu});var Vu=u((lU,Ym)=>{var xw=fr(),ww=qt(),Wu=class i extends xw{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 ww.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}:{}})}};Ym.exports=Wu});var k_=u((cU,j_)=>{"use strict";function p_(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(p_,"bind");var{toString:vw}=Object.prototype,{getPrototypeOf:nc}=Object,{iterator:ns,toStringTag:m_}=Symbol,as=(i=>e=>{let t=vw.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ke=n(i=>(i=i.toLowerCase(),e=>as(e)===i),"kindOfTest"),ss=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:xr}=Array,li=ss("undefined");function ui(i){return i!==null&&!li(i)&&i.constructor!==null&&!li(i.constructor)&&Ce(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(ui,"isBuffer");var __=Ke("ArrayBuffer");function Sw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&__(i.buffer),e}n(Sw,"isArrayBufferView");var Hw=ss("string"),Ce=ss("function"),y_=ss("number"),ci=n(i=>i!==null&&typeof i=="object","isObject"),Cw=n(i=>i===!0||i===!1,"isBoolean"),Xa=n(i=>{if(as(i)!=="object")return!1;let e=nc(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(m_ in i)&&!(ns in i)},"isPlainObject"),qw=n(i=>{if(!ci(i)||ui(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},"isEmptyObject"),Ew=Ke("Date"),Pw=Ke("File"),Aw=Ke("Blob"),Dw=Ke("FileList"),Iw=n(i=>ci(i)&&Ce(i.pipe),"isStream"),Tw=n(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Ce(i.append)&&((e=as(i))==="formdata"||e==="object"&&Ce(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Rw=Ke("URLSearchParams"),[Uw,Bw,Ow,jw]=["ReadableStream","Request","Response","Headers"].map(Ke),kw=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function di(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,a;if(typeof i!="object"&&(i=[i]),xr(i))for(r=0,a=i.length;r<a;r++)e.call(null,i[r],r,i);else{if(ui(i))return;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(di,"forEach");function f_(i,e){if(ui(i))return null;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(f_,"findKey");var Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,g_=n(i=>!li(i)&&i!==Kt,"isContextDefined");function Ju(){let{caseless:i}=g_(this)&&this||{},e={},t=n((r,a)=>{let s=i&&f_(e,a)||a;Xa(e[s])&&Xa(r)?e[s]=Ju(e[s],r):Xa(r)?e[s]=Ju({},r):xr(r)?e[s]=r.slice():e[s]=r},"assignValue");for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&di(arguments[r],t);return e}n(Ju,"merge");var Mw=n((i,e,t,{allOwnKeys:r}={})=>(di(e,(a,s)=>{t&&Ce(a)?i[s]=p_(a,t):i[s]=a},{allOwnKeys:r}),i),"extend"),Lw=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),Fw=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"),Nw=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&&nc(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),Qw=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"),Gw=n(i=>{if(!i)return null;if(xr(i))return i;let e=i.length;if(!y_(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),Ww=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&nc(Uint8Array)),Vw=n((i,e)=>{let r=(i&&i[ns]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),$w=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),zw=Ke("HTMLFormElement"),Kw=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),e_=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Jw=Ke("RegExp"),b_=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};di(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),Zw=n(i=>{b_(i,(e,t)=>{if(Ce(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(Ce(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"),Xw=n((i,e)=>{let t={},r=n(a=>{a.forEach(s=>{t[s]=!0})},"define");return xr(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),Yw=n(()=>{},"noop"),ev=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber");function tv(i){return!!(i&&Ce(i.append)&&i[m_]==="FormData"&&i[ns])}n(tv,"isSpecCompliantForm");var rv=n(i=>{let e=new Array(10),t=n((r,a)=>{if(ci(r)){if(e.indexOf(r)>=0)return;if(ui(r))return r;if(!("toJSON"in r)){e[a]=r;let s=xr(r)?[]:{};return di(r,(o,l)=>{let d=t(o,a+1);!li(d)&&(s[l]=d)}),e[a]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),iv=Ke("AsyncFunction"),nv=n(i=>i&&(ci(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),"isThenable"),x_=((i,e)=>i?setImmediate:e?((t,r)=>(Kt.addEventListener("message",({source:a,data:s})=>{a===Kt&&s===t&&r.length&&r.shift()()},!1),a=>{r.push(a),Kt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ce(Kt.postMessage)),av=typeof queueMicrotask<"u"?queueMicrotask.bind(Kt):typeof process<"u"&&process.nextTick||x_,sv=n(i=>i!=null&&Ce(i[ns]),"isIterable"),_={isArray:xr,isArrayBuffer:__,isBuffer:ui,isFormData:Tw,isArrayBufferView:Sw,isString:Hw,isNumber:y_,isBoolean:Cw,isObject:ci,isPlainObject:Xa,isEmptyObject:qw,isReadableStream:Uw,isRequest:Bw,isResponse:Ow,isHeaders:jw,isUndefined:li,isDate:Ew,isFile:Pw,isBlob:Aw,isRegExp:Jw,isFunction:Ce,isStream:Iw,isURLSearchParams:Rw,isTypedArray:Ww,isFileList:Dw,forEach:di,merge:Ju,extend:Mw,trim:kw,stripBOM:Lw,inherits:Fw,toFlatObject:Nw,kindOf:as,kindOfTest:Ke,endsWith:Qw,toArray:Gw,forEachEntry:Vw,matchAll:$w,isHTMLForm:zw,hasOwnProperty:e_,hasOwnProp:e_,reduceDescriptors:b_,freezeMethods:Zw,toObjectSet:Xw,toCamelCase:Kw,noop:Yw,toFiniteNumber:ev,findKey:f_,global:Kt,isContextDefined:g_,isSpecCompliantForm:tv,toJSONObject:rv,isAsyncFn:iv,isThenable:nv,setImmediate:x_,asap:av,isIterable:sv};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 w_=I.prototype,v_={};["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=>{v_[i]={value:i}});Object.defineProperties(I,v_);Object.defineProperty(w_,"isAxiosError",{value:!0});I.from=(i,e,t,r,a,s)=>{let o=Object.create(w_);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 ov=null;function Zu(i){return _.isPlainObject(i)||_.isArray(i)}n(Zu,"isVisitable");function S_(i){return _.endsWith(i,"[]")?i.slice(0,-2):i}n(S_,"removeBrackets");function t_(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=S_(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(t_,"renderKey");function lv(i){return _.isArray(i)&&!i.some(Zu)}n(lv,"isFlatArray");var uv=_.toFlatObject(_,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function os(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(P,v){return!_.isUndefined(v[P])},"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(_.isBoolean(w))return w.toString();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,P,v){let B=w;if(w&&!v&&typeof w=="object"){if(_.endsWith(P,"{}"))P=r?P:P.slice(0,-2),w=JSON.stringify(w);else if(_.isArray(w)&&lv(w)||(_.isFileList(w)||_.endsWith(P,"[]"))&&(B=_.toArray(w)))return P=S_(P),B.forEach(n(function($,z){!(_.isUndefined($)||$===null)&&e.append(o===!0?t_([P],z,s):o===null?P:P+"[]",h($))},"each")),!1}return Zu(w)?!0:(e.append(t_(v,P,s),h(w)),!1)}n(p,"defaultVisitor");let x=[],q=Object.assign(uv,{defaultVisitor:p,convertValue:h,isVisitable:Zu});function E(w,P){if(!_.isUndefined(w)){if(x.indexOf(w)!==-1)throw Error("Circular reference detected in "+P.join("."));x.push(w),_.forEach(w,n(function(B,V){(!(_.isUndefined(B)||B===null)&&a.call(e,B,_.isString(V)?V.trim():V,P,q))===!0&&E(B,P?P.concat(V):[V])},"each")),x.pop()}}if(n(E,"build"),!_.isObject(i))throw new TypeError("data must be an object");return E(i),e}n(os,"toFormData");function r_(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(r_,"encode$1");function ac(i,e){this._pairs=[],i&&os(i,this,e)}n(ac,"AxiosURLSearchParams");var H_=ac.prototype;H_.append=n(function(e,t){this._pairs.push([e,t])},"append");H_.toString=n(function(e){let t=e?function(r){return e.call(this,r,r_)}:r_;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function cv(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}n(cv,"encode");function C_(i,e,t){if(!e)return i;let r=t&&t.encode||cv;_.isFunction(t)&&(t={serialize:t});let a=t&&t.serialize,s;if(a?s=a(e,t):s=_.isURLSearchParams(e)?e.toString():new ac(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 Xu=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"))}},i_=Xu,q_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dv=typeof URLSearchParams<"u"?URLSearchParams:ac,hv=typeof FormData<"u"?FormData:null,pv=typeof Blob<"u"?Blob:null,mv={isBrowser:!0,classes:{URLSearchParams:dv,FormData:hv,Blob:pv},protocols:["http","https","file","blob","url","data"]},sc=typeof window<"u"&&typeof document<"u",Yu=typeof navigator=="object"&&navigator||void 0,_v=sc&&(!Yu||["ReactNative","NativeScript","NS"].indexOf(Yu.product)<0),yv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",fv=sc&&window.location.href||"http://localhost",gv=Object.freeze({__proto__:null,hasBrowserEnv:sc,hasStandardBrowserWebWorkerEnv:yv,hasStandardBrowserEnv:_v,navigator:Yu,origin:fv}),ve={...gv,...mv};function bv(i,e){return os(i,new ve.classes.URLSearchParams,{visitor:n(function(t,r,a,s){return ve.isNode&&_.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}n(bv,"toURLEncodedForm");function xv(i){return _.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(xv,"parsePropPath");function wv(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(wv,"arrayToObject");function E_(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]=wv(a[o])),!l)}if(n(e,"buildPath"),_.isFormData(i)&&_.isFunction(i.entries)){let t={};return _.forEachEntry(i,(r,a)=>{e(xv(r),a,t,0)}),t}return null}n(E_,"formDataToJSON");function vv(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(vv,"stringifySafely");var oc={transitional:q_,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(E_(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 bv(e,this.formSerializer).toString();if((l=_.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return os(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),vv(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||oc.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:ve.classes.FormData,Blob:ve.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],i=>{oc.headers[i]={}});var lc=oc,Sv=_.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"]),Hv=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]&&Sv[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),n_=Symbol("internals");function oi(i){return i&&String(i).trim().toLowerCase()}n(oi,"normalizeHeader");function Ya(i){return i===!1||i==null?i:_.isArray(i)?i.map(Ya):String(i)}n(Ya,"normalizeValue");function Cv(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(Cv,"parseTokens");var qv=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function $u(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($u,"matchHeaderValue");function Ev(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(Ev,"formatHeader");function Pv(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(Pv,"buildAccessors");var gr=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=oi(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]=Ya(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())&&!qv(e))o(Hv(e),t);else if(_.isObject(e)&&_.isIterable(e)){let l={},d,h;for(let p of e){if(!_.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[h=p[0]]=(d=l[h])?_.isArray(d)?[...d,p[1]]:[d,p[1]]:p[1]}o(l,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=oi(e),e){let r=_.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return Cv(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=oi(e),e){let r=_.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||$u(this,this[r],r,t)))}return!1}delete(e,t){let r=this,a=!1;function s(o){if(o=oi(o),o){let l=_.findKey(r,o);l&&(!t||$u(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||$u(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]=Ya(a),delete t[s];return}let l=e?Ev(s):String(s).trim();l!==s&&delete t[s],t[l]=Ya(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
- `)}getSetCookie(){return this.get("set-cookie")||[]}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[n_]=this[n_]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=oi(o);r[l]||(Pv(a,o),r[l]=!0)}return n(s,"defineAccessor"),_.isArray(e)?e.forEach(s):s(e),this}};gr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(gr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});_.freezeMethods(gr);var ze=gr;function zu(i,e){let t=this||lc,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(zu,"transformData");function P_(i){return!!(i&&i.__CANCEL__)}n(P_,"isCancel");function wr(i,e,t){I.call(this,i??"canceled",I.ERR_CANCELED,e,t),this.name="CanceledError"}n(wr,"CanceledError");_.inherits(wr,I,{__CANCEL__:!0});function A_(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(A_,"settle");function Av(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(Av,"parseProtocol");function Dv(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,q=0;for(;x!==a;)q+=t[x++],x=x%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),h-o<e)return;let E=p&&h-p;return E?Math.round(q*1e3/E):void 0},"push")}n(Dv,"speedometer");function Iv(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(...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(Iv,"throttle");var rs=n((i,e,t=3)=>{let r=0,a=Dv(50,250);return Iv(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"),a_=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),s_=n(i=>(...e)=>_.asap(()=>i(...e)),"asyncDecorator"),Tv=ve.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,ve.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(ve.origin),ve.navigator&&/(msie|trident)/i.test(ve.navigator.userAgent)):()=>!0,Rv=ve.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 Uv(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(Uv,"isAbsoluteURL");function Bv(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n(Bv,"combineURLs");function D_(i,e,t){let r=!Uv(e);return i&&(r||t==!1)?Bv(i,e):e}n(D_,"buildFullPath");var o_=n(i=>i instanceof ze?{...i}:i,"headersToObject");function Jt(i,e){e=e||{};let t={};function r(h,p,x,q){return _.isPlainObject(h)&&_.isPlainObject(p)?_.merge.call({caseless:q},h,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,x,q){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h,x,q)}else return r(h,p,x,q)}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,x)=>a(o_(h),o_(p),x,!0),"headers")};return _.forEach(Object.keys({...i,...e}),n(function(p){let x=d[p]||a,q=x(i[p],e[p],p);_.isUndefined(q)&&x!==l||(t[p]=q)},"computeConfigValue")),t}n(Jt,"mergeConfig");var I_=n(i=>{let e=Jt({},i),{data:t,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:l}=e;e.headers=o=ze.from(o),e.url=C_(D_(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(_.isFormData(t)){if(ve.hasStandardBrowserEnv||ve.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(ve.hasStandardBrowserEnv&&(r&&_.isFunction(r)&&(r=r(e)),r||r!==!1&&Tv(e.url))){let h=a&&s&&Rv.read(s);h&&o.set(a,h)}return e},"resolveConfig"),Ov=typeof XMLHttpRequest<"u",jv=Ov&&function(i){return new Promise(n(function(t,r){let a=I_(i),s=a.data,o=ze.from(a.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:h}=a,p,x,q,E,w;function P(){E&&E(),w&&w(),a.cancelToken&&a.cancelToken.unsubscribe(p),a.signal&&a.signal.removeEventListener("abort",p)}n(P,"done");let v=new XMLHttpRequest;v.open(a.method.toUpperCase(),a.url,!0),v.timeout=a.timeout;function B(){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};A_(n(function(he){t(he),P()},"_resolve"),n(function(he){r(he),P()},"_reject"),xe),v=null}n(B,"onloadend"),"onloadend"in v?v.onloadend=B:v.onreadystatechange=n(function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(B)},"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||q_;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&&([q,w]=rs(h,!0),v.addEventListener("progress",q)),d&&v.upload&&([x,E]=rs(d),v.upload.addEventListener("progress",x),v.upload.addEventListener("loadend",E)),(a.cancelToken||a.signal)&&(p=n($=>{v&&(r(!$||$.type?new wr(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=Av(a.url);if(V&&ve.protocols.indexOf(V)===-1){r(new I("Unsupported protocol "+V+":",I.ERR_BAD_REQUEST,i));return}v.send(s||null)},"dispatchXhrRequest"))},kv=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 wr(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"),Mv=kv,Lv=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"),Fv=n(async function*(i,e){for await(let t of Nv(i))yield*Lv(t,e)},"readBytes"),Nv=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"),l_=n((i,e,t,r)=>{let a=Fv(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 q=s+=x;t(q)}d.enqueue(new Uint8Array(p))}catch(h){throw l(h),h}},cancel(d){return l(d),a.return()}},{highWaterMark:2})},"trackStream"),ls=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",T_=ls&&typeof ReadableStream=="function",Qv=ls&&(typeof TextEncoder=="function"?(i=>e=>i.encode(e))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),R_=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),Gv=T_&&R_(()=>{let i=!1,e=new Request(ve.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!e}),u_=64*1024,ec=T_&&R_(()=>_.isReadableStream(new Response("").body)),is={stream:ec&&(i=>i.body)};ls&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!is[e]&&(is[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 Wv=n(async i=>{if(i==null)return 0;if(_.isBlob(i))return i.size;if(_.isSpecCompliantForm(i))return(await new Request(ve.origin,{method:"POST",body:i}).arrayBuffer()).byteLength;if(_.isArrayBufferView(i)||_.isArrayBuffer(i))return i.byteLength;if(_.isURLSearchParams(i)&&(i=i+""),_.isString(i))return(await Qv(i)).byteLength},"getBodyLength"),Vv=n(async(i,e)=>{let t=_.toFiniteNumber(i.getContentLength());return t??Wv(e)},"resolveBodyLength"),$v=ls&&(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:q}=I_(i);h=h?(h+"").toLowerCase():"text";let E=Mv([a,s&&s.toAbortSignal()],o),w,P=E&&E.unsubscribe&&(()=>{E.unsubscribe()}),v;try{if(d&&Gv&&t!=="get"&&t!=="head"&&(v=await Vv(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[he,_r]=a_(v,rs(s_(d)));r=l_(xe.body,u_,he,_r)}}_.isString(x)||(x=x?"include":"omit");let B="credentials"in Request.prototype;w=new Request(e,{...q,signal:E,method:t.toUpperCase(),headers:p.normalize().toJSON(),body:r,duplex:"half",credentials:B?x:void 0});let V=await fetch(w,q),$=ec&&(h==="stream"||h==="response");if(ec&&(l||$&&P)){let xe={};["status","statusText","headers"].forEach(yr=>{xe[yr]=V[yr]});let it=_.toFiniteNumber(V.headers.get("content-length")),[he,_r]=l&&a_(it,rs(s_(l),!0))||[];V=new Response(l_(V.body,u_,he,()=>{_r&&_r(),P&&P()}),xe)}h=h||"text";let z=await is[_.findKey(is,h)||"text"](V,i);return!$&&P&&P(),await new Promise((xe,it)=>{A_(xe,it,{data:z,headers:ze.from(V.headers),status:V.status,statusText:V.statusText,config:i,request:w})})}catch(B){throw P&&P(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new I("Network Error",I.ERR_NETWORK,i,w),{cause:B.cause||B}):I.from(B,B&&B.code,i,w)}}),tc={http:ov,xhr:jv,fetch:$v};_.forEach(tc,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var c_=n(i=>`- ${i}`,"renderReason"),zv=n(i=>_.isFunction(i)||i===null||i===!1,"isResolvedHandle"),U_={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,!zv(t)&&(r=tc[(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(c_).join(`
5
- `):" "+c_(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:tc};function Ku(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new wr(null,i)}n(Ku,"throwIfCancellationRequested");function d_(i){return Ku(i),i.headers=ze.from(i.headers),i.data=zu.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),U_.getAdapter(i.adapter||lc.adapter)(i).then(n(function(r){return Ku(i),r.data=zu.call(i,i.transformResponse,r),r.headers=ze.from(r.headers),r},"onAdapterResolution"),n(function(r){return P_(r)||(Ku(i),r&&r.response&&(r.response.data=zu.call(i,i.transformResponse,r.response),r.response.headers=ze.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(d_,"dispatchRequest");var B_="1.11.0",us={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{us[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var h_={};us.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+B_+"] 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&&!h_[o]&&(h_[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");us.spelling=n(function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)},"spelling");function Kv(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(Kv,"assertOptions");var es={assertOptions:Kv,validators:us},nt=es.validators,br=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new i_,response:new i_}}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=Jt(this.defaults,t);let{transitional:r,paramsSerializer:a,headers:s}=t;r!==void 0&&es.assertOptions(r,{silentJSONParsing:nt.transitional(nt.boolean),forcedJSONParsing:nt.transitional(nt.boolean),clarifyTimeoutError:nt.transitional(nt.boolean)},!1),a!=null&&(_.isFunction(a)?t.paramsSerializer={serialize:a}:es.assertOptions(a,{encode:nt.function,serialize:nt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),es.assertOptions(t,{baseUrl:nt.spelling("baseURL"),withXsrfToken:nt.spelling("withXSRFToken")},!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(P){typeof P.runWhen=="function"&&P.runWhen(t)===!1||(d=d&&P.synchronous,l.unshift(P.fulfilled,P.rejected))},"unshiftRequestInterceptors"));let h=[];this.interceptors.response.forEach(n(function(P){h.push(P.fulfilled,P.rejected)},"pushResponseInterceptors"));let p,x=0,q;if(!d){let w=[d_.bind(this),void 0];for(w.unshift(...l),w.push(...h),q=w.length,p=Promise.resolve(t);x<q;)p=p.then(w[x++],w[x++]);return p}q=l.length;let E=t;for(x=0;x<q;){let w=l[x++],P=l[x++];try{E=w(E)}catch(v){P.call(this,v);break}}try{p=d_.call(this,E)}catch(w){return Promise.reject(w)}for(x=0,q=h.length;x<q;)p=p.then(h[x++],h[x++]);return p}getUri(e){e=Jt(this.defaults,e);let t=D_(e.baseURL,e.url,e.allowAbsoluteUrls);return C_(t,e.params,e.paramsSerializer)}};_.forEach(["delete","get","head","options"],n(function(e){br.prototype[e]=function(t,r){return this.request(Jt(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(Jt(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}n(t,"generateHTTPMethod"),br.prototype[e]=t(),br.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var ts=br,rc=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 wr(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}}},Jv=rc;function Zv(i){return n(function(t){return i.apply(null,t)},"wrap")}n(Zv,"spread");function Xv(i){return _.isObject(i)&&i.isAxiosError===!0}n(Xv,"isAxiosError");var ic={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(ic).forEach(([i,e])=>{ic[e]=i});var Yv=ic;function O_(i){let e=new ts(i),t=p_(ts.prototype.request,e);return _.extend(t,ts.prototype,e,{allOwnKeys:!0}),_.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return O_(Jt(i,a))},"create"),t}n(O_,"createInstance");var ie=O_(lc);ie.Axios=ts;ie.CanceledError=wr;ie.CancelToken=Jv;ie.isCancel=P_;ie.VERSION=B_;ie.toFormData=os;ie.AxiosError=I;ie.Cancel=ie.CanceledError;ie.all=n(function(e){return Promise.all(e)},"all");ie.spread=Zv;ie.isAxiosError=Xv;ie.mergeConfig=Jt;ie.AxiosHeaders=ze;ie.formToJSON=i=>E_(_.isHTMLForm(i)?new FormData(i):i);ie.getAdapter=U_.getAdapter;ie.HttpStatusCode=Yv;ie.default=ie;j_.exports=ie});var y={};hw(y,{__addDisposableResource:()=>uy,__assign:()=>cs,__asyncDelegator:()=>ty,__asyncGenerator:()=>ey,__asyncValues:()=>ry,__await:()=>vr,__awaiter:()=>z_,__classPrivateFieldGet:()=>sy,__classPrivateFieldIn:()=>ly,__classPrivateFieldSet:()=>oy,__createBinding:()=>hs,__decorate:()=>F_,__disposeResources:()=>cy,__esDecorate:()=>Q_,__exportStar:()=>J_,__extends:()=>M_,__generator:()=>K_,__importDefault:()=>ay,__importStar:()=>ny,__makeTemplateObject:()=>iy,__metadata:()=>$_,__param:()=>N_,__propKey:()=>W_,__read:()=>dc,__rest:()=>L_,__rewriteRelativeImportExtension:()=>dy,__runInitializers:()=>G_,__setFunctionName:()=>V_,__spread:()=>Z_,__spreadArray:()=>Y_,__spreadArrays:()=>X_,__values:()=>ds,default:()=>rS});function M_(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");uc(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function L_(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 F_(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 N_(i,e){return function(t,r){e(t,r,i)}}function Q_(i,e,t,r,a,s){function o(B){if(B!==void 0&&typeof B!="function")throw new TypeError("Function expected");return B}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,q=!1,E=t.length-1;E>=0;E--){var w={};for(var P in r)w[P]=P==="access"?{}:r[P];for(var P in r.access)w.access[P]=r.access[P];w.addInitializer=function(B){if(q)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(B||null))};var v=(0,t[E])(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),q=!0}function G_(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 W_(i){return typeof i=="symbol"?i:"".concat(i)}function V_(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 $_(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function z_(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 K_(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 J_(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hs(e,i,t)}function ds(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 dc(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 Z_(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(dc(arguments[e]));return i}function X_(){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 Y_(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 vr(i){return this instanceof vr?(this.v=i,this):new vr(i)}function ey(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(E){return function(w){return Promise.resolve(w).then(E,x)}}function l(E,w){r[E]&&(a[E]=function(P){return new Promise(function(v,B){s.push([E,P,v,B])>1||d(E,P)})},w&&(a[E]=w(a[E])))}function d(E,w){try{h(r[E](w))}catch(P){q(s[0][3],P)}}function h(E){E.value instanceof vr?Promise.resolve(E.value.v).then(p,x):q(s[0][2],E)}function p(E){d("next",E)}function x(E){d("throw",E)}function q(E,w){E(w),s.shift(),s.length&&d(s[0][0],s[0][1])}}function ty(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:vr(i[a](o)),done:!1}:s?s(o):o}:s}}function ry(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 ds=="function"?ds(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 iy(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function ny(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=cc(i),r=0;r<t.length;r++)t[r]!=="default"&&hs(e,i,t[r]);return eS(e,i),e}function ay(i){return i&&i.__esModule?i:{default:i}}function sy(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 oy(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 ly(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 uy(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 cy(i){function e(s){i.error=i.hasError?new tS(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()}function dy(i,e){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,a,s,o){return r?e?".jsx":".js":a&&(!s||!o)?t:a+s+"."+o.toLowerCase()+"js"}):i}var uc,cs,hs,eS,cc,tS,rS,f=dw(()=>{uc=n(function(i,e){return uc=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])},uc(i,e)},"extendStatics");n(M_,"__extends");cs=n(function(){return cs=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"),cs.apply(this,arguments)},"__assign");n(L_,"__rest");n(F_,"__decorate");n(N_,"__param");n(Q_,"__esDecorate");n(G_,"__runInitializers");n(W_,"__propKey");n(V_,"__setFunctionName");n($_,"__metadata");n(z_,"__awaiter");n(K_,"__generator");hs=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(J_,"__exportStar");n(ds,"__values");n(dc,"__read");n(Z_,"__spread");n(X_,"__spreadArrays");n(Y_,"__spreadArray");n(vr,"__await");n(ey,"__asyncGenerator");n(ty,"__asyncDelegator");n(ry,"__asyncValues");n(iy,"__makeTemplateObject");eS=Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e},cc=n(function(i){return cc=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},cc(i)},"ownKeys");n(ny,"__importStar");n(ay,"__importDefault");n(sy,"__classPrivateFieldGet");n(oy,"__classPrivateFieldSet");n(ly,"__classPrivateFieldIn");n(uy,"__addDisposableResource");tS=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(cy,"__disposeResources");n(dy,"__rewriteRelativeImportExtension");rS={__extends:M_,__assign:cs,__rest:L_,__decorate:F_,__param:N_,__esDecorate:Q_,__runInitializers:G_,__propKey:W_,__setFunctionName:V_,__metadata:$_,__awaiter:z_,__generator:K_,__createBinding:hs,__exportStar:J_,__values:ds,__read:dc,__spread:Z_,__spreadArrays:X_,__spreadArray:Y_,__await:vr,__asyncGenerator:ey,__asyncDelegator:ty,__asyncValues:ry,__makeTemplateObject:iy,__importStar:ny,__importDefault:ay,__classPrivateFieldGet:sy,__classPrivateFieldSet:oy,__classPrivateFieldIn:ly,__addDisposableResource:uy,__disposeResources:cy,__rewriteRelativeImportExtension:dy}});var hi=u((pU,hy)=>{hy.exports.isNode=!1});var Zt=u(Pt=>{"use strict";var Et;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.LogLevelToConsoleFunction=Pt.resolveLogLevel=Pt.LogLevel=void 0;var iS=hi(),qe;(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"})(qe||(qe={}));Pt.LogLevel=qe;function nS(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(qe,i))return i;var e=Object.keys(qe).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):qe.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(qe,t))throw new Error("Unknown log level string: ".concat(i));return qe[t]}n(nS,"resolveLogLevel");Pt.resolveLogLevel=nS;var aS=iS.isNode?console.log.bind(console):console.debug.bind(console);Pt.LogLevelToConsoleFunction=(Et={},Et[qe.CRITICAL]=console.error.bind(console),Et[qe.ERROR]=console.error.bind(console),Et[qe.WARNING]=console.warn.bind(console),Et[qe.INFO]=console.info.bind(console),Et[qe.DEBUG]=aS.bind(console),Et[qe.TRACE]=console.trace.bind(console),Et)});var py=u(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.Enumerable=void 0;function sS(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(sS,"Enumerable");ps.Enumerable=sS});var _y=u(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.flatten=void 0;var my=(f(),b(y));function oS(i){var e;return(e=[]).concat.apply(e,my.__spreadArray([],my.__read(i),!1))}n(oS,"flatten");ms.flatten=oS});var yy=u(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.immutableSplice=void 0;var Sr=(f(),b(y));function lS(i,e,t){for(var r=[],a=3;a<arguments.length;a++)r[a-3]=arguments[a];return Sr.__spreadArray(Sr.__spreadArray(Sr.__spreadArray([],Sr.__read(i.slice(0,e)),!1),Sr.__read(r),!1),Sr.__read(i.slice(e+t)),!1)}n(lS,"immutableSplice");_s.immutableSplice=lS});var fy=u(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.partitionedFlatMap=void 0;var hc=(f(),b(y));function uS(i,e,t){var r,a,s,o={};try{for(var l=hc.__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,hc.__spreadArray([],hc.__read(x),!1)):o[p]=x}}catch(q){r={error:q}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(uS,"partitionedFlatMap");ys.partitionedFlatMap=uS});var by=u(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.resolveConfigValueSync=Hr.resolveConfigValue=void 0;var gy=(f(),b(y));function cS(i){return gy.__awaiter(this,void 0,void 0,function(){return gy.__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(cS,"resolveConfigValue");Hr.resolveConfigValue=cS;function dS(i){return typeof i=="function"?i():i}n(dS,"resolveConfigValueSync");Hr.resolveConfigValueSync=dS});var xy=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.deprecateClass=void 0;var pc=(f(),b(y));function hS(i,e){var t=!1;return function(r){pc.__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,pc.__spreadArray([],pc.__read(s),!1))||this}return n(a,"class_1"),a}(i)}n(hS,"deprecateClass");fs.deprecateClass=hS});var vy=u(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.match=Xt.eq=void 0;var wy=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return wy(i)},"on")}},"matched"),mc=n(function(i){return{on:n(function(e,t){return e(i)?wy(t(i)):mc(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");Xt.match=mc;var pS=n(function(i){return function(e){return i===e}},"eq");Xt.eq=pS;mc.eq=Xt.eq});var Hy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.fibWithLimit=void 0;var Sy=(f(),b(y));function mS(i){var e,t,r;return Sy.__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=Sy.__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(mS,"fibWithLimit");gs.fibWithLimit=mS});var xs=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.arrayToObject=void 0;var Cy=(f(),b(y));function _S(i,e){return Object.assign.apply(Object,Cy.__spreadArray([{}],Cy.__read(i.map(e)),!1))}n(_S,"arrayToObject");bs.arrayToObject=_S});var qy=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.entriesToObject=void 0;var yS=(f(),b(y)),fS=xs();function gS(i){return(0,fS.arrayToObject)(i,function(e){var t,r=yS.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(gS,"entriesToObject");ws.entriesToObject=gS});var Ey=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.forEachObjectEntry=void 0;var bS=(f(),b(y));function xS(i,e){Object.entries(i).forEach(function(t){var r=bS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(xS,"forEachObjectEntry");vs.forEachObjectEntry=xS});var Py=u(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.groupBy=void 0;var wS=(f(),b(y));function vS(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=wS.__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(vS,"groupBy");Ss.groupBy=vS});var Ay=u(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.indexBy=void 0;var SS=xs();function HS(i,e){if(typeof e!="function"){var t=e;e=n(function(r){return r[t].toString()},"keyFn")}return(0,SS.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(HS,"indexBy");Hs.indexBy=HS});var Dy=u(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.mapObject=void 0;var _c=(f(),b(y));function CS(i,e){var t=Object.entries(i).map(function(r){var a,s=_c.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,_c.__spreadArray([{}],_c.__read(t),!1))}n(CS,"mapObject");Cs.mapObject=CS});var yc=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.pick=void 0;var qs=(f(),b(y));function qS(i,e){return Object.assign.apply(Object,qs.__spreadArray([{}],qs.__read(Object.entries(i).filter(function(t){var r=qs.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=qs.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(qS,"pick");Es.pick=qS});var Iy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.omit=void 0;var ES=yc();function PS(i,e){return(0,ES.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(PS,"omit");Ps.omit=PS});var Ty=u(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.mapOptional=At.mapNullable=At.isNullish=void 0;function fc(i){return i==null}n(fc,"isNullish");At.isNullish=fc;function AS(i,e){return fc(i)?null:e(i)}n(AS,"mapNullable");At.mapNullable=AS;function DS(i,e){return fc(i)?void 0:e(i)}n(DS,"mapOptional");At.mapOptional=DS});var Uy=u(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.delay=void 0;var Ry=(f(),b(y));function IS(i){return Ry.__awaiter(this,void 0,void 0,function(){return Ry.__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(IS,"delay");As.delay=IS});var By=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.promiseWithResolvers=void 0;function TS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(TS,"promiseWithResolvers");Ds.promiseWithResolvers=TS});var Oy=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.padLeft=void 0;function RS(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(RS,"padLeft");Is.padLeft=RS});var jy=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.splitWithLimit=void 0;var gc=(f(),b(y));function US(i,e,t){var r=i.split(e);return r.length<=t?r:gc.__spreadArray(gc.__spreadArray([],gc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(US,"splitWithLimit");Ts.splitWithLimit=US});var ky=u(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.utf8Substring=Cr.utf8Length=void 0;var Rs=(f(),b(y));function BS(i){return Rs.__spreadArray([],Rs.__read(i),!1).length}n(BS,"utf8Length");Cr.utf8Length=BS;function OS(i,e,t){return Rs.__spreadArray([],Rs.__read(i),!1).slice(e,t).join("")}n(OS,"utf8Substring");Cr.utf8Substring=OS});var C=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.immutableSplice=A.flatten=A.Enumerable=void 0;var jS=py();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return jS.Enumerable},"get")});var kS=_y();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return kS.flatten},"get")});var MS=yy();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return MS.immutableSplice},"get")});var LS=fy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return LS.partitionedFlatMap},"get")});var My=by();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return My.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return My.resolveConfigValueSync},"get")});var FS=xy();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return FS.deprecateClass},"get")});var Ly=vy();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return Ly.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return Ly.eq},"get")});var NS=Hy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return NS.fibWithLimit},"get")});var QS=xs();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return QS.arrayToObject},"get")});var GS=qy();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return GS.entriesToObject},"get")});var WS=Ey();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return WS.forEachObjectEntry},"get")});var VS=Py();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return VS.groupBy},"get")});var $S=Ay();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return $S.indexBy},"get")});var zS=Dy();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return zS.mapObject},"get")});var KS=Iy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return KS.omit},"get")});var JS=yc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return JS.pick},"get")});var bc=Ty();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return bc.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return bc.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return bc.mapOptional},"get")});var ZS=Uy();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return ZS.delay},"get")});var XS=By();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return XS.promiseWithResolvers},"get")});var YS=Oy();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return YS.padLeft},"get")});var e0=jy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return e0.splitWithLimit},"get")});var Fy=ky();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return Fy.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return Fy.utf8Substring},"get")})});var Sc=u(Bs=>{"use strict";var xc,wc;Object.defineProperty(Bs,"__esModule",{value:!0});Bs.getMinLogLevelFromEnv=void 0;var t0=Zt(),Us=typeof process>"u"?[]:(wc=(xc=process.env.LOGGING)===null||xc===void 0?void 0:xc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,t0.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&&wc!==void 0?wc:[],vc=Us.findIndex(function(i){var e=i[0];return!e}),Ny=void 0;vc!==-1&&(Ny=Us[vc][1],Us.splice(vc));function r0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(r0,"isPrefix");function i0(i){for(var e=i.split(":"),t=0,r=Us;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(r0(e,s))return o}return Ny}n(i0,"getMinLogLevelFromEnv");Bs.getMinLogLevelFromEnv=i0});var Hc=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.BaseLogger=void 0;var n0=C(),a0=hi(),s0=Sc(),Dt=Zt(),o0=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?a0.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,n0.mapOptional)(r,function(x){return(0,Dt.resolveLogLevel)(x)}))!==null&&h!==void 0?h:(0,s0.getMinLogLevelFromEnv)(t))!==null&&p!==void 0?p:Dt.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=d}return n(i,"BaseLogger"),i.prototype.crit=function(e){this.log(Dt.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(Dt.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(Dt.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(Dt.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(Dt.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(Dt.LogLevel.TRACE,e)},i}();Os.BaseLogger=o0});var Qy=u(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.BrowserLogger=void 0;var l0=(f(),b(y)),u0=Zt(),c0=Hc(),d0=function(i){l0.__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=u0.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e}(c0.BaseLogger);js.BrowserLogger=d0});var Gy=u(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.CustomLoggerWrapper=void 0;var h0=C(),p0=Sc(),Re=Zt(),m0=function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,h0.mapOptional)(r,function(o){return(0,Re.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,p0.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}();ks.CustomLoggerWrapper=m0});var Wy=u(Ee=>{"use strict";var It,Tt,Rt;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.NodeLogger=Ee.LogLevelToBackgroundColor=Ee.LogLevelToColor=Ee.LogLevelToEmoji=void 0;var _0=(f(),b(y)),re=Zt(),y0=Hc();Ee.LogLevelToEmoji=(It={},It[re.LogLevel.CRITICAL]="\u{1F6D1}",It[re.LogLevel.ERROR]="\u274C",It[re.LogLevel.WARNING]="\u26A0\uFE0F ",It[re.LogLevel.INFO]="\u2139\uFE0F ",It[re.LogLevel.DEBUG]="\u{1F41E}",It[re.LogLevel.TRACE]="\u{1F43E}",It);var f0={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},g0={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 Ms(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(Ms,"createGenericWrapper");function at(i){return Ms(f0[i],39)}n(at,"createColorWrapper");function pi(i,e){return Ms(g0[i],49,e)}n(pi,"createBgWrapper");Ee.LogLevelToColor=(Tt={},Tt[re.LogLevel.CRITICAL]=at("red"),Tt[re.LogLevel.ERROR]=at("redBright"),Tt[re.LogLevel.WARNING]=at("yellow"),Tt[re.LogLevel.INFO]=at("blue"),Tt[re.LogLevel.DEBUG]=at("magenta"),Tt[re.LogLevel.TRACE]=Ms(0,0),Tt);Ee.LogLevelToBackgroundColor=(Rt={},Rt[re.LogLevel.CRITICAL]=pi("bgRed",at("white")),Rt[re.LogLevel.ERROR]=pi("bgRedBright",at("white")),Rt[re.LogLevel.WARNING]=pi("bgYellow",at("black")),Rt[re.LogLevel.INFO]=pi("bgBlue",at("white")),Rt[re.LogLevel.DEBUG]=pi("bgMagenta",at("black")),Rt[re.LogLevel.TRACE]=Ms(7,27),Rt);var b0=function(i){_0.__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=Ee.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(Ee.LogLevelToBackgroundColor[t](this._name)," ").concat(Ee.LogLevelToBackgroundColor[t](re.LogLevel[t])," ").concat(Ee.LogLevelToColor[t](r)):d+="[".concat(this._name,":").concat(re.LogLevel[t].toLowerCase(),"] ").concat(r),l(d)}},e}(y0.BaseLogger);Ee.NodeLogger=b0});var Vy=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.createLogger=void 0;var x0=hi(),w0=Qy(),v0=Gy(),S0=Wy();function H0(i){return i.custom?new v0.CustomLoggerWrapper(i):x0.isNode?new S0.NodeLogger(i):new w0.BrowserLogger(i)}n(H0,"createLogger");Ls.createLogger=H0});var mi=u(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.LogLevel=qr.createLogger=void 0;var C0=Vy();Object.defineProperty(qr,"createLogger",{enumerable:!0,get:n(function(){return C0.createLogger},"get")});var q0=Zt();Object.defineProperty(qr,"LogLevel",{enumerable:!0,get:n(function(){return q0.LogLevel},"get")})});var Ns=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.CustomError=void 0;var Cc=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}};Fs.CustomError=Cc});var Gs=u(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.RateLimiterDestroyedError=void 0;var E0=Ns(),qc=class extends E0.CustomError{static{n(this,"RateLimiterDestroyedError")}};Qs.RateLimiterDestroyedError=qc});var _i=u(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.RateLimitReachedError=void 0;var P0=Ns(),Ec=class extends P0.CustomError{static{n(this,"RateLimitReachedError")}};Ws.RateLimitReachedError=Ec});var Ac=u(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.RetryAfterError=void 0;var A0=Ns(),Pc=class extends A0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Vs.RetryAfterError=Pc});var $y=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.NullRateLimiter=void 0;var Dc=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};$s.NullRateLimiter=Dc});var Tc=u(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.ResponseBasedRateLimiter=void 0;var D0=mi(),I0=C(),T0=_i(),zy=Ac(),Ic=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,D0.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,I0.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 zy.RetryAfterError(x);let q=this.getParametersFromResponse(p);return d(p),q}catch(p){if(p instanceof zy.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 T0.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")}};zs.ResponseBasedRateLimiter=Ic});var Ky=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.PartitionedRateLimiter=void 0;var R0=Tc(),Rc=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 R0.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}};Ks.PartitionedRateLimiter=Rc});var Zy=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.PartitionedTimeBasedRateLimiter=void 0;var U0=mi(),B0=_i(),Jy=Gs(),Uc=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._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,U0.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;if(this._destroyed){a(new Jy.RateLimiterDestroyedError("Rate limiter was destroyed"));return}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 B0.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)}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._partitionedQueue.values())for(let t of e)t.reject(new Jy.RateLimiterDestroyedError("Rate limiter was destroyed"));this._partitionedQueue.clear()}_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{let d=setTimeout(()=>{this._counterTimers.delete(d);let h=this._usedFromBucket.get(t)-1;this._usedFromBucket.set(t,h),a.length&&h<this._bucketSize&&this._runNextRequest(t)},this._timeFrame);this._counterTimers.add(d)}}_runNextRequest(e){if(this._paused)return;let r=this._getPartitionedQueue(e).shift();r&&this._runRequest(r,e)}};Js.PartitionedTimeBasedRateLimiter=Uc});var Oc=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.TimeBasedRateLimiter=void 0;var O0=mi(),j0=_i(),Xy=Gs(),Bc=class{static{n(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a}){this._queue=[],this._usedFromBucket=0,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,O0.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;if(this._destroyed){a(new Xy.RateLimiterDestroyedError("Rate limiter was destroyed"));return}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 j0.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()}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._queue)e.reject(new Xy.RateLimiterDestroyedError("Rate limiter was destroyed"));this._queue=[]}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{let s=setTimeout(()=>{this._counterTimers.delete(s),this._usedFromBucket-=1,this._queue.length&&this._usedFromBucket<this._bucketSize&&this._runNextRequest()},this._timeFrame);this._counterTimers.add(s)}}_runNextRequest(){if(this._paused)return;let e=this._queue.shift();e&&this._runRequest(e)}};Zs.TimeBasedRateLimiter=Bc});var Yy=u(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.TimedPassthruRateLimiter=void 0;var k0=Oc(),jc=class extends k0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};Xs.TimedPassthruRateLimiter=jc});var Ys=u(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.TimedPassthruRateLimiter=ne.TimeBasedRateLimiter=ne.ResponseBasedRateLimiter=ne.PartitionedTimeBasedRateLimiter=ne.PartitionedRateLimiter=ne.NullRateLimiter=ne.RetryAfterError=ne.RateLimitReachedError=ne.RateLimiterDestroyedError=void 0;var M0=Gs();Object.defineProperty(ne,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return M0.RateLimiterDestroyedError},"get")});var L0=_i();Object.defineProperty(ne,"RateLimitReachedError",{enumerable:!0,get:n(function(){return L0.RateLimitReachedError},"get")});var F0=Ac();Object.defineProperty(ne,"RetryAfterError",{enumerable:!0,get:n(function(){return F0.RetryAfterError},"get")});var N0=$y();Object.defineProperty(ne,"NullRateLimiter",{enumerable:!0,get:n(function(){return N0.NullRateLimiter},"get")});var Q0=Ky();Object.defineProperty(ne,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return Q0.PartitionedRateLimiter},"get")});var G0=Zy();Object.defineProperty(ne,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return G0.PartitionedTimeBasedRateLimiter},"get")});var W0=Tc();Object.defineProperty(ne,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return W0.ResponseBasedRateLimiter},"get")});var V0=Oc();Object.defineProperty(ne,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return V0.TimeBasedRateLimiter},"get")});var $0=Yy();Object.defineProperty(ne,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return $0.TimedPassthruRateLimiter},"get")})});var rf=u((_t,tf)=>{var ef=typeof self<"u"?self:_t,eo=function(){function i(){this.fetch=!1,this.DOMException=ef.DOMException}return n(i,"F"),i.prototype=ef,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(g){return g&&DataView.prototype.isPrototypeOf(g)}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(g){return g&&s.indexOf(Object.prototype.toString.call(g))>-1};function l(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}n(l,"normalizeName");function d(g){return typeof g!="string"&&(g=String(g)),g}n(d,"normalizeValue");function h(g){var S={next:n(function(){var R=g.shift();return{done:R===void 0,value:R}},"next")};return r.iterable&&(S[Symbol.iterator]=function(){return S}),S}n(h,"iteratorFor");function p(g){this.map={},g instanceof p?g.forEach(function(S,R){this.append(R,S)},this):Array.isArray(g)?g.forEach(function(S){this.append(S[0],S[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(S){this.append(S,g[S])},this)}n(p,"Headers"),p.prototype.append=function(g,S){g=l(g),S=d(S);var R=this.map[g];this.map[g]=R?R+", "+S:S},p.prototype.delete=function(g){delete this.map[l(g)]},p.prototype.get=function(g){return g=l(g),this.has(g)?this.map[g]:null},p.prototype.has=function(g){return this.map.hasOwnProperty(l(g))},p.prototype.set=function(g,S){this.map[l(g)]=d(S)},p.prototype.forEach=function(g,S){for(var R in this.map)this.map.hasOwnProperty(R)&&g.call(S,this.map[R],R,this)},p.prototype.keys=function(){var g=[];return this.forEach(function(S,R){g.push(R)}),h(g)},p.prototype.values=function(){var g=[];return this.forEach(function(S){g.push(S)}),h(g)},p.prototype.entries=function(){var g=[];return this.forEach(function(S,R){g.push([R,S])}),h(g)},r.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function x(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}n(x,"consumed");function q(g){return new Promise(function(S,R){g.onload=function(){S(g.result)},g.onerror=function(){R(g.error)}})}n(q,"fileReaderReady");function E(g){var S=new FileReader,R=q(S);return S.readAsArrayBuffer(g),R}n(E,"readBlobAsArrayBuffer");function w(g){var S=new FileReader,R=q(S);return S.readAsText(g),R}n(w,"readBlobAsText");function P(g){for(var S=new Uint8Array(g),R=new Array(S.length),we=0;we<S.length;we++)R[we]=String.fromCharCode(S[we]);return R.join("")}n(P,"readArrayBufferAsText");function v(g){if(g.slice)return g.slice(0);var S=new Uint8Array(g.byteLength);return S.set(new Uint8Array(g)),S.buffer}n(v,"bufferClone");function B(){return this.bodyUsed=!1,this._initBody=function(g){this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:r.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:r.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():r.arrayBuffer&&r.blob&&a(g)?(this._bodyArrayBuffer=v(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||o(g))?this._bodyArrayBuffer=v(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="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(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var g=x(this);if(g)return g;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(E)}),this.text=function(){var g=x(this);if(g)return g;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(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(B,"Body");var V=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(g){var S=g.toUpperCase();return V.indexOf(S)>-1?S:g}n($,"normalizeMethod");function z(g,S){S=S||{};var R=S.body;if(g instanceof z){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,S.headers||(this.headers=new p(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!R&&g._bodyInit!=null&&(R=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);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(g){var S=new FormData;return g.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(g){var S=new p,R=g.replace(/\r?\n[\t ]+/g," ");return R.split(/\r?\n/).forEach(function(we){var fe=we.split(":"),F=fe.shift().trim();if(F){var Ka=fe.join(":").trim();S.append(F,Ka)}}),S}n(it,"parseHeaders"),B.call(z.prototype);function he(g,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(g)}n(he,"Response"),B.call(he.prototype),he.prototype.clone=function(){return new he(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},he.error=function(){var g=new he(null,{status:0,statusText:""});return g.type="error",g};var _r=[301,302,303,307,308];he.redirect=function(g,S){if(_r.indexOf(S)===-1)throw new RangeError("Invalid status code");return new he(null,{status:S,headers:{location:g}})},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 yr(g,S){return new Promise(function(R,we){var fe=new z(g,S);if(fe.signal&&fe.signal.aborted)return we(new t.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function Ka(){F.abort()}n(Ka,"abortXhr"),F.onload=function(){var si={status:F.status,statusText:F.statusText,headers:it(F.getAllResponseHeaders()||"")};si.url="responseURL"in F?F.responseURL:si.headers.get("X-Request-URL");var Uu="response"in F?F.response:F.responseText;R(new he(Uu,si))},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(si,Uu){F.setRequestHeader(Uu,si)}),fe.signal&&(fe.signal.addEventListener("abort",Ka),F.onreadystatechange=function(){F.readyState===4&&fe.signal.removeEventListener("abort",Ka)}),F.send(typeof fe._bodyInit>"u"?null:fe._bodyInit)})}return n(yr,"fetch"),yr.polyfill=!0,i.fetch||(i.fetch=yr,i.Headers=p,i.Request=z,i.Response=he),t.Headers=p,t.Request=z,t.Response=he,t.fetch=yr,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(eo);eo.fetch.ponyfill=!0;delete eo.fetch.polyfill;var Er=eo;_t=Er.fetch;_t.default=Er.fetch;_t.fetch=Er.fetch;_t.Headers=Er.Headers;_t.Request=Er.Request;_t.Response=Er.Response;tf.exports=_t});var to=u((WB,af)=>{"use strict";var kc=Object.prototype.hasOwnProperty,Pr=Array.isArray,st=function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i}(),z0=n(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Pr(r)){for(var a=[],s=0;s<r.length;++s)typeof r[s]<"u"&&a.push(r[s]);t.obj[t.prop]=a}}},"compactQueue"),nf=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"),K0=n(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(Pr(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!kc.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 Pr(e)&&!Pr(t)&&(a=nf(e,r)),Pr(e)&&Pr(t)?(t.forEach(function(s,o){if(kc.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 kc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),J0=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),Z0=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"),X0=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+st[l];continue}if(l<2048){s=s+(st[192|l>>6]+st[128|l&63]);continue}if(l<55296||l>=57344){s=s+(st[224|l>>12]+st[128|l>>6&63]+st[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|a.charCodeAt(o)&1023),s+=st[240|l>>18]+st[128|l>>12&63]+st[128|l>>6&63]+st[128|l&63]}return s},"encode"),Y0=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 z0(t),e},"compact"),eH=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),tH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),rH=n(function(e,t){return[].concat(e,t)},"combine");af.exports={arrayToObject:nf,assign:J0,combine:rH,compact:Y0,decode:Z0,encode:X0,isBuffer:tH,isRegExp:eH,merge:K0}});var Mc=u(($B,of)=>{"use strict";var iH=String.prototype.replace,nH=/%20/g,aH=to(),sf={RFC1738:"RFC1738",RFC3986:"RFC3986"};of.exports=aH.assign({default:sf.RFC3986,formatters:{RFC1738:n(function(i){return iH.call(i,nH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},sf)});var hf=u((KB,df)=>{"use strict";var cf=to(),yi=Mc(),sH=Object.prototype.hasOwnProperty,lf={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")},Ar=Array.isArray,oH=Array.prototype.push,Lc=n(function(i,e){oH.apply(i,Ar(e)?e:[e])},"pushToArray"),lH=Date.prototype.toISOString,uf=yi.default,Se={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:cf.encode,encodeValuesOnly:!1,format:uf,formatter:yi.formatters[uf],indices:!1,serializeDate:n(function(e){return lH.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},uH=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),cH=n(function i(e,t,r,a,s,o,l,d,h,p,x,q,E){var w=e;if(typeof l=="function"?w=l(t,w):w instanceof Date?w=p(w):r==="comma"&&Ar(w)&&(w=w.join(",")),w===null){if(a)return o&&!q?o(t,Se.encoder,E,"key"):t;w=""}if(uH(w)||cf.isBuffer(w)){if(o){var P=q?t:o(t,Se.encoder,E,"key");return[x(P)+"="+x(o(w,Se.encoder,E,"value"))]}return[x(t)+"="+x(String(w))]}var v=[];if(typeof w>"u")return v;var B;if(Ar(l))B=l;else{var V=Object.keys(w);B=d?V.sort(d):V}for(var $=0;$<B.length;++$){var z=B[$];s&&w[z]===null||(Ar(w)?Lc(v,i(w[z],typeof r=="function"?r(t,z):t,r,a,s,o,l,d,h,p,x,q,E)):Lc(v,i(w[z],t+(h?"."+z:"["+z+"]"),r,a,s,o,l,d,h,p,x,q,E)))}return v},"stringify"),dH=n(function(e){if(!e)return Se;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||Se.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=yi.default;if(typeof e.format<"u"){if(!sH.call(yi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=yi.formatters[r],s=Se.filter;return(typeof e.filter=="function"||Ar(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Se.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Se.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Se.charsetSentinel,delimiter:typeof e.delimiter>"u"?Se.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Se.encode,encoder:typeof e.encoder=="function"?e.encoder:Se.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Se.encodeValuesOnly,filter:s,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Se.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Se.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Se.strictNullHandling}},"normalizeStringifyOptions");df.exports=function(i,e){var t=i,r=dH(e),a,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):Ar(r.filter)&&(s=r.filter,a=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in lf?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=lf[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||Lc(o,cH(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),q=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?q+="utf8=%26%2310003%3B&":q+="utf8=%E2%9C%93&"),x.length>0?q+x:""}});var yf=u((ZB,_f)=>{"use strict";var fi=to(),Fc=Object.prototype.hasOwnProperty,pf=Array.isArray,ge={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:fi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},hH=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),mf=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),pH=n(function(e,t){if(pf(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),mH="utf8=%26%2310003%3B",_H="utf8=%E2%9C%93",yH=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]===_H?h="utf-8":o[d]===mH&&(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("]="),q=x===-1?p.indexOf("="):x+1,E,w;q===-1?(E=t.decoder(p,ge.decoder,h,"key"),w=t.strictNullHandling?null:""):(E=t.decoder(p.slice(0,q),ge.decoder,h,"key"),w=pH(mf(p.slice(q+1),t),function(P){return t.decoder(P,ge.decoder,h,"value")})),w&&t.interpretNumericEntities&&h==="iso-8859-1"&&(w=hH(w)),p.indexOf("[]=")>-1&&(w=pf(w)?[w]:w),Fc.call(r,E)?r[E]=fi.combine(r[E],w):r[E]=w}return r},"parseQueryStringValues"),fH=n(function(i,e,t,r){for(var a=r?e:mf(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"),gH=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&&Fc.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&&Fc.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(d[1])}return d&&p.push("["+s.slice(d.index)+"]"),fH(p,t,r,a)}},"parseQueryStringKeys"),bH=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"||fi.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");_f.exports=function(i,e){var t=bH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?yH(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=gH(l,r[l],t,typeof i=="string");a=fi.merge(a,d,t)}return fi.compact(a)}});var Nc=u((YB,ff)=>{"use strict";var xH=hf(),wH=yf(),vH=Mc();ff.exports={formats:vH,parse:wH,stringify:xH}});var bf=u(gf=>{function yt(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]=yt(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:yt(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=yt(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=yt(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(a){t.add(yt(a))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(a,s){t.set(yt(s),yt(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(yt(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}n(yt,"klona");gf.klona=yt});var Gc=u(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.DataObject=ot.getRawData=ot.rawDataSymbol=void 0;var SH=bf();ot.rawDataSymbol=Symbol("twurpleRawData");function HH(i){return(0,SH.klona)(i[ot.rawDataSymbol])}n(HH,"getRawData");ot.getRawData=HH;var Qc=class{static{n(this,"DataObject")}constructor(e){this[ot.rawDataSymbol]=e}};ot.DataObject=Qc});var io=u(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.CustomError=void 0;var Wc=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}};ro.CustomError=Wc});var $c=u(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.RelationAssertionError=void 0;var CH=io(),Vc=class extends CH.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};no.RelationAssertionError=Vc});var xf=u(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.checkRelationAssertion=void 0;var qH=$c();function EH(i){if(i==null)throw new qH.RelationAssertionError;return i}n(EH,"checkRelationAssertion");ao.checkRelationAssertion=EH});var zc=u(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.rtfm=void 0;function PH(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(PH,"rtfm");so.rtfm=PH});var wf=u(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.HelixExtension=void 0;var AH=(f(),b(y)),D=Gc(),DH=zc(),Kc=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 viewerSummary(){return this[D.rawDataSymbol].viewer_summary}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}};gi.HelixExtension=Kc;gi.HelixExtension=Kc=AH.__decorate([(0,DH.rtfm)("api","HelixExtension","id")],Kc)});var vf=u(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.HellFreezesOverError=void 0;var IH=io(),Jc=class extends IH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};oo.HellFreezesOverError=Jc});var Sf=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.extractUserName=Dr.extractUserId=void 0;function TH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(TH,"extractUserId");Dr.extractUserId=TH;function RH(i){return typeof i=="string"?i:i.name}n(RH,"extractUserName");Dr.extractUserName=RH});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 Zc=Gc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return Zc.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return Zc.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return Zc.rawDataSymbol},"get")});var UH=xf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return UH.checkRelationAssertion},"get")});var BH=zc();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return BH.rtfm},"get")});var OH=wf();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return OH.HelixExtension},"get")});var jH=io();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return jH.CustomError},"get")});var kH=vf();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return kH.HellFreezesOverError},"get")});var MH=$c();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return MH.RelationAssertionError},"get")});var Hf=Sf();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return Hf.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return Hf.extractUserName},"get")})});var Yc=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.HttpStatusCodeError=void 0;var LH=m(),Xc=class extends LH.CustomError{static{n(this,"HttpStatusCodeError")}constructor(e,t,r,a,s,o){super(`Encountered HTTP status code ${e}: ${t}
1
+ var es=Object.defineProperty;var _w=Object.getOwnPropertyDescriptor;var yw=Object.getOwnPropertyNames;var fw=Object.prototype.hasOwnProperty;var n=(i,e)=>es(i,"name",{value:e,configurable:!0});var gw=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),bw=(i,e)=>{for(var t in e)es(i,t,{get:e[t],enumerable:!0})},xw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of yw(e))!fw.call(i,a)&&a!==t&&es(i,a,{get:()=>e[a],enumerable:!(r=_w(e,a))||r.enumerable});return i};var x=i=>xw(es({},"__esModule",{value:!0}),i);var wr=u((tU,Km)=>{var ku=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}}};Km.exports=ku});var It=u((iU,Jm)=>{Jm.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 Lu=u((aU,Zm)=>{var ww=wr(),vw=It(),Mu=class i extends ww{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 vw.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}})}};Zm.exports=Mu});var ts=u((oU,Xm)=>{var Fu=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}};Xm.exports=Fu});var Qu=u((uU,Ym)=>{var Sw=ts(),Nu=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new Sw}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};Ym.exports=Nu});var Wu=u((dU,t_)=>{var Hw=wr(),e_=It(),Gu=class i extends Hw{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?e_.FFZ.CDNAnimated(this.id,e):e_.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})}};t_.exports=Gu});var $u=u((pU,r_)=>{var Cw=wr(),qw=It(),Vu=class i extends Cw{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.data?e.data.owner.display_name:null,this.sizes=e.data.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.data.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],qw.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,data:{animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}}})}};r_.exports=Vu});var Ku=u((_U,i_)=>{var Ew=wr(),Pw=It(),zu=class i extends Ew{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 Pw.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}:{}})}};i_.exports=zu});var G_=u((fU,Q_)=>{"use strict";function x_(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(x_,"bind");var{toString:Aw}=Object.prototype,{getPrototypeOf:ac}=Object,{iterator:ls,toStringTag:w_}=Symbol,us=(i=>e=>{let t=Aw.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ze=n(i=>(i=i.toLowerCase(),e=>us(e)===i),"kindOfTest"),cs=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:Cr}=Array,vr=cs("undefined");function pi(i){return i!==null&&!vr(i)&&i.constructor!==null&&!vr(i.constructor)&&Ce(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(pi,"isBuffer");var v_=Ze("ArrayBuffer");function Dw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&v_(i.buffer),e}n(Dw,"isArrayBufferView");var Iw=cs("string"),Ce=cs("function"),S_=cs("number"),mi=n(i=>i!==null&&typeof i=="object","isObject"),Tw=n(i=>i===!0||i===!1,"isBoolean"),is=n(i=>{if(us(i)!=="object")return!1;let e=ac(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(w_ in i)&&!(ls in i)},"isPlainObject"),Rw=n(i=>{if(!mi(i)||pi(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},"isEmptyObject"),Uw=Ze("Date"),Bw=Ze("File"),Ow=Ze("Blob"),jw=Ze("FileList"),kw=n(i=>mi(i)&&Ce(i.pipe),"isStream"),Mw=n(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Ce(i.append)&&((e=us(i))==="formdata"||e==="object"&&Ce(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Lw=Ze("URLSearchParams"),[Fw,Nw,Qw,Gw]=["ReadableStream","Request","Response","Headers"].map(Ze),Ww=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function _i(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,a;if(typeof i!="object"&&(i=[i]),Cr(i))for(r=0,a=i.length;r<a;r++)e.call(null,i[r],r,i);else{if(pi(i))return;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(_i,"forEach");function H_(i,e){if(pi(i))return null;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(H_,"findKey");var er=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,C_=n(i=>!vr(i)&&i!==er,"isContextDefined");function Yu(){let{caseless:i,skipUndefined:e}=C_(this)&&this||{},t={},r=n((a,s)=>{let o=i&&H_(t,s)||s;is(t[o])&&is(a)?t[o]=Yu(t[o],a):is(a)?t[o]=Yu({},a):Cr(a)?t[o]=a.slice():(!e||!vr(a))&&(t[o]=a)},"assignValue");for(let a=0,s=arguments.length;a<s;a++)arguments[a]&&_i(arguments[a],r);return t}n(Yu,"merge");var Vw=n((i,e,t,{allOwnKeys:r}={})=>(_i(e,(a,s)=>{t&&Ce(a)?i[s]=x_(a,t):i[s]=a},{allOwnKeys:r}),i),"extend"),$w=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),zw=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"),Kw=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&&ac(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),Jw=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"),Zw=n(i=>{if(!i)return null;if(Cr(i))return i;let e=i.length;if(!S_(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),Xw=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&ac(Uint8Array)),Yw=n((i,e)=>{let r=(i&&i[ls]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),ev=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),tv=Ze("HTMLFormElement"),rv=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),n_=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),iv=Ze("RegExp"),q_=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};_i(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),nv=n(i=>{q_(i,(e,t)=>{if(Ce(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(Ce(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"),av=n((i,e)=>{let t={},r=n(a=>{a.forEach(s=>{t[s]=!0})},"define");return Cr(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),sv=n(()=>{},"noop"),ov=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber");function lv(i){return!!(i&&Ce(i.append)&&i[w_]==="FormData"&&i[ls])}n(lv,"isSpecCompliantForm");var uv=n(i=>{let e=new Array(10),t=n((r,a)=>{if(mi(r)){if(e.indexOf(r)>=0)return;if(pi(r))return r;if(!("toJSON"in r)){e[a]=r;let s=Cr(r)?[]:{};return _i(r,(o,l)=>{let c=t(o,a+1);!vr(c)&&(s[l]=c)}),e[a]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),cv=Ze("AsyncFunction"),dv=n(i=>i&&(mi(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),"isThenable"),E_=((i,e)=>i?setImmediate:e?((t,r)=>(er.addEventListener("message",({source:a,data:s})=>{a===er&&s===t&&r.length&&r.shift()()},!1),a=>{r.push(a),er.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ce(er.postMessage)),hv=typeof queueMicrotask<"u"?queueMicrotask.bind(er):typeof process<"u"&&process.nextTick||E_,pv=n(i=>i!=null&&Ce(i[ls]),"isIterable"),m={isArray:Cr,isArrayBuffer:v_,isBuffer:pi,isFormData:Mw,isArrayBufferView:Dw,isString:Iw,isNumber:S_,isBoolean:Tw,isObject:mi,isPlainObject:is,isEmptyObject:Rw,isReadableStream:Fw,isRequest:Nw,isResponse:Qw,isHeaders:Gw,isUndefined:vr,isDate:Uw,isFile:Bw,isBlob:Ow,isRegExp:iv,isFunction:Ce,isStream:kw,isURLSearchParams:Lw,isTypedArray:Xw,isFileList:jw,forEach:_i,merge:Yu,extend:Vw,trim:Ww,stripBOM:$w,inherits:zw,toFlatObject:Kw,kindOf:us,kindOfTest:Ze,endsWith:Jw,toArray:Zw,forEachEntry:Yw,matchAll:ev,isHTMLForm:tv,hasOwnProperty:n_,hasOwnProp:n_,reduceDescriptors:q_,freezeMethods:nv,toObjectSet:av,toCamelCase:rv,noop:sv,toFiniteNumber:ov,findKey:H_,global:er,isContextDefined:C_,isSpecCompliantForm:lv,toJSONObject:uv,isAsyncFn:cv,isThenable:dv,setImmediate:E_,asap:hv,isIterable:pv};function T(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(T,"AxiosError");m.inherits(T,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:m.toJSONObject(this.config),code:this.code,status:this.status}},"toJSON")});var P_=T.prototype,A_={};["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=>{A_[i]={value:i}});Object.defineProperties(T,A_);Object.defineProperty(P_,"isAxiosError",{value:!0});T.from=(i,e,t,r,a,s)=>{let o=Object.create(P_);m.toFlatObject(i,o,n(function(p){return p!==Error.prototype},"filter"),h=>h!=="isAxiosError");let l=i&&i.message?i.message:"Error",c=e==null&&i?i.code:e;return T.call(o,l,c,t,r,a),i&&o.cause==null&&Object.defineProperty(o,"cause",{value:i,configurable:!0}),o.name=i&&i.name||"Error",s&&Object.assign(o,s),o};var mv=null;function ec(i){return m.isPlainObject(i)||m.isArray(i)}n(ec,"isVisitable");function D_(i){return m.endsWith(i,"[]")?i.slice(0,-2):i}n(D_,"removeBrackets");function a_(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=D_(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(a_,"renderKey");function _v(i){return m.isArray(i)&&!i.some(ec)}n(_v,"isFlatArray");var yv=m.toFlatObject(m,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function ds(i,e,t){if(!m.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=m.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,n(function(q,v){return!m.isUndefined(v[q])},"defined"));let r=t.metaTokens,a=t.visitor||p,s=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&m.isSpecCompliantForm(e);if(!m.isFunction(a))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(m.isDate(y))return y.toISOString();if(m.isBoolean(y))return y.toString();if(!c&&m.isBlob(y))throw new T("Blob is not supported. Use a Buffer instead.");return m.isArrayBuffer(y)||m.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}n(h,"convertValue");function p(y,q,v){let B=y;if(y&&!v&&typeof y=="object"){if(m.endsWith(q,"{}"))q=r?q:q.slice(0,-2),y=JSON.stringify(y);else if(m.isArray(y)&&_v(y)||(m.isFileList(y)||m.endsWith(q,"[]"))&&(B=m.toArray(y)))return q=D_(q),B.forEach(n(function(z,k){!(m.isUndefined(z)||z===null)&&e.append(o===!0?a_([q],k,s):o===null?q:q+"[]",h(z))},"each")),!1}return ec(y)?!0:(e.append(a_(v,q,s),h(y)),!1)}n(p,"defaultVisitor");let w=[],E=Object.assign(yv,{defaultVisitor:p,convertValue:h,isVisitable:ec});function P(y,q){if(!m.isUndefined(y)){if(w.indexOf(y)!==-1)throw Error("Circular reference detected in "+q.join("."));w.push(y),m.forEach(y,n(function(B,ge){(!(m.isUndefined(B)||B===null)&&a.call(e,B,m.isString(ge)?ge.trim():ge,q,E))===!0&&P(B,q?q.concat(ge):[ge])},"each")),w.pop()}}if(n(P,"build"),!m.isObject(i))throw new TypeError("data must be an object");return P(i),e}n(ds,"toFormData");function s_(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(s_,"encode$1");function sc(i,e){this._pairs=[],i&&ds(i,this,e)}n(sc,"AxiosURLSearchParams");var I_=sc.prototype;I_.append=n(function(e,t){this._pairs.push([e,t])},"append");I_.toString=n(function(e){let t=e?function(r){return e.call(this,r,s_)}:s_;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function fv(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}n(fv,"encode");function T_(i,e,t){if(!e)return i;let r=t&&t.encode||fv;m.isFunction(t)&&(t={serialize:t});let a=t&&t.serialize,s;if(a?s=a(e,t):s=m.isURLSearchParams(e)?e.toString():new sc(e,t).toString(r),s){let o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}n(T_,"buildURL");var tc=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){m.forEach(this.handlers,n(function(r){r!==null&&e(r)},"forEachHandler"))}},o_=tc,R_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gv=typeof URLSearchParams<"u"?URLSearchParams:sc,bv=typeof FormData<"u"?FormData:null,xv=typeof Blob<"u"?Blob:null,wv={isBrowser:!0,classes:{URLSearchParams:gv,FormData:bv,Blob:xv},protocols:["http","https","file","blob","url","data"]},oc=typeof window<"u"&&typeof document<"u",rc=typeof navigator=="object"&&navigator||void 0,vv=oc&&(!rc||["ReactNative","NativeScript","NS"].indexOf(rc.product)<0),Sv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hv=oc&&window.location.href||"http://localhost",Cv=Object.freeze({__proto__:null,hasBrowserEnv:oc,hasStandardBrowserWebWorkerEnv:Sv,hasStandardBrowserEnv:vv,navigator:rc,origin:Hv}),we={...Cv,...wv};function qv(i,e){return ds(i,new we.classes.URLSearchParams,{visitor:n(function(t,r,a,s){return we.isNode&&m.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}n(qv,"toURLEncodedForm");function Ev(i){return m.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(Ev,"parsePropPath");function Pv(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(Pv,"arrayToObject");function U_(i){function e(t,r,a,s){let o=t[s++];if(o==="__proto__")return!0;let l=Number.isFinite(+o),c=s>=t.length;return o=!o&&m.isArray(a)?a.length:o,c?(m.hasOwnProp(a,o)?a[o]=[a[o],r]:a[o]=r,!l):((!a[o]||!m.isObject(a[o]))&&(a[o]=[]),e(t,r,a[o],s)&&m.isArray(a[o])&&(a[o]=Pv(a[o])),!l)}if(n(e,"buildPath"),m.isFormData(i)&&m.isFunction(i.entries)){let t={};return m.forEachEntry(i,(r,a)=>{e(Ev(r),a,t,0)}),t}return null}n(U_,"formDataToJSON");function Av(i,e,t){if(m.isString(i))try{return(e||JSON.parse)(i),m.trim(i)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(i)}n(Av,"stringifySafely");var lc={transitional:R_,adapter:["xhr","http","fetch"],transformRequest:[n(function(e,t){let r=t.getContentType()||"",a=r.indexOf("application/json")>-1,s=m.isObject(e);if(s&&m.isHTMLForm(e)&&(e=new FormData(e)),m.isFormData(e))return a?JSON.stringify(U_(e)):e;if(m.isArrayBuffer(e)||m.isBuffer(e)||m.isStream(e)||m.isFile(e)||m.isBlob(e)||m.isReadableStream(e))return e;if(m.isArrayBufferView(e))return e.buffer;if(m.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 qv(e,this.formSerializer).toString();if((l=m.isFileList(e))||r.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return ds(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),Av(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||lc.transitional,r=t&&t.forcedJSONParsing,a=this.responseType==="json";if(m.isResponse(e)||m.isReadableStream(e))return e;if(e&&m.isString(e)&&(r&&!this.responseType||a)){let o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?T.from(l,T.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:we.classes.FormData,Blob:we.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};m.forEach(["delete","get","head","post","put","patch"],i=>{lc.headers[i]={}});var uc=lc,Dv=m.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"]),Iv=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]&&Dv[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),l_=Symbol("internals");function hi(i){return i&&String(i).trim().toLowerCase()}n(hi,"normalizeHeader");function ns(i){return i===!1||i==null?i:m.isArray(i)?i.map(ns):String(i)}n(ns,"normalizeValue");function Tv(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(Tv,"parseTokens");var Rv=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function Ju(i,e,t,r,a){if(m.isFunction(r))return r.call(this,e,t);if(a&&(e=t),!!m.isString(e)){if(m.isString(r))return e.indexOf(r)!==-1;if(m.isRegExp(r))return r.test(e)}}n(Ju,"matchHeaderValue");function Uv(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(Uv,"formatHeader");function Bv(i,e){let t=m.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(Bv,"buildAccessors");var Sr=class{static{n(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,r){let a=this;function s(l,c,h){let p=hi(c);if(!p)throw new Error("header name must be a non-empty string");let w=m.findKey(a,p);(!w||a[w]===void 0||h===!0||h===void 0&&a[w]!==!1)&&(a[w||c]=ns(l))}n(s,"setHeader");let o=n((l,c)=>m.forEach(l,(h,p)=>s(h,p,c)),"setHeaders");if(m.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(m.isString(e)&&(e=e.trim())&&!Rv(e))o(Iv(e),t);else if(m.isObject(e)&&m.isIterable(e)){let l={},c,h;for(let p of e){if(!m.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[h=p[0]]=(c=l[h])?m.isArray(c)?[...c,p[1]]:[c,p[1]]:p[1]}o(l,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=hi(e),e){let r=m.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return Tv(a);if(m.isFunction(t))return t.call(this,a,r);if(m.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hi(e),e){let r=m.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Ju(this,this[r],r,t)))}return!1}delete(e,t){let r=this,a=!1;function s(o){if(o=hi(o),o){let l=m.findKey(r,o);l&&(!t||Ju(r,r[l],l,t))&&(delete r[l],a=!0)}}return n(s,"deleteHeader"),m.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||Ju(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,r={};return m.forEach(this,(a,s)=>{let o=m.findKey(r,s);if(o){t[o]=ns(a),delete t[s];return}let l=e?Uv(s):String(s).trim();l!==s&&delete t[s],t[l]=ns(a),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return m.forEach(this,(r,a)=>{r!=null&&r!==!1&&(t[a]=e&&m.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
+ `)}getSetCookie(){return this.get("set-cookie")||[]}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[l_]=this[l_]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=hi(o);r[l]||(Bv(a,o),r[l]=!0)}return n(s,"defineAccessor"),m.isArray(e)?e.forEach(s):s(e),this}};Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);m.reduceDescriptors(Sr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});m.freezeMethods(Sr);var Je=Sr;function Zu(i,e){let t=this||uc,r=e||t,a=Je.from(r.headers),s=r.data;return m.forEach(i,n(function(l){s=l.call(t,s,a.normalize(),e?e.status:void 0)},"transform")),a.normalize(),s}n(Zu,"transformData");function B_(i){return!!(i&&i.__CANCEL__)}n(B_,"isCancel");function qr(i,e,t){T.call(this,i??"canceled",T.ERR_CANCELED,e,t),this.name="CanceledError"}n(qr,"CanceledError");m.inherits(qr,T,{__CANCEL__:!0});function O_(i,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?i(t):e(new T("Request failed with status code "+t.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}n(O_,"settle");function Ov(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(Ov,"parseProtocol");function jv(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(c){let h=Date.now(),p=r[s];o||(o=h),t[a]=c,r[a]=h;let w=s,E=0;for(;w!==a;)E+=t[w++],w=w%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),h-o<e)return;let P=p&&h-p;return P?Math.round(E*1e3/P):void 0},"push")}n(jv,"speedometer");function kv(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(...h)},"invoke");return[n((...h)=>{let p=Date.now(),w=p-t;w>=r?o(h,p):(a=h,s||(s=setTimeout(()=>{s=null,o(a)},r-w)))},"throttled"),n(()=>a&&o(a),"flush")]}n(kv,"throttle");var os=n((i,e,t=3)=>{let r=0,a=jv(50,250);return kv(s=>{let o=s.loaded,l=s.lengthComputable?s.total:void 0,c=o-r,h=a(c),p=o<=l;r=o;let w={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:h||void 0,estimated:h&&l&&p?(l-o)/h:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};i(w)},t)},"progressEventReducer"),u_=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),c_=n(i=>(...e)=>m.asap(()=>i(...e)),"asyncDecorator"),Mv=we.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,we.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(we.origin),we.navigator&&/(msie|trident)/i.test(we.navigator.userAgent)):()=>!0,Lv=we.hasStandardBrowserEnv?{write(i,e,t,r,a,s,o){if(typeof document>"u")return;let l=[`${i}=${encodeURIComponent(e)}`];m.isNumber(t)&&l.push(`expires=${new Date(t).toUTCString()}`),m.isString(r)&&l.push(`path=${r}`),m.isString(a)&&l.push(`domain=${a}`),s===!0&&l.push("secure"),m.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(i){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Fv(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(Fv,"isAbsoluteURL");function Nv(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n(Nv,"combineURLs");function j_(i,e,t){let r=!Fv(e);return i&&(r||t==!1)?Nv(i,e):e}n(j_,"buildFullPath");var d_=n(i=>i instanceof Je?{...i}:i,"headersToObject");function tr(i,e){e=e||{};let t={};function r(h,p,w,E){return m.isPlainObject(h)&&m.isPlainObject(p)?m.merge.call({caseless:E},h,p):m.isPlainObject(p)?m.merge({},p):m.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,w,E){if(m.isUndefined(p)){if(!m.isUndefined(h))return r(void 0,h,w,E)}else return r(h,p,w,E)}n(a,"mergeDeepProperties");function s(h,p){if(!m.isUndefined(p))return r(void 0,p)}n(s,"valueFromConfig2");function o(h,p){if(m.isUndefined(p)){if(!m.isUndefined(h))return r(void 0,h)}else return r(void 0,p)}n(o,"defaultToConfig2");function l(h,p,w){if(w in e)return r(h,p);if(w in i)return r(void 0,h)}n(l,"mergeDirectKeys");let c={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,w)=>a(d_(h),d_(p),w,!0),"headers")};return m.forEach(Object.keys({...i,...e}),n(function(p){let w=c[p]||a,E=w(i[p],e[p],p);m.isUndefined(E)&&w!==l||(t[p]=E)},"computeConfigValue")),t}n(tr,"mergeConfig");var k_=n(i=>{let e=tr({},i),{data:t,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:l}=e;if(e.headers=o=Je.from(o),e.url=T_(j_(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),m.isFormData(t)){if(we.hasStandardBrowserEnv||we.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(m.isFunction(t.getHeaders)){let c=t.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([p,w])=>{h.includes(p.toLowerCase())&&o.set(p,w)})}}if(we.hasStandardBrowserEnv&&(r&&m.isFunction(r)&&(r=r(e)),r||r!==!1&&Mv(e.url))){let c=a&&s&&Lv.read(s);c&&o.set(a,c)}return e},"resolveConfig"),Qv=typeof XMLHttpRequest<"u",Gv=Qv&&function(i){return new Promise(n(function(t,r){let a=k_(i),s=a.data,o=Je.from(a.headers).normalize(),{responseType:l,onUploadProgress:c,onDownloadProgress:h}=a,p,w,E,P,y;function q(){P&&P(),y&&y(),a.cancelToken&&a.cancelToken.unsubscribe(p),a.signal&&a.signal.removeEventListener("abort",p)}n(q,"done");let v=new XMLHttpRequest;v.open(a.method.toUpperCase(),a.url,!0),v.timeout=a.timeout;function B(){if(!v)return;let z=Je.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),Ue={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:z,config:i,request:v};O_(n(function(J){t(J),q()},"_resolve"),n(function(J){r(J),q()},"_reject"),Ue),v=null}n(B,"onloadend"),"onloadend"in v?v.onloadend=B:v.onreadystatechange=n(function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(B)},"handleLoad"),v.onabort=n(function(){v&&(r(new T("Request aborted",T.ECONNABORTED,i,v)),v=null)},"handleAbort"),v.onerror=n(function(k){let Ue=k&&k.message?k.message:"Network Error",yt=new T(Ue,T.ERR_NETWORK,i,v);yt.event=k||null,r(yt),v=null},"handleError"),v.ontimeout=n(function(){let k=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded",Ue=a.transitional||R_;a.timeoutErrorMessage&&(k=a.timeoutErrorMessage),r(new T(k,Ue.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,i,v)),v=null},"handleTimeout"),s===void 0&&o.setContentType(null),"setRequestHeader"in v&&m.forEach(o.toJSON(),n(function(k,Ue){v.setRequestHeader(Ue,k)},"setRequestHeader")),m.isUndefined(a.withCredentials)||(v.withCredentials=!!a.withCredentials),l&&l!=="json"&&(v.responseType=a.responseType),h&&([E,y]=os(h,!0),v.addEventListener("progress",E)),c&&v.upload&&([w,P]=os(c),v.upload.addEventListener("progress",w),v.upload.addEventListener("loadend",P)),(a.cancelToken||a.signal)&&(p=n(z=>{v&&(r(!z||z.type?new qr(null,i,v):z),v.abort(),v=null)},"onCanceled"),a.cancelToken&&a.cancelToken.subscribe(p),a.signal&&(a.signal.aborted?p():a.signal.addEventListener("abort",p)));let ge=Ov(a.url);if(ge&&we.protocols.indexOf(ge)===-1){r(new T("Unsupported protocol "+ge+":",T.ERR_BAD_REQUEST,i));return}v.send(s||null)},"dispatchXhrRequest"))},Wv=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 T?p:new qr(p instanceof Error?p.message:p))}},"onabort"),o=e&&setTimeout(()=>{o=null,s(new T(`timeout ${e} of ms exceeded`,T.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:c}=r;return c.unsubscribe=()=>m.asap(l),c}},"composeSignals"),Vv=Wv,$v=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"),zv=n(async function*(i,e){for await(let t of Kv(i))yield*$v(t,e)},"readBytes"),Kv=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"),h_=n((i,e,t,r)=>{let a=zv(i,e),s=0,o,l=n(c=>{o||(o=!0,r&&r(c))},"_onFinish");return new ReadableStream({async pull(c){try{let{done:h,value:p}=await a.next();if(h){l(),c.close();return}let w=p.byteLength;if(t){let E=s+=w;t(E)}c.enqueue(new Uint8Array(p))}catch(h){throw l(h),h}},cancel(c){return l(c),a.return()}},{highWaterMark:2})},"trackStream"),p_=64*1024,{isFunction:rs}=m,Jv=(({Request:i,Response:e})=>({Request:i,Response:e}))(m.global),{ReadableStream:m_,TextEncoder:__}=m.global,y_=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),Zv=n(i=>{i=m.merge.call({skipUndefined:!0},Jv,i);let{fetch:e,Request:t,Response:r}=i,a=e?rs(e):typeof fetch=="function",s=rs(t),o=rs(r);if(!a)return!1;let l=a&&rs(m_),c=a&&(typeof __=="function"?(y=>q=>y.encode(q))(new __):async y=>new Uint8Array(await new t(y).arrayBuffer())),h=s&&l&&y_(()=>{let y=!1,q=new t(we.origin,{body:new m_,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!q}),p=o&&l&&y_(()=>m.isReadableStream(new r("").body)),w={stream:p&&(y=>y.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!w[y]&&(w[y]=(q,v)=>{let B=q&&q[y];if(B)return B.call(q);throw new T(`Response type '${y}' is not supported`,T.ERR_NOT_SUPPORT,v)})});let E=n(async y=>{if(y==null)return 0;if(m.isBlob(y))return y.size;if(m.isSpecCompliantForm(y))return(await new t(we.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(m.isArrayBufferView(y)||m.isArrayBuffer(y))return y.byteLength;if(m.isURLSearchParams(y)&&(y=y+""),m.isString(y))return(await c(y)).byteLength},"getBodyLength"),P=n(async(y,q)=>{let v=m.toFiniteNumber(y.getContentLength());return v??E(q)},"resolveBodyLength");return async y=>{let{url:q,method:v,data:B,signal:ge,cancelToken:z,timeout:k,onDownloadProgress:Ue,onUploadProgress:yt,responseType:J,headers:di,withCredentials:Pt="same-origin",fetchOptions:f}=k_(y),H=e||fetch;J=J?(J+"").toLowerCase():"text";let I=Vv([ge,z&&z.toAbortSignal()],k),X=null,$=I&&I.unsubscribe&&(()=>{I.unsubscribe()}),O;try{if(yt&&h&&v!=="get"&&v!=="head"&&(O=await P(di,B))!==0){let Dt=new t(q,{method:"POST",body:B,duplex:"half"}),xr;if(m.isFormData(B)&&(xr=Dt.headers.get("content-type"))&&di.setContentType(xr),Dt.body){let[ju,Ya]=u_(O,os(c_(yt)));B=h_(Dt.body,p_,ju,Ya)}}m.isString(Pt)||(Pt=Pt?"include":"omit");let He=s&&"credentials"in t.prototype,At={...f,signal:I,method:v.toUpperCase(),headers:di.normalize().toJSON(),body:B,duplex:"half",credentials:He?Pt:void 0};X=s&&new t(q,At);let Le=await(s?H(X,f):H(q,At)),$m=p&&(J==="stream"||J==="response");if(p&&(Ue||$m&&$)){let Dt={};["status","statusText","headers"].forEach(zm=>{Dt[zm]=Le[zm]});let xr=m.toFiniteNumber(Le.headers.get("content-length")),[ju,Ya]=Ue&&u_(xr,os(c_(Ue),!0))||[];Le=new r(h_(Le.body,p_,ju,()=>{Ya&&Ya(),$&&$()}),Dt)}J=J||"text";let mw=await w[m.findKey(w,J)||"text"](Le,y);return!$m&&$&&$(),await new Promise((Dt,xr)=>{O_(Dt,xr,{data:mw,headers:Je.from(Le.headers),status:Le.status,statusText:Le.statusText,config:y,request:X})})}catch(He){throw $&&$(),He&&He.name==="TypeError"&&/Load failed|fetch/i.test(He.message)?Object.assign(new T("Network Error",T.ERR_NETWORK,y,X),{cause:He.cause||He}):T.from(He,He&&He.code,y,X)}}},"factory"),Xv=new Map,M_=n(i=>{let e=i&&i.env||{},{fetch:t,Request:r,Response:a}=e,s=[r,a,t],o=s.length,l=o,c,h,p=Xv;for(;l--;)c=s[l],h=p.get(c),h===void 0&&p.set(c,h=l?new Map:Zv(e)),p=h;return h},"getFetch");M_();var cc={http:mv,xhr:Gv,fetch:{get:M_}};m.forEach(cc,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var f_=n(i=>`- ${i}`,"renderReason"),Yv=n(i=>m.isFunction(i)||i===null||i===!1,"isResolvedHandle");function eS(i,e){i=m.isArray(i)?i:[i];let{length:t}=i,r,a,s={};for(let o=0;o<t;o++){r=i[o];let l;if(a=r,!Yv(r)&&(a=cc[(l=String(r)).toLowerCase()],a===void 0))throw new T(`Unknown adapter '${l}'`);if(a&&(m.isFunction(a)||(a=a.get(e))))break;s[l||"#"+o]=a}if(!a){let o=Object.entries(s).map(([c,h])=>`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build")),l=t?o.length>1?`since :
4
+ `+o.map(f_).join(`
5
+ `):" "+f_(o[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a}n(eS,"getAdapter");var L_={getAdapter:eS,adapters:cc};function Xu(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new qr(null,i)}n(Xu,"throwIfCancellationRequested");function g_(i){return Xu(i),i.headers=Je.from(i.headers),i.data=Zu.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),L_.getAdapter(i.adapter||uc.adapter,i)(i).then(n(function(r){return Xu(i),r.data=Zu.call(i,i.transformResponse,r),r.headers=Je.from(r.headers),r},"onAdapterResolution"),n(function(r){return B_(r)||(Xu(i),r&&r.response&&(r.response.data=Zu.call(i,i.transformResponse,r.response),r.response.headers=Je.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(g_,"dispatchRequest");var F_="1.13.2",hs={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{hs[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var b_={};hs.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+F_+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return n(a,"formatMessage"),(s,o,l)=>{if(e===!1)throw new T(a(o," has been removed"+(t?" in "+t:"")),T.ERR_DEPRECATED);return t&&!b_[o]&&(b_[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");hs.spelling=n(function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)},"spelling");function tS(i,e,t){if(typeof i!="object")throw new T("options must be an object",T.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],c=l===void 0||o(l,s,i);if(c!==!0)throw new T("option "+s+" must be "+c,T.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new T("Unknown option "+s,T.ERR_BAD_OPTION)}}n(tS,"assertOptions");var as={assertOptions:tS,validators:hs},at=as.validators,Hr=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new o_,response:new o_}}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=tr(this.defaults,t);let{transitional:r,paramsSerializer:a,headers:s}=t;r!==void 0&&as.assertOptions(r,{silentJSONParsing:at.transitional(at.boolean),forcedJSONParsing:at.transitional(at.boolean),clarifyTimeoutError:at.transitional(at.boolean)},!1),a!=null&&(m.isFunction(a)?t.paramsSerializer={serialize:a}:as.assertOptions(a,{encode:at.function,serialize:at.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),as.assertOptions(t,{baseUrl:at.spelling("baseURL"),withXsrfToken:at.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&m.merge(s.common,s[t.method]);s&&m.forEach(["delete","get","head","post","put","patch","common"],y=>{delete s[y]}),t.headers=Je.concat(o,s);let l=[],c=!0;this.interceptors.request.forEach(n(function(q){typeof q.runWhen=="function"&&q.runWhen(t)===!1||(c=c&&q.synchronous,l.unshift(q.fulfilled,q.rejected))},"unshiftRequestInterceptors"));let h=[];this.interceptors.response.forEach(n(function(q){h.push(q.fulfilled,q.rejected)},"pushResponseInterceptors"));let p,w=0,E;if(!c){let y=[g_.bind(this),void 0];for(y.unshift(...l),y.push(...h),E=y.length,p=Promise.resolve(t);w<E;)p=p.then(y[w++],y[w++]);return p}E=l.length;let P=t;for(;w<E;){let y=l[w++],q=l[w++];try{P=y(P)}catch(v){q.call(this,v);break}}try{p=g_.call(this,P)}catch(y){return Promise.reject(y)}for(w=0,E=h.length;w<E;)p=p.then(h[w++],h[w++]);return p}getUri(e){e=tr(this.defaults,e);let t=j_(e.baseURL,e.url,e.allowAbsoluteUrls);return T_(t,e.params,e.paramsSerializer)}};m.forEach(["delete","get","head","options"],n(function(e){Hr.prototype[e]=function(t,r){return this.request(tr(r||{},{method:e,url:t,data:(r||{}).data}))}},"forEachMethodNoData"));m.forEach(["post","put","patch"],n(function(e){function t(r){return n(function(s,o,l){return this.request(tr(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}n(t,"generateHTTPMethod"),Hr.prototype[e]=t(),Hr.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var ss=Hr,ic=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 qr(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}}},rS=ic;function iS(i){return n(function(t){return i.apply(null,t)},"wrap")}n(iS,"spread");function nS(i){return m.isObject(i)&&i.isAxiosError===!0}n(nS,"isAxiosError");var nc={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(nc).forEach(([i,e])=>{nc[e]=i});var aS=nc;function N_(i){let e=new ss(i),t=x_(ss.prototype.request,e);return m.extend(t,ss.prototype,e,{allOwnKeys:!0}),m.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return N_(tr(i,a))},"create"),t}n(N_,"createInstance");var ae=N_(uc);ae.Axios=ss;ae.CanceledError=qr;ae.CancelToken=rS;ae.isCancel=B_;ae.VERSION=F_;ae.toFormData=ds;ae.AxiosError=T;ae.Cancel=ae.CanceledError;ae.all=n(function(e){return Promise.all(e)},"all");ae.spread=iS;ae.isAxiosError=nS;ae.mergeConfig=tr;ae.AxiosHeaders=Je;ae.formToJSON=i=>U_(m.isHTMLForm(i)?new FormData(i):i);ae.getAdapter=L_.getAdapter;ae.HttpStatusCode=aS;ae.default=ae;Q_.exports=ae});var g={};bw(g,{__addDisposableResource:()=>_y,__assign:()=>ps,__asyncDelegator:()=>oy,__asyncGenerator:()=>sy,__asyncValues:()=>ly,__await:()=>Er,__awaiter:()=>ey,__classPrivateFieldGet:()=>hy,__classPrivateFieldIn:()=>my,__classPrivateFieldSet:()=>py,__createBinding:()=>_s,__decorate:()=>$_,__disposeResources:()=>yy,__esDecorate:()=>K_,__exportStar:()=>ry,__extends:()=>W_,__generator:()=>ty,__importDefault:()=>dy,__importStar:()=>cy,__makeTemplateObject:()=>uy,__metadata:()=>Y_,__param:()=>z_,__propKey:()=>Z_,__read:()=>pc,__rest:()=>V_,__rewriteRelativeImportExtension:()=>fy,__runInitializers:()=>J_,__setFunctionName:()=>X_,__spread:()=>iy,__spreadArray:()=>ay,__spreadArrays:()=>ny,__values:()=>ms,default:()=>lS});function W_(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");dc(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function V_(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 $_(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 z_(i,e){return function(t,r){e(t,r,i)}}function K_(i,e,t,r,a,s){function o(B){if(B!==void 0&&typeof B!="function")throw new TypeError("Function expected");return B}n(o,"accept");for(var l=r.kind,c=l==="getter"?"get":l==="setter"?"set":"value",h=!e&&i?r.static?i:i.prototype:null,p=e||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),w,E=!1,P=t.length-1;P>=0;P--){var y={};for(var q in r)y[q]=q==="access"?{}:r[q];for(var q in r.access)y.access[q]=r.access[q];y.addInitializer=function(B){if(E)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(B||null))};var v=(0,t[P])(l==="accessor"?{get:p.get,set:p.set}:p[c],y);if(l==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(w=o(v.get))&&(p.get=w),(w=o(v.set))&&(p.set=w),(w=o(v.init))&&a.unshift(w)}else(w=o(v))&&(l==="field"?a.unshift(w):p[c]=w)}h&&Object.defineProperty(h,r.name,p),E=!0}function J_(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 Z_(i){return typeof i=="symbol"?i:"".concat(i)}function X_(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 Y_(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function ey(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(w){o(w)}}n(l,"fulfilled");function c(p){try{h(r.throw(p))}catch(w){o(w)}}n(c,"rejected");function h(p){p.done?s(p.value):a(p.value).then(l,c)}n(h,"step"),h((r=r.apply(i,e||[])).next())})}function ty(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 c([h,p])}}function c(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 ry(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&_s(e,i,t)}function ms(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 pc(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 iy(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(pc(arguments[e]));return i}function ny(){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 ay(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 Er(i){return this instanceof Er?(this.v=i,this):new Er(i)}function sy(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(P){return function(y){return Promise.resolve(y).then(P,w)}}function l(P,y){r[P]&&(a[P]=function(q){return new Promise(function(v,B){s.push([P,q,v,B])>1||c(P,q)})},y&&(a[P]=y(a[P])))}function c(P,y){try{h(r[P](y))}catch(q){E(s[0][3],q)}}function h(P){P.value instanceof Er?Promise.resolve(P.value.v).then(p,w):E(s[0][2],P)}function p(P){c("next",P)}function w(P){c("throw",P)}function E(P,y){P(y),s.shift(),s.length&&c(s[0][0],s[0][1])}}function oy(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:Er(i[a](o)),done:!1}:s?s(o):o}:s}}function ly(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 ms=="function"?ms(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,c){o=i[s](o),a(l,c,o.done,o.value)})}}function a(s,o,l,c){Promise.resolve(c).then(function(h){s({value:h,done:l})},o)}}function uy(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function cy(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=hc(i),r=0;r<t.length;r++)t[r]!=="default"&&_s(e,i,t[r]);return sS(e,i),e}function dy(i){return i&&i.__esModule?i:{default:i}}function hy(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 py(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 my(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 _y(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 yy(i){function e(s){i.error=i.hasError?new oS(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()}function fy(i,e){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,a,s,o){return r?e?".jsx":".js":a&&(!s||!o)?t:a+s+"."+o.toLowerCase()+"js"}):i}var dc,ps,_s,sS,hc,oS,lS,b=gw(()=>{dc=n(function(i,e){return dc=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])},dc(i,e)},"extendStatics");n(W_,"__extends");ps=n(function(){return ps=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"),ps.apply(this,arguments)},"__assign");n(V_,"__rest");n($_,"__decorate");n(z_,"__param");n(K_,"__esDecorate");n(J_,"__runInitializers");n(Z_,"__propKey");n(X_,"__setFunctionName");n(Y_,"__metadata");n(ey,"__awaiter");n(ty,"__generator");_s=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(ry,"__exportStar");n(ms,"__values");n(pc,"__read");n(iy,"__spread");n(ny,"__spreadArrays");n(ay,"__spreadArray");n(Er,"__await");n(sy,"__asyncGenerator");n(oy,"__asyncDelegator");n(ly,"__asyncValues");n(uy,"__makeTemplateObject");sS=Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e},hc=n(function(i){return hc=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},hc(i)},"ownKeys");n(cy,"__importStar");n(dy,"__importDefault");n(hy,"__classPrivateFieldGet");n(py,"__classPrivateFieldSet");n(my,"__classPrivateFieldIn");n(_y,"__addDisposableResource");oS=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(yy,"__disposeResources");n(fy,"__rewriteRelativeImportExtension");lS={__extends:W_,__assign:ps,__rest:V_,__decorate:$_,__param:z_,__esDecorate:K_,__runInitializers:J_,__propKey:Z_,__setFunctionName:X_,__metadata:Y_,__awaiter:ey,__generator:ty,__createBinding:_s,__exportStar:ry,__values:ms,__read:pc,__spread:iy,__spreadArrays:ny,__spreadArray:ay,__await:Er,__asyncGenerator:sy,__asyncDelegator:oy,__asyncValues:ly,__makeTemplateObject:uy,__importStar:cy,__importDefault:dy,__classPrivateFieldGet:hy,__classPrivateFieldSet:py,__classPrivateFieldIn:my,__addDisposableResource:_y,__disposeResources:yy,__rewriteRelativeImportExtension:fy}});var yi=u((xU,gy)=>{gy.exports.isNode=!1});var rr=u(Rt=>{"use strict";var Tt;Object.defineProperty(Rt,"__esModule",{value:!0});Rt.LogLevelToConsoleFunction=Rt.resolveLogLevel=Rt.LogLevel=void 0;var uS=yi(),qe;(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"})(qe||(qe={}));Rt.LogLevel=qe;function cS(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(qe,i))return i;var e=Object.keys(qe).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):qe.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(qe,t))throw new Error("Unknown log level string: ".concat(i));return qe[t]}n(cS,"resolveLogLevel");Rt.resolveLogLevel=cS;var dS=uS.isNode?console.log.bind(console):console.debug.bind(console);Rt.LogLevelToConsoleFunction=(Tt={},Tt[qe.CRITICAL]=console.error.bind(console),Tt[qe.ERROR]=console.error.bind(console),Tt[qe.WARNING]=console.warn.bind(console),Tt[qe.INFO]=console.info.bind(console),Tt[qe.DEBUG]=dS.bind(console),Tt[qe.TRACE]=console.trace.bind(console),Tt)});var by=u(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.Enumerable=void 0;function hS(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(hS,"Enumerable");ys.Enumerable=hS});var wy=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.flatten=void 0;var xy=(b(),x(g));function pS(i){var e;return(e=[]).concat.apply(e,xy.__spreadArray([],xy.__read(i),!1))}n(pS,"flatten");fs.flatten=pS});var vy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.immutableSplice=void 0;var Pr=(b(),x(g));function mS(i,e,t){for(var r=[],a=3;a<arguments.length;a++)r[a-3]=arguments[a];return Pr.__spreadArray(Pr.__spreadArray(Pr.__spreadArray([],Pr.__read(i.slice(0,e)),!1),Pr.__read(r),!1),Pr.__read(i.slice(e+t)),!1)}n(mS,"immutableSplice");gs.immutableSplice=mS});var Sy=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.partitionedFlatMap=void 0;var mc=(b(),x(g));function _S(i,e,t){var r,a,s,o={};try{for(var l=mc.__values(i),c=l.next();!c.done;c=l.next()){var h=c.value,p=e(h),w=t(h);Array.isArray(w)||(w=[w]),Object.prototype.hasOwnProperty.call(o,p)?(s=o[p]).push.apply(s,mc.__spreadArray([],mc.__read(w),!1)):o[p]=w}}catch(E){r={error:E}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(_S,"partitionedFlatMap");bs.partitionedFlatMap=_S});var Cy=u(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.resolveConfigValueSync=Ar.resolveConfigValue=void 0;var Hy=(b(),x(g));function yS(i){return Hy.__awaiter(this,void 0,void 0,function(){return Hy.__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(yS,"resolveConfigValue");Ar.resolveConfigValue=yS;function fS(i){return typeof i=="function"?i():i}n(fS,"resolveConfigValueSync");Ar.resolveConfigValueSync=fS});var qy=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.deprecateClass=void 0;var _c=(b(),x(g));function gS(i,e){var t=!1;return(function(r){_c.__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,_c.__spreadArray([],_c.__read(s),!1))||this}return n(a,"class_1"),a})(i)}n(gS,"deprecateClass");xs.deprecateClass=gS});var Py=u(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.match=ir.eq=void 0;var Ey=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return Ey(i)},"on")}},"matched"),yc=n(function(i){return{on:n(function(e,t){return e(i)?Ey(t(i)):yc(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");ir.match=yc;var bS=n(function(i){return function(e){return i===e}},"eq");ir.eq=bS;yc.eq=ir.eq});var Dy=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.fibWithLimit=void 0;var Ay=(b(),x(g));function xS(i){var e,t,r;return Ay.__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=Ay.__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(xS,"fibWithLimit");ws.fibWithLimit=xS});var Ss=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.arrayToObject=void 0;var Iy=(b(),x(g));function wS(i,e){return Object.assign.apply(Object,Iy.__spreadArray([{}],Iy.__read(i.map(e)),!1))}n(wS,"arrayToObject");vs.arrayToObject=wS});var Ty=u(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.entriesToObject=void 0;var vS=(b(),x(g)),SS=Ss();function HS(i){return(0,SS.arrayToObject)(i,function(e){var t,r=vS.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(HS,"entriesToObject");Hs.entriesToObject=HS});var Ry=u(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.forEachObjectEntry=void 0;var CS=(b(),x(g));function qS(i,e){Object.entries(i).forEach(function(t){var r=CS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(qS,"forEachObjectEntry");Cs.forEachObjectEntry=qS});var Uy=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.groupBy=void 0;var ES=(b(),x(g));function PS(i,e){var t,r,a;if(typeof e!="function"){var s=e;e=n((function(w){return w[s].toString()}),"keyFn")}var o={};try{for(var l=ES.__values(i),c=l.next();!c.done;c=l.next()){var h=c.value,p=e(h);((a=o[p])!==null&&a!==void 0?a:o[p]=[]).push(h)}}catch(w){t={error:w}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return o}n(PS,"groupBy");qs.groupBy=PS});var By=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.indexBy=void 0;var AS=Ss();function DS(i,e){if(typeof e!="function"){var t=e;e=n((function(r){return r[t].toString()}),"keyFn")}return(0,AS.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(DS,"indexBy");Es.indexBy=DS});var Oy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.mapObject=void 0;var fc=(b(),x(g));function IS(i,e){var t=Object.entries(i).map(function(r){var a,s=fc.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,fc.__spreadArray([{}],fc.__read(t),!1))}n(IS,"mapObject");Ps.mapObject=IS});var gc=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.pick=void 0;var As=(b(),x(g));function TS(i,e){return Object.assign.apply(Object,As.__spreadArray([{}],As.__read(Object.entries(i).filter(function(t){var r=As.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=As.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(TS,"pick");Ds.pick=TS});var jy=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.omit=void 0;var RS=gc();function US(i,e){return(0,RS.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(US,"omit");Is.omit=US});var ky=u(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.mapOptional=Ut.mapNullable=Ut.isNullish=void 0;function bc(i){return i==null}n(bc,"isNullish");Ut.isNullish=bc;function BS(i,e){return bc(i)?null:e(i)}n(BS,"mapNullable");Ut.mapNullable=BS;function OS(i,e){return bc(i)?void 0:e(i)}n(OS,"mapOptional");Ut.mapOptional=OS});var Ly=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.delay=void 0;var My=(b(),x(g));function jS(i){return My.__awaiter(this,void 0,void 0,function(){return My.__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(jS,"delay");Ts.delay=jS});var Fy=u(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.promiseWithResolvers=void 0;function kS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(kS,"promiseWithResolvers");Rs.promiseWithResolvers=kS});var Ny=u(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.padLeft=void 0;function MS(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(MS,"padLeft");Us.padLeft=MS});var Qy=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.splitWithLimit=void 0;var xc=(b(),x(g));function LS(i,e,t){var r=i.split(e);return r.length<=t?r:xc.__spreadArray(xc.__spreadArray([],xc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(LS,"splitWithLimit");Bs.splitWithLimit=LS});var Gy=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.utf8Substring=Dr.utf8Length=void 0;var Os=(b(),x(g));function FS(i){return Os.__spreadArray([],Os.__read(i),!1).length}n(FS,"utf8Length");Dr.utf8Length=FS;function NS(i,e,t){return Os.__spreadArray([],Os.__read(i),!1).slice(e,t).join("")}n(NS,"utf8Substring");Dr.utf8Substring=NS});var C=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.immutableSplice=A.flatten=A.Enumerable=void 0;var QS=by();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return QS.Enumerable},"get")});var GS=wy();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return GS.flatten},"get")});var WS=vy();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return WS.immutableSplice},"get")});var VS=Sy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return VS.partitionedFlatMap},"get")});var Wy=Cy();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return Wy.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return Wy.resolveConfigValueSync},"get")});var $S=qy();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return $S.deprecateClass},"get")});var Vy=Py();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return Vy.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return Vy.eq},"get")});var zS=Dy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return zS.fibWithLimit},"get")});var KS=Ss();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return KS.arrayToObject},"get")});var JS=Ty();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return JS.entriesToObject},"get")});var ZS=Ry();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return ZS.forEachObjectEntry},"get")});var XS=Uy();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return XS.groupBy},"get")});var YS=By();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return YS.indexBy},"get")});var e0=Oy();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return e0.mapObject},"get")});var t0=jy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return t0.omit},"get")});var r0=gc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return r0.pick},"get")});var wc=ky();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return wc.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return wc.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return wc.mapOptional},"get")});var i0=Ly();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return i0.delay},"get")});var n0=Fy();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return n0.promiseWithResolvers},"get")});var a0=Ny();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return a0.padLeft},"get")});var s0=Qy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return s0.splitWithLimit},"get")});var $y=Gy();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return $y.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return $y.utf8Substring},"get")})});var Cc=u(ks=>{"use strict";var vc,Sc;Object.defineProperty(ks,"__esModule",{value:!0});ks.getMinLogLevelFromEnv=void 0;var o0=rr(),js=typeof process>"u"?[]:(Sc=(vc=process.env.LOGGING)===null||vc===void 0?void 0:vc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,o0.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&&Sc!==void 0?Sc:[],Hc=js.findIndex(function(i){var e=i[0];return!e}),zy=void 0;Hc!==-1&&(zy=js[Hc][1],js.splice(Hc));function l0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(l0,"isPrefix");function u0(i){for(var e=i.split(":"),t=0,r=js;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(l0(e,s))return o}return zy}n(u0,"getMinLogLevelFromEnv");ks.getMinLogLevelFromEnv=u0});var qc=u(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.BaseLogger=void 0;var c0=C(),d0=yi(),h0=Cc(),Bt=rr(),p0=(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,c=l===void 0?d0.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,c0.mapOptional)(r,function(w){return(0,Bt.resolveLogLevel)(w)}))!==null&&h!==void 0?h:(0,h0.getMinLogLevelFromEnv)(t))!==null&&p!==void 0?p:Bt.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=c}return n(i,"BaseLogger"),i.prototype.crit=function(e){this.log(Bt.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(Bt.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(Bt.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(Bt.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(Bt.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(Bt.LogLevel.TRACE,e)},i})();Ms.BaseLogger=p0});var Ky=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.BrowserLogger=void 0;var m0=(b(),x(g)),_0=rr(),y0=qc(),f0=(function(i){m0.__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=_0.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e})(y0.BaseLogger);Ls.BrowserLogger=f0});var Jy=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.CustomLoggerWrapper=void 0;var g0=C(),b0=Cc(),Be=rr(),x0=(function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,g0.mapOptional)(r,function(o){return(0,Be.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,b0.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(Be.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Be.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this._override.error?this._shouldLog(Be.LogLevel.ERROR)&&this._override.error(e):this.log(Be.LogLevel.ERROR,e)},i.prototype.warn=function(e){this._override.warn?this._shouldLog(Be.LogLevel.WARNING)&&this._override.warn(e):this.log(Be.LogLevel.WARNING,e)},i.prototype.info=function(e){this._override.info?this._shouldLog(Be.LogLevel.INFO)&&this._override.info(e):this.log(Be.LogLevel.INFO,e)},i.prototype.debug=function(e){this._override.debug?this._shouldLog(Be.LogLevel.DEBUG)&&this._override.debug(e):this.log(Be.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this._override.trace?this._shouldLog(Be.LogLevel.TRACE)&&this._override.trace(e):this.log(Be.LogLevel.TRACE,e)},i.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},i})();Fs.CustomLoggerWrapper=x0});var Zy=u(Ee=>{"use strict";var Ot,jt,kt;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.NodeLogger=Ee.LogLevelToBackgroundColor=Ee.LogLevelToColor=Ee.LogLevelToEmoji=void 0;var w0=(b(),x(g)),ne=rr(),v0=qc();Ee.LogLevelToEmoji=(Ot={},Ot[ne.LogLevel.CRITICAL]="\u{1F6D1}",Ot[ne.LogLevel.ERROR]="\u274C",Ot[ne.LogLevel.WARNING]="\u26A0\uFE0F ",Ot[ne.LogLevel.INFO]="\u2139\uFE0F ",Ot[ne.LogLevel.DEBUG]="\u{1F41E}",Ot[ne.LogLevel.TRACE]="\u{1F43E}",Ot);var S0={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},H0={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 Ns(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(Ns,"createGenericWrapper");function st(i){return Ns(S0[i],39)}n(st,"createColorWrapper");function fi(i,e){return Ns(H0[i],49,e)}n(fi,"createBgWrapper");Ee.LogLevelToColor=(jt={},jt[ne.LogLevel.CRITICAL]=st("red"),jt[ne.LogLevel.ERROR]=st("redBright"),jt[ne.LogLevel.WARNING]=st("yellow"),jt[ne.LogLevel.INFO]=st("blue"),jt[ne.LogLevel.DEBUG]=st("magenta"),jt[ne.LogLevel.TRACE]=Ns(0,0),jt);Ee.LogLevelToBackgroundColor=(kt={},kt[ne.LogLevel.CRITICAL]=fi("bgRed",st("white")),kt[ne.LogLevel.ERROR]=fi("bgRedBright",st("white")),kt[ne.LogLevel.WARNING]=fi("bgYellow",st("black")),kt[ne.LogLevel.INFO]=fi("bgBlue",st("white")),kt[ne.LogLevel.DEBUG]=fi("bgMagenta",st("black")),kt[ne.LogLevel.TRACE]=Ns(7,27),kt);var C0=(function(i){w0.__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=ne.LogLevelToConsoleFunction[t],c="";if(this._timestamps&&(c+="[".concat(new Date().toISOString(),"] ")),this._emoji){var h=Ee.LogLevelToEmoji[t];c+="".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?c+="".concat(Ee.LogLevelToBackgroundColor[t](this._name)," ").concat(Ee.LogLevelToBackgroundColor[t](ne.LogLevel[t])," ").concat(Ee.LogLevelToColor[t](r)):c+="[".concat(this._name,":").concat(ne.LogLevel[t].toLowerCase(),"] ").concat(r),l(c)}},e})(v0.BaseLogger);Ee.NodeLogger=C0});var Xy=u(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.createLogger=void 0;var q0=yi(),E0=Ky(),P0=Jy(),A0=Zy();function D0(i){return i.custom?new P0.CustomLoggerWrapper(i):q0.isNode?new A0.NodeLogger(i):new E0.BrowserLogger(i)}n(D0,"createLogger");Qs.createLogger=D0});var gi=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.LogLevel=Ir.createLogger=void 0;var I0=Xy();Object.defineProperty(Ir,"createLogger",{enumerable:!0,get:n(function(){return I0.createLogger},"get")});var T0=rr();Object.defineProperty(Ir,"LogLevel",{enumerable:!0,get:n(function(){return T0.LogLevel},"get")})});var Ws=u(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.CustomError=void 0;var Ec=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}};Gs.CustomError=Ec});var $s=u(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.RateLimiterDestroyedError=void 0;var R0=Ws(),Pc=class extends R0.CustomError{static{n(this,"RateLimiterDestroyedError")}};Vs.RateLimiterDestroyedError=Pc});var bi=u(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.RateLimitReachedError=void 0;var U0=Ws(),Ac=class extends U0.CustomError{static{n(this,"RateLimitReachedError")}};zs.RateLimitReachedError=Ac});var Ic=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.RetryAfterError=void 0;var B0=Ws(),Dc=class extends B0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Ks.RetryAfterError=Dc});var Yy=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.NullRateLimiter=void 0;var Tc=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};Js.NullRateLimiter=Tc});var Uc=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.ResponseBasedRateLimiter=void 0;var O0=gi(),j0=C(),k0=bi(),ef=Ic(),Rc=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,O0.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,j0.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:c,reject:h}=o;try{let p=await this.doRequest(l),w=this.needsToRetryAfter(p);if(w!==null)throw this._queue.unshift(o),this._logger.info(`Retrying after ${w} ms`),new ef.RetryAfterError(w);let E=this.getParametersFromResponse(p);return c(p),E}catch(p){if(p instanceof ef.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(c=>c.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,c)=>l?c.remaining<l.remaining?c:l:c,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(c=>{switch(c.limitReachedBehavior){case"enqueue":return!0;case"null":return c.resolve(null),!1;case"throw":return c.reject(new k0.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")}};Zs.ResponseBasedRateLimiter=Rc});var tf=u(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.PartitionedRateLimiter=void 0;var M0=Uc(),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 M0.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}};Xs.PartitionedRateLimiter=Bc});var nf=u(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.PartitionedTimeBasedRateLimiter=void 0;var L0=gi(),F0=bi(),rf=$s(),Oc=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._counterTimers=new Set,this._paused=!1,this._destroyed=!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;if(this._destroyed){a(new rf.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let l={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"},c=this._partitionKeyCallback(e),h=(o=this._usedFromBucket.get(c))!==null&&o!==void 0?o:0;if(h>=this._bucketSize||this._paused)switch(l.limitReachedBehavior){case"enqueue":{let p=this._getPartitionedQueue(c);p.push(l),h+p.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} for ${c?`partition ${c}`:"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 ${c?`partition ${c}`:"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 ${c?`partition ${c}`:"default partition"} because the rate limiter is paused`):this._logger.warn(`Rate limit of ${this._bucketSize} for ${c?`partition ${c}`:"default partition"} was reached, dropping request and returning null`);break}case"throw":{l.reject(new F0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":`the rate limit for ${c?`partition ${c}`:"default partition"} was reached`}`));break}default:throw new Error("this should never happen")}else this._runRequest(l,c)})}clear(){this._partitionedQueue.clear()}pause(){this._paused=!0}resume(){this._paused=!1;for(let e of this._partitionedQueue.keys())this._runNextRequest(e)}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._partitionedQueue.values())for(let t of e)t.reject(new rf.RateLimiterDestroyedError("Rate limiter was destroyed"));this._partitionedQueue.clear()}_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(c){l(c)}finally{let c=setTimeout(()=>{this._counterTimers.delete(c);let h=this._usedFromBucket.get(t)-1;this._usedFromBucket.set(t,h),a.length&&h<this._bucketSize&&this._runNextRequest(t)},this._timeFrame);this._counterTimers.add(c)}}_runNextRequest(e){if(this._paused)return;let r=this._getPartitionedQueue(e).shift();r&&this._runRequest(r,e)}};Ys.PartitionedTimeBasedRateLimiter=Oc});var kc=u(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.TimeBasedRateLimiter=void 0;var N0=gi(),Q0=bi(),af=$s(),jc=class{static{n(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a}){this._queue=[],this._usedFromBucket=0,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,N0.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;if(this._destroyed){a(new af.RateLimiterDestroyedError("Rate limiter was destroyed"));return}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 Q0.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()}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._queue)e.reject(new af.RateLimiterDestroyedError("Rate limiter was destroyed"));this._queue=[]}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{let s=setTimeout(()=>{this._counterTimers.delete(s),this._usedFromBucket-=1,this._queue.length&&this._usedFromBucket<this._bucketSize&&this._runNextRequest()},this._timeFrame);this._counterTimers.add(s)}}_runNextRequest(){if(this._paused)return;let e=this._queue.shift();e&&this._runRequest(e)}};eo.TimeBasedRateLimiter=jc});var sf=u(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.TimedPassthruRateLimiter=void 0;var G0=kc(),Mc=class extends G0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};to.TimedPassthruRateLimiter=Mc});var ro=u(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.TimedPassthruRateLimiter=se.TimeBasedRateLimiter=se.ResponseBasedRateLimiter=se.PartitionedTimeBasedRateLimiter=se.PartitionedRateLimiter=se.NullRateLimiter=se.RetryAfterError=se.RateLimitReachedError=se.RateLimiterDestroyedError=void 0;var W0=$s();Object.defineProperty(se,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return W0.RateLimiterDestroyedError},"get")});var V0=bi();Object.defineProperty(se,"RateLimitReachedError",{enumerable:!0,get:n(function(){return V0.RateLimitReachedError},"get")});var $0=Ic();Object.defineProperty(se,"RetryAfterError",{enumerable:!0,get:n(function(){return $0.RetryAfterError},"get")});var z0=Yy();Object.defineProperty(se,"NullRateLimiter",{enumerable:!0,get:n(function(){return z0.NullRateLimiter},"get")});var K0=tf();Object.defineProperty(se,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return K0.PartitionedRateLimiter},"get")});var J0=nf();Object.defineProperty(se,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return J0.PartitionedTimeBasedRateLimiter},"get")});var Z0=Uc();Object.defineProperty(se,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return Z0.ResponseBasedRateLimiter},"get")});var X0=kc();Object.defineProperty(se,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return X0.TimeBasedRateLimiter},"get")});var Y0=sf();Object.defineProperty(se,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return Y0.TimedPassthruRateLimiter},"get")})});var uf=u((ft,lf)=>{var of=typeof self<"u"?self:ft,io=(function(){function i(){this.fetch=!1,this.DOMException=of.DOMException}return n(i,"F"),i.prototype=of,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(f){return f&&DataView.prototype.isPrototypeOf(f)}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(f){return f&&s.indexOf(Object.prototype.toString.call(f))>-1};function l(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}n(l,"normalizeName");function c(f){return typeof f!="string"&&(f=String(f)),f}n(c,"normalizeValue");function h(f){var H={next:n(function(){var I=f.shift();return{done:I===void 0,value:I}},"next")};return r.iterable&&(H[Symbol.iterator]=function(){return H}),H}n(h,"iteratorFor");function p(f){this.map={},f instanceof p?f.forEach(function(H,I){this.append(I,H)},this):Array.isArray(f)?f.forEach(function(H){this.append(H[0],H[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(H){this.append(H,f[H])},this)}n(p,"Headers"),p.prototype.append=function(f,H){f=l(f),H=c(H);var I=this.map[f];this.map[f]=I?I+", "+H:H},p.prototype.delete=function(f){delete this.map[l(f)]},p.prototype.get=function(f){return f=l(f),this.has(f)?this.map[f]:null},p.prototype.has=function(f){return this.map.hasOwnProperty(l(f))},p.prototype.set=function(f,H){this.map[l(f)]=c(H)},p.prototype.forEach=function(f,H){for(var I in this.map)this.map.hasOwnProperty(I)&&f.call(H,this.map[I],I,this)},p.prototype.keys=function(){var f=[];return this.forEach(function(H,I){f.push(I)}),h(f)},p.prototype.values=function(){var f=[];return this.forEach(function(H){f.push(H)}),h(f)},p.prototype.entries=function(){var f=[];return this.forEach(function(H,I){f.push([I,H])}),h(f)},r.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function w(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}n(w,"consumed");function E(f){return new Promise(function(H,I){f.onload=function(){H(f.result)},f.onerror=function(){I(f.error)}})}n(E,"fileReaderReady");function P(f){var H=new FileReader,I=E(H);return H.readAsArrayBuffer(f),I}n(P,"readBlobAsArrayBuffer");function y(f){var H=new FileReader,I=E(H);return H.readAsText(f),I}n(y,"readBlobAsText");function q(f){for(var H=new Uint8Array(f),I=new Array(H.length),X=0;X<H.length;X++)I[X]=String.fromCharCode(H[X]);return I.join("")}n(q,"readArrayBufferAsText");function v(f){if(f.slice)return f.slice(0);var H=new Uint8Array(f.byteLength);return H.set(new Uint8Array(f)),H.buffer}n(v,"bufferClone");function B(){return this.bodyUsed=!1,this._initBody=function(f){this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:r.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:r.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():r.arrayBuffer&&r.blob&&a(f)?(this._bodyArrayBuffer=v(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||o(f))?this._bodyArrayBuffer=v(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="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(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var f=w(this);if(f)return f;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?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(P)}),this.text=function(){var f=w(this);if(f)return f;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(q(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(Ue)}),this.json=function(){return this.text().then(JSON.parse)},this}n(B,"Body");var ge=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function z(f){var H=f.toUpperCase();return ge.indexOf(H)>-1?H:f}n(z,"normalizeMethod");function k(f,H){H=H||{};var I=H.body;if(f instanceof k){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,H.headers||(this.headers=new p(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!I&&f._bodyInit!=null&&(I=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=H.credentials||this.credentials||"same-origin",(H.headers||!this.headers)&&(this.headers=new p(H.headers)),this.method=z(H.method||this.method||"GET"),this.mode=H.mode||this.mode||null,this.signal=H.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)}n(k,"Request"),k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function Ue(f){var H=new FormData;return f.trim().split("&").forEach(function(I){if(I){var X=I.split("="),$=X.shift().replace(/\+/g," "),O=X.join("=").replace(/\+/g," ");H.append(decodeURIComponent($),decodeURIComponent(O))}}),H}n(Ue,"decode");function yt(f){var H=new p,I=f.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(X){var $=X.split(":"),O=$.shift().trim();if(O){var He=$.join(":").trim();H.append(O,He)}}),H}n(yt,"parseHeaders"),B.call(k.prototype);function J(f,H){H||(H={}),this.type="default",this.status=H.status===void 0?200:H.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in H?H.statusText:"OK",this.headers=new p(H.headers),this.url=H.url||"",this._initBody(f)}n(J,"Response"),B.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},J.error=function(){var f=new J(null,{status:0,statusText:""});return f.type="error",f};var di=[301,302,303,307,308];J.redirect=function(f,H){if(di.indexOf(H)===-1)throw new RangeError("Invalid status code");return new J(null,{status:H,headers:{location:f}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(H,I){this.message=H,this.name=I;var X=Error(H);this.stack=X.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function Pt(f,H){return new Promise(function(I,X){var $=new k(f,H);if($.signal&&$.signal.aborted)return X(new t.DOMException("Aborted","AbortError"));var O=new XMLHttpRequest;function He(){O.abort()}n(He,"abortXhr"),O.onload=function(){var At={status:O.status,statusText:O.statusText,headers:yt(O.getAllResponseHeaders()||"")};At.url="responseURL"in O?O.responseURL:At.headers.get("X-Request-URL");var Le="response"in O?O.response:O.responseText;I(new J(Le,At))},O.onerror=function(){X(new TypeError("Network request failed"))},O.ontimeout=function(){X(new TypeError("Network request failed"))},O.onabort=function(){X(new t.DOMException("Aborted","AbortError"))},O.open($.method,$.url,!0),$.credentials==="include"?O.withCredentials=!0:$.credentials==="omit"&&(O.withCredentials=!1),"responseType"in O&&r.blob&&(O.responseType="blob"),$.headers.forEach(function(At,Le){O.setRequestHeader(Le,At)}),$.signal&&($.signal.addEventListener("abort",He),O.onreadystatechange=function(){O.readyState===4&&$.signal.removeEventListener("abort",He)}),O.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return n(Pt,"fetch"),Pt.polyfill=!0,i.fetch||(i.fetch=Pt,i.Headers=p,i.Request=k,i.Response=J),t.Headers=p,t.Request=k,t.Response=J,t.fetch=Pt,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(io);io.fetch.ponyfill=!0;delete io.fetch.polyfill;var Tr=io;ft=Tr.fetch;ft.default=Tr.fetch;ft.fetch=Tr.fetch;ft.Headers=Tr.Headers;ft.Request=Tr.Request;ft.Response=Tr.Response;lf.exports=ft});var no=u((XB,df)=>{"use strict";var Lc=Object.prototype.hasOwnProperty,Rr=Array.isArray,ot=(function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i})(),eH=n(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Rr(r)){for(var a=[],s=0;s<r.length;++s)typeof r[s]<"u"&&a.push(r[s]);t.obj[t.prop]=a}}},"compactQueue"),cf=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"),tH=n(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(Rr(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!Lc.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 Rr(e)&&!Rr(t)&&(a=cf(e,r)),Rr(e)&&Rr(t)?(t.forEach(function(s,o){if(Lc.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 Lc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),rH=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),iH=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"),nH=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(c){return"%26%23"+parseInt(c.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+ot[l];continue}if(l<2048){s=s+(ot[192|l>>6]+ot[128|l&63]);continue}if(l<55296||l>=57344){s=s+(ot[224|l>>12]+ot[128|l>>6&63]+ot[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|a.charCodeAt(o)&1023),s+=ot[240|l>>18]+ot[128|l>>12&63]+ot[128|l>>6&63]+ot[128|l&63]}return s},"encode"),aH=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),c=0;c<l.length;++c){var h=l[c],p=o[h];typeof p=="object"&&p!==null&&r.indexOf(p)===-1&&(t.push({obj:o,prop:h}),r.push(p))}return eH(t),e},"compact"),sH=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),oH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),lH=n(function(e,t){return[].concat(e,t)},"combine");df.exports={arrayToObject:cf,assign:rH,combine:lH,compact:aH,decode:iH,encode:nH,isBuffer:oH,isRegExp:sH,merge:tH}});var Fc=u((eO,pf)=>{"use strict";var uH=String.prototype.replace,cH=/%20/g,dH=no(),hf={RFC1738:"RFC1738",RFC3986:"RFC3986"};pf.exports=dH.assign({default:hf.RFC3986,formatters:{RFC1738:n(function(i){return uH.call(i,cH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},hf)});var gf=u((rO,ff)=>{"use strict";var yf=no(),xi=Fc(),hH=Object.prototype.hasOwnProperty,mf={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")},Ur=Array.isArray,pH=Array.prototype.push,Nc=n(function(i,e){pH.apply(i,Ur(e)?e:[e])},"pushToArray"),mH=Date.prototype.toISOString,_f=xi.default,ve={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:yf.encode,encodeValuesOnly:!1,format:_f,formatter:xi.formatters[_f],indices:!1,serializeDate:n(function(e){return mH.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},_H=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),yH=n(function i(e,t,r,a,s,o,l,c,h,p,w,E,P){var y=e;if(typeof l=="function"?y=l(t,y):y instanceof Date?y=p(y):r==="comma"&&Ur(y)&&(y=y.join(",")),y===null){if(a)return o&&!E?o(t,ve.encoder,P,"key"):t;y=""}if(_H(y)||yf.isBuffer(y)){if(o){var q=E?t:o(t,ve.encoder,P,"key");return[w(q)+"="+w(o(y,ve.encoder,P,"value"))]}return[w(t)+"="+w(String(y))]}var v=[];if(typeof y>"u")return v;var B;if(Ur(l))B=l;else{var ge=Object.keys(y);B=c?ge.sort(c):ge}for(var z=0;z<B.length;++z){var k=B[z];s&&y[k]===null||(Ur(y)?Nc(v,i(y[k],typeof r=="function"?r(t,k):t,r,a,s,o,l,c,h,p,w,E,P)):Nc(v,i(y[k],t+(h?"."+k:"["+k+"]"),r,a,s,o,l,c,h,p,w,E,P)))}return v},"stringify"),fH=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=xi.default;if(typeof e.format<"u"){if(!hH.call(xi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=xi.formatters[r],s=ve.filter;return(typeof e.filter=="function"||Ur(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");ff.exports=function(i,e){var t=i,r=fH(e),a,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):Ur(r.filter)&&(s=r.filter,a=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in mf?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var c=mf[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||Nc(o,yH(t[p],p,c,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.formatter,r.encodeValuesOnly,r.charset))}var w=o.join(r.delimiter),E=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?E+="utf8=%26%2310003%3B&":E+="utf8=%E2%9C%93&"),w.length>0?E+w:""}});var vf=u((nO,wf)=>{"use strict";var wi=no(),Qc=Object.prototype.hasOwnProperty,bf=Array.isArray,be={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:wi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},gH=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),xf=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),bH=n(function(e,t){if(bf(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),xH="utf8=%26%2310003%3B",wH="utf8=%E2%9C%93",vH=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,c,h=t.charset;if(t.charsetSentinel)for(c=0;c<o.length;++c)o[c].indexOf("utf8=")===0&&(o[c]===wH?h="utf-8":o[c]===xH&&(h="iso-8859-1"),l=c,c=o.length);for(c=0;c<o.length;++c)if(c!==l){var p=o[c],w=p.indexOf("]="),E=w===-1?p.indexOf("="):w+1,P,y;E===-1?(P=t.decoder(p,be.decoder,h,"key"),y=t.strictNullHandling?null:""):(P=t.decoder(p.slice(0,E),be.decoder,h,"key"),y=bH(xf(p.slice(E+1),t),function(q){return t.decoder(q,be.decoder,h,"value")})),y&&t.interpretNumericEntities&&h==="iso-8859-1"&&(y=gH(y)),p.indexOf("[]=")>-1&&(y=bf(y)?[y]:y),Qc.call(r,P)?r[P]=wi.combine(r[P],y):r[P]=y}return r},"parseQueryStringValues"),SH=n(function(i,e,t,r){for(var a=r?e:xf(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 c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,h=parseInt(c,10);!t.parseArrays&&c===""?o={0:a}:!isNaN(h)&&l!==c&&String(h)===c&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=a):o[c]=a}a=o}return a},"parseObject"),HH=n(function(e,t,r,a){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,c=r.depth>0&&o.exec(s),h=c?s.slice(0,c.index):s,p=[];if(h){if(!r.plainObjects&&Qc.call(Object.prototype,h)&&!r.allowPrototypes)return;p.push(h)}for(var w=0;r.depth>0&&(c=l.exec(s))!==null&&w<r.depth;){if(w+=1,!r.plainObjects&&Qc.call(Object.prototype,c[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(c[1])}return c&&p.push("["+s.slice(c.index)+"]"),SH(p,t,r,a)}},"parseQueryStringKeys"),CH=n(function(e){if(!e)return be;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"?be.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?be.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:be.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:be.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:be.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:be.comma,decoder:typeof e.decoder=="function"?e.decoder:be.decoder,delimiter:typeof e.delimiter=="string"||wi.isRegExp(e.delimiter)?e.delimiter:be.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:be.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:be.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:be.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:be.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:be.strictNullHandling}},"normalizeParseOptions");wf.exports=function(i,e){var t=CH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?vH(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],c=HH(l,r[l],t,typeof i=="string");a=wi.merge(a,c,t)}return wi.compact(a)}});var Gc=u((sO,Sf)=>{"use strict";var qH=gf(),EH=vf(),PH=Fc();Sf.exports={formats:PH,parse:EH,stringify:qH}});var Cf=u(Hf=>{function gt(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]=gt(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:gt(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=gt(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=gt(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(a){t.add(gt(a))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(a,s){t.set(gt(s),gt(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(gt(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}n(gt,"klona");Hf.klona=gt});var Vc=u(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.DataObject=lt.getRawData=lt.rawDataSymbol=void 0;var AH=Cf();lt.rawDataSymbol=Symbol("twurpleRawData");function DH(i){return(0,AH.klona)(i[lt.rawDataSymbol])}n(DH,"getRawData");lt.getRawData=DH;var Wc=class{static{n(this,"DataObject")}constructor(e){this[lt.rawDataSymbol]=e}};lt.DataObject=Wc});var so=u(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.CustomError=void 0;var $c=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}};ao.CustomError=$c});var Kc=u(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.RelationAssertionError=void 0;var IH=so(),zc=class extends IH.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};oo.RelationAssertionError=zc});var qf=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.checkRelationAssertion=void 0;var TH=Kc();function RH(i){if(i==null)throw new TH.RelationAssertionError;return i}n(RH,"checkRelationAssertion");lo.checkRelationAssertion=RH});var Jc=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.rtfm=void 0;function UH(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(UH,"rtfm");uo.rtfm=UH});var Ef=u(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.HelixExtension=void 0;var BH=(b(),x(g)),D=Vc(),OH=Jc(),Zc=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 viewerSummary(){return this[D.rawDataSymbol].viewer_summary}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}};vi.HelixExtension=Zc;vi.HelixExtension=Zc=BH.__decorate([(0,OH.rtfm)("api","HelixExtension","id")],Zc)});var Pf=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.HellFreezesOverError=void 0;var jH=so(),Xc=class extends jH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};co.HellFreezesOverError=Xc});var Af=u(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.extractUserName=Br.extractUserId=void 0;function kH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(kH,"extractUserId");Br.extractUserId=kH;function MH(i){return typeof i=="string"?i:i.name}n(MH,"extractUserName");Br.extractUserName=MH});var _=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 Yc=Vc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return Yc.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return Yc.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return Yc.rawDataSymbol},"get")});var LH=qf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return LH.checkRelationAssertion},"get")});var FH=Jc();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return FH.rtfm},"get")});var NH=Ef();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return NH.HelixExtension},"get")});var QH=so();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return QH.CustomError},"get")});var GH=Pf();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return GH.HellFreezesOverError},"get")});var WH=Kc();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return WH.RelationAssertionError},"get")});var Df=Af();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return Df.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return Df.extractUserName},"get")})});var td=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.HttpStatusCodeError=void 0;var VH=_(),ed=class extends VH.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
9
  Method: ${a}
10
10
  Body:
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}};lo.HttpStatusCodeError=Xc});var ed=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.transformTwitchApiResponse=Ir.handleTwitchApiResponseError=void 0;var FH=Nc(),NH=Yc();async function QH(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,FH.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new NH.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(QH,"handleTwitchApiResponseError");Ir.handleTwitchApiResponseError=QH;async function GH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(GH,"transformTwitchApiResponse");Ir.transformTwitchApiResponse=GH});var Cf=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.getTwitchApiUrl=void 0;function WH(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(WH,"getTwitchApiUrl");uo.getTwitchApiUrl=WH});var Af=u(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callTwitchApi=Tr.callTwitchApiRaw=void 0;var qf=rf(),VH=Nc(),Ef=ed(),$H=Cf();async function Pf(i,e,t,r,a={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",h=(0,$H.getTwitchApiUrl)(i.url,d,s),p=(0,VH.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),x=new qf.Headers({Accept:"application/json"}),q;i.jsonBody&&(q=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 E={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:x,body:q};return await(0,qf.default)(`${h}${p}`,E)}n(Pf,"callTwitchApiRaw");Tr.callTwitchApiRaw=Pf;async function zH(i,e,t,r,a={}){let s=await Pf(i,e,t,r,a);return await(0,Ef.handleTwitchApiResponseError)(s,i),await(0,Ef.transformTwitchApiResponse)(s)}n(zH,"callTwitchApi");Tr.callTwitchApi=zH});var Df=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.createBroadcasterQuery=void 0;var KH=m();function JH(i){return{broadcaster_id:(0,KH.extractUserId)(i)}}n(JH,"createBroadcasterQuery");co.createBroadcasterQuery=JH});var Z=u(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.HttpStatusCodeError=Pe.transformTwitchApiResponse=Pe.handleTwitchApiResponseError=Pe.createBroadcasterQuery=Pe.callTwitchApiRaw=Pe.callTwitchApi=void 0;var If=Af();Object.defineProperty(Pe,"callTwitchApi",{enumerable:!0,get:n(function(){return If.callTwitchApi},"get")});Object.defineProperty(Pe,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return If.callTwitchApiRaw},"get")});var ZH=Df();Object.defineProperty(Pe,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return ZH.createBroadcasterQuery},"get")});var Tf=ed();Object.defineProperty(Pe,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return Tf.handleTwitchApiResponseError},"get")});Object.defineProperty(Pe,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return Tf.transformTwitchApiResponse},"get")});var XH=Yc();Object.defineProperty(Pe,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return XH.HttpStatusCodeError},"get")})});var rd=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.ConfigError=void 0;var YH=m(),td=class extends YH.CustomError{static{n(this,"ConfigError")}};ho.ConfigError=td});var Rf=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.HelixRateLimiter=void 0;var eC=Ys(),tC=Z(),id=class extends eC.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,tC.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}}};po.HelixRateLimiter=id});var bi=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.createCacheKey=void 0;function rC(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(rC,"createSingleCacheKey");function iC(i,e,t){return[i,...e.map(rC)].join("/")+(t?"/":"")}n(iC,"createCacheKey");mo.createCacheKey=iC});var Uf=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.Cacheable=void 0;var nC=bi(),ft=Symbol("cache");function aC(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[ft].has(r)){let a=this[ft].get(r);if(a)return a.value}}setCache(r,a,s){this[ft].set(r,{value:a,expires:Date.now()+s*1e3})}removeFromCache(r,a){let s=this._getInternalCacheKey(r,a);a?this[ft].forEach((o,l)=>{l.startsWith(s)&&this[ft].delete(l)}):this[ft].delete(s)}_cleanCache(){let r=Date.now();this[ft].forEach((a,s)=>{a.expires<r&&this[ft].delete(s)})}_getInternalCacheKey(r,a){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,nC.createCacheKey)(s,r,a)}}},e=ft,t}n(aC,"Cacheable");_o.Cacheable=aC});var Bf=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.Cached=void 0;var sC=bi();function oC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,sC.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(oC,"Cached");yo.Cached=oC});var Of=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.CachedGetter=void 0;var lC=bi();function uC(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,lC.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(uC,"CachedGetter");fo.CachedGetter=uC});var jf=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.ClearsCache=void 0;function cC(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(cC,"ClearsCache");go.ClearsCache=cC});var xi=u(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.createCacheKey=ke.ClearsCache=ke.CachedGetter=ke.Cached=ke.Cacheable=void 0;var dC=Uf();Object.defineProperty(ke,"Cacheable",{enumerable:!0,get:n(function(){return dC.Cacheable},"get")});var hC=Bf();Object.defineProperty(ke,"Cached",{enumerable:!0,get:n(function(){return hC.Cached},"get")});var pC=Of();Object.defineProperty(ke,"CachedGetter",{enumerable:!0,get:n(function(){return pC.CachedGetter},"get")});var mC=jf();Object.defineProperty(ke,"ClearsCache",{enumerable:!0,get:n(function(){return mC.ClearsCache},"get")});var _C=bi();Object.defineProperty(ke,"createCacheKey",{enumerable:!0,get:n(function(){return _C.createCacheKey},"get")})});var ad=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.Listener=void 0;var nd=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)}};bo.Listener=nd});var kf=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.EventEmitter=void 0;var yC=ad(),sd=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 yC.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)}}};xo.EventEmitter=sd});var od=u(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Listener=Rr.EventEmitter=void 0;var fC=kf();Object.defineProperty(Rr,"EventEmitter",{enumerable:!0,get:n(function(){return fC.EventEmitter},"get")});var gC=ad();Object.defineProperty(Rr,"Listener",{enumerable:!0,get:n(function(){return gC.Listener},"get")})});var wo=u(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.accessTokenIsExpired=Ur.getExpiryDateOfAccessToken=void 0;var ld=C(),bC=6e4;function Mf(i){return(0,ld.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-bC)}n(Mf,"getExpiryMillis");function xC(i){return(0,ld.mapNullable)(Mf(i),e=>new Date(e))}n(xC,"getExpiryDateOfAccessToken");Ur.getExpiryDateOfAccessToken=xC;function wC(i){var e;return(e=(0,ld.mapNullable)(Mf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(wC,"accessTokenIsExpired");Ur.accessTokenIsExpired=wC});var So=u(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.InvalidTokenError=void 0;var vC=m(),ud=class extends vC.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};vo.InvalidTokenError=ud});var Co=u(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.InvalidTokenTypeError=void 0;var SC=m(),cd=class extends SC.CustomError{static{n(this,"InvalidTokenTypeError")}};Ho.InvalidTokenTypeError=cd});var Lf=u(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.createRevokeTokenQuery=lt.createRefreshTokenQuery=lt.createGetAppTokenQuery=lt.createExchangeCodeQuery=void 0;function HC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(HC,"createExchangeCodeQuery");lt.createExchangeCodeQuery=HC;function CC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(CC,"createGetAppTokenQuery");lt.createGetAppTokenQuery=CC;function qC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(qC,"createRefreshTokenQuery");lt.createRefreshTokenQuery=qC;function EC(i,e){return{client_id:i,token:e}}n(EC,"createRevokeTokenQuery");lt.createRevokeTokenQuery=EC});var hd=u(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.TokenInfo=void 0;var PC=(f(),b(y)),AC=C(),Yt=m(),dd=class extends Yt.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[Yt.rawDataSymbol].client_id}get userId(){var e;return(e=this[Yt.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[Yt.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[Yt.rawDataSymbol].scopes}get expiryDate(){return(0,AC.mapNullable)(this[Yt.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};wi.TokenInfo=dd;wi.TokenInfo=dd=PC.__decorate([(0,Yt.rtfm)("auth","TokenInfo","clientId")],dd)});var Si=u(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.loadAndCompareTokenInfo=X.compareScopeSets=X.compareScopes=X.getValidTokenFromProviderForIntent=X.getValidTokenFromProviderForUser=X.getTokenInfo=X.revokeToken=X.refreshUserToken=X.getAppToken=X.exchangeCode=void 0;var Br=Z(),vi=So(),DC=Co(),qo=Lf(),IC=hd();function pd(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(pd,"createAccessTokenFromData");async function TC(i,e,t,r){return pd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,qo.createExchangeCodeQuery)(i,e,t,r)}))}n(TC,"exchangeCode");X.exchangeCode=TC;async function RC(i,e){return pd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,qo.createGetAppTokenQuery)(i,e)}))}n(RC,"getAppToken");X.getAppToken=RC;async function UC(i,e,t){return pd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,qo.createRefreshTokenQuery)(i,e,t)}))}n(UC,"refreshUserToken");X.refreshUserToken=UC;async function BC(i,e){await(0,Br.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,qo.createRevokeTokenQuery)(i,e)})}n(BC,"revokeToken");X.revokeToken=BC;async function Or(i,e){try{let t=await(0,Br.callTwitchApi)({type:"auth",url:"validate"},e,i);return new IC.TokenInfo(t)}catch(t){throw t instanceof Br.HttpStatusCodeError&&t.statusCode===401?new vi.InvalidTokenError({cause:t}):t}}n(Or,"getTokenInfo");X.getTokenInfo=Or;async function OC(i,e,t,r){let a=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await Or(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof vi.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 Or(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof vi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(OC,"getValidTokenFromProviderForUser");X.getValidTokenFromProviderForUser=OC;async function jC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new DC.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 Or(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof vi.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 Or(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof vi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(jC,"getValidTokenFromProviderForIntent");X.getValidTokenFromProviderForIntent=jC;var kC=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 Ff(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=kC.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.
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}};ho.HttpStatusCodeError=ed});var rd=u(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.transformTwitchApiResponse=Or.handleTwitchApiResponseError=void 0;var $H=Gc(),zH=td();async function KH(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,$H.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new zH.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(KH,"handleTwitchApiResponseError");Or.handleTwitchApiResponseError=KH;async function JH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(JH,"transformTwitchApiResponse");Or.transformTwitchApiResponse=JH});var If=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.getTwitchApiUrl=void 0;function ZH(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(ZH,"getTwitchApiUrl");po.getTwitchApiUrl=ZH});var Bf=u(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callTwitchApi=jr.callTwitchApiRaw=void 0;var Tf=uf(),XH=Gc(),Rf=rd(),YH=If();async function Uf(i,e,t,r,a={},s){var o,l;let c=(o=i.type)!==null&&o!==void 0?o:"helix",h=(0,YH.getTwitchApiUrl)(i.url,c,s),p=(0,XH.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),w=new Tf.Headers({Accept:"application/json"}),E;i.jsonBody&&(E=JSON.stringify(i.jsonBody),w.append("Content-Type","application/json")),e&&c!=="auth"&&w.append("Client-ID",e),t&&w.append("Authorization",`${c==="helix"?r??"Bearer":"OAuth"} ${t}`);let P={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:w,body:E};return await(0,Tf.default)(`${h}${p}`,P)}n(Uf,"callTwitchApiRaw");jr.callTwitchApiRaw=Uf;async function eC(i,e,t,r,a={}){let s=await Uf(i,e,t,r,a);return await(0,Rf.handleTwitchApiResponseError)(s,i),await(0,Rf.transformTwitchApiResponse)(s)}n(eC,"callTwitchApi");jr.callTwitchApi=eC});var Of=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.createBroadcasterQuery=void 0;var tC=_();function rC(i){return{broadcaster_id:(0,tC.extractUserId)(i)}}n(rC,"createBroadcasterQuery");mo.createBroadcasterQuery=rC});var Y=u(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.HttpStatusCodeError=Pe.transformTwitchApiResponse=Pe.handleTwitchApiResponseError=Pe.createBroadcasterQuery=Pe.callTwitchApiRaw=Pe.callTwitchApi=void 0;var jf=Bf();Object.defineProperty(Pe,"callTwitchApi",{enumerable:!0,get:n(function(){return jf.callTwitchApi},"get")});Object.defineProperty(Pe,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return jf.callTwitchApiRaw},"get")});var iC=Of();Object.defineProperty(Pe,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return iC.createBroadcasterQuery},"get")});var kf=rd();Object.defineProperty(Pe,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return kf.handleTwitchApiResponseError},"get")});Object.defineProperty(Pe,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return kf.transformTwitchApiResponse},"get")});var nC=td();Object.defineProperty(Pe,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return nC.HttpStatusCodeError},"get")})});var nd=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.ConfigError=void 0;var aC=_(),id=class extends aC.CustomError{static{n(this,"ConfigError")}};_o.ConfigError=id});var Mf=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.HelixRateLimiter=void 0;var sC=ro(),oC=Y(),ad=class extends sC.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,oC.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}}};yo.HelixRateLimiter=ad});var Si=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.createCacheKey=void 0;function lC(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(lC,"createSingleCacheKey");function uC(i,e,t){return[i,...e.map(lC)].join("/")+(t?"/":"")}n(uC,"createCacheKey");fo.createCacheKey=uC});var Lf=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.Cacheable=void 0;var cC=Si(),bt=Symbol("cache");function dC(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[bt].has(r)){let a=this[bt].get(r);if(a)return a.value}}setCache(r,a,s){this[bt].set(r,{value:a,expires:Date.now()+s*1e3})}removeFromCache(r,a){let s=this._getInternalCacheKey(r,a);a?this[bt].forEach((o,l)=>{l.startsWith(s)&&this[bt].delete(l)}):this[bt].delete(s)}_cleanCache(){let r=Date.now();this[bt].forEach((a,s)=>{a.expires<r&&this[bt].delete(s)})}_getInternalCacheKey(r,a){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,cC.createCacheKey)(s,r,a)}}},e=bt,t}n(dC,"Cacheable");go.Cacheable=dC});var Ff=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.Cached=void 0;var hC=Si();function pC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,hC.createCacheKey)(r,o),c=this.getFromCache(l);if(c)return c;let h=await s.apply(this,o);return(h!=null||e)&&this.setCache(l,h,i),h},a}}n(pC,"Cached");bo.Cached=pC});var Nf=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.CachedGetter=void 0;var mC=Si();function _C(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,mC.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(_C,"CachedGetter");xo.CachedGetter=_C});var Qf=u(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.ClearsCache=void 0;function yC(i,e){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=await s.apply(this,o),c=e===void 0?o.slice():o.slice(0,e);return this.removeFromCache([i,...c],!0),l},a}}n(yC,"ClearsCache");wo.ClearsCache=yC});var Hi=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createCacheKey=Fe.ClearsCache=Fe.CachedGetter=Fe.Cached=Fe.Cacheable=void 0;var fC=Lf();Object.defineProperty(Fe,"Cacheable",{enumerable:!0,get:n(function(){return fC.Cacheable},"get")});var gC=Ff();Object.defineProperty(Fe,"Cached",{enumerable:!0,get:n(function(){return gC.Cached},"get")});var bC=Nf();Object.defineProperty(Fe,"CachedGetter",{enumerable:!0,get:n(function(){return bC.CachedGetter},"get")});var xC=Qf();Object.defineProperty(Fe,"ClearsCache",{enumerable:!0,get:n(function(){return xC.ClearsCache},"get")});var wC=Si();Object.defineProperty(Fe,"createCacheKey",{enumerable:!0,get:n(function(){return wC.createCacheKey},"get")})});var od=u(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.Listener=void 0;var sd=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)}};vo.Listener=sd});var Gf=u(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.EventEmitter=void 0;var vC=od(),ld=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 vC.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=ld});var ud=u(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.Listener=kr.EventEmitter=void 0;var SC=Gf();Object.defineProperty(kr,"EventEmitter",{enumerable:!0,get:n(function(){return SC.EventEmitter},"get")});var HC=od();Object.defineProperty(kr,"Listener",{enumerable:!0,get:n(function(){return HC.Listener},"get")})});var Ho=u(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.accessTokenIsExpired=Mr.getExpiryDateOfAccessToken=void 0;var cd=C(),CC=6e4;function Wf(i){return(0,cd.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-CC)}n(Wf,"getExpiryMillis");function qC(i){return(0,cd.mapNullable)(Wf(i),e=>new Date(e))}n(qC,"getExpiryDateOfAccessToken");Mr.getExpiryDateOfAccessToken=qC;function EC(i){var e;return(e=(0,cd.mapNullable)(Wf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(EC,"accessTokenIsExpired");Mr.accessTokenIsExpired=EC});var qo=u(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.InvalidTokenError=void 0;var PC=_(),dd=class extends PC.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};Co.InvalidTokenError=dd});var Po=u(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.InvalidTokenTypeError=void 0;var AC=_(),hd=class extends AC.CustomError{static{n(this,"InvalidTokenTypeError")}};Eo.InvalidTokenTypeError=hd});var Vf=u(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.createRevokeTokenQuery=ut.createRefreshTokenQuery=ut.createGetAppTokenQuery=ut.createExchangeCodeQuery=void 0;function DC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(DC,"createExchangeCodeQuery");ut.createExchangeCodeQuery=DC;function IC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(IC,"createGetAppTokenQuery");ut.createGetAppTokenQuery=IC;function TC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(TC,"createRefreshTokenQuery");ut.createRefreshTokenQuery=TC;function RC(i,e){return{client_id:i,token:e}}n(RC,"createRevokeTokenQuery");ut.createRevokeTokenQuery=RC});var md=u(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.TokenInfo=void 0;var UC=(b(),x(g)),BC=C(),nr=_(),pd=class extends nr.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[nr.rawDataSymbol].client_id}get userId(){var e;return(e=this[nr.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[nr.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[nr.rawDataSymbol].scopes}get expiryDate(){return(0,BC.mapNullable)(this[nr.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};Ci.TokenInfo=pd;Ci.TokenInfo=pd=UC.__decorate([(0,nr.rtfm)("auth","TokenInfo","clientId")],pd)});var Ei=u(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.loadAndCompareTokenInfo=ee.compareScopeSets=ee.compareScopes=ee.getValidTokenFromProviderForIntent=ee.getValidTokenFromProviderForUser=ee.getTokenInfo=ee.revokeToken=ee.refreshUserToken=ee.getAppToken=ee.exchangeCode=void 0;var Lr=Y(),qi=qo(),OC=Po(),Ao=Vf(),jC=md();function _d(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(_d,"createAccessTokenFromData");async function kC(i,e,t,r){return _d(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ao.createExchangeCodeQuery)(i,e,t,r)}))}n(kC,"exchangeCode");ee.exchangeCode=kC;async function MC(i,e){return _d(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ao.createGetAppTokenQuery)(i,e)}))}n(MC,"getAppToken");ee.getAppToken=MC;async function LC(i,e,t){return _d(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ao.createRefreshTokenQuery)(i,e,t)}))}n(LC,"refreshUserToken");ee.refreshUserToken=LC;async function FC(i,e){await(0,Lr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,Ao.createRevokeTokenQuery)(i,e)})}n(FC,"revokeToken");ee.revokeToken=FC;async function Fr(i,e){try{let t=await(0,Lr.callTwitchApi)({type:"auth",url:"validate"},e,i);return new jC.TokenInfo(t)}catch(t){throw t instanceof Lr.HttpStatusCodeError&&t.statusCode===401?new qi.InvalidTokenError({cause:t}):t}}n(Fr,"getTokenInfo");ee.getTokenInfo=Fr;async function NC(i,e,t,r){let a=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof qi.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 Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof qi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(NC,"getValidTokenFromProviderForUser");ee.getValidTokenFromProviderForUser=NC;async function QC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new OC.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 Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof qi.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 Fr(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof qi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(QC,"getValidTokenFromProviderForIntent");ee.getValidTokenFromProviderForIntent=QC;var GC=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 $f(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=GC.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`)}}}n(Ff,"compareScopes");X.compareScopes=Ff;function Nf(i,e){for(let t of e)Ff(i,t)}n(Nf,"compareScopeSets");X.compareScopeSets=Nf;async function MC(i,e,t,r,a){if(a?.length||!t){let s=await Or(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&&Nf(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(MC,"loadAndCompareTokenInfo");X.loadAndCompareTokenInfo=MC});var Po=u(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.TokenFetcher=void 0;var Qf=C(),md=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,Qf.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,Qf.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}};Eo.TokenFetcher=md});var Wf=u(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.AppTokenAuthProvider=void 0;var Ao=(f(),b(y)),_d=C(),Gf=m(),LC=wo(),FC=Si(),NC=Po(),jr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new NC.TokenFetcher(async a=>await this._fetch(a))}get clientId(){return this._clientId}get currentScopes(){return this._impliedScopes}async getAccessTokenForUser(e,...t){if(t.every(r=>{var a;return(a=r?.some(s=>this._impliedScopes.includes(s)))!==null&&a!==void 0?a:!0}))return{...await this.getAppAccessToken(),userId:(0,Gf.extractUserId)(e)};throw new Error("Can not get user access token for AppTokenAuthProvider")}getCurrentScopesForUser(){return this._impliedScopes}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,LC.accessTokenIsExpired)(this._token)?this._token=await(0,FC.getAppToken)(this._clientId,this._clientSecret):this._token}};Hi.AppTokenAuthProvider=jr;Ao.__decorate([(0,_d.Enumerable)(!1)],jr.prototype,"_clientSecret",void 0);Ao.__decorate([(0,_d.Enumerable)(!1)],jr.prototype,"_token",void 0);Ao.__decorate([(0,_d.Enumerable)(!1)],jr.prototype,"_fetcher",void 0);Hi.AppTokenAuthProvider=jr=Ao.__decorate([(0,Gf.rtfm)("auth","AppTokenAuthProvider","clientId")],jr)});var fd=u(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.CachedRefreshFailureError=void 0;var QC=m(),yd=class extends QC.CustomError{static{n(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($f,"compareScopes");ee.compareScopes=$f;function zf(i,e){for(let t of e)$f(i,t)}n(zf,"compareScopeSets");ee.compareScopeSets=zf;async function WC(i,e,t,r,a){if(a?.length||!t){let s=await Fr(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&&zf(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(WC,"loadAndCompareTokenInfo");ee.loadAndCompareTokenInfo=WC});var Io=u(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.TokenFetcher=void 0;var Kf=C(),yd=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:c,reject:h}=(0,Kf.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{c(await this._executor(this._newTokenScopeSets))}catch(w){h(w)}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,Kf.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}};Do.TokenFetcher=yd});var Zf=u(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.AppTokenAuthProvider=void 0;var To=(b(),x(g)),fd=C(),Jf=_(),VC=Ho(),$C=Ei(),zC=Io(),Nr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new zC.TokenFetcher(async a=>await this._fetch(a))}get clientId(){return this._clientId}get currentScopes(){return this._impliedScopes}async getAccessTokenForUser(e,...t){if(t.every(r=>{var a;return(a=r?.some(s=>this._impliedScopes.includes(s)))!==null&&a!==void 0?a:!0}))return{...await this.getAppAccessToken(),userId:(0,Jf.extractUserId)(e)};throw new Error("Can not get user access token for AppTokenAuthProvider")}getCurrentScopesForUser(){return this._impliedScopes}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,VC.accessTokenIsExpired)(this._token)?this._token=await(0,$C.getAppToken)(this._clientId,this._clientSecret):this._token}};Pi.AppTokenAuthProvider=Nr;To.__decorate([(0,fd.Enumerable)(!1)],Nr.prototype,"_clientSecret",void 0);To.__decorate([(0,fd.Enumerable)(!1)],Nr.prototype,"_token",void 0);To.__decorate([(0,fd.Enumerable)(!1)],Nr.prototype,"_fetcher",void 0);Pi.AppTokenAuthProvider=Nr=To.__decorate([(0,Jf.rtfm)("auth","AppTokenAuthProvider","clientId")],Nr)});var bd=u(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.CachedRefreshFailureError=void 0;var KC=_(),gd=class extends KC.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}};Do.CachedRefreshFailureError=yd});var bd=u(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.IntermediateUserRemovalError=void 0;var GC=m(),gd=class extends GC.CustomError{static{n(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}};Ro.CachedRefreshFailureError=gd});var wd=u(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.IntermediateUserRemovalError=void 0;var JC=_(),xd=class extends JC.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}};Io.IntermediateUserRemovalError=gd});var wd=u(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.UnknownIntentError=void 0;var WC=m(),xd=class extends WC.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};To.UnknownIntentError=xd});var zf=u(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.RefreshingAuthProvider=void 0;var kr=(f(),b(y)),Ci=C(),VC=od(),Me=m(),vd=wo(),Vf=fd(),$C=bd(),Sd=So(),zC=Co(),KC=wd(),ut=Si(),$f=Po(),Ut=class extends VC.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 $f.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 $f.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,vd.accessTokenIsExpired)(e))try{let l=await(0,ut.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof Sd.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new Sd.InvalidTokenError;let l=await(0,ut.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),d=await(0,ut.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,d.userId,l),r=[l,d]}let[a,s]=r;if(!s.userId)throw new zC.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,ut.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 KC.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,ut.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 $C.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,vd.accessTokenIsExpired)(r))try{if(r.scope)return(0,ut.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,ut.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 Sd.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,ut.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,ut.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,vd.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,ut.getAppToken)(this._clientId,this._clientSecret)}};qi.RefreshingAuthProvider=Ut;kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_clientSecret",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_userAccessTokens",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_userTokenFetchers",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_appAccessToken",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_appTokenFetcher",void 0);qi.RefreshingAuthProvider=Ut=kr.__decorate([(0,Me.rtfm)("auth","RefreshingAuthProvider","clientId")],Ut)});var Jf=u(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.StaticAuthProvider=void 0;var Hd=(f(),b(y)),Kf=C(),JC=m(),ZC=Si(),Ei=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,ZC.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};Pi.StaticAuthProvider=Ei;Hd.__decorate([(0,Kf.Enumerable)(!1)],Ei.prototype,"_clientId",void 0);Hd.__decorate([(0,Kf.Enumerable)(!1)],Ei.prototype,"_accessToken",void 0);Pi.StaticAuthProvider=Ei=Hd.__decorate([(0,JC.rtfm)("auth","StaticAuthProvider","clientId")],Ei)});var Cd=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 Zf=wo();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return Zf.accessTokenIsExpired},"get")});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return Zf.getExpiryDateOfAccessToken},"get")});var er=Si();Object.defineProperty(T,"exchangeCode",{enumerable:!0,get:n(function(){return er.exchangeCode},"get")});Object.defineProperty(T,"getAppToken",{enumerable:!0,get:n(function(){return er.getAppToken},"get")});Object.defineProperty(T,"getTokenInfo",{enumerable:!0,get:n(function(){return er.getTokenInfo},"get")});Object.defineProperty(T,"getValidTokenFromProviderForUser",{enumerable:!0,get:n(function(){return er.getValidTokenFromProviderForUser},"get")});Object.defineProperty(T,"getValidTokenFromProviderForIntent",{enumerable:!0,get:n(function(){return er.getValidTokenFromProviderForIntent},"get")});Object.defineProperty(T,"refreshUserToken",{enumerable:!0,get:n(function(){return er.refreshUserToken},"get")});Object.defineProperty(T,"revokeToken",{enumerable:!0,get:n(function(){return er.revokeToken},"get")});var XC=Po();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:n(function(){return XC.TokenFetcher},"get")});var YC=hd();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:n(function(){return YC.TokenInfo},"get")});var eq=Wf();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return eq.AppTokenAuthProvider},"get")});var tq=zf();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return tq.RefreshingAuthProvider},"get")});var rq=Jf();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:n(function(){return rq.StaticAuthProvider},"get")});var iq=fd();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return iq.CachedRefreshFailureError},"get")});var nq=bd();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return nq.IntermediateUserRemovalError},"get")});var aq=So();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:n(function(){return aq.InvalidTokenError},"get")});var sq=Co();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return sq.InvalidTokenTypeError},"get")});var oq=wd();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:n(function(){return oq.UnknownIntentError},"get")})});var Yf=u((Uj,Xf)=>{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");Xf.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 eg=u(tr=>{var lq=Yf();tr.operation=function(i){var e=tr.timeouts(i);return new lq(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};tr.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};tr.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};tr.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=tr.operation(e),p=Array.prototype.slice.call(arguments,1),x=p.pop();p.push(function(q){h.retry(q)||(q&&(arguments[0]=h.mainError()),x.apply(this,arguments))}),h.attempt(function(){d.apply(i,p)})},"retryWrapper").bind(i,o),i[s].options=e}}});var rg=u((kj,tg)=>{tg.exports=eg()});var ig=u(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.createBitsLeaderboardQuery=void 0;function uq(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(uq,"createBitsLeaderboardQuery");Ro.createBitsLeaderboardQuery=uq});var Q=u(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BaseApi=void 0;var cq=(f(),b(y)),dq=C(),Uo=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}};Bo.BaseApi=Uo;cq.__decorate([(0,dq.Enumerable)(!1)],Uo.prototype,"_client",void 0)});var qd=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.HelixBitsLeaderboardEntry=void 0;var ng=(f(),b(y)),hq=C(),gt=m(),Oo=class extends gt.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[gt.rawDataSymbol].user_id}get userName(){return this[gt.rawDataSymbol].user_login}get userDisplayName(){return this[gt.rawDataSymbol].user_name}get rank(){return this[gt.rawDataSymbol].rank}get amount(){return this[gt.rawDataSymbol].score}async getUser(){return(0,gt.checkRelationAssertion)(await this._client.users.getUserById(this[gt.rawDataSymbol].user_id))}};Ai.HelixBitsLeaderboardEntry=Oo;ng.__decorate([(0,hq.Enumerable)(!1)],Oo.prototype,"_client",void 0);Ai.HelixBitsLeaderboardEntry=Oo=ng.__decorate([(0,gt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Oo)});var Pd=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.HelixBitsLeaderboard=void 0;var Ed=(f(),b(y)),ag=xi(),pq=C(),jo=m(),mq=qd(),Di=class extends jo.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[jo.rawDataSymbol].data.map(e=>new mq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[jo.rawDataSymbol].total}};Ii.HelixBitsLeaderboard=Di;Ed.__decorate([(0,pq.Enumerable)(!1)],Di.prototype,"_client",void 0);Ed.__decorate([(0,ag.CachedGetter)()],Di.prototype,"entries",null);Ii.HelixBitsLeaderboard=Di=Ed.__decorate([ag.Cacheable,(0,jo.rtfm)("api","HelixBitsLeaderboard")],Di)});var Dd=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.HelixCheermoteList=void 0;var _q=(f(),b(y)),yq=C(),Ti=m(),Ad=class extends Ti.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,yq.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[Ti.rawDataSymbol][e],d=l.sort((h,p)=>p.min_bits-h.min_bits).find(h=>h.min_bits<=t);if(!d)throw new Ti.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[Ti.rawDataSymbol])}};Ri.HelixCheermoteList=Ad;Ri.HelixCheermoteList=Ad=_q.__decorate([(0,Ti.rtfm)("api","HelixCheermoteList")],Ad)});var Rd=u(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixBitsApi=void 0;var fq=(f(),b(y)),sg=C(),gq=Z(),Id=m(),bq=ig(),xq=Q(),wq=Pd(),vq=Dd(),Td=class extends xq.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Id.extractUserId)(e),scopes:["bits:read"],query:(0,bq.createBitsLeaderboardQuery)(t)});return new wq.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,sg.mapOptional)(e,Id.extractUserId),query:(0,sg.mapOptional)(e,gq.createBroadcasterQuery)});return new vq.HelixCheermoteList(t.data)}};Ui.HelixBitsApi=Td;Ui.HelixBitsApi=Td=fq.__decorate([(0,Id.rtfm)("api","HelixBitsApi")],Td)});var lg=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createFollowedChannelQuery=Fe.createChannelFollowerQuery=Fe.createChannelVipUpdateQuery=Fe.createChannelCommercialBody=Fe.createChannelUpdateBody=void 0;var og=C(),rr=m();function Sq(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(Sq,"createChannelUpdateBody");Fe.createChannelUpdateBody=Sq;function Hq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),length:e}}n(Hq,"createChannelCommercialBody");Fe.createChannelCommercialBody=Hq;function Cq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),user_id:(0,rr.extractUserId)(e)}}n(Cq,"createChannelVipUpdateQuery");Fe.createChannelVipUpdateQuery=Cq;function qq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),user_id:(0,og.mapOptional)(e,rr.extractUserId)}}n(qq,"createChannelFollowerQuery");Fe.createChannelFollowerQuery=qq;function Eq(i,e){return{broadcaster_id:(0,og.mapOptional)(e,rr.extractUserId),user_id:(0,rr.extractUserId)(i)}}n(Eq,"createFollowedChannelQuery");Fe.createFollowedChannelQuery=Eq});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 ko=m();function Pq(i,e){return{[i]:e}}n(Pq,"createSingleKeyQuery");Ne.createSingleKeyQuery=Pq;function Aq(i){return{user_id:(0,ko.extractUserId)(i)}}n(Aq,"createUserQuery");Ne.createUserQuery=Aq;function Dq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Dq,"createModeratorActionQuery");Ne.createModeratorActionQuery=Dq;function Iq(i,e){return{broadcaster_id:(0,ko.extractUserId)(i),id:e}}n(Iq,"createGetByIdsQuery");Ne.createGetByIdsQuery=Iq;function Tq(i,e){return{broadcaster_id:(0,ko.extractUserId)(i),user_id:e.map(ko.extractUserId)}}n(Tq,"createChannelUsersCheckQuery");Ne.createChannelUsersCheckQuery=Tq});var Lo=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixUserRelation=void 0;var ug=(f(),b(y)),Rq=C(),ir=m(),Mo=class extends ir.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[ir.rawDataSymbol].user_id}get name(){return this[ir.rawDataSymbol].user_login}get displayName(){return this[ir.rawDataSymbol].user_name}async getUser(){return(0,ir.checkRelationAssertion)(await this._client.users.getUserById(this[ir.rawDataSymbol].user_id))}};Bi.HelixUserRelation=Mo;ug.__decorate([(0,Rq.Enumerable)(!1)],Mo.prototype,"_client",void 0);Bi.HelixUserRelation=Mo=ug.__decorate([(0,ir.rtfm)("api","HelixUserRelation","id")],Mo)});var Bt=u(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.HelixRequestBatcher=void 0;var Uq=(f(),b(y)),Ud=C(),Fo=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,Ud.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,Ud.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}})}};No.HelixRequestBatcher=Fo;Uq.__decorate([(0,Ud.Enumerable)(!1)],Fo.prototype,"_client",void 0)});var ae=u(Oi=>{"use strict";var Bd;Object.defineProperty(Oi,"__esModule",{value:!0});Oi.HelixPaginatedRequest=void 0;var cg=(f(),b(y)),Bq=C(),Oq=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Bd=Symbol.asyncIterator)!==null&&Bd!==void 0?Bd:Symbol.for("Symbol.asyncIterator"));var Qo=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]},[])}};Oi.HelixPaginatedRequest=Qo;cg.__decorate([(0,Bq.Enumerable)(!1)],Qo.prototype,"_client",void 0);Oi.HelixPaginatedRequest=Qo=cg.__decorate([(0,Oq.rtfm)("api","HelixPaginatedRequest")],Qo)});var Mr=u(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.HelixPaginatedRequestWithTotal=void 0;var jq=(f(),b(y)),kq=m(),Mq=ae(),Od=class extends Mq.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}};ji.HelixPaginatedRequestWithTotal=Od;ji.HelixPaginatedRequestWithTotal=Od=jq.__decorate([(0,kq.rtfm)("api","HelixPaginatedRequestWithTotal")],Od)});var ce=u(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.createPaginatedResultWithTotal=Lr.createPaginatedResult=void 0;function Lq(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(Lq,"createPaginatedResult");Lr.createPaginatedResult=Lq;function Fq(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(Fq,"createPaginatedResultWithTotal");Lr.createPaginatedResultWithTotal=Fq});var se=u(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.createPaginationQuery=void 0;function Nq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(Nq,"createPaginationQuery");Go.createPaginationQuery=Nq});var jd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixChannel=void 0;var dg=(f(),b(y)),Qq=C(),pe=m(),Wo=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}};ki.HelixChannel=Wo;dg.__decorate([(0,Qq.Enumerable)(!1)],Wo.prototype,"_client",void 0);ki.HelixChannel=Wo=dg.__decorate([(0,pe.rtfm)("api","HelixChannel","id")],Wo)});var kd=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixChannelEditor=void 0;var hg=(f(),b(y)),Gq=C(),nr=m(),Vo=class extends nr.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[nr.rawDataSymbol].user_id}get userDisplayName(){return this[nr.rawDataSymbol].user_name}async getUser(){return(0,nr.checkRelationAssertion)(await this._client.users.getUserById(this[nr.rawDataSymbol].user_id))}get creationDate(){return new Date(this[nr.rawDataSymbol].created_at)}};Mi.HelixChannelEditor=Vo;hg.__decorate([(0,Gq.Enumerable)(!1)],Vo.prototype,"_client",void 0);Mi.HelixChannelEditor=Vo=hg.__decorate([(0,nr.rtfm)("api","HelixChannelEditor","userId")],Vo)});var Md=u(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixChannelFollower=void 0;var pg=(f(),b(y)),Wq=C(),Ot=m(),$o=class extends Ot.DataObject{static{n(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[Ot.rawDataSymbol].user_id}get userName(){return this[Ot.rawDataSymbol].user_login}get userDisplayName(){return this[Ot.rawDataSymbol].user_name}async getUser(){return(0,Ot.checkRelationAssertion)(await this._client.users.getUserById(this[Ot.rawDataSymbol].user_id))}get followDate(){return new Date(this[Ot.rawDataSymbol].followed_at)}};Li.HelixChannelFollower=$o;pg.__decorate([(0,Wq.Enumerable)(!1)],$o.prototype,"_client",void 0);Li.HelixChannelFollower=$o=pg.__decorate([(0,Ot.rtfm)("api","HelixChannelFollower","userId")],$o)});var Ld=u(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixFollowedChannel=void 0;var mg=(f(),b(y)),Vq=C(),jt=m(),zo=class extends jt.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[jt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[jt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[jt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,jt.checkRelationAssertion)(await this._client.users.getUserById(this[jt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[jt.rawDataSymbol].followed_at)}};Fi.HelixFollowedChannel=zo;mg.__decorate([(0,Vq.Enumerable)(!1)],zo.prototype,"_client",void 0);Fi.HelixFollowedChannel=zo=mg.__decorate([(0,jt.rtfm)("api","HelixFollowedChannel","broadcasterId")],zo)});var Nd=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixAdSchedule=void 0;var $q=(f(),b(y)),Je=m(),Fd=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}};Ni.HelixAdSchedule=Fd;Ni.HelixAdSchedule=Fd=$q.__decorate([(0,Je.rtfm)("api","HelixAdSchedule")],Fd)});var _g=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixSnoozeNextAdResult=void 0;var zq=(f(),b(y)),Qi=m(),Qd=class extends Qi.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[Qi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[Qi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[Qi.rawDataSymbol].next_ad_at*1e3)}};Gi.HelixSnoozeNextAdResult=Qd;Gi.HelixSnoozeNextAdResult=Qd=zq.__decorate([(0,Qi.rtfm)("api","HelixSnoozeNextAdResult")],Qd)});var $d=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixChannelApi=void 0;var xg=(f(),b(y)),wg=C(),ar=Z(),oe=m(),bt=lg(),yg=Ue(),Gd=Lo(),Kq=Bt(),Jq=ae(),fg=Mr(),Wd=ce(),Ko=se(),Zq=Q(),Vd=jd(),Xq=kd(),gg=Md(),bg=Ld(),Yq=Nd(),eE=_g(),Jo=class extends Zq.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new Kq.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Vd.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,oe.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,ar.createBroadcasterQuery)(t)});return(0,wg.mapNullable)(r.data[0],a=>new Vd.HelixChannel(a,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,oe.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(oe.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,yg.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Vd.HelixChannel(a,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,ar.createBroadcasterQuery)(e),jsonBody:(0,bt.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,oe.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,bt.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,oe.extractUserId)(e),scopes:["channel:read:editors"],query:(0,ar.createBroadcasterQuery)(e)})).data.map(r=>new Xq.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,oe.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,ar.createBroadcasterQuery)(e),...(0,Ko.createPaginationQuery)(t)}});return(0,Wd.createPaginatedResult)(r,Gd.HelixUserRelation,this._client)}getVipsPaginated(e){return new Jq.HelixPaginatedRequest({url:"channels/vips",userId:(0,oe.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,ar.createBroadcasterQuery)(e)},this._client,t=>new Gd.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,oe.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,yg.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Gd.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let r=(0,oe.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,oe.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,bt.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,bt.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,oe.extractUserId)(e),query:{...(0,bt.createChannelFollowerQuery)(e),...(0,Ko.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,oe.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,bt.createChannelFollowerQuery)(e,t),...(0,Ko.createPaginationQuery)(r)}});return(0,Wd.createPaginatedResultWithTotal)(a,gg.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new fg.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,oe.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,bt.createChannelFollowerQuery)(e)},this._client,t=>new gg.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,oe.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,bt.createFollowedChannelQuery)(e,t),...(0,Ko.createPaginationQuery)(r)}});return(0,Wd.createPaginatedResultWithTotal)(a,bg.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new fg.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,oe.extractUserId)(e),scopes:["user:read:follows"],query:(0,bt.createFollowedChannelQuery)(e,t)},this._client,r=>new bg.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,oe.extractUserId)(e),scopes:["channel:read:ads"],query:(0,ar.createBroadcasterQuery)(e)});return new Yq.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,ar.createBroadcasterQuery)(e)});return new eE.HelixSnoozeNextAdResult(t.data[0])}};Wi.HelixChannelApi=Jo;xg.__decorate([(0,wg.Enumerable)(!1)],Jo.prototype,"_getChannelByIdBatcher",void 0);Wi.HelixChannelApi=Jo=xg.__decorate([(0,oe.rtfm)("api","HelixChannelApi")],Jo)});var vg=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createRedemptionsForBroadcasterQuery=Qe.createRewardRedemptionsByIdsQuery=Qe.createCustomRewardBody=Qe.createCustomRewardChangeQuery=Qe.createCustomRewardsQuery=void 0;var Zo=m();function tE(i,e){return{broadcaster_id:(0,Zo.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(tE,"createCustomRewardsQuery");Qe.createCustomRewardsQuery=tE;function rE(i,e){return{broadcaster_id:(0,Zo.extractUserId)(i),id:e}}n(rE,"createCustomRewardChangeQuery");Qe.createCustomRewardChangeQuery=rE;function iE(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(iE,"createCustomRewardBody");Qe.createCustomRewardBody=iE;function nE(i,e,t){return{broadcaster_id:(0,Zo.extractUserId)(i),reward_id:e,id:t}}n(nE,"createRewardRedemptionsByIdsQuery");Qe.createRewardRedemptionsByIdsQuery=nE;function aE(i,e,t,r){return{broadcaster_id:(0,Zo.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(aE,"createRedemptionsForBroadcasterQuery");Qe.createRedemptionsForBroadcasterQuery=aE});var zd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixCustomReward=void 0;var Sg=(f(),b(y)),sE=C(),j=m(),Xo=class extends j.DataObject{static{n(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[j.rawDataSymbol].id}get broadcasterId(){return this[j.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[j.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[j.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,r;let a=`url_${e}x`;return(r=(t=this[j.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&r!==void 0?r:this[j.rawDataSymbol].default_image[a]}get backgroundColor(){return this[j.rawDataSymbol].background_color}get isEnabled(){return this[j.rawDataSymbol].is_enabled}get cost(){return this[j.rawDataSymbol].cost}get title(){return this[j.rawDataSymbol].title}get prompt(){return this[j.rawDataSymbol].prompt}get userInputRequired(){return this[j.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[j.rawDataSymbol].max_per_stream_setting.is_enabled?this[j.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[j.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[j.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[j.rawDataSymbol].global_cooldown_setting.is_enabled?this[j.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[j.rawDataSymbol].is_paused}get isInStock(){return this[j.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[j.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[j.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[j.rawDataSymbol].cooldown_expires_at?new Date(this[j.rawDataSymbol].cooldown_expires_at):null}};Vi.HelixCustomReward=Xo;Sg.__decorate([(0,sE.Enumerable)(!1)],Xo.prototype,"_client",void 0);Vi.HelixCustomReward=Xo=Sg.__decorate([(0,j.rtfm)("api","HelixCustomReward","id")],Xo)});var Kd=u($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.HelixCustomRewardRedemption=void 0;var Hg=(f(),b(y)),oE=C(),N=m(),Yo=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]}};$i.HelixCustomRewardRedemption=Yo;Hg.__decorate([(0,oE.Enumerable)(!1)],Yo.prototype,"_client",void 0);$i.HelixCustomRewardRedemption=Yo=Hg.__decorate([(0,N.rtfm)("api","HelixCustomRewardRedemption","id")],Yo)});var Zd=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixChannelPointsApi=void 0;var lE=(f(),b(y)),uE=Z(),ct=m(),xt=vg(),cE=Ue(),dE=ae(),hE=ce(),pE=se(),mE=Q(),el=zd(),tl=Kd(),Jd=class extends mE.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,xt.createCustomRewardsQuery)(e,t)})).data.map(a=>new el.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,cE.createGetByIdsQuery)(e,t)})).data.map(a=>new el.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,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,uE.createBroadcasterQuery)(e),jsonBody:(0,xt.createCustomRewardBody)(t)});return new el.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,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xt.createCustomRewardChangeQuery)(e,t),jsonBody:(0,xt.createCustomRewardBody)(r)});return new el.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,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xt.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,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,xt.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new tl.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,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,xt.createRedemptionsForBroadcasterQuery)(e,t,r,a),...(0,pE.createPaginationQuery)(a)}});return(0,hE.createPaginatedResult)(s,tl.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new dE.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,xt.createRedemptionsForBroadcasterQuery)(e,t,r,a)},this._client,s=>new tl.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,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xt.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:a}})).data.map(o=>new tl.HelixCustomRewardRedemption(o,this._client)):[]}};zi.HelixChannelPointsApi=Jd;zi.HelixChannelPointsApi=Jd=lE.__decorate([(0,ct.rtfm)("api","HelixChannelPointsApi")],Jd)});var rl=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixCharityCampaignAmount=void 0;var _E=(f(),b(y)),Ki=m(),Xd=class extends Ki.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[Ki.rawDataSymbol].value}get decimalPlaces(){return this[Ki.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[Ki.rawDataSymbol].currency}};Ji.HelixCharityCampaignAmount=Xd;Ji.HelixCharityCampaignAmount=Xd=_E.__decorate([(0,Ki.rtfm)("api","HelixCharityCampaignAmount")],Xd)});var Yd=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixCharityCampaign=void 0;var qg=(f(),b(y)),yE=C(),Ae=m(),Cg=rl(),il=class extends Ae.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[Ae.rawDataSymbol].id}get broadcasterId(){return this[Ae.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Ae.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Ae.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Ae.checkRelationAssertion)(await this._client.users.getUserById(this[Ae.rawDataSymbol].broadcaster_id))}get charityName(){return this[Ae.rawDataSymbol].charity_name}get charityDescription(){return this[Ae.rawDataSymbol].charity_description}get charityLogo(){return this[Ae.rawDataSymbol].charity_logo}get charityWebsite(){return this[Ae.rawDataSymbol].charity_website}get currentAmount(){return new Cg.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].current_amount)}get targetAmount(){return new Cg.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].target_amount)}};Zi.HelixCharityCampaign=il;qg.__decorate([(0,yE.Enumerable)(!1)],il.prototype,"_client",void 0);Zi.HelixCharityCampaign=il=qg.__decorate([(0,Ae.rtfm)("api","HelixCharityCampaign","id")],il)});var eh=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixCharityCampaignDonation=void 0;var Eg=(f(),b(y)),fE=C(),wt=m(),gE=rl(),nl=class extends wt.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[wt.rawDataSymbol].campaign_id}get donorId(){return this[wt.rawDataSymbol].user_id}get donorName(){return this[wt.rawDataSymbol].user_login}get donorDisplayName(){return this[wt.rawDataSymbol].user_name}async getDonor(){return(0,wt.checkRelationAssertion)(await this._client.users.getUserById(this[wt.rawDataSymbol].user_id))}get amount(){return new gE.HelixCharityCampaignAmount(this[wt.rawDataSymbol].amount)}};Xi.HelixCharityCampaignDonation=nl;Eg.__decorate([(0,fE.Enumerable)(!1)],nl.prototype,"_client",void 0);Xi.HelixCharityCampaignDonation=nl=Eg.__decorate([(0,wt.rtfm)("api","HelixCharityCampaignDonation")],nl)});var ih=u(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.HelixCharityApi=void 0;var bE=(f(),b(y)),Pg=Z(),th=m(),xE=ce(),wE=se(),vE=Q(),SE=Yd(),HE=eh(),rh=class extends vE.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,th.extractUserId)(e),scopes:["channel:read:charity"],query:(0,Pg.createBroadcasterQuery)(e)});return new SE.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,th.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,Pg.createBroadcasterQuery)(e),...(0,wE.createPaginationQuery)(t)}});return(0,xE.createPaginatedResult)(r,HE.HelixCharityCampaignDonation,this._client)}};Yi.HelixCharityApi=rh;Yi.HelixCharityApi=rh=bE.__decorate([(0,th.rtfm)("api","HelixCharityApi")],rh)});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 nh=m();function CE(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(CE,"createChatSettingsUpdateBody");Ge.createChatSettingsUpdateBody=CE;function qE(i,e){return{user_id:(0,nh.extractUserId)(i),color:e}}n(qE,"createChatColorUpdateQuery");Ge.createChatColorUpdateQuery=qE;function EE(i,e,t){return{from_broadcaster_id:(0,nh.extractUserId)(i),to_broadcaster_id:(0,nh.extractUserId)(e),moderator_id:t}}n(EE,"createShoutoutQuery");Ge.createShoutoutQuery=EE;function PE(i,e){return{broadcaster_id:i,sender_id:e}}n(PE,"createSendChatMessageQuery");Ge.createSendChatMessageQuery=PE;function AE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(AE,"createSendChatMessageBody");Ge.createSendChatMessageBody=AE});var sh=u(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.HelixEmoteBase=void 0;var Ze=m(),ah=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}`}};al.HelixEmoteBase=ah});var tn=u(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.HelixEmote=void 0;var DE=(f(),b(y)),Dg=m(),IE=sh(),oh=class extends IE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[Dg.rawDataSymbol].images[`url_${e}x`]}};en.HelixEmote=oh;en.HelixEmote=oh=DE.__decorate([(0,Dg.rtfm)("api","HelixEmote","id")],oh)});var lh=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixChannelEmote=void 0;var Ig=(f(),b(y)),TE=C(),rn=m(),RE=tn(),sl=class extends RE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[rn.rawDataSymbol].tier||null}get type(){return this[rn.rawDataSymbol].emote_type}get emoteSetId(){return this[rn.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[rn.rawDataSymbol].emote_set_id])}};nn.HelixChannelEmote=sl;Ig.__decorate([(0,TE.Enumerable)(!1)],sl.prototype,"_client",void 0);nn.HelixChannelEmote=sl=Ig.__decorate([(0,rn.rtfm)("api","HelixChannelEmote","id")],sl)});var ch=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixChatBadgeVersion=void 0;var UE=(f(),b(y)),kt=m(),uh=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}};an.HelixChatBadgeVersion=uh;an.HelixChatBadgeVersion=uh=UE.__decorate([(0,kt.rtfm)("api","HelixChatBadgeVersion","id")],uh)});var dh=u(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.HelixChatBadgeSet=void 0;var Tg=(f(),b(y)),Rg=xi(),ol=m(),BE=ch(),ll=class extends ol.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[ol.rawDataSymbol].set_id}get versions(){return this[ol.rawDataSymbol].versions.map(e=>new BE.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};sn.HelixChatBadgeSet=ll;Tg.__decorate([(0,Rg.CachedGetter)()],ll.prototype,"versions",null);sn.HelixChatBadgeSet=ll=Tg.__decorate([Rg.Cacheable,(0,ol.rtfm)("api","HelixChatBadgeSet","id")],ll)});var hh=u(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.HelixChatChatter=void 0;var Ug=(f(),b(y)),OE=C(),sr=m(),ul=class extends sr.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[sr.rawDataSymbol].user_id}get userName(){return this[sr.rawDataSymbol].user_login}get userDisplayName(){return this[sr.rawDataSymbol].user_name}async getUser(){return(0,sr.checkRelationAssertion)(await this._client.users.getUserById(this[sr.rawDataSymbol].user_id))}};on.HelixChatChatter=ul;Ug.__decorate([(0,OE.Enumerable)(!1)],ul.prototype,"_client",void 0);on.HelixChatChatter=ul=Ug.__decorate([(0,sr.rtfm)("api","HelixChatChatter")],ul)});var cl=u(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.HelixChatSettings=void 0;var jE=(f(),b(y)),dt=m(),ph=class extends dt.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[dt.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[dt.rawDataSymbol].slow_mode}get slowModeDelay(){return this[dt.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[dt.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[dt.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[dt.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[dt.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[dt.rawDataSymbol].unique_chat_mode}};ln.HelixChatSettings=ph;ln.HelixChatSettings=ph=jE.__decorate([(0,dt.rtfm)("api","HelixChatSettings","broadcasterId")],ph)});var mh=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixEmoteFromSet=void 0;var Bg=(f(),b(y)),kE=C(),or=m(),ME=tn(),dl=class extends ME.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[or.rawDataSymbol].emote_type}get emoteSetId(){return this[or.rawDataSymbol].emote_set_id}get ownerId(){switch(this[or.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[or.rawDataSymbol].owner_id}}async getOwner(){switch(this[or.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[or.rawDataSymbol].owner_id)}}};un.HelixEmoteFromSet=dl;Bg.__decorate([(0,kE.Enumerable)(!1)],dl.prototype,"_client",void 0);un.HelixEmoteFromSet=dl=Bg.__decorate([(0,or.rtfm)("api","HelixEmoteFromSet","id")],dl)});var _h=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixUserEmote=void 0;var Og=(f(),b(y)),Mt=m(),LE=sh(),FE=C(),hl=class extends LE.HelixEmoteBase{static{n(this,"HelixUserEmote")}constructor(e,t){super(e),this._client=t}get type(){return this[Mt.rawDataSymbol].emote_type}get emoteSetId(){return this[Mt.rawDataSymbol].emote_set_id||null}get ownerId(){return this[Mt.rawDataSymbol].owner_id||null}async getAllEmotesFromSet(){return this[Mt.rawDataSymbol].emote_set_id?await this._client.chat.getEmotesFromSets([this[Mt.rawDataSymbol].emote_set_id]):null}async getOwner(){return this[Mt.rawDataSymbol].owner_id?await this._client.users.getUserById(this[Mt.rawDataSymbol].owner_id):null}};cn.HelixUserEmote=hl;Og.__decorate([(0,FE.Enumerable)(!1)],hl.prototype,"_client",void 0);cn.HelixUserEmote=hl=Og.__decorate([(0,Mt.rtfm)("api","HelixUserEmote","id")],hl)});var gh=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixPrivilegedChatSettings=void 0;var NE=(f(),b(y)),yh=m(),QE=cl(),fh=class extends QE.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[yh.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[yh.rawDataSymbol].non_moderator_chat_delay_duration}};dn.HelixPrivilegedChatSettings=fh;dn.HelixPrivilegedChatSettings=fh=NE.__decorate([(0,yh.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],fh)});var xh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixSentChatMessage=void 0;var GE=(f(),b(y)),Fr=m(),bh=class extends Fr.DataObject{static{n(this,"HelixSentChatMessage")}get id(){return this[Fr.rawDataSymbol].message_id}get isSent(){return this[Fr.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Fr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Fr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};hn.HelixSentChatMessage=bh;hn.HelixSentChatMessage=bh=GE.__decorate([(0,Fr.rtfm)("api","HelixSentChatMessage","id")],bh)});var jg=u(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.createSharedChatSessionQuery=void 0;var WE=m();function VE(i){return{broadcaster_id:(0,WE.extractUserId)(i)}}n(VE,"createSharedChatSessionQuery");pl.createSharedChatSessionQuery=VE});var wh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixSharedChatSessionParticipant=void 0;var kg=(f(),b(y)),$E=C(),pn=m(),ml=class extends pn.DataObject{static{n(this,"HelixSharedChatSessionParticipant")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[pn.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,pn.checkRelationAssertion)(await this._client.users.getUserById(this[pn.rawDataSymbol].broadcaster_id))}};mn.HelixSharedChatSessionParticipant=ml;kg.__decorate([(0,$E.Enumerable)(!1)],ml.prototype,"_client",void 0);mn.HelixSharedChatSessionParticipant=ml=kg.__decorate([(0,pn.rtfm)("api","HelixSharedChatSessionParticipant","broadcasterId")],ml)});var vh=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixSharedChatSession=void 0;var Mg=(f(),b(y)),zE=C(),vt=m(),KE=wh(),_l=class extends vt.DataObject{static{n(this,"HelixSharedChatSession")}constructor(e,t){super(e),this._client=t}get sessionId(){return this[vt.rawDataSymbol].session_id}get hostBroadcasterId(){return this[vt.rawDataSymbol].host_broadcaster_id}async getHostBroadcaster(){return(0,vt.checkRelationAssertion)(await this._client.users.getUserById(this[vt.rawDataSymbol].host_broadcaster_id))}get participants(){return this[vt.rawDataSymbol].participants.map(e=>new KE.HelixSharedChatSessionParticipant(e,this._client))}get createdDate(){return new Date(this[vt.rawDataSymbol].created_at)}get updatedDate(){return new Date(this[vt.rawDataSymbol].updated_at)}};_n.HelixSharedChatSession=_l;Mg.__decorate([(0,zE.Enumerable)(!1)],_l.prototype,"_client",void 0);_n.HelixSharedChatSession=_l=Mg.__decorate([(0,vt.rtfm)("api","HelixSharedChatSession","sessionId")],_l)});var Ch=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixChatApi=void 0;var JE=(f(),b(y)),Sh=Z(),J=m(),lr=Ag(),Lt=Ue(),ZE=ae(),XE=Mr(),Lg=ce(),Fg=se(),YE=Q(),eP=lh(),Ng=dh(),Qg=hh(),tP=cl(),rP=tn(),iP=mh(),Gg=_h(),Wg=gh(),Vg=xh(),nP=jg(),aP=vh(),Hh=class extends YE.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let r=(0,J.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,Fg.createPaginationQuery)(t)}});return(0,Lg.createPaginatedResultWithTotal)(a,Qg.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,J.extractUserId)(e);return new XE.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Qg.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new Ng.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,J.extractUserId)(e),query:(0,Sh.createBroadcasterQuery)(e)})).data.map(r=>new Ng.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new rP.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,J.extractUserId)(e),query:(0,Sh.createBroadcasterQuery)(e)})).data.map(r=>new eP.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Lt.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new iP.HelixEmoteFromSet(r,this._client))}async getUserEmotes(e,t){let r=(0,J.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/emotes/user",userId:(0,J.extractUserId)(e),scopes:["user:read:emotes"],query:{...(0,Lt.createSingleKeyQuery)("user_id",r),...(0,Lt.createSingleKeyQuery)("broadcasterId",t?.broadcaster?(0,J.extractUserId)(t.broadcaster):void 0),...(0,Fg.createPaginationQuery)(t)}});return(0,Lg.createPaginatedResult)(a,Gg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,J.extractUserId)(e);return new ZE.HelixPaginatedRequest({url:"chat/emotes/user",userId:r,scopes:["user:read:emotes"],query:{...(0,Lt.createSingleKeyQuery)("user_id",r),...(0,Lt.createSingleKeyQuery)("broadcasterId",t?(0,J.extractUserId)(t):void 0)}},this._client,a=>new Gg.HelixUserEmote(a,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,J.extractUserId)(e),query:(0,Sh.createBroadcasterQuery)(e)});return new tP.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,J.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 Wg.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,J.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,lr.createChatSettingsUpdateBody)(t)});return new Wg.HelixPrivilegedChatSettings(a.data[0])}async sendChatMessage(e,t,r){let a=(0,J.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:a,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,lr.createSendChatMessageQuery)(a,this._getUserContextIdWithDefault(a)),jsonBody:(0,lr.createSendChatMessageBody)(t,r)});return new Vg.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,a){let s=(0,J.extractUserId)(e),o=(0,J.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,lr.createSendChatMessageQuery)(o,s),jsonBody:(0,lr.createSendChatMessageBody)(r,a)});return new Vg.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,J.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,Lt.createSingleKeyQuery)("user_id",e.map(J.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,J.extractUserId)(e),query:(0,Lt.createSingleKeyQuery)("user_id",(0,J.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,J.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,lr.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,J.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,lr.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}async getSharedChatSession(e){let t=(0,J.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"shared_chat/session",userId:t,query:(0,nP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new aP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Lt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};yn.HelixChatApi=Hh;yn.HelixChatApi=Hh=JE.__decorate([(0,J.rtfm)("api","HelixChatApi")],Hh)});var $g=u(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createClipQuery=Nr.createClipCreateQuery=void 0;var sP=m();function oP(i,e){return{broadcaster_id:(0,sP.extractUserId)(i),has_delay:e.toString()}}n(oP,"createClipCreateQuery");Nr.createClipCreateQuery=oP;function lP(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(lP,"createClipQuery");Nr.createClipQuery=lP});var qh=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixClip=void 0;var zg=(f(),b(y)),uP=C(),k=m(),yl=class extends k.DataObject{static{n(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}};fn.HelixClip=yl;zg.__decorate([(0,uP.Enumerable)(!1)],yl.prototype,"_client",void 0);fn.HelixClip=yl=zg.__decorate([(0,k.rtfm)("api","HelixClip","id")],yl)});var Ah=u(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.HelixClipApi=void 0;var Kg=(f(),b(y)),cP=C(),Qr=m(),Eh=$g(),dP=Bt(),hP=ae(),pP=ce(),mP=se(),_P=Q(),Ph=qh(),fl=class extends _P.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new dP.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Ph.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,Qr.extractUserId)(e),userId:(0,Qr.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,Qr.extractUserId)(e),userId:(0,Qr.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,Qr.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,Eh.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,Eh.createClipQuery)(e),...(0,mP.createPaginationQuery)(e)}});return(0,pP.createPaginatedResult)(t,Ph.HelixClip,this._client)}_getClipsPaginated(e){return new hP.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,Eh.createClipQuery)(e)},this._client,t=>new Ph.HelixClip(t,this._client))}};gn.HelixClipApi=fl;Kg.__decorate([(0,cP.Enumerable)(!1)],fl.prototype,"_getClipByIdBatcher",void 0);gn.HelixClipApi=fl=Kg.__decorate([(0,Qr.rtfm)("api","HelixClipApi")],fl)});var Ih=u(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.HelixContentClassificationLabel=void 0;var gl=m(),Dh=class extends gl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[gl.rawDataSymbol].id}get name(){return this[gl.rawDataSymbol].name}get description(){return this[gl.rawDataSymbol].description}};bl.HelixContentClassificationLabel=Dh});var Rh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixContentClassificationLabelApi=void 0;var yP=(f(),b(y)),fP=m(),gP=Q(),bP=Ih(),Th=class extends gP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new bP.HelixContentClassificationLabel(r))}};bn.HelixContentClassificationLabelApi=Th;bn.HelixContentClassificationLabelApi=Th=yP.__decorate([(0,fP.rtfm)("api","HelixContentClassificationLabelApi")],Th)});var Jg=u(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createDropsEntitlementUpdateBody=Gr.createDropsEntitlementQuery=void 0;var xP=C(),wP=m();function vP(i,e){return{user_id:e?(0,xP.mapOptional)(i.user,wP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(vP,"createDropsEntitlementQuery");Gr.createDropsEntitlementQuery=vP;function SP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(SP,"createDropsEntitlementUpdateBody");Gr.createDropsEntitlementUpdateBody=SP});var Uh=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixDropsEntitlement=void 0;var Zg=(f(),b(y)),HP=C(),Be=m(),xl=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)}};xn.HelixDropsEntitlement=xl;Zg.__decorate([(0,HP.Enumerable)(!1)],xl.prototype,"_client",void 0);xn.HelixDropsEntitlement=xl=Zg.__decorate([(0,Be.rtfm)("api","HelixDropsEntitlement")],xl)});var kh=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixEntitlementApi=void 0;var Xg=(f(),b(y)),Oh=C(),jh=m(),Bh=Jg(),CP=Bt(),qP=ae(),EP=ce(),PP=se(),AP=Q(),wl=Uh(),vl=class extends AP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new CP.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new wl.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Oh.mapOptional)(e.user,jh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,Bh.createDropsEntitlementQuery)(e,t),...(0,PP.createPaginationQuery)(e)}});return(0,EP.createPaginatedResult)(r,wl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new qP.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Oh.mapOptional)(e.user,jh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,Bh.createDropsEntitlementQuery)(e,t)},this._client,r=>new wl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new wl.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])))}};wn.HelixEntitlementApi=vl;Xg.__decorate([(0,Oh.Enumerable)(!1)],vl.prototype,"_getDropsEntitlementByIdBatcher",void 0);wn.HelixEntitlementApi=vl=Xg.__decorate([(0,jh.rtfm)("api","HelixEntitlementApi")],vl)});var eb=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 Yg=m();function DP(i){return{broadcaster_user_id:(0,Yg.extractUserId)(i)}}n(DP,"createEventSubBroadcasterCondition");me.createEventSubBroadcasterCondition=DP;function IP(i,e){return{broadcaster_user_id:(0,Yg.extractUserId)(i),reward_id:e}}n(IP,"createEventSubRewardCondition");me.createEventSubRewardCondition=IP;function TP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(TP,"createEventSubModeratorCondition");me.createEventSubModeratorCondition=TP;function RP(i,e){return{broadcaster_user_id:i,user_id:e}}n(RP,"createEventSubUserCondition");me.createEventSubUserCondition=RP;function UP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(UP,"createEventSubDropEntitlementGrantCondition");me.createEventSubDropEntitlementGrantCondition=UP;function BP(i,e){return{conduit_id:i,status:e}}n(BP,"createEventSubConduitCondition");me.createEventSubConduitCondition=BP;function OP(i,e){return{id:i,shard_count:e.toString()}}n(OP,"createEventSubConduitUpdateCondition");me.createEventSubConduitUpdateCondition=OP;function jP(i,e){return{conduit_id:i,shards:e}}n(jP,"createEventSubConduitShardsUpdateCondition");me.createEventSubConduitShardsUpdateCondition=jP});var Hl=u(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.HelixEventSubSubscription=void 0;var tb=(f(),b(y)),kP=C(),We=m(),Sl=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}};vn.HelixEventSubSubscription=Sl;tb.__decorate([(0,kP.Enumerable)(!1)],Sl.prototype,"_client",void 0);vn.HelixEventSubSubscription=Sl=tb.__decorate([(0,We.rtfm)("api","HelixEventSubSubscription","id")],Sl)});var Lh=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var MP=(f(),b(y)),LP=m(),FP=Mr(),NP=Hl(),Mh=class extends FP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new NP.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}};Sn.HelixPaginatedEventSubSubscriptionsRequest=Mh;Sn.HelixPaginatedEventSubSubscriptionsRequest=Mh=MP.__decorate([(0,LP.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Mh)});var Fh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixEventSubConduit=void 0;var rb=(f(),b(y)),QP=C(),ur=m(),Cl=class extends ur.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[ur.rawDataSymbol].id}get shardCount(){return this[ur.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[ur.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[ur.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[ur.rawDataSymbol].id)}};Hn.HelixEventSubConduit=Cl;rb.__decorate([(0,QP.Enumerable)(!1)],Cl.prototype,"_client",void 0);Hn.HelixEventSubConduit=Cl=rb.__decorate([(0,ur.rtfm)("api","HelixEventSubConduit")],Cl)});var Qh=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixEventSubConduitShard=void 0;var GP=(f(),b(y)),Cn=m(),Nh=class extends Cn.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[Cn.rawDataSymbol].id}get status(){return this[Cn.rawDataSymbol].status}get transportMethod(){return this[Cn.rawDataSymbol].transport.method}};qn.HelixEventSubConduitShard=Nh;qn.HelixEventSubConduitShard=Nh=GP.__decorate([(0,Cn.rtfm)("api","HelixEventSubConduitShard")],Nh)});var $h=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixEventSubApi=void 0;var WP=(f(),b(y)),VP=C(),U=m(),H=eb(),Xe=Ue(),$P=ae(),En=ce(),Pn=se(),zP=Q(),An=Hl(),ql=Lh(),Gh=Fh(),Wh=Qh(),Vh=class extends zP.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,Pn.createPaginationQuery)(e)});return{...(0,En.createPaginatedResultWithTotal)(t,An.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new ql.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Pn.createPaginationQuery)(t),status:e}});return{...(0,En.createPaginatedResultWithTotal)(r,An.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new ql.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Pn.createPaginationQuery)(t),type:e}});return{...(0,En.createPaginatedResultWithTotal)(r,An.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new ql.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,U.extractUserId)(e),query:{...(0,Xe.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),...(0,Pn.createPaginationQuery)(t)}});return{...(0,En.createPaginatedResultWithTotal)(r,An.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,U.extractUserId)(e);return new ql.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 q=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:p,userId:(0,VP.mapOptional)(s,U.extractUserId),canOverrideScopedUserContext:l,forceType:h?"app":"user",jsonBody:x});return new An.HelixEventSubSubscription(q.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,H.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,H.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","2",(0,H.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,H.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,H.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,H.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,U.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,Xe.createSingleKeyQuery)("to_broadcaster_user_id",(0,U.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,H.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,H.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,H.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,H.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,H.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,H.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,H.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,H.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,H.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,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,H.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,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelUnbanRequestCreateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.unban_request.create","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelUnbanRequestResolveEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.unban_request.resolve","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelModerateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.moderate","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,[],!0)}async subscribeToChannelWarningAcknowledgeEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.warning.acknowledge","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelWarningSendEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.warning.send","1",(0,H.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,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToChannelVipRemoveEvents(e,t){return await this.createSubscription("channel.vip.remove","1",(0,H.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,U.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,U.extractUserId)(e)),t,e,["user:read:whispers","user:manage:whispers"])}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,H.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async subscribeToAutoModMessageHoldEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.hold","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageHoldV2Events(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.hold","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateV2Events(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.update","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModSettingsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.settings.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:automod_settings"],!0)}async subscribeToAutoModTermsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.terms.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToChannelChatUserMessageHoldEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_hold","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatUserMessageUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_update","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelSuspiciousUserUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSuspiciousUserMessageEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.message","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSharedChatSessionBeginEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.begin","1",(0,H.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.update","1",(0,H.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionEndEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.end","1",(0,H.createEventSubBroadcasterCondition)(r),t,r)}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new Gh.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 Gh.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,H.createEventSubConduitUpdateCondition)(e,t)});return new Gh.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,H.createEventSubConduitCondition)(e,t),...(0,Pn.createPaginationQuery)(r)}});return{...(0,En.createPaginatedResult)(a,Wh.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new $P.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,H.createEventSubConduitCondition)(e,t)},this._client,r=>new Wh.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,H.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(a=>new Wh.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};Dn.HelixEventSubApi=Vh;Dn.HelixEventSubApi=Vh=WP.__decorate([(0,U.rtfm)("api","HelixEventSubApi")],Vh)});var ib=u(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.createExtensionTransactionQuery=Ft.createExtensionProductBody=Ft.createReleasedExtensionFilter=void 0;function KP(i,e){return{extension_id:i,extension_version:e}}n(KP,"createReleasedExtensionFilter");Ft.createReleasedExtensionFilter=KP;function JP(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(JP,"createExtensionProductBody");Ft.createExtensionProductBody=JP;function ZP(i,e){return{extension_id:i,id:e.transactionIds}}n(ZP,"createExtensionTransactionQuery");Ft.createExtensionTransactionQuery=ZP});var zh=u(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.HelixChannelReference=void 0;var nb=(f(),b(y)),XP=C(),De=m(),El=class extends De.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[De.rawDataSymbol].broadcaster_id}get displayName(){return this[De.rawDataSymbol].broadcaster_name}async getChannel(){return(0,De.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[De.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,De.checkRelationAssertion)(await this._client.users.getUserById(this[De.rawDataSymbol].broadcaster_id))}get gameId(){return this[De.rawDataSymbol].game_id}get gameName(){return this[De.rawDataSymbol].game_name}async getGame(){return this[De.rawDataSymbol].game_id?(0,De.checkRelationAssertion)(await this._client.games.getGameById(this[De.rawDataSymbol].game_id)):null}get title(){return this[De.rawDataSymbol].title}};In.HelixChannelReference=El;nb.__decorate([(0,XP.Enumerable)(!1)],El.prototype,"_client",void 0);In.HelixChannelReference=El=nb.__decorate([(0,De.rtfm)("api","HelixChannelReference","id")],El)});var Jh=u(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.HelixExtensionBitsProduct=void 0;var YP=(f(),b(y)),eA=C(),Nt=m(),Kh=class extends Nt.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[Nt.rawDataSymbol].sku}get cost(){return this[Nt.rawDataSymbol].cost.amount}get displayName(){return this[Nt.rawDataSymbol].display_name}get inDevelopment(){return this[Nt.rawDataSymbol].in_development}get isBroadcast(){return this[Nt.rawDataSymbol].is_broadcast}get expirationDate(){return(0,eA.mapNullable)(this[Nt.rawDataSymbol].expiration,e=>new Date(e))}};Tn.HelixExtensionBitsProduct=Kh;Tn.HelixExtensionBitsProduct=Kh=YP.__decorate([(0,Nt.rtfm)("api","HelixExtensionBitsProduct","sku")],Kh)});var Zh=u(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.HelixExtensionTransaction=void 0;var ab=(f(),b(y)),tA=C(),de=m(),Pl=class extends de.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[de.rawDataSymbol].id}get transactionDate(){return new Date(this[de.rawDataSymbol].timestamp)}get broadcasterId(){return this[de.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[de.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[de.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].broadcaster_id))}get userId(){return this[de.rawDataSymbol].user_id}get userName(){return this[de.rawDataSymbol].user_login}get userDisplayName(){return this[de.rawDataSymbol].user_name}async getUser(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].user_id))}get productType(){return this[de.rawDataSymbol].product_type}get productSku(){return this[de.rawDataSymbol].product_data.sku}get productCost(){return this[de.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[de.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[de.rawDataSymbol].product_data.inDevelopment}};Rn.HelixExtensionTransaction=Pl;ab.__decorate([(0,tA.Enumerable)(!1)],Pl.prototype,"_client",void 0);Rn.HelixExtensionTransaction=Pl=ab.__decorate([(0,de.rtfm)("api","HelixExtensionTransaction","id")],Pl)});var ep=u(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.HelixExtensionsApi=void 0;var rA=(f(),b(y)),hb=m(),Al=ib(),Xh=Ue(),sb=ae(),ob=ce(),lb=se(),iA=Q(),ub=zh(),cb=Jh(),db=Zh(),Yh=class extends iA.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Al.createReleasedExtensionFilter)(e,t)});return new hb.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,Xh.createSingleKeyQuery)("extension_id",e),...(0,lb.createPaginationQuery)(t)}});return(0,ob.createPaginatedResult)(r,ub.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new sb.HelixPaginatedRequest({url:"extensions/live",query:(0,Xh.createSingleKeyQuery)("extension_id",e)},this._client,t=>new ub.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,Xh.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new cb.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Al.createExtensionProductBody)(e)});return new cb.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Al.createExtensionTransactionQuery)(e,t),...(0,lb.createPaginationQuery)(t)}});return(0,ob.createPaginatedResult)(r,db.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new sb.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Al.createExtensionTransactionQuery)(e,t)},this._client,r=>new db.HelixExtensionTransaction(r,this._client))}};Un.HelixExtensionsApi=Yh;Un.HelixExtensionsApi=Yh=rA.__decorate([(0,hb.rtfm)("api","HelixExtensionsApi")],Yh)});var Il=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixGame=void 0;var pb=(f(),b(y)),nA=C(),St=m(),Dl=class extends St.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[St.rawDataSymbol].id}get name(){return this[St.rawDataSymbol].name}get boxArtUrl(){return this[St.rawDataSymbol].box_art_url}get igdbId(){return this[St.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[St.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[St.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[St.rawDataSymbol].id})}};Bn.HelixGame=Dl;pb.__decorate([(0,nA.Enumerable)(!1)],Dl.prototype,"_client",void 0);Bn.HelixGame=Dl=pb.__decorate([(0,St.rtfm)("api","HelixGame","id")],Dl)});var ip=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixGameApi=void 0;var Tl=(f(),b(y)),rp=C(),aA=m(),tp=Bt(),sA=ae(),oA=ce(),lA=se(),uA=Q(),Wr=Il(),Vr=class extends uA.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new tp.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Wr.HelixGame(e,this._client)),this._getGameByNameBatcher=new tp.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Wr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new tp.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Wr.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,lA.createPaginationQuery)(e)});return(0,oA.createPaginatedResult)(t,Wr.HelixGame,this._client)}getTopGamesPaginated(){return new sA.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Wr.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 Wr.HelixGame(a,this._client)):[]}};On.HelixGameApi=Vr;Tl.__decorate([(0,rp.Enumerable)(!1)],Vr.prototype,"_getGameByIdBatcher",void 0);Tl.__decorate([(0,rp.Enumerable)(!1)],Vr.prototype,"_getGameByNameBatcher",void 0);Tl.__decorate([(0,rp.Enumerable)(!1)],Vr.prototype,"_getGameByIgdbIdBatcher",void 0);On.HelixGameApi=Vr=Tl.__decorate([(0,aA.rtfm)("api","HelixGameApi")],Vr)});var np=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixGoal=void 0;var mb=(f(),b(y)),cA=C(),Oe=m(),Rl=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}};jn.HelixGoal=Rl;mb.__decorate([(0,cA.Enumerable)(!1)],Rl.prototype,"_client",void 0);jn.HelixGoal=Rl=mb.__decorate([(0,Oe.rtfm)("api","HelixGoal","id")],Rl)});var sp=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixGoalApi=void 0;var dA=(f(),b(y)),hA=Z(),_b=m(),pA=Q(),mA=np(),ap=class extends pA.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,_b.extractUserId)(e),scopes:["channel:read:goals"],query:(0,hA.createBroadcasterQuery)(e)})).data.map(r=>new mA.HelixGoal(r,this._client))}};kn.HelixGoalApi=ap;kn.HelixGoalApi=ap=dA.__decorate([(0,_b.rtfm)("api","HelixGoalApi")],ap)});var op=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixHypeTrainContribution=void 0;var yb=(f(),b(y)),_A=C(),cr=m(),Ul=class extends cr.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[cr.rawDataSymbol].user}async getUser(){return(0,cr.checkRelationAssertion)(await this._client.users.getUserById(this[cr.rawDataSymbol].user))}get type(){return this[cr.rawDataSymbol].type}get total(){return this[cr.rawDataSymbol].total}};Mn.HelixHypeTrainContribution=Ul;yb.__decorate([(0,_A.Enumerable)(!1)],Ul.prototype,"_client",void 0);Mn.HelixHypeTrainContribution=Ul=yb.__decorate([(0,cr.rtfm)("api","HelixHypeTrainContribution","userId")],Ul)});var lp=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixHypeTrainEvent=void 0;var gb=(f(),b(y)),yA=C(),_e=m(),fb=op(),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 fb.HelixHypeTrainContribution(this[_e.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[_e.rawDataSymbol].event_data.top_contributions.map(e=>new fb.HelixHypeTrainContribution(e,this._client))}};Ln.HelixHypeTrainEvent=Bl;gb.__decorate([(0,yA.Enumerable)(!1)],Bl.prototype,"_client",void 0);Ln.HelixHypeTrainEvent=Bl=gb.__decorate([(0,_e.rtfm)("api","HelixHypeTrainEvent","id")],Bl)});var cp=u(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.HelixHypeTrainApi=void 0;var bb=Z(),xb=m(),fA=ae(),gA=ce(),bA=se(),xA=Q(),wb=lp(),up=class extends xA.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,xb.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,bb.createBroadcasterQuery)(e),...(0,bA.createPaginationQuery)(t)}});return(0,gA.createPaginatedResult)(r,wb.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new fA.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,xb.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,bb.createBroadcasterQuery)(e)},this._client,t=>new wb.HelixHypeTrainEvent(t,this._client))}};Ol.HelixHypeTrainApi=up});var vb=u(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.createWarnUserBody=le.createCheckAutoModStatusBody=le.createUpdateShieldModeStatusBody=le.createBanUserBody=le.createAutoModSettingsBody=le.createAutoModProcessBody=le.createResolveUnbanRequestQuery=le.createModeratorModifyQuery=le.createModerationUserListQuery=void 0;var Qt=m();function wA(i,e){return{broadcaster_id:(0,Qt.extractUserId)(i),user_id:e?.userId}}n(wA,"createModerationUserListQuery");le.createModerationUserListQuery=wA;function vA(i,e){return{broadcaster_id:(0,Qt.extractUserId)(i),user_id:(0,Qt.extractUserId)(e)}}n(vA,"createModeratorModifyQuery");le.createModeratorModifyQuery=vA;function SA(i,e,t,r,a){return{unban_request_id:t,broadcaster_id:(0,Qt.extractUserId)(i),moderator_id:(0,Qt.extractUserId)(e),status:r?"approved":"denied",resolution_text:a}}n(SA,"createResolveUnbanRequestQuery");le.createResolveUnbanRequestQuery=SA;function HA(i,e,t){return{user_id:(0,Qt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(HA,"createAutoModProcessBody");le.createAutoModProcessBody=HA;function CA(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(CA,"createAutoModSettingsBody");le.createAutoModSettingsBody=CA;function qA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,Qt.extractUserId)(i.user)}}}n(qA,"createBanUserBody");le.createBanUserBody=qA;function EA(i){return{is_active:i}}n(EA,"createUpdateShieldModeStatusBody");le.createUpdateShieldModeStatusBody=EA;function PA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(PA,"createCheckAutoModStatusBody");le.createCheckAutoModStatusBody=PA;function AA(i,e){return{data:{user_id:(0,Qt.extractUserId)(i),reason:e}}}n(AA,"createWarnUserBody");le.createWarnUserBody=AA});var Sb=u(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.HelixAutoModSettings=void 0;var DA=(f(),b(y)),Ie=m(),dp=class extends Ie.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[Ie.rawDataSymbol].broadcaster_id}get moderatorId(){return this[Ie.rawDataSymbol].moderator_id}get overallLevel(){return this[Ie.rawDataSymbol].overall_level?this[Ie.rawDataSymbol].overall_level:null}get disability(){return this[Ie.rawDataSymbol].disability}get aggression(){return this[Ie.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[Ie.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[Ie.rawDataSymbol].misogyny}get bullying(){return this[Ie.rawDataSymbol].bullying}get swearing(){return this[Ie.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[Ie.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[Ie.rawDataSymbol].sex_based_terms}};Fn.HelixAutoModSettings=dp;Fn.HelixAutoModSettings=dp=DA.__decorate([(0,Ie.rtfm)("api","HelixAutoModSettings","broadcasterId")],dp)});var Hb=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixAutoModStatus=void 0;var IA=(f(),b(y)),jl=m(),hp=class extends jl.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[jl.rawDataSymbol].msg_id}get isPermitted(){return this[jl.rawDataSymbol].is_permitted}};Nn.HelixAutoModStatus=hp;Nn.HelixAutoModStatus=hp=IA.__decorate([(0,jl.rtfm)("api","HelixAutoModStatus","messageId")],hp)});var kl=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixBanUser=void 0;var pp=(f(),b(y)),mp=C(),Ht=m(),Qn=class extends Ht.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[Ht.rawDataSymbol].created_at)}get expiryDate(){return(0,mp.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[Ht.rawDataSymbol].moderator_id}async getModerator(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].moderator_id))}get userId(){return this[Ht.rawDataSymbol].user_id}async getUser(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].user_id))}};Gn.HelixBanUser=Qn;pp.__decorate([(0,mp.Enumerable)(!1)],Qn.prototype,"_client",void 0);pp.__decorate([(0,mp.Enumerable)(!1)],Qn.prototype,"_expiryTimestamp",void 0);Gn.HelixBanUser=Qn=pp.__decorate([(0,Ht.rtfm)("api","HelixBanUser","userId")],Qn)});var yp=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixBan=void 0;var TA=(f(),b(y)),$r=m(),RA=kl(),_p=class extends RA.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[$r.rawDataSymbol].user_login}get userDisplayName(){return this[$r.rawDataSymbol].user_name}get moderatorName(){return this[$r.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[$r.rawDataSymbol].moderator_name}get reason(){return this[$r.rawDataSymbol].reason||null}};Wn.HelixBan=_p;Wn.HelixBan=_p=TA.__decorate([(0,$r.rtfm)("api","HelixBan","userId")],_p)});var gp=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixBlockedTerm=void 0;var UA=(f(),b(y)),ht=m(),fp=class extends ht.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[ht.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[ht.rawDataSymbol].created_at)}get expirationDate(){return this[ht.rawDataSymbol].expires_at?new Date(this[ht.rawDataSymbol].expires_at):null}get id(){return this[ht.rawDataSymbol].id}get moderatorId(){return this[ht.rawDataSymbol].moderator_id}get text(){return this[ht.rawDataSymbol].text}get updatedDate(){return new Date(this[ht.rawDataSymbol].updated_at)}};Vn.HelixBlockedTerm=fp;Vn.HelixBlockedTerm=fp=UA.__decorate([(0,ht.rtfm)("api","HelixBlockedTerm","id")],fp)});var bp=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixModeratedChannel=void 0;var Cb=(f(),b(y)),BA=C(),Ct=m(),Ml=class extends Ct.DataObject{static{n(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[Ct.rawDataSymbol].broadcaster_id}get name(){return this[Ct.rawDataSymbol].broadcaster_login}get displayName(){return this[Ct.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Ct.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Ct.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Ct.checkRelationAssertion)(await this._client.users.getUserById(this[Ct.rawDataSymbol].broadcaster_id))}};$n.HelixModeratedChannel=Ml;Cb.__decorate([(0,BA.Enumerable)(!1)],Ml.prototype,"_client",void 0);$n.HelixModeratedChannel=Ml=Cb.__decorate([(0,Ct.rtfm)("api","HelixModeratedChannel","id")],Ml)});var xp=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixModerator=void 0;var qb=(f(),b(y)),OA=C(),dr=m(),Ll=class extends dr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[dr.rawDataSymbol].user_id}get userName(){return this[dr.rawDataSymbol].user_login}get userDisplayName(){return this[dr.rawDataSymbol].user_name}async getUser(){return(0,dr.checkRelationAssertion)(await this._client.users.getUserById(this[dr.rawDataSymbol].user_id))}};zn.HelixModerator=Ll;qb.__decorate([(0,OA.Enumerable)(!1)],Ll.prototype,"_client",void 0);zn.HelixModerator=Ll=qb.__decorate([(0,dr.rtfm)("api","HelixModerator","userId")],Ll)});var wp=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixShieldModeStatus=void 0;var Eb=(f(),b(y)),jA=C(),pt=m(),Fl=class extends pt.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[pt.rawDataSymbol].is_active}get moderatorId(){return this[pt.rawDataSymbol].moderator_id}get moderatorName(){return this[pt.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[pt.rawDataSymbol].moderator_name}async getModerator(){return(0,pt.checkRelationAssertion)(await this._client.users.getUserById(this[pt.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[pt.rawDataSymbol].last_activated_at===""?null:new Date(this[pt.rawDataSymbol].last_activated_at)}};Kn.HelixShieldModeStatus=Fl;Eb.__decorate([(0,jA.Enumerable)(!1)],Fl.prototype,"_client",void 0);Kn.HelixShieldModeStatus=Fl=Eb.__decorate([(0,pt.rtfm)("api","HelixShieldModeStatus")],Fl)});var vp=u(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.HelixUnbanRequest=void 0;var Pb=(f(),b(y)),Ab=C(),Y=m(),Nl=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,Ab.mapNullable)(this[Y.rawDataSymbol].resolved_at,e=>new Date(e))}};Jn.HelixUnbanRequest=Nl;Pb.__decorate([(0,Ab.Enumerable)(!1)],Nl.prototype,"_client",void 0);Jn.HelixUnbanRequest=Nl=Pb.__decorate([(0,Y.rtfm)("api","HelixUnbanRequest","id")],Nl)});var Sp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixWarning=void 0;var Db=(f(),b(y)),kA=C(),Ve=m(),Ql=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}};Zn.HelixWarning=Ql;Db.__decorate([(0,kA.Enumerable)(!1)],Ql.prototype,"_client",void 0);Zn.HelixWarning=Ql=Db.__decorate([(0,Ve.rtfm)("api","HelixWarning","userId")],Ql)});var Ep=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixModerationApi=void 0;var MA=(f(),b(y)),Hp=Z(),M=m(),hr=Ue(),Ye=vb(),Gl=ae(),Xn=ce(),Yn=se(),LA=Q(),Ib=Sb(),FA=Hb(),Tb=yp(),NA=kl(),Rb=gp(),Ub=bp(),Bb=xp(),Ob=wp(),Cp=vp(),QA=Sp(),qp=class extends LA.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,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(r,Tb.HelixBan,this._client)}getBannedUsersPaginated(e){return new Gl.HelixPaginatedRequest({url:"moderation/banned",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:(0,Hp.createBroadcasterQuery)(e)},this._client,t=>new Tb.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,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(r,Bb.HelixModerator,this._client)}getModeratorsPaginated(e){return new Gl.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,M.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,Hp.createBroadcasterQuery)(e)},this._client,t=>new Bb.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,hr.createSingleKeyQuery)("user_id",r),...(0,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(a,Ub.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,M.extractUserId)(e);return new Gl.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,hr.createSingleKeyQuery)("user_id",t)},this._client,r=>new Ub.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,Hp.createBroadcasterQuery)(e),jsonBody:(0,Ye.createCheckAutoModStatusBody)(t)})).data.map(a=>new FA.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 Ib.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 Ib.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 NA.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,hr.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,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(a,Rb.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 Rb.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,hr.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 Ob.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 Ob.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,hr.createSingleKeyQuery)("status",t),...(0,Yn.createPaginationQuery)(r)}});return(0,Xn.createPaginatedResult)(s,Cp.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,M.extractUserId)(e);return new Gl.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,hr.createSingleKeyQuery)("status",t)}},this._client,a=>new Cp.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 Cp.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 QA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,hr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};ea.HelixModerationApi=qp;ea.HelixModerationApi=qp=MA.__decorate([(0,M.rtfm)("api","HelixModerationApi")],qp)});var kb=u(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.createPollEndBody=zr.createPollBody=void 0;var jb=m();function GA(i,e){var t;return{broadcaster_id:(0,jb.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(GA,"createPollBody");zr.createPollBody=GA;function WA(i,e,t){return{broadcaster_id:(0,jb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(WA,"createPollEndBody");zr.createPollEndBody=WA});var Ap=u(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.HelixPollChoice=void 0;var VA=(f(),b(y)),Kr=m(),Pp=class extends Kr.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[Kr.rawDataSymbol].id}get title(){return this[Kr.rawDataSymbol].title}get totalVotes(){return this[Kr.rawDataSymbol].votes}get channelPointsVotes(){return this[Kr.rawDataSymbol].channel_points_votes}};ta.HelixPollChoice=Pp;ta.HelixPollChoice=Pp=VA.__decorate([(0,Kr.rtfm)("api","HelixPollChoice","id")],Pp)});var Dp=u(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixPoll=void 0;var Mb=(f(),b(y)),$A=C(),He=m(),zA=Ap(),Wl=class extends He.DataObject{static{n(this,"HelixPoll")}constructor(e,t){super(e),this._client=t}get id(){return this[He.rawDataSymbol].id}get broadcasterId(){return this[He.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[He.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[He.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,He.checkRelationAssertion)(await this._client.users.getUserById(this[He.rawDataSymbol].broadcaster_id))}get title(){return this[He.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[He.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[He.rawDataSymbol].channel_points_per_vote}get status(){return this[He.rawDataSymbol].status}get durationInSeconds(){return this[He.rawDataSymbol].duration}get startDate(){return new Date(this[He.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[He.rawDataSymbol].duration*1e3)}get choices(){return this[He.rawDataSymbol].choices.map(e=>new zA.HelixPollChoice(e))}};ra.HelixPoll=Wl;Mb.__decorate([(0,$A.Enumerable)(!1)],Wl.prototype,"_client",void 0);ra.HelixPoll=Wl=Mb.__decorate([(0,He.rtfm)("api","HelixPoll","id")],Wl)});var Tp=u(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.HelixPollApi=void 0;var KA=(f(),b(y)),Lb=Z(),Jr=m(),JA=Ue(),Fb=kb(),ZA=ae(),XA=ce(),YA=se(),eD=Q(),ia=Dp(),Ip=class extends eD.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:{...(0,Lb.createBroadcasterQuery)(e),...(0,YA.createPaginationQuery)(t)}});return(0,XA.createPaginatedResult)(r,ia.HelixPoll,this._client)}getPollsPaginated(e){return new ZA.HelixPaginatedRequest({url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,Lb.createBroadcasterQuery)(e)},this._client,t=>new ia.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,JA.createGetByIdsQuery)(e,t)})).data.map(a=>new ia.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,Jr.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Fb.createPollBody)(e,t)});return new ia.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,Jr.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Fb.createPollEndBody)(e,t,r)});return new ia.HelixPoll(a.data[0],this._client)}};na.HelixPollApi=Ip;na.HelixPollApi=Ip=KA.__decorate([(0,Jr.rtfm)("api","HelixPollApi")],Ip)});var Qb=u(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.createEndPredictionBody=Zr.createPredictionBody=void 0;var Nb=m();function tD(i,e){return{broadcaster_id:(0,Nb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(tD,"createPredictionBody");Zr.createPredictionBody=tD;function rD(i,e,t,r){return{broadcaster_id:(0,Nb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(rD,"createEndPredictionBody");Zr.createEndPredictionBody=rD});var Rp=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixPredictor=void 0;var Gb=(f(),b(y)),iD=C(),Gt=m(),Vl=class extends Gt.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Gt.rawDataSymbol].user_id}get userName(){return this[Gt.rawDataSymbol].user_login}get userDisplayName(){return this[Gt.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Gt.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Gt.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Gt.rawDataSymbol].channel_points_won}};aa.HelixPredictor=Vl;Gb.__decorate([(0,iD.Enumerable)(!1)],Vl.prototype,"_client",void 0);aa.HelixPredictor=Vl=Gb.__decorate([(0,Gt.rtfm)("api","HelixPredictor","userId")],Vl)});var Up=u(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.HelixPredictionOutcome=void 0;var Wb=(f(),b(y)),nD=C(),Wt=m(),aD=Rp(),$l=class extends Wt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Wt.rawDataSymbol].id}get title(){return this[Wt.rawDataSymbol].title}get users(){return this[Wt.rawDataSymbol].users}get totalChannelPoints(){return this[Wt.rawDataSymbol].channel_points}get color(){return this[Wt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Wt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new aD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};sa.HelixPredictionOutcome=$l;Wb.__decorate([(0,nD.Enumerable)(!1)],$l.prototype,"_client",void 0);sa.HelixPredictionOutcome=$l=Wb.__decorate([(0,Wt.rtfm)("api","HelixPredictionOutcome","id")],$l)});var Bp=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixPrediction=void 0;var $b=(f(),b(y)),sD=C(),ee=m(),Vb=Up(),zl=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 Vb.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 Vb.HelixPredictionOutcome(e,this._client)}};oa.HelixPrediction=zl;$b.__decorate([(0,sD.Enumerable)(!1)],zl.prototype,"_client",void 0);oa.HelixPrediction=zl=$b.__decorate([(0,ee.rtfm)("api","HelixPrediction","id")],zl)});var jp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixPredictionApi=void 0;var oD=(f(),b(y)),zb=Z(),Xr=m(),lD=Ue(),Kb=Qb(),uD=ae(),cD=ce(),dD=se(),hD=Q(),la=Bp(),Op=class extends hD.BaseApi{static{n(this,"HelixPredictionApi")}async getPredictions(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,zb.createBroadcasterQuery)(e),...(0,dD.createPaginationQuery)(t)}});return(0,cD.createPaginatedResult)(r,la.HelixPrediction,this._client)}getPredictionsPaginated(e){return new uD.HelixPaginatedRequest({url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,zb.createBroadcasterQuery)(e)},this._client,t=>new la.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,lD.createGetByIdsQuery)(e,t)})).data.map(a=>new la.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,Xr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,Kb.createPredictionBody)(e,t)});return new la.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,Xr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,Kb.createEndPredictionBody)(e,t,r,a)});return new la.HelixPrediction(s.data[0],this._client)}};ua.HelixPredictionApi=Op;ua.HelixPredictionApi=Op=oD.__decorate([(0,Xr.rtfm)("api","HelixPredictionApi")],Op)});var Zb=u(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.createRaidStartQuery=void 0;var Jb=m();function pD(i,e){return{from_broadcaster_id:(0,Jb.extractUserId)(i),to_broadcaster_id:(0,Jb.extractUserId)(e)}}n(pD,"createRaidStartQuery");Kl.createRaidStartQuery=pD});var Mp=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixRaid=void 0;var mD=(f(),b(y)),Jl=m(),kp=class extends Jl.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[Jl.rawDataSymbol].created_at)}get targetIsMature(){return this[Jl.rawDataSymbol].is_mature}};ca.HelixRaid=kp;ca.HelixRaid=kp=mD.__decorate([(0,Jl.rtfm)("api","HelixRaid")],kp)});var Np=u(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.HelixRaidApi=void 0;var _D=(f(),b(y)),yD=Z(),Lp=m(),fD=Zb(),gD=Q(),bD=Mp(),Fp=class extends gD.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Lp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,fD.createRaidStartQuery)(e,t)});return new bD.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Lp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,yD.createBroadcasterQuery)(e)})}};da.HelixRaidApi=Fp;da.HelixRaidApi=Fp=_D.__decorate([(0,Lp.rtfm)("api","HelixRaidApi")],Fp)});var Qp=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.createScheduleSegmentUpdateBody=$e.createScheduleSegmentModifyQuery=$e.createScheduleSegmentBody=$e.createScheduleSettingsUpdateQuery=$e.createScheduleQuery=void 0;var Zl=m();function xD(i,e){var t;return{broadcaster_id:(0,Zl.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(xD,"createScheduleQuery");$e.createScheduleQuery=xD;function wD(i,e){return e.vacation?{broadcaster_id:(0,Zl.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,Zl.extractUserId)(i),is_vacation_enabled:"false"}}n(wD,"createScheduleSettingsUpdateQuery");$e.createScheduleSettingsUpdateQuery=wD;function vD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(vD,"createScheduleSegmentBody");$e.createScheduleSegmentBody=vD;function SD(i,e){return{broadcaster_id:(0,Zl.extractUserId)(i),id:e}}n(SD,"createScheduleSegmentModifyQuery");$e.createScheduleSegmentModifyQuery=SD;function HD(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(HD,"createScheduleSegmentUpdateBody");$e.createScheduleSegmentUpdateBody=HD});var pa=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixScheduleSegment=void 0;var Xb=(f(),b(y)),Yb=C(),et=m(),Xl=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,Yb.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}};ha.HelixScheduleSegment=Xl;Xb.__decorate([(0,Yb.Enumerable)(!1)],Xl.prototype,"_client",void 0);ha.HelixScheduleSegment=Xl=Xb.__decorate([(0,et.rtfm)("api","HelixScheduleSegment","id")],Xl)});var Wp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixPaginatedScheduleSegmentRequest=void 0;var CD=(f(),b(y)),qD=m(),ED=Qp(),PD=ae(),AD=pa(),Gp=class extends PD.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,ED.createScheduleQuery)(e,r)},t,a=>new AD.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}}};ma.HelixPaginatedScheduleSegmentRequest=Gp;ma.HelixPaginatedScheduleSegmentRequest=Gp=CD.__decorate([(0,qD.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Gp)});var Vp=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixSchedule=void 0;var ex=(f(),b(y)),DD=C(),mt=m(),ID=pa(),Yl=class extends mt.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[mt.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new ID.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?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(0,mt.checkRelationAssertion)(await this._client.users.getUserById(this[mt.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[mt.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[mt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};_a.HelixSchedule=Yl;ex.__decorate([(0,DD.Enumerable)(!1)],Yl.prototype,"_client",void 0);_a.HelixSchedule=Yl=ex.__decorate([(0,mt.rtfm)("api","HelixSchedule","broadcasterId")],Yl)});var Kp=u(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.HelixScheduleApi=void 0;var tx=Z(),Yr=m(),TD=Ue(),ei=Qp(),RD=se(),UD=Q(),BD=Wp(),OD=Vp(),$p=pa(),zp=class extends UD.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,Yr.extractUserId)(e),query:{...(0,ei.createScheduleQuery)(e,t),...(0,RD.createPaginationQuery)(t)}});return{data:new OD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new BD.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,Yr.extractUserId)(e),query:(0,TD.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new $p.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,tx.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ei.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,tx.createBroadcasterQuery)(e),jsonBody:(0,ei.createScheduleSegmentBody)(t)});return new $p.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,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ei.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,ei.createScheduleSegmentUpdateBody)(r)});return new $p.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ei.createScheduleSegmentModifyQuery)(e,t)})}};eu.HelixScheduleApi=zp});var rx=u(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.createSearchChannelsQuery=void 0;function jD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(jD,"createSearchChannelsQuery");tu.createSearchChannelsQuery=jD});var Jp=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixChannelSearchResult=void 0;var ix=(f(),b(y)),kD=C(),ye=m(),ru=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}};ya.HelixChannelSearchResult=ru;ix.__decorate([(0,kD.Enumerable)(!1)],ru.prototype,"_client",void 0);ya.HelixChannelSearchResult=ru=ix.__decorate([(0,ye.rtfm)("api","HelixChannelSearchResult","id")],ru)});var Xp=u(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.HelixSearchApi=void 0;var MD=(f(),b(y)),LD=m(),nx=rx(),ax=ae(),sx=ce(),ox=se(),FD=Q(),lx=Il(),ux=Jp(),Zp=class extends FD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,ox.createPaginationQuery)(t)}});return(0,sx.createPaginatedResult)(r,lx.HelixGame,this._client)}searchCategoriesPaginated(e){return new ax.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new lx.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,nx.createSearchChannelsQuery)(e,t),...(0,ox.createPaginationQuery)(t)}});return(0,sx.createPaginatedResult)(r,ux.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new ax.HelixPaginatedRequest({url:"search/channels",query:(0,nx.createSearchChannelsQuery)(e,t)},this._client,r=>new ux.HelixChannelSearchResult(r,this._client))}};fa.HelixSearchApi=Zp;fa.HelixSearchApi=Zp=MD.__decorate([(0,LD.rtfm)("api","HelixSearchApi")],Zp)});var em=u(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.StreamNotLiveError=void 0;var ND=m(),Yp=class extends ND.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};iu.StreamNotLiveError=Yp});var cx=u(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.createVideoQuery=Vt.createStreamMarkerBody=Vt.createStreamQuery=void 0;var QD=m();function GD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(GD,"createStreamQuery");Vt.createStreamQuery=GD;function WD(i,e){return{user_id:(0,QD.extractUserId)(i),description:e}}n(WD,"createStreamMarkerBody");Vt.createStreamMarkerBody=WD;function VD(i){return{video_id:i}}n(VD,"createVideoQuery");Vt.createVideoQuery=VD});var tm=u(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.HelixStream=void 0;var dx=(f(),b(y)),$D=C(),te=m(),nu=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}};ga.HelixStream=nu;dx.__decorate([(0,$D.Enumerable)(!1)],nu.prototype,"_client",void 0);ga.HelixStream=nu=dx.__decorate([(0,te.rtfm)("api","HelixStream","id")],nu)});var su=u(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.HelixStreamMarker=void 0;var hx=(f(),b(y)),zD=C(),ti=m(),au=class extends ti.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[ti.rawDataSymbol].id}get creationDate(){return new Date(this[ti.rawDataSymbol].created_at)}get description(){return this[ti.rawDataSymbol].description}get positionInSeconds(){return this[ti.rawDataSymbol].position_seconds}};ba.HelixStreamMarker=au;hx.__decorate([(0,zD.Enumerable)(!1)],au.prototype,"_client",void 0);ba.HelixStreamMarker=au=hx.__decorate([(0,ti.rtfm)("api","HelixStreamMarker","id")],au)});var nm=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixStreamMarkerWithVideo=void 0;var KD=(f(),b(y)),rm=m(),JD=su(),im=class extends JD.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[rm.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,rm.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};xa.HelixStreamMarkerWithVideo=im;xa.HelixStreamMarkerWithVideo=im=KD.__decorate([(0,rm.rtfm)("api","HelixStreamMarkerWithVideo","id")],im)});var sm=u(Sa=>{"use strict";var ii;Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixStreamApi=void 0;var am=(f(),b(y)),wa=C(),px=Z(),Te=m(),ZD=em(),ou=Ue(),ri=cx(),mx=Bt(),lu=ae(),_x=ce(),uu=se(),XD=Q(),pr=tm(),YD=su(),e1=nm(),va=ii=class extends XD.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new mx.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new pr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new mx.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new pr.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,ri.createStreamQuery)(e),...(0,uu.createPaginationQuery)(e)}});return(0,_x.createPaginatedResult)(t,pr.HelixStream,this._client)}getStreamsPaginated(e={}){return new lu.HelixPaginatedRequest({url:"streams",query:(0,ri.createStreamQuery)(e)},this._client,t=>new pr.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Te.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,Te.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Te.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Te.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,ri.createStreamQuery)({userId:t})});return(0,wa.mapNullable)(r.data[0],a=>new pr.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Te.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,ou.createUserQuery)(e),...(0,uu.createPaginationQuery)(t)},userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,wa.flatten)(a.data.map(s=>ii._mapGetStreamMarkersResult(s,this._client))),cursor:(r=a.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new lu.HelixPaginatedRequest({url:"streams/markers",query:(0,ou.createUserQuery)(e),userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>ii._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var a;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,ri.createVideoQuery)(t),...(0,uu.createPaginationQuery)(r)},userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,wa.flatten)(s.data.map(o=>ii._mapGetStreamMarkersResult(o,this._client))),cursor:(a=s.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new lu.HelixPaginatedRequest({url:"streams/markers",query:(0,ri.createVideoQuery)(t),userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>ii._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Te.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,ri.createStreamMarkerBody)(e,t)});return new YD.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof px.HttpStatusCodeError&&r.statusCode===404?new ZD.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,Te.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,px.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,Te.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,ou.createSingleKeyQuery)("user_id",r),...(0,uu.createPaginationQuery)(t)}});return(0,_x.createPaginatedResult)(a,pr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Te.extractUserId)(e);return new lu.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,ou.createSingleKeyQuery)("user_id",t)},this._client,r=>new pr.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,a)=>[...r,...a.markers.map(s=>new e1.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};Sa.HelixStreamApi=va;am.__decorate([(0,wa.Enumerable)(!1)],va.prototype,"_getStreamByUserIdBatcher",void 0);am.__decorate([(0,wa.Enumerable)(!1)],va.prototype,"_getStreamByUserNameBatcher",void 0);Sa.HelixStreamApi=va=ii=am.__decorate([(0,Te.rtfm)("api","HelixStreamApi")],va)});var fx=u(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.createSubscriptionCheckQuery=void 0;var yx=m();function t1(i,e){return{broadcaster_id:(0,yx.extractUserId)(i),user_id:(0,yx.extractUserId)(e)}}n(t1,"createSubscriptionCheckQuery");cu.createSubscriptionCheckQuery=t1});var hu=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixUserSubscription=void 0;var gx=(f(),b(y)),r1=C(),$t=m(),du=class extends $t.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[$t.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[$t.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[$t.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[$t.rawDataSymbol].broadcaster_id)}get isGift(){return this[$t.rawDataSymbol].is_gift}get tier(){return this[$t.rawDataSymbol].tier}};Ha.HelixUserSubscription=du;gx.__decorate([(0,r1.Enumerable)(!1)],du.prototype,"_client",void 0);Ha.HelixUserSubscription=du=gx.__decorate([(0,$t.rtfm)("api","HelixUserSubscription","broadcasterId")],du)});var pu=u(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.HelixSubscription=void 0;var i1=(f(),b(y)),ue=m(),n1=hu(),om=class extends n1.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[ue.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ue.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ue.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].broadcaster_id))}get gifterId(){return this[ue.rawDataSymbol].is_gift?this[ue.rawDataSymbol].gifter_id:null}get gifterName(){return this[ue.rawDataSymbol].is_gift?this[ue.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[ue.rawDataSymbol].is_gift?this[ue.rawDataSymbol].gifter_name:null}async getGifter(){return this[ue.rawDataSymbol].is_gift?(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].gifter_id)):null}get userId(){return this[ue.rawDataSymbol].user_id}get userName(){return this[ue.rawDataSymbol].user_login}get userDisplayName(){return this[ue.rawDataSymbol].user_name}async getUser(){return(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].user_id))}};Ca.HelixSubscription=om;Ca.HelixSubscription=om=i1.__decorate([(0,ue.rtfm)("api","HelixSubscription","userId")],om)});var um=u(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.HelixPaginatedSubscriptionsRequest=void 0;var a1=(f(),b(y)),s1=Z(),bx=m(),o1=Mr(),l1=pu(),lm=class extends o1.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,bx.extractUserId)(e),query:(0,s1.createBroadcasterQuery)(e)},t,r=>new l1.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};qa.HelixPaginatedSubscriptionsRequest=lm;qa.HelixPaginatedSubscriptionsRequest=lm=a1.__decorate([(0,bx.rtfm)("api","HelixPaginatedSubscriptionsRequest")],lm)});var dm=u(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixSubscriptionApi=void 0;var u1=(f(),b(y)),xx=Z(),mu=m(),c1=Ue(),d1=fx(),h1=ce(),p1=se(),m1=Q(),_1=um(),wx=pu(),y1=hu(),cm=class extends m1.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,mu.extractUserId)(e),query:{...(0,xx.createBroadcasterQuery)(e),...(0,p1.createPaginationQuery)(t)}});return{...(0,h1.createPaginatedResultWithTotal)(r,wx.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new _1.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,mu.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,c1.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new wx.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,mu.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,d1.createSubscriptionCheckQuery)(t,e)});return new y1.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof xx.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ea.HelixSubscriptionApi=cm;Ea.HelixSubscriptionApi=cm=u1.__decorate([(0,mu.rtfm)("api","HelixSubscriptionApi")],cm)});var yu=u(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixTeam=void 0;var vx=(f(),b(y)),f1=C(),tt=m(),_u=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}};Pa.HelixTeam=_u;vx.__decorate([(0,f1.Enumerable)(!1)],_u.prototype,"_client",void 0);Pa.HelixTeam=_u=vx.__decorate([(0,tt.rtfm)("api","HelixTeam","id")],_u)});var pm=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixTeamWithUsers=void 0;var g1=(f(),b(y)),Sx=m(),b1=Lo(),x1=yu(),hm=class extends x1.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Sx.rawDataSymbol].users.map(e=>new b1.HelixUserRelation(e,this._client))}};Aa.HelixTeamWithUsers=hm;Aa.HelixTeamWithUsers=hm=g1.__decorate([(0,Sx.rtfm)("api","HelixTeamWithUsers","id")],hm)});var ym=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixTeamApi=void 0;var w1=(f(),b(y)),mm=Z(),Cx=m(),v1=Q(),S1=yu(),Hx=pm(),_m=class extends v1.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,Cx.extractUserId)(e),query:(0,mm.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new S1.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 Hx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof mm.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 Hx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof mm.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Da.HelixTeamApi=_m;Da.HelixTeamApi=_m=w1.__decorate([(0,Cx.rtfm)("api","HelixTeamApi")],_m)});var Ex=u(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.createUserBlockDeleteQuery=ni.createUserBlockCreateQuery=void 0;var qx=m();function H1(i,e){return{target_user_id:(0,qx.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(H1,"createUserBlockCreateQuery");ni.createUserBlockCreateQuery=H1;function C1(i){return{target_user_id:(0,qx.extractUserId)(i)}}n(C1,"createUserBlockDeleteQuery");ni.createUserBlockDeleteQuery=C1});var bu=u(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.HelixBaseExtension=void 0;var fu=m(),fm=class extends fu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[fu.rawDataSymbol].id}get version(){return this[fu.rawDataSymbol].version}get name(){return this[fu.rawDataSymbol].name}};gu.HelixBaseExtension=fm});var bm=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixInstalledExtension=void 0;var q1=(f(),b(y)),E1=m(),P1=bu(),gm=class extends P1.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}};Ia.HelixInstalledExtension=gm;Ia.HelixInstalledExtension=gm=q1.__decorate([(0,E1.rtfm)("api","HelixInstalledExtension","id")],gm)});var vm=u(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.HelixInstalledExtensionList=void 0;var A1=(f(),b(y)),Ta=m(),xm=bm(),wm=class extends Ta.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[Ta.rawDataSymbol][e][t];return r.active?new xm.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[Ta.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new xm.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[Ta.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new xm.HelixInstalledExtension(e,r,a)))}};Ra.HelixInstalledExtensionList=wm;Ra.HelixInstalledExtensionList=wm=A1.__decorate([(0,Ta.rtfm)("api","HelixInstalledExtensionList")],wm)});var Cm=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixUserExtension=void 0;var D1=(f(),b(y)),Sm=m(),I1=bu(),Hm=class extends I1.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[Sm.rawDataSymbol].can_activate}get types(){return this[Sm.rawDataSymbol].type}};Ua.HelixUserExtension=Hm;Ua.HelixUserExtension=Hm=D1.__decorate([(0,Sm.rtfm)("api","HelixUserExtension","id")],Hm)});var wu=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixUser=void 0;var Px=(f(),b(y)),T1=C(),rt=m(),xu=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}};Ba.HelixUser=xu;Px.__decorate([(0,T1.Enumerable)(!1)],xu.prototype,"_client",void 0);Ba.HelixUser=xu=Px.__decorate([(0,rt.rtfm)("api","HelixUser","id")],xu)});var Em=u(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HelixPrivilegedUser=void 0;var R1=(f(),b(y)),Ax=m(),U1=wu(),qm=class extends U1.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[Ax.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};Oa.HelixPrivilegedUser=qm;Oa.HelixPrivilegedUser=qm=R1.__decorate([(0,Ax.rtfm)("api","HelixPrivilegedUser","id")],qm)});var Pm=u(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.HelixUserBlock=void 0;var Dx=(f(),b(y)),B1=C(),mr=m(),vu=class extends mr.DataObject{static{n(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[mr.rawDataSymbol].user_id}get userName(){return this[mr.rawDataSymbol].user_login}get userDisplayName(){return this[mr.rawDataSymbol].display_name}async getUser(){return(0,mr.checkRelationAssertion)(await this._client.users.getUserById(this[mr.rawDataSymbol].user_id))}};ja.HelixUserBlock=vu;Dx.__decorate([(0,B1.Enumerable)(!1)],vu.prototype,"_client",void 0);ja.HelixUserBlock=vu=Dx.__decorate([(0,mr.rtfm)("api","HelixUserBlock","userId")],vu)});var Im=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixUserApi=void 0;var Am=(f(),b(y)),Dm=C(),Ix=Z(),be=m(),O1=Ue(),Tx=Ex(),Rx=Bt(),j1=ae(),k1=ce(),M1=se(),L1=Q(),Ux=vm(),F1=Cm(),Bx=Em(),Su=wu(),Ox=Pm(),ka=class extends L1.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new Rx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new Su.HelixUser(e,this._client)),this._getUserByNameBatcher=new Rx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new Su.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,Dm.mapNullable)(r.data[0],a=>new Su.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 Bx.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 Bx.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,Ix.createBroadcasterQuery)(e),...(0,M1.createPaginationQuery)(t)}});return(0,k1.createPaginatedResult)(r,Ox.HelixUserBlock,this._client)}getBlocksPaginated(e){return new j1.HelixPaginatedRequest({url:"users/blocks",userId:(0,be.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,Ix.createBroadcasterQuery)(e)},this._client,t=>new Ox.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,Tx.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,Tx.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 F1.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,O1.createSingleKeyQuery)("user_id",r)});return new Ux.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 Ux.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 Su.HelixUser(s,this._client))}};Ma.HelixUserApi=ka;Am.__decorate([(0,Dm.Enumerable)(!1)],ka.prototype,"_getUserByIdBatcher",void 0);Am.__decorate([(0,Dm.Enumerable)(!1)],ka.prototype,"_getUserByNameBatcher",void 0);Ma.HelixUserApi=ka=Am.__decorate([(0,be.rtfm)("api","HelixUserApi")],ka)});var Rm=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixVideo=void 0;var Tm=(f(),b(y)),jx=xi(),N1=C(),O=m(),La=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})}};Fa.HelixVideo=La;Tm.__decorate([(0,N1.Enumerable)(!1)],La.prototype,"_client",void 0);Tm.__decorate([(0,jx.CachedGetter)()],La.prototype,"durationInSeconds",null);Fa.HelixVideo=La=Tm.__decorate([jx.Cacheable,(0,O.rtfm)("api","HelixVideo","id")],La)});var Bm=u(Na=>{"use strict";var Hu;Object.defineProperty(Na,"__esModule",{value:!0});Na.HelixVideoApi=void 0;var kx=(f(),b(y)),Q1=C(),Cu=m(),G1=Bt(),W1=ae(),V1=ce(),$1=se(),z1=Q(),Um=Rm(),qu=Hu=class extends z1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new G1.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new Um.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,Cu.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Cu.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,Cu.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:{...Hu._makeVideosQuery(e,t,r),...(0,$1.createPaginationQuery)(r)}});return(0,V1.createPaginatedResult)(a,Um.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new W1.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Hu._makeVideosQuery(e,t,r)},this._client,a=>new Um.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}}};Na.HelixVideoApi=qu;kx.__decorate([(0,Q1.Enumerable)(!1)],qu.prototype,"_getVideoByIdBatcher",void 0);Na.HelixVideoApi=qu=Hu=kx.__decorate([(0,Cu.rtfm)("api","HelixVideoApi")],qu)});var Lx=u(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.createWhisperQuery=void 0;var Mx=m();function K1(i,e){return{from_user_id:(0,Mx.extractUserId)(i),to_user_id:(0,Mx.extractUserId)(e)}}n(K1,"createWhisperQuery");Eu.createWhisperQuery=K1});var jm=u(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.HelixWhisperApi=void 0;var J1=(f(),b(y)),Fx=m(),Z1=Lx(),X1=Q(),Om=class extends X1.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,Fx.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,Z1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};Qa.HelixWhisperApi=Om;Qa.HelixWhisperApi=Om=J1.__decorate([(0,Fx.rtfm)("api","HelixWhisperApi")],Om)});var Mm=u(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.ApiReportedRequest=void 0;var km=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}};Pu.ApiReportedRequest=km});var Du=u(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.BaseApiClient=void 0;var G=(f(),b(y)),W=xi(),Y1=Ys(),eI=C(),tI=od(),ai=Z(),Au=Cd(),Nx=m(),rI=rg(),iI=Rd(),nI=$d(),aI=Zd(),sI=ih(),oI=Ch(),lI=Ah(),uI=Rh(),cI=kh(),dI=$h(),hI=ep(),pI=ip(),mI=sp(),_I=cp(),yI=Ep(),fI=Tp(),gI=jp(),bI=Np(),xI=Kp(),wI=Xp(),vI=sm(),SI=dm(),HI=ym(),CI=Im(),qI=Bm(),EI=jm(),PI=Mm(),L=class extends tI.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 Au.TokenInfo(e)}catch(e){throw e instanceof ai.HttpStatusCodeError&&e.statusCode===401?new Au.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,ai.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 Nx.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,Au.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,Au.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 iI.HelixBitsApi(this)}get channels(){return new nI.HelixChannelApi(this)}get channelPoints(){return new aI.HelixChannelPointsApi(this)}get charity(){return new sI.HelixCharityApi(this)}get chat(){return new oI.HelixChatApi(this)}get clips(){return new lI.HelixClipApi(this)}get contentClassificationLabels(){return new uI.HelixContentClassificationLabelApi(this)}get entitlements(){return new cI.HelixEntitlementApi(this)}get eventSub(){return new dI.HelixEventSubApi(this)}get extensions(){return new hI.HelixExtensionsApi(this)}get games(){return new pI.HelixGameApi(this)}get hypeTrain(){return new _I.HelixHypeTrainApi(this)}get goals(){return new mI.HelixGoalApi(this)}get moderation(){return new yI.HelixModerationApi(this)}get polls(){return new fI.HelixPollApi(this)}get predictions(){return new gI.HelixPredictionApi(this)}get raids(){return new bI.HelixRaidApi(this)}get schedule(){return new xI.HelixScheduleApi(this)}get search(){return new wI.HelixSearchApi(this)}get streams(){return new vI.HelixStreamApi(this)}get subscriptions(){return new SI.HelixSubscriptionApi(this)}get teams(){return new HI.HelixTeamApi(this)}get users(){return new CI.HelixUserApi(this)}get videos(){return new qI.HelixVideoApi(this)}get whispers(){return new EI.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof Y1.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 PI.ApiReportedRequest(e,l.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,ai.handleTwitchApiResponseError)(l,e),await(0,ai.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=rI.operation({retries:3,minTimeout:500,factor:2}),{promise:q,resolve:E,reject:w}=(0,eI.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,ai.callTwitchApiRaw)(e,t,r,a,d,h);!v.ok&&v.status>=500&&v.status<600&&await(0,ai.handleTwitchApiResponseError)(v,e),E(v)}catch(v){if(x.retry(v))return;w(x.mainError())}});let P=await q;return this._logger.debug(`Called ${p} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${P.status}`),P}};Ga.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);Ga.BaseApiClient=L=G.__decorate([W.Cacheable,(0,Nx.rtfm)("api","ApiClient")],L)});var Qx=u(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.NoContextApiClient=void 0;var AI=(f(),b(y)),DI=m(),II=Du(),Lm=class extends II.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Wa.NoContextApiClient=Lm;Wa.NoContextApiClient=Lm=AI.__decorate([(0,DI.rtfm)("api","ApiClient")],Lm)});var Gx=u(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.UserContextApiClient=void 0;var TI=(f(),b(y)),RI=m(),UI=Du(),Fm=class extends UI.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Va.UserContextApiClient=Fm;Va.UserContextApiClient=Fm=TI.__decorate([(0,RI.rtfm)("api","ApiClient")],Fm)});var zx=u($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.ApiClient=void 0;var BI=(f(),b(y)),OI=hi(),jI=mi(),Wx=Ys(),kI=Z(),$x=m(),MI=rd(),LI=Rf(),FI=Du(),NI=Qx(),Vx=Gx(),Nm=class extends FI.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new MI.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,jI.createLogger)({name:"twurple:api:client",...e.logger}),OI.isNode?new Wx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new LI.HelixRateLimiter({logger:t}),"createChild")}):new Wx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,kI.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 Vx.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,$x.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 Vx.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 NI.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};$a.ApiClient=Nm;$a.ApiClient=Nm=BI.__decorate([(0,$x.rtfm)("api","ApiClient")],Nm)});var Jx=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.HelixFollow=void 0;var Kx=(f(),b(y)),QI=C(),je=m(),Iu=class extends je.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[je.rawDataSymbol].from_id}get userName(){return this[je.rawDataSymbol].from_login}get userDisplayName(){return this[je.rawDataSymbol].from_name}async getUser(){return(0,je.checkRelationAssertion)(await this._client.users.getUserById(this[je.rawDataSymbol].from_id))}get followedUserId(){return this[je.rawDataSymbol].to_id}get followedUserName(){return this[je.rawDataSymbol].to_login}get followedUserDisplayName(){return this[je.rawDataSymbol].to_name}async getFollowedUser(){return(0,je.checkRelationAssertion)(await this._client.users.getUserById(this[je.rawDataSymbol].to_id))}get followDate(){return new Date(this[je.rawDataSymbol].followed_at)}};za.HelixFollow=Iu;Kx.__decorate([(0,QI.Enumerable)(!1)],Iu.prototype,"_client",void 0);za.HelixFollow=Iu=Kx.__decorate([(0,je.rtfm)("api","HelixFollow")],Iu)});var Zx=u(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});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.HelixSharedChatSession=c.HelixSharedChatSessionParticipant=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.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=c.HelixHypeTrainContribution=c.HelixHypeTrainApi=void 0;c.HellFreezesOverError=c.HelixExtension=c.extractUserName=c.extractUserId=c.HelixPaginatedRequestWithTotal=c.HelixPaginatedRequest=c.ApiReportedRequest=c.StreamNotLiveError=c.ConfigError=c.HelixWhisperApi=void 0;var GI=zx();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:n(function(){return GI.ApiClient},"get")});var WI=Rd();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:n(function(){return WI.HelixBitsApi},"get")});var VI=Pd();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return VI.HelixBitsLeaderboard},"get")});var $I=qd();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return $I.HelixBitsLeaderboardEntry},"get")});var zI=Dd();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:n(function(){return zI.HelixCheermoteList},"get")});var KI=$d();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:n(function(){return KI.HelixChannelApi},"get")});var JI=Nd();Object.defineProperty(c,"HelixAdSchedule",{enumerable:!0,get:n(function(){return JI.HelixAdSchedule},"get")});var ZI=jd();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:n(function(){return ZI.HelixChannel},"get")});var XI=kd();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:n(function(){return XI.HelixChannelEditor},"get")});var YI=Md();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:n(function(){return YI.HelixChannelFollower},"get")});var eT=Ld();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return eT.HelixFollowedChannel},"get")});var tT=zh();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:n(function(){return tT.HelixChannelReference},"get")});var rT=Zd();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return rT.HelixChannelPointsApi},"get")});var iT=zd();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:n(function(){return iT.HelixCustomReward},"get")});var nT=Kd();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return nT.HelixCustomRewardRedemption},"get")});var aT=ih();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:n(function(){return aT.HelixCharityApi},"get")});var sT=Yd();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return sT.HelixCharityCampaign},"get")});var oT=eh();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return oT.HelixCharityCampaignDonation},"get")});var lT=rl();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return lT.HelixCharityCampaignAmount},"get")});var uT=Ch();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:n(function(){return uT.HelixChatApi},"get")});var cT=dh();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return cT.HelixChatBadgeSet},"get")});var dT=ch();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return dT.HelixChatBadgeVersion},"get")});var hT=cl();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:n(function(){return hT.HelixChatSettings},"get")});var pT=hh();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:n(function(){return pT.HelixChatChatter},"get")});var mT=tn();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:n(function(){return mT.HelixEmote},"get")});var _T=lh();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:n(function(){return _T.HelixChannelEmote},"get")});var yT=mh();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return yT.HelixEmoteFromSet},"get")});var fT=_h();Object.defineProperty(c,"HelixUserEmote",{enumerable:!0,get:n(function(){return fT.HelixUserEmote},"get")});var gT=gh();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return gT.HelixPrivilegedChatSettings},"get")});var bT=xh();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return bT.HelixSentChatMessage},"get")});var xT=wh();Object.defineProperty(c,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return xT.HelixSharedChatSessionParticipant},"get")});var wT=vh();Object.defineProperty(c,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return wT.HelixSharedChatSession},"get")});var vT=Ah();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:n(function(){return vT.HelixClipApi},"get")});var ST=qh();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:n(function(){return ST.HelixClip},"get")});var HT=Rh();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return HT.HelixContentClassificationLabelApi},"get")});var CT=Ih();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return CT.HelixContentClassificationLabel},"get")});var qT=kh();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return qT.HelixEntitlementApi},"get")});var ET=Uh();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return ET.HelixDropsEntitlement},"get")});var PT=$h();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:n(function(){return PT.HelixEventSubApi},"get")});var AT=Fh();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return AT.HelixEventSubConduit},"get")});var DT=Qh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return DT.HelixEventSubConduitShard},"get")});var IT=Hl();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return IT.HelixEventSubSubscription},"get")});var TT=Lh();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return TT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var RT=ep();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return RT.HelixExtensionsApi},"get")});var UT=Jh();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return UT.HelixExtensionBitsProduct},"get")});var BT=Zh();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return BT.HelixExtensionTransaction},"get")});var OT=ip();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:n(function(){return OT.HelixGameApi},"get")});var jT=Il();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:n(function(){return jT.HelixGame},"get")});var kT=sp();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:n(function(){return kT.HelixGoalApi},"get")});var MT=np();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:n(function(){return MT.HelixGoal},"get")});var LT=cp();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return LT.HelixHypeTrainApi},"get")});var FT=op();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return FT.HelixHypeTrainContribution},"get")});var NT=lp();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return NT.HelixHypeTrainEvent},"get")});var QT=Ep();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:n(function(){return QT.HelixModerationApi},"get")});var GT=yp();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:n(function(){return GT.HelixBan},"get")});var WT=xp();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:n(function(){return WT.HelixModerator},"get")});var VT=bp();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return VT.HelixModeratedChannel},"get")});var $T=kl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:n(function(){return $T.HelixBanUser},"get")});var zT=gp();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return zT.HelixBlockedTerm},"get")});var KT=wp();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return KT.HelixShieldModeStatus},"get")});var JT=vp();Object.defineProperty(c,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return JT.HelixUnbanRequest},"get")});var ZT=Sp();Object.defineProperty(c,"HelixWarning",{enumerable:!0,get:n(function(){return ZT.HelixWarning},"get")});var XT=Tp();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:n(function(){return XT.HelixPollApi},"get")});var YT=Dp();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:n(function(){return YT.HelixPoll},"get")});var eR=Ap();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:n(function(){return eR.HelixPollChoice},"get")});var tR=jp();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:n(function(){return tR.HelixPredictionApi},"get")});var rR=Bp();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:n(function(){return rR.HelixPrediction},"get")});var iR=Up();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return iR.HelixPredictionOutcome},"get")});var nR=Rp();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:n(function(){return nR.HelixPredictor},"get")});var aR=Np();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:n(function(){return aR.HelixRaidApi},"get")});var sR=Mp();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:n(function(){return sR.HelixRaid},"get")});var oR=Lo();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:n(function(){return oR.HelixUserRelation},"get")});var lR=Kp();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:n(function(){return lR.HelixScheduleApi},"get")});var uR=Vp();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:n(function(){return uR.HelixSchedule},"get")});var cR=pa();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return cR.HelixScheduleSegment},"get")});var dR=Wp();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return dR.HelixPaginatedScheduleSegmentRequest},"get")});var hR=Xp();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:n(function(){return hR.HelixSearchApi},"get")});var pR=Jp();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return pR.HelixChannelSearchResult},"get")});var mR=sm();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:n(function(){return mR.HelixStreamApi},"get")});var _R=tm();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:n(function(){return _R.HelixStream},"get")});var yR=su();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:n(function(){return yR.HelixStreamMarker},"get")});var fR=nm();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return fR.HelixStreamMarkerWithVideo},"get")});var gR=um();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return gR.HelixPaginatedSubscriptionsRequest},"get")});var bR=dm();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return bR.HelixSubscriptionApi},"get")});var xR=pu();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:n(function(){return xR.HelixSubscription},"get")});var wR=hu();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:n(function(){return wR.HelixUserSubscription},"get")});var vR=ym();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:n(function(){return vR.HelixTeamApi},"get")});var SR=yu();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:n(function(){return SR.HelixTeam},"get")});var HR=pm();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return HR.HelixTeamWithUsers},"get")});var CR=Im();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:n(function(){return CR.HelixUserApi},"get")});var qR=Pm();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:n(function(){return qR.HelixUserBlock},"get")});var ER=Jx();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:n(function(){return ER.HelixFollow},"get")});var PR=Em();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return PR.HelixPrivilegedUser},"get")});var AR=wu();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:n(function(){return AR.HelixUser},"get")});var DR=bu();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:n(function(){return DR.HelixBaseExtension},"get")});var IR=bm();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return IR.HelixInstalledExtension},"get")});var TR=vm();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return TR.HelixInstalledExtensionList},"get")});var RR=Cm();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:n(function(){return RR.HelixUserExtension},"get")});var UR=Bm();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:n(function(){return UR.HelixVideoApi},"get")});var BR=Rm();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:n(function(){return BR.HelixVideo},"get")});var OR=jm();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:n(function(){return OR.HelixWhisperApi},"get")});var jR=rd();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:n(function(){return jR.ConfigError},"get")});var kR=em();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:n(function(){return kR.StreamNotLiveError},"get")});var MR=Mm();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:n(function(){return MR.ApiReportedRequest},"get")});var LR=ae();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return LR.HelixPaginatedRequest},"get")});var FR=Mr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return FR.HelixPaginatedRequestWithTotal},"get")});var Tu=m();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:n(function(){return Tu.extractUserId},"get")});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:n(function(){return Tu.extractUserName},"get")});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:n(function(){return Tu.HelixExtension},"get")});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:n(function(){return Tu.HellFreezesOverError},"get")})});var nw=u((LG,iw)=>{var Xx=ju(),NR=Lu(),Yx=Za(),zt=qt(),ew=Nu(),tw=Gu(),rw=Vu(),Ru=k_(),{ApiClient:QR}=Zx(),{AppTokenAuthProvider:GR}=Cd(),Qm=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 GR(e,t);this.apiClient=new QR({authProvider:a})}this.emotes=new Yx,this.channels=new Yx,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new NR(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 rw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?zt.BTTV.Channel(e):zt.BTTV.Global;return Ru.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 Xx(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=zt.FFZ.Set(e);return Ru.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=zt.FFZ.Channel(e);return Ru.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 ew(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?zt.SevenTV.Channel(e):zt.SevenTV.Global;return Ru.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new tw(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(zt.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(zt.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,t);else for(let a of r.emote_set.emotes)this._cacheSevenTVEmote(e,a,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:Xx,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:ew,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:tw,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:rw,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}};iw.exports=Qm});var sw=u((NG,aw)=>{var WR=qt(),Gm=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||WR.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")})}};aw.exports=Gm});var VR=u((GG,ow)=>{ow.exports={BTTVEmote:ju(),Channel:Lu(),Collection:Za(),Constants:qt(),Emote:fr(),EmoteFetcher:nw(),EmoteParser:sw(),FFZEmote:Nu(),SevenTVEmote:Gu(),TwitchEmote:Vu()}});export default VR();
19
+ Make sure you're not executing any actions when you want to remove a user.`),this.userId=e}};Uo.IntermediateUserRemovalError=xd});var Sd=u(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.UnknownIntentError=void 0;var ZC=_(),vd=class extends ZC.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};Bo.UnknownIntentError=vd});var eg=u(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.RefreshingAuthProvider=void 0;var Qr=(b(),x(g)),Ai=C(),XC=ud(),Ne=_(),Hd=Ho(),Xf=bd(),YC=wd(),Cd=qo(),eq=Po(),tq=Sd(),ct=Ei(),Yf=Io(),Mt=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 Yf.TokenFetcher(async r=>await this._fetchAppToken(r))}addUser(e,t,r){let a=(0,Ne.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 Yf.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,Hd.accessTokenIsExpired)(e))try{let l=await(0,ct.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof Cd.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new Cd.InvalidTokenError;let l=await(0,ct.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),c=await(0,ct.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,c.userId,l),r=[l,c]}let[a,s]=r;if(!s.userId)throw new eq.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,ct.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(r,t)}hasUser(e){return this._userTokenFetchers.has((0,Ne.extractUserId)(e))}removeUser(e){let t=(0,Ne.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,Ne.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,Ne.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,Ne.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new Xf.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 tq.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,Ne.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,Ne.extractUserId)(e),a=this._userTokenFetchers.get(r);if(!a)return null;if(this._cachedRefreshFailures.has(r))throw new Xf.CachedRefreshFailureError(r);return(0,ct.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 Ne.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,Ne.extractUserId)(e);if(this._userAccessTokens.has(t)){let r=await this.getAccessTokenForUser(t);if(!r)throw new Ne.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 YC.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,Hd.accessTokenIsExpired)(r))try{if(r.scope)return(0,ct.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,ct.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 Cd.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,ct.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,ct.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,Hd.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,ct.getAppToken)(this._clientId,this._clientSecret)}};Di.RefreshingAuthProvider=Mt;Qr.__decorate([(0,Ai.Enumerable)(!1)],Mt.prototype,"_clientSecret",void 0);Qr.__decorate([(0,Ai.Enumerable)(!1)],Mt.prototype,"_userAccessTokens",void 0);Qr.__decorate([(0,Ai.Enumerable)(!1)],Mt.prototype,"_userTokenFetchers",void 0);Qr.__decorate([(0,Ai.Enumerable)(!1)],Mt.prototype,"_appAccessToken",void 0);Qr.__decorate([(0,Ai.Enumerable)(!1)],Mt.prototype,"_appTokenFetcher",void 0);Di.RefreshingAuthProvider=Mt=Qr.__decorate([(0,Ne.rtfm)("auth","RefreshingAuthProvider","clientId")],Mt)});var rg=u(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.StaticAuthProvider=void 0;var qd=(b(),x(g)),tg=C(),rq=_(),iq=Ei(),Ii=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,iq.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};Ti.StaticAuthProvider=Ii;qd.__decorate([(0,tg.Enumerable)(!1)],Ii.prototype,"_clientId",void 0);qd.__decorate([(0,tg.Enumerable)(!1)],Ii.prototype,"_accessToken",void 0);Ti.StaticAuthProvider=Ii=qd.__decorate([(0,rq.rtfm)("auth","StaticAuthProvider","clientId")],Ii)});var Ed=u(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.UnknownIntentError=R.InvalidTokenTypeError=R.InvalidTokenError=R.IntermediateUserRemovalError=R.CachedRefreshFailureError=R.StaticAuthProvider=R.RefreshingAuthProvider=R.AppTokenAuthProvider=R.TokenInfo=R.TokenFetcher=R.revokeToken=R.refreshUserToken=R.getValidTokenFromProviderForIntent=R.getValidTokenFromProviderForUser=R.getTokenInfo=R.getAppToken=R.exchangeCode=R.getExpiryDateOfAccessToken=R.accessTokenIsExpired=void 0;var ig=Ho();Object.defineProperty(R,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return ig.accessTokenIsExpired},"get")});Object.defineProperty(R,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return ig.getExpiryDateOfAccessToken},"get")});var ar=Ei();Object.defineProperty(R,"exchangeCode",{enumerable:!0,get:n(function(){return ar.exchangeCode},"get")});Object.defineProperty(R,"getAppToken",{enumerable:!0,get:n(function(){return ar.getAppToken},"get")});Object.defineProperty(R,"getTokenInfo",{enumerable:!0,get:n(function(){return ar.getTokenInfo},"get")});Object.defineProperty(R,"getValidTokenFromProviderForUser",{enumerable:!0,get:n(function(){return ar.getValidTokenFromProviderForUser},"get")});Object.defineProperty(R,"getValidTokenFromProviderForIntent",{enumerable:!0,get:n(function(){return ar.getValidTokenFromProviderForIntent},"get")});Object.defineProperty(R,"refreshUserToken",{enumerable:!0,get:n(function(){return ar.refreshUserToken},"get")});Object.defineProperty(R,"revokeToken",{enumerable:!0,get:n(function(){return ar.revokeToken},"get")});var nq=Io();Object.defineProperty(R,"TokenFetcher",{enumerable:!0,get:n(function(){return nq.TokenFetcher},"get")});var aq=md();Object.defineProperty(R,"TokenInfo",{enumerable:!0,get:n(function(){return aq.TokenInfo},"get")});var sq=Zf();Object.defineProperty(R,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return sq.AppTokenAuthProvider},"get")});var oq=eg();Object.defineProperty(R,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return oq.RefreshingAuthProvider},"get")});var lq=rg();Object.defineProperty(R,"StaticAuthProvider",{enumerable:!0,get:n(function(){return lq.StaticAuthProvider},"get")});var uq=bd();Object.defineProperty(R,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return uq.CachedRefreshFailureError},"get")});var cq=wd();Object.defineProperty(R,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return cq.IntermediateUserRemovalError},"get")});var dq=qo();Object.defineProperty(R,"InvalidTokenError",{enumerable:!0,get:n(function(){return dq.InvalidTokenError},"get")});var hq=Po();Object.defineProperty(R,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return hq.InvalidTokenTypeError},"get")});var pq=Sd();Object.defineProperty(R,"UnknownIntentError",{enumerable:!0,get:n(function(){return pq.UnknownIntentError},"get")})});var ag=u((Fj,ng)=>{function Qe(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(Qe,"RetryOperation");ng.exports=Qe;Qe.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Qe.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Qe.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};Qe.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)};Qe.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};Qe.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};Qe.prototype.start=Qe.prototype.try;Qe.prototype.errors=function(){return this._errors};Qe.prototype.attempts=function(){return this._attempts};Qe.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 sg=u(sr=>{var mq=ag();sr.operation=function(i){var e=sr.timeouts(i);return new mq(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};sr.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};sr.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};sr.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(c){var h=sr.operation(e),p=Array.prototype.slice.call(arguments,1),w=p.pop();p.push(function(E){h.retry(E)||(E&&(arguments[0]=h.mainError()),w.apply(this,arguments))}),h.attempt(function(){c.apply(i,p)})},"retryWrapper").bind(i,o),i[s].options=e}}});var lg=u((Wj,og)=>{og.exports=sg()});var ug=u(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.createBitsLeaderboardQuery=void 0;function _q(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(_q,"createBitsLeaderboardQuery");Oo.createBitsLeaderboardQuery=_q});var G=u(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.BaseApi=void 0;var yq=(b(),x(g)),fq=C(),jo=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}};ko.BaseApi=jo;yq.__decorate([(0,fq.Enumerable)(!1)],jo.prototype,"_client",void 0)});var Pd=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.HelixBitsLeaderboardEntry=void 0;var cg=(b(),x(g)),gq=C(),xt=_(),Mo=class extends xt.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[xt.rawDataSymbol].user_id}get userName(){return this[xt.rawDataSymbol].user_login}get userDisplayName(){return this[xt.rawDataSymbol].user_name}get rank(){return this[xt.rawDataSymbol].rank}get amount(){return this[xt.rawDataSymbol].score}async getUser(){return(0,xt.checkRelationAssertion)(await this._client.users.getUserById(this[xt.rawDataSymbol].user_id))}};Ri.HelixBitsLeaderboardEntry=Mo;cg.__decorate([(0,gq.Enumerable)(!1)],Mo.prototype,"_client",void 0);Ri.HelixBitsLeaderboardEntry=Mo=cg.__decorate([(0,xt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Mo)});var Dd=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixBitsLeaderboard=void 0;var Ad=(b(),x(g)),dg=Hi(),bq=C(),Lo=_(),xq=Pd(),Ui=class extends Lo.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[Lo.rawDataSymbol].data.map(e=>new xq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[Lo.rawDataSymbol].total}};Bi.HelixBitsLeaderboard=Ui;Ad.__decorate([(0,bq.Enumerable)(!1)],Ui.prototype,"_client",void 0);Ad.__decorate([(0,dg.CachedGetter)()],Ui.prototype,"entries",null);Bi.HelixBitsLeaderboard=Ui=Ad.__decorate([dg.Cacheable,(0,Lo.rtfm)("api","HelixBitsLeaderboard")],Ui)});var Td=u(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.HelixCheermoteList=void 0;var wq=(b(),x(g)),vq=C(),Oi=_(),Id=class extends Oi.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,vq.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[Oi.rawDataSymbol][e],c=l.sort((h,p)=>p.min_bits-h.min_bits).find(h=>h.min_bits<=t);if(!c)throw new Oi.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:c.images[a][s][o],color:c.color}}getPossibleNames(){return Object.keys(this[Oi.rawDataSymbol])}};ji.HelixCheermoteList=Id;ji.HelixCheermoteList=Id=wq.__decorate([(0,Oi.rtfm)("api","HelixCheermoteList")],Id)});var Bd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixBitsApi=void 0;var Sq=(b(),x(g)),hg=C(),Hq=Y(),Rd=_(),Cq=ug(),qq=G(),Eq=Dd(),Pq=Td(),Ud=class extends qq.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Rd.extractUserId)(e),scopes:["bits:read"],query:(0,Cq.createBitsLeaderboardQuery)(t)});return new Eq.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,hg.mapOptional)(e,Rd.extractUserId),query:(0,hg.mapOptional)(e,Hq.createBroadcasterQuery)});return new Pq.HelixCheermoteList(t.data)}};ki.HelixBitsApi=Ud;ki.HelixBitsApi=Ud=Sq.__decorate([(0,Rd.rtfm)("api","HelixBitsApi")],Ud)});var mg=u(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.createFollowedChannelQuery=Ge.createChannelFollowerQuery=Ge.createChannelVipUpdateQuery=Ge.createChannelCommercialBody=Ge.createChannelUpdateBody=void 0;var pg=C(),or=_();function Aq(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(Aq,"createChannelUpdateBody");Ge.createChannelUpdateBody=Aq;function Dq(i,e){return{broadcaster_id:(0,or.extractUserId)(i),length:e}}n(Dq,"createChannelCommercialBody");Ge.createChannelCommercialBody=Dq;function Iq(i,e){return{broadcaster_id:(0,or.extractUserId)(i),user_id:(0,or.extractUserId)(e)}}n(Iq,"createChannelVipUpdateQuery");Ge.createChannelVipUpdateQuery=Iq;function Tq(i,e){return{broadcaster_id:(0,or.extractUserId)(i),user_id:(0,pg.mapOptional)(e,or.extractUserId)}}n(Tq,"createChannelFollowerQuery");Ge.createChannelFollowerQuery=Tq;function Rq(i,e){return{broadcaster_id:(0,pg.mapOptional)(e,or.extractUserId),user_id:(0,or.extractUserId)(i)}}n(Rq,"createFollowedChannelQuery");Ge.createFollowedChannelQuery=Rq});var Oe=u(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.createChannelUsersCheckQuery=We.createGetByIdsQuery=We.createModeratorActionQuery=We.createUserQuery=We.createSingleKeyQuery=void 0;var Fo=_();function Uq(i,e){return{[i]:e}}n(Uq,"createSingleKeyQuery");We.createSingleKeyQuery=Uq;function Bq(i){return{user_id:(0,Fo.extractUserId)(i)}}n(Bq,"createUserQuery");We.createUserQuery=Bq;function Oq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Oq,"createModeratorActionQuery");We.createModeratorActionQuery=Oq;function jq(i,e){return{broadcaster_id:(0,Fo.extractUserId)(i),id:e}}n(jq,"createGetByIdsQuery");We.createGetByIdsQuery=jq;function kq(i,e){return{broadcaster_id:(0,Fo.extractUserId)(i),user_id:e.map(Fo.extractUserId)}}n(kq,"createChannelUsersCheckQuery");We.createChannelUsersCheckQuery=kq});var Qo=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixUserRelation=void 0;var _g=(b(),x(g)),Mq=C(),lr=_(),No=class extends lr.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[lr.rawDataSymbol].user_id}get name(){return this[lr.rawDataSymbol].user_login}get displayName(){return this[lr.rawDataSymbol].user_name}async getUser(){return(0,lr.checkRelationAssertion)(await this._client.users.getUserById(this[lr.rawDataSymbol].user_id))}};Mi.HelixUserRelation=No;_g.__decorate([(0,Mq.Enumerable)(!1)],No.prototype,"_client",void 0);Mi.HelixUserRelation=No=_g.__decorate([(0,lr.rtfm)("api","HelixUserRelation","id")],No)});var Lt=u(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.HelixRequestBatcher=void 0;var Lq=(b(),x(g)),Od=C(),Go=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,Od.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,Od.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 c of(s=this._requestResolversById.get(a))!==null&&s!==void 0?s:[])c.resolve(l.data.length?this._mapper(l.data[0]):null)}catch(l){for(let c of(o=this._requestResolversById.get(a))!==null&&o!==void 0?o:[])c.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}})}};Wo.HelixRequestBatcher=Go;Lq.__decorate([(0,Od.Enumerable)(!1)],Go.prototype,"_client",void 0)});var oe=u(Li=>{"use strict";var jd;Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixPaginatedRequest=void 0;var yg=(b(),x(g)),Fq=C(),Nq=_();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(jd=Symbol.asyncIterator)!==null&&jd!==void 0?jd:Symbol.for("Symbol.asyncIterator"));var Vo=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]},[])}};Li.HelixPaginatedRequest=Vo;yg.__decorate([(0,Fq.Enumerable)(!1)],Vo.prototype,"_client",void 0);Li.HelixPaginatedRequest=Vo=yg.__decorate([(0,Nq.rtfm)("api","HelixPaginatedRequest")],Vo)});var Gr=u(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixPaginatedRequestWithTotal=void 0;var Qq=(b(),x(g)),Gq=_(),Wq=oe(),kd=class extends Wq.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}};Fi.HelixPaginatedRequestWithTotal=kd;Fi.HelixPaginatedRequestWithTotal=kd=Qq.__decorate([(0,Gq.rtfm)("api","HelixPaginatedRequestWithTotal")],kd)});var he=u(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.createPaginatedResultWithTotal=Wr.createPaginatedResult=void 0;function Vq(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(Vq,"createPaginatedResult");Wr.createPaginatedResult=Vq;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");Wr.createPaginatedResultWithTotal=$q});var le=u($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.createPaginationQuery=void 0;function zq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(zq,"createPaginationQuery");$o.createPaginationQuery=zq});var Md=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixChannel=void 0;var fg=(b(),x(g)),Kq=C(),me=_(),zo=class extends me.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[me.rawDataSymbol].broadcaster_id}get name(){return this[me.rawDataSymbol].broadcaster_login}get displayName(){return this[me.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,me.checkRelationAssertion)(await this._client.users.getUserById(this[me.rawDataSymbol].broadcaster_id))}get language(){return this[me.rawDataSymbol].broadcaster_language}get gameId(){return this[me.rawDataSymbol].game_id}get gameName(){return this[me.rawDataSymbol].game_name}async getGame(){return this[me.rawDataSymbol].game_id?(0,me.checkRelationAssertion)(await this._client.games.getGameById(this[me.rawDataSymbol].game_id)):null}get title(){return this[me.rawDataSymbol].title}get delay(){return this[me.rawDataSymbol].delay}get tags(){return this[me.rawDataSymbol].tags}get contentClassificationLabels(){return this[me.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[me.rawDataSymbol].is_branded_content}};Ni.HelixChannel=zo;fg.__decorate([(0,Kq.Enumerable)(!1)],zo.prototype,"_client",void 0);Ni.HelixChannel=zo=fg.__decorate([(0,me.rtfm)("api","HelixChannel","id")],zo)});var Ld=u(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.HelixChannelEditor=void 0;var gg=(b(),x(g)),Jq=C(),ur=_(),Ko=class extends ur.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[ur.rawDataSymbol].user_id}get userDisplayName(){return this[ur.rawDataSymbol].user_name}async getUser(){return(0,ur.checkRelationAssertion)(await this._client.users.getUserById(this[ur.rawDataSymbol].user_id))}get creationDate(){return new Date(this[ur.rawDataSymbol].created_at)}};Qi.HelixChannelEditor=Ko;gg.__decorate([(0,Jq.Enumerable)(!1)],Ko.prototype,"_client",void 0);Qi.HelixChannelEditor=Ko=gg.__decorate([(0,ur.rtfm)("api","HelixChannelEditor","userId")],Ko)});var Fd=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixChannelFollower=void 0;var bg=(b(),x(g)),Zq=C(),Ft=_(),Jo=class extends Ft.DataObject{static{n(this,"HelixChannelFollower")}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}async getUser(){return(0,Ft.checkRelationAssertion)(await this._client.users.getUserById(this[Ft.rawDataSymbol].user_id))}get followDate(){return new Date(this[Ft.rawDataSymbol].followed_at)}};Gi.HelixChannelFollower=Jo;bg.__decorate([(0,Zq.Enumerable)(!1)],Jo.prototype,"_client",void 0);Gi.HelixChannelFollower=Jo=bg.__decorate([(0,Ft.rtfm)("api","HelixChannelFollower","userId")],Jo)});var Nd=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixFollowedChannel=void 0;var xg=(b(),x(g)),Xq=C(),Nt=_(),Zo=class extends Nt.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Nt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Nt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Nt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Nt.checkRelationAssertion)(await this._client.users.getUserById(this[Nt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[Nt.rawDataSymbol].followed_at)}};Wi.HelixFollowedChannel=Zo;xg.__decorate([(0,Xq.Enumerable)(!1)],Zo.prototype,"_client",void 0);Wi.HelixFollowedChannel=Zo=xg.__decorate([(0,Nt.rtfm)("api","HelixFollowedChannel","broadcasterId")],Zo)});var Gd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixAdSchedule=void 0;var Yq=(b(),x(g)),Xe=_(),Qd=class extends Xe.DataObject{static{n(this,"HelixAdSchedule")}get snoozeCount(){return this[Xe.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return this[Xe.rawDataSymbol].snooze_refresh_at?new Date(this[Xe.rawDataSymbol].snooze_refresh_at*1e3):null}get nextAdDate(){return this[Xe.rawDataSymbol].next_ad_at?new Date(this[Xe.rawDataSymbol].next_ad_at*1e3):null}get duration(){return this[Xe.rawDataSymbol].duration}get lastAdDate(){return this[Xe.rawDataSymbol].last_ad_at?new Date(this[Xe.rawDataSymbol].last_ad_at*1e3):null}get prerollFreeTime(){return this[Xe.rawDataSymbol].preroll_free_time}};Vi.HelixAdSchedule=Qd;Vi.HelixAdSchedule=Qd=Yq.__decorate([(0,Xe.rtfm)("api","HelixAdSchedule")],Qd)});var wg=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixSnoozeNextAdResult=void 0;var eE=(b(),x(g)),$i=_(),Wd=class extends $i.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[$i.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[$i.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[$i.rawDataSymbol].next_ad_at*1e3)}};zi.HelixSnoozeNextAdResult=Wd;zi.HelixSnoozeNextAdResult=Wd=eE.__decorate([(0,$i.rtfm)("api","HelixSnoozeNextAdResult")],Wd)});var Kd=u(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.HelixChannelApi=void 0;var qg=(b(),x(g)),Eg=C(),cr=Y(),ue=_(),wt=mg(),vg=Oe(),Vd=Qo(),tE=Lt(),rE=oe(),Sg=Gr(),$d=he(),Xo=le(),iE=G(),zd=Md(),nE=Ld(),Hg=Fd(),Cg=Nd(),aE=Gd(),sE=wg(),Yo=class extends iE.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new tE.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new zd.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,ue.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,cr.createBroadcasterQuery)(t)});return(0,Eg.mapNullable)(r.data[0],a=>new zd.HelixChannel(a,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,ue.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(ue.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,vg.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new zd.HelixChannel(a,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,cr.createBroadcasterQuery)(e),jsonBody:(0,wt.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,wt.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,ue.extractUserId)(e),scopes:["channel:read:editors"],query:(0,cr.createBroadcasterQuery)(e)})).data.map(r=>new nE.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,cr.createBroadcasterQuery)(e),...(0,Xo.createPaginationQuery)(t)}});return(0,$d.createPaginatedResult)(r,Vd.HelixUserRelation,this._client)}getVipsPaginated(e){return new rE.HelixPaginatedRequest({url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,cr.createBroadcasterQuery)(e)},this._client,t=>new Vd.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,ue.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,vg.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Vd.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let r=(0,ue.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,ue.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,wt.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,wt.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),query:{...(0,wt.createChannelFollowerQuery)(e),...(0,Xo.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,wt.createChannelFollowerQuery)(e,t),...(0,Xo.createPaginationQuery)(r)}});return(0,$d.createPaginatedResultWithTotal)(a,Hg.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new Sg.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,ue.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,wt.createChannelFollowerQuery)(e)},this._client,t=>new Hg.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,wt.createFollowedChannelQuery)(e,t),...(0,Xo.createPaginationQuery)(r)}});return(0,$d.createPaginatedResultWithTotal)(a,Cg.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new Sg.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["user:read:follows"],query:(0,wt.createFollowedChannelQuery)(e,t)},this._client,r=>new Cg.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,ue.extractUserId)(e),scopes:["channel:read:ads"],query:(0,cr.createBroadcasterQuery)(e)});return new aE.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,ue.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,cr.createBroadcasterQuery)(e)});return new sE.HelixSnoozeNextAdResult(t.data[0])}};Ki.HelixChannelApi=Yo;qg.__decorate([(0,Eg.Enumerable)(!1)],Yo.prototype,"_getChannelByIdBatcher",void 0);Ki.HelixChannelApi=Yo=qg.__decorate([(0,ue.rtfm)("api","HelixChannelApi")],Yo)});var Pg=u(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.createRedemptionsForBroadcasterQuery=Ve.createRewardRedemptionsByIdsQuery=Ve.createCustomRewardBody=Ve.createCustomRewardChangeQuery=Ve.createCustomRewardsQuery=void 0;var el=_();function oE(i,e){return{broadcaster_id:(0,el.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(oE,"createCustomRewardsQuery");Ve.createCustomRewardsQuery=oE;function lE(i,e){return{broadcaster_id:(0,el.extractUserId)(i),id:e}}n(lE,"createCustomRewardChangeQuery");Ve.createCustomRewardChangeQuery=lE;function uE(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(uE,"createCustomRewardBody");Ve.createCustomRewardBody=uE;function cE(i,e,t){return{broadcaster_id:(0,el.extractUserId)(i),reward_id:e,id:t}}n(cE,"createRewardRedemptionsByIdsQuery");Ve.createRewardRedemptionsByIdsQuery=cE;function dE(i,e,t,r){return{broadcaster_id:(0,el.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(dE,"createRedemptionsForBroadcasterQuery");Ve.createRedemptionsForBroadcasterQuery=dE});var Jd=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixCustomReward=void 0;var Ag=(b(),x(g)),hE=C(),M=_(),tl=class extends M.DataObject{static{n(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[M.rawDataSymbol].id}get broadcasterId(){return this[M.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[M.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[M.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,M.checkRelationAssertion)(await this._client.users.getUserById(this[M.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,r;let a=`url_${e}x`;return(r=(t=this[M.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&r!==void 0?r:this[M.rawDataSymbol].default_image[a]}get backgroundColor(){return this[M.rawDataSymbol].background_color}get isEnabled(){return this[M.rawDataSymbol].is_enabled}get cost(){return this[M.rawDataSymbol].cost}get title(){return this[M.rawDataSymbol].title}get prompt(){return this[M.rawDataSymbol].prompt}get userInputRequired(){return this[M.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[M.rawDataSymbol].max_per_stream_setting.is_enabled?this[M.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[M.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[M.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[M.rawDataSymbol].global_cooldown_setting.is_enabled?this[M.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[M.rawDataSymbol].is_paused}get isInStock(){return this[M.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[M.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[M.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[M.rawDataSymbol].cooldown_expires_at?new Date(this[M.rawDataSymbol].cooldown_expires_at):null}};Ji.HelixCustomReward=tl;Ag.__decorate([(0,hE.Enumerable)(!1)],tl.prototype,"_client",void 0);Ji.HelixCustomReward=tl=Ag.__decorate([(0,M.rtfm)("api","HelixCustomReward","id")],tl)});var Zd=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixCustomRewardRedemption=void 0;var Dg=(b(),x(g)),pE=C(),Q=_(),rl=class extends Q.DataObject{static{n(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[Q.rawDataSymbol].id}get broadcasterId(){return this[Q.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Q.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Q.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Q.checkRelationAssertion)(await this._client.users.getUserById(this[Q.rawDataSymbol].broadcaster_id))}get userId(){return this[Q.rawDataSymbol].user_id}get userName(){return this[Q.rawDataSymbol].user_login}get userDisplayName(){return this[Q.rawDataSymbol].user_name}async getUser(){return(0,Q.checkRelationAssertion)(await this._client.users.getUserById(this[Q.rawDataSymbol].user_id))}get userInput(){return this[Q.rawDataSymbol].user_input}get isFulfilled(){return this[Q.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[Q.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[Q.rawDataSymbol].redeemed_at)}get rewardId(){return this[Q.rawDataSymbol].reward.id}get rewardTitle(){return this[Q.rawDataSymbol].reward.title}get rewardPrompt(){return this[Q.rawDataSymbol].reward.prompt}get rewardCost(){return this[Q.rawDataSymbol].reward.cost}async getReward(){return(0,Q.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[Q.rawDataSymbol].broadcaster_id,this[Q.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[Q.rawDataSymbol].broadcaster_id,this[Q.rawDataSymbol].reward.id,[this[Q.rawDataSymbol].id],e))[0]}};Zi.HelixCustomRewardRedemption=rl;Dg.__decorate([(0,pE.Enumerable)(!1)],rl.prototype,"_client",void 0);Zi.HelixCustomRewardRedemption=rl=Dg.__decorate([(0,Q.rtfm)("api","HelixCustomRewardRedemption","id")],rl)});var Yd=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixChannelPointsApi=void 0;var mE=(b(),x(g)),_E=Y(),dt=_(),vt=Pg(),yE=Oe(),fE=oe(),gE=he(),bE=le(),xE=G(),il=Jd(),nl=Zd(),Xd=class extends xE.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,dt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,vt.createCustomRewardsQuery)(e,t)})).data.map(a=>new il.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,dt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,yE.createGetByIdsQuery)(e,t)})).data.map(a=>new il.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,dt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,_E.createBroadcasterQuery)(e),jsonBody:(0,vt.createCustomRewardBody)(t)});return new il.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,dt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,vt.createCustomRewardChangeQuery)(e,t),jsonBody:(0,vt.createCustomRewardBody)(r)});return new il.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,dt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,vt.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,dt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,vt.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new nl.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,dt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,vt.createRedemptionsForBroadcasterQuery)(e,t,r,a),...(0,bE.createPaginationQuery)(a)}});return(0,gE.createPaginatedResult)(s,nl.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new fE.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,dt.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,vt.createRedemptionsForBroadcasterQuery)(e,t,r,a)},this._client,s=>new nl.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,dt.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,vt.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:a}})).data.map(o=>new nl.HelixCustomRewardRedemption(o,this._client)):[]}};Xi.HelixChannelPointsApi=Xd;Xi.HelixChannelPointsApi=Xd=mE.__decorate([(0,dt.rtfm)("api","HelixChannelPointsApi")],Xd)});var al=u(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.HelixCharityCampaignAmount=void 0;var wE=(b(),x(g)),Yi=_(),eh=class extends Yi.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[Yi.rawDataSymbol].value}get decimalPlaces(){return this[Yi.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[Yi.rawDataSymbol].currency}};en.HelixCharityCampaignAmount=eh;en.HelixCharityCampaignAmount=eh=wE.__decorate([(0,Yi.rtfm)("api","HelixCharityCampaignAmount")],eh)});var th=u(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.HelixCharityCampaign=void 0;var Tg=(b(),x(g)),vE=C(),Ae=_(),Ig=al(),sl=class extends Ae.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[Ae.rawDataSymbol].id}get broadcasterId(){return this[Ae.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Ae.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Ae.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Ae.checkRelationAssertion)(await this._client.users.getUserById(this[Ae.rawDataSymbol].broadcaster_id))}get charityName(){return this[Ae.rawDataSymbol].charity_name}get charityDescription(){return this[Ae.rawDataSymbol].charity_description}get charityLogo(){return this[Ae.rawDataSymbol].charity_logo}get charityWebsite(){return this[Ae.rawDataSymbol].charity_website}get currentAmount(){return new Ig.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].current_amount)}get targetAmount(){return new Ig.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].target_amount)}};tn.HelixCharityCampaign=sl;Tg.__decorate([(0,vE.Enumerable)(!1)],sl.prototype,"_client",void 0);tn.HelixCharityCampaign=sl=Tg.__decorate([(0,Ae.rtfm)("api","HelixCharityCampaign","id")],sl)});var rh=u(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.HelixCharityCampaignDonation=void 0;var Rg=(b(),x(g)),SE=C(),St=_(),HE=al(),ol=class extends St.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[St.rawDataSymbol].campaign_id}get donorId(){return this[St.rawDataSymbol].user_id}get donorName(){return this[St.rawDataSymbol].user_login}get donorDisplayName(){return this[St.rawDataSymbol].user_name}async getDonor(){return(0,St.checkRelationAssertion)(await this._client.users.getUserById(this[St.rawDataSymbol].user_id))}get amount(){return new HE.HelixCharityCampaignAmount(this[St.rawDataSymbol].amount)}};rn.HelixCharityCampaignDonation=ol;Rg.__decorate([(0,SE.Enumerable)(!1)],ol.prototype,"_client",void 0);rn.HelixCharityCampaignDonation=ol=Rg.__decorate([(0,St.rtfm)("api","HelixCharityCampaignDonation")],ol)});var ah=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixCharityApi=void 0;var CE=(b(),x(g)),Ug=Y(),ih=_(),qE=he(),EE=le(),PE=G(),AE=th(),DE=rh(),nh=class extends PE.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,ih.extractUserId)(e),scopes:["channel:read:charity"],query:(0,Ug.createBroadcasterQuery)(e)});return new AE.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,ih.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,Ug.createBroadcasterQuery)(e),...(0,EE.createPaginationQuery)(t)}});return(0,qE.createPaginatedResult)(r,DE.HelixCharityCampaignDonation,this._client)}};nn.HelixCharityApi=nh;nn.HelixCharityApi=nh=CE.__decorate([(0,ih.rtfm)("api","HelixCharityApi")],nh)});var Bg=u(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.createSendChatMessageAsAppBody=De.createSendChatMessageBody=De.createSendChatMessageQuery=De.createShoutoutQuery=De.createChatColorUpdateQuery=De.createChatSettingsUpdateBody=void 0;var sh=_();function IE(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(IE,"createChatSettingsUpdateBody");De.createChatSettingsUpdateBody=IE;function TE(i,e){return{user_id:(0,sh.extractUserId)(i),color:e}}n(TE,"createChatColorUpdateQuery");De.createChatColorUpdateQuery=TE;function RE(i,e,t){return{from_broadcaster_id:(0,sh.extractUserId)(i),to_broadcaster_id:(0,sh.extractUserId)(e),moderator_id:t}}n(RE,"createShoutoutQuery");De.createShoutoutQuery=RE;function UE(i,e){return{broadcaster_id:i,sender_id:e}}n(UE,"createSendChatMessageQuery");De.createSendChatMessageQuery=UE;function BE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(BE,"createSendChatMessageBody");De.createSendChatMessageBody=BE;function OE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId,for_source_only:e?.forSourceOnly}}n(OE,"createSendChatMessageAsAppBody");De.createSendChatMessageAsAppBody=OE});var lh=u(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.HelixEmoteBase=void 0;var Ye=_(),oh=class extends Ye.DataObject{static{n(this,"HelixEmoteBase")}get id(){return this[Ye.rawDataSymbol].id}get name(){return this[Ye.rawDataSymbol].name}get formats(){return this[Ye.rawDataSymbol].format}get scales(){return this[Ye.rawDataSymbol].scale}get themeModes(){return this[Ye.rawDataSymbol].theme_mode}getStaticImageUrl(e="1.0",t="light"){return this[Ye.rawDataSymbol].format.includes("static")&&this[Ye.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[Ye.rawDataSymbol].format.includes("animated")&&this[Ye.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[Ye.rawDataSymbol].id}/${t}/${r}/${e}`}};ll.HelixEmoteBase=oh});var sn=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixEmote=void 0;var jE=(b(),x(g)),Og=_(),kE=lh(),uh=class extends kE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[Og.rawDataSymbol].images[`url_${e}x`]}};an.HelixEmote=uh;an.HelixEmote=uh=jE.__decorate([(0,Og.rtfm)("api","HelixEmote","id")],uh)});var ch=u(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.HelixChannelEmote=void 0;var jg=(b(),x(g)),ME=C(),on=_(),LE=sn(),ul=class extends LE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[on.rawDataSymbol].tier||null}get type(){return this[on.rawDataSymbol].emote_type}get emoteSetId(){return this[on.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[on.rawDataSymbol].emote_set_id])}};ln.HelixChannelEmote=ul;jg.__decorate([(0,ME.Enumerable)(!1)],ul.prototype,"_client",void 0);ln.HelixChannelEmote=ul=jg.__decorate([(0,on.rtfm)("api","HelixChannelEmote","id")],ul)});var hh=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixChatBadgeVersion=void 0;var FE=(b(),x(g)),Qt=_(),dh=class extends Qt.DataObject{static{n(this,"HelixChatBadgeVersion")}get id(){return this[Qt.rawDataSymbol].id}getImageUrl(e){return this[Qt.rawDataSymbol][`image_url_${e}x`]}get title(){return this[Qt.rawDataSymbol].title}get description(){return this[Qt.rawDataSymbol].description}get clickAction(){return this[Qt.rawDataSymbol].click_action}get clickUrl(){return this[Qt.rawDataSymbol].click_url}};un.HelixChatBadgeVersion=dh;un.HelixChatBadgeVersion=dh=FE.__decorate([(0,Qt.rtfm)("api","HelixChatBadgeVersion","id")],dh)});var ph=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixChatBadgeSet=void 0;var kg=(b(),x(g)),Mg=Hi(),cl=_(),NE=hh(),dl=class extends cl.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[cl.rawDataSymbol].set_id}get versions(){return this[cl.rawDataSymbol].versions.map(e=>new NE.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};cn.HelixChatBadgeSet=dl;kg.__decorate([(0,Mg.CachedGetter)()],dl.prototype,"versions",null);cn.HelixChatBadgeSet=dl=kg.__decorate([Mg.Cacheable,(0,cl.rtfm)("api","HelixChatBadgeSet","id")],dl)});var mh=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixChatChatter=void 0;var Lg=(b(),x(g)),QE=C(),dr=_(),hl=class extends dr.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[dr.rawDataSymbol].user_id}get userName(){return this[dr.rawDataSymbol].user_login}get userDisplayName(){return this[dr.rawDataSymbol].user_name}async getUser(){return(0,dr.checkRelationAssertion)(await this._client.users.getUserById(this[dr.rawDataSymbol].user_id))}};dn.HelixChatChatter=hl;Lg.__decorate([(0,QE.Enumerable)(!1)],hl.prototype,"_client",void 0);dn.HelixChatChatter=hl=Lg.__decorate([(0,dr.rtfm)("api","HelixChatChatter")],hl)});var pl=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixChatSettings=void 0;var GE=(b(),x(g)),ht=_(),_h=class extends ht.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[ht.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[ht.rawDataSymbol].slow_mode}get slowModeDelay(){return this[ht.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[ht.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[ht.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[ht.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[ht.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[ht.rawDataSymbol].unique_chat_mode}};hn.HelixChatSettings=_h;hn.HelixChatSettings=_h=GE.__decorate([(0,ht.rtfm)("api","HelixChatSettings","broadcasterId")],_h)});var yh=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixEmoteFromSet=void 0;var Fg=(b(),x(g)),WE=C(),hr=_(),VE=sn(),ml=class extends VE.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[hr.rawDataSymbol].emote_type}get emoteSetId(){return this[hr.rawDataSymbol].emote_set_id}get ownerId(){switch(this[hr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[hr.rawDataSymbol].owner_id}}async getOwner(){switch(this[hr.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[hr.rawDataSymbol].owner_id)}}};pn.HelixEmoteFromSet=ml;Fg.__decorate([(0,WE.Enumerable)(!1)],ml.prototype,"_client",void 0);pn.HelixEmoteFromSet=ml=Fg.__decorate([(0,hr.rtfm)("api","HelixEmoteFromSet","id")],ml)});var fh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixUserEmote=void 0;var Ng=(b(),x(g)),Gt=_(),$E=lh(),zE=C(),_l=class extends $E.HelixEmoteBase{static{n(this,"HelixUserEmote")}constructor(e,t){super(e),this._client=t}get type(){return this[Gt.rawDataSymbol].emote_type}get emoteSetId(){return this[Gt.rawDataSymbol].emote_set_id||null}get ownerId(){return this[Gt.rawDataSymbol].owner_id||null}async getAllEmotesFromSet(){return this[Gt.rawDataSymbol].emote_set_id?await this._client.chat.getEmotesFromSets([this[Gt.rawDataSymbol].emote_set_id]):null}async getOwner(){return this[Gt.rawDataSymbol].owner_id?await this._client.users.getUserById(this[Gt.rawDataSymbol].owner_id):null}};mn.HelixUserEmote=_l;Ng.__decorate([(0,zE.Enumerable)(!1)],_l.prototype,"_client",void 0);mn.HelixUserEmote=_l=Ng.__decorate([(0,Gt.rtfm)("api","HelixUserEmote","id")],_l)});var xh=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixPrivilegedChatSettings=void 0;var KE=(b(),x(g)),gh=_(),JE=pl(),bh=class extends JE.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[gh.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[gh.rawDataSymbol].non_moderator_chat_delay_duration}};_n.HelixPrivilegedChatSettings=bh;_n.HelixPrivilegedChatSettings=bh=KE.__decorate([(0,gh.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],bh)});var vh=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixSentChatMessage=void 0;var ZE=(b(),x(g)),Vr=_(),wh=class extends Vr.DataObject{static{n(this,"HelixSentChatMessage")}get id(){return this[Vr.rawDataSymbol].message_id}get isSent(){return this[Vr.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Vr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Vr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};yn.HelixSentChatMessage=wh;yn.HelixSentChatMessage=wh=ZE.__decorate([(0,Vr.rtfm)("api","HelixSentChatMessage","id")],wh)});var Qg=u(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.createSharedChatSessionQuery=void 0;var XE=_();function YE(i){return{broadcaster_id:(0,XE.extractUserId)(i)}}n(YE,"createSharedChatSessionQuery");yl.createSharedChatSessionQuery=YE});var Sh=u(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.HelixSharedChatSessionParticipant=void 0;var Gg=(b(),x(g)),eP=C(),fn=_(),fl=class extends fn.DataObject{static{n(this,"HelixSharedChatSessionParticipant")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[fn.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,fn.checkRelationAssertion)(await this._client.users.getUserById(this[fn.rawDataSymbol].broadcaster_id))}};gn.HelixSharedChatSessionParticipant=fl;Gg.__decorate([(0,eP.Enumerable)(!1)],fl.prototype,"_client",void 0);gn.HelixSharedChatSessionParticipant=fl=Gg.__decorate([(0,fn.rtfm)("api","HelixSharedChatSessionParticipant","broadcasterId")],fl)});var Hh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixSharedChatSession=void 0;var Wg=(b(),x(g)),tP=C(),Ht=_(),rP=Sh(),gl=class extends Ht.DataObject{static{n(this,"HelixSharedChatSession")}constructor(e,t){super(e),this._client=t}get sessionId(){return this[Ht.rawDataSymbol].session_id}get hostBroadcasterId(){return this[Ht.rawDataSymbol].host_broadcaster_id}async getHostBroadcaster(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].host_broadcaster_id))}get participants(){return this[Ht.rawDataSymbol].participants.map(e=>new rP.HelixSharedChatSessionParticipant(e,this._client))}get createdDate(){return new Date(this[Ht.rawDataSymbol].created_at)}get updatedDate(){return new Date(this[Ht.rawDataSymbol].updated_at)}};bn.HelixSharedChatSession=gl;Wg.__decorate([(0,tP.Enumerable)(!1)],gl.prototype,"_client",void 0);bn.HelixSharedChatSession=gl=Wg.__decorate([(0,Ht.rtfm)("api","HelixSharedChatSession","sessionId")],gl)});var Eh=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixChatApi=void 0;var iP=(b(),x(g)),Ch=Y(),Z=_(),pr=Bg(),Wt=Oe(),nP=oe(),aP=Gr(),Vg=he(),$g=le(),sP=G(),oP=ch(),zg=ph(),Kg=mh(),lP=pl(),uP=sn(),cP=yh(),Jg=fh(),Zg=xh(),Xg=vh(),dP=Qg(),hP=Hh(),qh=class extends sP.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let r=(0,Z.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,$g.createPaginationQuery)(t)}});return(0,Vg.createPaginatedResultWithTotal)(a,Kg.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,Z.extractUserId)(e);return new aP.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Kg.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new zg.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,Z.extractUserId)(e),query:(0,Ch.createBroadcasterQuery)(e)})).data.map(r=>new zg.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new uP.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,Z.extractUserId)(e),query:(0,Ch.createBroadcasterQuery)(e)})).data.map(r=>new oP.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Wt.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new cP.HelixEmoteFromSet(r,this._client))}async getUserEmotes(e,t){let r=(0,Z.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/emotes/user",userId:(0,Z.extractUserId)(e),scopes:["user:read:emotes"],query:{...(0,Wt.createSingleKeyQuery)("user_id",r),...(0,Wt.createSingleKeyQuery)("broadcasterId",t?.broadcaster?(0,Z.extractUserId)(t.broadcaster):void 0),...(0,$g.createPaginationQuery)(t)}});return(0,Vg.createPaginatedResult)(a,Jg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,Z.extractUserId)(e);return new nP.HelixPaginatedRequest({url:"chat/emotes/user",userId:r,scopes:["user:read:emotes"],query:{...(0,Wt.createSingleKeyQuery)("user_id",r),...(0,Wt.createSingleKeyQuery)("broadcasterId",t?(0,Z.extractUserId)(t):void 0)}},this._client,a=>new Jg.HelixUserEmote(a,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,Z.extractUserId)(e),query:(0,Ch.createBroadcasterQuery)(e)});return new lP.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,Z.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 Zg.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,Z.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,pr.createChatSettingsUpdateBody)(t)});return new Zg.HelixPrivilegedChatSettings(a.data[0])}async sendChatMessage(e,t,r){let a=(0,Z.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:a,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,pr.createSendChatMessageQuery)(a,this._getUserContextIdWithDefault(a)),jsonBody:(0,pr.createSendChatMessageBody)(t,r)});return new Xg.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,a){let s=(0,Z.extractUserId)(e),o=(0,Z.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,pr.createSendChatMessageQuery)(o,s),jsonBody:(0,pr.createSendChatMessageAsAppBody)(r,a)});return new Xg.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,Z.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,Wt.createSingleKeyQuery)("user_id",e.map(Z.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,Z.extractUserId)(e),query:(0,Wt.createSingleKeyQuery)("user_id",(0,Z.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,Z.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,pr.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,Z.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,pr.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}async getSharedChatSession(e){let t=(0,Z.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"shared_chat/session",userId:t,query:(0,dP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new hP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Wt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};xn.HelixChatApi=qh;xn.HelixChatApi=qh=iP.__decorate([(0,Z.rtfm)("api","HelixChatApi")],qh)});var Yg=u($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.createClipQuery=$r.createClipCreateQuery=void 0;var pP=_();function mP(i,e){return{broadcaster_id:(0,pP.extractUserId)(i),has_delay:e.toString()}}n(mP,"createClipCreateQuery");$r.createClipCreateQuery=mP;function _P(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(_P,"createClipQuery");$r.createClipQuery=_P});var Ph=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixClip=void 0;var eb=(b(),x(g)),yP=C(),L=_(),bl=class extends L.DataObject{static{n(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[L.rawDataSymbol].id}get url(){return this[L.rawDataSymbol].url}get embedUrl(){return this[L.rawDataSymbol].embed_url}get broadcasterId(){return this[L.rawDataSymbol].broadcaster_id}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 creatorId(){return this[L.rawDataSymbol].creator_id}get creatorDisplayName(){return this[L.rawDataSymbol].creator_name}async getCreator(){return(0,L.checkRelationAssertion)(await this._client.users.getUserById(this[L.rawDataSymbol].creator_id))}get videoId(){return this[L.rawDataSymbol].video_id}async getVideo(){return(0,L.checkRelationAssertion)(await this._client.videos.getVideoById(this[L.rawDataSymbol].video_id))}get gameId(){return this[L.rawDataSymbol].game_id}async getGame(){return this[L.rawDataSymbol].game_id?(0,L.checkRelationAssertion)(await this._client.games.getGameById(this[L.rawDataSymbol].game_id)):null}get language(){return this[L.rawDataSymbol].language}get title(){return this[L.rawDataSymbol].title}get views(){return this[L.rawDataSymbol].view_count}get creationDate(){return new Date(this[L.rawDataSymbol].created_at)}get thumbnailUrl(){return this[L.rawDataSymbol].thumbnail_url}get duration(){return this[L.rawDataSymbol].duration}get vodOffset(){return this[L.rawDataSymbol].vod_offset}get isFeatured(){return this[L.rawDataSymbol].is_featured}};wn.HelixClip=bl;eb.__decorate([(0,yP.Enumerable)(!1)],bl.prototype,"_client",void 0);wn.HelixClip=bl=eb.__decorate([(0,L.rtfm)("api","HelixClip","id")],bl)});var Ih=u(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.HelixClipApi=void 0;var tb=(b(),x(g)),fP=C(),zr=_(),Ah=Yg(),gP=Lt(),bP=oe(),xP=he(),wP=le(),vP=G(),Dh=Ph(),xl=class extends vP.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new gP.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Dh.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,zr.extractUserId)(e),userId:(0,zr.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,zr.extractUserId)(e),userId:(0,zr.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,zr.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,Ah.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,Ah.createClipQuery)(e),...(0,wP.createPaginationQuery)(e)}});return(0,xP.createPaginatedResult)(t,Dh.HelixClip,this._client)}_getClipsPaginated(e){return new bP.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,Ah.createClipQuery)(e)},this._client,t=>new Dh.HelixClip(t,this._client))}};vn.HelixClipApi=xl;tb.__decorate([(0,fP.Enumerable)(!1)],xl.prototype,"_getClipByIdBatcher",void 0);vn.HelixClipApi=xl=tb.__decorate([(0,zr.rtfm)("api","HelixClipApi")],xl)});var Rh=u(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.HelixContentClassificationLabel=void 0;var wl=_(),Th=class extends wl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[wl.rawDataSymbol].id}get name(){return this[wl.rawDataSymbol].name}get description(){return this[wl.rawDataSymbol].description}};vl.HelixContentClassificationLabel=Th});var Bh=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixContentClassificationLabelApi=void 0;var SP=(b(),x(g)),HP=_(),CP=G(),qP=Rh(),Uh=class extends CP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new qP.HelixContentClassificationLabel(r))}};Sn.HelixContentClassificationLabelApi=Uh;Sn.HelixContentClassificationLabelApi=Uh=SP.__decorate([(0,HP.rtfm)("api","HelixContentClassificationLabelApi")],Uh)});var rb=u(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.createDropsEntitlementUpdateBody=Kr.createDropsEntitlementQuery=void 0;var EP=C(),PP=_();function AP(i,e){return{user_id:e?(0,EP.mapOptional)(i.user,PP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(AP,"createDropsEntitlementQuery");Kr.createDropsEntitlementQuery=AP;function DP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(DP,"createDropsEntitlementUpdateBody");Kr.createDropsEntitlementUpdateBody=DP});var Oh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixDropsEntitlement=void 0;var ib=(b(),x(g)),IP=C(),je=_(),Sl=class extends je.DataObject{static{n(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[je.rawDataSymbol].id}get rewardId(){return this[je.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[je.rawDataSymbol].timestamp)}get userId(){return this[je.rawDataSymbol].user_id}async getUser(){return(0,je.checkRelationAssertion)(await this._client.users.getUserById(this[je.rawDataSymbol].user_id))}get gameId(){return this[je.rawDataSymbol].game_id}async getGame(){return(0,je.checkRelationAssertion)(await this._client.games.getGameById(this[je.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[je.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[je.rawDataSymbol].last_updated)}};Hn.HelixDropsEntitlement=Sl;ib.__decorate([(0,IP.Enumerable)(!1)],Sl.prototype,"_client",void 0);Hn.HelixDropsEntitlement=Sl=ib.__decorate([(0,je.rtfm)("api","HelixDropsEntitlement")],Sl)});var Lh=u(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.HelixEntitlementApi=void 0;var nb=(b(),x(g)),kh=C(),Mh=_(),jh=rb(),TP=Lt(),RP=oe(),UP=he(),BP=le(),OP=G(),Hl=Oh(),Cl=class extends OP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new TP.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new Hl.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,kh.mapOptional)(e.user,Mh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,jh.createDropsEntitlementQuery)(e,t),...(0,BP.createPaginationQuery)(e)}});return(0,UP.createPaginatedResult)(r,Hl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new RP.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,kh.mapOptional)(e.user,Mh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,jh.createDropsEntitlementQuery)(e,t)},this._client,r=>new Hl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new Hl.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,jh.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(a=>a.ids.map(s=>[s,a.status])))}};Cn.HelixEntitlementApi=Cl;nb.__decorate([(0,kh.Enumerable)(!1)],Cl.prototype,"_getDropsEntitlementByIdBatcher",void 0);Cn.HelixEntitlementApi=Cl=nb.__decorate([(0,Mh.rtfm)("api","HelixEntitlementApi")],Cl)});var sb=u(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.createEventSubConduitShardsUpdateCondition=_e.createEventSubConduitUpdateCondition=_e.createEventSubConduitCondition=_e.createEventSubDropEntitlementGrantCondition=_e.createEventSubUserCondition=_e.createEventSubModeratorCondition=_e.createEventSubRewardCondition=_e.createEventSubBroadcasterCondition=void 0;var ab=_();function jP(i){return{broadcaster_user_id:(0,ab.extractUserId)(i)}}n(jP,"createEventSubBroadcasterCondition");_e.createEventSubBroadcasterCondition=jP;function kP(i,e){return{broadcaster_user_id:(0,ab.extractUserId)(i),reward_id:e}}n(kP,"createEventSubRewardCondition");_e.createEventSubRewardCondition=kP;function MP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(MP,"createEventSubModeratorCondition");_e.createEventSubModeratorCondition=MP;function LP(i,e){return{broadcaster_user_id:i,user_id:e}}n(LP,"createEventSubUserCondition");_e.createEventSubUserCondition=LP;function FP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(FP,"createEventSubDropEntitlementGrantCondition");_e.createEventSubDropEntitlementGrantCondition=FP;function NP(i,e){return{conduit_id:i,status:e}}n(NP,"createEventSubConduitCondition");_e.createEventSubConduitCondition=NP;function QP(i,e){return{id:i,shard_count:e.toString()}}n(QP,"createEventSubConduitUpdateCondition");_e.createEventSubConduitUpdateCondition=QP;function GP(i,e){return{conduit_id:i,shards:e}}n(GP,"createEventSubConduitShardsUpdateCondition");_e.createEventSubConduitShardsUpdateCondition=GP});var El=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixEventSubSubscription=void 0;var ob=(b(),x(g)),WP=C(),$e=_(),ql=class extends $e.DataObject{static{n(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[$e.rawDataSymbol].id}get status(){return this[$e.rawDataSymbol].status}get type(){return this[$e.rawDataSymbol].type}get cost(){return this[$e.rawDataSymbol].cost}get condition(){return this[$e.rawDataSymbol].condition}get creationDate(){return new Date(this[$e.rawDataSymbol].created_at)}get transportMethod(){return this[$e.rawDataSymbol].transport.method}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[$e.rawDataSymbol].id)}get _transport(){return this[$e.rawDataSymbol].transport}set _status(e){this[$e.rawDataSymbol].status=e}};qn.HelixEventSubSubscription=ql;ob.__decorate([(0,WP.Enumerable)(!1)],ql.prototype,"_client",void 0);qn.HelixEventSubSubscription=ql=ob.__decorate([(0,$e.rtfm)("api","HelixEventSubSubscription","id")],ql)});var Nh=u(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.HelixPaginatedEventSubSubscriptionsRequest=void 0;var VP=(b(),x(g)),$P=_(),zP=Gr(),KP=El(),Fh=class extends zP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new KP.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}};En.HelixPaginatedEventSubSubscriptionsRequest=Fh;En.HelixPaginatedEventSubSubscriptionsRequest=Fh=VP.__decorate([(0,$P.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Fh)});var Qh=u(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.HelixEventSubConduit=void 0;var lb=(b(),x(g)),JP=C(),mr=_(),Pl=class extends mr.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[mr.rawDataSymbol].id}get shardCount(){return this[mr.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[mr.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[mr.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[mr.rawDataSymbol].id)}};Pn.HelixEventSubConduit=Pl;lb.__decorate([(0,JP.Enumerable)(!1)],Pl.prototype,"_client",void 0);Pn.HelixEventSubConduit=Pl=lb.__decorate([(0,mr.rtfm)("api","HelixEventSubConduit")],Pl)});var Wh=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixEventSubConduitShard=void 0;var ZP=(b(),x(g)),An=_(),Gh=class extends An.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[An.rawDataSymbol].id}get status(){return this[An.rawDataSymbol].status}get transportMethod(){return this[An.rawDataSymbol].transport.method}};Dn.HelixEventSubConduitShard=Gh;Dn.HelixEventSubConduitShard=Gh=ZP.__decorate([(0,An.rtfm)("api","HelixEventSubConduitShard")],Gh)});var Kh=u(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.HelixEventSubApi=void 0;var XP=(b(),x(g)),YP=C(),U=_(),S=sb(),et=Oe(),eA=oe(),In=he(),Tn=le(),tA=G(),Rn=El(),Al=Nh(),Vh=Qh(),$h=Wh(),zh=class extends tA.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,Tn.createPaginationQuery)(e)});return{...(0,In.createPaginatedResultWithTotal)(t,Rn.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new Al.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Tn.createPaginationQuery)(t),status:e}});return{...(0,In.createPaginatedResultWithTotal)(r,Rn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Al.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Tn.createPaginationQuery)(t),type:e}});return{...(0,In.createPaginatedResultWithTotal)(r,Rn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Al.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,U.extractUserId)(e),query:{...(0,et.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),...(0,Tn.createPaginationQuery)(t)}});return{...(0,In.createPaginatedResultWithTotal)(r,Rn.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,U.extractUserId)(e);return new Al.HelixPaginatedEventSubSubscriptionsRequest((0,et.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,a,s,o,l,c){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 w={type:e,version:t,condition:r,transport:a};c&&(w.is_batching_enabled=!0);let E=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:p,userId:(0,YP.mapOptional)(s,U.extractUserId),canOverrideScopedUserContext:l,forceType:h?"app":"user",jsonBody:w});return new Rn.HelixEventSubSubscription(E.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,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","2",(0,S.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,S.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,S.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,t){return await this.createSubscription("channel.raid","1",(0,et.createSingleKeyQuery)("from_broadcaster_user_id",(0,U.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,et.createSingleKeyQuery)("to_broadcaster_user_id",(0,U.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,S.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,S.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,S.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,S.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,S.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,S.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,S.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,S.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,S.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,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddV2Events(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainBeginV2Events(e,t){return await this.createSubscription("channel.hype_train.begin","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressV2Events(e,t){return await this.createSubscription("channel.hype_train.progress","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndV2Events(e,t){return await this.createSubscription("channel.hype_train.end","2",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,S.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,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelUnbanRequestCreateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.unban_request.create","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelUnbanRequestResolveEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.unban_request.resolve","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelModerateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.moderate","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,[],!0)}async subscribeToChannelWarningAcknowledgeEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.warning.acknowledge","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelWarningSendEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.warning.send","1",(0,S.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,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToChannelVipRemoveEvents(e,t){return await this.createSubscription("channel.vip.remove","1",(0,S.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,et.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,et.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,et.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,r){return await this.createSubscription("user.update","1",(0,et.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),t,e,r?["user:read:email"]:void 0)}async subscribeToUserWhisperMessageEvents(e,t){return await this.createSubscription("user.whisper.message","1",(0,et.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),t,e,["user:read:whispers","user:manage:whispers"])}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,S.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async subscribeToAutoModMessageHoldEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.hold","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageHoldV2Events(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.hold","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateV2Events(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.update","2",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModSettingsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.settings.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:automod_settings"],!0)}async subscribeToAutoModTermsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.terms.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToChannelChatUserMessageHoldEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_hold","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatUserMessageUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_update","1",(0,S.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelSuspiciousUserUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.update","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSuspiciousUserMessageEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.message","1",(0,S.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSharedChatSessionBeginEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.begin","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.update","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionEndEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.end","1",(0,S.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelBitsUseEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.bits.use","1",(0,S.createEventSubBroadcasterCondition)(r),t,r,["bits:read"])}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new Vh.HelixEventSubConduit(t,this._client))}async createConduit(e){let t=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"POST",query:{...(0,et.createSingleKeyQuery)("shard_count",e.toString())}});return new Vh.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,S.createEventSubConduitUpdateCondition)(e,t)});return new Vh.HelixEventSubConduit(r.data[0],this._client)}async deleteConduit(e){await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"DELETE",query:{...(0,et.createSingleKeyQuery)("id",e)}})}async getConduitShards(e,t,r){let a=await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",query:{...(0,S.createEventSubConduitCondition)(e,t),...(0,Tn.createPaginationQuery)(r)}});return{...(0,In.createPaginatedResult)(a,$h.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new eA.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,S.createEventSubConduitCondition)(e,t)},this._client,r=>new $h.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,S.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(a=>new $h.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};Un.HelixEventSubApi=zh;Un.HelixEventSubApi=zh=XP.__decorate([(0,U.rtfm)("api","HelixEventSubApi")],zh)});var ub=u(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.createExtensionTransactionQuery=Vt.createExtensionProductBody=Vt.createReleasedExtensionFilter=void 0;function rA(i,e){return{extension_id:i,extension_version:e}}n(rA,"createReleasedExtensionFilter");Vt.createReleasedExtensionFilter=rA;function iA(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(iA,"createExtensionProductBody");Vt.createExtensionProductBody=iA;function nA(i,e){return{extension_id:i,id:e.transactionIds}}n(nA,"createExtensionTransactionQuery");Vt.createExtensionTransactionQuery=nA});var Jh=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixChannelReference=void 0;var cb=(b(),x(g)),aA=C(),Ie=_(),Dl=class extends Ie.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[Ie.rawDataSymbol].broadcaster_id}get displayName(){return this[Ie.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Ie.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Ie.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Ie.checkRelationAssertion)(await this._client.users.getUserById(this[Ie.rawDataSymbol].broadcaster_id))}get gameId(){return this[Ie.rawDataSymbol].game_id}get gameName(){return this[Ie.rawDataSymbol].game_name}async getGame(){return this[Ie.rawDataSymbol].game_id?(0,Ie.checkRelationAssertion)(await this._client.games.getGameById(this[Ie.rawDataSymbol].game_id)):null}get title(){return this[Ie.rawDataSymbol].title}};Bn.HelixChannelReference=Dl;cb.__decorate([(0,aA.Enumerable)(!1)],Dl.prototype,"_client",void 0);Bn.HelixChannelReference=Dl=cb.__decorate([(0,Ie.rtfm)("api","HelixChannelReference","id")],Dl)});var Xh=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixExtensionBitsProduct=void 0;var sA=(b(),x(g)),oA=C(),$t=_(),Zh=class extends $t.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[$t.rawDataSymbol].sku}get cost(){return this[$t.rawDataSymbol].cost.amount}get displayName(){return this[$t.rawDataSymbol].display_name}get inDevelopment(){return this[$t.rawDataSymbol].in_development}get isBroadcast(){return this[$t.rawDataSymbol].is_broadcast}get expirationDate(){return(0,oA.mapNullable)(this[$t.rawDataSymbol].expiration,e=>new Date(e))}};On.HelixExtensionBitsProduct=Zh;On.HelixExtensionBitsProduct=Zh=sA.__decorate([(0,$t.rtfm)("api","HelixExtensionBitsProduct","sku")],Zh)});var Yh=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixExtensionTransaction=void 0;var db=(b(),x(g)),lA=C(),pe=_(),Il=class extends pe.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[pe.rawDataSymbol].id}get transactionDate(){return new Date(this[pe.rawDataSymbol].timestamp)}get broadcasterId(){return this[pe.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[pe.rawDataSymbol].broadcaster_name}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 userId(){return this[pe.rawDataSymbol].user_id}get userName(){return this[pe.rawDataSymbol].user_login}get userDisplayName(){return this[pe.rawDataSymbol].user_name}async getUser(){return(0,pe.checkRelationAssertion)(await this._client.users.getUserById(this[pe.rawDataSymbol].user_id))}get productType(){return this[pe.rawDataSymbol].product_type}get productSku(){return this[pe.rawDataSymbol].product_data.sku}get productCost(){return this[pe.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[pe.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[pe.rawDataSymbol].product_data.inDevelopment}};jn.HelixExtensionTransaction=Il;db.__decorate([(0,lA.Enumerable)(!1)],Il.prototype,"_client",void 0);jn.HelixExtensionTransaction=Il=db.__decorate([(0,pe.rtfm)("api","HelixExtensionTransaction","id")],Il)});var rp=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixExtensionsApi=void 0;var uA=(b(),x(g)),gb=_(),Tl=ub(),ep=Oe(),hb=oe(),pb=he(),mb=le(),cA=G(),_b=Jh(),yb=Xh(),fb=Yh(),tp=class extends cA.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Tl.createReleasedExtensionFilter)(e,t)});return new gb.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,ep.createSingleKeyQuery)("extension_id",e),...(0,mb.createPaginationQuery)(t)}});return(0,pb.createPaginatedResult)(r,_b.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new hb.HelixPaginatedRequest({url:"extensions/live",query:(0,ep.createSingleKeyQuery)("extension_id",e)},this._client,t=>new _b.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,ep.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new yb.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Tl.createExtensionProductBody)(e)});return new yb.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Tl.createExtensionTransactionQuery)(e,t),...(0,mb.createPaginationQuery)(t)}});return(0,pb.createPaginatedResult)(r,fb.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new hb.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Tl.createExtensionTransactionQuery)(e,t)},this._client,r=>new fb.HelixExtensionTransaction(r,this._client))}};kn.HelixExtensionsApi=tp;kn.HelixExtensionsApi=tp=uA.__decorate([(0,gb.rtfm)("api","HelixExtensionsApi")],tp)});var Ul=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixGame=void 0;var bb=(b(),x(g)),dA=C(),Ct=_(),Rl=class extends Ct.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[Ct.rawDataSymbol].id}get name(){return this[Ct.rawDataSymbol].name}get boxArtUrl(){return this[Ct.rawDataSymbol].box_art_url}get igdbId(){return this[Ct.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[Ct.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[Ct.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[Ct.rawDataSymbol].id})}};Mn.HelixGame=Rl;bb.__decorate([(0,dA.Enumerable)(!1)],Rl.prototype,"_client",void 0);Mn.HelixGame=Rl=bb.__decorate([(0,Ct.rtfm)("api","HelixGame","id")],Rl)});var ap=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixGameApi=void 0;var Bl=(b(),x(g)),np=C(),hA=_(),ip=Lt(),pA=oe(),mA=he(),_A=le(),yA=G(),Jr=Ul(),Zr=class extends yA.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new ip.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Jr.HelixGame(e,this._client)),this._getGameByNameBatcher=new ip.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Jr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new ip.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Jr.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,_A.createPaginationQuery)(e)});return(0,mA.createPaginatedResult)(t,Jr.HelixGame,this._client)}getTopGamesPaginated(){return new pA.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Jr.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 Jr.HelixGame(a,this._client)):[]}};Ln.HelixGameApi=Zr;Bl.__decorate([(0,np.Enumerable)(!1)],Zr.prototype,"_getGameByIdBatcher",void 0);Bl.__decorate([(0,np.Enumerable)(!1)],Zr.prototype,"_getGameByNameBatcher",void 0);Bl.__decorate([(0,np.Enumerable)(!1)],Zr.prototype,"_getGameByIgdbIdBatcher",void 0);Ln.HelixGameApi=Zr=Bl.__decorate([(0,hA.rtfm)("api","HelixGameApi")],Zr)});var sp=u(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.HelixGoal=void 0;var xb=(b(),x(g)),fA=C(),ke=_(),Ol=class extends ke.DataObject{static{n(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[ke.rawDataSymbol].id}get broadcasterId(){return this[ke.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[ke.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[ke.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,ke.checkRelationAssertion)(await this._client.users.getUserById(this[ke.rawDataSymbol].broadcaster_id))}get type(){return this[ke.rawDataSymbol].type}get description(){return this[ke.rawDataSymbol].description}get currentAmount(){return this[ke.rawDataSymbol].current_amount}get targetAmount(){return this[ke.rawDataSymbol].target_amount}get creationDate(){return this[ke.rawDataSymbol].created_at}};Fn.HelixGoal=Ol;xb.__decorate([(0,fA.Enumerable)(!1)],Ol.prototype,"_client",void 0);Fn.HelixGoal=Ol=xb.__decorate([(0,ke.rtfm)("api","HelixGoal","id")],Ol)});var lp=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixGoalApi=void 0;var gA=(b(),x(g)),bA=Y(),wb=_(),xA=G(),wA=sp(),op=class extends xA.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,wb.extractUserId)(e),scopes:["channel:read:goals"],query:(0,bA.createBroadcasterQuery)(e)})).data.map(r=>new wA.HelixGoal(r,this._client))}};Nn.HelixGoalApi=op;Nn.HelixGoalApi=op=gA.__decorate([(0,wb.rtfm)("api","HelixGoalApi")],op)});var up=u(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.HelixHypeTrainContribution=void 0;var vb=(b(),x(g)),vA=C(),_r=_(),jl=class extends _r.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[_r.rawDataSymbol].user}async getUser(){return(0,_r.checkRelationAssertion)(await this._client.users.getUserById(this[_r.rawDataSymbol].user))}get type(){return this[_r.rawDataSymbol].type}get total(){return this[_r.rawDataSymbol].total}};Qn.HelixHypeTrainContribution=jl;vb.__decorate([(0,vA.Enumerable)(!1)],jl.prototype,"_client",void 0);Qn.HelixHypeTrainContribution=jl=vb.__decorate([(0,_r.rtfm)("api","HelixHypeTrainContribution","userId")],jl)});var cp=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixHypeTrainEvent=void 0;var Hb=(b(),x(g)),SA=C(),ye=_(),Sb=up(),kl=class extends ye.DataObject{static{n(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[ye.rawDataSymbol].id}get eventType(){return this[ye.rawDataSymbol].event_type}get eventDate(){return new Date(this[ye.rawDataSymbol].event_timestamp)}get eventVersion(){return this[ye.rawDataSymbol].version}get id(){return this[ye.rawDataSymbol].event_data.id}get broadcasterId(){return this[ye.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,ye.checkRelationAssertion)(await this._client.users.getUserById(this[ye.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[ye.rawDataSymbol].event_data.level}get startDate(){return new Date(this[ye.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[ye.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[ye.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[ye.rawDataSymbol].event_data.total}get goal(){return this[ye.rawDataSymbol].event_data.goal}get lastContribution(){return new Sb.HelixHypeTrainContribution(this[ye.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[ye.rawDataSymbol].event_data.top_contributions.map(e=>new Sb.HelixHypeTrainContribution(e,this._client))}};Gn.HelixHypeTrainEvent=kl;Hb.__decorate([(0,SA.Enumerable)(!1)],kl.prototype,"_client",void 0);Gn.HelixHypeTrainEvent=kl=Hb.__decorate([(0,ye.rtfm)("api","HelixHypeTrainEvent","id")],kl)});var hp=u(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.HelixHypeTrainApi=void 0;var Cb=Y(),qb=_(),HA=oe(),CA=he(),qA=le(),EA=G(),Eb=cp(),dp=class extends EA.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,qb.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,Cb.createBroadcasterQuery)(e),...(0,qA.createPaginationQuery)(t)}});return(0,CA.createPaginatedResult)(r,Eb.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new HA.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,qb.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,Cb.createBroadcasterQuery)(e)},this._client,t=>new Eb.HelixHypeTrainEvent(t,this._client))}};Ml.HelixHypeTrainApi=dp});var Pb=u(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.createWarnUserBody=ce.createCheckAutoModStatusBody=ce.createUpdateShieldModeStatusBody=ce.createBanUserBody=ce.createAutoModSettingsBody=ce.createAutoModProcessBody=ce.createResolveUnbanRequestQuery=ce.createModeratorModifyQuery=ce.createModerationUserListQuery=void 0;var zt=_();function PA(i,e){return{broadcaster_id:(0,zt.extractUserId)(i),user_id:e?.userId}}n(PA,"createModerationUserListQuery");ce.createModerationUserListQuery=PA;function AA(i,e){return{broadcaster_id:(0,zt.extractUserId)(i),user_id:(0,zt.extractUserId)(e)}}n(AA,"createModeratorModifyQuery");ce.createModeratorModifyQuery=AA;function DA(i,e,t,r,a){return{unban_request_id:t,broadcaster_id:(0,zt.extractUserId)(i),moderator_id:(0,zt.extractUserId)(e),status:r?"approved":"denied",resolution_text:a}}n(DA,"createResolveUnbanRequestQuery");ce.createResolveUnbanRequestQuery=DA;function IA(i,e,t){return{user_id:(0,zt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(IA,"createAutoModProcessBody");ce.createAutoModProcessBody=IA;function TA(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(TA,"createAutoModSettingsBody");ce.createAutoModSettingsBody=TA;function RA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,zt.extractUserId)(i.user)}}}n(RA,"createBanUserBody");ce.createBanUserBody=RA;function UA(i){return{is_active:i}}n(UA,"createUpdateShieldModeStatusBody");ce.createUpdateShieldModeStatusBody=UA;function BA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(BA,"createCheckAutoModStatusBody");ce.createCheckAutoModStatusBody=BA;function OA(i,e){return{data:{user_id:(0,zt.extractUserId)(i),reason:e}}}n(OA,"createWarnUserBody");ce.createWarnUserBody=OA});var Ab=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixAutoModSettings=void 0;var jA=(b(),x(g)),Te=_(),pp=class extends Te.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[Te.rawDataSymbol].broadcaster_id}get moderatorId(){return this[Te.rawDataSymbol].moderator_id}get overallLevel(){return this[Te.rawDataSymbol].overall_level?this[Te.rawDataSymbol].overall_level:null}get disability(){return this[Te.rawDataSymbol].disability}get aggression(){return this[Te.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[Te.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[Te.rawDataSymbol].misogyny}get bullying(){return this[Te.rawDataSymbol].bullying}get swearing(){return this[Te.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[Te.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[Te.rawDataSymbol].sex_based_terms}};Wn.HelixAutoModSettings=pp;Wn.HelixAutoModSettings=pp=jA.__decorate([(0,Te.rtfm)("api","HelixAutoModSettings","broadcasterId")],pp)});var Db=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixAutoModStatus=void 0;var kA=(b(),x(g)),Ll=_(),mp=class extends Ll.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[Ll.rawDataSymbol].msg_id}get isPermitted(){return this[Ll.rawDataSymbol].is_permitted}};Vn.HelixAutoModStatus=mp;Vn.HelixAutoModStatus=mp=kA.__decorate([(0,Ll.rtfm)("api","HelixAutoModStatus","messageId")],mp)});var Fl=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixBanUser=void 0;var _p=(b(),x(g)),yp=C(),qt=_(),$n=class extends qt.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[qt.rawDataSymbol].created_at)}get expiryDate(){return(0,yp.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[qt.rawDataSymbol].moderator_id}async getModerator(){return(0,qt.checkRelationAssertion)(await this._client.users.getUserById(this[qt.rawDataSymbol].moderator_id))}get userId(){return this[qt.rawDataSymbol].user_id}async getUser(){return(0,qt.checkRelationAssertion)(await this._client.users.getUserById(this[qt.rawDataSymbol].user_id))}};zn.HelixBanUser=$n;_p.__decorate([(0,yp.Enumerable)(!1)],$n.prototype,"_client",void 0);_p.__decorate([(0,yp.Enumerable)(!1)],$n.prototype,"_expiryTimestamp",void 0);zn.HelixBanUser=$n=_p.__decorate([(0,qt.rtfm)("api","HelixBanUser","userId")],$n)});var gp=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixBan=void 0;var MA=(b(),x(g)),Xr=_(),LA=Fl(),fp=class extends LA.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[Xr.rawDataSymbol].user_login}get userDisplayName(){return this[Xr.rawDataSymbol].user_name}get moderatorName(){return this[Xr.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Xr.rawDataSymbol].moderator_name}get reason(){return this[Xr.rawDataSymbol].reason||null}};Kn.HelixBan=fp;Kn.HelixBan=fp=MA.__decorate([(0,Xr.rtfm)("api","HelixBan","userId")],fp)});var xp=u(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.HelixBlockedTerm=void 0;var FA=(b(),x(g)),pt=_(),bp=class extends pt.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[pt.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[pt.rawDataSymbol].created_at)}get expirationDate(){return this[pt.rawDataSymbol].expires_at?new Date(this[pt.rawDataSymbol].expires_at):null}get id(){return this[pt.rawDataSymbol].id}get moderatorId(){return this[pt.rawDataSymbol].moderator_id}get text(){return this[pt.rawDataSymbol].text}get updatedDate(){return new Date(this[pt.rawDataSymbol].updated_at)}};Jn.HelixBlockedTerm=bp;Jn.HelixBlockedTerm=bp=FA.__decorate([(0,pt.rtfm)("api","HelixBlockedTerm","id")],bp)});var wp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixModeratedChannel=void 0;var Ib=(b(),x(g)),NA=C(),Et=_(),Nl=class extends Et.DataObject{static{n(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[Et.rawDataSymbol].broadcaster_id}get name(){return this[Et.rawDataSymbol].broadcaster_login}get displayName(){return this[Et.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Et.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Et.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Et.checkRelationAssertion)(await this._client.users.getUserById(this[Et.rawDataSymbol].broadcaster_id))}};Zn.HelixModeratedChannel=Nl;Ib.__decorate([(0,NA.Enumerable)(!1)],Nl.prototype,"_client",void 0);Zn.HelixModeratedChannel=Nl=Ib.__decorate([(0,Et.rtfm)("api","HelixModeratedChannel","id")],Nl)});var vp=u(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.HelixModerator=void 0;var Tb=(b(),x(g)),QA=C(),yr=_(),Ql=class extends yr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[yr.rawDataSymbol].user_id}get userName(){return this[yr.rawDataSymbol].user_login}get userDisplayName(){return this[yr.rawDataSymbol].user_name}async getUser(){return(0,yr.checkRelationAssertion)(await this._client.users.getUserById(this[yr.rawDataSymbol].user_id))}};Xn.HelixModerator=Ql;Tb.__decorate([(0,QA.Enumerable)(!1)],Ql.prototype,"_client",void 0);Xn.HelixModerator=Ql=Tb.__decorate([(0,yr.rtfm)("api","HelixModerator","userId")],Ql)});var Sp=u(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.HelixShieldModeStatus=void 0;var Rb=(b(),x(g)),GA=C(),mt=_(),Gl=class extends mt.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[mt.rawDataSymbol].is_active}get moderatorId(){return this[mt.rawDataSymbol].moderator_id}get moderatorName(){return this[mt.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[mt.rawDataSymbol].moderator_name}async getModerator(){return(0,mt.checkRelationAssertion)(await this._client.users.getUserById(this[mt.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[mt.rawDataSymbol].last_activated_at===""?null:new Date(this[mt.rawDataSymbol].last_activated_at)}};Yn.HelixShieldModeStatus=Gl;Rb.__decorate([(0,GA.Enumerable)(!1)],Gl.prototype,"_client",void 0);Yn.HelixShieldModeStatus=Gl=Rb.__decorate([(0,mt.rtfm)("api","HelixShieldModeStatus")],Gl)});var Hp=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixUnbanRequest=void 0;var Ub=(b(),x(g)),Bb=C(),te=_(),Wl=class extends te.DataObject{static{n(this,"HelixUnbanRequest")}constructor(e,t){super(e),this._client=t}get id(){return this[te.rawDataSymbol].id}get broadcasterId(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[te.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[te.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[te.rawDataSymbol].moderator_id}get moderatorName(){return this[te.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[te.rawDataSymbol].moderator_name}async getModerator(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].moderator_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 message(){return this[te.rawDataSymbol].text}get creationDate(){return new Date(this[te.rawDataSymbol].created_at)}get resolutionMessage(){return this[te.rawDataSymbol].resolution_text||null}get resolutionDate(){return(0,Bb.mapNullable)(this[te.rawDataSymbol].resolved_at,e=>new Date(e))}};ea.HelixUnbanRequest=Wl;Ub.__decorate([(0,Bb.Enumerable)(!1)],Wl.prototype,"_client",void 0);ea.HelixUnbanRequest=Wl=Ub.__decorate([(0,te.rtfm)("api","HelixUnbanRequest","id")],Wl)});var Cp=u(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.HelixWarning=void 0;var Ob=(b(),x(g)),WA=C(),ze=_(),Vl=class extends ze.DataObject{static{n(this,"HelixWarning")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[ze.rawDataSymbol].user_id}async getBroadcaster(){return(0,ze.checkRelationAssertion)(await this._client.users.getUserById(this[ze.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[ze.rawDataSymbol].moderator_id}async getModerator(){return(0,ze.checkRelationAssertion)(await this._client.users.getUserById(this[ze.rawDataSymbol].moderator_id))}get userId(){return this[ze.rawDataSymbol].user_id}async getUser(){return(0,ze.checkRelationAssertion)(await this._client.users.getUserById(this[ze.rawDataSymbol].user_id))}get reason(){return this[ze.rawDataSymbol].reason}};ta.HelixWarning=Vl;Ob.__decorate([(0,WA.Enumerable)(!1)],Vl.prototype,"_client",void 0);ta.HelixWarning=Vl=Ob.__decorate([(0,ze.rtfm)("api","HelixWarning","userId")],Vl)});var Ap=u(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.HelixModerationApi=void 0;var VA=(b(),x(g)),qp=Y(),F=_(),fr=Oe(),tt=Pb(),$l=oe(),ra=he(),ia=le(),$A=G(),jb=Ab(),zA=Db(),kb=gp(),KA=Fl(),Mb=xp(),Lb=wp(),Fb=vp(),Nb=Sp(),Ep=Hp(),JA=Cp(),Pp=class extends $A.BaseApi{static{n(this,"HelixModerationApi")}async getBannedUsers(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:{...(0,tt.createModerationUserListQuery)(e,t),...(0,ia.createPaginationQuery)(t)}});return(0,ra.createPaginatedResult)(r,kb.HelixBan,this._client)}getBannedUsersPaginated(e){return new $l.HelixPaginatedRequest({url:"moderation/banned",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:(0,qp.createBroadcasterQuery)(e)},this._client,t=>new kb.HelixBan(t,this._client),50)}async checkUserBan(e,t){let r=(0,F.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,F.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,tt.createModerationUserListQuery)(e,t),...(0,ia.createPaginationQuery)(t)}});return(0,ra.createPaginatedResult)(r,Fb.HelixModerator,this._client)}getModeratorsPaginated(e){return new $l.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,F.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,qp.createBroadcasterQuery)(e)},this._client,t=>new Fb.HelixModerator(t,this._client))}async getModeratedChannels(e,t){let r=(0,F.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/channels",userId:r,scopes:["user:read:moderated_channels"],query:{...(0,fr.createSingleKeyQuery)("user_id",r),...(0,ia.createPaginationQuery)(t)}});return(0,ra.createPaginatedResult)(a,Lb.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,F.extractUserId)(e);return new $l.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,fr.createSingleKeyQuery)("user_id",t)},this._client,r=>new Lb.HelixModeratedChannel(r,this._client))}async checkUserMod(e,t){let r=(0,F.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,F.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,tt.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,F.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,tt.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,F.extractUserId)(e),scopes:["moderation:read"],query:(0,qp.createBroadcasterQuery)(e),jsonBody:(0,tt.createCheckAutoModStatusBody)(t)})).data.map(a=>new zA.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,F.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,tt.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,F.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 jb.HelixAutoModSettings(a))}async updateAutoModSettings(e,t){let r=(0,F.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,tt.createAutoModSettingsBody)(t)})).data.map(s=>new jb.HelixAutoModSettings(s))}async banUser(e,t){let r=(0,F.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,tt.createBanUserBody)(t)})).data.map(s=>new KA.HelixBanUser(s,s.end_time,this._client))}async unbanUser(e,t){let r=(0,F.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,fr.createSingleKeyQuery)("user_id",(0,F.extractUserId)(t))}})}async getBlockedTerms(e,t){let r=(0,F.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,ia.createPaginationQuery)(t)}});return(0,ra.createPaginatedResult)(a,Mb.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let r=(0,F.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 Mb.HelixBlockedTerm(s))}async removeBlockedTerm(e,t,r){let a=(0,F.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,F.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,fr.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,F.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 Nb.HelixShieldModeStatus(r.data[0],this._client)}async updateShieldModeStatus(e,t){let r=(0,F.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,tt.createUpdateShieldModeStatusBody)(t)});return new Nb.HelixShieldModeStatus(a.data[0],this._client)}async getUnbanRequests(e,t,r){let a=(0,F.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,fr.createSingleKeyQuery)("status",t),...(0,ia.createPaginationQuery)(r)}});return(0,ra.createPaginatedResult)(s,Ep.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,F.extractUserId)(e);return new $l.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,fr.createSingleKeyQuery)("status",t)}},this._client,a=>new Ep.HelixUnbanRequest(a,this._client))}async resolveUnbanRequest(e,t,r,a){let s=(0,F.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,tt.createResolveUnbanRequestQuery)(s,this._getUserContextIdWithDefault(s),t,r,a?.slice(0,500))});return new Ep.HelixUnbanRequest(o.data[0],this._client)}async warnUser(e,t,r){let a=(0,F.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,tt.createWarnUserBody)(t,r.slice(0,500))});return new JA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,fr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};na.HelixModerationApi=Pp;na.HelixModerationApi=Pp=VA.__decorate([(0,F.rtfm)("api","HelixModerationApi")],Pp)});var Gb=u(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.createPollEndBody=Yr.createPollBody=void 0;var Qb=_();function ZA(i,e){var t;return{broadcaster_id:(0,Qb.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(ZA,"createPollBody");Yr.createPollBody=ZA;function XA(i,e,t){return{broadcaster_id:(0,Qb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(XA,"createPollEndBody");Yr.createPollEndBody=XA});var Ip=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixPollChoice=void 0;var YA=(b(),x(g)),ei=_(),Dp=class extends ei.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[ei.rawDataSymbol].id}get title(){return this[ei.rawDataSymbol].title}get totalVotes(){return this[ei.rawDataSymbol].votes}get channelPointsVotes(){return this[ei.rawDataSymbol].channel_points_votes}};aa.HelixPollChoice=Dp;aa.HelixPollChoice=Dp=YA.__decorate([(0,ei.rtfm)("api","HelixPollChoice","id")],Dp)});var Tp=u(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.HelixPoll=void 0;var Wb=(b(),x(g)),eD=C(),Se=_(),tD=Ip(),zl=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 tD.HelixPollChoice(e))}};sa.HelixPoll=zl;Wb.__decorate([(0,eD.Enumerable)(!1)],zl.prototype,"_client",void 0);sa.HelixPoll=zl=Wb.__decorate([(0,Se.rtfm)("api","HelixPoll","id")],zl)});var Up=u(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.HelixPollApi=void 0;var rD=(b(),x(g)),Vb=Y(),ti=_(),iD=Oe(),$b=Gb(),nD=oe(),aD=he(),sD=le(),oD=G(),oa=Tp(),Rp=class extends oD.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:{...(0,Vb.createBroadcasterQuery)(e),...(0,sD.createPaginationQuery)(t)}});return(0,aD.createPaginatedResult)(r,oa.HelixPoll,this._client)}getPollsPaginated(e){return new nD.HelixPaginatedRequest({url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,Vb.createBroadcasterQuery)(e)},this._client,t=>new oa.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,ti.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,iD.createGetByIdsQuery)(e,t)})).data.map(a=>new oa.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,ti.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,$b.createPollBody)(e,t)});return new oa.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,ti.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,$b.createPollEndBody)(e,t,r)});return new oa.HelixPoll(a.data[0],this._client)}};la.HelixPollApi=Rp;la.HelixPollApi=Rp=rD.__decorate([(0,ti.rtfm)("api","HelixPollApi")],Rp)});var Kb=u(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.createEndPredictionBody=ri.createPredictionBody=void 0;var zb=_();function lD(i,e){return{broadcaster_id:(0,zb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(lD,"createPredictionBody");ri.createPredictionBody=lD;function uD(i,e,t,r){return{broadcaster_id:(0,zb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(uD,"createEndPredictionBody");ri.createEndPredictionBody=uD});var Bp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixPredictor=void 0;var Jb=(b(),x(g)),cD=C(),Kt=_(),Kl=class extends Kt.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Kt.rawDataSymbol].user_id}get userName(){return this[Kt.rawDataSymbol].user_login}get userDisplayName(){return this[Kt.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Kt.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Kt.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Kt.rawDataSymbol].channel_points_won}};ua.HelixPredictor=Kl;Jb.__decorate([(0,cD.Enumerable)(!1)],Kl.prototype,"_client",void 0);ua.HelixPredictor=Kl=Jb.__decorate([(0,Kt.rtfm)("api","HelixPredictor","userId")],Kl)});var Op=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixPredictionOutcome=void 0;var Zb=(b(),x(g)),dD=C(),Jt=_(),hD=Bp(),Jl=class extends Jt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Jt.rawDataSymbol].id}get title(){return this[Jt.rawDataSymbol].title}get users(){return this[Jt.rawDataSymbol].users}get totalChannelPoints(){return this[Jt.rawDataSymbol].channel_points}get color(){return this[Jt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Jt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new hD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};ca.HelixPredictionOutcome=Jl;Zb.__decorate([(0,dD.Enumerable)(!1)],Jl.prototype,"_client",void 0);ca.HelixPredictionOutcome=Jl=Zb.__decorate([(0,Jt.rtfm)("api","HelixPredictionOutcome","id")],Jl)});var jp=u(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.HelixPrediction=void 0;var Yb=(b(),x(g)),pD=C(),re=_(),Xb=Op(),Zl=class extends re.DataObject{static{n(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[re.rawDataSymbol].id}get broadcasterId(){return this[re.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[re.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[re.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,re.checkRelationAssertion)(await this._client.users.getUserById(this[re.rawDataSymbol].broadcaster_id))}get title(){return this[re.rawDataSymbol].title}get status(){return this[re.rawDataSymbol].status}get autoLockAfter(){return this[re.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[re.rawDataSymbol].created_at)}get endDate(){return this[re.rawDataSymbol].ended_at?new Date(this[re.rawDataSymbol].ended_at):null}get lockDate(){return this[re.rawDataSymbol].locked_at?new Date(this[re.rawDataSymbol].locked_at):null}get outcomes(){return this[re.rawDataSymbol].outcomes.map(e=>new Xb.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[re.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[re.rawDataSymbol].winning_outcome_id)return null;let e=this[re.rawDataSymbol].outcomes.find(t=>t.id===this[re.rawDataSymbol].winning_outcome_id);if(!e)throw new re.HellFreezesOverError("Winning outcome not found in outcomes array");return new Xb.HelixPredictionOutcome(e,this._client)}};da.HelixPrediction=Zl;Yb.__decorate([(0,pD.Enumerable)(!1)],Zl.prototype,"_client",void 0);da.HelixPrediction=Zl=Yb.__decorate([(0,re.rtfm)("api","HelixPrediction","id")],Zl)});var Mp=u(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.HelixPredictionApi=void 0;var mD=(b(),x(g)),ex=Y(),ii=_(),_D=Oe(),tx=Kb(),yD=oe(),fD=he(),gD=le(),bD=G(),ha=jp(),kp=class extends bD.BaseApi{static{n(this,"HelixPredictionApi")}async getPredictions(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,ex.createBroadcasterQuery)(e),...(0,gD.createPaginationQuery)(t)}});return(0,fD.createPaginatedResult)(r,ha.HelixPrediction,this._client)}getPredictionsPaginated(e){return new yD.HelixPaginatedRequest({url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,ex.createBroadcasterQuery)(e)},this._client,t=>new ha.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,ii.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,_D.createGetByIdsQuery)(e,t)})).data.map(a=>new ha.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,ii.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,tx.createPredictionBody)(e,t)});return new ha.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,ii.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,tx.createEndPredictionBody)(e,t,r,a)});return new ha.HelixPrediction(s.data[0],this._client)}};pa.HelixPredictionApi=kp;pa.HelixPredictionApi=kp=mD.__decorate([(0,ii.rtfm)("api","HelixPredictionApi")],kp)});var ix=u(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});Xl.createRaidStartQuery=void 0;var rx=_();function xD(i,e){return{from_broadcaster_id:(0,rx.extractUserId)(i),to_broadcaster_id:(0,rx.extractUserId)(e)}}n(xD,"createRaidStartQuery");Xl.createRaidStartQuery=xD});var Fp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixRaid=void 0;var wD=(b(),x(g)),Yl=_(),Lp=class extends Yl.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[Yl.rawDataSymbol].created_at)}get targetIsMature(){return this[Yl.rawDataSymbol].is_mature}};ma.HelixRaid=Lp;ma.HelixRaid=Lp=wD.__decorate([(0,Yl.rtfm)("api","HelixRaid")],Lp)});var Gp=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixRaidApi=void 0;var vD=(b(),x(g)),SD=Y(),Np=_(),HD=ix(),CD=G(),qD=Fp(),Qp=class extends CD.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Np.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,HD.createRaidStartQuery)(e,t)});return new qD.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Np.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,SD.createBroadcasterQuery)(e)})}};_a.HelixRaidApi=Qp;_a.HelixRaidApi=Qp=vD.__decorate([(0,Np.rtfm)("api","HelixRaidApi")],Qp)});var Wp=u(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.createScheduleSegmentUpdateBody=Ke.createScheduleSegmentModifyQuery=Ke.createScheduleSegmentBody=Ke.createScheduleSettingsUpdateQuery=Ke.createScheduleQuery=void 0;var eu=_();function ED(i,e){var t;return{broadcaster_id:(0,eu.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(ED,"createScheduleQuery");Ke.createScheduleQuery=ED;function PD(i,e){return e.vacation?{broadcaster_id:(0,eu.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,eu.extractUserId)(i),is_vacation_enabled:"false"}}n(PD,"createScheduleSettingsUpdateQuery");Ke.createScheduleSettingsUpdateQuery=PD;function AD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(AD,"createScheduleSegmentBody");Ke.createScheduleSegmentBody=AD;function DD(i,e){return{broadcaster_id:(0,eu.extractUserId)(i),id:e}}n(DD,"createScheduleSegmentModifyQuery");Ke.createScheduleSegmentModifyQuery=DD;function ID(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(ID,"createScheduleSegmentUpdateBody");Ke.createScheduleSegmentUpdateBody=ID});var fa=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixScheduleSegment=void 0;var nx=(b(),x(g)),ax=C(),rt=_(),tu=class extends rt.DataObject{static{n(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[rt.rawDataSymbol].id}get startDate(){return new Date(this[rt.rawDataSymbol].start_time)}get endDate(){return new Date(this[rt.rawDataSymbol].end_time)}get title(){return this[rt.rawDataSymbol].title}get cancelEndDate(){return(0,ax.mapNullable)(this[rt.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[rt.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[rt.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[rt.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[rt.rawDataSymbol].is_recurring}};ya.HelixScheduleSegment=tu;nx.__decorate([(0,ax.Enumerable)(!1)],tu.prototype,"_client",void 0);ya.HelixScheduleSegment=tu=nx.__decorate([(0,rt.rtfm)("api","HelixScheduleSegment","id")],tu)});var $p=u(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.HelixPaginatedScheduleSegmentRequest=void 0;var TD=(b(),x(g)),RD=_(),UD=Wp(),BD=oe(),OD=fa(),Vp=class extends BD.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,UD.createScheduleQuery)(e,r)},t,a=>new OD.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}}};ga.HelixPaginatedScheduleSegmentRequest=Vp;ga.HelixPaginatedScheduleSegmentRequest=Vp=TD.__decorate([(0,RD.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Vp)});var zp=u(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.HelixSchedule=void 0;var sx=(b(),x(g)),jD=C(),_t=_(),kD=fa(),ru=class extends _t.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[_t.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new kD.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[_t.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[_t.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[_t.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,_t.checkRelationAssertion)(await this._client.users.getUserById(this[_t.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[_t.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[_t.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};ba.HelixSchedule=ru;sx.__decorate([(0,jD.Enumerable)(!1)],ru.prototype,"_client",void 0);ba.HelixSchedule=ru=sx.__decorate([(0,_t.rtfm)("api","HelixSchedule","broadcasterId")],ru)});var Zp=u(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.HelixScheduleApi=void 0;var ox=Y(),ni=_(),MD=Oe(),ai=Wp(),LD=le(),FD=G(),ND=$p(),QD=zp(),Kp=fa(),Jp=class extends FD.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,ni.extractUserId)(e),query:{...(0,ai.createScheduleQuery)(e,t),...(0,LD.createPaginationQuery)(t)}});return{data:new QD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new ND.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,ni.extractUserId)(e),query:(0,MD.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new Kp.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,ox.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ox.createBroadcasterQuery)(e),jsonBody:(0,ai.createScheduleSegmentBody)(t)});return new Kp.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,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,ai.createScheduleSegmentUpdateBody)(r)});return new Kp.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,ni.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ai.createScheduleSegmentModifyQuery)(e,t)})}};iu.HelixScheduleApi=Jp});var lx=u(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.createSearchChannelsQuery=void 0;function GD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(GD,"createSearchChannelsQuery");nu.createSearchChannelsQuery=GD});var Xp=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixChannelSearchResult=void 0;var ux=(b(),x(g)),WD=C(),fe=_(),au=class extends fe.DataObject{static{n(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[fe.rawDataSymbol].broadcaster_language}get id(){return this[fe.rawDataSymbol].id}get name(){return this[fe.rawDataSymbol].broadcaster_login}get displayName(){return this[fe.rawDataSymbol].display_name}async getUser(){return(0,fe.checkRelationAssertion)(await this._client.users.getUserById(this[fe.rawDataSymbol].id))}get gameId(){return this[fe.rawDataSymbol].game_id}get gameName(){return this[fe.rawDataSymbol].game_name}async getGame(){return this[fe.rawDataSymbol].game_id?(0,fe.checkRelationAssertion)(await this._client.games.getGameById(this[fe.rawDataSymbol].game_id)):null}get isLive(){return this[fe.rawDataSymbol].is_live}get tags(){return this[fe.rawDataSymbol].tags}get thumbnailUrl(){return this[fe.rawDataSymbol].thumbnail_url}get startDate(){return this[fe.rawDataSymbol].is_live?new Date(this[fe.rawDataSymbol].started_at):null}};xa.HelixChannelSearchResult=au;ux.__decorate([(0,WD.Enumerable)(!1)],au.prototype,"_client",void 0);xa.HelixChannelSearchResult=au=ux.__decorate([(0,fe.rtfm)("api","HelixChannelSearchResult","id")],au)});var em=u(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixSearchApi=void 0;var VD=(b(),x(g)),$D=_(),cx=lx(),dx=oe(),hx=he(),px=le(),zD=G(),mx=Ul(),_x=Xp(),Yp=class extends zD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,px.createPaginationQuery)(t)}});return(0,hx.createPaginatedResult)(r,mx.HelixGame,this._client)}searchCategoriesPaginated(e){return new dx.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new mx.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,cx.createSearchChannelsQuery)(e,t),...(0,px.createPaginationQuery)(t)}});return(0,hx.createPaginatedResult)(r,_x.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new dx.HelixPaginatedRequest({url:"search/channels",query:(0,cx.createSearchChannelsQuery)(e,t)},this._client,r=>new _x.HelixChannelSearchResult(r,this._client))}};wa.HelixSearchApi=Yp;wa.HelixSearchApi=Yp=VD.__decorate([(0,$D.rtfm)("api","HelixSearchApi")],Yp)});var rm=u(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.StreamNotLiveError=void 0;var KD=_(),tm=class extends KD.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};su.StreamNotLiveError=tm});var yx=u(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.createVideoQuery=Zt.createStreamMarkerBody=Zt.createStreamQuery=void 0;var JD=_();function ZD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(ZD,"createStreamQuery");Zt.createStreamQuery=ZD;function XD(i,e){return{user_id:(0,JD.extractUserId)(i),description:e}}n(XD,"createStreamMarkerBody");Zt.createStreamMarkerBody=XD;function YD(i){return{video_id:i}}n(YD,"createVideoQuery");Zt.createVideoQuery=YD});var im=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixStream=void 0;var fx=(b(),x(g)),eI=C(),ie=_(),ou=class extends ie.DataObject{static{n(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[ie.rawDataSymbol].id}get userId(){return this[ie.rawDataSymbol].user_id}get userName(){return this[ie.rawDataSymbol].user_login}get userDisplayName(){return this[ie.rawDataSymbol].user_name}async getUser(){return(0,ie.checkRelationAssertion)(await this._client.users.getUserById(this[ie.rawDataSymbol].user_id))}get gameId(){return this[ie.rawDataSymbol].game_id}get gameName(){return this[ie.rawDataSymbol].game_name}async getGame(){return this[ie.rawDataSymbol].game_id?(0,ie.checkRelationAssertion)(await this._client.games.getGameById(this[ie.rawDataSymbol].game_id)):null}get type(){return this[ie.rawDataSymbol].type}get title(){return this[ie.rawDataSymbol].title}get viewers(){return this[ie.rawDataSymbol].viewer_count}get startDate(){return new Date(this[ie.rawDataSymbol].started_at)}get language(){return this[ie.rawDataSymbol].language}get thumbnailUrl(){return this[ie.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[ie.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[ie.rawDataSymbol].tags}get isMature(){return this[ie.rawDataSymbol].is_mature}};va.HelixStream=ou;fx.__decorate([(0,eI.Enumerable)(!1)],ou.prototype,"_client",void 0);va.HelixStream=ou=fx.__decorate([(0,ie.rtfm)("api","HelixStream","id")],ou)});var uu=u(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixStreamMarker=void 0;var gx=(b(),x(g)),tI=C(),si=_(),lu=class extends si.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[si.rawDataSymbol].id}get creationDate(){return new Date(this[si.rawDataSymbol].created_at)}get description(){return this[si.rawDataSymbol].description}get positionInSeconds(){return this[si.rawDataSymbol].position_seconds}};Sa.HelixStreamMarker=lu;gx.__decorate([(0,tI.Enumerable)(!1)],lu.prototype,"_client",void 0);Sa.HelixStreamMarker=lu=gx.__decorate([(0,si.rtfm)("api","HelixStreamMarker","id")],lu)});var sm=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixStreamMarkerWithVideo=void 0;var rI=(b(),x(g)),nm=_(),iI=uu(),am=class extends iI.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[nm.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,nm.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};Ha.HelixStreamMarkerWithVideo=am;Ha.HelixStreamMarkerWithVideo=am=rI.__decorate([(0,nm.rtfm)("api","HelixStreamMarkerWithVideo","id")],am)});var lm=u(Ea=>{"use strict";var li;Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixStreamApi=void 0;var om=(b(),x(g)),Ca=C(),bx=Y(),Re=_(),nI=rm(),cu=Oe(),oi=yx(),xx=Lt(),du=oe(),wx=he(),hu=le(),aI=G(),gr=im(),sI=uu(),oI=sm(),qa=li=class extends aI.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new xx.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new gr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new xx.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new gr.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,oi.createStreamQuery)(e),...(0,hu.createPaginationQuery)(e)}});return(0,wx.createPaginatedResult)(t,gr.HelixStream,this._client)}getStreamsPaginated(e={}){return new du.HelixPaginatedRequest({url:"streams",query:(0,oi.createStreamQuery)(e)},this._client,t=>new gr.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Re.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,Re.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Re.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Re.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,oi.createStreamQuery)({userId:t})});return(0,Ca.mapNullable)(r.data[0],a=>new gr.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Re.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,cu.createUserQuery)(e),...(0,hu.createPaginationQuery)(t)},userId:(0,Re.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,Ca.flatten)(a.data.map(s=>li._mapGetStreamMarkersResult(s,this._client))),cursor:(r=a.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new du.HelixPaginatedRequest({url:"streams/markers",query:(0,cu.createUserQuery)(e),userId:(0,Re.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>li._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var a;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,oi.createVideoQuery)(t),...(0,hu.createPaginationQuery)(r)},userId:(0,Re.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,Ca.flatten)(s.data.map(o=>li._mapGetStreamMarkersResult(o,this._client))),cursor:(a=s.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new du.HelixPaginatedRequest({url:"streams/markers",query:(0,oi.createVideoQuery)(t),userId:(0,Re.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>li._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Re.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,oi.createStreamMarkerBody)(e,t)});return new sI.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof bx.HttpStatusCodeError&&r.statusCode===404?new nI.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,Re.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,bx.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,Re.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,cu.createSingleKeyQuery)("user_id",r),...(0,hu.createPaginationQuery)(t)}});return(0,wx.createPaginatedResult)(a,gr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Re.extractUserId)(e);return new du.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,cu.createSingleKeyQuery)("user_id",t)},this._client,r=>new gr.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,a)=>[...r,...a.markers.map(s=>new oI.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};Ea.HelixStreamApi=qa;om.__decorate([(0,Ca.Enumerable)(!1)],qa.prototype,"_getStreamByUserIdBatcher",void 0);om.__decorate([(0,Ca.Enumerable)(!1)],qa.prototype,"_getStreamByUserNameBatcher",void 0);Ea.HelixStreamApi=qa=li=om.__decorate([(0,Re.rtfm)("api","HelixStreamApi")],qa)});var Sx=u(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.createSubscriptionCheckQuery=void 0;var vx=_();function lI(i,e){return{broadcaster_id:(0,vx.extractUserId)(i),user_id:(0,vx.extractUserId)(e)}}n(lI,"createSubscriptionCheckQuery");pu.createSubscriptionCheckQuery=lI});var _u=u(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixUserSubscription=void 0;var Hx=(b(),x(g)),uI=C(),Xt=_(),mu=class extends Xt.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Xt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Xt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Xt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[Xt.rawDataSymbol].broadcaster_id)}get isGift(){return this[Xt.rawDataSymbol].is_gift}get tier(){return this[Xt.rawDataSymbol].tier}};Pa.HelixUserSubscription=mu;Hx.__decorate([(0,uI.Enumerable)(!1)],mu.prototype,"_client",void 0);Pa.HelixUserSubscription=mu=Hx.__decorate([(0,Xt.rtfm)("api","HelixUserSubscription","broadcasterId")],mu)});var yu=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixSubscription=void 0;var cI=(b(),x(g)),de=_(),dI=_u(),um=class extends dI.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[de.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[de.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[de.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].broadcaster_id))}get gifterId(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_id:null}get gifterName(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[de.rawDataSymbol].is_gift?this[de.rawDataSymbol].gifter_name:null}async getGifter(){return this[de.rawDataSymbol].is_gift?(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].gifter_id)):null}get userId(){return this[de.rawDataSymbol].user_id}get userName(){return this[de.rawDataSymbol].user_login}get userDisplayName(){return this[de.rawDataSymbol].user_name}async getUser(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].user_id))}};Aa.HelixSubscription=um;Aa.HelixSubscription=um=cI.__decorate([(0,de.rtfm)("api","HelixSubscription","userId")],um)});var dm=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixPaginatedSubscriptionsRequest=void 0;var hI=(b(),x(g)),pI=Y(),Cx=_(),mI=Gr(),_I=yu(),cm=class extends mI.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,Cx.extractUserId)(e),query:(0,pI.createBroadcasterQuery)(e)},t,r=>new _I.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Da.HelixPaginatedSubscriptionsRequest=cm;Da.HelixPaginatedSubscriptionsRequest=cm=hI.__decorate([(0,Cx.rtfm)("api","HelixPaginatedSubscriptionsRequest")],cm)});var pm=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixSubscriptionApi=void 0;var yI=(b(),x(g)),qx=Y(),fu=_(),fI=Oe(),gI=Sx(),bI=he(),xI=le(),wI=G(),vI=dm(),Ex=yu(),SI=_u(),hm=class extends wI.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,fu.extractUserId)(e),query:{...(0,qx.createBroadcasterQuery)(e),...(0,xI.createPaginationQuery)(t)}});return{...(0,bI.createPaginatedResultWithTotal)(r,Ex.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new vI.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,fu.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,fI.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Ex.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,fu.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,gI.createSubscriptionCheckQuery)(t,e)});return new SI.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof qx.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ia.HelixSubscriptionApi=hm;Ia.HelixSubscriptionApi=hm=yI.__decorate([(0,fu.rtfm)("api","HelixSubscriptionApi")],hm)});var bu=u(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.HelixTeam=void 0;var Px=(b(),x(g)),HI=C(),it=_(),gu=class extends it.DataObject{static{n(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[it.rawDataSymbol].id}get name(){return this[it.rawDataSymbol].team_name}get displayName(){return this[it.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[it.rawDataSymbol].background_image_url}get bannerUrl(){return this[it.rawDataSymbol].banner}get creationDate(){return new Date(this[it.rawDataSymbol].created_at)}get updateDate(){return new Date(this[it.rawDataSymbol].updated_at)}get info(){return this[it.rawDataSymbol].info}get logoThumbnailUrl(){return this[it.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};Ta.HelixTeam=gu;Px.__decorate([(0,HI.Enumerable)(!1)],gu.prototype,"_client",void 0);Ta.HelixTeam=gu=Px.__decorate([(0,it.rtfm)("api","HelixTeam","id")],gu)});var _m=u(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.HelixTeamWithUsers=void 0;var CI=(b(),x(g)),Ax=_(),qI=Qo(),EI=bu(),mm=class extends EI.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Ax.rawDataSymbol].users.map(e=>new qI.HelixUserRelation(e,this._client))}};Ra.HelixTeamWithUsers=mm;Ra.HelixTeamWithUsers=mm=CI.__decorate([(0,Ax.rtfm)("api","HelixTeamWithUsers","id")],mm)});var gm=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixTeamApi=void 0;var PI=(b(),x(g)),ym=Y(),Ix=_(),AI=G(),DI=bu(),Dx=_m(),fm=class extends AI.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,Ix.extractUserId)(e),query:(0,ym.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new DI.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 Dx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof ym.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 Dx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof ym.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Ua.HelixTeamApi=fm;Ua.HelixTeamApi=fm=PI.__decorate([(0,Ix.rtfm)("api","HelixTeamApi")],fm)});var Rx=u(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createUserBlockDeleteQuery=ui.createUserBlockCreateQuery=void 0;var Tx=_();function II(i,e){return{target_user_id:(0,Tx.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(II,"createUserBlockCreateQuery");ui.createUserBlockCreateQuery=II;function TI(i){return{target_user_id:(0,Tx.extractUserId)(i)}}n(TI,"createUserBlockDeleteQuery");ui.createUserBlockDeleteQuery=TI});var vu=u(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.HelixBaseExtension=void 0;var xu=_(),bm=class extends xu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[xu.rawDataSymbol].id}get version(){return this[xu.rawDataSymbol].version}get name(){return this[xu.rawDataSymbol].name}};wu.HelixBaseExtension=bm});var wm=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixInstalledExtension=void 0;var RI=(b(),x(g)),UI=_(),BI=vu(),xm=class extends BI.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}};Ba.HelixInstalledExtension=xm;Ba.HelixInstalledExtension=xm=RI.__decorate([(0,UI.rtfm)("api","HelixInstalledExtension","id")],xm)});var Hm=u(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.HelixInstalledExtensionList=void 0;var OI=(b(),x(g)),Oa=_(),vm=wm(),Sm=class extends Oa.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[Oa.rawDataSymbol][e][t];return r.active?new vm.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[Oa.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new vm.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[Oa.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new vm.HelixInstalledExtension(e,r,a)))}};ja.HelixInstalledExtensionList=Sm;ja.HelixInstalledExtensionList=Sm=OI.__decorate([(0,Oa.rtfm)("api","HelixInstalledExtensionList")],Sm)});var Em=u(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.HelixUserExtension=void 0;var jI=(b(),x(g)),Cm=_(),kI=vu(),qm=class extends kI.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[Cm.rawDataSymbol].can_activate}get types(){return this[Cm.rawDataSymbol].type}};ka.HelixUserExtension=qm;ka.HelixUserExtension=qm=jI.__decorate([(0,Cm.rtfm)("api","HelixUserExtension","id")],qm)});var Hu=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixUser=void 0;var Ux=(b(),x(g)),MI=C(),nt=_(),Su=class extends nt.DataObject{static{n(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[nt.rawDataSymbol].id}get name(){return this[nt.rawDataSymbol].login}get displayName(){return this[nt.rawDataSymbol].display_name}get description(){return this[nt.rawDataSymbol].description}get type(){return this[nt.rawDataSymbol].type}get broadcasterType(){return this[nt.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[nt.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[nt.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[nt.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}};Ma.HelixUser=Su;Ux.__decorate([(0,MI.Enumerable)(!1)],Su.prototype,"_client",void 0);Ma.HelixUser=Su=Ux.__decorate([(0,nt.rtfm)("api","HelixUser","id")],Su)});var Am=u(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.HelixPrivilegedUser=void 0;var LI=(b(),x(g)),Bx=_(),FI=Hu(),Pm=class extends FI.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[Bx.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};La.HelixPrivilegedUser=Pm;La.HelixPrivilegedUser=Pm=LI.__decorate([(0,Bx.rtfm)("api","HelixPrivilegedUser","id")],Pm)});var Dm=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixUserBlock=void 0;var Ox=(b(),x(g)),NI=C(),br=_(),Cu=class extends br.DataObject{static{n(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[br.rawDataSymbol].user_id}get userName(){return this[br.rawDataSymbol].user_login}get userDisplayName(){return this[br.rawDataSymbol].display_name}async getUser(){return(0,br.checkRelationAssertion)(await this._client.users.getUserById(this[br.rawDataSymbol].user_id))}};Fa.HelixUserBlock=Cu;Ox.__decorate([(0,NI.Enumerable)(!1)],Cu.prototype,"_client",void 0);Fa.HelixUserBlock=Cu=Ox.__decorate([(0,br.rtfm)("api","HelixUserBlock","userId")],Cu)});var Rm=u(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.HelixUserApi=void 0;var Im=(b(),x(g)),Tm=C(),jx=Y(),xe=_(),QI=Oe(),kx=Rx(),Mx=Lt(),GI=oe(),WI=he(),VI=le(),$I=G(),Lx=Hm(),zI=Em(),Fx=Am(),qu=Hu(),Nx=Dm(),Na=class extends $I.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new Mx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new qu.HelixUser(e,this._client)),this._getUserByNameBatcher=new Mx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new qu.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(xe.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(xe.extractUserName))}async getUserById(e){let t=(0,xe.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,Tm.mapNullable)(r.data[0],a=>new qu.HelixUser(a,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,xe.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,xe.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,xe.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var r;let a=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,xe.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((r=a.data)===null||r===void 0)&&r.length))throw new xe.HellFreezesOverError("Could not get authenticated user");return new Fx.HelixPrivilegedUser(a.data[0],this._client)}async updateAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,xe.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new Fx.HelixPrivilegedUser(r.data[0],this._client)}async getBlocks(e,t){let r=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,xe.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,jx.createBroadcasterQuery)(e),...(0,VI.createPaginationQuery)(t)}});return(0,WI.createPaginatedResult)(r,Nx.HelixUserBlock,this._client)}getBlocksPaginated(e){return new GI.HelixPaginatedRequest({url:"users/blocks",userId:(0,xe.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,jx.createBroadcasterQuery)(e)},this._client,t=>new Nx.HelixUserBlock(t,this._client))}async createBlock(e,t,r={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,xe.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,kx.createUserBlockCreateQuery)(t,r)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,xe.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,kx.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,xe.extractUserId)(e),scopes:t?["channel:manage:extensions"]:["user:read:broadcast","channel:manage:extensions"]})).data.map(a=>new zI.HelixUserExtension(a))}async getActiveExtensions(e,t=!1){let r=(0,xe.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,QI.createSingleKeyQuery)("user_id",r)});return new Lx.HelixInstalledExtensionList(a.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,xe.extractUserId)(e),scopes:["channel:manage:extensions"],jsonBody:{data:t}});return new Lx.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 qu.HelixUser(s,this._client))}};Qa.HelixUserApi=Na;Im.__decorate([(0,Tm.Enumerable)(!1)],Na.prototype,"_getUserByIdBatcher",void 0);Im.__decorate([(0,Tm.Enumerable)(!1)],Na.prototype,"_getUserByNameBatcher",void 0);Qa.HelixUserApi=Na=Im.__decorate([(0,xe.rtfm)("api","HelixUserApi")],Na)});var Bm=u(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.HelixVideo=void 0;var Um=(b(),x(g)),Qx=Hi(),KI=C(),j=_(),Ga=class extends j.DataObject{static{n(this,"HelixVideo")}constructor(e,t){super(e),this._client=t}get id(){return this[j.rawDataSymbol].id}get userId(){return this[j.rawDataSymbol].user_id}get userName(){return this[j.rawDataSymbol].user_login}get userDisplayName(){return this[j.rawDataSymbol].user_name}async getUser(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].user_id))}get title(){return this[j.rawDataSymbol].title}get description(){return this[j.rawDataSymbol].description}get creationDate(){return new Date(this[j.rawDataSymbol].created_at)}get publishDate(){return new Date(this[j.rawDataSymbol].published_at)}get url(){return this[j.rawDataSymbol].url}get thumbnailUrl(){return this[j.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[j.rawDataSymbol].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",t.toString())}get isPublic(){return this[j.rawDataSymbol].viewable==="public"}get views(){return this[j.rawDataSymbol].view_count}get language(){return this[j.rawDataSymbol].language}get type(){return this[j.rawDataSymbol].type}get duration(){return this[j.rawDataSymbol].duration}get durationInSeconds(){let e=this[j.rawDataSymbol].duration.match(/\d+[hms]/g);if(!e)throw new j.HellFreezesOverError(`Could not parse duration string: ${this[j.rawDataSymbol].duration}`);return e.map(t=>{let r=/(\d+)([hms])/.exec(t);if(!r)throw new j.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[j.rawDataSymbol].stream_id}get mutedSegmentData(){var e,t;return(t=(e=this[j.rawDataSymbol].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&t!==void 0?t:[]}isMutedAt(e,t,r=!1){if(this[j.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[j.rawDataSymbol].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);let a=e+t;return r?this[j.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return e<o&&s.offset<a}):this[j.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return s.offset<=e&&a<=o})}};Wa.HelixVideo=Ga;Um.__decorate([(0,KI.Enumerable)(!1)],Ga.prototype,"_client",void 0);Um.__decorate([(0,Qx.CachedGetter)()],Ga.prototype,"durationInSeconds",null);Wa.HelixVideo=Ga=Um.__decorate([Qx.Cacheable,(0,j.rtfm)("api","HelixVideo","id")],Ga)});var jm=u(Va=>{"use strict";var Eu;Object.defineProperty(Va,"__esModule",{value:!0});Va.HelixVideoApi=void 0;var Gx=(b(),x(g)),JI=C(),Pu=_(),ZI=Lt(),XI=oe(),YI=he(),e1=le(),t1=G(),Om=Bm(),Au=Eu=class extends t1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new ZI.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new Om.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,Pu.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Pu.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,Pu.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:{...Eu._makeVideosQuery(e,t,r),...(0,e1.createPaginationQuery)(r)}});return(0,YI.createPaginatedResult)(a,Om.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new XI.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Eu._makeVideosQuery(e,t,r)},this._client,a=>new Om.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}}};Va.HelixVideoApi=Au;Gx.__decorate([(0,JI.Enumerable)(!1)],Au.prototype,"_getVideoByIdBatcher",void 0);Va.HelixVideoApi=Au=Eu=Gx.__decorate([(0,Pu.rtfm)("api","HelixVideoApi")],Au)});var Vx=u(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.createWhisperQuery=void 0;var Wx=_();function r1(i,e){return{from_user_id:(0,Wx.extractUserId)(i),to_user_id:(0,Wx.extractUserId)(e)}}n(r1,"createWhisperQuery");Du.createWhisperQuery=r1});var Mm=u($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.HelixWhisperApi=void 0;var i1=(b(),x(g)),$x=_(),n1=Vx(),a1=G(),km=class extends a1.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,$x.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,n1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};$a.HelixWhisperApi=km;$a.HelixWhisperApi=km=i1.__decorate([(0,$x.rtfm)("api","HelixWhisperApi")],km)});var Fm=u(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ApiReportedRequest=void 0;var Lm=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}};Iu.ApiReportedRequest=Lm});var Ru=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.BaseApiClient=void 0;var W=(b(),x(g)),V=Hi(),s1=ro(),o1=C(),l1=ud(),ci=Y(),Tu=Ed(),zx=_(),u1=lg(),c1=Bd(),d1=Kd(),h1=Yd(),p1=ah(),m1=Eh(),_1=Ih(),y1=Bh(),f1=Lh(),g1=Kh(),b1=rp(),x1=ap(),w1=lp(),v1=hp(),S1=Ap(),H1=Up(),C1=Mp(),q1=Gp(),E1=Zp(),P1=em(),A1=lm(),D1=pm(),I1=gm(),T1=Rm(),R1=jm(),U1=Mm(),B1=Fm(),N=class extends l1.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 Tu.TokenInfo(e)}catch(e){throw e instanceof ci.HttpStatusCodeError&&e.statusCode===401?new Tu.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,ci.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 c=await r.getAppAccessToken();return await this._callApiUsingInitialToken(e,c)}case"user":{s=!0;break}default:throw new zx.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){let c=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!c)throw new Error("Tried to make an API call with a user context but no context user ID");let h=await r.getAccessTokenForUser(c,e.scopes);if(!h)throw new Error(`Tried to make an API call with a user context for user ID ${c} but no token was found`);if((0,Tu.accessTokenIsExpired)(h)&&r.refreshAccessTokenForUser){let p=await r.refreshAccessTokenForUser(c);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,Tu.accessTokenIsExpired)(l)&&l.userId&&r.refreshAccessTokenForUser){let c=await r.refreshAccessTokenForUser(l.userId);return await this._callApiUsingInitialToken(e,c,!0)}return await this._callApiUsingInitialToken(e,l)}get bits(){return new c1.HelixBitsApi(this)}get channels(){return new d1.HelixChannelApi(this)}get channelPoints(){return new h1.HelixChannelPointsApi(this)}get charity(){return new p1.HelixCharityApi(this)}get chat(){return new m1.HelixChatApi(this)}get clips(){return new _1.HelixClipApi(this)}get contentClassificationLabels(){return new y1.HelixContentClassificationLabelApi(this)}get entitlements(){return new f1.HelixEntitlementApi(this)}get eventSub(){return new g1.HelixEventSubApi(this)}get extensions(){return new b1.HelixExtensionsApi(this)}get games(){return new x1.HelixGameApi(this)}get hypeTrain(){return new v1.HelixHypeTrainApi(this)}get goals(){return new w1.HelixGoalApi(this)}get moderation(){return new S1.HelixModerationApi(this)}get polls(){return new H1.HelixPollApi(this)}get predictions(){return new C1.HelixPredictionApi(this)}get raids(){return new q1.HelixRaidApi(this)}get schedule(){return new E1.HelixScheduleApi(this)}get search(){return new P1.HelixSearchApi(this)}get streams(){return new A1.HelixStreamApi(this)}get subscriptions(){return new D1.HelixSubscriptionApi(this)}get teams(){return new I1.HelixTeamApi(this)}get users(){return new T1.HelixUserApi(this)}get videos(){return new R1.HelixVideoApi(this)}get whispers(){return new U1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof s1.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 c=await s.refreshAccessTokenForUser(t.userId);l=await this._callApiInternal(e,s.clientId,c.accessToken,o)}}else if(s.getAppAccessToken){let c=await s.getAppAccessToken(!0);l=await this._callApiInternal(e,s.clientId,c.accessToken,o)}}return this.emit(this.onRequest,new B1.ApiReportedRequest(e,l.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,ci.handleTwitchApiResponseError)(l,e),await(0,ci.transformTwitchApiResponse)(l)}async _callApiInternal(e,t,r,a){var s,o,l;let{fetchOptions:c,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 w=u1.operation({retries:3,minTimeout:500,factor:2}),{promise:E,resolve:P,reject:y}=(0,o1.promiseWithResolvers)();w.attempt(async()=>{try{let v=p==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:c,mockServerPort:h}):await(0,ci.callTwitchApiRaw)(e,t,r,a,c,h);!v.ok&&v.status>=500&&v.status<600&&await(0,ci.handleTwitchApiResponseError)(v,e),P(v)}catch(v){if(w.retry(v))return;y(w.mainError())}});let q=await E;return this._logger.debug(`Called ${p} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${q.status}`),q}};za.BaseApiClient=N;W.__decorate([(0,V.CachedGetter)()],N.prototype,"bits",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"channels",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"channelPoints",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"charity",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"chat",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"clips",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"contentClassificationLabels",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"entitlements",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"eventSub",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"extensions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"games",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"hypeTrain",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"goals",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"moderation",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"polls",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"predictions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"raids",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"schedule",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"search",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"streams",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"subscriptions",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"teams",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"users",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"videos",null);W.__decorate([(0,V.CachedGetter)()],N.prototype,"whispers",null);za.BaseApiClient=N=W.__decorate([V.Cacheable,(0,zx.rtfm)("api","ApiClient")],N)});var Kx=u(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.NoContextApiClient=void 0;var O1=(b(),x(g)),j1=_(),k1=Ru(),Nm=class extends k1.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Ka.NoContextApiClient=Nm;Ka.NoContextApiClient=Nm=O1.__decorate([(0,j1.rtfm)("api","ApiClient")],Nm)});var Jx=u(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.UserContextApiClient=void 0;var M1=(b(),x(g)),L1=_(),F1=Ru(),Qm=class extends F1.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Ja.UserContextApiClient=Qm;Ja.UserContextApiClient=Qm=M1.__decorate([(0,L1.rtfm)("api","ApiClient")],Qm)});var ew=u(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.ApiClient=void 0;var N1=(b(),x(g)),Q1=yi(),G1=gi(),Zx=ro(),W1=Y(),Yx=_(),V1=nd(),$1=Mf(),z1=Ru(),K1=Kx(),Xx=Jx(),Gm=class extends z1.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new V1.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,G1.createLogger)({name:"twurple:api:client",...e.logger}),Q1.isNode?new Zx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new $1.HelixRateLimiter({logger:t}),"createChild")}):new Zx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:c})=>await(0,W1.callTwitchApiRaw)(r,a,s,o,l,c),"doRequest"),getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey")}))}async asUser(e,t){let r=new Xx.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,Yx.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 Xx.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 K1.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};Za.ApiClient=Gm;Za.ApiClient=Gm=N1.__decorate([(0,Yx.rtfm)("api","ApiClient")],Gm)});var rw=u(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.HelixFollow=void 0;var tw=(b(),x(g)),J1=C(),Me=_(),Uu=class extends Me.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[Me.rawDataSymbol].from_id}get userName(){return this[Me.rawDataSymbol].from_login}get userDisplayName(){return this[Me.rawDataSymbol].from_name}async getUser(){return(0,Me.checkRelationAssertion)(await this._client.users.getUserById(this[Me.rawDataSymbol].from_id))}get followedUserId(){return this[Me.rawDataSymbol].to_id}get followedUserName(){return this[Me.rawDataSymbol].to_login}get followedUserDisplayName(){return this[Me.rawDataSymbol].to_name}async getFollowedUser(){return(0,Me.checkRelationAssertion)(await this._client.users.getUserById(this[Me.rawDataSymbol].to_id))}get followDate(){return new Date(this[Me.rawDataSymbol].followed_at)}};Xa.HelixFollow=Uu;tw.__decorate([(0,J1.Enumerable)(!1)],Uu.prototype,"_client",void 0);Xa.HelixFollow=Uu=tw.__decorate([(0,Me.rtfm)("api","HelixFollow")],Uu)});var iw=u(d=>{"use strict";Object.defineProperty(d,"__esModule",{value:!0});d.HelixGoal=d.HelixGoalApi=d.HelixGame=d.HelixGameApi=d.HelixExtensionTransaction=d.HelixExtensionBitsProduct=d.HelixExtensionsApi=d.HelixPaginatedEventSubSubscriptionsRequest=d.HelixEventSubSubscription=d.HelixEventSubConduitShard=d.HelixEventSubConduit=d.HelixEventSubApi=d.HelixDropsEntitlement=d.HelixEntitlementApi=d.HelixContentClassificationLabel=d.HelixContentClassificationLabelApi=d.HelixClip=d.HelixClipApi=d.HelixSharedChatSession=d.HelixSharedChatSessionParticipant=d.HelixSentChatMessage=d.HelixPrivilegedChatSettings=d.HelixUserEmote=d.HelixEmoteFromSet=d.HelixChannelEmote=d.HelixEmote=d.HelixChatChatter=d.HelixChatSettings=d.HelixChatBadgeVersion=d.HelixChatBadgeSet=d.HelixChatApi=d.HelixCharityCampaignAmount=d.HelixCharityCampaignDonation=d.HelixCharityCampaign=d.HelixCharityApi=d.HelixCustomRewardRedemption=d.HelixCustomReward=d.HelixChannelPointsApi=d.HelixChannelReference=d.HelixFollowedChannel=d.HelixChannelFollower=d.HelixChannelEditor=d.HelixChannel=d.HelixAdSchedule=d.HelixChannelApi=d.HelixCheermoteList=d.HelixBitsLeaderboardEntry=d.HelixBitsLeaderboard=d.HelixBitsApi=d.ApiClient=void 0;d.HelixVideo=d.HelixVideoApi=d.HelixUserExtension=d.HelixInstalledExtensionList=d.HelixInstalledExtension=d.HelixBaseExtension=d.HelixUser=d.HelixPrivilegedUser=d.HelixFollow=d.HelixUserBlock=d.HelixUserApi=d.HelixTeamWithUsers=d.HelixTeam=d.HelixTeamApi=d.HelixUserSubscription=d.HelixSubscription=d.HelixSubscriptionApi=d.HelixPaginatedSubscriptionsRequest=d.HelixStreamMarkerWithVideo=d.HelixStreamMarker=d.HelixStream=d.HelixStreamApi=d.HelixChannelSearchResult=d.HelixSearchApi=d.HelixPaginatedScheduleSegmentRequest=d.HelixScheduleSegment=d.HelixSchedule=d.HelixScheduleApi=d.HelixUserRelation=d.HelixRaid=d.HelixRaidApi=d.HelixPredictor=d.HelixPredictionOutcome=d.HelixPrediction=d.HelixPredictionApi=d.HelixPollChoice=d.HelixPoll=d.HelixPollApi=d.HelixWarning=d.HelixUnbanRequest=d.HelixShieldModeStatus=d.HelixBlockedTerm=d.HelixBanUser=d.HelixModeratedChannel=d.HelixModerator=d.HelixBan=d.HelixModerationApi=d.HelixHypeTrainEvent=d.HelixHypeTrainContribution=d.HelixHypeTrainApi=void 0;d.HellFreezesOverError=d.HelixExtension=d.extractUserName=d.extractUserId=d.HelixPaginatedRequestWithTotal=d.HelixPaginatedRequest=d.ApiReportedRequest=d.StreamNotLiveError=d.ConfigError=d.HelixWhisperApi=void 0;var Z1=ew();Object.defineProperty(d,"ApiClient",{enumerable:!0,get:n(function(){return Z1.ApiClient},"get")});var X1=Bd();Object.defineProperty(d,"HelixBitsApi",{enumerable:!0,get:n(function(){return X1.HelixBitsApi},"get")});var Y1=Dd();Object.defineProperty(d,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return Y1.HelixBitsLeaderboard},"get")});var eT=Pd();Object.defineProperty(d,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return eT.HelixBitsLeaderboardEntry},"get")});var tT=Td();Object.defineProperty(d,"HelixCheermoteList",{enumerable:!0,get:n(function(){return tT.HelixCheermoteList},"get")});var rT=Kd();Object.defineProperty(d,"HelixChannelApi",{enumerable:!0,get:n(function(){return rT.HelixChannelApi},"get")});var iT=Gd();Object.defineProperty(d,"HelixAdSchedule",{enumerable:!0,get:n(function(){return iT.HelixAdSchedule},"get")});var nT=Md();Object.defineProperty(d,"HelixChannel",{enumerable:!0,get:n(function(){return nT.HelixChannel},"get")});var aT=Ld();Object.defineProperty(d,"HelixChannelEditor",{enumerable:!0,get:n(function(){return aT.HelixChannelEditor},"get")});var sT=Fd();Object.defineProperty(d,"HelixChannelFollower",{enumerable:!0,get:n(function(){return sT.HelixChannelFollower},"get")});var oT=Nd();Object.defineProperty(d,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return oT.HelixFollowedChannel},"get")});var lT=Jh();Object.defineProperty(d,"HelixChannelReference",{enumerable:!0,get:n(function(){return lT.HelixChannelReference},"get")});var uT=Yd();Object.defineProperty(d,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return uT.HelixChannelPointsApi},"get")});var cT=Jd();Object.defineProperty(d,"HelixCustomReward",{enumerable:!0,get:n(function(){return cT.HelixCustomReward},"get")});var dT=Zd();Object.defineProperty(d,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return dT.HelixCustomRewardRedemption},"get")});var hT=ah();Object.defineProperty(d,"HelixCharityApi",{enumerable:!0,get:n(function(){return hT.HelixCharityApi},"get")});var pT=th();Object.defineProperty(d,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return pT.HelixCharityCampaign},"get")});var mT=rh();Object.defineProperty(d,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return mT.HelixCharityCampaignDonation},"get")});var _T=al();Object.defineProperty(d,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return _T.HelixCharityCampaignAmount},"get")});var yT=Eh();Object.defineProperty(d,"HelixChatApi",{enumerable:!0,get:n(function(){return yT.HelixChatApi},"get")});var fT=ph();Object.defineProperty(d,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return fT.HelixChatBadgeSet},"get")});var gT=hh();Object.defineProperty(d,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return gT.HelixChatBadgeVersion},"get")});var bT=pl();Object.defineProperty(d,"HelixChatSettings",{enumerable:!0,get:n(function(){return bT.HelixChatSettings},"get")});var xT=mh();Object.defineProperty(d,"HelixChatChatter",{enumerable:!0,get:n(function(){return xT.HelixChatChatter},"get")});var wT=sn();Object.defineProperty(d,"HelixEmote",{enumerable:!0,get:n(function(){return wT.HelixEmote},"get")});var vT=ch();Object.defineProperty(d,"HelixChannelEmote",{enumerable:!0,get:n(function(){return vT.HelixChannelEmote},"get")});var ST=yh();Object.defineProperty(d,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return ST.HelixEmoteFromSet},"get")});var HT=fh();Object.defineProperty(d,"HelixUserEmote",{enumerable:!0,get:n(function(){return HT.HelixUserEmote},"get")});var CT=xh();Object.defineProperty(d,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return CT.HelixPrivilegedChatSettings},"get")});var qT=vh();Object.defineProperty(d,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return qT.HelixSentChatMessage},"get")});var ET=Sh();Object.defineProperty(d,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return ET.HelixSharedChatSessionParticipant},"get")});var PT=Hh();Object.defineProperty(d,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return PT.HelixSharedChatSession},"get")});var AT=Ih();Object.defineProperty(d,"HelixClipApi",{enumerable:!0,get:n(function(){return AT.HelixClipApi},"get")});var DT=Ph();Object.defineProperty(d,"HelixClip",{enumerable:!0,get:n(function(){return DT.HelixClip},"get")});var IT=Bh();Object.defineProperty(d,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return IT.HelixContentClassificationLabelApi},"get")});var TT=Rh();Object.defineProperty(d,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return TT.HelixContentClassificationLabel},"get")});var RT=Lh();Object.defineProperty(d,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return RT.HelixEntitlementApi},"get")});var UT=Oh();Object.defineProperty(d,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return UT.HelixDropsEntitlement},"get")});var BT=Kh();Object.defineProperty(d,"HelixEventSubApi",{enumerable:!0,get:n(function(){return BT.HelixEventSubApi},"get")});var OT=Qh();Object.defineProperty(d,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return OT.HelixEventSubConduit},"get")});var jT=Wh();Object.defineProperty(d,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return jT.HelixEventSubConduitShard},"get")});var kT=El();Object.defineProperty(d,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return kT.HelixEventSubSubscription},"get")});var MT=Nh();Object.defineProperty(d,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return MT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var LT=rp();Object.defineProperty(d,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return LT.HelixExtensionsApi},"get")});var FT=Xh();Object.defineProperty(d,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return FT.HelixExtensionBitsProduct},"get")});var NT=Yh();Object.defineProperty(d,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return NT.HelixExtensionTransaction},"get")});var QT=ap();Object.defineProperty(d,"HelixGameApi",{enumerable:!0,get:n(function(){return QT.HelixGameApi},"get")});var GT=Ul();Object.defineProperty(d,"HelixGame",{enumerable:!0,get:n(function(){return GT.HelixGame},"get")});var WT=lp();Object.defineProperty(d,"HelixGoalApi",{enumerable:!0,get:n(function(){return WT.HelixGoalApi},"get")});var VT=sp();Object.defineProperty(d,"HelixGoal",{enumerable:!0,get:n(function(){return VT.HelixGoal},"get")});var $T=hp();Object.defineProperty(d,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return $T.HelixHypeTrainApi},"get")});var zT=up();Object.defineProperty(d,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return zT.HelixHypeTrainContribution},"get")});var KT=cp();Object.defineProperty(d,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return KT.HelixHypeTrainEvent},"get")});var JT=Ap();Object.defineProperty(d,"HelixModerationApi",{enumerable:!0,get:n(function(){return JT.HelixModerationApi},"get")});var ZT=gp();Object.defineProperty(d,"HelixBan",{enumerable:!0,get:n(function(){return ZT.HelixBan},"get")});var XT=vp();Object.defineProperty(d,"HelixModerator",{enumerable:!0,get:n(function(){return XT.HelixModerator},"get")});var YT=wp();Object.defineProperty(d,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return YT.HelixModeratedChannel},"get")});var eR=Fl();Object.defineProperty(d,"HelixBanUser",{enumerable:!0,get:n(function(){return eR.HelixBanUser},"get")});var tR=xp();Object.defineProperty(d,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return tR.HelixBlockedTerm},"get")});var rR=Sp();Object.defineProperty(d,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return rR.HelixShieldModeStatus},"get")});var iR=Hp();Object.defineProperty(d,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return iR.HelixUnbanRequest},"get")});var nR=Cp();Object.defineProperty(d,"HelixWarning",{enumerable:!0,get:n(function(){return nR.HelixWarning},"get")});var aR=Up();Object.defineProperty(d,"HelixPollApi",{enumerable:!0,get:n(function(){return aR.HelixPollApi},"get")});var sR=Tp();Object.defineProperty(d,"HelixPoll",{enumerable:!0,get:n(function(){return sR.HelixPoll},"get")});var oR=Ip();Object.defineProperty(d,"HelixPollChoice",{enumerable:!0,get:n(function(){return oR.HelixPollChoice},"get")});var lR=Mp();Object.defineProperty(d,"HelixPredictionApi",{enumerable:!0,get:n(function(){return lR.HelixPredictionApi},"get")});var uR=jp();Object.defineProperty(d,"HelixPrediction",{enumerable:!0,get:n(function(){return uR.HelixPrediction},"get")});var cR=Op();Object.defineProperty(d,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return cR.HelixPredictionOutcome},"get")});var dR=Bp();Object.defineProperty(d,"HelixPredictor",{enumerable:!0,get:n(function(){return dR.HelixPredictor},"get")});var hR=Gp();Object.defineProperty(d,"HelixRaidApi",{enumerable:!0,get:n(function(){return hR.HelixRaidApi},"get")});var pR=Fp();Object.defineProperty(d,"HelixRaid",{enumerable:!0,get:n(function(){return pR.HelixRaid},"get")});var mR=Qo();Object.defineProperty(d,"HelixUserRelation",{enumerable:!0,get:n(function(){return mR.HelixUserRelation},"get")});var _R=Zp();Object.defineProperty(d,"HelixScheduleApi",{enumerable:!0,get:n(function(){return _R.HelixScheduleApi},"get")});var yR=zp();Object.defineProperty(d,"HelixSchedule",{enumerable:!0,get:n(function(){return yR.HelixSchedule},"get")});var fR=fa();Object.defineProperty(d,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return fR.HelixScheduleSegment},"get")});var gR=$p();Object.defineProperty(d,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return gR.HelixPaginatedScheduleSegmentRequest},"get")});var bR=em();Object.defineProperty(d,"HelixSearchApi",{enumerable:!0,get:n(function(){return bR.HelixSearchApi},"get")});var xR=Xp();Object.defineProperty(d,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return xR.HelixChannelSearchResult},"get")});var wR=lm();Object.defineProperty(d,"HelixStreamApi",{enumerable:!0,get:n(function(){return wR.HelixStreamApi},"get")});var vR=im();Object.defineProperty(d,"HelixStream",{enumerable:!0,get:n(function(){return vR.HelixStream},"get")});var SR=uu();Object.defineProperty(d,"HelixStreamMarker",{enumerable:!0,get:n(function(){return SR.HelixStreamMarker},"get")});var HR=sm();Object.defineProperty(d,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return HR.HelixStreamMarkerWithVideo},"get")});var CR=dm();Object.defineProperty(d,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return CR.HelixPaginatedSubscriptionsRequest},"get")});var qR=pm();Object.defineProperty(d,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return qR.HelixSubscriptionApi},"get")});var ER=yu();Object.defineProperty(d,"HelixSubscription",{enumerable:!0,get:n(function(){return ER.HelixSubscription},"get")});var PR=_u();Object.defineProperty(d,"HelixUserSubscription",{enumerable:!0,get:n(function(){return PR.HelixUserSubscription},"get")});var AR=gm();Object.defineProperty(d,"HelixTeamApi",{enumerable:!0,get:n(function(){return AR.HelixTeamApi},"get")});var DR=bu();Object.defineProperty(d,"HelixTeam",{enumerable:!0,get:n(function(){return DR.HelixTeam},"get")});var IR=_m();Object.defineProperty(d,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return IR.HelixTeamWithUsers},"get")});var TR=Rm();Object.defineProperty(d,"HelixUserApi",{enumerable:!0,get:n(function(){return TR.HelixUserApi},"get")});var RR=Dm();Object.defineProperty(d,"HelixUserBlock",{enumerable:!0,get:n(function(){return RR.HelixUserBlock},"get")});var UR=rw();Object.defineProperty(d,"HelixFollow",{enumerable:!0,get:n(function(){return UR.HelixFollow},"get")});var BR=Am();Object.defineProperty(d,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return BR.HelixPrivilegedUser},"get")});var OR=Hu();Object.defineProperty(d,"HelixUser",{enumerable:!0,get:n(function(){return OR.HelixUser},"get")});var jR=vu();Object.defineProperty(d,"HelixBaseExtension",{enumerable:!0,get:n(function(){return jR.HelixBaseExtension},"get")});var kR=wm();Object.defineProperty(d,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return kR.HelixInstalledExtension},"get")});var MR=Hm();Object.defineProperty(d,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return MR.HelixInstalledExtensionList},"get")});var LR=Em();Object.defineProperty(d,"HelixUserExtension",{enumerable:!0,get:n(function(){return LR.HelixUserExtension},"get")});var FR=jm();Object.defineProperty(d,"HelixVideoApi",{enumerable:!0,get:n(function(){return FR.HelixVideoApi},"get")});var NR=Bm();Object.defineProperty(d,"HelixVideo",{enumerable:!0,get:n(function(){return NR.HelixVideo},"get")});var QR=Mm();Object.defineProperty(d,"HelixWhisperApi",{enumerable:!0,get:n(function(){return QR.HelixWhisperApi},"get")});var GR=nd();Object.defineProperty(d,"ConfigError",{enumerable:!0,get:n(function(){return GR.ConfigError},"get")});var WR=rm();Object.defineProperty(d,"StreamNotLiveError",{enumerable:!0,get:n(function(){return WR.StreamNotLiveError},"get")});var VR=Fm();Object.defineProperty(d,"ApiReportedRequest",{enumerable:!0,get:n(function(){return VR.ApiReportedRequest},"get")});var $R=oe();Object.defineProperty(d,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return $R.HelixPaginatedRequest},"get")});var zR=Gr();Object.defineProperty(d,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return zR.HelixPaginatedRequestWithTotal},"get")});var Bu=_();Object.defineProperty(d,"extractUserId",{enumerable:!0,get:n(function(){return Bu.extractUserId},"get")});Object.defineProperty(d,"extractUserName",{enumerable:!0,get:n(function(){return Bu.extractUserName},"get")});Object.defineProperty(d,"HelixExtension",{enumerable:!0,get:n(function(){return Bu.HelixExtension},"get")});Object.defineProperty(d,"HellFreezesOverError",{enumerable:!0,get:n(function(){return Bu.HellFreezesOverError},"get")})});var cw=u(($G,uw)=>{var nw=Lu(),KR=Qu(),aw=ts(),Yt=It(),sw=Wu(),ow=$u(),lw=Ku(),Ou=G_(),{ApiClient:JR}=iw(),{AppTokenAuthProvider:ZR}=Ed(),Wm=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 ZR(e,t);this.apiClient=new JR({authProvider:a})}this.emotes=new aw,this.channels=new aw,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new KR(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 lw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?Yt.BTTV.Channel(e):Yt.BTTV.Global;return Ou.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 nw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=Yt.FFZ.Set(e);return Ou.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=Yt.FFZ.Channel(e);return Ou.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 sw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?Yt.SevenTV.Channel(e):Yt.SevenTV.Global;return Ou.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new ow(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(Yt.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(Yt.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,t);else for(let a of r.emote_set.emotes)this._cacheSevenTVEmote(e,a,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:nw,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:sw,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:ow,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:lw,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}};uw.exports=Wm});var hw=u((KG,dw)=>{var XR=It(),Vm=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||XR.Templates[this.options.type],c=o.toLink(t);return l.replace(/{link}/g,c).replace(/{name}/g,o.code).replace(/{size}/g,t).replace(/{creator}/g,o.ownerName||"global")})}};dw.exports=Vm});var YR=u((ZG,pw)=>{pw.exports={BTTVEmote:Lu(),Channel:Qu(),Collection:ts(),Constants:It(),Emote:wr(),EmoteFetcher:cw(),EmoteParser:hw(),FFZEmote:Wu(),SevenTVEmote:$u(),TwitchEmote:Ku()}});export default YR();
20
20
  /*! Bundled license information:
21
21
 
22
22
  axios/dist/browser/axios.cjs:
23
- (*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors *)
23
+ (*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors *)
24
24
  */
25
25
  //# sourceMappingURL=TwitchEmoticons.min.js.map