@mkody/twitch-emoticons 2.9.2 → 2.9.4

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 za=Object.defineProperty;var ow=Object.getOwnPropertyDescriptor;var lw=Object.getOwnPropertyNames;var uw=Object.prototype.hasOwnProperty;var n=(i,e)=>za(i,"name",{value:e,configurable:!0});var cw=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),dw=(i,e)=>{for(var t in e)za(i,t,{get:e[t],enumerable:!0})},hw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of lw(e))!uw.call(i,a)&&a!==t&&za(i,a,{get:()=>e[a],enumerable:!(r=ow(e,a))||r.enumerable});return i};var b=i=>hw(za({},"__esModule",{value:!0}),i);var fr=u(($R,Gm)=>{var Uu=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}}};Gm.exports=Uu});var qt=u((KR,Wm)=>{Wm.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 Ou=u((ZR,Vm)=>{var pw=fr(),mw=qt(),Bu=class i extends pw{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 mw.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}})}};Vm.exports=Bu});var Ka=u((YR,$m)=>{var ju=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}};$m.exports=ju});var Mu=u((tU,zm)=>{var _w=Ka(),ku=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new _w}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};zm.exports=ku});var Fu=u((iU,Jm)=>{var yw=fr(),Km=qt(),Lu=class i extends yw{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?Km.FFZ.CDNAnimated(this.id,e):Km.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})}};Jm.exports=Lu});var Qu=u((aU,Zm)=>{var fw=fr(),gw=qt(),Nu=class i extends fw{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],gw.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}}})}};Zm.exports=Nu});var Wu=u((oU,Xm)=>{var bw=fr(),xw=qt(),Gu=class i extends bw{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 xw.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}:{}})}};Xm.exports=Gu});var j_=u((uU,O_)=>{"use strict";function h_(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(h_,"bind");var{toString:ww}=Object.prototype,{getPrototypeOf:ic}=Object,{iterator:rs,toStringTag:p_}=Symbol,is=(i=>e=>{let t=ww.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ke=n(i=>(i=i.toLowerCase(),e=>is(e)===i),"kindOfTest"),ns=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:xr}=Array,li=ns("undefined");function vw(i){return i!==null&&!li(i)&&i.constructor!==null&&!li(i.constructor)&&Ce(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(vw,"isBuffer");var m_=Ke("ArrayBuffer");function Sw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&m_(i.buffer),e}n(Sw,"isArrayBufferView");var Hw=ns("string"),Ce=ns("function"),__=ns("number"),as=n(i=>i!==null&&typeof i=="object","isObject"),Cw=n(i=>i===!0||i===!1,"isBoolean"),Ja=n(i=>{if(is(i)!=="object")return!1;let e=ic(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(p_ in i)&&!(rs in i)},"isPlainObject"),qw=Ke("Date"),Ew=Ke("File"),Pw=Ke("Blob"),Aw=Ke("FileList"),Dw=n(i=>as(i)&&Ce(i.pipe),"isStream"),Iw=n(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Ce(i.append)&&((e=is(i))==="formdata"||e==="object"&&Ce(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Tw=Ke("URLSearchParams"),[Rw,Uw,Bw,Ow]=["ReadableStream","Request","Response","Headers"].map(Ke),jw=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ui(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{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(ui,"forEach");function y_(i,e){e=e.toLowerCase();let t=Object.keys(i),r=t.length,a;for(;r-- >0;)if(a=t[r],e===a.toLowerCase())return a;return null}n(y_,"findKey");var Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,f_=n(i=>!li(i)&&i!==Kt,"isContextDefined");function Ku(){let{caseless:i}=f_(this)&&this||{},e={},t=n((r,a)=>{let s=i&&y_(e,a)||a;Ja(e[s])&&Ja(r)?e[s]=Ku(e[s],r):Ja(r)?e[s]=Ku({},r):xr(r)?e[s]=r.slice():e[s]=r},"assignValue");for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&ui(arguments[r],t);return e}n(Ku,"merge");var kw=n((i,e,t,{allOwnKeys:r}={})=>(ui(e,(a,s)=>{t&&Ce(a)?i[s]=h_(a,t):i[s]=a},{allOwnKeys:r}),i),"extend"),Mw=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),Lw=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"),Fw=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&&ic(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),Nw=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"),Qw=n(i=>{if(!i)return null;if(xr(i))return i;let e=i.length;if(!__(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),Gw=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&ic(Uint8Array)),Ww=n((i,e)=>{let r=(i&&i[rs]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),Vw=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),$w=Ke("HTMLFormElement"),zw=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),Ym=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Kw=Ke("RegExp"),g_=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};ui(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),Jw=n(i=>{g_(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"),Zw=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"),Xw=n(()=>{},"noop"),Yw=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber");function ev(i){return!!(i&&Ce(i.append)&&i[p_]==="FormData"&&i[rs])}n(ev,"isSpecCompliantForm");var tv=n(i=>{let e=new Array(10),t=n((r,a)=>{if(as(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[a]=r;let s=xr(r)?[]:{};return ui(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"),rv=Ke("AsyncFunction"),iv=n(i=>i&&(as(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),"isThenable"),b_=((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)),nv=typeof queueMicrotask<"u"?queueMicrotask.bind(Kt):typeof process<"u"&&process.nextTick||b_,av=n(i=>i!=null&&Ce(i[rs]),"isIterable"),_={isArray:xr,isArrayBuffer:m_,isBuffer:vw,isFormData:Iw,isArrayBufferView:Sw,isString:Hw,isNumber:__,isBoolean:Cw,isObject:as,isPlainObject:Ja,isReadableStream:Rw,isRequest:Uw,isResponse:Bw,isHeaders:Ow,isUndefined:li,isDate:qw,isFile:Ew,isBlob:Pw,isRegExp:Kw,isFunction:Ce,isStream:Dw,isURLSearchParams:Tw,isTypedArray:Gw,isFileList:Aw,forEach:ui,merge:Ku,extend:kw,trim:jw,stripBOM:Mw,inherits:Lw,toFlatObject:Fw,kindOf:is,kindOfTest:Ke,endsWith:Nw,toArray:Qw,forEachEntry:Ww,matchAll:Vw,isHTMLForm:$w,hasOwnProperty:Ym,hasOwnProp:Ym,reduceDescriptors:g_,freezeMethods:Jw,toObjectSet:Zw,toCamelCase:zw,noop:Xw,toFiniteNumber:Yw,findKey:y_,global:Kt,isContextDefined:f_,isSpecCompliantForm:ev,toJSONObject:tv,isAsyncFn:rv,isThenable:iv,setImmediate:b_,asap:nv,isIterable:av};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 x_=I.prototype,w_={};["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=>{w_[i]={value:i}});Object.defineProperties(I,w_);Object.defineProperty(x_,"isAxiosError",{value:!0});I.from=(i,e,t,r,a,s)=>{let o=Object.create(x_);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 sv=null;function Ju(i){return _.isPlainObject(i)||_.isArray(i)}n(Ju,"isVisitable");function v_(i){return _.endsWith(i,"[]")?i.slice(0,-2):i}n(v_,"removeBrackets");function e_(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=v_(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(e_,"renderKey");function ov(i){return _.isArray(i)&&!i.some(Ju)}n(ov,"isFlatArray");var lv=_.toFlatObject(_,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function ss(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(!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)&&ov(w)||(_.isFileList(w)||_.endsWith(P,"[]"))&&(B=_.toArray(w)))return P=v_(P),B.forEach(n(function($,z){!(_.isUndefined($)||$===null)&&e.append(o===!0?e_([P],z,s):o===null?P:P+"[]",h($))},"each")),!1}return Ju(w)?!0:(e.append(e_(v,P,s),h(w)),!1)}n(p,"defaultVisitor");let x=[],E=Object.assign(lv,{defaultVisitor:p,convertValue:h,isVisitable:Ju});function q(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,E))===!0&&q(B,P?P.concat(V):[V])},"each")),x.pop()}}if(n(q,"build"),!_.isObject(i))throw new TypeError("data must be an object");return q(i),e}n(ss,"toFormData");function t_(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(t_,"encode$1");function nc(i,e){this._pairs=[],i&&ss(i,this,e)}n(nc,"AxiosURLSearchParams");var S_=nc.prototype;S_.append=n(function(e,t){this._pairs.push([e,t])},"append");S_.toString=n(function(e){let t=e?function(r){return e.call(this,r,t_)}:t_;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function uv(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}n(uv,"encode");function H_(i,e,t){if(!e)return i;let r=t&&t.encode||uv;_.isFunction(t)&&(t={serialize:t});let a=t&&t.serialize,s;if(a?s=a(e,t):s=_.isURLSearchParams(e)?e.toString():new nc(e,t).toString(r),s){let o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}n(H_,"buildURL");var Zu=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"))}},r_=Zu,C_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},cv=typeof URLSearchParams<"u"?URLSearchParams:nc,dv=typeof FormData<"u"?FormData:null,hv=typeof Blob<"u"?Blob:null,pv={isBrowser:!0,classes:{URLSearchParams:cv,FormData:dv,Blob:hv},protocols:["http","https","file","blob","url","data"]},ac=typeof window<"u"&&typeof document<"u",Xu=typeof navigator=="object"&&navigator||void 0,mv=ac&&(!Xu||["ReactNative","NativeScript","NS"].indexOf(Xu.product)<0),_v=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yv=ac&&window.location.href||"http://localhost",fv=Object.freeze({__proto__:null,hasBrowserEnv:ac,hasStandardBrowserWebWorkerEnv:_v,hasStandardBrowserEnv:mv,navigator:Xu,origin:yv}),ve={...fv,...pv};function gv(i,e){return ss(i,new ve.classes.URLSearchParams,Object.assign({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(gv,"toURLEncodedForm");function bv(i){return _.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(bv,"parsePropPath");function xv(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(xv,"arrayToObject");function q_(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]=xv(a[o])),!l)}if(n(e,"buildPath"),_.isFormData(i)&&_.isFunction(i.entries)){let t={};return _.forEachEntry(i,(r,a)=>{e(bv(r),a,t,0)}),t}return null}n(q_,"formDataToJSON");function wv(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(wv,"stringifySafely");var sc={transitional:C_,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(q_(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 gv(e,this.formSerializer).toString();if((l=_.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return ss(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),wv(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||sc.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=>{sc.headers[i]={}});var oc=sc,vv=_.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"]),Sv=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]&&vv[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),i_=Symbol("internals");function oi(i){return i&&String(i).trim().toLowerCase()}n(oi,"normalizeHeader");function Za(i){return i===!1||i==null?i:_.isArray(i)?i.map(Za):String(i)}n(Za,"normalizeValue");function Hv(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(Hv,"parseTokens");var Cv=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function Vu(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(Vu,"matchHeaderValue");function qv(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(qv,"formatHeader");function Ev(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(Ev,"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]=Za(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())&&!Cv(e))o(Sv(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 Hv(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||Vu(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||Vu(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||Vu(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]=Za(a),delete t[s];return}let l=e?qv(s):String(s).trim();l!==s&&delete t[s],t[l]=Za(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[i_]=this[i_]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=oi(o);r[l]||(Ev(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 $u(i,e){let t=this||oc,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($u,"transformData");function E_(i){return!!(i&&i.__CANCEL__)}n(E_,"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 P_(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(P_,"settle");function Pv(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(Pv,"parseProtocol");function Av(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,E=0;for(;x!==a;)E+=t[x++],x=x%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),h-o<e)return;let q=p&&h-p;return q?Math.round(E*1e3/q):void 0},"push")}n(Av,"speedometer");function Dv(i,e){let t=0,r=1e3/e,a,s,o=n((h,p=Date.now())=>{t=p,a=null,s&&(clearTimeout(s),s=null),i.apply(null,h)},"invoke");return[n((...h)=>{let p=Date.now(),x=p-t;x>=r?o(h,p):(a=h,s||(s=setTimeout(()=>{s=null,o(a)},r-x)))},"throttled"),n(()=>a&&o(a),"flush")]}n(Dv,"throttle");var es=n((i,e,t=3)=>{let r=0,a=Av(50,250);return Dv(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"),n_=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),a_=n(i=>(...e)=>_.asap(()=>i(...e)),"asyncDecorator"),Iv=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,Tv=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 Rv(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(Rv,"isAbsoluteURL");function Uv(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n(Uv,"combineURLs");function A_(i,e,t){let r=!Rv(e);return i&&(r||t==!1)?Uv(i,e):e}n(A_,"buildFullPath");var s_=n(i=>i instanceof ze?{...i}:i,"headersToObject");function Jt(i,e){e=e||{};let t={};function r(h,p,x,E){return _.isPlainObject(h)&&_.isPlainObject(p)?_.merge.call({caseless:E},h,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,x,E){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h,x,E)}else return r(h,p,x,E)}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(s_(h),s_(p),x,!0),"headers")};return _.forEach(Object.keys(Object.assign({},i,e)),n(function(p){let x=d[p]||a,E=x(i[p],e[p],p);_.isUndefined(E)&&x!==l||(t[p]=E)},"computeConfigValue")),t}n(Jt,"mergeConfig");var D_=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=H_(A_(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&&Iv(e.url))){let h=a&&s&&Tv.read(s);h&&o.set(a,h)}return e},"resolveConfig"),Bv=typeof XMLHttpRequest<"u",Ov=Bv&&function(i){return new Promise(n(function(t,r){let a=D_(i),s=a.data,o=ze.from(a.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:h}=a,p,x,E,q,w;function P(){q&&q(),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};P_(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||C_;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&&([E,w]=es(h,!0),v.addEventListener("progress",E)),d&&v.upload&&([x,q]=es(d),v.upload.addEventListener("progress",x),v.upload.addEventListener("loadend",q)),(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=Pv(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"))},jv=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"),kv=jv,Mv=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"),Lv=n(async function*(i,e){for await(let t of Fv(i))yield*Mv(t,e)},"readBytes"),Fv=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"),o_=n((i,e,t,r)=>{let a=Lv(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 E=s+=x;t(E)}d.enqueue(new Uint8Array(p))}catch(h){throw l(h),h}},cancel(d){return l(d),a.return()}},{highWaterMark:2})},"trackStream"),os=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",I_=os&&typeof ReadableStream=="function",Nv=os&&(typeof TextEncoder=="function"?(i=>e=>i.encode(e))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),T_=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),Qv=I_&&T_(()=>{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}),l_=64*1024,Yu=I_&&T_(()=>_.isReadableStream(new Response("").body)),ts={stream:Yu&&(i=>i.body)};os&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!ts[e]&&(ts[e]=_.isFunction(i[e])?t=>t[e]():(t,r)=>{throw new I(`Response type '${e}' is not supported`,I.ERR_NOT_SUPPORT,r)})})})(new Response);var Gv=n(async i=>{if(i==null)return 0;if(_.isBlob(i))return i.size;if(_.isSpecCompliantForm(i))return(await new Request(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 Nv(i)).byteLength},"getBodyLength"),Wv=n(async(i,e)=>{let t=_.toFiniteNumber(i.getContentLength());return t??Gv(e)},"resolveBodyLength"),Vv=os&&(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:E}=D_(i);h=h?(h+"").toLowerCase():"text";let q=kv([a,s&&s.toAbortSignal()],o),w,P=q&&q.unsubscribe&&(()=>{q.unsubscribe()}),v;try{if(d&&Qv&&t!=="get"&&t!=="head"&&(v=await Wv(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]=n_(v,es(a_(d)));r=o_(xe.body,l_,he,_r)}}_.isString(x)||(x=x?"include":"omit");let B="credentials"in Request.prototype;w=new Request(e,{...E,signal:q,method:t.toUpperCase(),headers:p.normalize().toJSON(),body:r,duplex:"half",credentials:B?x:void 0});let V=await fetch(w),$=Yu&&(h==="stream"||h==="response");if(Yu&&(l||$&&P)){let xe={};["status","statusText","headers"].forEach(yr=>{xe[yr]=V[yr]});let it=_.toFiniteNumber(V.headers.get("content-length")),[he,_r]=l&&n_(it,es(a_(l),!0))||[];V=new Response(o_(V.body,l_,he,()=>{_r&&_r(),P&&P()}),xe)}h=h||"text";let z=await ts[_.findKey(ts,h)||"text"](V,i);return!$&&P&&P(),await new Promise((xe,it)=>{P_(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)}}),ec={http:sv,xhr:Ov,fetch:Vv};_.forEach(ec,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var u_=n(i=>`- ${i}`,"renderReason"),$v=n(i=>_.isFunction(i)||i===null||i===!1,"isResolvedHandle"),R_={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,!$v(t)&&(r=ec[(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(u_).join(`
5
- `):" "+u_(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:ec};function zu(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new wr(null,i)}n(zu,"throwIfCancellationRequested");function c_(i){return zu(i),i.headers=ze.from(i.headers),i.data=$u.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),R_.getAdapter(i.adapter||oc.adapter)(i).then(n(function(r){return zu(i),r.data=$u.call(i,i.transformResponse,r),r.headers=ze.from(r.headers),r},"onAdapterResolution"),n(function(r){return E_(r)||(zu(i),r&&r.response&&(r.response.data=$u.call(i,i.transformResponse,r.response),r.response.headers=ze.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(c_,"dispatchRequest");var U_="1.9.0",ls={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{ls[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var d_={};ls.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+U_+"] 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&&!d_[o]&&(d_[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");ls.spelling=n(function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)},"spelling");function zv(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(zv,"assertOptions");var Xa={assertOptions:zv,validators:ls},nt=Xa.validators,br=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new r_,response:new r_}}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&&Xa.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}:Xa.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),Xa.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,E;if(!d){let w=[c_.bind(this),void 0];for(w.unshift.apply(w,l),w.push.apply(w,h),E=w.length,p=Promise.resolve(t);x<E;)p=p.then(w[x++],w[x++]);return p}E=l.length;let q=t;for(x=0;x<E;){let w=l[x++],P=l[x++];try{q=w(q)}catch(v){P.call(this,v);break}}try{p=c_.call(this,q)}catch(w){return Promise.reject(w)}for(x=0,E=h.length;x<E;)p=p.then(h[x++],h[x++]);return p}getUri(e){e=Jt(this.defaults,e);let t=A_(e.baseURL,e.url,e.allowAbsoluteUrls);return H_(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 Ya=br,tc=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}}},Kv=tc;function Jv(i){return n(function(t){return i.apply(null,t)},"wrap")}n(Jv,"spread");function Zv(i){return _.isObject(i)&&i.isAxiosError===!0}n(Zv,"isAxiosError");var rc={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(rc).forEach(([i,e])=>{rc[e]=i});var Xv=rc;function B_(i){let e=new Ya(i),t=h_(Ya.prototype.request,e);return _.extend(t,Ya.prototype,e,{allOwnKeys:!0}),_.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return B_(Jt(i,a))},"create"),t}n(B_,"createInstance");var ie=B_(oc);ie.Axios=Ya;ie.CanceledError=wr;ie.CancelToken=Kv;ie.isCancel=E_;ie.VERSION=U_;ie.toFormData=ss;ie.AxiosError=I;ie.Cancel=ie.CanceledError;ie.all=n(function(e){return Promise.all(e)},"all");ie.spread=Jv;ie.isAxiosError=Zv;ie.mergeConfig=Jt;ie.AxiosHeaders=ze;ie.formToJSON=i=>q_(_.isHTMLForm(i)?new FormData(i):i);ie.getAdapter=R_.getAdapter;ie.HttpStatusCode=Xv;ie.default=ie;O_.exports=ie});var y={};dw(y,{__addDisposableResource:()=>ly,__assign:()=>us,__asyncDelegator:()=>ey,__asyncGenerator:()=>Y_,__asyncValues:()=>ty,__await:()=>vr,__awaiter:()=>$_,__classPrivateFieldGet:()=>ay,__classPrivateFieldIn:()=>oy,__classPrivateFieldSet:()=>sy,__createBinding:()=>ds,__decorate:()=>L_,__disposeResources:()=>uy,__esDecorate:()=>N_,__exportStar:()=>K_,__extends:()=>k_,__generator:()=>z_,__importDefault:()=>ny,__importStar:()=>iy,__makeTemplateObject:()=>ry,__metadata:()=>V_,__param:()=>F_,__propKey:()=>G_,__read:()=>cc,__rest:()=>M_,__rewriteRelativeImportExtension:()=>cy,__runInitializers:()=>Q_,__setFunctionName:()=>W_,__spread:()=>J_,__spreadArray:()=>X_,__spreadArrays:()=>Z_,__values:()=>cs,default:()=>tS});function k_(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");lc(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function M_(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 L_(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 F_(i,e){return function(t,r){e(t,r,i)}}function N_(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,E=!1,q=t.length-1;q>=0;q--){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(E)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(B||null))};var v=(0,t[q])(l==="accessor"?{get:p.get,set:p.set}:p[d],w);if(l==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(x=o(v.get))&&(p.get=x),(x=o(v.set))&&(p.set=x),(x=o(v.init))&&a.unshift(x)}else(x=o(v))&&(l==="field"?a.unshift(x):p[d]=x)}h&&Object.defineProperty(h,r.name,p),E=!0}function Q_(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 G_(i){return typeof i=="symbol"?i:"".concat(i)}function W_(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 V_(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function $_(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 z_(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 K_(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ds(e,i,t)}function cs(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 cc(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 J_(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(cc(arguments[e]));return i}function Z_(){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 X_(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 Y_(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(q){return function(w){return Promise.resolve(w).then(q,x)}}function l(q,w){r[q]&&(a[q]=function(P){return new Promise(function(v,B){s.push([q,P,v,B])>1||d(q,P)})},w&&(a[q]=w(a[q])))}function d(q,w){try{h(r[q](w))}catch(P){E(s[0][3],P)}}function h(q){q.value instanceof vr?Promise.resolve(q.value.v).then(p,x):E(s[0][2],q)}function p(q){d("next",q)}function x(q){d("throw",q)}function E(q,w){q(w),s.shift(),s.length&&d(s[0][0],s[0][1])}}function ey(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 ty(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 cs=="function"?cs(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 ry(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function iy(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=uc(i),r=0;r<t.length;r++)t[r]!=="default"&&ds(e,i,t[r]);return Yv(e,i),e}function ny(i){return i&&i.__esModule?i:{default:i}}function ay(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 sy(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 oy(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 ly(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 uy(i){function e(s){i.error=i.hasError?new eS(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 cy(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 lc,us,ds,Yv,uc,eS,tS,f=cw(()=>{lc=n(function(i,e){return lc=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])},lc(i,e)},"extendStatics");n(k_,"__extends");us=n(function(){return us=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"),us.apply(this,arguments)},"__assign");n(M_,"__rest");n(L_,"__decorate");n(F_,"__param");n(N_,"__esDecorate");n(Q_,"__runInitializers");n(G_,"__propKey");n(W_,"__setFunctionName");n(V_,"__metadata");n($_,"__awaiter");n(z_,"__generator");ds=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(K_,"__exportStar");n(cs,"__values");n(cc,"__read");n(J_,"__spread");n(Z_,"__spreadArrays");n(X_,"__spreadArray");n(vr,"__await");n(Y_,"__asyncGenerator");n(ey,"__asyncDelegator");n(ty,"__asyncValues");n(ry,"__makeTemplateObject");Yv=Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e},uc=n(function(i){return uc=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},uc(i)},"ownKeys");n(iy,"__importStar");n(ny,"__importDefault");n(ay,"__classPrivateFieldGet");n(sy,"__classPrivateFieldSet");n(oy,"__classPrivateFieldIn");n(ly,"__addDisposableResource");eS=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(uy,"__disposeResources");n(cy,"__rewriteRelativeImportExtension");tS={__extends:k_,__assign:us,__rest:M_,__decorate:L_,__param:F_,__esDecorate:N_,__runInitializers:Q_,__propKey:G_,__setFunctionName:W_,__metadata:V_,__awaiter:$_,__generator:z_,__createBinding:ds,__exportStar:K_,__values:cs,__read:cc,__spread:J_,__spreadArrays:Z_,__spreadArray:X_,__await:vr,__asyncGenerator:Y_,__asyncDelegator:ey,__asyncValues:ty,__makeTemplateObject:ry,__importStar:iy,__importDefault:ny,__classPrivateFieldGet:ay,__classPrivateFieldSet:sy,__classPrivateFieldIn:oy,__addDisposableResource:ly,__disposeResources:uy,__rewriteRelativeImportExtension:cy}});var ci=u((hU,dy)=>{dy.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 rS=ci(),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 iS(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(iS,"resolveLogLevel");Pt.resolveLogLevel=iS;var nS=rS.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]=nS.bind(console),Et[qe.TRACE]=console.trace.bind(console),Et)});var hy=u(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.Enumerable=void 0;function aS(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(aS,"Enumerable");hs.Enumerable=aS});var my=u(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.flatten=void 0;var py=(f(),b(y));function sS(i){var e;return(e=[]).concat.apply(e,py.__spreadArray([],py.__read(i),!1))}n(sS,"flatten");ps.flatten=sS});var _y=u(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.immutableSplice=void 0;var Sr=(f(),b(y));function oS(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(oS,"immutableSplice");ms.immutableSplice=oS});var yy=u(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.partitionedFlatMap=void 0;var dc=(f(),b(y));function lS(i,e,t){var r,a,s,o={};try{for(var l=dc.__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,dc.__spreadArray([],dc.__read(x),!1)):o[p]=x}}catch(E){r={error:E}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(lS,"partitionedFlatMap");_s.partitionedFlatMap=lS});var gy=u(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.resolveConfigValueSync=Hr.resolveConfigValue=void 0;var fy=(f(),b(y));function uS(i){return fy.__awaiter(this,void 0,void 0,function(){return fy.__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(uS,"resolveConfigValue");Hr.resolveConfigValue=uS;function cS(i){return typeof i=="function"?i():i}n(cS,"resolveConfigValueSync");Hr.resolveConfigValueSync=cS});var by=u(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.deprecateClass=void 0;var hc=(f(),b(y));function dS(i,e){var t=!1;return function(r){hc.__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,hc.__spreadArray([],hc.__read(s),!1))||this}return n(a,"class_1"),a}(i)}n(dS,"deprecateClass");ys.deprecateClass=dS});var wy=u(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.match=Xt.eq=void 0;var xy=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return xy(i)},"on")}},"matched"),pc=n(function(i){return{on:n(function(e,t){return e(i)?xy(t(i)):pc(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");Xt.match=pc;var hS=n(function(i){return function(e){return i===e}},"eq");Xt.eq=hS;pc.eq=Xt.eq});var Sy=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.fibWithLimit=void 0;var vy=(f(),b(y));function pS(i){var e,t,r;return vy.__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=vy.__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(pS,"fibWithLimit");fs.fibWithLimit=pS});var bs=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.arrayToObject=void 0;var Hy=(f(),b(y));function mS(i,e){return Object.assign.apply(Object,Hy.__spreadArray([{}],Hy.__read(i.map(e)),!1))}n(mS,"arrayToObject");gs.arrayToObject=mS});var Cy=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.entriesToObject=void 0;var _S=(f(),b(y)),yS=bs();function fS(i){return(0,yS.arrayToObject)(i,function(e){var t,r=_S.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(fS,"entriesToObject");xs.entriesToObject=fS});var qy=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.forEachObjectEntry=void 0;var gS=(f(),b(y));function bS(i,e){Object.entries(i).forEach(function(t){var r=gS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(bS,"forEachObjectEntry");ws.forEachObjectEntry=bS});var Ey=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.groupBy=void 0;var xS=(f(),b(y));function wS(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=xS.__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(wS,"groupBy");vs.groupBy=wS});var Py=u(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.indexBy=void 0;var vS=bs();function SS(i,e){if(typeof e!="function"){var t=e;e=n(function(r){return r[t].toString()},"keyFn")}return(0,vS.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(SS,"indexBy");Ss.indexBy=SS});var Ay=u(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.mapObject=void 0;var mc=(f(),b(y));function HS(i,e){var t=Object.entries(i).map(function(r){var a,s=mc.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,mc.__spreadArray([{}],mc.__read(t),!1))}n(HS,"mapObject");Hs.mapObject=HS});var _c=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.pick=void 0;var Cs=(f(),b(y));function CS(i,e){return Object.assign.apply(Object,Cs.__spreadArray([{}],Cs.__read(Object.entries(i).filter(function(t){var r=Cs.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=Cs.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(CS,"pick");qs.pick=CS});var Dy=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.omit=void 0;var qS=_c();function ES(i,e){return(0,qS.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(ES,"omit");Es.omit=ES});var Iy=u(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.mapOptional=At.mapNullable=At.isNullish=void 0;function yc(i){return i==null}n(yc,"isNullish");At.isNullish=yc;function PS(i,e){return yc(i)?null:e(i)}n(PS,"mapNullable");At.mapNullable=PS;function AS(i,e){return yc(i)?void 0:e(i)}n(AS,"mapOptional");At.mapOptional=AS});var Ry=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.delay=void 0;var Ty=(f(),b(y));function DS(i){return Ty.__awaiter(this,void 0,void 0,function(){return Ty.__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(DS,"delay");Ps.delay=DS});var Uy=u(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.promiseWithResolvers=void 0;function IS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(IS,"promiseWithResolvers");As.promiseWithResolvers=IS});var By=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.padLeft=void 0;function TS(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(TS,"padLeft");Ds.padLeft=TS});var Oy=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.splitWithLimit=void 0;var fc=(f(),b(y));function RS(i,e,t){var r=i.split(e);return r.length<=t?r:fc.__spreadArray(fc.__spreadArray([],fc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(RS,"splitWithLimit");Is.splitWithLimit=RS});var jy=u(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.utf8Substring=Cr.utf8Length=void 0;var Ts=(f(),b(y));function US(i){return Ts.__spreadArray([],Ts.__read(i),!1).length}n(US,"utf8Length");Cr.utf8Length=US;function BS(i,e,t){return Ts.__spreadArray([],Ts.__read(i),!1).slice(e,t).join("")}n(BS,"utf8Substring");Cr.utf8Substring=BS});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 OS=hy();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return OS.Enumerable},"get")});var jS=my();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return jS.flatten},"get")});var kS=_y();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return kS.immutableSplice},"get")});var MS=yy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return MS.partitionedFlatMap},"get")});var ky=gy();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return ky.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return ky.resolveConfigValueSync},"get")});var LS=by();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return LS.deprecateClass},"get")});var My=wy();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return My.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return My.eq},"get")});var FS=Sy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return FS.fibWithLimit},"get")});var NS=bs();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return NS.arrayToObject},"get")});var QS=Cy();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return QS.entriesToObject},"get")});var GS=qy();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return GS.forEachObjectEntry},"get")});var WS=Ey();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return WS.groupBy},"get")});var VS=Py();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return VS.indexBy},"get")});var $S=Ay();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return $S.mapObject},"get")});var zS=Dy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return zS.omit},"get")});var KS=_c();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return KS.pick},"get")});var gc=Iy();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return gc.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return gc.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return gc.mapOptional},"get")});var JS=Ry();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return JS.delay},"get")});var ZS=Uy();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return ZS.promiseWithResolvers},"get")});var XS=By();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return XS.padLeft},"get")});var YS=Oy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return YS.splitWithLimit},"get")});var Ly=jy();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return Ly.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return Ly.utf8Substring},"get")})});var vc=u(Us=>{"use strict";var bc,xc;Object.defineProperty(Us,"__esModule",{value:!0});Us.getMinLogLevelFromEnv=void 0;var e0=Zt(),Rs=typeof process>"u"?[]:(xc=(bc=process.env.LOGGING)===null||bc===void 0?void 0:bc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,e0.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&&xc!==void 0?xc:[],wc=Rs.findIndex(function(i){var e=i[0];return!e}),Fy=void 0;wc!==-1&&(Fy=Rs[wc][1],Rs.splice(wc));function t0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(t0,"isPrefix");function r0(i){for(var e=i.split(":"),t=0,r=Rs;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(t0(e,s))return o}return Fy}n(r0,"getMinLogLevelFromEnv");Us.getMinLogLevelFromEnv=r0});var Sc=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.BaseLogger=void 0;var i0=C(),n0=ci(),a0=vc(),Dt=Zt(),s0=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?n0.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,i0.mapOptional)(r,function(x){return(0,Dt.resolveLogLevel)(x)}))!==null&&h!==void 0?h:(0,a0.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}();Bs.BaseLogger=s0});var Ny=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.BrowserLogger=void 0;var o0=(f(),b(y)),l0=Zt(),u0=Sc(),c0=function(i){o0.__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=l0.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e}(u0.BaseLogger);Os.BrowserLogger=c0});var Qy=u(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.CustomLoggerWrapper=void 0;var d0=C(),h0=vc(),Re=Zt(),p0=function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,d0.mapOptional)(r,function(o){return(0,Re.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,h0.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}();js.CustomLoggerWrapper=p0});var Gy=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 m0=(f(),b(y)),re=Zt(),_0=Sc();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 y0={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},f0={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 ks(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(ks,"createGenericWrapper");function at(i){return ks(y0[i],39)}n(at,"createColorWrapper");function di(i,e){return ks(f0[i],49,e)}n(di,"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]=ks(0,0),Tt);Ee.LogLevelToBackgroundColor=(Rt={},Rt[re.LogLevel.CRITICAL]=di("bgRed",at("white")),Rt[re.LogLevel.ERROR]=di("bgRedBright",at("white")),Rt[re.LogLevel.WARNING]=di("bgYellow",at("black")),Rt[re.LogLevel.INFO]=di("bgBlue",at("white")),Rt[re.LogLevel.DEBUG]=di("bgMagenta",at("black")),Rt[re.LogLevel.TRACE]=ks(7,27),Rt);var g0=function(i){m0.__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}(_0.BaseLogger);Ee.NodeLogger=g0});var Wy=u(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.createLogger=void 0;var b0=ci(),x0=Ny(),w0=Qy(),v0=Gy();function S0(i){return i.custom?new w0.CustomLoggerWrapper(i):b0.isNode?new v0.NodeLogger(i):new x0.BrowserLogger(i)}n(S0,"createLogger");Ms.createLogger=S0});var hi=u(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.LogLevel=qr.createLogger=void 0;var H0=Wy();Object.defineProperty(qr,"createLogger",{enumerable:!0,get:n(function(){return H0.createLogger},"get")});var C0=Zt();Object.defineProperty(qr,"LogLevel",{enumerable:!0,get:n(function(){return C0.LogLevel},"get")})});var Fs=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.CustomError=void 0;var Hc=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}};Ls.CustomError=Hc});var Qs=u(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.RateLimiterDestroyedError=void 0;var q0=Fs(),Cc=class extends q0.CustomError{static{n(this,"RateLimiterDestroyedError")}};Ns.RateLimiterDestroyedError=Cc});var pi=u(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.RateLimitReachedError=void 0;var E0=Fs(),qc=class extends E0.CustomError{static{n(this,"RateLimitReachedError")}};Gs.RateLimitReachedError=qc});var Pc=u(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.RetryAfterError=void 0;var P0=Fs(),Ec=class extends P0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Ws.RetryAfterError=Ec});var Vy=u(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.NullRateLimiter=void 0;var Ac=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};Vs.NullRateLimiter=Ac});var Ic=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.ResponseBasedRateLimiter=void 0;var A0=hi(),D0=C(),I0=pi(),$y=Pc(),Dc=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,A0.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,D0.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 $y.RetryAfterError(x);let E=this.getParametersFromResponse(p);return d(p),E}catch(p){if(p instanceof $y.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 I0.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")}};$s.ResponseBasedRateLimiter=Dc});var zy=u(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.PartitionedRateLimiter=void 0;var T0=Ic(),Tc=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 T0.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}};zs.PartitionedRateLimiter=Tc});var Jy=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.PartitionedTimeBasedRateLimiter=void 0;var R0=hi(),U0=pi(),Ky=Qs(),Rc=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,R0.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 Ky.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 U0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":`the rate limit for ${d?`partition ${d}`:"default partition"} was reached`}`));break}default:throw new Error("this should never happen")}else this._runRequest(l,d)})}clear(){this._partitionedQueue.clear()}pause(){this._paused=!0}resume(){this._paused=!1;for(let e of this._partitionedQueue.keys())this._runNextRequest(e)}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 Ky.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)}};Ks.PartitionedTimeBasedRateLimiter=Rc});var Bc=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.TimeBasedRateLimiter=void 0;var B0=hi(),O0=pi(),Zy=Qs(),Uc=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,B0.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 Zy.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 O0.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 Zy.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)}};Js.TimeBasedRateLimiter=Uc});var Xy=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.TimedPassthruRateLimiter=void 0;var j0=Bc(),Oc=class extends j0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};Zs.TimedPassthruRateLimiter=Oc});var Xs=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 k0=Qs();Object.defineProperty(ne,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return k0.RateLimiterDestroyedError},"get")});var M0=pi();Object.defineProperty(ne,"RateLimitReachedError",{enumerable:!0,get:n(function(){return M0.RateLimitReachedError},"get")});var L0=Pc();Object.defineProperty(ne,"RetryAfterError",{enumerable:!0,get:n(function(){return L0.RetryAfterError},"get")});var F0=Vy();Object.defineProperty(ne,"NullRateLimiter",{enumerable:!0,get:n(function(){return F0.NullRateLimiter},"get")});var N0=zy();Object.defineProperty(ne,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return N0.PartitionedRateLimiter},"get")});var Q0=Jy();Object.defineProperty(ne,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return Q0.PartitionedTimeBasedRateLimiter},"get")});var G0=Ic();Object.defineProperty(ne,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return G0.ResponseBasedRateLimiter},"get")});var W0=Bc();Object.defineProperty(ne,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return W0.TimeBasedRateLimiter},"get")});var V0=Xy();Object.defineProperty(ne,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return V0.TimedPassthruRateLimiter},"get")})});var tf=u((_t,ef)=>{var Yy=typeof self<"u"?self:_t,Ys=function(){function i(){this.fetch=!1,this.DOMException=Yy.DOMException}return n(i,"F"),i.prototype=Yy,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 E(g){return new Promise(function(S,R){g.onload=function(){S(g.result)},g.onerror=function(){R(g.error)}})}n(E,"fileReaderReady");function q(g){var S=new FileReader,R=E(S);return S.readAsArrayBuffer(g),R}n(q,"readBlobAsArrayBuffer");function w(g){var S=new FileReader,R=E(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(q)}),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 $a=fe.join(":").trim();S.append(F,$a)}}),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 $a(){F.abort()}n($a,"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 Ru="response"in F?F.response:F.responseText;R(new he(Ru,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,Ru){F.setRequestHeader(Ru,si)}),fe.signal&&(fe.signal.addEventListener("abort",$a),F.onreadystatechange=function(){F.readyState===4&&fe.signal.removeEventListener("abort",$a)}),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}({})})(Ys);Ys.fetch.ponyfill=!0;delete Ys.fetch.polyfill;var Er=Ys;_t=Er.fetch;_t.default=Er.fetch;_t.fetch=Er.fetch;_t.Headers=Er.Headers;_t.Request=Er.Request;_t.Response=Er.Response;ef.exports=_t});var eo=u((GB,nf)=>{"use strict";var jc=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}(),$0=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"),rf=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"),z0=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)||!jc.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=rf(e,r)),Pr(e)&&Pr(t)?(t.forEach(function(s,o){if(jc.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 jc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),K0=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),J0=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"),Z0=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"),X0=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 $0(t),e},"compact"),Y0=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),eH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),tH=n(function(e,t){return[].concat(e,t)},"combine");nf.exports={arrayToObject:rf,assign:K0,combine:tH,compact:X0,decode:J0,encode:Z0,isBuffer:eH,isRegExp:Y0,merge:z0}});var kc=u((VB,sf)=>{"use strict";var rH=String.prototype.replace,iH=/%20/g,nH=eo(),af={RFC1738:"RFC1738",RFC3986:"RFC3986"};sf.exports=nH.assign({default:af.RFC3986,formatters:{RFC1738:n(function(i){return rH.call(i,iH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},af)});var df=u((zB,cf)=>{"use strict";var uf=eo(),mi=kc(),aH=Object.prototype.hasOwnProperty,of={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,sH=Array.prototype.push,Mc=n(function(i,e){sH.apply(i,Ar(e)?e:[e])},"pushToArray"),oH=Date.prototype.toISOString,lf=mi.default,Se={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:uf.encode,encodeValuesOnly:!1,format:lf,formatter:mi.formatters[lf],indices:!1,serializeDate:n(function(e){return oH.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},lH=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),uH=n(function i(e,t,r,a,s,o,l,d,h,p,x,E,q){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&&!E?o(t,Se.encoder,q,"key"):t;w=""}if(lH(w)||uf.isBuffer(w)){if(o){var P=E?t:o(t,Se.encoder,q,"key");return[x(P)+"="+x(o(w,Se.encoder,q,"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)?Mc(v,i(w[z],typeof r=="function"?r(t,z):t,r,a,s,o,l,d,h,p,x,E,q)):Mc(v,i(w[z],t+(h?"."+z:"["+z+"]"),r,a,s,o,l,d,h,p,x,E,q)))}return v},"stringify"),cH=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=mi.default;if(typeof e.format<"u"){if(!aH.call(mi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=mi.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");cf.exports=function(i,e){var t=i,r=cH(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 of?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=of[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||Mc(o,uH(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),E=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?E+="utf8=%26%2310003%3B&":E+="utf8=%E2%9C%93&"),x.length>0?E+x:""}});var _f=u((JB,mf)=>{"use strict";var _i=eo(),Lc=Object.prototype.hasOwnProperty,hf=Array.isArray,ge={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:_i.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},dH=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),pf=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),hH=n(function(e,t){if(hf(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),pH="utf8=%26%2310003%3B",mH="utf8=%E2%9C%93",_H=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]===mH?h="utf-8":o[d]===pH&&(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("]="),E=x===-1?p.indexOf("="):x+1,q,w;E===-1?(q=t.decoder(p,ge.decoder,h,"key"),w=t.strictNullHandling?null:""):(q=t.decoder(p.slice(0,E),ge.decoder,h,"key"),w=hH(pf(p.slice(E+1),t),function(P){return t.decoder(P,ge.decoder,h,"value")})),w&&t.interpretNumericEntities&&h==="iso-8859-1"&&(w=dH(w)),p.indexOf("[]=")>-1&&(w=hf(w)?[w]:w),Lc.call(r,q)?r[q]=_i.combine(r[q],w):r[q]=w}return r},"parseQueryStringValues"),yH=n(function(i,e,t,r){for(var a=r?e:pf(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"),fH=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&&Lc.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&&Lc.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(d[1])}return d&&p.push("["+s.slice(d.index)+"]"),yH(p,t,r,a)}},"parseQueryStringKeys"),gH=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"||_i.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");mf.exports=function(i,e){var t=gH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?_H(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=fH(l,r[l],t,typeof i=="string");a=_i.merge(a,d,t)}return _i.compact(a)}});var Fc=u((XB,yf)=>{"use strict";var bH=df(),xH=_f(),wH=kc();yf.exports={formats:wH,parse:xH,stringify:bH}});var gf=u(ff=>{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");ff.klona=yt});var Qc=u(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.DataObject=ot.getRawData=ot.rawDataSymbol=void 0;var vH=gf();ot.rawDataSymbol=Symbol("twurpleRawData");function SH(i){return(0,vH.klona)(i[ot.rawDataSymbol])}n(SH,"getRawData");ot.getRawData=SH;var Nc=class{static{n(this,"DataObject")}constructor(e){this[ot.rawDataSymbol]=e}};ot.DataObject=Nc});var ro=u(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.CustomError=void 0;var Gc=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}};to.CustomError=Gc});var Vc=u(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.RelationAssertionError=void 0;var HH=ro(),Wc=class extends HH.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};io.RelationAssertionError=Wc});var bf=u(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.checkRelationAssertion=void 0;var CH=Vc();function qH(i){if(i==null)throw new CH.RelationAssertionError;return i}n(qH,"checkRelationAssertion");no.checkRelationAssertion=qH});var $c=u(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.rtfm=void 0;function EH(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(EH,"rtfm");ao.rtfm=EH});var xf=u(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.HelixExtension=void 0;var PH=(f(),b(y)),D=Qc(),AH=$c(),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}};yi.HelixExtension=zc;yi.HelixExtension=zc=PH.__decorate([(0,AH.rtfm)("api","HelixExtension","id")],zc)});var wf=u(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.HellFreezesOverError=void 0;var DH=ro(),Kc=class extends DH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};so.HellFreezesOverError=Kc});var vf=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.extractUserName=Dr.extractUserId=void 0;function IH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(IH,"extractUserId");Dr.extractUserId=IH;function TH(i){return typeof i=="string"?i:i.name}n(TH,"extractUserName");Dr.extractUserName=TH});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 Jc=Qc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return Jc.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return Jc.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return Jc.rawDataSymbol},"get")});var RH=bf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return RH.checkRelationAssertion},"get")});var UH=$c();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return UH.rtfm},"get")});var BH=xf();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return BH.HelixExtension},"get")});var OH=ro();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return OH.CustomError},"get")});var jH=wf();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return jH.HellFreezesOverError},"get")});var kH=Vc();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return kH.RelationAssertionError},"get")});var Sf=vf();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return Sf.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return Sf.extractUserName},"get")})});var Xc=u(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.HttpStatusCodeError=void 0;var MH=m(),Zc=class extends MH.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 mw=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=mw(e,a))||r.enumerable});return i};var x=i=>xw(es({},"__esModule",{value:!0}),i);var wr=u((eU,K_)=>{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}}};K_.exports=ku});var It=u((rU,J_)=>{J_.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((nU,Z_)=>{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}})}};Z_.exports=Mu});var ts=u((sU,X_)=>{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}};X_.exports=Fu});var Qu=u((lU,Y_)=>{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)}};Y_.exports=Nu});var Wu=u((cU,tm)=>{var Hw=wr(),em=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?em.FFZ.CDNAnimated(this.id,e):em.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})}};tm.exports=Gu});var $u=u((hU,rm)=>{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}}})}};rm.exports=Vu});var Ku=u((_U,im)=>{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}:{}})}};im.exports=zu});var Gm=u((yU,Qm)=>{"use strict";function xm(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(xm,"bind");var{toString:Aw}=Object.prototype,{getPrototypeOf:sc}=Object,{iterator:ls,toStringTag:wm}=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 vm=Ze("ArrayBuffer");function Dw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&vm(i.buffer),e}n(Dw,"isArrayBufferView");var Iw=cs("string"),Ce=cs("function"),Sm=cs("number"),_i=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=sc(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(wm in i)&&!(ls in i)},"isPlainObject"),Rw=n(i=>{if(!_i(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=>_i(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 mi(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(mi,"forEach");function Hm(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(Hm,"findKey");var er=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Cm=n(i=>!vr(i)&&i!==er,"isContextDefined");function Yu(){let{caseless:i,skipUndefined:e}=Cm(this)&&this||{},t={},r=n((a,s)=>{let o=i&&Hm(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]&&mi(arguments[a],r);return t}n(Yu,"merge");var Vw=n((i,e,t,{allOwnKeys:r}={})=>(mi(e,(a,s)=>{t&&Ce(a)?i[s]=xm(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&&sc(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(!Sm(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"&&sc(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"),nm=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),iv=Ze("RegExp"),qm=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};mi(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),nv=n(i=>{qm(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[wm]==="FormData"&&i[ls])}n(lv,"isSpecCompliantForm");var uv=n(i=>{let e=new Array(10),t=n((r,a)=>{if(_i(r)){if(e.indexOf(r)>=0)return;if(pi(r))return r;if(!("toJSON"in r)){e[a]=r;let s=Cr(r)?[]:{};return mi(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&&(_i(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),"isThenable"),Em=((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||Em,pv=n(i=>i!=null&&Ce(i[ls]),"isIterable"),_={isArray:Cr,isArrayBuffer:vm,isBuffer:pi,isFormData:Mw,isArrayBufferView:Dw,isString:Iw,isNumber:Sm,isBoolean:Tw,isObject:_i,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:mi,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:nm,hasOwnProp:nm,reduceDescriptors:qm,freezeMethods:nv,toObjectSet:av,toCamelCase:rv,noop:sv,toFiniteNumber:ov,findKey:Hm,global:er,isContextDefined:Cm,isSpecCompliantForm:lv,toJSONObject:uv,isAsyncFn:cv,isThenable:dv,setImmediate:Em,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");_.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:_.toJSONObject(this.config),code:this.code,status:this.status}},"toJSON")});var Pm=T.prototype,Am={};["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=>{Am[i]={value:i}});Object.defineProperties(T,Am);Object.defineProperty(Pm,"isAxiosError",{value:!0});T.from=(i,e,t,r,a,s)=>{let o=Object.create(Pm);_.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 _v=null;function ec(i){return _.isPlainObject(i)||_.isArray(i)}n(ec,"isVisitable");function Dm(i){return _.endsWith(i,"[]")?i.slice(0,-2):i}n(Dm,"removeBrackets");function am(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=Dm(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(am,"renderKey");function mv(i){return _.isArray(i)&&!i.some(ec)}n(mv,"isFlatArray");var yv=_.toFlatObject(_,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function ds(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(q,v){return!_.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)&&_.isSpecCompliantForm(e);if(!_.isFunction(a))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(_.isDate(y))return y.toISOString();if(_.isBoolean(y))return y.toString();if(!c&&_.isBlob(y))throw new T("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(y)||_.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(_.endsWith(q,"{}"))q=r?q:q.slice(0,-2),y=JSON.stringify(y);else if(_.isArray(y)&&mv(y)||(_.isFileList(y)||_.endsWith(q,"[]"))&&(B=_.toArray(y)))return q=Dm(q),B.forEach(n(function(z,k){!(_.isUndefined(z)||z===null)&&e.append(o===!0?am([q],k,s):o===null?q:q+"[]",h(z))},"each")),!1}return ec(y)?!0:(e.append(am(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(!_.isUndefined(y)){if(w.indexOf(y)!==-1)throw Error("Circular reference detected in "+q.join("."));w.push(y),_.forEach(y,n(function(B,ge){(!(_.isUndefined(B)||B===null)&&a.call(e,B,_.isString(ge)?ge.trim():ge,q,E))===!0&&P(B,q?q.concat(ge):[ge])},"each")),w.pop()}}if(n(P,"build"),!_.isObject(i))throw new TypeError("data must be an object");return P(i),e}n(ds,"toFormData");function sm(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(sm,"encode$1");function oc(i,e){this._pairs=[],i&&ds(i,this,e)}n(oc,"AxiosURLSearchParams");var Im=oc.prototype;Im.append=n(function(e,t){this._pairs.push([e,t])},"append");Im.toString=n(function(e){let t=e?function(r){return e.call(this,r,sm)}:sm;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 Tm(i,e,t){if(!e)return i;let r=t&&t.encode||fv;_.isFunction(t)&&(t={serialize:t});let a=t&&t.serialize,s;if(a?s=a(e,t):s=_.isURLSearchParams(e)?e.toString():new oc(e,t).toString(r),s){let o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}n(Tm,"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){_.forEach(this.handlers,n(function(r){r!==null&&e(r)},"forEachHandler"))}},om=tc,Rm={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gv=typeof URLSearchParams<"u"?URLSearchParams:oc,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"]},lc=typeof window<"u"&&typeof document<"u",rc=typeof navigator=="object"&&navigator||void 0,vv=lc&&(!rc||["ReactNative","NativeScript","NS"].indexOf(rc.product)<0),Sv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hv=lc&&window.location.href||"http://localhost",Cv=Object.freeze({__proto__:null,hasBrowserEnv:lc,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&&_.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}n(qv,"toURLEncodedForm");function Ev(i){return _.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 Um(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&&_.isArray(a)?a.length:o,c?(_.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]=Pv(a[o])),!l)}if(n(e,"buildPath"),_.isFormData(i)&&_.isFunction(i.entries)){let t={};return _.forEachEntry(i,(r,a)=>{e(Ev(r),a,t,0)}),t}return null}n(Um,"formDataToJSON");function Av(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(Av,"stringifySafely");var uc={transitional:Rm,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(Um(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 qv(e,this.formSerializer).toString();if((l=_.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||uc.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,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}}};_.forEach(["delete","get","head","post","put","patch"],i=>{uc.headers[i]={}});var cc=uc,Dv=_.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"),lm=Symbol("internals");function hi(i){return i&&String(i).trim().toLowerCase()}n(hi,"normalizeHeader");function ns(i){return i===!1||i==null?i:_.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(_.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(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=_.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=_.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)=>_.forEach(l,(h,p)=>s(h,p,c)),"setHeaders");if(_.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(_.isString(e)&&(e=e.trim())&&!Rv(e))o(Iv(e),t);else if(_.isObject(e)&&_.isIterable(e)){let l={},c,h;for(let p of e){if(!_.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[h=p[0]]=(c=l[h])?_.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=_.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return Tv(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=hi(e),e){let r=_.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=_.findKey(r,o);l&&(!t||Ju(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||Ju(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]=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 _.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[lm]=this[lm]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=hi(o);r[l]||(Bv(a,o),r[l]=!0)}return n(s,"defineAccessor"),_.isArray(e)?e.forEach(s):s(e),this}};Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(Sr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});_.freezeMethods(Sr);var Je=Sr;function Zu(i,e){let t=this||cc,r=e||t,a=Je.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 Bm(i){return!!(i&&i.__CANCEL__)}n(Bm,"isCancel");function qr(i,e,t){T.call(this,i??"canceled",T.ERR_CANCELED,e,t),this.name="CanceledError"}n(qr,"CanceledError");_.inherits(qr,T,{__CANCEL__:!0});function Om(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(Om,"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"),um=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),cm=n(i=>(...e)=>_.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){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 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 jm(i,e,t){let r=!Fv(e);return i&&(r||t==!1)?Nv(i,e):e}n(jm,"buildFullPath");var dm=n(i=>i instanceof Je?{...i}:i,"headersToObject");function tr(i,e){e=e||{};let t={};function r(h,p,w,E){return _.isPlainObject(h)&&_.isPlainObject(p)?_.merge.call({caseless:E},h,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,w,E){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h,w,E)}else return r(h,p,w,E)}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,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(dm(h),dm(p),w,!0),"headers")};return _.forEach(Object.keys({...i,...e}),n(function(p){let w=c[p]||a,E=w(i[p],e[p],p);_.isUndefined(E)&&w!==l||(t[p]=E)},"computeConfigValue")),t}n(tr,"mergeConfig");var km=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=Tm(jm(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),_.isFormData(t)){if(we.hasStandardBrowserEnv||we.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(_.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&&_.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=km(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};Om(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||Rm;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&&_.forEach(o.toJSON(),n(function(k,Ue){v.setRequestHeader(Ue,k)},"setRequestHeader")),_.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=()=>_.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"),hm=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"),pm=64*1024,{isFunction:rs}=_,Jv=(({Request:i,Response:e})=>({Request:i,Response:e}))(_.global),{ReadableStream:_m,TextEncoder:mm}=_.global,ym=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),Zv=n(i=>{i=_.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 mm=="function"?(y=>q=>y.encode(q))(new mm):async y=>new Uint8Array(await new t(y).arrayBuffer())),h=s&&l&&ym(()=>{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&&ym(()=>_.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(_.isBlob(y))return y.size;if(_.isSpecCompliantForm(y))return(await new t(we.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(_.isArrayBufferView(y)||_.isArrayBuffer(y))return y.byteLength;if(_.isURLSearchParams(y)&&(y=y+""),_.isString(y))return(await c(y)).byteLength},"getBodyLength"),P=n(async(y,q)=>{let v=_.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}=km(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(_.isFormData(B)&&(xr=Dt.headers.get("content-type"))&&di.setContentType(xr),Dt.body){let[ju,Ya]=um(O,os(cm(yt)));B=hm(Dt.body,pm,ju,Ya)}}_.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)),$_=p&&(J==="stream"||J==="response");if(p&&(Ue||$_&&$)){let Dt={};["status","statusText","headers"].forEach(z_=>{Dt[z_]=Le[z_]});let xr=_.toFiniteNumber(Le.headers.get("content-length")),[ju,Ya]=Ue&&um(xr,os(cm(Ue),!0))||[];Le=new r(hm(Le.body,pm,ju,()=>{Ya&&Ya(),$&&$()}),Dt)}J=J||"text";let _w=await w[_.findKey(w,J)||"text"](Le,y);return!$_&&$&&$(),await new Promise((Dt,xr)=>{Om(Dt,xr,{data:_w,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,Mm=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");Mm();var ic={http:_v,xhr:Gv,fetch:{get:Mm}};_.forEach(ic,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var fm=n(i=>`- ${i}`,"renderReason"),Yv=n(i=>_.isFunction(i)||i===null||i===!1,"isResolvedHandle"),Lm={getAdapter:n((i,e)=>{i=_.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=ic[(l=String(r)).toLowerCase()],a===void 0))throw new T(`Unknown adapter '${l}'`);if(a&&(_.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(fm).join(`
5
+ `):" "+fm(o[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a},"getAdapter"),adapters:ic};function Xu(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new qr(null,i)}n(Xu,"throwIfCancellationRequested");function gm(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),Lm.getAdapter(i.adapter||cc.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 Bm(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(gm,"dispatchRequest");var Fm="1.12.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 bm={};hs.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+Fm+"] 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&&!bm[o]&&(bm[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 eS(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(eS,"assertOptions");var as={assertOptions:eS,validators:hs},at=as.validators,Hr=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new om,response:new om}}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&&(_.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&&_.merge(s.common,s[t.method]);s&&_.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=[gm.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=gm.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=jm(e.baseURL,e.url,e.allowAbsoluteUrls);return Tm(t,e.params,e.paramsSerializer)}};_.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"));_.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,nc=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}}},tS=nc;function rS(i){return n(function(t){return i.apply(null,t)},"wrap")}n(rS,"spread");function iS(i){return _.isObject(i)&&i.isAxiosError===!0}n(iS,"isAxiosError");var ac={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(ac).forEach(([i,e])=>{ac[e]=i});var nS=ac;function Nm(i){let e=new ss(i),t=xm(ss.prototype.request,e);return _.extend(t,ss.prototype,e,{allOwnKeys:!0}),_.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return Nm(tr(i,a))},"create"),t}n(Nm,"createInstance");var ae=Nm(cc);ae.Axios=ss;ae.CanceledError=qr;ae.CancelToken=tS;ae.isCancel=Bm;ae.VERSION=Fm;ae.toFormData=ds;ae.AxiosError=T;ae.Cancel=ae.CanceledError;ae.all=n(function(e){return Promise.all(e)},"all");ae.spread=rS;ae.isAxiosError=iS;ae.mergeConfig=tr;ae.AxiosHeaders=Je;ae.formToJSON=i=>Um(_.isHTMLForm(i)?new FormData(i):i);ae.getAdapter=Lm.getAdapter;ae.HttpStatusCode=nS;ae.default=ae;Qm.exports=ae});var g={};bw(g,{__addDisposableResource:()=>my,__assign:()=>ps,__asyncDelegator:()=>oy,__asyncGenerator:()=>sy,__asyncValues:()=>ly,__await:()=>Er,__awaiter:()=>ey,__classPrivateFieldGet:()=>hy,__classPrivateFieldIn:()=>_y,__classPrivateFieldSet:()=>py,__createBinding:()=>ms,__decorate:()=>$m,__disposeResources:()=>yy,__esDecorate:()=>Km,__exportStar:()=>ry,__extends:()=>Wm,__generator:()=>ty,__importDefault:()=>dy,__importStar:()=>cy,__makeTemplateObject:()=>uy,__metadata:()=>Ym,__param:()=>zm,__propKey:()=>Zm,__read:()=>pc,__rest:()=>Vm,__rewriteRelativeImportExtension:()=>fy,__runInitializers:()=>Jm,__setFunctionName:()=>Xm,__spread:()=>iy,__spreadArray:()=>ay,__spreadArrays:()=>ny,__values:()=>_s,default:()=>oS});function Wm(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 Vm(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 $m(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 zm(i,e){return function(t,r){e(t,r,i)}}function Km(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 Jm(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 Zm(i){return typeof i=="symbol"?i:"".concat(i)}function Xm(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 Ym(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)&&ms(e,i,t)}function _s(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 _s=="function"?_s(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"&&ms(e,i,t[r]);return aS(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 _y(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 my(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 sS(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,ms,aS,hc,sS,oS,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(Wm,"__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(Vm,"__rest");n($m,"__decorate");n(zm,"__param");n(Km,"__esDecorate");n(Jm,"__runInitializers");n(Zm,"__propKey");n(Xm,"__setFunctionName");n(Ym,"__metadata");n(ey,"__awaiter");n(ty,"__generator");ms=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(_s,"__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");aS=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(_y,"__classPrivateFieldIn");n(my,"__addDisposableResource");sS=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");oS={__extends:Wm,__assign:ps,__rest:Vm,__decorate:$m,__param:zm,__esDecorate:Km,__runInitializers:Jm,__propKey:Zm,__setFunctionName:Xm,__metadata:Ym,__awaiter:ey,__generator:ty,__createBinding:ms,__exportStar:ry,__values:_s,__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:_y,__addDisposableResource:my,__disposeResources:yy,__rewriteRelativeImportExtension:fy}});var yi=u((bU,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 lS=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 uS(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(uS,"resolveLogLevel");Rt.resolveLogLevel=uS;var cS=lS.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]=cS.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 dS(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(dS,"Enumerable");ys.Enumerable=dS});var wy=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.flatten=void 0;var xy=(b(),x(g));function hS(i){var e;return(e=[]).concat.apply(e,xy.__spreadArray([],xy.__read(i),!1))}n(hS,"flatten");fs.flatten=hS});var vy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.immutableSplice=void 0;var Pr=(b(),x(g));function pS(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(pS,"immutableSplice");gs.immutableSplice=pS});var Sy=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.partitionedFlatMap=void 0;var _c=(b(),x(g));function _S(i,e,t){var r,a,s,o={};try{for(var l=_c.__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,_c.__spreadArray([],_c.__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 mS(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(mS,"resolveConfigValue");Ar.resolveConfigValue=mS;function yS(i){return typeof i=="function"?i():i}n(yS,"resolveConfigValueSync");Ar.resolveConfigValueSync=yS});var qy=u(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.deprecateClass=void 0;var mc=(b(),x(g));function fS(i,e){var t=!1;return(function(r){mc.__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,mc.__spreadArray([],mc.__read(s),!1))||this}return n(a,"class_1"),a})(i)}n(fS,"deprecateClass");xs.deprecateClass=fS});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 gS=n(function(i){return function(e){return i===e}},"eq");ir.eq=gS;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 bS(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(bS,"fibWithLimit");ws.fibWithLimit=bS});var Ss=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.arrayToObject=void 0;var Iy=(b(),x(g));function xS(i,e){return Object.assign.apply(Object,Iy.__spreadArray([{}],Iy.__read(i.map(e)),!1))}n(xS,"arrayToObject");vs.arrayToObject=xS});var Ty=u(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.entriesToObject=void 0;var wS=(b(),x(g)),vS=Ss();function SS(i){return(0,vS.arrayToObject)(i,function(e){var t,r=wS.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(SS,"entriesToObject");Hs.entriesToObject=SS});var Ry=u(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.forEachObjectEntry=void 0;var HS=(b(),x(g));function CS(i,e){Object.entries(i).forEach(function(t){var r=HS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(CS,"forEachObjectEntry");Cs.forEachObjectEntry=CS});var Uy=u(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.groupBy=void 0;var qS=(b(),x(g));function ES(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=qS.__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(ES,"groupBy");qs.groupBy=ES});var By=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.indexBy=void 0;var PS=Ss();function AS(i,e){if(typeof e!="function"){var t=e;e=n((function(r){return r[t].toString()}),"keyFn")}return(0,PS.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(AS,"indexBy");Es.indexBy=AS});var Oy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.mapObject=void 0;var fc=(b(),x(g));function DS(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(DS,"mapObject");Ps.mapObject=DS});var gc=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.pick=void 0;var As=(b(),x(g));function IS(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(IS,"pick");Ds.pick=IS});var jy=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.omit=void 0;var TS=gc();function RS(i,e){return(0,TS.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(RS,"omit");Is.omit=RS});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 US(i,e){return bc(i)?null:e(i)}n(US,"mapNullable");Ut.mapNullable=US;function BS(i,e){return bc(i)?void 0:e(i)}n(BS,"mapOptional");Ut.mapOptional=BS});var Ly=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.delay=void 0;var My=(b(),x(g));function OS(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(OS,"delay");Ts.delay=OS});var Fy=u(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.promiseWithResolvers=void 0;function jS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(jS,"promiseWithResolvers");Rs.promiseWithResolvers=jS});var Ny=u(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.padLeft=void 0;function kS(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(kS,"padLeft");Us.padLeft=kS});var Qy=u(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.splitWithLimit=void 0;var xc=(b(),x(g));function MS(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(MS,"splitWithLimit");Bs.splitWithLimit=MS});var Gy=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.utf8Substring=Dr.utf8Length=void 0;var Os=(b(),x(g));function LS(i){return Os.__spreadArray([],Os.__read(i),!1).length}n(LS,"utf8Length");Dr.utf8Length=LS;function FS(i,e,t){return Os.__spreadArray([],Os.__read(i),!1).slice(e,t).join("")}n(FS,"utf8Substring");Dr.utf8Substring=FS});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 NS=by();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return NS.Enumerable},"get")});var QS=wy();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return QS.flatten},"get")});var GS=vy();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return GS.immutableSplice},"get")});var WS=Sy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return WS.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 VS=qy();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return VS.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 $S=Dy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return $S.fibWithLimit},"get")});var zS=Ss();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return zS.arrayToObject},"get")});var KS=Ty();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return KS.entriesToObject},"get")});var JS=Ry();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return JS.forEachObjectEntry},"get")});var ZS=Uy();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return ZS.groupBy},"get")});var XS=By();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return XS.indexBy},"get")});var YS=Oy();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return YS.mapObject},"get")});var e0=jy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return e0.omit},"get")});var t0=gc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return t0.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 r0=Ly();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return r0.delay},"get")});var i0=Fy();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return i0.promiseWithResolvers},"get")});var n0=Ny();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return n0.padLeft},"get")});var a0=Qy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return a0.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 s0=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,s0.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 o0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(o0,"isPrefix");function l0(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(o0(e,s))return o}return zy}n(l0,"getMinLogLevelFromEnv");ks.getMinLogLevelFromEnv=l0});var qc=u(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.BaseLogger=void 0;var u0=C(),c0=yi(),d0=Cc(),Bt=rr(),h0=(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?c0.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,u0.mapOptional)(r,function(w){return(0,Bt.resolveLogLevel)(w)}))!==null&&h!==void 0?h:(0,d0.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=h0});var Ky=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.BrowserLogger=void 0;var p0=(b(),x(g)),_0=rr(),m0=qc(),y0=(function(i){p0.__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})(m0.BaseLogger);Ls.BrowserLogger=y0});var Jy=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.CustomLoggerWrapper=void 0;var f0=C(),g0=Cc(),Be=rr(),b0=(function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,f0.mapOptional)(r,function(o){return(0,Be.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,g0.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=b0});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 x0=(b(),x(g)),ne=rr(),w0=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 v0={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},S0={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(v0[i],39)}n(st,"createColorWrapper");function fi(i,e){return Ns(S0[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 H0=(function(i){x0.__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})(w0.BaseLogger);Ee.NodeLogger=H0});var Xy=u(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.createLogger=void 0;var C0=yi(),q0=Ky(),E0=Jy(),P0=Zy();function A0(i){return i.custom?new E0.CustomLoggerWrapper(i):C0.isNode?new P0.NodeLogger(i):new q0.BrowserLogger(i)}n(A0,"createLogger");Qs.createLogger=A0});var gi=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.LogLevel=Ir.createLogger=void 0;var D0=Xy();Object.defineProperty(Ir,"createLogger",{enumerable:!0,get:n(function(){return D0.createLogger},"get")});var I0=rr();Object.defineProperty(Ir,"LogLevel",{enumerable:!0,get:n(function(){return I0.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 T0=Ws(),Pc=class extends T0.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 R0=Ws(),Ac=class extends R0.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 U0=Ws(),Dc=class extends U0.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 B0=gi(),O0=C(),j0=bi(),ef=Ic(),Rc=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,B0.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,O0.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 j0.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 k0=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 k0.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 M0=gi(),L0=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,M0.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 L0.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 F0=gi(),N0=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,F0.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 N0.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 Q0=kc(),Mc=class extends Q0.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 G0=$s();Object.defineProperty(se,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return G0.RateLimiterDestroyedError},"get")});var W0=bi();Object.defineProperty(se,"RateLimitReachedError",{enumerable:!0,get:n(function(){return W0.RateLimitReachedError},"get")});var V0=Ic();Object.defineProperty(se,"RetryAfterError",{enumerable:!0,get:n(function(){return V0.RetryAfterError},"get")});var $0=Yy();Object.defineProperty(se,"NullRateLimiter",{enumerable:!0,get:n(function(){return $0.NullRateLimiter},"get")});var z0=tf();Object.defineProperty(se,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return z0.PartitionedRateLimiter},"get")});var K0=nf();Object.defineProperty(se,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return K0.PartitionedTimeBasedRateLimiter},"get")});var J0=Uc();Object.defineProperty(se,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return J0.ResponseBasedRateLimiter},"get")});var Z0=kc();Object.defineProperty(se,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return Z0.TimeBasedRateLimiter},"get")});var X0=sf();Object.defineProperty(se,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return X0.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((ZB,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})(),Y0=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"),eH=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"),tH=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),rH=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"),iH=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"),nH=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 Y0(t),e},"compact"),aH=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),sH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),oH=n(function(e,t){return[].concat(e,t)},"combine");df.exports={arrayToObject:cf,assign:tH,combine:oH,compact:nH,decode:rH,encode:iH,isBuffer:sH,isRegExp:aH,merge:eH}});var Fc=u((YB,pf)=>{"use strict";var lH=String.prototype.replace,uH=/%20/g,cH=no(),hf={RFC1738:"RFC1738",RFC3986:"RFC3986"};pf.exports=cH.assign({default:hf.RFC3986,formatters:{RFC1738:n(function(i){return lH.call(i,uH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},hf)});var gf=u((tO,ff)=>{"use strict";var yf=no(),xi=Fc(),dH=Object.prototype.hasOwnProperty,_f={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,hH=Array.prototype.push,Nc=n(function(i,e){hH.apply(i,Ur(e)?e:[e])},"pushToArray"),pH=Date.prototype.toISOString,mf=xi.default,ve={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:yf.encode,encodeValuesOnly:!1,format:mf,formatter:xi.formatters[mf],indices:!1,serializeDate:n(function(e){return pH.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"),mH=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"),yH=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(!dH.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=yH(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 _f?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var c=_f[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,mH(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((iO,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},fH=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"),gH=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"),bH="utf8=%26%2310003%3B",xH="utf8=%E2%9C%93",wH=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]===xH?h="utf-8":o[c]===bH&&(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=gH(xf(p.slice(E+1),t),function(q){return t.decoder(q,be.decoder,h,"value")})),y&&t.interpretNumericEntities&&h==="iso-8859-1"&&(y=fH(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"),vH=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"),SH=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)+"]"),vH(p,t,r,a)}},"parseQueryStringKeys"),HH=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=HH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?wH(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],c=SH(l,r[l],t,typeof i=="string");a=wi.merge(a,c,t)}return wi.compact(a)}});var Gc=u((aO,Sf)=>{"use strict";var CH=gf(),qH=vf(),EH=Fc();Sf.exports={formats:EH,parse:qH,stringify:CH}});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 PH=Cf();lt.rawDataSymbol=Symbol("twurpleRawData");function AH(i){return(0,PH.klona)(i[lt.rawDataSymbol])}n(AH,"getRawData");lt.getRawData=AH;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 DH=so(),zc=class extends DH.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 IH=Kc();function TH(i){if(i==null)throw new IH.RelationAssertionError;return i}n(TH,"checkRelationAssertion");lo.checkRelationAssertion=TH});var Jc=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.rtfm=void 0;function RH(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(RH,"rtfm");uo.rtfm=RH});var Ef=u(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.HelixExtension=void 0;var UH=(b(),x(g)),D=Vc(),BH=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=UH.__decorate([(0,BH.rtfm)("api","HelixExtension","id")],Zc)});var Pf=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.HellFreezesOverError=void 0;var OH=so(),Xc=class extends OH.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 jH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(jH,"extractUserId");Br.extractUserId=jH;function kH(i){return typeof i=="string"?i:i.name}n(kH,"extractUserName");Br.extractUserName=kH});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 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 MH=qf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return MH.checkRelationAssertion},"get")});var LH=Jc();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return LH.rtfm},"get")});var FH=Ef();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return FH.HelixExtension},"get")});var NH=so();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return NH.CustomError},"get")});var QH=Pf();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return QH.HellFreezesOverError},"get")});var GH=Kc();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return GH.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 WH=m(),ed=class extends WH.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}};oo.HttpStatusCodeError=Zc});var Yc=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.transformTwitchApiResponse=Ir.handleTwitchApiResponseError=void 0;var LH=Fc(),FH=Xc();async function NH(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,LH.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new FH.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(NH,"handleTwitchApiResponseError");Ir.handleTwitchApiResponseError=NH;async function QH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(QH,"transformTwitchApiResponse");Ir.transformTwitchApiResponse=QH});var Hf=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.getTwitchApiUrl=void 0;function GH(i,e,t){switch(e){case"helix":{let r=i.replace(/^\//,"");return t?r==="eventsub/subscriptions"?`http://localhost:${t}/${r}`:`http://localhost:${t}/mock/${r}`:`https://api.twitch.tv/helix/${r}`}case"auth":return`https://id.twitch.tv/oauth2/${i.replace(/^\//,"")}`;case"custom":return i;default:return i}}n(GH,"getTwitchApiUrl");lo.getTwitchApiUrl=GH});var Pf=u(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callTwitchApi=Tr.callTwitchApiRaw=void 0;var Cf=tf(),WH=Fc(),qf=Yc(),VH=Hf();async function Ef(i,e,t,r,a={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",h=(0,VH.getTwitchApiUrl)(i.url,d,s),p=(0,WH.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),x=new Cf.Headers({Accept:"application/json"}),E;i.jsonBody&&(E=JSON.stringify(i.jsonBody),x.append("Content-Type","application/json")),e&&d!=="auth"&&x.append("Client-ID",e),t&&x.append("Authorization",`${d==="helix"?r??"Bearer":"OAuth"} ${t}`);let q={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:x,body:E};return await(0,Cf.default)(`${h}${p}`,q)}n(Ef,"callTwitchApiRaw");Tr.callTwitchApiRaw=Ef;async function $H(i,e,t,r,a={}){let s=await Ef(i,e,t,r,a);return await(0,qf.handleTwitchApiResponseError)(s,i),await(0,qf.transformTwitchApiResponse)(s)}n($H,"callTwitchApi");Tr.callTwitchApi=$H});var Af=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.createBroadcasterQuery=void 0;var zH=m();function KH(i){return{broadcaster_id:(0,zH.extractUserId)(i)}}n(KH,"createBroadcasterQuery");uo.createBroadcasterQuery=KH});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 Df=Pf();Object.defineProperty(Pe,"callTwitchApi",{enumerable:!0,get:n(function(){return Df.callTwitchApi},"get")});Object.defineProperty(Pe,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return Df.callTwitchApiRaw},"get")});var JH=Af();Object.defineProperty(Pe,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return JH.createBroadcasterQuery},"get")});var If=Yc();Object.defineProperty(Pe,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return If.handleTwitchApiResponseError},"get")});Object.defineProperty(Pe,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return If.transformTwitchApiResponse},"get")});var ZH=Xc();Object.defineProperty(Pe,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return ZH.HttpStatusCodeError},"get")})});var td=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.ConfigError=void 0;var XH=m(),ed=class extends XH.CustomError{static{n(this,"ConfigError")}};co.ConfigError=ed});var Tf=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.HelixRateLimiter=void 0;var YH=Xs(),eC=Z(),rd=class extends YH.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,eC.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}}};ho.HelixRateLimiter=rd});var fi=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.createCacheKey=void 0;function tC(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(tC,"createSingleCacheKey");function rC(i,e,t){return[i,...e.map(tC)].join("/")+(t?"/":"")}n(rC,"createCacheKey");po.createCacheKey=rC});var Rf=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.Cacheable=void 0;var iC=fi(),ft=Symbol("cache");function nC(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,iC.createCacheKey)(s,r,a)}}},e=ft,t}n(nC,"Cacheable");mo.Cacheable=nC});var Uf=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.Cached=void 0;var aC=fi();function sC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,aC.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(sC,"Cached");_o.Cached=sC});var Bf=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.CachedGetter=void 0;var oC=fi();function lC(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,oC.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(lC,"CachedGetter");yo.CachedGetter=lC});var Of=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.ClearsCache=void 0;function uC(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(uC,"ClearsCache");fo.ClearsCache=uC});var gi=u(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.createCacheKey=ke.ClearsCache=ke.CachedGetter=ke.Cached=ke.Cacheable=void 0;var cC=Rf();Object.defineProperty(ke,"Cacheable",{enumerable:!0,get:n(function(){return cC.Cacheable},"get")});var dC=Uf();Object.defineProperty(ke,"Cached",{enumerable:!0,get:n(function(){return dC.Cached},"get")});var hC=Bf();Object.defineProperty(ke,"CachedGetter",{enumerable:!0,get:n(function(){return hC.CachedGetter},"get")});var pC=Of();Object.defineProperty(ke,"ClearsCache",{enumerable:!0,get:n(function(){return pC.ClearsCache},"get")});var mC=fi();Object.defineProperty(ke,"createCacheKey",{enumerable:!0,get:n(function(){return mC.createCacheKey},"get")})});var nd=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.Listener=void 0;var id=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)}};go.Listener=id});var jf=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.EventEmitter=void 0;var _C=nd(),ad=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 _C.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)}}};bo.EventEmitter=ad});var sd=u(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Listener=Rr.EventEmitter=void 0;var yC=jf();Object.defineProperty(Rr,"EventEmitter",{enumerable:!0,get:n(function(){return yC.EventEmitter},"get")});var fC=nd();Object.defineProperty(Rr,"Listener",{enumerable:!0,get:n(function(){return fC.Listener},"get")})});var xo=u(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.accessTokenIsExpired=Ur.getExpiryDateOfAccessToken=void 0;var od=C(),gC=6e4;function kf(i){return(0,od.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-gC)}n(kf,"getExpiryMillis");function bC(i){return(0,od.mapNullable)(kf(i),e=>new Date(e))}n(bC,"getExpiryDateOfAccessToken");Ur.getExpiryDateOfAccessToken=bC;function xC(i){var e;return(e=(0,od.mapNullable)(kf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(xC,"accessTokenIsExpired");Ur.accessTokenIsExpired=xC});var vo=u(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.InvalidTokenError=void 0;var wC=m(),ld=class extends wC.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};wo.InvalidTokenError=ld});var Ho=u(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.InvalidTokenTypeError=void 0;var vC=m(),ud=class extends vC.CustomError{static{n(this,"InvalidTokenTypeError")}};So.InvalidTokenTypeError=ud});var Mf=u(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.createRevokeTokenQuery=lt.createRefreshTokenQuery=lt.createGetAppTokenQuery=lt.createExchangeCodeQuery=void 0;function SC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(SC,"createExchangeCodeQuery");lt.createExchangeCodeQuery=SC;function HC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(HC,"createGetAppTokenQuery");lt.createGetAppTokenQuery=HC;function CC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(CC,"createRefreshTokenQuery");lt.createRefreshTokenQuery=CC;function qC(i,e){return{client_id:i,token:e}}n(qC,"createRevokeTokenQuery");lt.createRevokeTokenQuery=qC});var dd=u(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.TokenInfo=void 0;var EC=(f(),b(y)),PC=C(),Yt=m(),cd=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,PC.mapNullable)(this[Yt.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};bi.TokenInfo=cd;bi.TokenInfo=cd=EC.__decorate([(0,Yt.rtfm)("auth","TokenInfo","clientId")],cd)});var wi=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(),xi=vo(),AC=Ho(),Co=Mf(),DC=dd();function hd(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(hd,"createAccessTokenFromData");async function IC(i,e,t,r){return hd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Co.createExchangeCodeQuery)(i,e,t,r)}))}n(IC,"exchangeCode");X.exchangeCode=IC;async function TC(i,e){return hd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Co.createGetAppTokenQuery)(i,e)}))}n(TC,"getAppToken");X.getAppToken=TC;async function RC(i,e,t){return hd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Co.createRefreshTokenQuery)(i,e,t)}))}n(RC,"refreshUserToken");X.refreshUserToken=RC;async function UC(i,e){await(0,Br.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,Co.createRevokeTokenQuery)(i,e)})}n(UC,"revokeToken");X.revokeToken=UC;async function Or(i,e){try{let t=await(0,Br.callTwitchApi)({type:"auth",url:"validate"},e,i);return new DC.TokenInfo(t)}catch(t){throw t instanceof Br.HttpStatusCodeError&&t.statusCode===401?new xi.InvalidTokenError({cause:t}):t}}n(Or,"getTokenInfo");X.getTokenInfo=Or;async function BC(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 xi.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 xi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(BC,"getValidTokenFromProviderForUser");X.getValidTokenFromProviderForUser=BC;async function OC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new AC.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 xi.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 xi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(OC,"getValidTokenFromProviderForIntent");X.getValidTokenFromProviderForIntent=OC;var jC=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 Lf(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=jC.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 VH=Gc(),$H=td();async function zH(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,VH.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new $H.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(zH,"handleTwitchApiResponseError");Or.handleTwitchApiResponseError=zH;async function KH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(KH,"transformTwitchApiResponse");Or.transformTwitchApiResponse=KH});var If=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.getTwitchApiUrl=void 0;function JH(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(JH,"getTwitchApiUrl");po.getTwitchApiUrl=JH});var Bf=u(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callTwitchApi=jr.callTwitchApiRaw=void 0;var Tf=uf(),ZH=Gc(),Rf=rd(),XH=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,XH.getTwitchApiUrl)(i.url,c,s),p=(0,ZH.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 YH(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(YH,"callTwitchApi");jr.callTwitchApi=YH});var Of=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.createBroadcasterQuery=void 0;var eC=m();function tC(i){return{broadcaster_id:(0,eC.extractUserId)(i)}}n(tC,"createBroadcasterQuery");_o.createBroadcasterQuery=tC});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 rC=Of();Object.defineProperty(Pe,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return rC.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 iC=td();Object.defineProperty(Pe,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return iC.HttpStatusCodeError},"get")})});var nd=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.ConfigError=void 0;var nC=m(),id=class extends nC.CustomError{static{n(this,"ConfigError")}};mo.ConfigError=id});var Mf=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.HelixRateLimiter=void 0;var aC=ro(),sC=Y(),ad=class extends aC.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,sC.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 oC(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(oC,"createSingleCacheKey");function lC(i,e,t){return[i,...e.map(oC)].join("/")+(t?"/":"")}n(lC,"createCacheKey");fo.createCacheKey=lC});var Lf=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.Cacheable=void 0;var uC=Si(),bt=Symbol("cache");function cC(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,uC.createCacheKey)(s,r,a)}}},e=bt,t}n(cC,"Cacheable");go.Cacheable=cC});var Ff=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.Cached=void 0;var dC=Si();function hC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,dC.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(hC,"Cached");bo.Cached=hC});var Nf=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.CachedGetter=void 0;var pC=Si();function _C(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,pC.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 mC(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(mC,"ClearsCache");wo.ClearsCache=mC});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 yC=Lf();Object.defineProperty(Fe,"Cacheable",{enumerable:!0,get:n(function(){return yC.Cacheable},"get")});var fC=Ff();Object.defineProperty(Fe,"Cached",{enumerable:!0,get:n(function(){return fC.Cached},"get")});var gC=Nf();Object.defineProperty(Fe,"CachedGetter",{enumerable:!0,get:n(function(){return gC.CachedGetter},"get")});var bC=Qf();Object.defineProperty(Fe,"ClearsCache",{enumerable:!0,get:n(function(){return bC.ClearsCache},"get")});var xC=Si();Object.defineProperty(Fe,"createCacheKey",{enumerable:!0,get:n(function(){return xC.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 wC=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 wC.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 vC=Gf();Object.defineProperty(kr,"EventEmitter",{enumerable:!0,get:n(function(){return vC.EventEmitter},"get")});var SC=od();Object.defineProperty(kr,"Listener",{enumerable:!0,get:n(function(){return SC.Listener},"get")})});var Ho=u(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.accessTokenIsExpired=Mr.getExpiryDateOfAccessToken=void 0;var cd=C(),HC=6e4;function Wf(i){return(0,cd.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-HC)}n(Wf,"getExpiryMillis");function CC(i){return(0,cd.mapNullable)(Wf(i),e=>new Date(e))}n(CC,"getExpiryDateOfAccessToken");Mr.getExpiryDateOfAccessToken=CC;function qC(i){var e;return(e=(0,cd.mapNullable)(Wf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(qC,"accessTokenIsExpired");Mr.accessTokenIsExpired=qC});var qo=u(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.InvalidTokenError=void 0;var EC=m(),dd=class extends EC.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 PC=m(),hd=class extends PC.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 AC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(AC,"createExchangeCodeQuery");ut.createExchangeCodeQuery=AC;function DC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(DC,"createGetAppTokenQuery");ut.createGetAppTokenQuery=DC;function IC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(IC,"createRefreshTokenQuery");ut.createRefreshTokenQuery=IC;function TC(i,e){return{client_id:i,token:e}}n(TC,"createRevokeTokenQuery");ut.createRevokeTokenQuery=TC});var _d=u(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.TokenInfo=void 0;var RC=(b(),x(g)),UC=C(),nr=m(),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,UC.mapNullable)(this[nr.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};Ci.TokenInfo=pd;Ci.TokenInfo=pd=RC.__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(),BC=Po(),Ao=Vf(),OC=_d();function md(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(md,"createAccessTokenFromData");async function jC(i,e,t,r){return md(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ao.createExchangeCodeQuery)(i,e,t,r)}))}n(jC,"exchangeCode");ee.exchangeCode=jC;async function kC(i,e){return md(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ao.createGetAppTokenQuery)(i,e)}))}n(kC,"getAppToken");ee.getAppToken=kC;async function MC(i,e,t){return md(await(0,Lr.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,Ao.createRefreshTokenQuery)(i,e,t)}))}n(MC,"refreshUserToken");ee.refreshUserToken=MC;async function LC(i,e){await(0,Lr.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,Ao.createRevokeTokenQuery)(i,e)})}n(LC,"revokeToken");ee.revokeToken=LC;async function Fr(i,e){try{let t=await(0,Lr.callTwitchApi)({type:"auth",url:"validate"},e,i);return new OC.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 FC(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(FC,"getValidTokenFromProviderForUser");ee.getValidTokenFromProviderForUser=FC;async function NC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new BC.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(NC,"getValidTokenFromProviderForIntent");ee.getValidTokenFromProviderForIntent=NC;var QC=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=QC.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(Lf,"compareScopes");X.compareScopes=Lf;function Ff(i,e){for(let t of e)Lf(i,t)}n(Ff,"compareScopeSets");X.compareScopeSets=Ff;async function kC(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&&Ff(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(kC,"loadAndCompareTokenInfo");X.loadAndCompareTokenInfo=kC});var Eo=u(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.TokenFetcher=void 0;var Nf=C(),pd=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,Nf.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,Nf.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}};qo.TokenFetcher=pd});var Gf=u(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.AppTokenAuthProvider=void 0;var Po=(f(),b(y)),md=C(),Qf=m(),MC=xo(),LC=wi(),FC=Eo(),jr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new FC.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,Qf.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,MC.accessTokenIsExpired)(this._token)?this._token=await(0,LC.getAppToken)(this._clientId,this._clientSecret):this._token}};vi.AppTokenAuthProvider=jr;Po.__decorate([(0,md.Enumerable)(!1)],jr.prototype,"_clientSecret",void 0);Po.__decorate([(0,md.Enumerable)(!1)],jr.prototype,"_token",void 0);Po.__decorate([(0,md.Enumerable)(!1)],jr.prototype,"_fetcher",void 0);vi.AppTokenAuthProvider=jr=Po.__decorate([(0,Qf.rtfm)("auth","AppTokenAuthProvider","clientId")],jr)});var yd=u(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.CachedRefreshFailureError=void 0;var NC=m(),_d=class extends NC.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 GC(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(GC,"loadAndCompareTokenInfo");ee.loadAndCompareTokenInfo=GC});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=m(),WC=Ho(),VC=Ei(),$C=Io(),Nr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new $C.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,WC.accessTokenIsExpired)(this._token)?this._token=await(0,VC.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 zC=m(),gd=class extends zC.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}};Ao.CachedRefreshFailureError=_d});var gd=u(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.IntermediateUserRemovalError=void 0;var QC=m(),fd=class extends QC.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 KC=m(),xd=class extends KC.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}};Do.IntermediateUserRemovalError=fd});var xd=u(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.UnknownIntentError=void 0;var GC=m(),bd=class extends GC.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};Io.UnknownIntentError=bd});var $f=u(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.RefreshingAuthProvider=void 0;var kr=(f(),b(y)),Si=C(),WC=sd(),Me=m(),wd=xo(),Wf=yd(),VC=gd(),vd=vo(),$C=Ho(),zC=xd(),ut=wi(),Vf=Eo(),Ut=class extends WC.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 Vf.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 Vf.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,wd.accessTokenIsExpired)(e))try{let l=await(0,ut.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof vd.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new vd.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 $C.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 Wf.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 zC.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 Wf.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 VC.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,wd.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 vd.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,wd.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,ut.getAppToken)(this._clientId,this._clientSecret)}};Hi.RefreshingAuthProvider=Ut;kr.__decorate([(0,Si.Enumerable)(!1)],Ut.prototype,"_clientSecret",void 0);kr.__decorate([(0,Si.Enumerable)(!1)],Ut.prototype,"_userAccessTokens",void 0);kr.__decorate([(0,Si.Enumerable)(!1)],Ut.prototype,"_userTokenFetchers",void 0);kr.__decorate([(0,Si.Enumerable)(!1)],Ut.prototype,"_appAccessToken",void 0);kr.__decorate([(0,Si.Enumerable)(!1)],Ut.prototype,"_appTokenFetcher",void 0);Hi.RefreshingAuthProvider=Ut=kr.__decorate([(0,Me.rtfm)("auth","RefreshingAuthProvider","clientId")],Ut)});var Kf=u(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.StaticAuthProvider=void 0;var Sd=(f(),b(y)),zf=C(),KC=m(),JC=wi(),Ci=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,JC.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};qi.StaticAuthProvider=Ci;Sd.__decorate([(0,zf.Enumerable)(!1)],Ci.prototype,"_clientId",void 0);Sd.__decorate([(0,zf.Enumerable)(!1)],Ci.prototype,"_accessToken",void 0);qi.StaticAuthProvider=Ci=Sd.__decorate([(0,KC.rtfm)("auth","StaticAuthProvider","clientId")],Ci)});var Hd=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 Jf=xo();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return Jf.accessTokenIsExpired},"get")});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return Jf.getExpiryDateOfAccessToken},"get")});var er=wi();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 ZC=Eo();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:n(function(){return ZC.TokenFetcher},"get")});var XC=dd();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:n(function(){return XC.TokenInfo},"get")});var YC=Gf();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return YC.AppTokenAuthProvider},"get")});var eq=$f();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return eq.RefreshingAuthProvider},"get")});var tq=Kf();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:n(function(){return tq.StaticAuthProvider},"get")});var rq=yd();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return rq.CachedRefreshFailureError},"get")});var iq=gd();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return iq.IntermediateUserRemovalError},"get")});var nq=vo();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:n(function(){return nq.InvalidTokenError},"get")});var aq=Ho();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return aq.InvalidTokenTypeError},"get")});var sq=xd();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:n(function(){return sq.UnknownIntentError},"get")})});var Xf=u((Rj,Zf)=>{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");Zf.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 Yf=u(tr=>{var oq=Xf();tr.operation=function(i){var e=tr.timeouts(i);return new oq(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(E){h.retry(E)||(E&&(arguments[0]=h.mainError()),x.apply(this,arguments))}),h.attempt(function(){d.apply(i,p)})},"retryWrapper").bind(i,o),i[s].options=e}}});var tg=u((jj,eg)=>{eg.exports=Yf()});var rg=u(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.createBitsLeaderboardQuery=void 0;function lq(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(lq,"createBitsLeaderboardQuery");To.createBitsLeaderboardQuery=lq});var Q=u(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.BaseApi=void 0;var uq=(f(),b(y)),cq=C(),Ro=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}};Uo.BaseApi=Ro;uq.__decorate([(0,cq.Enumerable)(!1)],Ro.prototype,"_client",void 0)});var Cd=u(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.HelixBitsLeaderboardEntry=void 0;var ig=(f(),b(y)),dq=C(),gt=m(),Bo=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))}};Ei.HelixBitsLeaderboardEntry=Bo;ig.__decorate([(0,dq.Enumerable)(!1)],Bo.prototype,"_client",void 0);Ei.HelixBitsLeaderboardEntry=Bo=ig.__decorate([(0,gt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Bo)});var Ed=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.HelixBitsLeaderboard=void 0;var qd=(f(),b(y)),ng=gi(),hq=C(),Oo=m(),pq=Cd(),Pi=class extends Oo.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[Oo.rawDataSymbol].data.map(e=>new pq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[Oo.rawDataSymbol].total}};Ai.HelixBitsLeaderboard=Pi;qd.__decorate([(0,hq.Enumerable)(!1)],Pi.prototype,"_client",void 0);qd.__decorate([(0,ng.CachedGetter)()],Pi.prototype,"entries",null);Ai.HelixBitsLeaderboard=Pi=qd.__decorate([ng.Cacheable,(0,Oo.rtfm)("api","HelixBitsLeaderboard")],Pi)});var Ad=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.HelixCheermoteList=void 0;var mq=(f(),b(y)),_q=C(),Di=m(),Pd=class extends Di.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,_q.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[Di.rawDataSymbol][e],d=l.sort((h,p)=>p.min_bits-h.min_bits).find(h=>h.min_bits<=t);if(!d)throw new Di.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[Di.rawDataSymbol])}};Ii.HelixCheermoteList=Pd;Ii.HelixCheermoteList=Pd=mq.__decorate([(0,Di.rtfm)("api","HelixCheermoteList")],Pd)});var Td=u(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.HelixBitsApi=void 0;var yq=(f(),b(y)),ag=C(),fq=Z(),Dd=m(),gq=rg(),bq=Q(),xq=Ed(),wq=Ad(),Id=class extends bq.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Dd.extractUserId)(e),scopes:["bits:read"],query:(0,gq.createBitsLeaderboardQuery)(t)});return new xq.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,ag.mapOptional)(e,Dd.extractUserId),query:(0,ag.mapOptional)(e,fq.createBroadcasterQuery)});return new wq.HelixCheermoteList(t.data)}};Ti.HelixBitsApi=Id;Ti.HelixBitsApi=Id=yq.__decorate([(0,Dd.rtfm)("api","HelixBitsApi")],Id)});var og=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createFollowedChannelQuery=Fe.createChannelFollowerQuery=Fe.createChannelVipUpdateQuery=Fe.createChannelCommercialBody=Fe.createChannelUpdateBody=void 0;var sg=C(),rr=m();function vq(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(vq,"createChannelUpdateBody");Fe.createChannelUpdateBody=vq;function Sq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),length:e}}n(Sq,"createChannelCommercialBody");Fe.createChannelCommercialBody=Sq;function Hq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),user_id:(0,rr.extractUserId)(e)}}n(Hq,"createChannelVipUpdateQuery");Fe.createChannelVipUpdateQuery=Hq;function Cq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),user_id:(0,sg.mapOptional)(e,rr.extractUserId)}}n(Cq,"createChannelFollowerQuery");Fe.createChannelFollowerQuery=Cq;function qq(i,e){return{broadcaster_id:(0,sg.mapOptional)(e,rr.extractUserId),user_id:(0,rr.extractUserId)(i)}}n(qq,"createFollowedChannelQuery");Fe.createFollowedChannelQuery=qq});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 jo=m();function Eq(i,e){return{[i]:e}}n(Eq,"createSingleKeyQuery");Ne.createSingleKeyQuery=Eq;function Pq(i){return{user_id:(0,jo.extractUserId)(i)}}n(Pq,"createUserQuery");Ne.createUserQuery=Pq;function Aq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Aq,"createModeratorActionQuery");Ne.createModeratorActionQuery=Aq;function Dq(i,e){return{broadcaster_id:(0,jo.extractUserId)(i),id:e}}n(Dq,"createGetByIdsQuery");Ne.createGetByIdsQuery=Dq;function Iq(i,e){return{broadcaster_id:(0,jo.extractUserId)(i),user_id:e.map(jo.extractUserId)}}n(Iq,"createChannelUsersCheckQuery");Ne.createChannelUsersCheckQuery=Iq});var Mo=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.HelixUserRelation=void 0;var lg=(f(),b(y)),Tq=C(),ir=m(),ko=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))}};Ri.HelixUserRelation=ko;lg.__decorate([(0,Tq.Enumerable)(!1)],ko.prototype,"_client",void 0);Ri.HelixUserRelation=ko=lg.__decorate([(0,ir.rtfm)("api","HelixUserRelation","id")],ko)});var Bt=u(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.HelixRequestBatcher=void 0;var Rq=(f(),b(y)),Rd=C(),Lo=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,Rd.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,Rd.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}})}};Fo.HelixRequestBatcher=Lo;Rq.__decorate([(0,Rd.Enumerable)(!1)],Lo.prototype,"_client",void 0)});var ae=u(Ui=>{"use strict";var Ud;Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixPaginatedRequest=void 0;var ug=(f(),b(y)),Uq=C(),Bq=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Ud=Symbol.asyncIterator)!==null&&Ud!==void 0?Ud:Symbol.for("Symbol.asyncIterator"));var No=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]},[])}};Ui.HelixPaginatedRequest=No;ug.__decorate([(0,Uq.Enumerable)(!1)],No.prototype,"_client",void 0);Ui.HelixPaginatedRequest=No=ug.__decorate([(0,Bq.rtfm)("api","HelixPaginatedRequest")],No)});var Mr=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixPaginatedRequestWithTotal=void 0;var Oq=(f(),b(y)),jq=m(),kq=ae(),Bd=class extends kq.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}};Bi.HelixPaginatedRequestWithTotal=Bd;Bi.HelixPaginatedRequestWithTotal=Bd=Oq.__decorate([(0,jq.rtfm)("api","HelixPaginatedRequestWithTotal")],Bd)});var ce=u(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.createPaginatedResultWithTotal=Lr.createPaginatedResult=void 0;function Mq(i,e,t){var r;let a;return{get data(){var s,o;return a??(a=(o=(s=i.data)===null||s===void 0?void 0:s.map(l=>new e(l,t)))!==null&&o!==void 0?o:[])},cursor:typeof i.pagination=="string"?i.pagination:(r=i.pagination)===null||r===void 0?void 0:r.cursor}}n(Mq,"createPaginatedResult");Lr.createPaginatedResult=Mq;function Lq(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(Lq,"createPaginatedResultWithTotal");Lr.createPaginatedResultWithTotal=Lq});var se=u(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.createPaginationQuery=void 0;function Fq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(Fq,"createPaginationQuery");Qo.createPaginationQuery=Fq});var Od=u(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.HelixChannel=void 0;var cg=(f(),b(y)),Nq=C(),pe=m(),Go=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}};Oi.HelixChannel=Go;cg.__decorate([(0,Nq.Enumerable)(!1)],Go.prototype,"_client",void 0);Oi.HelixChannel=Go=cg.__decorate([(0,pe.rtfm)("api","HelixChannel","id")],Go)});var jd=u(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.HelixChannelEditor=void 0;var dg=(f(),b(y)),Qq=C(),nr=m(),Wo=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)}};ji.HelixChannelEditor=Wo;dg.__decorate([(0,Qq.Enumerable)(!1)],Wo.prototype,"_client",void 0);ji.HelixChannelEditor=Wo=dg.__decorate([(0,nr.rtfm)("api","HelixChannelEditor","userId")],Wo)});var kd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixChannelFollower=void 0;var hg=(f(),b(y)),Gq=C(),Ot=m(),Vo=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)}};ki.HelixChannelFollower=Vo;hg.__decorate([(0,Gq.Enumerable)(!1)],Vo.prototype,"_client",void 0);ki.HelixChannelFollower=Vo=hg.__decorate([(0,Ot.rtfm)("api","HelixChannelFollower","userId")],Vo)});var Md=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixFollowedChannel=void 0;var pg=(f(),b(y)),Wq=C(),jt=m(),$o=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)}};Mi.HelixFollowedChannel=$o;pg.__decorate([(0,Wq.Enumerable)(!1)],$o.prototype,"_client",void 0);Mi.HelixFollowedChannel=$o=pg.__decorate([(0,jt.rtfm)("api","HelixFollowedChannel","broadcasterId")],$o)});var Fd=u(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixAdSchedule=void 0;var Vq=(f(),b(y)),Je=m(),Ld=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}};Li.HelixAdSchedule=Ld;Li.HelixAdSchedule=Ld=Vq.__decorate([(0,Je.rtfm)("api","HelixAdSchedule")],Ld)});var mg=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixSnoozeNextAdResult=void 0;var $q=(f(),b(y)),Fi=m(),Nd=class extends Fi.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[Fi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[Fi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[Fi.rawDataSymbol].next_ad_at*1e3)}};Ni.HelixSnoozeNextAdResult=Nd;Ni.HelixSnoozeNextAdResult=Nd=$q.__decorate([(0,Fi.rtfm)("api","HelixSnoozeNextAdResult")],Nd)});var Vd=u(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.HelixChannelApi=void 0;var bg=(f(),b(y)),xg=C(),ar=Z(),oe=m(),bt=og(),_g=Ue(),Qd=Mo(),zq=Bt(),Kq=ae(),yg=Mr(),Gd=ce(),zo=se(),Jq=Q(),Wd=Od(),Zq=jd(),fg=kd(),gg=Md(),Xq=Fd(),Yq=mg(),Ko=class extends Jq.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new zq.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Wd.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,xg.mapNullable)(r.data[0],a=>new Wd.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,_g.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Wd.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 Zq.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,zo.createPaginationQuery)(t)}});return(0,Gd.createPaginatedResult)(r,Qd.HelixUserRelation,this._client)}getVipsPaginated(e){return new Kq.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 Qd.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,_g.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Qd.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,zo.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,zo.createPaginationQuery)(r)}});return(0,Gd.createPaginatedResultWithTotal)(a,fg.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new yg.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 fg.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,zo.createPaginationQuery)(r)}});return(0,Gd.createPaginatedResultWithTotal)(a,gg.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new yg.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 gg.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 Xq.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 Yq.HelixSnoozeNextAdResult(t.data[0])}};Qi.HelixChannelApi=Ko;bg.__decorate([(0,xg.Enumerable)(!1)],Ko.prototype,"_getChannelByIdBatcher",void 0);Qi.HelixChannelApi=Ko=bg.__decorate([(0,oe.rtfm)("api","HelixChannelApi")],Ko)});var wg=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createRedemptionsForBroadcasterQuery=Qe.createRewardRedemptionsByIdsQuery=Qe.createCustomRewardBody=Qe.createCustomRewardChangeQuery=Qe.createCustomRewardsQuery=void 0;var Jo=m();function eE(i,e){return{broadcaster_id:(0,Jo.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(eE,"createCustomRewardsQuery");Qe.createCustomRewardsQuery=eE;function tE(i,e){return{broadcaster_id:(0,Jo.extractUserId)(i),id:e}}n(tE,"createCustomRewardChangeQuery");Qe.createCustomRewardChangeQuery=tE;function rE(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(rE,"createCustomRewardBody");Qe.createCustomRewardBody=rE;function iE(i,e,t){return{broadcaster_id:(0,Jo.extractUserId)(i),reward_id:e,id:t}}n(iE,"createRewardRedemptionsByIdsQuery");Qe.createRewardRedemptionsByIdsQuery=iE;function nE(i,e,t,r){return{broadcaster_id:(0,Jo.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(nE,"createRedemptionsForBroadcasterQuery");Qe.createRedemptionsForBroadcasterQuery=nE});var $d=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixCustomReward=void 0;var vg=(f(),b(y)),aE=C(),j=m(),Zo=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}};Gi.HelixCustomReward=Zo;vg.__decorate([(0,aE.Enumerable)(!1)],Zo.prototype,"_client",void 0);Gi.HelixCustomReward=Zo=vg.__decorate([(0,j.rtfm)("api","HelixCustomReward","id")],Zo)});var zd=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixCustomRewardRedemption=void 0;var Sg=(f(),b(y)),sE=C(),N=m(),Xo=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]}};Wi.HelixCustomRewardRedemption=Xo;Sg.__decorate([(0,sE.Enumerable)(!1)],Xo.prototype,"_client",void 0);Wi.HelixCustomRewardRedemption=Xo=Sg.__decorate([(0,N.rtfm)("api","HelixCustomRewardRedemption","id")],Xo)});var Jd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixChannelPointsApi=void 0;var oE=(f(),b(y)),lE=Z(),ct=m(),xt=wg(),uE=Ue(),cE=ae(),dE=ce(),hE=se(),pE=Q(),Yo=$d(),el=zd(),Kd=class extends pE.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 Yo.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,uE.createGetByIdsQuery)(e,t)})).data.map(a=>new Yo.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,lE.createBroadcasterQuery)(e),jsonBody:(0,xt.createCustomRewardBody)(t)});return new Yo.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 Yo.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 el.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,hE.createPaginationQuery)(a)}});return(0,dE.createPaginatedResult)(s,el.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new cE.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 el.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 el.HelixCustomRewardRedemption(o,this._client)):[]}};Vi.HelixChannelPointsApi=Kd;Vi.HelixChannelPointsApi=Kd=oE.__decorate([(0,ct.rtfm)("api","HelixChannelPointsApi")],Kd)});var tl=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixCharityCampaignAmount=void 0;var mE=(f(),b(y)),$i=m(),Zd=class extends $i.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[$i.rawDataSymbol].value}get decimalPlaces(){return this[$i.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[$i.rawDataSymbol].currency}};zi.HelixCharityCampaignAmount=Zd;zi.HelixCharityCampaignAmount=Zd=mE.__decorate([(0,$i.rtfm)("api","HelixCharityCampaignAmount")],Zd)});var Xd=u(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.HelixCharityCampaign=void 0;var Cg=(f(),b(y)),_E=C(),Ae=m(),Hg=tl(),rl=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 Hg.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].current_amount)}get targetAmount(){return new Hg.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].target_amount)}};Ki.HelixCharityCampaign=rl;Cg.__decorate([(0,_E.Enumerable)(!1)],rl.prototype,"_client",void 0);Ki.HelixCharityCampaign=rl=Cg.__decorate([(0,Ae.rtfm)("api","HelixCharityCampaign","id")],rl)});var Yd=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixCharityCampaignDonation=void 0;var qg=(f(),b(y)),yE=C(),wt=m(),fE=tl(),il=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 fE.HelixCharityCampaignAmount(this[wt.rawDataSymbol].amount)}};Ji.HelixCharityCampaignDonation=il;qg.__decorate([(0,yE.Enumerable)(!1)],il.prototype,"_client",void 0);Ji.HelixCharityCampaignDonation=il=qg.__decorate([(0,wt.rtfm)("api","HelixCharityCampaignDonation")],il)});var rh=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixCharityApi=void 0;var gE=(f(),b(y)),Eg=Z(),eh=m(),bE=ce(),xE=se(),wE=Q(),vE=Xd(),SE=Yd(),th=class extends wE.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,eh.extractUserId)(e),scopes:["channel:read:charity"],query:(0,Eg.createBroadcasterQuery)(e)});return new vE.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,eh.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,Eg.createBroadcasterQuery)(e),...(0,xE.createPaginationQuery)(t)}});return(0,bE.createPaginatedResult)(r,SE.HelixCharityCampaignDonation,this._client)}};Zi.HelixCharityApi=th;Zi.HelixCharityApi=th=gE.__decorate([(0,eh.rtfm)("api","HelixCharityApi")],th)});var Pg=u(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.createSendChatMessageBody=Ge.createSendChatMessageQuery=Ge.createShoutoutQuery=Ge.createChatColorUpdateQuery=Ge.createChatSettingsUpdateBody=void 0;var ih=m();function HE(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(HE,"createChatSettingsUpdateBody");Ge.createChatSettingsUpdateBody=HE;function CE(i,e){return{user_id:(0,ih.extractUserId)(i),color:e}}n(CE,"createChatColorUpdateQuery");Ge.createChatColorUpdateQuery=CE;function qE(i,e,t){return{from_broadcaster_id:(0,ih.extractUserId)(i),to_broadcaster_id:(0,ih.extractUserId)(e),moderator_id:t}}n(qE,"createShoutoutQuery");Ge.createShoutoutQuery=qE;function EE(i,e){return{broadcaster_id:i,sender_id:e}}n(EE,"createSendChatMessageQuery");Ge.createSendChatMessageQuery=EE;function PE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(PE,"createSendChatMessageBody");Ge.createSendChatMessageBody=PE});var ah=u(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.HelixEmoteBase=void 0;var Ze=m(),nh=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}`}};nl.HelixEmoteBase=nh});var Yi=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixEmote=void 0;var AE=(f(),b(y)),Ag=m(),DE=ah(),sh=class extends DE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[Ag.rawDataSymbol].images[`url_${e}x`]}};Xi.HelixEmote=sh;Xi.HelixEmote=sh=AE.__decorate([(0,Ag.rtfm)("api","HelixEmote","id")],sh)});var oh=u(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.HelixChannelEmote=void 0;var Dg=(f(),b(y)),IE=C(),en=m(),TE=Yi(),al=class extends TE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[en.rawDataSymbol].tier||null}get type(){return this[en.rawDataSymbol].emote_type}get emoteSetId(){return this[en.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[en.rawDataSymbol].emote_set_id])}};tn.HelixChannelEmote=al;Dg.__decorate([(0,IE.Enumerable)(!1)],al.prototype,"_client",void 0);tn.HelixChannelEmote=al=Dg.__decorate([(0,en.rtfm)("api","HelixChannelEmote","id")],al)});var uh=u(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.HelixChatBadgeVersion=void 0;var RE=(f(),b(y)),kt=m(),lh=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}};rn.HelixChatBadgeVersion=lh;rn.HelixChatBadgeVersion=lh=RE.__decorate([(0,kt.rtfm)("api","HelixChatBadgeVersion","id")],lh)});var ch=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixChatBadgeSet=void 0;var Ig=(f(),b(y)),Tg=gi(),sl=m(),UE=uh(),ol=class extends sl.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[sl.rawDataSymbol].set_id}get versions(){return this[sl.rawDataSymbol].versions.map(e=>new UE.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};nn.HelixChatBadgeSet=ol;Ig.__decorate([(0,Tg.CachedGetter)()],ol.prototype,"versions",null);nn.HelixChatBadgeSet=ol=Ig.__decorate([Tg.Cacheable,(0,sl.rtfm)("api","HelixChatBadgeSet","id")],ol)});var dh=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixChatChatter=void 0;var Rg=(f(),b(y)),BE=C(),sr=m(),ll=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))}};an.HelixChatChatter=ll;Rg.__decorate([(0,BE.Enumerable)(!1)],ll.prototype,"_client",void 0);an.HelixChatChatter=ll=Rg.__decorate([(0,sr.rtfm)("api","HelixChatChatter")],ll)});var ul=u(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.HelixChatSettings=void 0;var OE=(f(),b(y)),dt=m(),hh=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}};sn.HelixChatSettings=hh;sn.HelixChatSettings=hh=OE.__decorate([(0,dt.rtfm)("api","HelixChatSettings","broadcasterId")],hh)});var ph=u(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.HelixEmoteFromSet=void 0;var Ug=(f(),b(y)),jE=C(),or=m(),kE=Yi(),cl=class extends kE.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)}}};on.HelixEmoteFromSet=cl;Ug.__decorate([(0,jE.Enumerable)(!1)],cl.prototype,"_client",void 0);on.HelixEmoteFromSet=cl=Ug.__decorate([(0,or.rtfm)("api","HelixEmoteFromSet","id")],cl)});var mh=u(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.HelixUserEmote=void 0;var Bg=(f(),b(y)),Mt=m(),ME=ah(),LE=C(),dl=class extends ME.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}};ln.HelixUserEmote=dl;Bg.__decorate([(0,LE.Enumerable)(!1)],dl.prototype,"_client",void 0);ln.HelixUserEmote=dl=Bg.__decorate([(0,Mt.rtfm)("api","HelixUserEmote","id")],dl)});var fh=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixPrivilegedChatSettings=void 0;var FE=(f(),b(y)),_h=m(),NE=ul(),yh=class extends NE.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[_h.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[_h.rawDataSymbol].non_moderator_chat_delay_duration}};un.HelixPrivilegedChatSettings=yh;un.HelixPrivilegedChatSettings=yh=FE.__decorate([(0,_h.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],yh)});var bh=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixSentChatMessage=void 0;var QE=(f(),b(y)),Fr=m(),gh=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}};cn.HelixSentChatMessage=gh;cn.HelixSentChatMessage=gh=QE.__decorate([(0,Fr.rtfm)("api","HelixSentChatMessage","id")],gh)});var Og=u(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.createSharedChatSessionQuery=void 0;var GE=m();function WE(i){return{broadcaster_id:(0,GE.extractUserId)(i)}}n(WE,"createSharedChatSessionQuery");hl.createSharedChatSessionQuery=WE});var xh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixSharedChatSessionParticipant=void 0;var jg=(f(),b(y)),VE=C(),dn=m(),pl=class extends dn.DataObject{static{n(this,"HelixSharedChatSessionParticipant")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[dn.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,dn.checkRelationAssertion)(await this._client.users.getUserById(this[dn.rawDataSymbol].broadcaster_id))}};hn.HelixSharedChatSessionParticipant=pl;jg.__decorate([(0,VE.Enumerable)(!1)],pl.prototype,"_client",void 0);hn.HelixSharedChatSessionParticipant=pl=jg.__decorate([(0,dn.rtfm)("api","HelixSharedChatSessionParticipant","broadcasterId")],pl)});var wh=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixSharedChatSession=void 0;var kg=(f(),b(y)),$E=C(),vt=m(),zE=xh(),ml=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 zE.HelixSharedChatSessionParticipant(e,this._client))}get createdDate(){return new Date(this[vt.rawDataSymbol].created_at)}get updatedDate(){return new Date(this[vt.rawDataSymbol].updated_at)}};pn.HelixSharedChatSession=ml;kg.__decorate([(0,$E.Enumerable)(!1)],ml.prototype,"_client",void 0);pn.HelixSharedChatSession=ml=kg.__decorate([(0,vt.rtfm)("api","HelixSharedChatSession","sessionId")],ml)});var Hh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixChatApi=void 0;var KE=(f(),b(y)),vh=Z(),J=m(),lr=Pg(),Lt=Ue(),JE=ae(),ZE=Mr(),Mg=ce(),Lg=se(),XE=Q(),YE=oh(),Fg=ch(),Ng=dh(),eP=ul(),tP=Yi(),rP=ph(),Qg=mh(),Gg=fh(),Wg=bh(),iP=Og(),nP=wh(),Sh=class extends XE.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,Lg.createPaginationQuery)(t)}});return(0,Mg.createPaginatedResultWithTotal)(a,Ng.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,J.extractUserId)(e);return new ZE.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Ng.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new Fg.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,J.extractUserId)(e),query:(0,vh.createBroadcasterQuery)(e)})).data.map(r=>new Fg.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new tP.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,J.extractUserId)(e),query:(0,vh.createBroadcasterQuery)(e)})).data.map(r=>new YE.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 rP.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,Lg.createPaginationQuery)(t)}});return(0,Mg.createPaginatedResult)(a,Qg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,J.extractUserId)(e);return new JE.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 Qg.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,vh.createBroadcasterQuery)(e)});return new eP.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 Gg.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 Gg.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 Wg.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 Wg.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,iP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new nP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Lt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};mn.HelixChatApi=Sh;mn.HelixChatApi=Sh=KE.__decorate([(0,J.rtfm)("api","HelixChatApi")],Sh)});var Vg=u(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createClipQuery=Nr.createClipCreateQuery=void 0;var aP=m();function sP(i,e){return{broadcaster_id:(0,aP.extractUserId)(i),has_delay:e.toString()}}n(sP,"createClipCreateQuery");Nr.createClipCreateQuery=sP;function oP(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(oP,"createClipQuery");Nr.createClipQuery=oP});var Ch=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixClip=void 0;var $g=(f(),b(y)),lP=C(),k=m(),_l=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}};_n.HelixClip=_l;$g.__decorate([(0,lP.Enumerable)(!1)],_l.prototype,"_client",void 0);_n.HelixClip=_l=$g.__decorate([(0,k.rtfm)("api","HelixClip","id")],_l)});var Ph=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixClipApi=void 0;var zg=(f(),b(y)),uP=C(),Qr=m(),qh=Vg(),cP=Bt(),dP=ae(),hP=ce(),pP=se(),mP=Q(),Eh=Ch(),yl=class extends mP.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new cP.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Eh.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,qh.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,qh.createClipQuery)(e),...(0,pP.createPaginationQuery)(e)}});return(0,hP.createPaginatedResult)(t,Eh.HelixClip,this._client)}_getClipsPaginated(e){return new dP.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,qh.createClipQuery)(e)},this._client,t=>new Eh.HelixClip(t,this._client))}};yn.HelixClipApi=yl;zg.__decorate([(0,uP.Enumerable)(!1)],yl.prototype,"_getClipByIdBatcher",void 0);yn.HelixClipApi=yl=zg.__decorate([(0,Qr.rtfm)("api","HelixClipApi")],yl)});var Dh=u(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.HelixContentClassificationLabel=void 0;var fl=m(),Ah=class extends fl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[fl.rawDataSymbol].id}get name(){return this[fl.rawDataSymbol].name}get description(){return this[fl.rawDataSymbol].description}};gl.HelixContentClassificationLabel=Ah});var Th=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixContentClassificationLabelApi=void 0;var _P=(f(),b(y)),yP=m(),fP=Q(),gP=Dh(),Ih=class extends fP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new gP.HelixContentClassificationLabel(r))}};fn.HelixContentClassificationLabelApi=Ih;fn.HelixContentClassificationLabelApi=Ih=_P.__decorate([(0,yP.rtfm)("api","HelixContentClassificationLabelApi")],Ih)});var Kg=u(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createDropsEntitlementUpdateBody=Gr.createDropsEntitlementQuery=void 0;var bP=C(),xP=m();function wP(i,e){return{user_id:e?(0,bP.mapOptional)(i.user,xP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(wP,"createDropsEntitlementQuery");Gr.createDropsEntitlementQuery=wP;function vP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(vP,"createDropsEntitlementUpdateBody");Gr.createDropsEntitlementUpdateBody=vP});var Rh=u(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.HelixDropsEntitlement=void 0;var Jg=(f(),b(y)),SP=C(),Be=m(),bl=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)}};gn.HelixDropsEntitlement=bl;Jg.__decorate([(0,SP.Enumerable)(!1)],bl.prototype,"_client",void 0);gn.HelixDropsEntitlement=bl=Jg.__decorate([(0,Be.rtfm)("api","HelixDropsEntitlement")],bl)});var jh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixEntitlementApi=void 0;var Zg=(f(),b(y)),Bh=C(),Oh=m(),Uh=Kg(),HP=Bt(),CP=ae(),qP=ce(),EP=se(),PP=Q(),xl=Rh(),wl=class extends PP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new HP.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new xl.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Bh.mapOptional)(e.user,Oh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,Uh.createDropsEntitlementQuery)(e,t),...(0,EP.createPaginationQuery)(e)}});return(0,qP.createPaginatedResult)(r,xl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new CP.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Bh.mapOptional)(e.user,Oh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,Uh.createDropsEntitlementQuery)(e,t)},this._client,r=>new xl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new xl.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,Uh.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(a=>a.ids.map(s=>[s,a.status])))}};bn.HelixEntitlementApi=wl;Zg.__decorate([(0,Bh.Enumerable)(!1)],wl.prototype,"_getDropsEntitlementByIdBatcher",void 0);bn.HelixEntitlementApi=wl=Zg.__decorate([(0,Oh.rtfm)("api","HelixEntitlementApi")],wl)});var Yg=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 Xg=m();function AP(i){return{broadcaster_user_id:(0,Xg.extractUserId)(i)}}n(AP,"createEventSubBroadcasterCondition");me.createEventSubBroadcasterCondition=AP;function DP(i,e){return{broadcaster_user_id:(0,Xg.extractUserId)(i),reward_id:e}}n(DP,"createEventSubRewardCondition");me.createEventSubRewardCondition=DP;function IP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(IP,"createEventSubModeratorCondition");me.createEventSubModeratorCondition=IP;function TP(i,e){return{broadcaster_user_id:i,user_id:e}}n(TP,"createEventSubUserCondition");me.createEventSubUserCondition=TP;function RP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(RP,"createEventSubDropEntitlementGrantCondition");me.createEventSubDropEntitlementGrantCondition=RP;function UP(i,e){return{conduit_id:i,status:e}}n(UP,"createEventSubConduitCondition");me.createEventSubConduitCondition=UP;function BP(i,e){return{id:i,shard_count:e.toString()}}n(BP,"createEventSubConduitUpdateCondition");me.createEventSubConduitUpdateCondition=BP;function OP(i,e){return{conduit_id:i,shards:e}}n(OP,"createEventSubConduitShardsUpdateCondition");me.createEventSubConduitShardsUpdateCondition=OP});var Sl=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixEventSubSubscription=void 0;var eb=(f(),b(y)),jP=C(),We=m(),vl=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}};xn.HelixEventSubSubscription=vl;eb.__decorate([(0,jP.Enumerable)(!1)],vl.prototype,"_client",void 0);xn.HelixEventSubSubscription=vl=eb.__decorate([(0,We.rtfm)("api","HelixEventSubSubscription","id")],vl)});var Mh=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var kP=(f(),b(y)),MP=m(),LP=Mr(),FP=Sl(),kh=class extends LP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new FP.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}};wn.HelixPaginatedEventSubSubscriptionsRequest=kh;wn.HelixPaginatedEventSubSubscriptionsRequest=kh=kP.__decorate([(0,MP.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],kh)});var Lh=u(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.HelixEventSubConduit=void 0;var tb=(f(),b(y)),NP=C(),ur=m(),Hl=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)}};vn.HelixEventSubConduit=Hl;tb.__decorate([(0,NP.Enumerable)(!1)],Hl.prototype,"_client",void 0);vn.HelixEventSubConduit=Hl=tb.__decorate([(0,ur.rtfm)("api","HelixEventSubConduit")],Hl)});var Nh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixEventSubConduitShard=void 0;var QP=(f(),b(y)),Sn=m(),Fh=class extends Sn.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[Sn.rawDataSymbol].id}get status(){return this[Sn.rawDataSymbol].status}get transportMethod(){return this[Sn.rawDataSymbol].transport.method}};Hn.HelixEventSubConduitShard=Fh;Hn.HelixEventSubConduitShard=Fh=QP.__decorate([(0,Sn.rtfm)("api","HelixEventSubConduitShard")],Fh)});var Vh=u(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.HelixEventSubApi=void 0;var GP=(f(),b(y)),WP=C(),U=m(),H=Yg(),Xe=Ue(),VP=ae(),Cn=ce(),qn=se(),$P=Q(),En=Sl(),Cl=Mh(),Qh=Lh(),Gh=Nh(),Wh=class extends $P.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,qn.createPaginationQuery)(e)});return{...(0,Cn.createPaginatedResultWithTotal)(t,En.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new Cl.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,qn.createPaginationQuery)(t),status:e}});return{...(0,Cn.createPaginatedResultWithTotal)(r,En.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new Cl.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,qn.createPaginationQuery)(t),type:e}});return{...(0,Cn.createPaginatedResultWithTotal)(r,En.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new Cl.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,U.extractUserId)(e),query:{...(0,Xe.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),...(0,qn.createPaginationQuery)(t)}});return{...(0,Cn.createPaginatedResultWithTotal)(r,En.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,U.extractUserId)(e);return new Cl.HelixPaginatedEventSubSubscriptionsRequest((0,Xe.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,a,s,o,l,d){let h=a.method==="webhook"||a.method==="conduit",p=h?void 0:o;if(!h&&!s)throw new Error(`Transport ${a.method} can only handle subscriptions with user context`);let x={type:e,version:t,condition:r,transport:a};d&&(x.is_batching_enabled=!0);let E=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:p,userId:(0,WP.mapOptional)(s,U.extractUserId),canOverrideScopedUserContext:l,forceType:h?"app":"user",jsonBody:x});return new En.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,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 Qh.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 Qh.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 Qh.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,qn.createPaginationQuery)(r)}});return{...(0,Cn.createPaginatedResult)(a,Gh.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new VP.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,H.createEventSubConduitCondition)(e,t)},this._client,r=>new Gh.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 Gh.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};Pn.HelixEventSubApi=Wh;Pn.HelixEventSubApi=Wh=GP.__decorate([(0,U.rtfm)("api","HelixEventSubApi")],Wh)});var rb=u(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.createExtensionTransactionQuery=Ft.createExtensionProductBody=Ft.createReleasedExtensionFilter=void 0;function zP(i,e){return{extension_id:i,extension_version:e}}n(zP,"createReleasedExtensionFilter");Ft.createReleasedExtensionFilter=zP;function KP(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(KP,"createExtensionProductBody");Ft.createExtensionProductBody=KP;function JP(i,e){return{extension_id:i,id:e.transactionIds}}n(JP,"createExtensionTransactionQuery");Ft.createExtensionTransactionQuery=JP});var $h=u(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.HelixChannelReference=void 0;var ib=(f(),b(y)),ZP=C(),De=m(),ql=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}};An.HelixChannelReference=ql;ib.__decorate([(0,ZP.Enumerable)(!1)],ql.prototype,"_client",void 0);An.HelixChannelReference=ql=ib.__decorate([(0,De.rtfm)("api","HelixChannelReference","id")],ql)});var Kh=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixExtensionBitsProduct=void 0;var XP=(f(),b(y)),YP=C(),Nt=m(),zh=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,YP.mapNullable)(this[Nt.rawDataSymbol].expiration,e=>new Date(e))}};Dn.HelixExtensionBitsProduct=zh;Dn.HelixExtensionBitsProduct=zh=XP.__decorate([(0,Nt.rtfm)("api","HelixExtensionBitsProduct","sku")],zh)});var Jh=u(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.HelixExtensionTransaction=void 0;var nb=(f(),b(y)),eA=C(),de=m(),El=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}};In.HelixExtensionTransaction=El;nb.__decorate([(0,eA.Enumerable)(!1)],El.prototype,"_client",void 0);In.HelixExtensionTransaction=El=nb.__decorate([(0,de.rtfm)("api","HelixExtensionTransaction","id")],El)});var Yh=u(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.HelixExtensionsApi=void 0;var tA=(f(),b(y)),db=m(),Pl=rb(),Zh=Ue(),ab=ae(),sb=ce(),ob=se(),rA=Q(),lb=$h(),ub=Kh(),cb=Jh(),Xh=class extends rA.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Pl.createReleasedExtensionFilter)(e,t)});return new db.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,Zh.createSingleKeyQuery)("extension_id",e),...(0,ob.createPaginationQuery)(t)}});return(0,sb.createPaginatedResult)(r,lb.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new ab.HelixPaginatedRequest({url:"extensions/live",query:(0,Zh.createSingleKeyQuery)("extension_id",e)},this._client,t=>new lb.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,Zh.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new ub.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Pl.createExtensionProductBody)(e)});return new ub.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Pl.createExtensionTransactionQuery)(e,t),...(0,ob.createPaginationQuery)(t)}});return(0,sb.createPaginatedResult)(r,cb.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new ab.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Pl.createExtensionTransactionQuery)(e,t)},this._client,r=>new cb.HelixExtensionTransaction(r,this._client))}};Tn.HelixExtensionsApi=Xh;Tn.HelixExtensionsApi=Xh=tA.__decorate([(0,db.rtfm)("api","HelixExtensionsApi")],Xh)});var Dl=u(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.HelixGame=void 0;var hb=(f(),b(y)),iA=C(),St=m(),Al=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})}};Rn.HelixGame=Al;hb.__decorate([(0,iA.Enumerable)(!1)],Al.prototype,"_client",void 0);Rn.HelixGame=Al=hb.__decorate([(0,St.rtfm)("api","HelixGame","id")],Al)});var rp=u(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.HelixGameApi=void 0;var Il=(f(),b(y)),tp=C(),nA=m(),ep=Bt(),aA=ae(),sA=ce(),oA=se(),lA=Q(),Wr=Dl(),Vr=class extends lA.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new ep.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Wr.HelixGame(e,this._client)),this._getGameByNameBatcher=new ep.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Wr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new ep.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,oA.createPaginationQuery)(e)});return(0,sA.createPaginatedResult)(t,Wr.HelixGame,this._client)}getTopGamesPaginated(){return new aA.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)):[]}};Un.HelixGameApi=Vr;Il.__decorate([(0,tp.Enumerable)(!1)],Vr.prototype,"_getGameByIdBatcher",void 0);Il.__decorate([(0,tp.Enumerable)(!1)],Vr.prototype,"_getGameByNameBatcher",void 0);Il.__decorate([(0,tp.Enumerable)(!1)],Vr.prototype,"_getGameByIgdbIdBatcher",void 0);Un.HelixGameApi=Vr=Il.__decorate([(0,nA.rtfm)("api","HelixGameApi")],Vr)});var ip=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixGoal=void 0;var pb=(f(),b(y)),uA=C(),Oe=m(),Tl=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}};Bn.HelixGoal=Tl;pb.__decorate([(0,uA.Enumerable)(!1)],Tl.prototype,"_client",void 0);Bn.HelixGoal=Tl=pb.__decorate([(0,Oe.rtfm)("api","HelixGoal","id")],Tl)});var ap=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixGoalApi=void 0;var cA=(f(),b(y)),dA=Z(),mb=m(),hA=Q(),pA=ip(),np=class extends hA.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,mb.extractUserId)(e),scopes:["channel:read:goals"],query:(0,dA.createBroadcasterQuery)(e)})).data.map(r=>new pA.HelixGoal(r,this._client))}};On.HelixGoalApi=np;On.HelixGoalApi=np=cA.__decorate([(0,mb.rtfm)("api","HelixGoalApi")],np)});var sp=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixHypeTrainContribution=void 0;var _b=(f(),b(y)),mA=C(),cr=m(),Rl=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}};jn.HelixHypeTrainContribution=Rl;_b.__decorate([(0,mA.Enumerable)(!1)],Rl.prototype,"_client",void 0);jn.HelixHypeTrainContribution=Rl=_b.__decorate([(0,cr.rtfm)("api","HelixHypeTrainContribution","userId")],Rl)});var op=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixHypeTrainEvent=void 0;var fb=(f(),b(y)),_A=C(),_e=m(),yb=sp(),Ul=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 yb.HelixHypeTrainContribution(this[_e.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[_e.rawDataSymbol].event_data.top_contributions.map(e=>new yb.HelixHypeTrainContribution(e,this._client))}};kn.HelixHypeTrainEvent=Ul;fb.__decorate([(0,_A.Enumerable)(!1)],Ul.prototype,"_client",void 0);kn.HelixHypeTrainEvent=Ul=fb.__decorate([(0,_e.rtfm)("api","HelixHypeTrainEvent","id")],Ul)});var up=u(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.HelixHypeTrainApi=void 0;var gb=Z(),bb=m(),yA=ae(),fA=ce(),gA=se(),bA=Q(),xb=op(),lp=class extends bA.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,bb.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,gb.createBroadcasterQuery)(e),...(0,gA.createPaginationQuery)(t)}});return(0,fA.createPaginatedResult)(r,xb.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new yA.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,bb.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,gb.createBroadcasterQuery)(e)},this._client,t=>new xb.HelixHypeTrainEvent(t,this._client))}};Bl.HelixHypeTrainApi=lp});var wb=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 xA(i,e){return{broadcaster_id:(0,Qt.extractUserId)(i),user_id:e?.userId}}n(xA,"createModerationUserListQuery");le.createModerationUserListQuery=xA;function wA(i,e){return{broadcaster_id:(0,Qt.extractUserId)(i),user_id:(0,Qt.extractUserId)(e)}}n(wA,"createModeratorModifyQuery");le.createModeratorModifyQuery=wA;function vA(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(vA,"createResolveUnbanRequestQuery");le.createResolveUnbanRequestQuery=vA;function SA(i,e,t){return{user_id:(0,Qt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(SA,"createAutoModProcessBody");le.createAutoModProcessBody=SA;function HA(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(HA,"createAutoModSettingsBody");le.createAutoModSettingsBody=HA;function CA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,Qt.extractUserId)(i.user)}}}n(CA,"createBanUserBody");le.createBanUserBody=CA;function qA(i){return{is_active:i}}n(qA,"createUpdateShieldModeStatusBody");le.createUpdateShieldModeStatusBody=qA;function EA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(EA,"createCheckAutoModStatusBody");le.createCheckAutoModStatusBody=EA;function PA(i,e){return{data:{user_id:(0,Qt.extractUserId)(i),reason:e}}}n(PA,"createWarnUserBody");le.createWarnUserBody=PA});var vb=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixAutoModSettings=void 0;var AA=(f(),b(y)),Ie=m(),cp=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}};Mn.HelixAutoModSettings=cp;Mn.HelixAutoModSettings=cp=AA.__decorate([(0,Ie.rtfm)("api","HelixAutoModSettings","broadcasterId")],cp)});var Sb=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixAutoModStatus=void 0;var DA=(f(),b(y)),Ol=m(),dp=class extends Ol.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[Ol.rawDataSymbol].msg_id}get isPermitted(){return this[Ol.rawDataSymbol].is_permitted}};Ln.HelixAutoModStatus=dp;Ln.HelixAutoModStatus=dp=DA.__decorate([(0,Ol.rtfm)("api","HelixAutoModStatus","messageId")],dp)});var jl=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixBanUser=void 0;var hp=(f(),b(y)),pp=C(),Ht=m(),Fn=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,pp.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))}};Nn.HelixBanUser=Fn;hp.__decorate([(0,pp.Enumerable)(!1)],Fn.prototype,"_client",void 0);hp.__decorate([(0,pp.Enumerable)(!1)],Fn.prototype,"_expiryTimestamp",void 0);Nn.HelixBanUser=Fn=hp.__decorate([(0,Ht.rtfm)("api","HelixBanUser","userId")],Fn)});var _p=u(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.HelixBan=void 0;var IA=(f(),b(y)),$r=m(),TA=jl(),mp=class extends TA.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}};Qn.HelixBan=mp;Qn.HelixBan=mp=IA.__decorate([(0,$r.rtfm)("api","HelixBan","userId")],mp)});var fp=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixBlockedTerm=void 0;var RA=(f(),b(y)),ht=m(),yp=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)}};Gn.HelixBlockedTerm=yp;Gn.HelixBlockedTerm=yp=RA.__decorate([(0,ht.rtfm)("api","HelixBlockedTerm","id")],yp)});var gp=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixModeratedChannel=void 0;var Hb=(f(),b(y)),UA=C(),Ct=m(),kl=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))}};Wn.HelixModeratedChannel=kl;Hb.__decorate([(0,UA.Enumerable)(!1)],kl.prototype,"_client",void 0);Wn.HelixModeratedChannel=kl=Hb.__decorate([(0,Ct.rtfm)("api","HelixModeratedChannel","id")],kl)});var bp=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixModerator=void 0;var Cb=(f(),b(y)),BA=C(),dr=m(),Ml=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))}};Vn.HelixModerator=Ml;Cb.__decorate([(0,BA.Enumerable)(!1)],Ml.prototype,"_client",void 0);Vn.HelixModerator=Ml=Cb.__decorate([(0,dr.rtfm)("api","HelixModerator","userId")],Ml)});var xp=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixShieldModeStatus=void 0;var qb=(f(),b(y)),OA=C(),pt=m(),Ll=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)}};$n.HelixShieldModeStatus=Ll;qb.__decorate([(0,OA.Enumerable)(!1)],Ll.prototype,"_client",void 0);$n.HelixShieldModeStatus=Ll=qb.__decorate([(0,pt.rtfm)("api","HelixShieldModeStatus")],Ll)});var wp=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixUnbanRequest=void 0;var Eb=(f(),b(y)),Pb=C(),Y=m(),Fl=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,Pb.mapNullable)(this[Y.rawDataSymbol].resolved_at,e=>new Date(e))}};zn.HelixUnbanRequest=Fl;Eb.__decorate([(0,Pb.Enumerable)(!1)],Fl.prototype,"_client",void 0);zn.HelixUnbanRequest=Fl=Eb.__decorate([(0,Y.rtfm)("api","HelixUnbanRequest","id")],Fl)});var vp=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixWarning=void 0;var Ab=(f(),b(y)),jA=C(),Ve=m(),Nl=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}};Kn.HelixWarning=Nl;Ab.__decorate([(0,jA.Enumerable)(!1)],Nl.prototype,"_client",void 0);Kn.HelixWarning=Nl=Ab.__decorate([(0,Ve.rtfm)("api","HelixWarning","userId")],Nl)});var qp=u(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.HelixModerationApi=void 0;var kA=(f(),b(y)),Sp=Z(),M=m(),hr=Ue(),Ye=wb(),Ql=ae(),Jn=ce(),Zn=se(),MA=Q(),Db=vb(),LA=Sb(),Ib=_p(),FA=jl(),Tb=fp(),Rb=gp(),Ub=bp(),Bb=xp(),Hp=wp(),NA=vp(),Cp=class extends MA.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,Zn.createPaginationQuery)(t)}});return(0,Jn.createPaginatedResult)(r,Ib.HelixBan,this._client)}getBannedUsersPaginated(e){return new Ql.HelixPaginatedRequest({url:"moderation/banned",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:(0,Sp.createBroadcasterQuery)(e)},this._client,t=>new Ib.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,Zn.createPaginationQuery)(t)}});return(0,Jn.createPaginatedResult)(r,Ub.HelixModerator,this._client)}getModeratorsPaginated(e){return new Ql.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,M.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,Sp.createBroadcasterQuery)(e)},this._client,t=>new Ub.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,Zn.createPaginationQuery)(t)}});return(0,Jn.createPaginatedResult)(a,Rb.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,M.extractUserId)(e);return new Ql.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,hr.createSingleKeyQuery)("user_id",t)},this._client,r=>new Rb.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,Sp.createBroadcasterQuery)(e),jsonBody:(0,Ye.createCheckAutoModStatusBody)(t)})).data.map(a=>new LA.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,M.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,Ye.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,M.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:t,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)})).data.map(a=>new Db.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 Db.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 FA.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,Zn.createPaginationQuery)(t)}});return(0,Jn.createPaginatedResult)(a,Tb.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 Tb.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 Bb.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 Bb.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,Zn.createPaginationQuery)(r)}});return(0,Jn.createPaginatedResult)(s,Hp.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,M.extractUserId)(e);return new Ql.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 Hp.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 Hp.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 NA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,hr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};Xn.HelixModerationApi=Cp;Xn.HelixModerationApi=Cp=kA.__decorate([(0,M.rtfm)("api","HelixModerationApi")],Cp)});var jb=u(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.createPollEndBody=zr.createPollBody=void 0;var Ob=m();function QA(i,e){var t;return{broadcaster_id:(0,Ob.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(QA,"createPollBody");zr.createPollBody=QA;function GA(i,e,t){return{broadcaster_id:(0,Ob.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(GA,"createPollEndBody");zr.createPollEndBody=GA});var Pp=u(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.HelixPollChoice=void 0;var WA=(f(),b(y)),Kr=m(),Ep=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}};Yn.HelixPollChoice=Ep;Yn.HelixPollChoice=Ep=WA.__decorate([(0,Kr.rtfm)("api","HelixPollChoice","id")],Ep)});var Ap=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixPoll=void 0;var kb=(f(),b(y)),VA=C(),He=m(),$A=Pp(),Gl=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 $A.HelixPollChoice(e))}};ea.HelixPoll=Gl;kb.__decorate([(0,VA.Enumerable)(!1)],Gl.prototype,"_client",void 0);ea.HelixPoll=Gl=kb.__decorate([(0,He.rtfm)("api","HelixPoll","id")],Gl)});var Ip=u(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixPollApi=void 0;var zA=(f(),b(y)),Mb=Z(),Jr=m(),KA=Ue(),Lb=jb(),JA=ae(),ZA=ce(),XA=se(),YA=Q(),ta=Ap(),Dp=class extends YA.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,Mb.createBroadcasterQuery)(e),...(0,XA.createPaginationQuery)(t)}});return(0,ZA.createPaginatedResult)(r,ta.HelixPoll,this._client)}getPollsPaginated(e){return new JA.HelixPaginatedRequest({url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,Mb.createBroadcasterQuery)(e)},this._client,t=>new ta.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,KA.createGetByIdsQuery)(e,t)})).data.map(a=>new ta.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,Lb.createPollBody)(e,t)});return new ta.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,Lb.createPollEndBody)(e,t,r)});return new ta.HelixPoll(a.data[0],this._client)}};ra.HelixPollApi=Dp;ra.HelixPollApi=Dp=zA.__decorate([(0,Jr.rtfm)("api","HelixPollApi")],Dp)});var Nb=u(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.createEndPredictionBody=Zr.createPredictionBody=void 0;var Fb=m();function eD(i,e){return{broadcaster_id:(0,Fb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(eD,"createPredictionBody");Zr.createPredictionBody=eD;function tD(i,e,t,r){return{broadcaster_id:(0,Fb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(tD,"createEndPredictionBody");Zr.createEndPredictionBody=tD});var Tp=u(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.HelixPredictor=void 0;var Qb=(f(),b(y)),rD=C(),Gt=m(),Wl=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}};ia.HelixPredictor=Wl;Qb.__decorate([(0,rD.Enumerable)(!1)],Wl.prototype,"_client",void 0);ia.HelixPredictor=Wl=Qb.__decorate([(0,Gt.rtfm)("api","HelixPredictor","userId")],Wl)});var Rp=u(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.HelixPredictionOutcome=void 0;var Gb=(f(),b(y)),iD=C(),Wt=m(),nD=Tp(),Vl=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 nD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};na.HelixPredictionOutcome=Vl;Gb.__decorate([(0,iD.Enumerable)(!1)],Vl.prototype,"_client",void 0);na.HelixPredictionOutcome=Vl=Gb.__decorate([(0,Wt.rtfm)("api","HelixPredictionOutcome","id")],Vl)});var Up=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixPrediction=void 0;var Vb=(f(),b(y)),aD=C(),ee=m(),Wb=Rp(),$l=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 Wb.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 Wb.HelixPredictionOutcome(e,this._client)}};aa.HelixPrediction=$l;Vb.__decorate([(0,aD.Enumerable)(!1)],$l.prototype,"_client",void 0);aa.HelixPrediction=$l=Vb.__decorate([(0,ee.rtfm)("api","HelixPrediction","id")],$l)});var Op=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixPredictionApi=void 0;var sD=(f(),b(y)),$b=Z(),Xr=m(),oD=Ue(),zb=Nb(),lD=ae(),uD=ce(),cD=se(),dD=Q(),sa=Up(),Bp=class extends dD.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,$b.createBroadcasterQuery)(e),...(0,cD.createPaginationQuery)(t)}});return(0,uD.createPaginatedResult)(r,sa.HelixPrediction,this._client)}getPredictionsPaginated(e){return new lD.HelixPaginatedRequest({url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,$b.createBroadcasterQuery)(e)},this._client,t=>new sa.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,oD.createGetByIdsQuery)(e,t)})).data.map(a=>new sa.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,zb.createPredictionBody)(e,t)});return new sa.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,zb.createEndPredictionBody)(e,t,r,a)});return new sa.HelixPrediction(s.data[0],this._client)}};oa.HelixPredictionApi=Bp;oa.HelixPredictionApi=Bp=sD.__decorate([(0,Xr.rtfm)("api","HelixPredictionApi")],Bp)});var Jb=u(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.createRaidStartQuery=void 0;var Kb=m();function hD(i,e){return{from_broadcaster_id:(0,Kb.extractUserId)(i),to_broadcaster_id:(0,Kb.extractUserId)(e)}}n(hD,"createRaidStartQuery");zl.createRaidStartQuery=hD});var kp=u(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.HelixRaid=void 0;var pD=(f(),b(y)),Kl=m(),jp=class extends Kl.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[Kl.rawDataSymbol].created_at)}get targetIsMature(){return this[Kl.rawDataSymbol].is_mature}};la.HelixRaid=jp;la.HelixRaid=jp=pD.__decorate([(0,Kl.rtfm)("api","HelixRaid")],jp)});var Fp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixRaidApi=void 0;var mD=(f(),b(y)),_D=Z(),Mp=m(),yD=Jb(),fD=Q(),gD=kp(),Lp=class extends fD.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Mp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,yD.createRaidStartQuery)(e,t)});return new gD.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Mp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,_D.createBroadcasterQuery)(e)})}};ua.HelixRaidApi=Lp;ua.HelixRaidApi=Lp=mD.__decorate([(0,Mp.rtfm)("api","HelixRaidApi")],Lp)});var Np=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.createScheduleSegmentUpdateBody=$e.createScheduleSegmentModifyQuery=$e.createScheduleSegmentBody=$e.createScheduleSettingsUpdateQuery=$e.createScheduleQuery=void 0;var Jl=m();function bD(i,e){var t;return{broadcaster_id:(0,Jl.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(bD,"createScheduleQuery");$e.createScheduleQuery=bD;function xD(i,e){return e.vacation?{broadcaster_id:(0,Jl.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,Jl.extractUserId)(i),is_vacation_enabled:"false"}}n(xD,"createScheduleSettingsUpdateQuery");$e.createScheduleSettingsUpdateQuery=xD;function wD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(wD,"createScheduleSegmentBody");$e.createScheduleSegmentBody=wD;function vD(i,e){return{broadcaster_id:(0,Jl.extractUserId)(i),id:e}}n(vD,"createScheduleSegmentModifyQuery");$e.createScheduleSegmentModifyQuery=vD;function SD(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(SD,"createScheduleSegmentUpdateBody");$e.createScheduleSegmentUpdateBody=SD});var da=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixScheduleSegment=void 0;var Zb=(f(),b(y)),Xb=C(),et=m(),Zl=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,Xb.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}};ca.HelixScheduleSegment=Zl;Zb.__decorate([(0,Xb.Enumerable)(!1)],Zl.prototype,"_client",void 0);ca.HelixScheduleSegment=Zl=Zb.__decorate([(0,et.rtfm)("api","HelixScheduleSegment","id")],Zl)});var Gp=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixPaginatedScheduleSegmentRequest=void 0;var HD=(f(),b(y)),CD=m(),qD=Np(),ED=ae(),PD=da(),Qp=class extends ED.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,qD.createScheduleQuery)(e,r)},t,a=>new PD.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}}};ha.HelixPaginatedScheduleSegmentRequest=Qp;ha.HelixPaginatedScheduleSegmentRequest=Qp=HD.__decorate([(0,CD.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Qp)});var Wp=u(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.HelixSchedule=void 0;var Yb=(f(),b(y)),AD=C(),mt=m(),DD=da(),Xl=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 DD.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}};pa.HelixSchedule=Xl;Yb.__decorate([(0,AD.Enumerable)(!1)],Xl.prototype,"_client",void 0);pa.HelixSchedule=Xl=Yb.__decorate([(0,mt.rtfm)("api","HelixSchedule","broadcasterId")],Xl)});var zp=u(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.HelixScheduleApi=void 0;var ex=Z(),Yr=m(),ID=Ue(),ei=Np(),TD=se(),RD=Q(),UD=Gp(),BD=Wp(),Vp=da(),$p=class extends RD.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,TD.createPaginationQuery)(t)}});return{data:new BD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new UD.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,ID.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new Vp.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,ex.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,ex.createBroadcasterQuery)(e),jsonBody:(0,ei.createScheduleSegmentBody)(t)});return new Vp.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 Vp.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)})}};Yl.HelixScheduleApi=$p});var tx=u(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.createSearchChannelsQuery=void 0;function OD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(OD,"createSearchChannelsQuery");eu.createSearchChannelsQuery=OD});var Kp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixChannelSearchResult=void 0;var rx=(f(),b(y)),jD=C(),ye=m(),tu=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}};ma.HelixChannelSearchResult=tu;rx.__decorate([(0,jD.Enumerable)(!1)],tu.prototype,"_client",void 0);ma.HelixChannelSearchResult=tu=rx.__decorate([(0,ye.rtfm)("api","HelixChannelSearchResult","id")],tu)});var Zp=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixSearchApi=void 0;var kD=(f(),b(y)),MD=m(),ix=tx(),nx=ae(),ax=ce(),sx=se(),LD=Q(),ox=Dl(),lx=Kp(),Jp=class extends LD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,sx.createPaginationQuery)(t)}});return(0,ax.createPaginatedResult)(r,ox.HelixGame,this._client)}searchCategoriesPaginated(e){return new nx.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new ox.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,ix.createSearchChannelsQuery)(e,t),...(0,sx.createPaginationQuery)(t)}});return(0,ax.createPaginatedResult)(r,lx.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new nx.HelixPaginatedRequest({url:"search/channels",query:(0,ix.createSearchChannelsQuery)(e,t)},this._client,r=>new lx.HelixChannelSearchResult(r,this._client))}};_a.HelixSearchApi=Jp;_a.HelixSearchApi=Jp=kD.__decorate([(0,MD.rtfm)("api","HelixSearchApi")],Jp)});var Yp=u(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.StreamNotLiveError=void 0;var FD=m(),Xp=class extends FD.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};ru.StreamNotLiveError=Xp});var ux=u(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.createVideoQuery=Vt.createStreamMarkerBody=Vt.createStreamQuery=void 0;var ND=m();function QD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(QD,"createStreamQuery");Vt.createStreamQuery=QD;function GD(i,e){return{user_id:(0,ND.extractUserId)(i),description:e}}n(GD,"createStreamMarkerBody");Vt.createStreamMarkerBody=GD;function WD(i){return{video_id:i}}n(WD,"createVideoQuery");Vt.createVideoQuery=WD});var em=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixStream=void 0;var cx=(f(),b(y)),VD=C(),te=m(),iu=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}};ya.HelixStream=iu;cx.__decorate([(0,VD.Enumerable)(!1)],iu.prototype,"_client",void 0);ya.HelixStream=iu=cx.__decorate([(0,te.rtfm)("api","HelixStream","id")],iu)});var au=u(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.HelixStreamMarker=void 0;var dx=(f(),b(y)),$D=C(),ti=m(),nu=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}};fa.HelixStreamMarker=nu;dx.__decorate([(0,$D.Enumerable)(!1)],nu.prototype,"_client",void 0);fa.HelixStreamMarker=nu=dx.__decorate([(0,ti.rtfm)("api","HelixStreamMarker","id")],nu)});var im=u(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.HelixStreamMarkerWithVideo=void 0;var zD=(f(),b(y)),tm=m(),KD=au(),rm=class extends KD.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[tm.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,tm.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};ga.HelixStreamMarkerWithVideo=rm;ga.HelixStreamMarkerWithVideo=rm=zD.__decorate([(0,tm.rtfm)("api","HelixStreamMarkerWithVideo","id")],rm)});var am=u(wa=>{"use strict";var ii;Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixStreamApi=void 0;var nm=(f(),b(y)),ba=C(),hx=Z(),Te=m(),JD=Yp(),su=Ue(),ri=ux(),px=Bt(),ou=ae(),mx=ce(),lu=se(),ZD=Q(),pr=em(),XD=au(),YD=im(),xa=ii=class extends ZD.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new px.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new pr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new px.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,lu.createPaginationQuery)(e)}});return(0,mx.createPaginatedResult)(t,pr.HelixStream,this._client)}getStreamsPaginated(e={}){return new ou.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,ba.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,su.createUserQuery)(e),...(0,lu.createPaginationQuery)(t)},userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,ba.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 ou.HelixPaginatedRequest({url:"streams/markers",query:(0,su.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,lu.createPaginationQuery)(r)},userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,ba.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 ou.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 XD.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof hx.HttpStatusCodeError&&r.statusCode===404?new JD.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,hx.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,su.createSingleKeyQuery)("user_id",r),...(0,lu.createPaginationQuery)(t)}});return(0,mx.createPaginatedResult)(a,pr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Te.extractUserId)(e);return new ou.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,su.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 YD.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};wa.HelixStreamApi=xa;nm.__decorate([(0,ba.Enumerable)(!1)],xa.prototype,"_getStreamByUserIdBatcher",void 0);nm.__decorate([(0,ba.Enumerable)(!1)],xa.prototype,"_getStreamByUserNameBatcher",void 0);wa.HelixStreamApi=xa=ii=nm.__decorate([(0,Te.rtfm)("api","HelixStreamApi")],xa)});var yx=u(uu=>{"use strict";Object.defineProperty(uu,"__esModule",{value:!0});uu.createSubscriptionCheckQuery=void 0;var _x=m();function eI(i,e){return{broadcaster_id:(0,_x.extractUserId)(i),user_id:(0,_x.extractUserId)(e)}}n(eI,"createSubscriptionCheckQuery");uu.createSubscriptionCheckQuery=eI});var du=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixUserSubscription=void 0;var fx=(f(),b(y)),tI=C(),$t=m(),cu=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}};va.HelixUserSubscription=cu;fx.__decorate([(0,tI.Enumerable)(!1)],cu.prototype,"_client",void 0);va.HelixUserSubscription=cu=fx.__decorate([(0,$t.rtfm)("api","HelixUserSubscription","broadcasterId")],cu)});var hu=u(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixSubscription=void 0;var rI=(f(),b(y)),ue=m(),iI=du(),sm=class extends iI.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))}};Sa.HelixSubscription=sm;Sa.HelixSubscription=sm=rI.__decorate([(0,ue.rtfm)("api","HelixSubscription","userId")],sm)});var lm=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixPaginatedSubscriptionsRequest=void 0;var nI=(f(),b(y)),aI=Z(),gx=m(),sI=Mr(),oI=hu(),om=class extends sI.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,gx.extractUserId)(e),query:(0,aI.createBroadcasterQuery)(e)},t,r=>new oI.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};Ha.HelixPaginatedSubscriptionsRequest=om;Ha.HelixPaginatedSubscriptionsRequest=om=nI.__decorate([(0,gx.rtfm)("api","HelixPaginatedSubscriptionsRequest")],om)});var cm=u(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.HelixSubscriptionApi=void 0;var lI=(f(),b(y)),bx=Z(),pu=m(),uI=Ue(),cI=yx(),dI=ce(),hI=se(),pI=Q(),mI=lm(),xx=hu(),_I=du(),um=class extends pI.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,pu.extractUserId)(e),query:{...(0,bx.createBroadcasterQuery)(e),...(0,hI.createPaginationQuery)(t)}});return{...(0,dI.createPaginatedResultWithTotal)(r,xx.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new mI.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,pu.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,uI.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new xx.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,pu.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,cI.createSubscriptionCheckQuery)(t,e)});return new _I.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof bx.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ca.HelixSubscriptionApi=um;Ca.HelixSubscriptionApi=um=lI.__decorate([(0,pu.rtfm)("api","HelixSubscriptionApi")],um)});var _u=u(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.HelixTeam=void 0;var wx=(f(),b(y)),yI=C(),tt=m(),mu=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}};qa.HelixTeam=mu;wx.__decorate([(0,yI.Enumerable)(!1)],mu.prototype,"_client",void 0);qa.HelixTeam=mu=wx.__decorate([(0,tt.rtfm)("api","HelixTeam","id")],mu)});var hm=u(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixTeamWithUsers=void 0;var fI=(f(),b(y)),vx=m(),gI=Mo(),bI=_u(),dm=class extends bI.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[vx.rawDataSymbol].users.map(e=>new gI.HelixUserRelation(e,this._client))}};Ea.HelixTeamWithUsers=dm;Ea.HelixTeamWithUsers=dm=fI.__decorate([(0,vx.rtfm)("api","HelixTeamWithUsers","id")],dm)});var _m=u(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixTeamApi=void 0;var xI=(f(),b(y)),pm=Z(),Hx=m(),wI=Q(),vI=_u(),Sx=hm(),mm=class extends wI.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,Hx.extractUserId)(e),query:(0,pm.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new vI.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 Sx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof pm.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 Sx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof pm.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Pa.HelixTeamApi=mm;Pa.HelixTeamApi=mm=xI.__decorate([(0,Hx.rtfm)("api","HelixTeamApi")],mm)});var qx=u(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.createUserBlockDeleteQuery=ni.createUserBlockCreateQuery=void 0;var Cx=m();function SI(i,e){return{target_user_id:(0,Cx.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(SI,"createUserBlockCreateQuery");ni.createUserBlockCreateQuery=SI;function HI(i){return{target_user_id:(0,Cx.extractUserId)(i)}}n(HI,"createUserBlockDeleteQuery");ni.createUserBlockDeleteQuery=HI});var gu=u(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.HelixBaseExtension=void 0;var yu=m(),ym=class extends yu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[yu.rawDataSymbol].id}get version(){return this[yu.rawDataSymbol].version}get name(){return this[yu.rawDataSymbol].name}};fu.HelixBaseExtension=ym});var gm=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixInstalledExtension=void 0;var CI=(f(),b(y)),qI=m(),EI=gu(),fm=class extends EI.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}};Aa.HelixInstalledExtension=fm;Aa.HelixInstalledExtension=fm=CI.__decorate([(0,qI.rtfm)("api","HelixInstalledExtension","id")],fm)});var wm=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixInstalledExtensionList=void 0;var PI=(f(),b(y)),Da=m(),bm=gm(),xm=class extends Da.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[Da.rawDataSymbol][e][t];return r.active?new bm.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[Da.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new bm.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[Da.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new bm.HelixInstalledExtension(e,r,a)))}};Ia.HelixInstalledExtensionList=xm;Ia.HelixInstalledExtensionList=xm=PI.__decorate([(0,Da.rtfm)("api","HelixInstalledExtensionList")],xm)});var Hm=u(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.HelixUserExtension=void 0;var AI=(f(),b(y)),vm=m(),DI=gu(),Sm=class extends DI.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[vm.rawDataSymbol].can_activate}get types(){return this[vm.rawDataSymbol].type}};Ta.HelixUserExtension=Sm;Ta.HelixUserExtension=Sm=AI.__decorate([(0,vm.rtfm)("api","HelixUserExtension","id")],Sm)});var xu=u(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.HelixUser=void 0;var Ex=(f(),b(y)),II=C(),rt=m(),bu=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}};Ra.HelixUser=bu;Ex.__decorate([(0,II.Enumerable)(!1)],bu.prototype,"_client",void 0);Ra.HelixUser=bu=Ex.__decorate([(0,rt.rtfm)("api","HelixUser","id")],bu)});var qm=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixPrivilegedUser=void 0;var TI=(f(),b(y)),Px=m(),RI=xu(),Cm=class extends RI.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[Px.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};Ua.HelixPrivilegedUser=Cm;Ua.HelixPrivilegedUser=Cm=TI.__decorate([(0,Px.rtfm)("api","HelixPrivilegedUser","id")],Cm)});var Em=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixUserBlock=void 0;var Ax=(f(),b(y)),UI=C(),mr=m(),wu=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))}};Ba.HelixUserBlock=wu;Ax.__decorate([(0,UI.Enumerable)(!1)],wu.prototype,"_client",void 0);Ba.HelixUserBlock=wu=Ax.__decorate([(0,mr.rtfm)("api","HelixUserBlock","userId")],wu)});var Dm=u(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.HelixUserApi=void 0;var Pm=(f(),b(y)),Am=C(),Dx=Z(),be=m(),BI=Ue(),Ix=qx(),Tx=Bt(),OI=ae(),jI=ce(),kI=se(),MI=Q(),Rx=wm(),LI=Hm(),Ux=qm(),vu=xu(),Bx=Em(),Oa=class extends MI.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new Tx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new vu.HelixUser(e,this._client)),this._getUserByNameBatcher=new Tx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new vu.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,Am.mapNullable)(r.data[0],a=>new vu.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 Ux.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 Ux.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,Dx.createBroadcasterQuery)(e),...(0,kI.createPaginationQuery)(t)}});return(0,jI.createPaginatedResult)(r,Bx.HelixUserBlock,this._client)}getBlocksPaginated(e){return new OI.HelixPaginatedRequest({url:"users/blocks",userId:(0,be.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,Dx.createBroadcasterQuery)(e)},this._client,t=>new Bx.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,Ix.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,Ix.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 LI.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,BI.createSingleKeyQuery)("user_id",r)});return new Rx.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 Rx.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 vu.HelixUser(s,this._client))}};ja.HelixUserApi=Oa;Pm.__decorate([(0,Am.Enumerable)(!1)],Oa.prototype,"_getUserByIdBatcher",void 0);Pm.__decorate([(0,Am.Enumerable)(!1)],Oa.prototype,"_getUserByNameBatcher",void 0);ja.HelixUserApi=Oa=Pm.__decorate([(0,be.rtfm)("api","HelixUserApi")],Oa)});var Tm=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixVideo=void 0;var Im=(f(),b(y)),Ox=gi(),FI=C(),O=m(),ka=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})}};Ma.HelixVideo=ka;Im.__decorate([(0,FI.Enumerable)(!1)],ka.prototype,"_client",void 0);Im.__decorate([(0,Ox.CachedGetter)()],ka.prototype,"durationInSeconds",null);Ma.HelixVideo=ka=Im.__decorate([Ox.Cacheable,(0,O.rtfm)("api","HelixVideo","id")],ka)});var Um=u(La=>{"use strict";var Su;Object.defineProperty(La,"__esModule",{value:!0});La.HelixVideoApi=void 0;var jx=(f(),b(y)),NI=C(),Hu=m(),QI=Bt(),GI=ae(),WI=ce(),VI=se(),$I=Q(),Rm=Tm(),Cu=Su=class extends $I.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new QI.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new Rm.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,Hu.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Hu.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,Hu.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:{...Su._makeVideosQuery(e,t,r),...(0,VI.createPaginationQuery)(r)}});return(0,WI.createPaginatedResult)(a,Rm.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new GI.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Su._makeVideosQuery(e,t,r)},this._client,a=>new Rm.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}}};La.HelixVideoApi=Cu;jx.__decorate([(0,NI.Enumerable)(!1)],Cu.prototype,"_getVideoByIdBatcher",void 0);La.HelixVideoApi=Cu=Su=jx.__decorate([(0,Hu.rtfm)("api","HelixVideoApi")],Cu)});var Mx=u(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.createWhisperQuery=void 0;var kx=m();function zI(i,e){return{from_user_id:(0,kx.extractUserId)(i),to_user_id:(0,kx.extractUserId)(e)}}n(zI,"createWhisperQuery");qu.createWhisperQuery=zI});var Om=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixWhisperApi=void 0;var KI=(f(),b(y)),Lx=m(),JI=Mx(),ZI=Q(),Bm=class extends ZI.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,Lx.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,JI.createWhisperQuery)(e,t),jsonBody:{message:r}})}};Fa.HelixWhisperApi=Bm;Fa.HelixWhisperApi=Bm=KI.__decorate([(0,Lx.rtfm)("api","HelixWhisperApi")],Bm)});var km=u(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.ApiReportedRequest=void 0;var jm=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}};Eu.ApiReportedRequest=jm});var Au=u(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.BaseApiClient=void 0;var G=(f(),b(y)),W=gi(),XI=Xs(),YI=C(),e1=sd(),ai=Z(),Pu=Hd(),Fx=m(),t1=tg(),r1=Td(),i1=Vd(),n1=Jd(),a1=rh(),s1=Hh(),o1=Ph(),l1=Th(),u1=jh(),c1=Vh(),d1=Yh(),h1=rp(),p1=ap(),m1=up(),_1=qp(),y1=Ip(),f1=Op(),g1=Fp(),b1=zp(),x1=Zp(),w1=am(),v1=cm(),S1=_m(),H1=Dm(),C1=Um(),q1=Om(),E1=km(),L=class extends e1.EventEmitter{static{n(this,"BaseApiClient")}constructor(e,t,r){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=t,this._rateLimiter=r}async requestScopesForUser(e,t){await this._config.authProvider.getAccessTokenForUser(e,...t.map(r=>[r]))}async getTokenInfo(){try{let e=await this.callApi({type:"auth",url:"validate"});return new Pu.TokenInfo(e)}catch(e){throw e instanceof ai.HttpStatusCodeError&&e.statusCode===401?new Pu.InvalidTokenError({cause:e}):e}}async callApi(e){var t;let{authProvider:r}=this._config;if(!((t=e.auth)!==null&&t!==void 0?t:!0))return await(0,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 Fx.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){let d=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!d)throw new Error("Tried to make an API call with a user context but no context user ID");let h=await r.getAccessTokenForUser(d,e.scopes);if(!h)throw new Error(`Tried to make an API call with a user context for user ID ${d} but no token was found`);if((0,Pu.accessTokenIsExpired)(h)&&r.refreshAccessTokenForUser){let p=await r.refreshAccessTokenForUser(d);return await this._callApiUsingInitialToken(e,p,!0)}return await this._callApiUsingInitialToken(e,h)}let o=this._getUserIdFromRequestContext(e.userId),l=o===null?await r.getAnyAccessToken():await r.getAnyAccessToken(o??e.userId);if((0,Pu.accessTokenIsExpired)(l)&&l.userId&&r.refreshAccessTokenForUser){let d=await r.refreshAccessTokenForUser(l.userId);return await this._callApiUsingInitialToken(e,d,!0)}return await this._callApiUsingInitialToken(e,l)}get bits(){return new r1.HelixBitsApi(this)}get channels(){return new i1.HelixChannelApi(this)}get channelPoints(){return new n1.HelixChannelPointsApi(this)}get charity(){return new a1.HelixCharityApi(this)}get chat(){return new s1.HelixChatApi(this)}get clips(){return new o1.HelixClipApi(this)}get contentClassificationLabels(){return new l1.HelixContentClassificationLabelApi(this)}get entitlements(){return new u1.HelixEntitlementApi(this)}get eventSub(){return new c1.HelixEventSubApi(this)}get extensions(){return new d1.HelixExtensionsApi(this)}get games(){return new h1.HelixGameApi(this)}get hypeTrain(){return new m1.HelixHypeTrainApi(this)}get goals(){return new p1.HelixGoalApi(this)}get moderation(){return new _1.HelixModerationApi(this)}get polls(){return new y1.HelixPollApi(this)}get predictions(){return new f1.HelixPredictionApi(this)}get raids(){return new g1.HelixRaidApi(this)}get schedule(){return new b1.HelixScheduleApi(this)}get search(){return new x1.HelixSearchApi(this)}get streams(){return new w1.HelixStreamApi(this)}get subscriptions(){return new v1.HelixSubscriptionApi(this)}get teams(){return new S1.HelixTeamApi(this)}get users(){return new H1.HelixUserApi(this)}get videos(){return new C1.HelixVideoApi(this)}get whispers(){return new q1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof XI.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 E1.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=t1.operation({retries:3,minTimeout:500,factor:2}),{promise:E,resolve:q,reject:w}=(0,YI.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),q(v)}catch(v){if(x.retry(v))return;w(x.mainError())}});let P=await E;return this._logger.debug(`Called ${p} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${P.status}`),P}};Na.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);Na.BaseApiClient=L=G.__decorate([W.Cacheable,(0,Fx.rtfm)("api","ApiClient")],L)});var Nx=u(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.NoContextApiClient=void 0;var P1=(f(),b(y)),A1=m(),D1=Au(),Mm=class extends D1.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Qa.NoContextApiClient=Mm;Qa.NoContextApiClient=Mm=P1.__decorate([(0,A1.rtfm)("api","ApiClient")],Mm)});var Qx=u(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.UserContextApiClient=void 0;var I1=(f(),b(y)),T1=m(),R1=Au(),Lm=class extends R1.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Ga.UserContextApiClient=Lm;Ga.UserContextApiClient=Lm=I1.__decorate([(0,T1.rtfm)("api","ApiClient")],Lm)});var $x=u(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.ApiClient=void 0;var U1=(f(),b(y)),B1=ci(),O1=hi(),Gx=Xs(),j1=Z(),Vx=m(),k1=td(),M1=Tf(),L1=Au(),F1=Nx(),Wx=Qx(),Fm=class extends L1.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new k1.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,O1.createLogger)({name:"twurple:api:client",...e.logger}),B1.isNode?new Gx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new M1.HelixRateLimiter({logger:t}),"createChild")}):new Gx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,j1.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 Wx.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,Vx.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 Wx.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 F1.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};Wa.ApiClient=Fm;Wa.ApiClient=Fm=U1.__decorate([(0,Vx.rtfm)("api","ApiClient")],Fm)});var Kx=u(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.HelixFollow=void 0;var zx=(f(),b(y)),N1=C(),je=m(),Du=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)}};Va.HelixFollow=Du;zx.__decorate([(0,N1.Enumerable)(!1)],Du.prototype,"_client",void 0);Va.HelixFollow=Du=zx.__decorate([(0,je.rtfm)("api","HelixFollow")],Du)});var Jx=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 Q1=$x();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:n(function(){return Q1.ApiClient},"get")});var G1=Td();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:n(function(){return G1.HelixBitsApi},"get")});var W1=Ed();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return W1.HelixBitsLeaderboard},"get")});var V1=Cd();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return V1.HelixBitsLeaderboardEntry},"get")});var $1=Ad();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:n(function(){return $1.HelixCheermoteList},"get")});var z1=Vd();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:n(function(){return z1.HelixChannelApi},"get")});var K1=Fd();Object.defineProperty(c,"HelixAdSchedule",{enumerable:!0,get:n(function(){return K1.HelixAdSchedule},"get")});var J1=Od();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:n(function(){return J1.HelixChannel},"get")});var Z1=jd();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:n(function(){return Z1.HelixChannelEditor},"get")});var X1=kd();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:n(function(){return X1.HelixChannelFollower},"get")});var Y1=Md();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return Y1.HelixFollowedChannel},"get")});var eT=$h();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:n(function(){return eT.HelixChannelReference},"get")});var tT=Jd();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return tT.HelixChannelPointsApi},"get")});var rT=$d();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:n(function(){return rT.HelixCustomReward},"get")});var iT=zd();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return iT.HelixCustomRewardRedemption},"get")});var nT=rh();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:n(function(){return nT.HelixCharityApi},"get")});var aT=Xd();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return aT.HelixCharityCampaign},"get")});var sT=Yd();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return sT.HelixCharityCampaignDonation},"get")});var oT=tl();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return oT.HelixCharityCampaignAmount},"get")});var lT=Hh();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:n(function(){return lT.HelixChatApi},"get")});var uT=ch();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return uT.HelixChatBadgeSet},"get")});var cT=uh();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return cT.HelixChatBadgeVersion},"get")});var dT=ul();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:n(function(){return dT.HelixChatSettings},"get")});var hT=dh();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:n(function(){return hT.HelixChatChatter},"get")});var pT=Yi();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:n(function(){return pT.HelixEmote},"get")});var mT=oh();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:n(function(){return mT.HelixChannelEmote},"get")});var _T=ph();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return _T.HelixEmoteFromSet},"get")});var yT=mh();Object.defineProperty(c,"HelixUserEmote",{enumerable:!0,get:n(function(){return yT.HelixUserEmote},"get")});var fT=fh();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return fT.HelixPrivilegedChatSettings},"get")});var gT=bh();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return gT.HelixSentChatMessage},"get")});var bT=xh();Object.defineProperty(c,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return bT.HelixSharedChatSessionParticipant},"get")});var xT=wh();Object.defineProperty(c,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return xT.HelixSharedChatSession},"get")});var wT=Ph();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:n(function(){return wT.HelixClipApi},"get")});var vT=Ch();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:n(function(){return vT.HelixClip},"get")});var ST=Th();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return ST.HelixContentClassificationLabelApi},"get")});var HT=Dh();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return HT.HelixContentClassificationLabel},"get")});var CT=jh();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return CT.HelixEntitlementApi},"get")});var qT=Rh();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return qT.HelixDropsEntitlement},"get")});var ET=Vh();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:n(function(){return ET.HelixEventSubApi},"get")});var PT=Lh();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return PT.HelixEventSubConduit},"get")});var AT=Nh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return AT.HelixEventSubConduitShard},"get")});var DT=Sl();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return DT.HelixEventSubSubscription},"get")});var IT=Mh();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return IT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var TT=Yh();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return TT.HelixExtensionsApi},"get")});var RT=Kh();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return RT.HelixExtensionBitsProduct},"get")});var UT=Jh();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return UT.HelixExtensionTransaction},"get")});var BT=rp();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:n(function(){return BT.HelixGameApi},"get")});var OT=Dl();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:n(function(){return OT.HelixGame},"get")});var jT=ap();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:n(function(){return jT.HelixGoalApi},"get")});var kT=ip();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:n(function(){return kT.HelixGoal},"get")});var MT=up();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return MT.HelixHypeTrainApi},"get")});var LT=sp();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return LT.HelixHypeTrainContribution},"get")});var FT=op();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return FT.HelixHypeTrainEvent},"get")});var NT=qp();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:n(function(){return NT.HelixModerationApi},"get")});var QT=_p();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:n(function(){return QT.HelixBan},"get")});var GT=bp();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:n(function(){return GT.HelixModerator},"get")});var WT=gp();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return WT.HelixModeratedChannel},"get")});var VT=jl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:n(function(){return VT.HelixBanUser},"get")});var $T=fp();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return $T.HelixBlockedTerm},"get")});var zT=xp();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return zT.HelixShieldModeStatus},"get")});var KT=wp();Object.defineProperty(c,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return KT.HelixUnbanRequest},"get")});var JT=vp();Object.defineProperty(c,"HelixWarning",{enumerable:!0,get:n(function(){return JT.HelixWarning},"get")});var ZT=Ip();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:n(function(){return ZT.HelixPollApi},"get")});var XT=Ap();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:n(function(){return XT.HelixPoll},"get")});var YT=Pp();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:n(function(){return YT.HelixPollChoice},"get")});var eR=Op();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:n(function(){return eR.HelixPredictionApi},"get")});var tR=Up();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:n(function(){return tR.HelixPrediction},"get")});var rR=Rp();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return rR.HelixPredictionOutcome},"get")});var iR=Tp();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:n(function(){return iR.HelixPredictor},"get")});var nR=Fp();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:n(function(){return nR.HelixRaidApi},"get")});var aR=kp();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:n(function(){return aR.HelixRaid},"get")});var sR=Mo();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:n(function(){return sR.HelixUserRelation},"get")});var oR=zp();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:n(function(){return oR.HelixScheduleApi},"get")});var lR=Wp();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:n(function(){return lR.HelixSchedule},"get")});var uR=da();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return uR.HelixScheduleSegment},"get")});var cR=Gp();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return cR.HelixPaginatedScheduleSegmentRequest},"get")});var dR=Zp();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:n(function(){return dR.HelixSearchApi},"get")});var hR=Kp();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return hR.HelixChannelSearchResult},"get")});var pR=am();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:n(function(){return pR.HelixStreamApi},"get")});var mR=em();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:n(function(){return mR.HelixStream},"get")});var _R=au();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:n(function(){return _R.HelixStreamMarker},"get")});var yR=im();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return yR.HelixStreamMarkerWithVideo},"get")});var fR=lm();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return fR.HelixPaginatedSubscriptionsRequest},"get")});var gR=cm();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return gR.HelixSubscriptionApi},"get")});var bR=hu();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:n(function(){return bR.HelixSubscription},"get")});var xR=du();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:n(function(){return xR.HelixUserSubscription},"get")});var wR=_m();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:n(function(){return wR.HelixTeamApi},"get")});var vR=_u();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:n(function(){return vR.HelixTeam},"get")});var SR=hm();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return SR.HelixTeamWithUsers},"get")});var HR=Dm();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:n(function(){return HR.HelixUserApi},"get")});var CR=Em();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:n(function(){return CR.HelixUserBlock},"get")});var qR=Kx();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:n(function(){return qR.HelixFollow},"get")});var ER=qm();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return ER.HelixPrivilegedUser},"get")});var PR=xu();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:n(function(){return PR.HelixUser},"get")});var AR=gu();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:n(function(){return AR.HelixBaseExtension},"get")});var DR=gm();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return DR.HelixInstalledExtension},"get")});var IR=wm();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return IR.HelixInstalledExtensionList},"get")});var TR=Hm();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:n(function(){return TR.HelixUserExtension},"get")});var RR=Um();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:n(function(){return RR.HelixVideoApi},"get")});var UR=Tm();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:n(function(){return UR.HelixVideo},"get")});var BR=Om();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:n(function(){return BR.HelixWhisperApi},"get")});var OR=td();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:n(function(){return OR.ConfigError},"get")});var jR=Yp();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:n(function(){return jR.StreamNotLiveError},"get")});var kR=km();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:n(function(){return kR.ApiReportedRequest},"get")});var MR=ae();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return MR.HelixPaginatedRequest},"get")});var LR=Mr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return LR.HelixPaginatedRequestWithTotal},"get")});var Iu=m();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:n(function(){return Iu.extractUserId},"get")});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:n(function(){return Iu.extractUserName},"get")});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:n(function(){return Iu.HelixExtension},"get")});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:n(function(){return Iu.HellFreezesOverError},"get")})});var iw=u((MG,rw)=>{var Zx=Ou(),FR=Mu(),Xx=Ka(),zt=qt(),Yx=Fu(),ew=Qu(),tw=Wu(),Tu=j_(),{ApiClient:NR}=Jx(),{AppTokenAuthProvider:QR}=Hd(),Nm=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 QR(e,t);this.apiClient=new NR({authProvider:a})}this.emotes=new Xx,this.channels=new Xx,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new FR(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 tw(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 Tu.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 Zx(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 Tu.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=zt.FFZ.Channel(e);return Tu.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 Yx(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 Tu.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new ew(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:Zx,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:Yx,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:ew,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:tw,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}};rw.exports=Nm});var aw=u((FG,nw)=>{var GR=qt(),Qm=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||GR.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")})}};nw.exports=Qm});var WR=u((QG,sw)=>{sw.exports={BTTVEmote:Ou(),Channel:Mu(),Collection:Ka(),Constants:qt(),Emote:fr(),EmoteFetcher:iw(),EmoteParser:aw(),FFZEmote:Fu(),SevenTVEmote:Qu(),TwitchEmote:Wu()}});export default WR();
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 JC=m(),vd=class extends JC.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(),ZC=ud(),Ne=m(),Hd=Ho(),Xf=bd(),XC=wd(),Cd=qo(),YC=Po(),eq=Sd(),ct=Ei(),Yf=Io(),Mt=class extends ZC.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 YC.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 eq.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 XC.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(),tq=m(),rq=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,rq.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,tq.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 iq=Io();Object.defineProperty(R,"TokenFetcher",{enumerable:!0,get:n(function(){return iq.TokenFetcher},"get")});var nq=_d();Object.defineProperty(R,"TokenInfo",{enumerable:!0,get:n(function(){return nq.TokenInfo},"get")});var aq=Zf();Object.defineProperty(R,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return aq.AppTokenAuthProvider},"get")});var sq=eg();Object.defineProperty(R,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return sq.RefreshingAuthProvider},"get")});var oq=rg();Object.defineProperty(R,"StaticAuthProvider",{enumerable:!0,get:n(function(){return oq.StaticAuthProvider},"get")});var lq=bd();Object.defineProperty(R,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return lq.CachedRefreshFailureError},"get")});var uq=wd();Object.defineProperty(R,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return uq.IntermediateUserRemovalError},"get")});var cq=qo();Object.defineProperty(R,"InvalidTokenError",{enumerable:!0,get:n(function(){return cq.InvalidTokenError},"get")});var dq=Po();Object.defineProperty(R,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return dq.InvalidTokenTypeError},"get")});var hq=Sd();Object.defineProperty(R,"UnknownIntentError",{enumerable:!0,get:n(function(){return hq.UnknownIntentError},"get")})});var ag=u((Lj,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 pq=ag();sr.operation=function(i){var e=sr.timeouts(i);return new pq(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((Gj,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 mq=(b(),x(g)),yq=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;mq.__decorate([(0,yq.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)),fq=C(),xt=m(),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,fq.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(),gq=C(),Lo=m(),bq=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 bq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[Lo.rawDataSymbol].total}};Bi.HelixBitsLeaderboard=Ui;Ad.__decorate([(0,gq.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 xq=(b(),x(g)),wq=C(),Oi=m(),Id=class extends Oi.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,wq.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=xq.__decorate([(0,Oi.rtfm)("api","HelixCheermoteList")],Id)});var Bd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixBitsApi=void 0;var vq=(b(),x(g)),hg=C(),Sq=Y(),Rd=m(),Hq=ug(),Cq=G(),qq=Dd(),Eq=Td(),Ud=class extends Cq.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,Hq.createBitsLeaderboardQuery)(t)});return new qq.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,Sq.createBroadcasterQuery)});return new Eq.HelixCheermoteList(t.data)}};ki.HelixBitsApi=Ud;ki.HelixBitsApi=Ud=vq.__decorate([(0,Rd.rtfm)("api","HelixBitsApi")],Ud)});var _g=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=m();function Pq(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(Pq,"createChannelUpdateBody");Ge.createChannelUpdateBody=Pq;function Aq(i,e){return{broadcaster_id:(0,or.extractUserId)(i),length:e}}n(Aq,"createChannelCommercialBody");Ge.createChannelCommercialBody=Aq;function Dq(i,e){return{broadcaster_id:(0,or.extractUserId)(i),user_id:(0,or.extractUserId)(e)}}n(Dq,"createChannelVipUpdateQuery");Ge.createChannelVipUpdateQuery=Dq;function Iq(i,e){return{broadcaster_id:(0,or.extractUserId)(i),user_id:(0,pg.mapOptional)(e,or.extractUserId)}}n(Iq,"createChannelFollowerQuery");Ge.createChannelFollowerQuery=Iq;function Tq(i,e){return{broadcaster_id:(0,pg.mapOptional)(e,or.extractUserId),user_id:(0,or.extractUserId)(i)}}n(Tq,"createFollowedChannelQuery");Ge.createFollowedChannelQuery=Tq});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=m();function Rq(i,e){return{[i]:e}}n(Rq,"createSingleKeyQuery");We.createSingleKeyQuery=Rq;function Uq(i){return{user_id:(0,Fo.extractUserId)(i)}}n(Uq,"createUserQuery");We.createUserQuery=Uq;function Bq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Bq,"createModeratorActionQuery");We.createModeratorActionQuery=Bq;function Oq(i,e){return{broadcaster_id:(0,Fo.extractUserId)(i),id:e}}n(Oq,"createGetByIdsQuery");We.createGetByIdsQuery=Oq;function jq(i,e){return{broadcaster_id:(0,Fo.extractUserId)(i),user_id:e.map(Fo.extractUserId)}}n(jq,"createChannelUsersCheckQuery");We.createChannelUsersCheckQuery=jq});var Qo=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixUserRelation=void 0;var mg=(b(),x(g)),kq=C(),lr=m(),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;mg.__decorate([(0,kq.Enumerable)(!1)],No.prototype,"_client",void 0);Mi.HelixUserRelation=No=mg.__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 Mq=(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;Mq.__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)),Lq=C(),Fq=m();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,Lq.Enumerable)(!1)],Vo.prototype,"_client",void 0);Li.HelixPaginatedRequest=Vo=yg.__decorate([(0,Fq.rtfm)("api","HelixPaginatedRequest")],Vo)});var Gr=u(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixPaginatedRequestWithTotal=void 0;var Nq=(b(),x(g)),Qq=m(),Gq=oe(),kd=class extends Gq.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=Nq.__decorate([(0,Qq.rtfm)("api","HelixPaginatedRequestWithTotal")],kd)});var he=u(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.createPaginatedResultWithTotal=Wr.createPaginatedResult=void 0;function Wq(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(Wq,"createPaginatedResult");Wr.createPaginatedResult=Wq;function Vq(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(Vq,"createPaginatedResultWithTotal");Wr.createPaginatedResultWithTotal=Vq});var le=u($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.createPaginationQuery=void 0;function $q({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n($q,"createPaginationQuery");$o.createPaginationQuery=$q});var Md=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixChannel=void 0;var fg=(b(),x(g)),zq=C(),_e=m(),zo=class extends _e.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[_e.rawDataSymbol].broadcaster_id}get name(){return this[_e.rawDataSymbol].broadcaster_login}get displayName(){return this[_e.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].broadcaster_id))}get language(){return this[_e.rawDataSymbol].broadcaster_language}get gameId(){return this[_e.rawDataSymbol].game_id}get gameName(){return this[_e.rawDataSymbol].game_name}async getGame(){return this[_e.rawDataSymbol].game_id?(0,_e.checkRelationAssertion)(await this._client.games.getGameById(this[_e.rawDataSymbol].game_id)):null}get title(){return this[_e.rawDataSymbol].title}get delay(){return this[_e.rawDataSymbol].delay}get tags(){return this[_e.rawDataSymbol].tags}get contentClassificationLabels(){return this[_e.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[_e.rawDataSymbol].is_branded_content}};Ni.HelixChannel=zo;fg.__decorate([(0,zq.Enumerable)(!1)],zo.prototype,"_client",void 0);Ni.HelixChannel=zo=fg.__decorate([(0,_e.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)),Kq=C(),ur=m(),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,Kq.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)),Jq=C(),Ft=m(),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,Jq.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)),Zq=C(),Nt=m(),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,Zq.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 Xq=(b(),x(g)),Xe=m(),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=Xq.__decorate([(0,Xe.rtfm)("api","HelixAdSchedule")],Qd)});var wg=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixSnoozeNextAdResult=void 0;var Yq=(b(),x(g)),$i=m(),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=Yq.__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=m(),wt=_g(),vg=Oe(),Vd=Qo(),eE=Lt(),tE=oe(),Sg=Gr(),$d=he(),Xo=le(),rE=G(),zd=Md(),iE=Ld(),Hg=Fd(),Cg=Nd(),nE=Gd(),aE=wg(),Yo=class extends rE.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new eE.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 iE.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 tE.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 nE.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 aE.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=m();function sE(i,e){return{broadcaster_id:(0,el.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(sE,"createCustomRewardsQuery");Ve.createCustomRewardsQuery=sE;function oE(i,e){return{broadcaster_id:(0,el.extractUserId)(i),id:e}}n(oE,"createCustomRewardChangeQuery");Ve.createCustomRewardChangeQuery=oE;function lE(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(lE,"createCustomRewardBody");Ve.createCustomRewardBody=lE;function uE(i,e,t){return{broadcaster_id:(0,el.extractUserId)(i),reward_id:e,id:t}}n(uE,"createRewardRedemptionsByIdsQuery");Ve.createRewardRedemptionsByIdsQuery=uE;function cE(i,e,t,r){return{broadcaster_id:(0,el.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(cE,"createRedemptionsForBroadcasterQuery");Ve.createRedemptionsForBroadcasterQuery=cE});var Jd=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixCustomReward=void 0;var Ag=(b(),x(g)),dE=C(),M=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,dE.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)),hE=C(),Q=m(),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,hE.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 pE=(b(),x(g)),_E=Y(),dt=m(),vt=Pg(),mE=Oe(),yE=oe(),fE=he(),gE=le(),bE=G(),il=Jd(),nl=Zd(),Xd=class extends bE.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,mE.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,gE.createPaginationQuery)(a)}});return(0,fE.createPaginatedResult)(s,nl.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new yE.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=pE.__decorate([(0,dt.rtfm)("api","HelixChannelPointsApi")],Xd)});var al=u(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.HelixCharityCampaignAmount=void 0;var xE=(b(),x(g)),Yi=m(),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=xE.__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)),wE=C(),Ae=m(),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,wE.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)),vE=C(),St=m(),SE=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 SE.HelixCharityCampaignAmount(this[St.rawDataSymbol].amount)}};rn.HelixCharityCampaignDonation=ol;Rg.__decorate([(0,vE.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 HE=(b(),x(g)),Ug=Y(),ih=m(),CE=he(),qE=le(),EE=G(),PE=th(),AE=rh(),nh=class extends EE.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 PE.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,qE.createPaginationQuery)(t)}});return(0,CE.createPaginatedResult)(r,AE.HelixCharityCampaignDonation,this._client)}};nn.HelixCharityApi=nh;nn.HelixCharityApi=nh=HE.__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=m();function DE(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(DE,"createChatSettingsUpdateBody");De.createChatSettingsUpdateBody=DE;function IE(i,e){return{user_id:(0,sh.extractUserId)(i),color:e}}n(IE,"createChatColorUpdateQuery");De.createChatColorUpdateQuery=IE;function TE(i,e,t){return{from_broadcaster_id:(0,sh.extractUserId)(i),to_broadcaster_id:(0,sh.extractUserId)(e),moderator_id:t}}n(TE,"createShoutoutQuery");De.createShoutoutQuery=TE;function RE(i,e){return{broadcaster_id:i,sender_id:e}}n(RE,"createSendChatMessageQuery");De.createSendChatMessageQuery=RE;function UE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(UE,"createSendChatMessageBody");De.createSendChatMessageBody=UE;function BE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId,for_source_only:e?.forSourceOnly}}n(BE,"createSendChatMessageAsAppBody");De.createSendChatMessageAsAppBody=BE});var lh=u(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.HelixEmoteBase=void 0;var Ye=m(),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 OE=(b(),x(g)),Og=m(),jE=lh(),uh=class extends jE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[Og.rawDataSymbol].images[`url_${e}x`]}};an.HelixEmote=uh;an.HelixEmote=uh=OE.__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)),kE=C(),on=m(),ME=sn(),ul=class extends ME.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,kE.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 LE=(b(),x(g)),Qt=m(),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=LE.__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=m(),FE=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 FE.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 _h=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixChatChatter=void 0;var Lg=(b(),x(g)),NE=C(),dr=m(),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,NE.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 QE=(b(),x(g)),ht=m(),mh=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=mh;hn.HelixChatSettings=mh=QE.__decorate([(0,ht.rtfm)("api","HelixChatSettings","broadcasterId")],mh)});var yh=u(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.HelixEmoteFromSet=void 0;var Fg=(b(),x(g)),GE=C(),hr=m(),WE=sn(),_l=class extends WE.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=_l;Fg.__decorate([(0,GE.Enumerable)(!1)],_l.prototype,"_client",void 0);pn.HelixEmoteFromSet=_l=Fg.__decorate([(0,hr.rtfm)("api","HelixEmoteFromSet","id")],_l)});var fh=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixUserEmote=void 0;var Ng=(b(),x(g)),Gt=m(),VE=lh(),$E=C(),ml=class extends VE.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}};_n.HelixUserEmote=ml;Ng.__decorate([(0,$E.Enumerable)(!1)],ml.prototype,"_client",void 0);_n.HelixUserEmote=ml=Ng.__decorate([(0,Gt.rtfm)("api","HelixUserEmote","id")],ml)});var xh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixPrivilegedChatSettings=void 0;var zE=(b(),x(g)),gh=m(),KE=pl(),bh=class extends KE.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}};mn.HelixPrivilegedChatSettings=bh;mn.HelixPrivilegedChatSettings=bh=zE.__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 JE=(b(),x(g)),Vr=m(),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=JE.__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 ZE=m();function XE(i){return{broadcaster_id:(0,ZE.extractUserId)(i)}}n(XE,"createSharedChatSessionQuery");yl.createSharedChatSessionQuery=XE});var Sh=u(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.HelixSharedChatSessionParticipant=void 0;var Gg=(b(),x(g)),YE=C(),fn=m(),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,YE.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)),eP=C(),Ht=m(),tP=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 tP.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,eP.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 rP=(b(),x(g)),Ch=Y(),Z=m(),pr=Bg(),Wt=Oe(),iP=oe(),nP=Gr(),Vg=he(),$g=le(),aP=G(),sP=ch(),zg=ph(),Kg=_h(),oP=pl(),lP=sn(),uP=yh(),Jg=fh(),Zg=xh(),Xg=vh(),cP=Qg(),dP=Hh(),qh=class extends aP.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 nP.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 lP.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 sP.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 uP.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 iP.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 oP.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,cP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new dP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Wt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};xn.HelixChatApi=qh;xn.HelixChatApi=qh=rP.__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 hP=m();function pP(i,e){return{broadcaster_id:(0,hP.extractUserId)(i),has_delay:e.toString()}}n(pP,"createClipCreateQuery");$r.createClipCreateQuery=pP;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)),mP=C(),L=m(),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,mP.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)),yP=C(),zr=m(),Ah=Yg(),fP=Lt(),gP=oe(),bP=he(),xP=le(),wP=G(),Dh=Ph(),xl=class extends wP.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new fP.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,xP.createPaginationQuery)(e)}});return(0,bP.createPaginatedResult)(t,Dh.HelixClip,this._client)}_getClipsPaginated(e){return new gP.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,yP.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=m(),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 vP=(b(),x(g)),SP=m(),HP=G(),CP=Rh(),Uh=class extends HP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new CP.HelixContentClassificationLabel(r))}};Sn.HelixContentClassificationLabelApi=Uh;Sn.HelixContentClassificationLabelApi=Uh=vP.__decorate([(0,SP.rtfm)("api","HelixContentClassificationLabelApi")],Uh)});var rb=u(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.createDropsEntitlementUpdateBody=Kr.createDropsEntitlementQuery=void 0;var qP=C(),EP=m();function PP(i,e){return{user_id:e?(0,qP.mapOptional)(i.user,EP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(PP,"createDropsEntitlementQuery");Kr.createDropsEntitlementQuery=PP;function AP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(AP,"createDropsEntitlementUpdateBody");Kr.createDropsEntitlementUpdateBody=AP});var Oh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixDropsEntitlement=void 0;var ib=(b(),x(g)),DP=C(),je=m(),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,DP.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=m(),jh=rb(),IP=Lt(),TP=oe(),RP=he(),UP=le(),BP=G(),Hl=Oh(),Cl=class extends BP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new IP.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,UP.createPaginationQuery)(e)}});return(0,RP.createPaginatedResult)(r,Hl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new TP.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(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 ab=m();function OP(i){return{broadcaster_user_id:(0,ab.extractUserId)(i)}}n(OP,"createEventSubBroadcasterCondition");me.createEventSubBroadcasterCondition=OP;function jP(i,e){return{broadcaster_user_id:(0,ab.extractUserId)(i),reward_id:e}}n(jP,"createEventSubRewardCondition");me.createEventSubRewardCondition=jP;function kP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(kP,"createEventSubModeratorCondition");me.createEventSubModeratorCondition=kP;function MP(i,e){return{broadcaster_user_id:i,user_id:e}}n(MP,"createEventSubUserCondition");me.createEventSubUserCondition=MP;function LP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(LP,"createEventSubDropEntitlementGrantCondition");me.createEventSubDropEntitlementGrantCondition=LP;function FP(i,e){return{conduit_id:i,status:e}}n(FP,"createEventSubConduitCondition");me.createEventSubConduitCondition=FP;function NP(i,e){return{id:i,shard_count:e.toString()}}n(NP,"createEventSubConduitUpdateCondition");me.createEventSubConduitUpdateCondition=NP;function QP(i,e){return{conduit_id:i,shards:e}}n(QP,"createEventSubConduitShardsUpdateCondition");me.createEventSubConduitShardsUpdateCondition=QP});var El=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixEventSubSubscription=void 0;var ob=(b(),x(g)),GP=C(),$e=m(),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,GP.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 WP=(b(),x(g)),VP=m(),$P=Gr(),zP=El(),Fh=class extends $P.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new zP.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=WP.__decorate([(0,VP.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)),KP=C(),_r=m(),Pl=class extends _r.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[_r.rawDataSymbol].id}get shardCount(){return this[_r.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[_r.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[_r.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[_r.rawDataSymbol].id)}};Pn.HelixEventSubConduit=Pl;lb.__decorate([(0,KP.Enumerable)(!1)],Pl.prototype,"_client",void 0);Pn.HelixEventSubConduit=Pl=lb.__decorate([(0,_r.rtfm)("api","HelixEventSubConduit")],Pl)});var Wh=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixEventSubConduitShard=void 0;var JP=(b(),x(g)),An=m(),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=JP.__decorate([(0,An.rtfm)("api","HelixEventSubConduitShard")],Gh)});var Kh=u(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.HelixEventSubApi=void 0;var ZP=(b(),x(g)),XP=C(),U=m(),S=sb(),et=Oe(),YP=oe(),In=he(),Tn=le(),eA=G(),Rn=El(),Al=Nh(),Vh=Qh(),$h=Wh(),zh=class extends eA.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,XP.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 YP.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=ZP.__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 tA(i,e){return{extension_id:i,extension_version:e}}n(tA,"createReleasedExtensionFilter");Vt.createReleasedExtensionFilter=tA;function rA(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(rA,"createExtensionProductBody");Vt.createExtensionProductBody=rA;function iA(i,e){return{extension_id:i,id:e.transactionIds}}n(iA,"createExtensionTransactionQuery");Vt.createExtensionTransactionQuery=iA});var Jh=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixChannelReference=void 0;var cb=(b(),x(g)),nA=C(),Ie=m(),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,nA.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 aA=(b(),x(g)),sA=C(),$t=m(),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,sA.mapNullable)(this[$t.rawDataSymbol].expiration,e=>new Date(e))}};On.HelixExtensionBitsProduct=Zh;On.HelixExtensionBitsProduct=Zh=aA.__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)),oA=C(),pe=m(),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,oA.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 lA=(b(),x(g)),gb=m(),Tl=ub(),ep=Oe(),hb=oe(),pb=he(),_b=le(),uA=G(),mb=Jh(),yb=Xh(),fb=Yh(),tp=class extends uA.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,_b.createPaginationQuery)(t)}});return(0,pb.createPaginatedResult)(r,mb.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new hb.HelixPaginatedRequest({url:"extensions/live",query:(0,ep.createSingleKeyQuery)("extension_id",e)},this._client,t=>new mb.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,_b.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=lA.__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)),cA=C(),Ct=m(),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,cA.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(),dA=m(),ip=Lt(),hA=oe(),pA=he(),_A=le(),mA=G(),Jr=Ul(),Zr=class extends mA.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,pA.createPaginatedResult)(t,Jr.HelixGame,this._client)}getTopGamesPaginated(){return new hA.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,dA.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)),yA=C(),ke=m(),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,yA.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 fA=(b(),x(g)),gA=Y(),wb=m(),bA=G(),xA=sp(),op=class extends bA.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,gA.createBroadcasterQuery)(e)})).data.map(r=>new xA.HelixGoal(r,this._client))}};Nn.HelixGoalApi=op;Nn.HelixGoalApi=op=fA.__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)),wA=C(),mr=m(),jl=class extends mr.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[mr.rawDataSymbol].user}async getUser(){return(0,mr.checkRelationAssertion)(await this._client.users.getUserById(this[mr.rawDataSymbol].user))}get type(){return this[mr.rawDataSymbol].type}get total(){return this[mr.rawDataSymbol].total}};Qn.HelixHypeTrainContribution=jl;vb.__decorate([(0,wA.Enumerable)(!1)],jl.prototype,"_client",void 0);Qn.HelixHypeTrainContribution=jl=vb.__decorate([(0,mr.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)),vA=C(),ye=m(),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,vA.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=m(),SA=oe(),HA=he(),CA=le(),qA=G(),Eb=cp(),dp=class extends qA.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,CA.createPaginationQuery)(t)}});return(0,HA.createPaginatedResult)(r,Eb.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new SA.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=m();function EA(i,e){return{broadcaster_id:(0,zt.extractUserId)(i),user_id:e?.userId}}n(EA,"createModerationUserListQuery");ce.createModerationUserListQuery=EA;function PA(i,e){return{broadcaster_id:(0,zt.extractUserId)(i),user_id:(0,zt.extractUserId)(e)}}n(PA,"createModeratorModifyQuery");ce.createModeratorModifyQuery=PA;function AA(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(AA,"createResolveUnbanRequestQuery");ce.createResolveUnbanRequestQuery=AA;function DA(i,e,t){return{user_id:(0,zt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(DA,"createAutoModProcessBody");ce.createAutoModProcessBody=DA;function IA(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(IA,"createAutoModSettingsBody");ce.createAutoModSettingsBody=IA;function TA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,zt.extractUserId)(i.user)}}}n(TA,"createBanUserBody");ce.createBanUserBody=TA;function RA(i){return{is_active:i}}n(RA,"createUpdateShieldModeStatusBody");ce.createUpdateShieldModeStatusBody=RA;function UA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(UA,"createCheckAutoModStatusBody");ce.createCheckAutoModStatusBody=UA;function BA(i,e){return{data:{user_id:(0,zt.extractUserId)(i),reason:e}}}n(BA,"createWarnUserBody");ce.createWarnUserBody=BA});var Ab=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixAutoModSettings=void 0;var OA=(b(),x(g)),Te=m(),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=OA.__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 jA=(b(),x(g)),Ll=m(),_p=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=_p;Vn.HelixAutoModStatus=_p=jA.__decorate([(0,Ll.rtfm)("api","HelixAutoModStatus","messageId")],_p)});var Fl=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixBanUser=void 0;var mp=(b(),x(g)),yp=C(),qt=m(),$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;mp.__decorate([(0,yp.Enumerable)(!1)],$n.prototype,"_client",void 0);mp.__decorate([(0,yp.Enumerable)(!1)],$n.prototype,"_expiryTimestamp",void 0);zn.HelixBanUser=$n=mp.__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 kA=(b(),x(g)),Xr=m(),MA=Fl(),fp=class extends MA.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=kA.__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 LA=(b(),x(g)),pt=m(),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=LA.__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)),FA=C(),Et=m(),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,FA.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)),NA=C(),yr=m(),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,NA.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)),QA=C(),_t=m(),Gl=class extends _t.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[_t.rawDataSymbol].is_active}get moderatorId(){return this[_t.rawDataSymbol].moderator_id}get moderatorName(){return this[_t.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[_t.rawDataSymbol].moderator_name}async getModerator(){return(0,_t.checkRelationAssertion)(await this._client.users.getUserById(this[_t.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[_t.rawDataSymbol].last_activated_at===""?null:new Date(this[_t.rawDataSymbol].last_activated_at)}};Yn.HelixShieldModeStatus=Gl;Rb.__decorate([(0,QA.Enumerable)(!1)],Gl.prototype,"_client",void 0);Yn.HelixShieldModeStatus=Gl=Rb.__decorate([(0,_t.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=m(),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)),GA=C(),ze=m(),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,GA.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 WA=(b(),x(g)),qp=Y(),F=m(),fr=Oe(),tt=Pb(),$l=oe(),ra=he(),ia=le(),VA=G(),jb=Ab(),$A=Db(),kb=gp(),zA=Fl(),Mb=xp(),Lb=wp(),Fb=vp(),Nb=Sp(),Ep=Hp(),KA=Cp(),Pp=class extends VA.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 $A.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 zA.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 KA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,fr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};na.HelixModerationApi=Pp;na.HelixModerationApi=Pp=WA.__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=m();function JA(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(JA,"createPollBody");Yr.createPollBody=JA;function ZA(i,e,t){return{broadcaster_id:(0,Qb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(ZA,"createPollEndBody");Yr.createPollEndBody=ZA});var Ip=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixPollChoice=void 0;var XA=(b(),x(g)),ei=m(),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=XA.__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)),YA=C(),Se=m(),eD=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 eD.HelixPollChoice(e))}};sa.HelixPoll=zl;Wb.__decorate([(0,YA.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 tD=(b(),x(g)),Vb=Y(),ti=m(),rD=Oe(),$b=Gb(),iD=oe(),nD=he(),aD=le(),sD=G(),oa=Tp(),Rp=class extends sD.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,aD.createPaginationQuery)(t)}});return(0,nD.createPaginatedResult)(r,oa.HelixPoll,this._client)}getPollsPaginated(e){return new iD.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,rD.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=tD.__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=m();function oD(i,e){return{broadcaster_id:(0,zb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(oD,"createPredictionBody");ri.createPredictionBody=oD;function lD(i,e,t,r){return{broadcaster_id:(0,zb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(lD,"createEndPredictionBody");ri.createEndPredictionBody=lD});var Bp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixPredictor=void 0;var Jb=(b(),x(g)),uD=C(),Kt=m(),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,uD.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)),cD=C(),Jt=m(),dD=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 dD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};ca.HelixPredictionOutcome=Jl;Zb.__decorate([(0,cD.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)),hD=C(),re=m(),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,hD.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 pD=(b(),x(g)),ex=Y(),ii=m(),_D=Oe(),tx=Kb(),mD=oe(),yD=he(),fD=le(),gD=G(),ha=jp(),kp=class extends gD.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,fD.createPaginationQuery)(t)}});return(0,yD.createPaginatedResult)(r,ha.HelixPrediction,this._client)}getPredictionsPaginated(e){return new mD.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=pD.__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=m();function bD(i,e){return{from_broadcaster_id:(0,rx.extractUserId)(i),to_broadcaster_id:(0,rx.extractUserId)(e)}}n(bD,"createRaidStartQuery");Xl.createRaidStartQuery=bD});var Fp=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixRaid=void 0;var xD=(b(),x(g)),Yl=m(),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}};_a.HelixRaid=Lp;_a.HelixRaid=Lp=xD.__decorate([(0,Yl.rtfm)("api","HelixRaid")],Lp)});var Gp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixRaidApi=void 0;var wD=(b(),x(g)),vD=Y(),Np=m(),SD=ix(),HD=G(),CD=Fp(),Qp=class extends HD.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,SD.createRaidStartQuery)(e,t)});return new CD.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,vD.createBroadcasterQuery)(e)})}};ma.HelixRaidApi=Qp;ma.HelixRaidApi=Qp=wD.__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=m();function qD(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(qD,"createScheduleQuery");Ke.createScheduleQuery=qD;function ED(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(ED,"createScheduleSettingsUpdateQuery");Ke.createScheduleSettingsUpdateQuery=ED;function PD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(PD,"createScheduleSegmentBody");Ke.createScheduleSegmentBody=PD;function AD(i,e){return{broadcaster_id:(0,eu.extractUserId)(i),id:e}}n(AD,"createScheduleSegmentModifyQuery");Ke.createScheduleSegmentModifyQuery=AD;function DD(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(DD,"createScheduleSegmentUpdateBody");Ke.createScheduleSegmentUpdateBody=DD});var fa=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixScheduleSegment=void 0;var nx=(b(),x(g)),ax=C(),rt=m(),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 ID=(b(),x(g)),TD=m(),RD=Wp(),UD=oe(),BD=fa(),Vp=class extends UD.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,RD.createScheduleQuery)(e,r)},t,a=>new BD.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=ID.__decorate([(0,TD.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)),OD=C(),mt=m(),jD=fa(),ru=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 jD.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}};ba.HelixSchedule=ru;sx.__decorate([(0,OD.Enumerable)(!1)],ru.prototype,"_client",void 0);ba.HelixSchedule=ru=sx.__decorate([(0,mt.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=m(),kD=Oe(),ai=Wp(),MD=le(),LD=G(),FD=$p(),ND=zp(),Kp=fa(),Jp=class extends LD.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,MD.createPaginationQuery)(t)}});return{data:new ND.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new FD.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,kD.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 QD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(QD,"createSearchChannelsQuery");nu.createSearchChannelsQuery=QD});var Xp=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixChannelSearchResult=void 0;var ux=(b(),x(g)),GD=C(),fe=m(),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,GD.Enumerable)(!1)],au.prototype,"_client",void 0);xa.HelixChannelSearchResult=au=ux.__decorate([(0,fe.rtfm)("api","HelixChannelSearchResult","id")],au)});var e_=u(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.HelixSearchApi=void 0;var WD=(b(),x(g)),VD=m(),cx=lx(),dx=oe(),hx=he(),px=le(),$D=G(),_x=Ul(),mx=Xp(),Yp=class extends $D.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,_x.HelixGame,this._client)}searchCategoriesPaginated(e){return new dx.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new _x.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,mx.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new dx.HelixPaginatedRequest({url:"search/channels",query:(0,cx.createSearchChannelsQuery)(e,t)},this._client,r=>new mx.HelixChannelSearchResult(r,this._client))}};wa.HelixSearchApi=Yp;wa.HelixSearchApi=Yp=WD.__decorate([(0,VD.rtfm)("api","HelixSearchApi")],Yp)});var r_=u(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.StreamNotLiveError=void 0;var zD=m(),t_=class extends zD.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};su.StreamNotLiveError=t_});var yx=u(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.createVideoQuery=Zt.createStreamMarkerBody=Zt.createStreamQuery=void 0;var KD=m();function JD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(JD,"createStreamQuery");Zt.createStreamQuery=JD;function ZD(i,e){return{user_id:(0,KD.extractUserId)(i),description:e}}n(ZD,"createStreamMarkerBody");Zt.createStreamMarkerBody=ZD;function XD(i){return{video_id:i}}n(XD,"createVideoQuery");Zt.createVideoQuery=XD});var i_=u(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.HelixStream=void 0;var fx=(b(),x(g)),YD=C(),ie=m(),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,YD.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)),eI=C(),si=m(),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,eI.Enumerable)(!1)],lu.prototype,"_client",void 0);Sa.HelixStreamMarker=lu=gx.__decorate([(0,si.rtfm)("api","HelixStreamMarker","id")],lu)});var s_=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixStreamMarkerWithVideo=void 0;var tI=(b(),x(g)),n_=m(),rI=uu(),a_=class extends rI.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[n_.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,n_.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};Ha.HelixStreamMarkerWithVideo=a_;Ha.HelixStreamMarkerWithVideo=a_=tI.__decorate([(0,n_.rtfm)("api","HelixStreamMarkerWithVideo","id")],a_)});var l_=u(Ea=>{"use strict";var li;Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixStreamApi=void 0;var o_=(b(),x(g)),Ca=C(),bx=Y(),Re=m(),iI=r_(),cu=Oe(),oi=yx(),xx=Lt(),du=oe(),wx=he(),hu=le(),nI=G(),gr=i_(),aI=uu(),sI=s_(),qa=li=class extends nI.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 aI.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof bx.HttpStatusCodeError&&r.statusCode===404?new iI.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 sI.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};Ea.HelixStreamApi=qa;o_.__decorate([(0,Ca.Enumerable)(!1)],qa.prototype,"_getStreamByUserIdBatcher",void 0);o_.__decorate([(0,Ca.Enumerable)(!1)],qa.prototype,"_getStreamByUserNameBatcher",void 0);Ea.HelixStreamApi=qa=li=o_.__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=m();function oI(i,e){return{broadcaster_id:(0,vx.extractUserId)(i),user_id:(0,vx.extractUserId)(e)}}n(oI,"createSubscriptionCheckQuery");pu.createSubscriptionCheckQuery=oI});var mu=u(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixUserSubscription=void 0;var Hx=(b(),x(g)),lI=C(),Xt=m(),_u=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=_u;Hx.__decorate([(0,lI.Enumerable)(!1)],_u.prototype,"_client",void 0);Pa.HelixUserSubscription=_u=Hx.__decorate([(0,Xt.rtfm)("api","HelixUserSubscription","broadcasterId")],_u)});var yu=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixSubscription=void 0;var uI=(b(),x(g)),de=m(),cI=mu(),u_=class extends cI.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=u_;Aa.HelixSubscription=u_=uI.__decorate([(0,de.rtfm)("api","HelixSubscription","userId")],u_)});var d_=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixPaginatedSubscriptionsRequest=void 0;var dI=(b(),x(g)),hI=Y(),Cx=m(),pI=Gr(),_I=yu(),c_=class extends pI.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,Cx.extractUserId)(e),query:(0,hI.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=c_;Da.HelixPaginatedSubscriptionsRequest=c_=dI.__decorate([(0,Cx.rtfm)("api","HelixPaginatedSubscriptionsRequest")],c_)});var p_=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixSubscriptionApi=void 0;var mI=(b(),x(g)),qx=Y(),fu=m(),yI=Oe(),fI=Sx(),gI=he(),bI=le(),xI=G(),wI=d_(),Ex=yu(),vI=mu(),h_=class extends xI.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,bI.createPaginationQuery)(t)}});return{...(0,gI.createPaginatedResultWithTotal)(r,Ex.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new wI.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,yI.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,fI.createSubscriptionCheckQuery)(t,e)});return new vI.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof qx.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ia.HelixSubscriptionApi=h_;Ia.HelixSubscriptionApi=h_=mI.__decorate([(0,fu.rtfm)("api","HelixSubscriptionApi")],h_)});var bu=u(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.HelixTeam=void 0;var Px=(b(),x(g)),SI=C(),it=m(),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,SI.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 HI=(b(),x(g)),Ax=m(),CI=Qo(),qI=bu(),__=class extends qI.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Ax.rawDataSymbol].users.map(e=>new CI.HelixUserRelation(e,this._client))}};Ra.HelixTeamWithUsers=__;Ra.HelixTeamWithUsers=__=HI.__decorate([(0,Ax.rtfm)("api","HelixTeamWithUsers","id")],__)});var g_=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixTeamApi=void 0;var EI=(b(),x(g)),y_=Y(),Ix=m(),PI=G(),AI=bu(),Dx=m_(),f_=class extends PI.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,y_.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new AI.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 y_.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 y_.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Ua.HelixTeamApi=f_;Ua.HelixTeamApi=f_=EI.__decorate([(0,Ix.rtfm)("api","HelixTeamApi")],f_)});var Rx=u(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.createUserBlockDeleteQuery=ui.createUserBlockCreateQuery=void 0;var Tx=m();function DI(i,e){return{target_user_id:(0,Tx.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(DI,"createUserBlockCreateQuery");ui.createUserBlockCreateQuery=DI;function II(i){return{target_user_id:(0,Tx.extractUserId)(i)}}n(II,"createUserBlockDeleteQuery");ui.createUserBlockDeleteQuery=II});var vu=u(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.HelixBaseExtension=void 0;var xu=m(),b_=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=b_});var w_=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixInstalledExtension=void 0;var TI=(b(),x(g)),RI=m(),UI=vu(),x_=class extends UI.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=x_;Ba.HelixInstalledExtension=x_=TI.__decorate([(0,RI.rtfm)("api","HelixInstalledExtension","id")],x_)});var H_=u(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.HelixInstalledExtensionList=void 0;var BI=(b(),x(g)),Oa=m(),v_=w_(),S_=class extends Oa.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[Oa.rawDataSymbol][e][t];return r.active?new v_.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[Oa.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new v_.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 v_.HelixInstalledExtension(e,r,a)))}};ja.HelixInstalledExtensionList=S_;ja.HelixInstalledExtensionList=S_=BI.__decorate([(0,Oa.rtfm)("api","HelixInstalledExtensionList")],S_)});var E_=u(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.HelixUserExtension=void 0;var OI=(b(),x(g)),C_=m(),jI=vu(),q_=class extends jI.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[C_.rawDataSymbol].can_activate}get types(){return this[C_.rawDataSymbol].type}};ka.HelixUserExtension=q_;ka.HelixUserExtension=q_=OI.__decorate([(0,C_.rtfm)("api","HelixUserExtension","id")],q_)});var Hu=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixUser=void 0;var Ux=(b(),x(g)),kI=C(),nt=m(),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,kI.Enumerable)(!1)],Su.prototype,"_client",void 0);Ma.HelixUser=Su=Ux.__decorate([(0,nt.rtfm)("api","HelixUser","id")],Su)});var A_=u(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.HelixPrivilegedUser=void 0;var MI=(b(),x(g)),Bx=m(),LI=Hu(),P_=class extends LI.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=P_;La.HelixPrivilegedUser=P_=MI.__decorate([(0,Bx.rtfm)("api","HelixPrivilegedUser","id")],P_)});var D_=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixUserBlock=void 0;var Ox=(b(),x(g)),FI=C(),br=m(),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,FI.Enumerable)(!1)],Cu.prototype,"_client",void 0);Fa.HelixUserBlock=Cu=Ox.__decorate([(0,br.rtfm)("api","HelixUserBlock","userId")],Cu)});var R_=u(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.HelixUserApi=void 0;var I_=(b(),x(g)),T_=C(),jx=Y(),xe=m(),NI=Oe(),kx=Rx(),Mx=Lt(),QI=oe(),GI=he(),WI=le(),VI=G(),Lx=H_(),$I=E_(),Fx=A_(),qu=Hu(),Nx=D_(),Na=class extends VI.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,T_.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,WI.createPaginationQuery)(t)}});return(0,GI.createPaginatedResult)(r,Nx.HelixUserBlock,this._client)}getBlocksPaginated(e){return new QI.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 $I.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,NI.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;I_.__decorate([(0,T_.Enumerable)(!1)],Na.prototype,"_getUserByIdBatcher",void 0);I_.__decorate([(0,T_.Enumerable)(!1)],Na.prototype,"_getUserByNameBatcher",void 0);Qa.HelixUserApi=Na=I_.__decorate([(0,xe.rtfm)("api","HelixUserApi")],Na)});var B_=u(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.HelixVideo=void 0;var U_=(b(),x(g)),Qx=Hi(),zI=C(),j=m(),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;U_.__decorate([(0,zI.Enumerable)(!1)],Ga.prototype,"_client",void 0);U_.__decorate([(0,Qx.CachedGetter)()],Ga.prototype,"durationInSeconds",null);Wa.HelixVideo=Ga=U_.__decorate([Qx.Cacheable,(0,j.rtfm)("api","HelixVideo","id")],Ga)});var j_=u(Va=>{"use strict";var Eu;Object.defineProperty(Va,"__esModule",{value:!0});Va.HelixVideoApi=void 0;var Gx=(b(),x(g)),KI=C(),Pu=m(),JI=Lt(),ZI=oe(),XI=he(),YI=le(),e1=G(),O_=B_(),Au=Eu=class extends e1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new JI.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new O_.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,YI.createPaginationQuery)(r)}});return(0,XI.createPaginatedResult)(a,O_.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new ZI.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Eu._makeVideosQuery(e,t,r)},this._client,a=>new O_.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,KI.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=m();function t1(i,e){return{from_user_id:(0,Wx.extractUserId)(i),to_user_id:(0,Wx.extractUserId)(e)}}n(t1,"createWhisperQuery");Du.createWhisperQuery=t1});var M_=u($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.HelixWhisperApi=void 0;var r1=(b(),x(g)),$x=m(),i1=Vx(),n1=G(),k_=class extends n1.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,i1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};$a.HelixWhisperApi=k_;$a.HelixWhisperApi=k_=r1.__decorate([(0,$x.rtfm)("api","HelixWhisperApi")],k_)});var F_=u(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ApiReportedRequest=void 0;var L_=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=L_});var Ru=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.BaseApiClient=void 0;var W=(b(),x(g)),V=Hi(),a1=ro(),s1=C(),o1=ud(),ci=Y(),Tu=Ed(),zx=m(),l1=lg(),u1=Bd(),c1=Kd(),d1=Yd(),h1=ah(),p1=Eh(),_1=Ih(),m1=Bh(),y1=Lh(),f1=Kh(),g1=rp(),b1=ap(),x1=lp(),w1=hp(),v1=Ap(),S1=Up(),H1=Mp(),C1=Gp(),q1=Zp(),E1=e_(),P1=l_(),A1=p_(),D1=g_(),I1=R_(),T1=j_(),R1=M_(),U1=F_(),N=class extends o1.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 u1.HelixBitsApi(this)}get channels(){return new c1.HelixChannelApi(this)}get channelPoints(){return new d1.HelixChannelPointsApi(this)}get charity(){return new h1.HelixCharityApi(this)}get chat(){return new p1.HelixChatApi(this)}get clips(){return new _1.HelixClipApi(this)}get contentClassificationLabels(){return new m1.HelixContentClassificationLabelApi(this)}get entitlements(){return new y1.HelixEntitlementApi(this)}get eventSub(){return new f1.HelixEventSubApi(this)}get extensions(){return new g1.HelixExtensionsApi(this)}get games(){return new b1.HelixGameApi(this)}get hypeTrain(){return new w1.HelixHypeTrainApi(this)}get goals(){return new x1.HelixGoalApi(this)}get moderation(){return new v1.HelixModerationApi(this)}get polls(){return new S1.HelixPollApi(this)}get predictions(){return new H1.HelixPredictionApi(this)}get raids(){return new C1.HelixRaidApi(this)}get schedule(){return new q1.HelixScheduleApi(this)}get search(){return new E1.HelixSearchApi(this)}get streams(){return new P1.HelixStreamApi(this)}get subscriptions(){return new A1.HelixSubscriptionApi(this)}get teams(){return new D1.HelixTeamApi(this)}get users(){return new I1.HelixUserApi(this)}get videos(){return new T1.HelixVideoApi(this)}get whispers(){return new R1.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof a1.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 U1.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=l1.operation({retries:3,minTimeout:500,factor:2}),{promise:E,resolve:P,reject:y}=(0,s1.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 B1=(b(),x(g)),O1=m(),j1=Ru(),N_=class extends j1.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Ka.NoContextApiClient=N_;Ka.NoContextApiClient=N_=B1.__decorate([(0,O1.rtfm)("api","ApiClient")],N_)});var Jx=u(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.UserContextApiClient=void 0;var k1=(b(),x(g)),M1=m(),L1=Ru(),Q_=class extends L1.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Ja.UserContextApiClient=Q_;Ja.UserContextApiClient=Q_=k1.__decorate([(0,M1.rtfm)("api","ApiClient")],Q_)});var ew=u(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.ApiClient=void 0;var F1=(b(),x(g)),N1=yi(),Q1=gi(),Zx=ro(),G1=Y(),Yx=m(),W1=nd(),V1=Mf(),$1=Ru(),z1=Kx(),Xx=Jx(),G_=class extends $1.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new W1.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,Q1.createLogger)({name:"twurple:api:client",...e.logger}),N1.isNode?new Zx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new V1.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,G1.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 z1.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};Za.ApiClient=G_;Za.ApiClient=G_=F1.__decorate([(0,Yx.rtfm)("api","ApiClient")],G_)});var rw=u(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.HelixFollow=void 0;var tw=(b(),x(g)),K1=C(),Me=m(),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,K1.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 J1=ew();Object.defineProperty(d,"ApiClient",{enumerable:!0,get:n(function(){return J1.ApiClient},"get")});var Z1=Bd();Object.defineProperty(d,"HelixBitsApi",{enumerable:!0,get:n(function(){return Z1.HelixBitsApi},"get")});var X1=Dd();Object.defineProperty(d,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return X1.HelixBitsLeaderboard},"get")});var Y1=Pd();Object.defineProperty(d,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return Y1.HelixBitsLeaderboardEntry},"get")});var eT=Td();Object.defineProperty(d,"HelixCheermoteList",{enumerable:!0,get:n(function(){return eT.HelixCheermoteList},"get")});var tT=Kd();Object.defineProperty(d,"HelixChannelApi",{enumerable:!0,get:n(function(){return tT.HelixChannelApi},"get")});var rT=Gd();Object.defineProperty(d,"HelixAdSchedule",{enumerable:!0,get:n(function(){return rT.HelixAdSchedule},"get")});var iT=Md();Object.defineProperty(d,"HelixChannel",{enumerable:!0,get:n(function(){return iT.HelixChannel},"get")});var nT=Ld();Object.defineProperty(d,"HelixChannelEditor",{enumerable:!0,get:n(function(){return nT.HelixChannelEditor},"get")});var aT=Fd();Object.defineProperty(d,"HelixChannelFollower",{enumerable:!0,get:n(function(){return aT.HelixChannelFollower},"get")});var sT=Nd();Object.defineProperty(d,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return sT.HelixFollowedChannel},"get")});var oT=Jh();Object.defineProperty(d,"HelixChannelReference",{enumerable:!0,get:n(function(){return oT.HelixChannelReference},"get")});var lT=Yd();Object.defineProperty(d,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return lT.HelixChannelPointsApi},"get")});var uT=Jd();Object.defineProperty(d,"HelixCustomReward",{enumerable:!0,get:n(function(){return uT.HelixCustomReward},"get")});var cT=Zd();Object.defineProperty(d,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return cT.HelixCustomRewardRedemption},"get")});var dT=ah();Object.defineProperty(d,"HelixCharityApi",{enumerable:!0,get:n(function(){return dT.HelixCharityApi},"get")});var hT=th();Object.defineProperty(d,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return hT.HelixCharityCampaign},"get")});var pT=rh();Object.defineProperty(d,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return pT.HelixCharityCampaignDonation},"get")});var _T=al();Object.defineProperty(d,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return _T.HelixCharityCampaignAmount},"get")});var mT=Eh();Object.defineProperty(d,"HelixChatApi",{enumerable:!0,get:n(function(){return mT.HelixChatApi},"get")});var yT=ph();Object.defineProperty(d,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return yT.HelixChatBadgeSet},"get")});var fT=hh();Object.defineProperty(d,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return fT.HelixChatBadgeVersion},"get")});var gT=pl();Object.defineProperty(d,"HelixChatSettings",{enumerable:!0,get:n(function(){return gT.HelixChatSettings},"get")});var bT=_h();Object.defineProperty(d,"HelixChatChatter",{enumerable:!0,get:n(function(){return bT.HelixChatChatter},"get")});var xT=sn();Object.defineProperty(d,"HelixEmote",{enumerable:!0,get:n(function(){return xT.HelixEmote},"get")});var wT=ch();Object.defineProperty(d,"HelixChannelEmote",{enumerable:!0,get:n(function(){return wT.HelixChannelEmote},"get")});var vT=yh();Object.defineProperty(d,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return vT.HelixEmoteFromSet},"get")});var ST=fh();Object.defineProperty(d,"HelixUserEmote",{enumerable:!0,get:n(function(){return ST.HelixUserEmote},"get")});var HT=xh();Object.defineProperty(d,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return HT.HelixPrivilegedChatSettings},"get")});var CT=vh();Object.defineProperty(d,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return CT.HelixSentChatMessage},"get")});var qT=Sh();Object.defineProperty(d,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return qT.HelixSharedChatSessionParticipant},"get")});var ET=Hh();Object.defineProperty(d,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return ET.HelixSharedChatSession},"get")});var PT=Ih();Object.defineProperty(d,"HelixClipApi",{enumerable:!0,get:n(function(){return PT.HelixClipApi},"get")});var AT=Ph();Object.defineProperty(d,"HelixClip",{enumerable:!0,get:n(function(){return AT.HelixClip},"get")});var DT=Bh();Object.defineProperty(d,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return DT.HelixContentClassificationLabelApi},"get")});var IT=Rh();Object.defineProperty(d,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return IT.HelixContentClassificationLabel},"get")});var TT=Lh();Object.defineProperty(d,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return TT.HelixEntitlementApi},"get")});var RT=Oh();Object.defineProperty(d,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return RT.HelixDropsEntitlement},"get")});var UT=Kh();Object.defineProperty(d,"HelixEventSubApi",{enumerable:!0,get:n(function(){return UT.HelixEventSubApi},"get")});var BT=Qh();Object.defineProperty(d,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return BT.HelixEventSubConduit},"get")});var OT=Wh();Object.defineProperty(d,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return OT.HelixEventSubConduitShard},"get")});var jT=El();Object.defineProperty(d,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return jT.HelixEventSubSubscription},"get")});var kT=Nh();Object.defineProperty(d,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return kT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var MT=rp();Object.defineProperty(d,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return MT.HelixExtensionsApi},"get")});var LT=Xh();Object.defineProperty(d,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return LT.HelixExtensionBitsProduct},"get")});var FT=Yh();Object.defineProperty(d,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return FT.HelixExtensionTransaction},"get")});var NT=ap();Object.defineProperty(d,"HelixGameApi",{enumerable:!0,get:n(function(){return NT.HelixGameApi},"get")});var QT=Ul();Object.defineProperty(d,"HelixGame",{enumerable:!0,get:n(function(){return QT.HelixGame},"get")});var GT=lp();Object.defineProperty(d,"HelixGoalApi",{enumerable:!0,get:n(function(){return GT.HelixGoalApi},"get")});var WT=sp();Object.defineProperty(d,"HelixGoal",{enumerable:!0,get:n(function(){return WT.HelixGoal},"get")});var VT=hp();Object.defineProperty(d,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return VT.HelixHypeTrainApi},"get")});var $T=up();Object.defineProperty(d,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return $T.HelixHypeTrainContribution},"get")});var zT=cp();Object.defineProperty(d,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return zT.HelixHypeTrainEvent},"get")});var KT=Ap();Object.defineProperty(d,"HelixModerationApi",{enumerable:!0,get:n(function(){return KT.HelixModerationApi},"get")});var JT=gp();Object.defineProperty(d,"HelixBan",{enumerable:!0,get:n(function(){return JT.HelixBan},"get")});var ZT=vp();Object.defineProperty(d,"HelixModerator",{enumerable:!0,get:n(function(){return ZT.HelixModerator},"get")});var XT=wp();Object.defineProperty(d,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return XT.HelixModeratedChannel},"get")});var YT=Fl();Object.defineProperty(d,"HelixBanUser",{enumerable:!0,get:n(function(){return YT.HelixBanUser},"get")});var eR=xp();Object.defineProperty(d,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return eR.HelixBlockedTerm},"get")});var tR=Sp();Object.defineProperty(d,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return tR.HelixShieldModeStatus},"get")});var rR=Hp();Object.defineProperty(d,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return rR.HelixUnbanRequest},"get")});var iR=Cp();Object.defineProperty(d,"HelixWarning",{enumerable:!0,get:n(function(){return iR.HelixWarning},"get")});var nR=Up();Object.defineProperty(d,"HelixPollApi",{enumerable:!0,get:n(function(){return nR.HelixPollApi},"get")});var aR=Tp();Object.defineProperty(d,"HelixPoll",{enumerable:!0,get:n(function(){return aR.HelixPoll},"get")});var sR=Ip();Object.defineProperty(d,"HelixPollChoice",{enumerable:!0,get:n(function(){return sR.HelixPollChoice},"get")});var oR=Mp();Object.defineProperty(d,"HelixPredictionApi",{enumerable:!0,get:n(function(){return oR.HelixPredictionApi},"get")});var lR=jp();Object.defineProperty(d,"HelixPrediction",{enumerable:!0,get:n(function(){return lR.HelixPrediction},"get")});var uR=Op();Object.defineProperty(d,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return uR.HelixPredictionOutcome},"get")});var cR=Bp();Object.defineProperty(d,"HelixPredictor",{enumerable:!0,get:n(function(){return cR.HelixPredictor},"get")});var dR=Gp();Object.defineProperty(d,"HelixRaidApi",{enumerable:!0,get:n(function(){return dR.HelixRaidApi},"get")});var hR=Fp();Object.defineProperty(d,"HelixRaid",{enumerable:!0,get:n(function(){return hR.HelixRaid},"get")});var pR=Qo();Object.defineProperty(d,"HelixUserRelation",{enumerable:!0,get:n(function(){return pR.HelixUserRelation},"get")});var _R=Zp();Object.defineProperty(d,"HelixScheduleApi",{enumerable:!0,get:n(function(){return _R.HelixScheduleApi},"get")});var mR=zp();Object.defineProperty(d,"HelixSchedule",{enumerable:!0,get:n(function(){return mR.HelixSchedule},"get")});var yR=fa();Object.defineProperty(d,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return yR.HelixScheduleSegment},"get")});var fR=$p();Object.defineProperty(d,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return fR.HelixPaginatedScheduleSegmentRequest},"get")});var gR=e_();Object.defineProperty(d,"HelixSearchApi",{enumerable:!0,get:n(function(){return gR.HelixSearchApi},"get")});var bR=Xp();Object.defineProperty(d,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return bR.HelixChannelSearchResult},"get")});var xR=l_();Object.defineProperty(d,"HelixStreamApi",{enumerable:!0,get:n(function(){return xR.HelixStreamApi},"get")});var wR=i_();Object.defineProperty(d,"HelixStream",{enumerable:!0,get:n(function(){return wR.HelixStream},"get")});var vR=uu();Object.defineProperty(d,"HelixStreamMarker",{enumerable:!0,get:n(function(){return vR.HelixStreamMarker},"get")});var SR=s_();Object.defineProperty(d,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return SR.HelixStreamMarkerWithVideo},"get")});var HR=d_();Object.defineProperty(d,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return HR.HelixPaginatedSubscriptionsRequest},"get")});var CR=p_();Object.defineProperty(d,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return CR.HelixSubscriptionApi},"get")});var qR=yu();Object.defineProperty(d,"HelixSubscription",{enumerable:!0,get:n(function(){return qR.HelixSubscription},"get")});var ER=mu();Object.defineProperty(d,"HelixUserSubscription",{enumerable:!0,get:n(function(){return ER.HelixUserSubscription},"get")});var PR=g_();Object.defineProperty(d,"HelixTeamApi",{enumerable:!0,get:n(function(){return PR.HelixTeamApi},"get")});var AR=bu();Object.defineProperty(d,"HelixTeam",{enumerable:!0,get:n(function(){return AR.HelixTeam},"get")});var DR=m_();Object.defineProperty(d,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return DR.HelixTeamWithUsers},"get")});var IR=R_();Object.defineProperty(d,"HelixUserApi",{enumerable:!0,get:n(function(){return IR.HelixUserApi},"get")});var TR=D_();Object.defineProperty(d,"HelixUserBlock",{enumerable:!0,get:n(function(){return TR.HelixUserBlock},"get")});var RR=rw();Object.defineProperty(d,"HelixFollow",{enumerable:!0,get:n(function(){return RR.HelixFollow},"get")});var UR=A_();Object.defineProperty(d,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return UR.HelixPrivilegedUser},"get")});var BR=Hu();Object.defineProperty(d,"HelixUser",{enumerable:!0,get:n(function(){return BR.HelixUser},"get")});var OR=vu();Object.defineProperty(d,"HelixBaseExtension",{enumerable:!0,get:n(function(){return OR.HelixBaseExtension},"get")});var jR=w_();Object.defineProperty(d,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return jR.HelixInstalledExtension},"get")});var kR=H_();Object.defineProperty(d,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return kR.HelixInstalledExtensionList},"get")});var MR=E_();Object.defineProperty(d,"HelixUserExtension",{enumerable:!0,get:n(function(){return MR.HelixUserExtension},"get")});var LR=j_();Object.defineProperty(d,"HelixVideoApi",{enumerable:!0,get:n(function(){return LR.HelixVideoApi},"get")});var FR=B_();Object.defineProperty(d,"HelixVideo",{enumerable:!0,get:n(function(){return FR.HelixVideo},"get")});var NR=M_();Object.defineProperty(d,"HelixWhisperApi",{enumerable:!0,get:n(function(){return NR.HelixWhisperApi},"get")});var QR=nd();Object.defineProperty(d,"ConfigError",{enumerable:!0,get:n(function(){return QR.ConfigError},"get")});var GR=r_();Object.defineProperty(d,"StreamNotLiveError",{enumerable:!0,get:n(function(){return GR.StreamNotLiveError},"get")});var WR=F_();Object.defineProperty(d,"ApiReportedRequest",{enumerable:!0,get:n(function(){return WR.ApiReportedRequest},"get")});var VR=oe();Object.defineProperty(d,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return VR.HelixPaginatedRequest},"get")});var $R=Gr();Object.defineProperty(d,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return $R.HelixPaginatedRequestWithTotal},"get")});var Bu=m();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((VG,uw)=>{var nw=Lu(),zR=Qu(),aw=ts(),Yt=It(),sw=Wu(),ow=$u(),lw=Ku(),Ou=Gm(),{ApiClient:KR}=iw(),{AppTokenAuthProvider:JR}=Ed(),W_=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 JR(e,t);this.apiClient=new KR({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 zR(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=W_});var hw=u((zG,dw)=>{var ZR=It(),V_=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||ZR.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=V_});var XR=u((JG,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 XR();
20
20
  /*! Bundled license information:
21
21
 
22
22
  axios/dist/browser/axios.cjs:
23
- (*! Axios v1.9.0 Copyright (c) 2025 Matt Zabriskie and contributors *)
23
+ (*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors *)
24
24
  */
25
25
  //# sourceMappingURL=TwitchEmoticons.min.js.map