@mkody/twitch-emoticons 2.9.2 → 2.9.3
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:'',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]&&
|
|
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(
|
|
5
|
-
`):" "+
|
|
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 Ja=Object.defineProperty;var lw=Object.getOwnPropertyDescriptor;var uw=Object.getOwnPropertyNames;var cw=Object.prototype.hasOwnProperty;var n=(i,e)=>Ja(i,"name",{value:e,configurable:!0});var dw=(i,e)=>()=>(i&&(e=i(i=0)),e);var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),hw=(i,e)=>{for(var t in e)Ja(i,t,{get:e[t],enumerable:!0})},pw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of uw(e))!cw.call(i,a)&&a!==t&&Ja(i,a,{get:()=>e[a],enumerable:!(r=lw(e,a))||r.enumerable});return i};var b=i=>pw(Ja({},"__esModule",{value:!0}),i);var fr=u((zR,Wm)=>{var Bu=class i{static{n(this,"Emote")}constructor(e,t,r){if(new.target.name===i.name)throw new Error("Base Emote class cannot be used");this.fetcher=e.fetcher,this.channel=e,this.id=t,this.type=null,this._setup(r)}_setup(e){this.code=e.code}toLink(){return null}toString(){return this.code}toObject(){return{code:this.code,id:this.id,channel_id:this.channel.channel_id}}};Wm.exports=Bu});var qt=u((JR,Vm)=>{Vm.exports={Twitch:{CDN:n((i,e)=>`https://static-cdn.jtvnw.net/emoticons/v2/${i}/default/dark/${e+1}.0`,"CDN")},BTTV:{Global:"https://api.betterttv.net/3/cached/emotes/global",Channel:n(i=>`https://api.betterttv.net/3/cached/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.betterttv.net/emote/${i}/${e+1}x.webp`,"CDN")},SevenTV:{Global:"https://7tv.io/v3/emote-sets/global",Channel:n(i=>`https://7tv.io/v3/users/twitch/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.7tv.app/emote/${i}/${e}`,"CDN")},FFZ:{sets:{Global:3,Modifiers:1532818},Set:n(i=>`https://api.frankerfacez.com/v1/set/${i}`,"Set"),Channel:n(i=>`https://api.frankerfacez.com/v1/room/id/${i}`,"Channel"),CDN:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/${e}`,"CDN"),CDNAnimated:n((i,e)=>`https://cdn.frankerfacez.com/emote/${i}/animated/${e}.webp`,"CDNAnimated")},Templates:{html:'<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',markdown:'',bbcode:"[img]{link}[/img]",plain:"{link}"}}});var ju=u((XR,$m)=>{var mw=fr(),_w=qt(),Ou=class i extends mw{static{n(this,"BTTVEmote")}constructor(e,t,r){super(e,t,r),this.type="bttv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.ownerName="user"in e?e.user.name:null,this.animated=e.animated,this.imageType="webp"}toLink(e=0){return _w.BTTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,ownerName:this.ownerName,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,user:{name:e.ownerName}})}};$m.exports=Ou});var Za=u((eU,zm)=>{var ku=class extends Map{static{n(this,"Collection")}find(e,t){if(typeof e=="string"){if(typeof t>"u")return null;for(let r of this.values())if(r[e]===t)return r;return null}if(typeof e=="function"){let r=0;for(let a of this.values()){if(e(a,r,this))return a;r++}return null}return null}filter(e,t){t&&(e=e.bind(t));let r=new this.constructor,a=0;for(let[s,o]of this)e(o,a,this)&&r.set(s,o),a++;return r}map(e,t){t&&(e=e.bind(t));let r=new Array(this.size),a=0;for(let s of this.values())r[a]=e(s,a,this),a++;return r}};zm.exports=ku});var Lu=u((rU,Km)=>{var yw=Za(),Mu=class{static{n(this,"Channel")}constructor(e,t){this.fetcher=e,this.channel_id=t,this.emotes=new yw}fetchBTTVEmotes(){return this.fetcher.fetchBTTVEmotes(this.id)}fetchFFZEmotes(){return this.fetcher.fetchFFZEmotes(this.id)}fetchSevenTVEmotes(){return this.fetcher.fetchSevenTVEmotes(this.id)}};Km.exports=Mu});var Nu=u((nU,Zm)=>{var fw=fr(),Jm=qt(),Fu=class i extends fw{static{n(this,"FFZEmote")}constructor(e,t,r){super(e,t,r),this.type="ffz"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e?e.owner.name:null,this.sizes="animated"in e?Object.keys(e.animated):Object.keys(e.urls),this.animated="animated"in e,this.imageType="animated"in e?"webp":"png",this.modifier=e.modifier&&(e.modifier_flags&1)!==0}toLink(e=0){return e=this.sizes[e],this.animated?Jm.FFZ.CDNAnimated(this.id,e):Jm.FFZ.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,modifier:this.modifier})}static fromObject(e,t=null){let r=e.sizes.reduce((a,s)=>(a[s]=s,a),{});return new i(t,e.id,{code:e.code,name:e.code,urls:r,...e.animated?{animated:r}:{},owner:{name:e.ownerName},modifier:e.modifier,modifier_flags:e.modifier})}};Zm.exports=Fu});var Gu=u((sU,Xm)=>{var gw=fr(),bw=qt(),Qu=class i extends gw{static{n(this,"SevenTVEmote")}constructor(e,t,r){super(e,t,r),this.type="7tv"}get owner(){return this.fetcher.channels.get(this.ownerName)}_setup(e){super._setup(e),this.code=e.name,this.ownerName="owner"in e.data?e.data.owner.display_name:null,this.sizes=e.data.host.files.filter(t=>t.format===this.channel.format.toUpperCase()).map(t=>t.name),this.animated=e.data.animated,this.imageType=this.channel.format}toLink(e=0){return e=this.sizes[e],bw.SevenTV.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,sizes:this.sizes,ownerName:this.ownerName,type:this.type,imageType:this.imageType})}static fromObject(e,t){let r=e.sizes.map(a=>({format:t.format.toUpperCase(),name:a}));return new i(t,e.id,{code:e.code,name:e.code,data:{animated:e.animated,owner:{display_name:e.ownerName},host:{files:r}}})}};Xm.exports=Qu});var Vu=u((lU,Ym)=>{var xw=fr(),ww=qt(),Wu=class i extends xw{static{n(this,"TwitchEmote")}constructor(e,t,r){super(e,t,r),this.type="twitch"}get owner(){return this.channel}_setup(e){super._setup(e),this.set=e.emoticon_set,this.animated="animated"in e.formats,this.imageType="animated"in e.formats?"gif":"png"}toLink(e=0){return ww.Twitch.CDN(this.id,e)}toObject(){return Object.assign({},super.toObject(),{animated:this.animated,set:this.set,type:this.type})}static fromObject(e,t=null){return new i(t,e.id,{code:e.code,animated:e.animated,emoticon_set:e.set,formats:e.animated?{animated:e.animated}:{}})}};Ym.exports=Wu});var k_=u((cU,j_)=>{"use strict";function p_(i,e){return n(function(){return i.apply(e,arguments)},"wrap")}n(p_,"bind");var{toString:vw}=Object.prototype,{getPrototypeOf:nc}=Object,{iterator:ns,toStringTag:m_}=Symbol,as=(i=>e=>{let t=vw.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ke=n(i=>(i=i.toLowerCase(),e=>as(e)===i),"kindOfTest"),ss=n(i=>e=>typeof e===i,"typeOfTest"),{isArray:xr}=Array,li=ss("undefined");function ui(i){return i!==null&&!li(i)&&i.constructor!==null&&!li(i.constructor)&&Ce(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}n(ui,"isBuffer");var __=Ke("ArrayBuffer");function Sw(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&__(i.buffer),e}n(Sw,"isArrayBufferView");var Hw=ss("string"),Ce=ss("function"),y_=ss("number"),ci=n(i=>i!==null&&typeof i=="object","isObject"),Cw=n(i=>i===!0||i===!1,"isBoolean"),Xa=n(i=>{if(as(i)!=="object")return!1;let e=nc(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(m_ in i)&&!(ns in i)},"isPlainObject"),qw=n(i=>{if(!ci(i)||ui(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},"isEmptyObject"),Ew=Ke("Date"),Pw=Ke("File"),Aw=Ke("Blob"),Dw=Ke("FileList"),Iw=n(i=>ci(i)&&Ce(i.pipe),"isStream"),Tw=n(i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Ce(i.append)&&((e=as(i))==="formdata"||e==="object"&&Ce(i.toString)&&i.toString()==="[object FormData]"))},"isFormData"),Rw=Ke("URLSearchParams"),[Uw,Bw,Ow,jw]=["ReadableStream","Request","Response","Headers"].map(Ke),kw=n(i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function di(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let r,a;if(typeof i!="object"&&(i=[i]),xr(i))for(r=0,a=i.length;r<a;r++)e.call(null,i[r],r,i);else{if(ui(i))return;let s=t?Object.getOwnPropertyNames(i):Object.keys(i),o=s.length,l;for(r=0;r<o;r++)l=s[r],e.call(null,i[l],l,i)}}n(di,"forEach");function f_(i,e){if(ui(i))return null;e=e.toLowerCase();let t=Object.keys(i),r=t.length,a;for(;r-- >0;)if(a=t[r],e===a.toLowerCase())return a;return null}n(f_,"findKey");var Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,g_=n(i=>!li(i)&&i!==Kt,"isContextDefined");function Ju(){let{caseless:i}=g_(this)&&this||{},e={},t=n((r,a)=>{let s=i&&f_(e,a)||a;Xa(e[s])&&Xa(r)?e[s]=Ju(e[s],r):Xa(r)?e[s]=Ju({},r):xr(r)?e[s]=r.slice():e[s]=r},"assignValue");for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&di(arguments[r],t);return e}n(Ju,"merge");var Mw=n((i,e,t,{allOwnKeys:r}={})=>(di(e,(a,s)=>{t&&Ce(a)?i[s]=p_(a,t):i[s]=a},{allOwnKeys:r}),i),"extend"),Lw=n(i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),"stripBOM"),Fw=n((i,e,t,r)=>{i.prototype=Object.create(e.prototype,r),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},"inherits"),Nw=n((i,e,t,r)=>{let a,s,o,l={};if(e=e||{},i==null)return e;do{for(a=Object.getOwnPropertyNames(i),s=a.length;s-- >0;)o=a[s],(!r||r(o,i,e))&&!l[o]&&(e[o]=i[o],l[o]=!0);i=t!==!1&&nc(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},"toFlatObject"),Qw=n((i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;let r=i.indexOf(e,t);return r!==-1&&r===t},"endsWith"),Gw=n(i=>{if(!i)return null;if(xr(i))return i;let e=i.length;if(!y_(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},"toArray"),Ww=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&nc(Uint8Array)),Vw=n((i,e)=>{let r=(i&&i[ns]).call(i),a;for(;(a=r.next())&&!a.done;){let s=a.value;e.call(i,s[0],s[1])}},"forEachEntry"),$w=n((i,e)=>{let t,r=[];for(;(t=i.exec(e))!==null;)r.push(t);return r},"matchAll"),zw=Ke("HTMLFormElement"),Kw=n(i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,n(function(t,r,a){return r.toUpperCase()+a},"replacer")),"toCamelCase"),e_=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),Jw=Ke("RegExp"),b_=n((i,e)=>{let t=Object.getOwnPropertyDescriptors(i),r={};di(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(r[s]=o||a)}),Object.defineProperties(i,r)},"reduceDescriptors"),Zw=n(i=>{b_(i,(e,t)=>{if(Ce(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=i[t];if(Ce(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),Xw=n((i,e)=>{let t={},r=n(a=>{a.forEach(s=>{t[s]=!0})},"define");return xr(i)?r(i):r(String(i).split(e)),t},"toObjectSet"),Yw=n(()=>{},"noop"),ev=n((i,e)=>i!=null&&Number.isFinite(i=+i)?i:e,"toFiniteNumber");function tv(i){return!!(i&&Ce(i.append)&&i[m_]==="FormData"&&i[ns])}n(tv,"isSpecCompliantForm");var rv=n(i=>{let e=new Array(10),t=n((r,a)=>{if(ci(r)){if(e.indexOf(r)>=0)return;if(ui(r))return r;if(!("toJSON"in r)){e[a]=r;let s=xr(r)?[]:{};return di(r,(o,l)=>{let d=t(o,a+1);!li(d)&&(s[l]=d)}),e[a]=void 0,s}}return r},"visit");return t(i,0)},"toJSONObject"),iv=Ke("AsyncFunction"),nv=n(i=>i&&(ci(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),"isThenable"),x_=((i,e)=>i?setImmediate:e?((t,r)=>(Kt.addEventListener("message",({source:a,data:s})=>{a===Kt&&s===t&&r.length&&r.shift()()},!1),a=>{r.push(a),Kt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ce(Kt.postMessage)),av=typeof queueMicrotask<"u"?queueMicrotask.bind(Kt):typeof process<"u"&&process.nextTick||x_,sv=n(i=>i!=null&&Ce(i[ns]),"isIterable"),_={isArray:xr,isArrayBuffer:__,isBuffer:ui,isFormData:Tw,isArrayBufferView:Sw,isString:Hw,isNumber:y_,isBoolean:Cw,isObject:ci,isPlainObject:Xa,isEmptyObject:qw,isReadableStream:Uw,isRequest:Bw,isResponse:Ow,isHeaders:jw,isUndefined:li,isDate:Ew,isFile:Pw,isBlob:Aw,isRegExp:Jw,isFunction:Ce,isStream:Iw,isURLSearchParams:Rw,isTypedArray:Ww,isFileList:Dw,forEach:di,merge:Ju,extend:Mw,trim:kw,stripBOM:Lw,inherits:Fw,toFlatObject:Nw,kindOf:as,kindOfTest:Ke,endsWith:Qw,toArray:Gw,forEachEntry:Vw,matchAll:$w,isHTMLForm:zw,hasOwnProperty:e_,hasOwnProp:e_,reduceDescriptors:b_,freezeMethods:Zw,toObjectSet:Xw,toCamelCase:Kw,noop:Yw,toFiniteNumber:ev,findKey:f_,global:Kt,isContextDefined:g_,isSpecCompliantForm:tv,toJSONObject:rv,isAsyncFn:iv,isThenable:nv,setImmediate:x_,asap:av,isIterable:sv};function I(i,e,t,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}n(I,"AxiosError");_.inherits(I,Error,{toJSON:n(function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_.toJSONObject(this.config),code:this.code,status:this.status}},"toJSON")});var w_=I.prototype,v_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{v_[i]={value:i}});Object.defineProperties(I,v_);Object.defineProperty(w_,"isAxiosError",{value:!0});I.from=(i,e,t,r,a,s)=>{let o=Object.create(w_);return _.toFlatObject(i,o,n(function(d){return d!==Error.prototype},"filter"),l=>l!=="isAxiosError"),I.call(o,i.message,e,t,r,a),o.cause=i,o.name=i.name,s&&Object.assign(o,s),o};var ov=null;function Zu(i){return _.isPlainObject(i)||_.isArray(i)}n(Zu,"isVisitable");function S_(i){return _.endsWith(i,"[]")?i.slice(0,-2):i}n(S_,"removeBrackets");function t_(i,e,t){return i?i.concat(e).map(n(function(a,s){return a=S_(a),!t&&s?"["+a+"]":a},"each")).join(t?".":""):e}n(t_,"renderKey");function lv(i){return _.isArray(i)&&!i.some(Zu)}n(lv,"isFlatArray");var uv=_.toFlatObject(_,{},null,n(function(e){return/^is[A-Z]/.test(e)},"filter"));function os(i,e,t){if(!_.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=_.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,n(function(P,v){return!_.isUndefined(v[P])},"defined"));let r=t.metaTokens,a=t.visitor||p,s=t.dots,o=t.indexes,d=(t.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(e);if(!_.isFunction(a))throw new TypeError("visitor must be a function");function h(w){if(w===null)return"";if(_.isDate(w))return w.toISOString();if(_.isBoolean(w))return w.toString();if(!d&&_.isBlob(w))throw new I("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(w)||_.isTypedArray(w)?d&&typeof Blob=="function"?new Blob([w]):Buffer.from(w):w}n(h,"convertValue");function p(w,P,v){let B=w;if(w&&!v&&typeof w=="object"){if(_.endsWith(P,"{}"))P=r?P:P.slice(0,-2),w=JSON.stringify(w);else if(_.isArray(w)&&lv(w)||(_.isFileList(w)||_.endsWith(P,"[]"))&&(B=_.toArray(w)))return P=S_(P),B.forEach(n(function($,z){!(_.isUndefined($)||$===null)&&e.append(o===!0?t_([P],z,s):o===null?P:P+"[]",h($))},"each")),!1}return Zu(w)?!0:(e.append(t_(v,P,s),h(w)),!1)}n(p,"defaultVisitor");let x=[],q=Object.assign(uv,{defaultVisitor:p,convertValue:h,isVisitable:Zu});function E(w,P){if(!_.isUndefined(w)){if(x.indexOf(w)!==-1)throw Error("Circular reference detected in "+P.join("."));x.push(w),_.forEach(w,n(function(B,V){(!(_.isUndefined(B)||B===null)&&a.call(e,B,_.isString(V)?V.trim():V,P,q))===!0&&E(B,P?P.concat(V):[V])},"each")),x.pop()}}if(n(E,"build"),!_.isObject(i))throw new TypeError("data must be an object");return E(i),e}n(os,"toFormData");function r_(i){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,n(function(r){return e[r]},"replacer"))}n(r_,"encode$1");function ac(i,e){this._pairs=[],i&&os(i,this,e)}n(ac,"AxiosURLSearchParams");var H_=ac.prototype;H_.append=n(function(e,t){this._pairs.push([e,t])},"append");H_.toString=n(function(e){let t=e?function(r){return e.call(this,r,r_)}:r_;return this._pairs.map(n(function(a){return t(a[0])+"="+t(a[1])},"each"),"").join("&")},"toString");function cv(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}n(cv,"encode");function C_(i,e,t){if(!e)return i;let r=t&&t.encode||cv;_.isFunction(t)&&(t={serialize:t});let a=t&&t.serialize,s;if(a?s=a(e,t):s=_.isURLSearchParams(e)?e.toString():new ac(e,t).toString(r),s){let o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}n(C_,"buildURL");var Xu=class{static{n(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){_.forEach(this.handlers,n(function(r){r!==null&&e(r)},"forEachHandler"))}},i_=Xu,q_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dv=typeof URLSearchParams<"u"?URLSearchParams:ac,hv=typeof FormData<"u"?FormData:null,pv=typeof Blob<"u"?Blob:null,mv={isBrowser:!0,classes:{URLSearchParams:dv,FormData:hv,Blob:pv},protocols:["http","https","file","blob","url","data"]},sc=typeof window<"u"&&typeof document<"u",Yu=typeof navigator=="object"&&navigator||void 0,_v=sc&&(!Yu||["ReactNative","NativeScript","NS"].indexOf(Yu.product)<0),yv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",fv=sc&&window.location.href||"http://localhost",gv=Object.freeze({__proto__:null,hasBrowserEnv:sc,hasStandardBrowserWebWorkerEnv:yv,hasStandardBrowserEnv:_v,navigator:Yu,origin:fv}),ve={...gv,...mv};function bv(i,e){return os(i,new ve.classes.URLSearchParams,{visitor:n(function(t,r,a,s){return ve.isNode&&_.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}n(bv,"toURLEncodedForm");function xv(i){return _.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}n(xv,"parsePropPath");function wv(i){let e={},t=Object.keys(i),r,a=t.length,s;for(r=0;r<a;r++)s=t[r],e[s]=i[s];return e}n(wv,"arrayToObject");function E_(i){function e(t,r,a,s){let o=t[s++];if(o==="__proto__")return!0;let l=Number.isFinite(+o),d=s>=t.length;return o=!o&&_.isArray(a)?a.length:o,d?(_.hasOwnProp(a,o)?a[o]=[a[o],r]:a[o]=r,!l):((!a[o]||!_.isObject(a[o]))&&(a[o]=[]),e(t,r,a[o],s)&&_.isArray(a[o])&&(a[o]=wv(a[o])),!l)}if(n(e,"buildPath"),_.isFormData(i)&&_.isFunction(i.entries)){let t={};return _.forEachEntry(i,(r,a)=>{e(xv(r),a,t,0)}),t}return null}n(E_,"formDataToJSON");function vv(i,e,t){if(_.isString(i))try{return(e||JSON.parse)(i),_.trim(i)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(i)}n(vv,"stringifySafely");var oc={transitional:q_,adapter:["xhr","http","fetch"],transformRequest:[n(function(e,t){let r=t.getContentType()||"",a=r.indexOf("application/json")>-1,s=_.isObject(e);if(s&&_.isHTMLForm(e)&&(e=new FormData(e)),_.isFormData(e))return a?JSON.stringify(E_(e)):e;if(_.isArrayBuffer(e)||_.isBuffer(e)||_.isStream(e)||_.isFile(e)||_.isBlob(e)||_.isReadableStream(e))return e;if(_.isArrayBufferView(e))return e.buffer;if(_.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return bv(e,this.formSerializer).toString();if((l=_.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return os(l?{"files[]":e}:e,d&&new d,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),vv(e)):e},"transformRequest")],transformResponse:[n(function(e){let t=this.transitional||oc.transitional,r=t&&t.forcedJSONParsing,a=this.responseType==="json";if(_.isResponse(e)||_.isReadableStream(e))return e;if(e&&_.isString(e)&&(r&&!this.responseType||a)){let o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?I.from(l,I.ERR_BAD_RESPONSE,this,null,this.response):l}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ve.classes.FormData,Blob:ve.classes.Blob},validateStatus:n(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],i=>{oc.headers[i]={}});var lc=oc,Sv=_.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Hv=n(i=>{let e={},t,r,a;return i&&i.split(`
|
|
2
|
+
`).forEach(n(function(o){a=o.indexOf(":"),t=o.substring(0,a).trim().toLowerCase(),r=o.substring(a+1).trim(),!(!t||e[t]&&Sv[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)},"parser")),e},"parseHeaders"),n_=Symbol("internals");function oi(i){return i&&String(i).trim().toLowerCase()}n(oi,"normalizeHeader");function Ya(i){return i===!1||i==null?i:_.isArray(i)?i.map(Ya):String(i)}n(Ya,"normalizeValue");function Cv(i){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(i);)e[r[1]]=r[2];return e}n(Cv,"parseTokens");var qv=n(i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim()),"isValidHeaderName");function $u(i,e,t,r,a){if(_.isFunction(r))return r.call(this,e,t);if(a&&(e=t),!!_.isString(e)){if(_.isString(r))return e.indexOf(r)!==-1;if(_.isRegExp(r))return r.test(e)}}n($u,"matchHeaderValue");function Ev(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}n(Ev,"formatHeader");function Pv(i,e){let t=_.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(i,r+t,{value:n(function(a,s,o){return this[r].call(this,e,a,s,o)},"value"),configurable:!0})})}n(Pv,"buildAccessors");var gr=class{static{n(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,r){let a=this;function s(l,d,h){let p=oi(d);if(!p)throw new Error("header name must be a non-empty string");let x=_.findKey(a,p);(!x||a[x]===void 0||h===!0||h===void 0&&a[x]!==!1)&&(a[x||d]=Ya(l))}n(s,"setHeader");let o=n((l,d)=>_.forEach(l,(h,p)=>s(h,p,d)),"setHeaders");if(_.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(_.isString(e)&&(e=e.trim())&&!qv(e))o(Hv(e),t);else if(_.isObject(e)&&_.isIterable(e)){let l={},d,h;for(let p of e){if(!_.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[h=p[0]]=(d=l[h])?_.isArray(d)?[...d,p[1]]:[d,p[1]]:p[1]}o(l,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=oi(e),e){let r=_.findKey(this,e);if(r){let a=this[r];if(!t)return a;if(t===!0)return Cv(a);if(_.isFunction(t))return t.call(this,a,r);if(_.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=oi(e),e){let r=_.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||$u(this,this[r],r,t)))}return!1}delete(e,t){let r=this,a=!1;function s(o){if(o=oi(o),o){let l=_.findKey(r,o);l&&(!t||$u(r,r[l],l,t))&&(delete r[l],a=!0)}}return n(s,"deleteHeader"),_.isArray(e)?e.forEach(s):s(e),a}clear(e){let t=Object.keys(this),r=t.length,a=!1;for(;r--;){let s=t[r];(!e||$u(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,r={};return _.forEach(this,(a,s)=>{let o=_.findKey(r,s);if(o){t[o]=Ya(a),delete t[s];return}let l=e?Ev(s):String(s).trim();l!==s&&delete t[s],t[l]=Ya(a),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return _.forEach(this,(r,a)=>{r!=null&&r!==!1&&(t[a]=e&&_.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(a=>r.set(a)),r}static accessor(e){let r=(this[n_]=this[n_]={accessors:{}}).accessors,a=this.prototype;function s(o){let l=oi(o);r[l]||(Pv(a,o),r[l]=!0)}return n(s,"defineAccessor"),_.isArray(e)?e.forEach(s):s(e),this}};gr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(gr.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:n(()=>i,"get"),set(r){this[t]=r}}});_.freezeMethods(gr);var ze=gr;function zu(i,e){let t=this||lc,r=e||t,a=ze.from(r.headers),s=r.data;return _.forEach(i,n(function(l){s=l.call(t,s,a.normalize(),e?e.status:void 0)},"transform")),a.normalize(),s}n(zu,"transformData");function P_(i){return!!(i&&i.__CANCEL__)}n(P_,"isCancel");function wr(i,e,t){I.call(this,i??"canceled",I.ERR_CANCELED,e,t),this.name="CanceledError"}n(wr,"CanceledError");_.inherits(wr,I,{__CANCEL__:!0});function A_(i,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?i(t):e(new I("Request failed with status code "+t.status,[I.ERR_BAD_REQUEST,I.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}n(A_,"settle");function Av(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}n(Av,"parseProtocol");function Dv(i,e){i=i||10;let t=new Array(i),r=new Array(i),a=0,s=0,o;return e=e!==void 0?e:1e3,n(function(d){let h=Date.now(),p=r[s];o||(o=h),t[a]=d,r[a]=h;let x=s,q=0;for(;x!==a;)q+=t[x++],x=x%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),h-o<e)return;let E=p&&h-p;return E?Math.round(q*1e3/E):void 0},"push")}n(Dv,"speedometer");function Iv(i,e){let t=0,r=1e3/e,a,s,o=n((h,p=Date.now())=>{t=p,a=null,s&&(clearTimeout(s),s=null),i(...h)},"invoke");return[n((...h)=>{let p=Date.now(),x=p-t;x>=r?o(h,p):(a=h,s||(s=setTimeout(()=>{s=null,o(a)},r-x)))},"throttled"),n(()=>a&&o(a),"flush")]}n(Iv,"throttle");var rs=n((i,e,t=3)=>{let r=0,a=Dv(50,250);return Iv(s=>{let o=s.loaded,l=s.lengthComputable?s.total:void 0,d=o-r,h=a(d),p=o<=l;r=o;let x={loaded:o,total:l,progress:l?o/l:void 0,bytes:d,rate:h||void 0,estimated:h&&l&&p?(l-o)/h:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};i(x)},t)},"progressEventReducer"),a_=n((i,e)=>{let t=i!=null;return[r=>e[0]({lengthComputable:t,total:i,loaded:r}),e[1]]},"progressEventDecorator"),s_=n(i=>(...e)=>_.asap(()=>i(...e)),"asyncDecorator"),Tv=ve.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,ve.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(ve.origin),ve.navigator&&/(msie|trident)/i.test(ve.navigator.userAgent)):()=>!0,Rv=ve.hasStandardBrowserEnv?{write(i,e,t,r,a,s){let o=[i+"="+encodeURIComponent(e)];_.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),_.isString(r)&&o.push("path="+r),_.isString(a)&&o.push("domain="+a),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(i){let e=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Uv(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}n(Uv,"isAbsoluteURL");function Bv(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}n(Bv,"combineURLs");function D_(i,e,t){let r=!Uv(e);return i&&(r||t==!1)?Bv(i,e):e}n(D_,"buildFullPath");var o_=n(i=>i instanceof ze?{...i}:i,"headersToObject");function Jt(i,e){e=e||{};let t={};function r(h,p,x,q){return _.isPlainObject(h)&&_.isPlainObject(p)?_.merge.call({caseless:q},h,p):_.isPlainObject(p)?_.merge({},p):_.isArray(p)?p.slice():p}n(r,"getMergedValue");function a(h,p,x,q){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h,x,q)}else return r(h,p,x,q)}n(a,"mergeDeepProperties");function s(h,p){if(!_.isUndefined(p))return r(void 0,p)}n(s,"valueFromConfig2");function o(h,p){if(_.isUndefined(p)){if(!_.isUndefined(h))return r(void 0,h)}else return r(void 0,p)}n(o,"defaultToConfig2");function l(h,p,x){if(x in e)return r(h,p);if(x in i)return r(void 0,h)}n(l,"mergeDirectKeys");let d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:n((h,p,x)=>a(o_(h),o_(p),x,!0),"headers")};return _.forEach(Object.keys({...i,...e}),n(function(p){let x=d[p]||a,q=x(i[p],e[p],p);_.isUndefined(q)&&x!==l||(t[p]=q)},"computeConfigValue")),t}n(Jt,"mergeConfig");var I_=n(i=>{let e=Jt({},i),{data:t,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:l}=e;e.headers=o=ze.from(o),e.url=C_(D_(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(_.isFormData(t)){if(ve.hasStandardBrowserEnv||ve.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((d=o.getContentType())!==!1){let[h,...p]=d?d.split(";").map(x=>x.trim()).filter(Boolean):[];o.setContentType([h||"multipart/form-data",...p].join("; "))}}if(ve.hasStandardBrowserEnv&&(r&&_.isFunction(r)&&(r=r(e)),r||r!==!1&&Tv(e.url))){let h=a&&s&&Rv.read(s);h&&o.set(a,h)}return e},"resolveConfig"),Ov=typeof XMLHttpRequest<"u",jv=Ov&&function(i){return new Promise(n(function(t,r){let a=I_(i),s=a.data,o=ze.from(a.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:h}=a,p,x,q,E,w;function P(){E&&E(),w&&w(),a.cancelToken&&a.cancelToken.unsubscribe(p),a.signal&&a.signal.removeEventListener("abort",p)}n(P,"done");let v=new XMLHttpRequest;v.open(a.method.toUpperCase(),a.url,!0),v.timeout=a.timeout;function B(){if(!v)return;let $=ze.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),xe={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:$,config:i,request:v};A_(n(function(he){t(he),P()},"_resolve"),n(function(he){r(he),P()},"_reject"),xe),v=null}n(B,"onloadend"),"onloadend"in v?v.onloadend=B:v.onreadystatechange=n(function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(B)},"handleLoad"),v.onabort=n(function(){v&&(r(new I("Request aborted",I.ECONNABORTED,i,v)),v=null)},"handleAbort"),v.onerror=n(function(){r(new I("Network Error",I.ERR_NETWORK,i,v)),v=null},"handleError"),v.ontimeout=n(function(){let z=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded",xe=a.transitional||q_;a.timeoutErrorMessage&&(z=a.timeoutErrorMessage),r(new I(z,xe.clarifyTimeoutError?I.ETIMEDOUT:I.ECONNABORTED,i,v)),v=null},"handleTimeout"),s===void 0&&o.setContentType(null),"setRequestHeader"in v&&_.forEach(o.toJSON(),n(function(z,xe){v.setRequestHeader(xe,z)},"setRequestHeader")),_.isUndefined(a.withCredentials)||(v.withCredentials=!!a.withCredentials),l&&l!=="json"&&(v.responseType=a.responseType),h&&([q,w]=rs(h,!0),v.addEventListener("progress",q)),d&&v.upload&&([x,E]=rs(d),v.upload.addEventListener("progress",x),v.upload.addEventListener("loadend",E)),(a.cancelToken||a.signal)&&(p=n($=>{v&&(r(!$||$.type?new wr(null,i,v):$),v.abort(),v=null)},"onCanceled"),a.cancelToken&&a.cancelToken.subscribe(p),a.signal&&(a.signal.aborted?p():a.signal.addEventListener("abort",p)));let V=Av(a.url);if(V&&ve.protocols.indexOf(V)===-1){r(new I("Unsupported protocol "+V+":",I.ERR_BAD_REQUEST,i));return}v.send(s||null)},"dispatchXhrRequest"))},kv=n((i,e)=>{let{length:t}=i=i?i.filter(Boolean):[];if(e||t){let r=new AbortController,a,s=n(function(h){if(!a){a=!0,l();let p=h instanceof Error?h:this.reason;r.abort(p instanceof I?p:new wr(p instanceof Error?p.message:p))}},"onabort"),o=e&&setTimeout(()=>{o=null,s(new I(`timeout ${e} of ms exceeded`,I.ETIMEDOUT))},e),l=n(()=>{i&&(o&&clearTimeout(o),o=null,i.forEach(h=>{h.unsubscribe?h.unsubscribe(s):h.removeEventListener("abort",s)}),i=null)},"unsubscribe");i.forEach(h=>h.addEventListener("abort",s));let{signal:d}=r;return d.unsubscribe=()=>_.asap(l),d}},"composeSignals"),Mv=kv,Lv=n(function*(i,e){let t=i.byteLength;if(!e||t<e){yield i;return}let r=0,a;for(;r<t;)a=r+e,yield i.slice(r,a),r=a},"streamChunk"),Fv=n(async function*(i,e){for await(let t of Nv(i))yield*Lv(t,e)},"readBytes"),Nv=n(async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}let e=i.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},"readStream"),l_=n((i,e,t,r)=>{let a=Fv(i,e),s=0,o,l=n(d=>{o||(o=!0,r&&r(d))},"_onFinish");return new ReadableStream({async pull(d){try{let{done:h,value:p}=await a.next();if(h){l(),d.close();return}let x=p.byteLength;if(t){let q=s+=x;t(q)}d.enqueue(new Uint8Array(p))}catch(h){throw l(h),h}},cancel(d){return l(d),a.return()}},{highWaterMark:2})},"trackStream"),ls=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",T_=ls&&typeof ReadableStream=="function",Qv=ls&&(typeof TextEncoder=="function"?(i=>e=>i.encode(e))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),R_=n((i,...e)=>{try{return!!i(...e)}catch{return!1}},"test"),Gv=T_&&R_(()=>{let i=!1,e=new Request(ve.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!e}),u_=64*1024,ec=T_&&R_(()=>_.isReadableStream(new Response("").body)),is={stream:ec&&(i=>i.body)};ls&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!is[e]&&(is[e]=_.isFunction(i[e])?t=>t[e]():(t,r)=>{throw new I(`Response type '${e}' is not supported`,I.ERR_NOT_SUPPORT,r)})})})(new Response);var Wv=n(async i=>{if(i==null)return 0;if(_.isBlob(i))return i.size;if(_.isSpecCompliantForm(i))return(await new Request(ve.origin,{method:"POST",body:i}).arrayBuffer()).byteLength;if(_.isArrayBufferView(i)||_.isArrayBuffer(i))return i.byteLength;if(_.isURLSearchParams(i)&&(i=i+""),_.isString(i))return(await Qv(i)).byteLength},"getBodyLength"),Vv=n(async(i,e)=>{let t=_.toFiniteNumber(i.getContentLength());return t??Wv(e)},"resolveBodyLength"),$v=ls&&(async i=>{let{url:e,method:t,data:r,signal:a,cancelToken:s,timeout:o,onDownloadProgress:l,onUploadProgress:d,responseType:h,headers:p,withCredentials:x="same-origin",fetchOptions:q}=I_(i);h=h?(h+"").toLowerCase():"text";let E=Mv([a,s&&s.toAbortSignal()],o),w,P=E&&E.unsubscribe&&(()=>{E.unsubscribe()}),v;try{if(d&&Gv&&t!=="get"&&t!=="head"&&(v=await Vv(p,r))!==0){let xe=new Request(e,{method:"POST",body:r,duplex:"half"}),it;if(_.isFormData(r)&&(it=xe.headers.get("content-type"))&&p.setContentType(it),xe.body){let[he,_r]=a_(v,rs(s_(d)));r=l_(xe.body,u_,he,_r)}}_.isString(x)||(x=x?"include":"omit");let B="credentials"in Request.prototype;w=new Request(e,{...q,signal:E,method:t.toUpperCase(),headers:p.normalize().toJSON(),body:r,duplex:"half",credentials:B?x:void 0});let V=await fetch(w,q),$=ec&&(h==="stream"||h==="response");if(ec&&(l||$&&P)){let xe={};["status","statusText","headers"].forEach(yr=>{xe[yr]=V[yr]});let it=_.toFiniteNumber(V.headers.get("content-length")),[he,_r]=l&&a_(it,rs(s_(l),!0))||[];V=new Response(l_(V.body,u_,he,()=>{_r&&_r(),P&&P()}),xe)}h=h||"text";let z=await is[_.findKey(is,h)||"text"](V,i);return!$&&P&&P(),await new Promise((xe,it)=>{A_(xe,it,{data:z,headers:ze.from(V.headers),status:V.status,statusText:V.statusText,config:i,request:w})})}catch(B){throw P&&P(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new I("Network Error",I.ERR_NETWORK,i,w),{cause:B.cause||B}):I.from(B,B&&B.code,i,w)}}),tc={http:ov,xhr:jv,fetch:$v};_.forEach(tc,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});var c_=n(i=>`- ${i}`,"renderReason"),zv=n(i=>_.isFunction(i)||i===null||i===!1,"isResolvedHandle"),U_={getAdapter:n(i=>{i=_.isArray(i)?i:[i];let{length:e}=i,t,r,a={};for(let s=0;s<e;s++){t=i[s];let o;if(r=t,!zv(t)&&(r=tc[(o=String(t)).toLowerCase()],r===void 0))throw new I(`Unknown adapter '${o}'`);if(r)break;a[o||"#"+s]=r}if(!r){let s=Object.entries(a).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since :
|
|
4
|
+
`+s.map(c_).join(`
|
|
5
|
+
`):" "+c_(s[0]):"as no adapter specified";throw new I("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},"getAdapter"),adapters:tc};function Ku(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new wr(null,i)}n(Ku,"throwIfCancellationRequested");function d_(i){return Ku(i),i.headers=ze.from(i.headers),i.data=zu.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),U_.getAdapter(i.adapter||lc.adapter)(i).then(n(function(r){return Ku(i),r.data=zu.call(i,i.transformResponse,r),r.headers=ze.from(r.headers),r},"onAdapterResolution"),n(function(r){return P_(r)||(Ku(i),r&&r.response&&(r.response.data=zu.call(i,i.transformResponse,r.response),r.response.headers=ze.from(r.response.headers))),Promise.reject(r)},"onAdapterRejection"))}n(d_,"dispatchRequest");var B_="1.11.0",us={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{us[i]=n(function(r){return typeof r===i||"a"+(e<1?"n ":" ")+i},"validator")});var h_={};us.transitional=n(function(e,t,r){function a(s,o){return"[Axios v"+B_+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return n(a,"formatMessage"),(s,o,l)=>{if(e===!1)throw new I(a(o," has been removed"+(t?" in "+t:"")),I.ERR_DEPRECATED);return t&&!h_[o]&&(h_[o]=!0,console.warn(a(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,l):!0}},"transitional");us.spelling=n(function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)},"spelling");function Kv(i,e,t){if(typeof i!="object")throw new I("options must be an object",I.ERR_BAD_OPTION_VALUE);let r=Object.keys(i),a=r.length;for(;a-- >0;){let s=r[a],o=e[s];if(o){let l=i[s],d=l===void 0||o(l,s,i);if(d!==!0)throw new I("option "+s+" must be "+d,I.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new I("Unknown option "+s,I.ERR_BAD_OPTION)}}n(Kv,"assertOptions");var es={assertOptions:Kv,validators:us},nt=es.validators,br=class{static{n(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new i_,response:new i_}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;let s=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Jt(this.defaults,t);let{transitional:r,paramsSerializer:a,headers:s}=t;r!==void 0&&es.assertOptions(r,{silentJSONParsing:nt.transitional(nt.boolean),forcedJSONParsing:nt.transitional(nt.boolean),clarifyTimeoutError:nt.transitional(nt.boolean)},!1),a!=null&&(_.isFunction(a)?t.paramsSerializer={serialize:a}:es.assertOptions(a,{encode:nt.function,serialize:nt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),es.assertOptions(t,{baseUrl:nt.spelling("baseURL"),withXsrfToken:nt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&_.merge(s.common,s[t.method]);s&&_.forEach(["delete","get","head","post","put","patch","common"],w=>{delete s[w]}),t.headers=ze.concat(o,s);let l=[],d=!0;this.interceptors.request.forEach(n(function(P){typeof P.runWhen=="function"&&P.runWhen(t)===!1||(d=d&&P.synchronous,l.unshift(P.fulfilled,P.rejected))},"unshiftRequestInterceptors"));let h=[];this.interceptors.response.forEach(n(function(P){h.push(P.fulfilled,P.rejected)},"pushResponseInterceptors"));let p,x=0,q;if(!d){let w=[d_.bind(this),void 0];for(w.unshift(...l),w.push(...h),q=w.length,p=Promise.resolve(t);x<q;)p=p.then(w[x++],w[x++]);return p}q=l.length;let E=t;for(x=0;x<q;){let w=l[x++],P=l[x++];try{E=w(E)}catch(v){P.call(this,v);break}}try{p=d_.call(this,E)}catch(w){return Promise.reject(w)}for(x=0,q=h.length;x<q;)p=p.then(h[x++],h[x++]);return p}getUri(e){e=Jt(this.defaults,e);let t=D_(e.baseURL,e.url,e.allowAbsoluteUrls);return C_(t,e.params,e.paramsSerializer)}};_.forEach(["delete","get","head","options"],n(function(e){br.prototype[e]=function(t,r){return this.request(Jt(r||{},{method:e,url:t,data:(r||{}).data}))}},"forEachMethodNoData"));_.forEach(["post","put","patch"],n(function(e){function t(r){return n(function(s,o,l){return this.request(Jt(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}n(t,"generateHTTPMethod"),br.prototype[e]=t(),br.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var ts=br,rc=class i{static{n(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(n(function(s){t=s},"promiseExecutor"));let r=this;this.promise.then(a=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](a);r._listeners=null}),this.promise.then=a=>{let s,o=new Promise(l=>{r.subscribe(l),s=l}).then(a);return o.cancel=n(function(){r.unsubscribe(s)},"reject"),o},e(n(function(s,o,l){r.reason||(r.reason=new wr(s,o,l),t(r.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=n(r=>{e.abort(r)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new i(n(function(a){e=a},"executor")),cancel:e}}},Jv=rc;function Zv(i){return n(function(t){return i.apply(null,t)},"wrap")}n(Zv,"spread");function Xv(i){return _.isObject(i)&&i.isAxiosError===!0}n(Xv,"isAxiosError");var ic={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ic).forEach(([i,e])=>{ic[e]=i});var Yv=ic;function O_(i){let e=new ts(i),t=p_(ts.prototype.request,e);return _.extend(t,ts.prototype,e,{allOwnKeys:!0}),_.extend(t,e,null,{allOwnKeys:!0}),t.create=n(function(a){return O_(Jt(i,a))},"create"),t}n(O_,"createInstance");var ie=O_(lc);ie.Axios=ts;ie.CanceledError=wr;ie.CancelToken=Jv;ie.isCancel=P_;ie.VERSION=B_;ie.toFormData=os;ie.AxiosError=I;ie.Cancel=ie.CanceledError;ie.all=n(function(e){return Promise.all(e)},"all");ie.spread=Zv;ie.isAxiosError=Xv;ie.mergeConfig=Jt;ie.AxiosHeaders=ze;ie.formToJSON=i=>E_(_.isHTMLForm(i)?new FormData(i):i);ie.getAdapter=U_.getAdapter;ie.HttpStatusCode=Yv;ie.default=ie;j_.exports=ie});var y={};hw(y,{__addDisposableResource:()=>uy,__assign:()=>cs,__asyncDelegator:()=>ty,__asyncGenerator:()=>ey,__asyncValues:()=>ry,__await:()=>vr,__awaiter:()=>z_,__classPrivateFieldGet:()=>sy,__classPrivateFieldIn:()=>ly,__classPrivateFieldSet:()=>oy,__createBinding:()=>hs,__decorate:()=>F_,__disposeResources:()=>cy,__esDecorate:()=>Q_,__exportStar:()=>J_,__extends:()=>M_,__generator:()=>K_,__importDefault:()=>ay,__importStar:()=>ny,__makeTemplateObject:()=>iy,__metadata:()=>$_,__param:()=>N_,__propKey:()=>W_,__read:()=>dc,__rest:()=>L_,__rewriteRelativeImportExtension:()=>dy,__runInitializers:()=>G_,__setFunctionName:()=>V_,__spread:()=>Z_,__spreadArray:()=>Y_,__spreadArrays:()=>X_,__values:()=>ds,default:()=>rS});function M_(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");uc(i,e);function t(){this.constructor=i}n(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function L_(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(i);a<r.length;a++)e.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(i,r[a])&&(t[r[a]]=i[r[a]]);return t}function F_(i,e,t,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(i,e,t,r);else for(var l=i.length-1;l>=0;l--)(o=i[l])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}function N_(i,e){return function(t,r){e(t,r,i)}}function Q_(i,e,t,r,a,s){function o(B){if(B!==void 0&&typeof B!="function")throw new TypeError("Function expected");return B}n(o,"accept");for(var l=r.kind,d=l==="getter"?"get":l==="setter"?"set":"value",h=!e&&i?r.static?i:i.prototype:null,p=e||(h?Object.getOwnPropertyDescriptor(h,r.name):{}),x,q=!1,E=t.length-1;E>=0;E--){var w={};for(var P in r)w[P]=P==="access"?{}:r[P];for(var P in r.access)w.access[P]=r.access[P];w.addInitializer=function(B){if(q)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(B||null))};var v=(0,t[E])(l==="accessor"?{get:p.get,set:p.set}:p[d],w);if(l==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(x=o(v.get))&&(p.get=x),(x=o(v.set))&&(p.set=x),(x=o(v.init))&&a.unshift(x)}else(x=o(v))&&(l==="field"?a.unshift(x):p[d]=x)}h&&Object.defineProperty(h,r.name,p),q=!0}function G_(i,e,t){for(var r=arguments.length>2,a=0;a<e.length;a++)t=r?e[a].call(i,t):e[a].call(i);return r?t:void 0}function W_(i){return typeof i=="symbol"?i:"".concat(i)}function V_(i,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function $_(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function z_(i,e,t,r){function a(s){return s instanceof t?s:new t(function(o){o(s)})}return n(a,"adopt"),new(t||(t=Promise))(function(s,o){function l(p){try{h(r.next(p))}catch(x){o(x)}}n(l,"fulfilled");function d(p){try{h(r.throw(p))}catch(x){o(x)}}n(d,"rejected");function h(p){p.done?s(p.value):a(p.value).then(l,d)}n(h,"step"),h((r=r.apply(i,e||[])).next())})}function K_(i,e){var t={label:0,sent:n(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,a,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(h){return function(p){return d([h,p])}}function d(h){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(t=0)),t;)try{if(r=1,a&&(s=h[0]&2?a.return:h[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,h[1])).done)return s;switch(a=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,a=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){t.label=h[1];break}if(h[0]===6&&t.label<s[1]){t.label=s[1],s=h;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(h);break}s[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(i,t)}catch(p){h=[6,p],a=0}finally{r=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function J_(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hs(e,i,t)}function ds(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:n(function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function dc(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),a,s=[],o;try{for(;(e===void 0||e-- >0)&&!(a=r.next()).done;)s.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function Z_(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(dc(arguments[e]));return i}function X_(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),a=0,e=0;e<t;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,a++)r[a]=s[o];return r}function Y_(i,e,t){if(t||arguments.length===2)for(var r=0,a=e.length,s;r<a;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return i.concat(s||Array.prototype.slice.call(e))}function vr(i){return this instanceof vr?(this.v=i,this):new vr(i)}function ey(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(E){return function(w){return Promise.resolve(w).then(E,x)}}function l(E,w){r[E]&&(a[E]=function(P){return new Promise(function(v,B){s.push([E,P,v,B])>1||d(E,P)})},w&&(a[E]=w(a[E])))}function d(E,w){try{h(r[E](w))}catch(P){q(s[0][3],P)}}function h(E){E.value instanceof vr?Promise.resolve(E.value.v).then(p,x):q(s[0][2],E)}function p(E){d("next",E)}function x(E){d("throw",E)}function q(E,w){E(w),s.shift(),s.length&&d(s[0][0],s[0][1])}}function ty(i){var e,t;return e={},r("next"),r("throw",function(a){throw a}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(a,s){e[a]=i[a]?function(o){return(t=!t)?{value:vr(i[a](o)),done:!1}:s?s(o):o}:s}}function ry(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof ds=="function"?ds(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=i[s]&&function(o){return new Promise(function(l,d){o=i[s](o),a(l,d,o.done,o.value)})}}function a(s,o,l,d){Promise.resolve(d).then(function(h){s({value:h,done:l})},o)}}function iy(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function ny(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=cc(i),r=0;r<t.length;r++)t[r]!=="default"&&hs(e,i,t[r]);return eS(e,i),e}function ay(i){return i&&i.__esModule?i:{default:i}}function sy(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)}function oy(i,e,t,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(i,t):a?a.value=t:e.set(i,t),t}function ly(i,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?e===i:i.has(e)}function uy(i,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,a;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(a=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");a&&(r=n(function(){try{a.call(this)}catch(s){return Promise.reject(s)}},"dispose")),i.stack.push({value:e,dispose:r,async:t})}else t&&i.stack.push({async:!0});return e}function cy(i){function e(s){i.error=i.hasError?new tS(s,i.error,"An error was suppressed during disposal."):s,i.hasError=!0}n(e,"fail");var t,r=0;function a(){for(;t=i.stack.pop();)try{if(!t.async&&r===1)return r=0,i.stack.push(t),Promise.resolve().then(a);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(s).then(a,function(o){return e(o),a()})}else r|=1}catch(o){e(o)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return n(a,"next"),a()}function dy(i,e){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,a,s,o){return r?e?".jsx":".js":a&&(!s||!o)?t:a+s+"."+o.toLowerCase()+"js"}):i}var uc,cs,hs,eS,cc,tS,rS,f=dw(()=>{uc=n(function(i,e){return uc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},uc(i,e)},"extendStatics");n(M_,"__extends");cs=n(function(){return cs=Object.assign||n(function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),cs.apply(this,arguments)},"__assign");n(L_,"__rest");n(F_,"__decorate");n(N_,"__param");n(Q_,"__esDecorate");n(G_,"__runInitializers");n(W_,"__propKey");n(V_,"__setFunctionName");n($_,"__metadata");n(z_,"__awaiter");n(K_,"__generator");hs=Object.create?function(i,e,t,r){r===void 0&&(r=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:n(function(){return e[t]},"get")}),Object.defineProperty(i,r,a)}:function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]};n(J_,"__exportStar");n(ds,"__values");n(dc,"__read");n(Z_,"__spread");n(X_,"__spreadArrays");n(Y_,"__spreadArray");n(vr,"__await");n(ey,"__asyncGenerator");n(ty,"__asyncDelegator");n(ry,"__asyncValues");n(iy,"__makeTemplateObject");eS=Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e},cc=n(function(i){return cc=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},cc(i)},"ownKeys");n(ny,"__importStar");n(ay,"__importDefault");n(sy,"__classPrivateFieldGet");n(oy,"__classPrivateFieldSet");n(ly,"__classPrivateFieldIn");n(uy,"__addDisposableResource");tS=typeof SuppressedError=="function"?SuppressedError:function(i,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=i,r.suppressed=e,r};n(cy,"__disposeResources");n(dy,"__rewriteRelativeImportExtension");rS={__extends:M_,__assign:cs,__rest:L_,__decorate:F_,__param:N_,__esDecorate:Q_,__runInitializers:G_,__propKey:W_,__setFunctionName:V_,__metadata:$_,__awaiter:z_,__generator:K_,__createBinding:hs,__exportStar:J_,__values:ds,__read:dc,__spread:Z_,__spreadArrays:X_,__spreadArray:Y_,__await:vr,__asyncGenerator:ey,__asyncDelegator:ty,__asyncValues:ry,__makeTemplateObject:iy,__importStar:ny,__importDefault:ay,__classPrivateFieldGet:sy,__classPrivateFieldSet:oy,__classPrivateFieldIn:ly,__addDisposableResource:uy,__disposeResources:cy,__rewriteRelativeImportExtension:dy}});var hi=u((pU,hy)=>{hy.exports.isNode=!1});var Zt=u(Pt=>{"use strict";var Et;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.LogLevelToConsoleFunction=Pt.resolveLogLevel=Pt.LogLevel=void 0;var iS=hi(),qe;(function(i){i[i.CRITICAL=0]="CRITICAL",i[i.ERROR=1]="ERROR",i[i.WARNING=2]="WARNING",i[i.INFO=3]="INFO",i[i.DEBUG=4]="DEBUG",i[i.TRACE=7]="TRACE"})(qe||(qe={}));Pt.LogLevel=qe;function nS(i){if(typeof i=="number"){if(Object.prototype.hasOwnProperty.call(qe,i))return i;var e=Object.keys(qe).map(function(r){return parseInt(r,10)}).filter(function(r){return!isNaN(r)&&r<i});return e.length?Math.max.apply(Math,e):qe.WARNING}var t=i.replace(/\d+$/,"").toUpperCase();if(!Object.prototype.hasOwnProperty.call(qe,t))throw new Error("Unknown log level string: ".concat(i));return qe[t]}n(nS,"resolveLogLevel");Pt.resolveLogLevel=nS;var aS=iS.isNode?console.log.bind(console):console.debug.bind(console);Pt.LogLevelToConsoleFunction=(Et={},Et[qe.CRITICAL]=console.error.bind(console),Et[qe.ERROR]=console.error.bind(console),Et[qe.WARNING]=console.warn.bind(console),Et[qe.INFO]=console.info.bind(console),Et[qe.DEBUG]=aS.bind(console),Et[qe.TRACE]=console.trace.bind(console),Et)});var py=u(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.Enumerable=void 0;function sS(i){return i===void 0&&(i=!0),function(e,t){Object.defineProperty(e,t,{get:n(function(){},"get"),set:n(function(r){Object.defineProperty(this,t,{value:r,writable:!0,enumerable:i})},"set"),enumerable:i})}}n(sS,"Enumerable");ps.Enumerable=sS});var _y=u(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.flatten=void 0;var my=(f(),b(y));function oS(i){var e;return(e=[]).concat.apply(e,my.__spreadArray([],my.__read(i),!1))}n(oS,"flatten");ms.flatten=oS});var yy=u(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.immutableSplice=void 0;var Sr=(f(),b(y));function lS(i,e,t){for(var r=[],a=3;a<arguments.length;a++)r[a-3]=arguments[a];return Sr.__spreadArray(Sr.__spreadArray(Sr.__spreadArray([],Sr.__read(i.slice(0,e)),!1),Sr.__read(r),!1),Sr.__read(i.slice(e+t)),!1)}n(lS,"immutableSplice");_s.immutableSplice=lS});var fy=u(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.partitionedFlatMap=void 0;var hc=(f(),b(y));function uS(i,e,t){var r,a,s,o={};try{for(var l=hc.__values(i),d=l.next();!d.done;d=l.next()){var h=d.value,p=e(h),x=t(h);Array.isArray(x)||(x=[x]),Object.prototype.hasOwnProperty.call(o,p)?(s=o[p]).push.apply(s,hc.__spreadArray([],hc.__read(x),!1)):o[p]=x}}catch(q){r={error:q}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}n(uS,"partitionedFlatMap");ys.partitionedFlatMap=uS});var by=u(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.resolveConfigValueSync=Hr.resolveConfigValue=void 0;var gy=(f(),b(y));function cS(i){return gy.__awaiter(this,void 0,void 0,function(){return gy.__generator(this,function(e){switch(e.label){case 0:return typeof i!="function"?[3,2]:[4,i()];case 1:return[2,e.sent()];case 2:return[2,i]}})})}n(cS,"resolveConfigValue");Hr.resolveConfigValue=cS;function dS(i){return typeof i=="function"?i():i}n(dS,"resolveConfigValueSync");Hr.resolveConfigValueSync=dS});var xy=u(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.deprecateClass=void 0;var pc=(f(),b(y));function hS(i,e){var t=!1;return function(r){pc.__extends(a,r);function a(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return t||(console.warn(e),t=!0),r.apply(this,pc.__spreadArray([],pc.__read(s),!1))||this}return n(a,"class_1"),a}(i)}n(hS,"deprecateClass");fs.deprecateClass=hS});var vy=u(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.match=Xt.eq=void 0;var wy=n(function(i){return{otherwise:n(function(){return i},"otherwise"),on:n(function(){return wy(i)},"on")}},"matched"),mc=n(function(i){return{on:n(function(e,t){return e(i)?wy(t(i)):mc(i)},"on"),otherwise:n(function(e){return e(i)},"otherwise")}},"match");Xt.match=mc;var pS=n(function(i){return function(e){return i===e}},"eq");Xt.eq=pS;mc.eq=Xt.eq});var Hy=u(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.fibWithLimit=void 0;var Sy=(f(),b(y));function mS(i){var e,t,r;return Sy.__generator(this,function(a){switch(a.label){case 0:e=0,t=1,a.label=1;case 1:return e<i?[4,e]:[3,3];case 2:return a.sent(),r=Sy.__read([t,e+t],2),e=r[0],t=r[1],[3,1];case 3:return[4,i];case 4:return a.sent(),[3,3];case 5:return[2]}})}n(mS,"fibWithLimit");gs.fibWithLimit=mS});var xs=u(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.arrayToObject=void 0;var Cy=(f(),b(y));function _S(i,e){return Object.assign.apply(Object,Cy.__spreadArray([{}],Cy.__read(i.map(e)),!1))}n(_S,"arrayToObject");bs.arrayToObject=_S});var qy=u(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.entriesToObject=void 0;var yS=(f(),b(y)),fS=xs();function gS(i){return(0,fS.arrayToObject)(i,function(e){var t,r=yS.__read(e,2),a=r[0],s=r[1];return t={},t[a]=s,t})}n(gS,"entriesToObject");ws.entriesToObject=gS});var Ey=u(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.forEachObjectEntry=void 0;var bS=(f(),b(y));function xS(i,e){Object.entries(i).forEach(function(t){var r=bS.__read(t,2),a=r[0],s=r[1];return e(s,a)})}n(xS,"forEachObjectEntry");vs.forEachObjectEntry=xS});var Py=u(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.groupBy=void 0;var wS=(f(),b(y));function vS(i,e){var t,r,a;if(typeof e!="function"){var s=e;e=n(function(x){return x[s].toString()},"keyFn")}var o={};try{for(var l=wS.__values(i),d=l.next();!d.done;d=l.next()){var h=d.value,p=e(h);((a=o[p])!==null&&a!==void 0?a:o[p]=[]).push(h)}}catch(x){t={error:x}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return o}n(vS,"groupBy");Ss.groupBy=vS});var Ay=u(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.indexBy=void 0;var SS=xs();function HS(i,e){if(typeof e!="function"){var t=e;e=n(function(r){return r[t].toString()},"keyFn")}return(0,SS.arrayToObject)(i,function(r){var a;return a={},a[e(r)]=r,a})}n(HS,"indexBy");Hs.indexBy=HS});var Dy=u(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.mapObject=void 0;var _c=(f(),b(y));function CS(i,e){var t=Object.entries(i).map(function(r){var a,s=_c.__read(r,2),o=s[0],l=s[1];return a={},a[o]=e(l,o),a});return Object.assign.apply(Object,_c.__spreadArray([{}],_c.__read(t),!1))}n(CS,"mapObject");Cs.mapObject=CS});var yc=u(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.pick=void 0;var qs=(f(),b(y));function qS(i,e){return Object.assign.apply(Object,qs.__spreadArray([{}],qs.__read(Object.entries(i).filter(function(t){var r=qs.__read(t,1),a=r[0];return e.includes(a)}).map(function(t){var r,a=qs.__read(t,2),s=a[0],o=a[1];return r={},r[s]=o,r})),!1))}n(qS,"pick");Es.pick=qS});var Iy=u(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.omit=void 0;var ES=yc();function PS(i,e){return(0,ES.pick)(i,Object.keys(i).filter(function(t){return!e.includes(t)}))}n(PS,"omit");Ps.omit=PS});var Ty=u(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.mapOptional=At.mapNullable=At.isNullish=void 0;function fc(i){return i==null}n(fc,"isNullish");At.isNullish=fc;function AS(i,e){return fc(i)?null:e(i)}n(AS,"mapNullable");At.mapNullable=AS;function DS(i,e){return fc(i)?void 0:e(i)}n(DS,"mapOptional");At.mapOptional=DS});var Uy=u(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.delay=void 0;var Ry=(f(),b(y));function IS(i){return Ry.__awaiter(this,void 0,void 0,function(){return Ry.__generator(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t){return setTimeout(t,i)})];case 1:return e.sent(),[2]}})})}n(IS,"delay");As.delay=IS});var By=u(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.promiseWithResolvers=void 0;function TS(){var i,e,t=new Promise(function(r,a){i=r,e=a});return{promise:t,resolve:i,reject:e}}n(TS,"promiseWithResolvers");Ds.promiseWithResolvers=TS});var Oy=u(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.padLeft=void 0;function RS(i,e,t){if(typeof i=="number"&&(i=i.toString()),e=e-i.length,e<=0)return i;t===void 0&&(t=" ");var r="";do(e&1)===1&&(r+=t),e>>=1,e&&(t+=t);while(e);return r+i}n(RS,"padLeft");Is.padLeft=RS});var jy=u(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.splitWithLimit=void 0;var gc=(f(),b(y));function US(i,e,t){var r=i.split(e);return r.length<=t?r:gc.__spreadArray(gc.__spreadArray([],gc.__read(r.slice(0,t-1)),!1),[r.slice(t-1).join(e)],!1)}n(US,"splitWithLimit");Ts.splitWithLimit=US});var ky=u(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.utf8Substring=Cr.utf8Length=void 0;var Rs=(f(),b(y));function BS(i){return Rs.__spreadArray([],Rs.__read(i),!1).length}n(BS,"utf8Length");Cr.utf8Length=BS;function OS(i,e,t){return Rs.__spreadArray([],Rs.__read(i),!1).slice(e,t).join("")}n(OS,"utf8Substring");Cr.utf8Substring=OS});var C=u(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.utf8Substring=A.utf8Length=A.splitWithLimit=A.padLeft=A.promiseWithResolvers=A.delay=A.mapOptional=A.mapNullable=A.isNullish=A.pick=A.omit=A.mapObject=A.indexBy=A.groupBy=A.forEachObjectEntry=A.entriesToObject=A.arrayToObject=A.fibWithLimit=A.eq=A.match=A.deprecateClass=A.resolveConfigValueSync=A.resolveConfigValue=A.partitionedFlatMap=A.immutableSplice=A.flatten=A.Enumerable=void 0;var jS=py();Object.defineProperty(A,"Enumerable",{enumerable:!0,get:n(function(){return jS.Enumerable},"get")});var kS=_y();Object.defineProperty(A,"flatten",{enumerable:!0,get:n(function(){return kS.flatten},"get")});var MS=yy();Object.defineProperty(A,"immutableSplice",{enumerable:!0,get:n(function(){return MS.immutableSplice},"get")});var LS=fy();Object.defineProperty(A,"partitionedFlatMap",{enumerable:!0,get:n(function(){return LS.partitionedFlatMap},"get")});var My=by();Object.defineProperty(A,"resolveConfigValue",{enumerable:!0,get:n(function(){return My.resolveConfigValue},"get")});Object.defineProperty(A,"resolveConfigValueSync",{enumerable:!0,get:n(function(){return My.resolveConfigValueSync},"get")});var FS=xy();Object.defineProperty(A,"deprecateClass",{enumerable:!0,get:n(function(){return FS.deprecateClass},"get")});var Ly=vy();Object.defineProperty(A,"match",{enumerable:!0,get:n(function(){return Ly.match},"get")});Object.defineProperty(A,"eq",{enumerable:!0,get:n(function(){return Ly.eq},"get")});var NS=Hy();Object.defineProperty(A,"fibWithLimit",{enumerable:!0,get:n(function(){return NS.fibWithLimit},"get")});var QS=xs();Object.defineProperty(A,"arrayToObject",{enumerable:!0,get:n(function(){return QS.arrayToObject},"get")});var GS=qy();Object.defineProperty(A,"entriesToObject",{enumerable:!0,get:n(function(){return GS.entriesToObject},"get")});var WS=Ey();Object.defineProperty(A,"forEachObjectEntry",{enumerable:!0,get:n(function(){return WS.forEachObjectEntry},"get")});var VS=Py();Object.defineProperty(A,"groupBy",{enumerable:!0,get:n(function(){return VS.groupBy},"get")});var $S=Ay();Object.defineProperty(A,"indexBy",{enumerable:!0,get:n(function(){return $S.indexBy},"get")});var zS=Dy();Object.defineProperty(A,"mapObject",{enumerable:!0,get:n(function(){return zS.mapObject},"get")});var KS=Iy();Object.defineProperty(A,"omit",{enumerable:!0,get:n(function(){return KS.omit},"get")});var JS=yc();Object.defineProperty(A,"pick",{enumerable:!0,get:n(function(){return JS.pick},"get")});var bc=Ty();Object.defineProperty(A,"isNullish",{enumerable:!0,get:n(function(){return bc.isNullish},"get")});Object.defineProperty(A,"mapNullable",{enumerable:!0,get:n(function(){return bc.mapNullable},"get")});Object.defineProperty(A,"mapOptional",{enumerable:!0,get:n(function(){return bc.mapOptional},"get")});var ZS=Uy();Object.defineProperty(A,"delay",{enumerable:!0,get:n(function(){return ZS.delay},"get")});var XS=By();Object.defineProperty(A,"promiseWithResolvers",{enumerable:!0,get:n(function(){return XS.promiseWithResolvers},"get")});var YS=Oy();Object.defineProperty(A,"padLeft",{enumerable:!0,get:n(function(){return YS.padLeft},"get")});var e0=jy();Object.defineProperty(A,"splitWithLimit",{enumerable:!0,get:n(function(){return e0.splitWithLimit},"get")});var Fy=ky();Object.defineProperty(A,"utf8Length",{enumerable:!0,get:n(function(){return Fy.utf8Length},"get")});Object.defineProperty(A,"utf8Substring",{enumerable:!0,get:n(function(){return Fy.utf8Substring},"get")})});var Sc=u(Bs=>{"use strict";var xc,wc;Object.defineProperty(Bs,"__esModule",{value:!0});Bs.getMinLogLevelFromEnv=void 0;var t0=Zt(),Us=typeof process>"u"?[]:(wc=(xc=process.env.LOGGING)===null||xc===void 0?void 0:xc.split(";").map(function(i){var e=i.split("=",2),t=e[0],r=e[1];return r?[t==="default"?void 0:t.split(":"),(0,t0.resolveLogLevel)(r)]:null}).filter(function(i){return!!i}).sort(function(i,e){var t,r,a=i[0],s=e[0];return((t=s?.length)!==null&&t!==void 0?t:0)-((r=a?.length)!==null&&r!==void 0?r:0)}))!==null&&wc!==void 0?wc:[],vc=Us.findIndex(function(i){var e=i[0];return!e}),Ny=void 0;vc!==-1&&(Ny=Us[vc][1],Us.splice(vc));function r0(i,e){return e.length<=i.length&&e.every(function(t,r){return t===i[r]})}n(r0,"isPrefix");function i0(i){for(var e=i.split(":"),t=0,r=Us;t<r.length;t++){var a=r[t],s=a[0],o=a[1];if(r0(e,s))return o}return Ny}n(i0,"getMinLogLevelFromEnv");Bs.getMinLogLevelFromEnv=i0});var Hc=u(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.BaseLogger=void 0;var n0=C(),a0=hi(),s0=Sc(),Dt=Zt(),o0=function(){function i(e){var t=e.name,r=e.minLevel,a=e.emoji,s=a===void 0?!1:a,o=e.colors,l=e.timestamps,d=l===void 0?a0.isNode:l,h,p;this._name=t,this._minLevel=(p=(h=(0,n0.mapOptional)(r,function(x){return(0,Dt.resolveLogLevel)(x)}))!==null&&h!==void 0?h:(0,s0.getMinLogLevelFromEnv)(t))!==null&&p!==void 0?p:Dt.LogLevel.WARNING,this._emoji=s,this._colors=o,this._timestamps=d}return n(i,"BaseLogger"),i.prototype.crit=function(e){this.log(Dt.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this.log(Dt.LogLevel.ERROR,e)},i.prototype.warn=function(e){this.log(Dt.LogLevel.WARNING,e)},i.prototype.info=function(e){this.log(Dt.LogLevel.INFO,e)},i.prototype.debug=function(e){this.log(Dt.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this.log(Dt.LogLevel.TRACE,e)},i}();Os.BaseLogger=o0});var Qy=u(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.BrowserLogger=void 0;var l0=(f(),b(y)),u0=Zt(),c0=Hc(),d0=function(i){l0.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"BrowserLogger"),e.prototype.log=function(t,r){if(!(t>this._minLevel)){var a=u0.LogLevelToConsoleFunction[t],s="[".concat(this._name,"] ").concat(r);this._timestamps&&(s="[".concat(new Date().toISOString(),"] ").concat(r)),a(s)}},e}(c0.BaseLogger);js.BrowserLogger=d0});var Gy=u(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.CustomLoggerWrapper=void 0;var h0=C(),p0=Sc(),Re=Zt(),m0=function(){function i(e){var t=e.name,r=e.minLevel,a=e.custom,s;this._minLevel=(s=(0,h0.mapOptional)(r,function(o){return(0,Re.resolveLogLevel)(o)}))!==null&&s!==void 0?s:(0,p0.getMinLogLevelFromEnv)(t),this._override=typeof a=="function"?{log:a}:a}return n(i,"CustomLoggerWrapper"),i.prototype.log=function(e,t){this._shouldLog(e)&&this._override.log(e,t)},i.prototype.crit=function(e){this._override.crit?this._shouldLog(Re.LogLevel.CRITICAL)&&this._override.crit(e):this.log(Re.LogLevel.CRITICAL,e)},i.prototype.error=function(e){this._override.error?this._shouldLog(Re.LogLevel.ERROR)&&this._override.error(e):this.log(Re.LogLevel.ERROR,e)},i.prototype.warn=function(e){this._override.warn?this._shouldLog(Re.LogLevel.WARNING)&&this._override.warn(e):this.log(Re.LogLevel.WARNING,e)},i.prototype.info=function(e){this._override.info?this._shouldLog(Re.LogLevel.INFO)&&this._override.info(e):this.log(Re.LogLevel.INFO,e)},i.prototype.debug=function(e){this._override.debug?this._shouldLog(Re.LogLevel.DEBUG)&&this._override.debug(e):this.log(Re.LogLevel.DEBUG,e)},i.prototype.trace=function(e){this._override.trace?this._shouldLog(Re.LogLevel.TRACE)&&this._override.trace(e):this.log(Re.LogLevel.TRACE,e)},i.prototype._shouldLog=function(e){return this._minLevel===void 0||this._minLevel>=e},i}();ks.CustomLoggerWrapper=m0});var Wy=u(Ee=>{"use strict";var It,Tt,Rt;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.NodeLogger=Ee.LogLevelToBackgroundColor=Ee.LogLevelToColor=Ee.LogLevelToEmoji=void 0;var _0=(f(),b(y)),re=Zt(),y0=Hc();Ee.LogLevelToEmoji=(It={},It[re.LogLevel.CRITICAL]="\u{1F6D1}",It[re.LogLevel.ERROR]="\u274C",It[re.LogLevel.WARNING]="\u26A0\uFE0F ",It[re.LogLevel.INFO]="\u2139\uFE0F ",It[re.LogLevel.DEBUG]="\u{1F41E}",It[re.LogLevel.TRACE]="\u{1F43E}",It);var f0={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,blackBright:90,redBright:91,greenBright:92,yellowBright:93,blueBright:94,magentaBright:95,cyanBright:96,whiteBright:97},g0={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBlackBright:100,bgRedBright:101,bgGreenBright:102,bgYellowBright:103,bgBlueBright:104,bgMagentaBright:105,bgCyanBright:106,bgWhiteBright:107};function Ms(i,e,t){return function(r){return"\x1B[".concat(i,"m").concat(t?t(r):r,"\x1B[").concat(e,"m")}}n(Ms,"createGenericWrapper");function at(i){return Ms(f0[i],39)}n(at,"createColorWrapper");function pi(i,e){return Ms(g0[i],49,e)}n(pi,"createBgWrapper");Ee.LogLevelToColor=(Tt={},Tt[re.LogLevel.CRITICAL]=at("red"),Tt[re.LogLevel.ERROR]=at("redBright"),Tt[re.LogLevel.WARNING]=at("yellow"),Tt[re.LogLevel.INFO]=at("blue"),Tt[re.LogLevel.DEBUG]=at("magenta"),Tt[re.LogLevel.TRACE]=Ms(0,0),Tt);Ee.LogLevelToBackgroundColor=(Rt={},Rt[re.LogLevel.CRITICAL]=pi("bgRed",at("white")),Rt[re.LogLevel.ERROR]=pi("bgRedBright",at("white")),Rt[re.LogLevel.WARNING]=pi("bgYellow",at("black")),Rt[re.LogLevel.INFO]=pi("bgBlue",at("white")),Rt[re.LogLevel.DEBUG]=pi("bgMagenta",at("black")),Rt[re.LogLevel.TRACE]=Ms(7,27),Rt);var b0=function(i){_0.__extends(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return n(e,"NodeLogger"),e.prototype.log=function(t,r){var a,s,o;if(!(t>this._minLevel)){var l=re.LogLevelToConsoleFunction[t],d="";if(this._timestamps&&(d+="[".concat(new Date().toISOString(),"] ")),this._emoji){var h=Ee.LogLevelToEmoji[t];d+="".concat(h," ")}var p=(o=(a=this._colors)!==null&&a!==void 0?a:(s=process.stdout)===null||s===void 0?void 0:s.isTTY)!==null&&o!==void 0?o:!0;p?d+="".concat(Ee.LogLevelToBackgroundColor[t](this._name)," ").concat(Ee.LogLevelToBackgroundColor[t](re.LogLevel[t])," ").concat(Ee.LogLevelToColor[t](r)):d+="[".concat(this._name,":").concat(re.LogLevel[t].toLowerCase(),"] ").concat(r),l(d)}},e}(y0.BaseLogger);Ee.NodeLogger=b0});var Vy=u(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.createLogger=void 0;var x0=hi(),w0=Qy(),v0=Gy(),S0=Wy();function H0(i){return i.custom?new v0.CustomLoggerWrapper(i):x0.isNode?new S0.NodeLogger(i):new w0.BrowserLogger(i)}n(H0,"createLogger");Ls.createLogger=H0});var mi=u(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.LogLevel=qr.createLogger=void 0;var C0=Vy();Object.defineProperty(qr,"createLogger",{enumerable:!0,get:n(function(){return C0.createLogger},"get")});var q0=Zt();Object.defineProperty(qr,"LogLevel",{enumerable:!0,get:n(function(){return q0.LogLevel},"get")})});var Ns=u(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.CustomError=void 0;var Cc=class extends Error{static{n(this,"CustomError")}constructor(...e){var t;super(...e),Object.setPrototypeOf(this,new.target.prototype),(t=Error.captureStackTrace)===null||t===void 0||t.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};Fs.CustomError=Cc});var Gs=u(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.RateLimiterDestroyedError=void 0;var E0=Ns(),qc=class extends E0.CustomError{static{n(this,"RateLimiterDestroyedError")}};Qs.RateLimiterDestroyedError=qc});var _i=u(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.RateLimitReachedError=void 0;var P0=Ns(),Ec=class extends P0.CustomError{static{n(this,"RateLimitReachedError")}};Ws.RateLimitReachedError=Ec});var Ac=u(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.RetryAfterError=void 0;var A0=Ns(),Pc=class extends A0.CustomError{static{n(this,"RetryAfterError")}constructor(e){super(`Need to retry after ${e} ms`),this._retryAt=Date.now()+e}get retryAt(){return this._retryAt}};Vs.RetryAfterError=Pc});var $y=u($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.NullRateLimiter=void 0;var Dc=class{static{n(this,"NullRateLimiter")}constructor(e){this._callback=e}async request(e){return await this._callback(e)}clear(){}pause(){}resume(){}};$s.NullRateLimiter=Dc});var Tc=u(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.ResponseBasedRateLimiter=void 0;var D0=mi(),I0=C(),T0=_i(),zy=Ac(),Ic=class{static{n(this,"ResponseBasedRateLimiter")}constructor({logger:e}){this._queue=[],this._batchRunning=!1,this._paused=!1,this._logger=(0,D0.createLogger)({name:"rate-limiter",emoji:!0,...e})}async request(e,t){return this._logger.trace("request start"),await new Promise((r,a)=>{var s;let o={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};this._batchRunning||this._nextBatchTimer||this._paused?(this._logger.trace(`request queued batchRunning:${this._batchRunning.toString()} hasNextBatchTimer:${(!!this._nextBatchTimer).toString()} paused:${this._paused.toString()}`),this._queue.push(o)):this._runRequestBatch([o])})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextBatch()}get stats(){var e,t,r,a,s;return{lastKnownLimit:(t=(e=this._parameters)===null||e===void 0?void 0:e.limit)!==null&&t!==void 0?t:null,lastKnownRemainingRequests:(a=(r=this._parameters)===null||r===void 0?void 0:r.remaining)!==null&&a!==void 0?a:null,lastKnownResetDate:(0,I0.mapNullable)((s=this._parameters)===null||s===void 0?void 0:s.resetsAt,o=>new Date(o))}}async _runRequestBatch(e){this._logger.trace(`runRequestBatch start specs:${e.length}`),this._batchRunning=!0,this._parameters&&this._logger.debug(`Remaining requests: ${this._parameters.remaining}`),this._logger.debug(`Doing ${e.length} requests, new queue length is ${this._queue.length}`);let t=e.map(async o=>{let{req:l,resolve:d,reject:h}=o;try{let p=await this.doRequest(l),x=this.needsToRetryAfter(p);if(x!==null)throw this._queue.unshift(o),this._logger.info(`Retrying after ${x} ms`),new zy.RetryAfterError(x);let q=this.getParametersFromResponse(p);return d(p),q}catch(p){if(p instanceof zy.RetryAfterError)throw p;h(p);return}}),r=await Promise.allSettled(t),a=r.filter(o=>o.status==="rejected"),s=Date.now();if(a.length){this._logger.trace("runRequestBatch some rejected");let l=Math.max(s,...a.map(d=>d.reason.retryAt))-s;this._logger.warn(`Waiting for ${l} ms because the rate limit was exceeded`),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}else{this._logger.trace("runRequestBatch none rejected");let o=r.filter(l=>l.status==="fulfilled"&&l.value!==void 0).map(l=>l.value).reduce((l,d)=>l?d.remaining<l.remaining?d:l:d,void 0);if(this._batchRunning=!1,o)if(this._parameters=o,o.resetsAt<s||o.remaining>0)this._logger.trace("runRequestBatch canRunMore"),this._runNextBatch();else{let l=o.resetsAt-s;this._logger.trace(`runRequestBatch delay:${l}`),this._logger.warn(`Waiting for ${l} ms because the rate limit was reached`),this._queue=this._queue.filter(d=>{switch(d.limitReachedBehavior){case"enqueue":return!0;case"null":return d.resolve(null),!1;case"throw":return d.reject(new T0.RateLimitReachedError("Request removed from queue because the rate limit was reached")),!1;default:throw new Error("this should never happen")}}),this._nextBatchTimer=setTimeout(()=>{this._parameters=void 0,this._runNextBatch()},l)}}this._logger.trace("runRequestBatch end")}_runNextBatch(){if(this._paused)return;this._logger.trace("runNextBatch start"),this._nextBatchTimer&&(clearTimeout(this._nextBatchTimer),this._nextBatchTimer=void 0);let e=this._parameters?Math.min(this._parameters.remaining,this._parameters.limit/10):1,t=this._queue.splice(0,e);t.length&&this._runRequestBatch(t),this._logger.trace("runNextBatch end")}};zs.ResponseBasedRateLimiter=Ic});var Ky=u(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.PartitionedRateLimiter=void 0;var R0=Tc(),Rc=class{static{n(this,"PartitionedRateLimiter")}constructor(e){this._children=new Map,this._paused=!1,this._partitionKeyCallback=e.getPartitionKey,this._createChildCallback=e.createChild}async request(e,t){let r=this._partitionKeyCallback(e);return await this._getChild(r).request(e,t)}clear(){for(let e of this._children.values())e.clear()}pause(){this._paused=!0;for(let e of this._children.values())e.pause()}resume(){this._paused=!1;for(let e of this._children.values())e.resume()}getChildStats(e){if(!this._children.has(e))return null;let t=this._children.get(e);return t instanceof R0.ResponseBasedRateLimiter?t.stats:null}_getChild(e){if(this._children.has(e))return this._children.get(e);let t=this._createChildCallback(e);return this._paused&&t.pause(),this._children.set(e,t),t}};Ks.PartitionedRateLimiter=Rc});var Zy=u(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.PartitionedTimeBasedRateLimiter=void 0;var U0=mi(),B0=_i(),Jy=Gs(),Uc=class{static{n(this,"PartitionedTimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a,getPartitionKey:s}){this._partitionedQueue=new Map,this._usedFromBucket=new Map,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,U0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a,this._partitionKeyCallback=s}async request(e,t){return await new Promise((r,a)=>{var s,o;if(this._destroyed){a(new Jy.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let l={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"},d=this._partitionKeyCallback(e),h=(o=this._usedFromBucket.get(d))!==null&&o!==void 0?o:0;if(h>=this._bucketSize||this._paused)switch(l.limitReachedBehavior){case"enqueue":{let p=this._getPartitionedQueue(d);p.push(l),h+p.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${p.length}`):this._logger.info(`Enqueueing request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused; queue size is ${p.length}`);break}case"null":{l.resolve(null),this._paused?this._logger.info(`Returning null for request for ${d?`partition ${d}`:"default partition"} because the rate limiter is paused`):this._logger.warn(`Rate limit of ${this._bucketSize} for ${d?`partition ${d}`:"default partition"} was reached, dropping request and returning null`);break}case"throw":{l.reject(new B0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":`the rate limit for ${d?`partition ${d}`:"default partition"} was reached`}`));break}default:throw new Error("this should never happen")}else this._runRequest(l,d)})}clear(){this._partitionedQueue.clear()}pause(){this._paused=!0}resume(){this._paused=!1;for(let e of this._partitionedQueue.keys())this._runNextRequest(e)}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._partitionedQueue.values())for(let t of e)t.reject(new Jy.RateLimiterDestroyedError("Rate limiter was destroyed"));this._partitionedQueue.clear()}_getPartitionedQueue(e){if(this._partitionedQueue.has(e))return this._partitionedQueue.get(e);let t=[];return this._partitionedQueue.set(e,t),t}async _runRequest(e,t){var r;let a=this._getPartitionedQueue(t);this._logger.debug(`doing a request for ${t?`partition ${t}`:"default partition"}, new queue length is ${a.length}`),this._usedFromBucket.set(t,((r=this._usedFromBucket.get(t))!==null&&r!==void 0?r:0)+1);let{req:s,resolve:o,reject:l}=e;try{o(await this._callback(s))}catch(d){l(d)}finally{let d=setTimeout(()=>{this._counterTimers.delete(d);let h=this._usedFromBucket.get(t)-1;this._usedFromBucket.set(t,h),a.length&&h<this._bucketSize&&this._runNextRequest(t)},this._timeFrame);this._counterTimers.add(d)}}_runNextRequest(e){if(this._paused)return;let r=this._getPartitionedQueue(e).shift();r&&this._runRequest(r,e)}};Js.PartitionedTimeBasedRateLimiter=Uc});var Oc=u(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.TimeBasedRateLimiter=void 0;var O0=mi(),j0=_i(),Xy=Gs(),Bc=class{static{n(this,"TimeBasedRateLimiter")}constructor({logger:e,bucketSize:t,timeFrame:r,doRequest:a}){this._queue=[],this._usedFromBucket=0,this._counterTimers=new Set,this._paused=!1,this._destroyed=!1,this._logger=(0,O0.createLogger)({name:"rate-limiter",emoji:!0,...e}),this._bucketSize=t,this._timeFrame=r,this._callback=a}async request(e,t){return await new Promise((r,a)=>{var s;if(this._destroyed){a(new Xy.RateLimiterDestroyedError("Rate limiter was destroyed"));return}let o={req:e,resolve:r,reject:a,limitReachedBehavior:(s=t?.limitReachedBehavior)!==null&&s!==void 0?s:"enqueue"};if(this._usedFromBucket>=this._bucketSize||this._paused)switch(o.limitReachedBehavior){case"enqueue":{this._queue.push(o),this._usedFromBucket+this._queue.length>=this._bucketSize?this._logger.warn(`Rate limit of ${this._bucketSize} was reached, waiting for ${this._paused?"the limiter to be unpaused":"a free bucket entry"}; queue size is ${this._queue.length}`):this._logger.info(`Enqueueing request because the rate limiter is paused; queue size is ${this._queue.length}`);break}case"null":{o.resolve(null),this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`),this._paused?this._logger.info("Returning null for request because the rate limiter is paused"):this._logger.warn(`Rate limit of ${this._bucketSize} was reached, dropping request and returning null`);break}case"throw":{o.reject(new j0.RateLimitReachedError(`Request dropped because ${this._paused?"the rate limiter is paused":"the rate limit was reached"}`));break}default:throw new Error("this should never happen")}else this._runRequest(o)})}clear(){this._queue=[]}pause(){this._paused=!0}resume(){this._paused=!1,this._runNextRequest()}destroy(){this._paused=!1,this._destroyed=!0,this._counterTimers.forEach(e=>{clearTimeout(e)});for(let e of this._queue)e.reject(new Xy.RateLimiterDestroyedError("Rate limiter was destroyed"));this._queue=[]}async _runRequest(e){this._logger.debug(`doing a request, new queue length is ${this._queue.length}`),this._usedFromBucket+=1;let{req:t,resolve:r,reject:a}=e;try{r(await this._callback(t))}catch(s){a(s)}finally{let s=setTimeout(()=>{this._counterTimers.delete(s),this._usedFromBucket-=1,this._queue.length&&this._usedFromBucket<this._bucketSize&&this._runNextRequest()},this._timeFrame);this._counterTimers.add(s)}}_runNextRequest(){if(this._paused)return;let e=this._queue.shift();e&&this._runRequest(e)}};Zs.TimeBasedRateLimiter=Bc});var Yy=u(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.TimedPassthruRateLimiter=void 0;var k0=Oc(),jc=class extends k0.TimeBasedRateLimiter{static{n(this,"TimedPassthruRateLimiter")}constructor(e,t){super({...t,async doRequest(r,a){return await e.request(r,a)}})}};Xs.TimedPassthruRateLimiter=jc});var Ys=u(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.TimedPassthruRateLimiter=ne.TimeBasedRateLimiter=ne.ResponseBasedRateLimiter=ne.PartitionedTimeBasedRateLimiter=ne.PartitionedRateLimiter=ne.NullRateLimiter=ne.RetryAfterError=ne.RateLimitReachedError=ne.RateLimiterDestroyedError=void 0;var M0=Gs();Object.defineProperty(ne,"RateLimiterDestroyedError",{enumerable:!0,get:n(function(){return M0.RateLimiterDestroyedError},"get")});var L0=_i();Object.defineProperty(ne,"RateLimitReachedError",{enumerable:!0,get:n(function(){return L0.RateLimitReachedError},"get")});var F0=Ac();Object.defineProperty(ne,"RetryAfterError",{enumerable:!0,get:n(function(){return F0.RetryAfterError},"get")});var N0=$y();Object.defineProperty(ne,"NullRateLimiter",{enumerable:!0,get:n(function(){return N0.NullRateLimiter},"get")});var Q0=Ky();Object.defineProperty(ne,"PartitionedRateLimiter",{enumerable:!0,get:n(function(){return Q0.PartitionedRateLimiter},"get")});var G0=Zy();Object.defineProperty(ne,"PartitionedTimeBasedRateLimiter",{enumerable:!0,get:n(function(){return G0.PartitionedTimeBasedRateLimiter},"get")});var W0=Tc();Object.defineProperty(ne,"ResponseBasedRateLimiter",{enumerable:!0,get:n(function(){return W0.ResponseBasedRateLimiter},"get")});var V0=Oc();Object.defineProperty(ne,"TimeBasedRateLimiter",{enumerable:!0,get:n(function(){return V0.TimeBasedRateLimiter},"get")});var $0=Yy();Object.defineProperty(ne,"TimedPassthruRateLimiter",{enumerable:!0,get:n(function(){return $0.TimedPassthruRateLimiter},"get")})});var rf=u((_t,tf)=>{var ef=typeof self<"u"?self:_t,eo=function(){function i(){this.fetch=!1,this.DOMException=ef.DOMException}return n(i,"F"),i.prototype=ef,new i}();(function(i){var e=function(t){var r={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function a(g){return g&&DataView.prototype.isPrototypeOf(g)}if(n(a,"isDataView"),r.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(g){return g&&s.indexOf(Object.prototype.toString.call(g))>-1};function l(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}n(l,"normalizeName");function d(g){return typeof g!="string"&&(g=String(g)),g}n(d,"normalizeValue");function h(g){var S={next:n(function(){var R=g.shift();return{done:R===void 0,value:R}},"next")};return r.iterable&&(S[Symbol.iterator]=function(){return S}),S}n(h,"iteratorFor");function p(g){this.map={},g instanceof p?g.forEach(function(S,R){this.append(R,S)},this):Array.isArray(g)?g.forEach(function(S){this.append(S[0],S[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(S){this.append(S,g[S])},this)}n(p,"Headers"),p.prototype.append=function(g,S){g=l(g),S=d(S);var R=this.map[g];this.map[g]=R?R+", "+S:S},p.prototype.delete=function(g){delete this.map[l(g)]},p.prototype.get=function(g){return g=l(g),this.has(g)?this.map[g]:null},p.prototype.has=function(g){return this.map.hasOwnProperty(l(g))},p.prototype.set=function(g,S){this.map[l(g)]=d(S)},p.prototype.forEach=function(g,S){for(var R in this.map)this.map.hasOwnProperty(R)&&g.call(S,this.map[R],R,this)},p.prototype.keys=function(){var g=[];return this.forEach(function(S,R){g.push(R)}),h(g)},p.prototype.values=function(){var g=[];return this.forEach(function(S){g.push(S)}),h(g)},p.prototype.entries=function(){var g=[];return this.forEach(function(S,R){g.push([R,S])}),h(g)},r.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function x(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}n(x,"consumed");function q(g){return new Promise(function(S,R){g.onload=function(){S(g.result)},g.onerror=function(){R(g.error)}})}n(q,"fileReaderReady");function E(g){var S=new FileReader,R=q(S);return S.readAsArrayBuffer(g),R}n(E,"readBlobAsArrayBuffer");function w(g){var S=new FileReader,R=q(S);return S.readAsText(g),R}n(w,"readBlobAsText");function P(g){for(var S=new Uint8Array(g),R=new Array(S.length),we=0;we<S.length;we++)R[we]=String.fromCharCode(S[we]);return R.join("")}n(P,"readArrayBufferAsText");function v(g){if(g.slice)return g.slice(0);var S=new Uint8Array(g.byteLength);return S.set(new Uint8Array(g)),S.buffer}n(v,"bufferClone");function B(){return this.bodyUsed=!1,this._initBody=function(g){this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:r.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:r.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():r.arrayBuffer&&r.blob&&a(g)?(this._bodyArrayBuffer=v(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||o(g))?this._bodyArrayBuffer=v(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var g=x(this);if(g)return g;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?x(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(E)}),this.text=function(){var g=x(this);if(g)return g;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(xe)}),this.json=function(){return this.text().then(JSON.parse)},this}n(B,"Body");var V=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(g){var S=g.toUpperCase();return V.indexOf(S)>-1?S:g}n($,"normalizeMethod");function z(g,S){S=S||{};var R=S.body;if(g instanceof z){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,S.headers||(this.headers=new p(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!R&&g._bodyInit!=null&&(R=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=S.credentials||this.credentials||"same-origin",(S.headers||!this.headers)&&(this.headers=new p(S.headers)),this.method=$(S.method||this.method||"GET"),this.mode=S.mode||this.mode||null,this.signal=S.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(R)}n(z,"Request"),z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function xe(g){var S=new FormData;return g.trim().split("&").forEach(function(R){if(R){var we=R.split("="),fe=we.shift().replace(/\+/g," "),F=we.join("=").replace(/\+/g," ");S.append(decodeURIComponent(fe),decodeURIComponent(F))}}),S}n(xe,"decode");function it(g){var S=new p,R=g.replace(/\r?\n[\t ]+/g," ");return R.split(/\r?\n/).forEach(function(we){var fe=we.split(":"),F=fe.shift().trim();if(F){var Ka=fe.join(":").trim();S.append(F,Ka)}}),S}n(it,"parseHeaders"),B.call(z.prototype);function he(g,S){S||(S={}),this.type="default",this.status=S.status===void 0?200:S.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in S?S.statusText:"OK",this.headers=new p(S.headers),this.url=S.url||"",this._initBody(g)}n(he,"Response"),B.call(he.prototype),he.prototype.clone=function(){return new he(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},he.error=function(){var g=new he(null,{status:0,statusText:""});return g.type="error",g};var _r=[301,302,303,307,308];he.redirect=function(g,S){if(_r.indexOf(S)===-1)throw new RangeError("Invalid status code");return new he(null,{status:S,headers:{location:g}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(S,R){this.message=S,this.name=R;var we=Error(S);this.stack=we.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function yr(g,S){return new Promise(function(R,we){var fe=new z(g,S);if(fe.signal&&fe.signal.aborted)return we(new t.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function Ka(){F.abort()}n(Ka,"abortXhr"),F.onload=function(){var si={status:F.status,statusText:F.statusText,headers:it(F.getAllResponseHeaders()||"")};si.url="responseURL"in F?F.responseURL:si.headers.get("X-Request-URL");var Uu="response"in F?F.response:F.responseText;R(new he(Uu,si))},F.onerror=function(){we(new TypeError("Network request failed"))},F.ontimeout=function(){we(new TypeError("Network request failed"))},F.onabort=function(){we(new t.DOMException("Aborted","AbortError"))},F.open(fe.method,fe.url,!0),fe.credentials==="include"?F.withCredentials=!0:fe.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&r.blob&&(F.responseType="blob"),fe.headers.forEach(function(si,Uu){F.setRequestHeader(Uu,si)}),fe.signal&&(fe.signal.addEventListener("abort",Ka),F.onreadystatechange=function(){F.readyState===4&&fe.signal.removeEventListener("abort",Ka)}),F.send(typeof fe._bodyInit>"u"?null:fe._bodyInit)})}return n(yr,"fetch"),yr.polyfill=!0,i.fetch||(i.fetch=yr,i.Headers=p,i.Request=z,i.Response=he),t.Headers=p,t.Request=z,t.Response=he,t.fetch=yr,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(eo);eo.fetch.ponyfill=!0;delete eo.fetch.polyfill;var Er=eo;_t=Er.fetch;_t.default=Er.fetch;_t.fetch=Er.fetch;_t.Headers=Er.Headers;_t.Request=Er.Request;_t.Response=Er.Response;tf.exports=_t});var to=u((WB,af)=>{"use strict";var kc=Object.prototype.hasOwnProperty,Pr=Array.isArray,st=function(){for(var i=[],e=0;e<256;++e)i.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return i}(),z0=n(function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(Pr(r)){for(var a=[],s=0;s<r.length;++s)typeof r[s]<"u"&&a.push(r[s]);t.obj[t.prop]=a}}},"compactQueue"),nf=n(function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(r[a]=e[a]);return r},"arrayToObject"),K0=n(function i(e,t,r){if(!t)return e;if(typeof t!="object"){if(Pr(e))e.push(t);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!kc.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return Pr(e)&&!Pr(t)&&(a=nf(e,r)),Pr(e)&&Pr(t)?(t.forEach(function(s,o){if(kc.call(e,o)){var l=e[o];l&&typeof l=="object"&&s&&typeof s=="object"?e[o]=i(l,s,r):e.push(s)}else e[o]=s}),e):Object.keys(t).reduce(function(s,o){var l=t[o];return kc.call(s,o)?s[o]=i(s[o],l,r):s[o]=l,s},a)},"merge"),J0=n(function(e,t){return Object.keys(t).reduce(function(r,a){return r[a]=t[a],r},e)},"assignSingleSource"),Z0=n(function(i,e,t){var r=i.replace(/\+/g," ");if(t==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode"),X0=n(function(e,t,r){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),r==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var s="",o=0;o<a.length;++o){var l=a.charCodeAt(o);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122){s+=a.charAt(o);continue}if(l<128){s=s+st[l];continue}if(l<2048){s=s+(st[192|l>>6]+st[128|l&63]);continue}if(l<55296||l>=57344){s=s+(st[224|l>>12]+st[128|l>>6&63]+st[128|l&63]);continue}o+=1,l=65536+((l&1023)<<10|a.charCodeAt(o)&1023),s+=st[240|l>>18]+st[128|l>>12&63]+st[128|l>>6&63]+st[128|l&63]}return s},"encode"),Y0=n(function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],a=0;a<t.length;++a)for(var s=t[a],o=s.obj[s.prop],l=Object.keys(o),d=0;d<l.length;++d){var h=l[d],p=o[h];typeof p=="object"&&p!==null&&r.indexOf(p)===-1&&(t.push({obj:o,prop:h}),r.push(p))}return z0(t),e},"compact"),eH=n(function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},"isRegExp"),tH=n(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),rH=n(function(e,t){return[].concat(e,t)},"combine");af.exports={arrayToObject:nf,assign:J0,combine:rH,compact:Y0,decode:Z0,encode:X0,isBuffer:tH,isRegExp:eH,merge:K0}});var Mc=u(($B,of)=>{"use strict";var iH=String.prototype.replace,nH=/%20/g,aH=to(),sf={RFC1738:"RFC1738",RFC3986:"RFC3986"};of.exports=aH.assign({default:sf.RFC3986,formatters:{RFC1738:n(function(i){return iH.call(i,nH,"+")},"RFC1738"),RFC3986:n(function(i){return String(i)},"RFC3986")}},sf)});var hf=u((KB,df)=>{"use strict";var cf=to(),yi=Mc(),sH=Object.prototype.hasOwnProperty,lf={brackets:n(function(e){return e+"[]"},"brackets"),comma:"comma",indices:n(function(e,t){return e+"["+t+"]"},"indices"),repeat:n(function(e){return e},"repeat")},Ar=Array.isArray,oH=Array.prototype.push,Lc=n(function(i,e){oH.apply(i,Ar(e)?e:[e])},"pushToArray"),lH=Date.prototype.toISOString,uf=yi.default,Se={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:cf.encode,encodeValuesOnly:!1,format:uf,formatter:yi.formatters[uf],indices:!1,serializeDate:n(function(e){return lH.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},uH=n(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),cH=n(function i(e,t,r,a,s,o,l,d,h,p,x,q,E){var w=e;if(typeof l=="function"?w=l(t,w):w instanceof Date?w=p(w):r==="comma"&&Ar(w)&&(w=w.join(",")),w===null){if(a)return o&&!q?o(t,Se.encoder,E,"key"):t;w=""}if(uH(w)||cf.isBuffer(w)){if(o){var P=q?t:o(t,Se.encoder,E,"key");return[x(P)+"="+x(o(w,Se.encoder,E,"value"))]}return[x(t)+"="+x(String(w))]}var v=[];if(typeof w>"u")return v;var B;if(Ar(l))B=l;else{var V=Object.keys(w);B=d?V.sort(d):V}for(var $=0;$<B.length;++$){var z=B[$];s&&w[z]===null||(Ar(w)?Lc(v,i(w[z],typeof r=="function"?r(t,z):t,r,a,s,o,l,d,h,p,x,q,E)):Lc(v,i(w[z],t+(h?"."+z:"["+z+"]"),r,a,s,o,l,d,h,p,x,q,E)))}return v},"stringify"),dH=n(function(e){if(!e)return Se;if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||Se.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=yi.default;if(typeof e.format<"u"){if(!sH.call(yi.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=yi.formatters[r],s=Se.filter;return(typeof e.filter=="function"||Ar(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Se.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Se.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Se.charsetSentinel,delimiter:typeof e.delimiter>"u"?Se.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Se.encode,encoder:typeof e.encoder=="function"?e.encoder:Se.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Se.encodeValuesOnly,filter:s,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Se.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Se.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Se.strictNullHandling}},"normalizeStringifyOptions");df.exports=function(i,e){var t=i,r=dH(e),a,s;typeof r.filter=="function"?(s=r.filter,t=s("",t)):Ar(r.filter)&&(s=r.filter,a=s);var o=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in lf?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var d=lf[l];a||(a=Object.keys(t)),r.sort&&a.sort(r.sort);for(var h=0;h<a.length;++h){var p=a[h];r.skipNulls&&t[p]===null||Lc(o,cH(t[p],p,d,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.formatter,r.encodeValuesOnly,r.charset))}var x=o.join(r.delimiter),q=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?q+="utf8=%26%2310003%3B&":q+="utf8=%E2%9C%93&"),x.length>0?q+x:""}});var yf=u((ZB,_f)=>{"use strict";var fi=to(),Fc=Object.prototype.hasOwnProperty,pf=Array.isArray,ge={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:fi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},hH=n(function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},"interpretNumericEntities"),mf=n(function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},"parseArrayValue"),pH=n(function(e,t){if(pf(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},"maybeMap"),mH="utf8=%26%2310003%3B",_H="utf8=%E2%9C%93",yH=n(function(e,t){var r={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=a.split(t.delimiter,s),l=-1,d,h=t.charset;if(t.charsetSentinel)for(d=0;d<o.length;++d)o[d].indexOf("utf8=")===0&&(o[d]===_H?h="utf-8":o[d]===mH&&(h="iso-8859-1"),l=d,d=o.length);for(d=0;d<o.length;++d)if(d!==l){var p=o[d],x=p.indexOf("]="),q=x===-1?p.indexOf("="):x+1,E,w;q===-1?(E=t.decoder(p,ge.decoder,h,"key"),w=t.strictNullHandling?null:""):(E=t.decoder(p.slice(0,q),ge.decoder,h,"key"),w=pH(mf(p.slice(q+1),t),function(P){return t.decoder(P,ge.decoder,h,"value")})),w&&t.interpretNumericEntities&&h==="iso-8859-1"&&(w=hH(w)),p.indexOf("[]=")>-1&&(w=pf(w)?[w]:w),Fc.call(r,E)?r[E]=fi.combine(r[E],w):r[E]=w}return r},"parseQueryStringValues"),fH=n(function(i,e,t,r){for(var a=r?e:mf(e,t),s=i.length-1;s>=0;--s){var o,l=i[s];if(l==="[]"&&t.parseArrays)o=[].concat(a);else{o=t.plainObjects?Object.create(null):{};var d=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,h=parseInt(d,10);!t.parseArrays&&d===""?o={0:a}:!isNaN(h)&&l!==d&&String(h)===d&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=a):o[d]=a}a=o}return a},"parseObject"),gH=n(function(e,t,r,a){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,d=r.depth>0&&o.exec(s),h=d?s.slice(0,d.index):s,p=[];if(h){if(!r.plainObjects&&Fc.call(Object.prototype,h)&&!r.allowPrototypes)return;p.push(h)}for(var x=0;r.depth>0&&(d=l.exec(s))!==null&&x<r.depth;){if(x+=1,!r.plainObjects&&Fc.call(Object.prototype,d[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(d[1])}return d&&p.push("["+s.slice(d.index)+"]"),fH(p,t,r,a)}},"parseQueryStringKeys"),bH=n(function(e){if(!e)return ge;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?ge.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?ge.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ge.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ge.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ge.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ge.comma,decoder:typeof e.decoder=="function"?e.decoder:ge.decoder,delimiter:typeof e.delimiter=="string"||fi.isRegExp(e.delimiter)?e.delimiter:ge.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ge.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ge.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ge.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ge.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ge.strictNullHandling}},"normalizeParseOptions");_f.exports=function(i,e){var t=bH(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?yH(i,t):i,a=t.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var l=s[o],d=gH(l,r[l],t,typeof i=="string");a=fi.merge(a,d,t)}return fi.compact(a)}});var Nc=u((YB,ff)=>{"use strict";var xH=hf(),wH=yf(),vH=Mc();ff.exports={formats:vH,parse:wH,stringify:xH}});var bf=u(gf=>{function yt(i){if(typeof i!="object")return i;var e,t,r=Object.prototype.toString.call(i);if(r==="[object Object]"){if(i.constructor!==Object&&typeof i.constructor=="function"){t=new i.constructor;for(e in i)i.hasOwnProperty(e)&&t[e]!==i[e]&&(t[e]=yt(i[e]))}else{t={};for(e in i)e==="__proto__"?Object.defineProperty(t,e,{value:yt(i[e]),configurable:!0,enumerable:!0,writable:!0}):t[e]=yt(i[e])}return t}if(r==="[object Array]"){for(e=i.length,t=Array(e);e--;)t[e]=yt(i[e]);return t}return r==="[object Set]"?(t=new Set,i.forEach(function(a){t.add(yt(a))}),t):r==="[object Map]"?(t=new Map,i.forEach(function(a,s){t.set(yt(s),yt(a))}),t):r==="[object Date]"?new Date(+i):r==="[object RegExp]"?(t=new RegExp(i.source,i.flags),t.lastIndex=i.lastIndex,t):r==="[object DataView]"?new i.constructor(yt(i.buffer)):r==="[object ArrayBuffer]"?i.slice(0):r.slice(-6)==="Array]"?new i.constructor(i):i}n(yt,"klona");gf.klona=yt});var Gc=u(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.DataObject=ot.getRawData=ot.rawDataSymbol=void 0;var SH=bf();ot.rawDataSymbol=Symbol("twurpleRawData");function HH(i){return(0,SH.klona)(i[ot.rawDataSymbol])}n(HH,"getRawData");ot.getRawData=HH;var Qc=class{static{n(this,"DataObject")}constructor(e){this[ot.rawDataSymbol]=e}};ot.DataObject=Qc});var io=u(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.CustomError=void 0;var Wc=class extends Error{static{n(this,"CustomError")}constructor(e,t){var r;super(e,t),Object.setPrototypeOf(this,new.target.prototype),(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,new.target.constructor)}get name(){return this.constructor.name}};ro.CustomError=Wc});var $c=u(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.RelationAssertionError=void 0;var CH=io(),Vc=class extends CH.CustomError{static{n(this,"RelationAssertionError")}constructor(){super("Relation returned null - this may be a library bug or a race condition in your own code")}};no.RelationAssertionError=Vc});var xf=u(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.checkRelationAssertion=void 0;var qH=$c();function EH(i){if(i==null)throw new qH.RelationAssertionError;return i}n(EH,"checkRelationAssertion");ao.checkRelationAssertion=EH});var zc=u(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.rtfm=void 0;function PH(i,e,t){return r=>{let a=t?function(){return`[${e}#${this[t]} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`}:function(){return`[${e} - please check https://twurple.js.org/reference/${i}/classes/${e}.html for available properties]`};Object.defineProperty(r.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:a,enumerable:!1})}}n(PH,"rtfm");so.rtfm=PH});var wf=u(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.HelixExtension=void 0;var AH=(f(),b(y)),D=Gc(),DH=zc(),Kc=class extends D.DataObject{static{n(this,"HelixExtension")}get authorName(){return this[D.rawDataSymbol].author_name}get bitsEnabled(){return this[D.rawDataSymbol].bits_enabled}get installable(){return this[D.rawDataSymbol].can_install}get configurationLocation(){return this[D.rawDataSymbol].configuration_location}get description(){return this[D.rawDataSymbol].description}get tosUrl(){return this[D.rawDataSymbol].eula_tos_url}get hasChatSupport(){return this[D.rawDataSymbol].has_chat_support}get iconUrl(){return this[D.rawDataSymbol].icon_url}getIconUrl(e){return this[D.rawDataSymbol].icon_urls[e]}get id(){return this[D.rawDataSymbol].id}get name(){return this[D.rawDataSymbol].name}get privacyPolicyUrl(){return this[D.rawDataSymbol].privacy_policy_url}get requestsIdentityLink(){return this[D.rawDataSymbol].request_identity_link}get screenshotUrls(){return this[D.rawDataSymbol].screenshot_urls}get state(){return this[D.rawDataSymbol].state}get subscriptionsSupportLevel(){return this[D.rawDataSymbol].subscriptions_support_level}get summary(){return this[D.rawDataSymbol].summary}get supportEmail(){return this[D.rawDataSymbol].support_email}get version(){return this[D.rawDataSymbol].version}get viewerSummary(){return this[D.rawDataSymbol].viewer_summary}get viewerSummery(){return this[D.rawDataSymbol].viewer_summary}get allowedConfigUrls(){return this[D.rawDataSymbol].allowlisted_config_urls}get allowedPanelUrls(){return this[D.rawDataSymbol].allowlisted_panel_urls}get mobileViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.mobile)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get panelHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.height)!==null&&t!==void 0?t:null}get panelCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.panel)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get overlayViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get overlayCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.video_overlay)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get componentViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get componentAspectWidth(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_width)!==null&&t!==void 0?t:null}get componentAspectHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_height)!==null&&t!==void 0?t:null}get componentAspectRatioX(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_x)!==null&&t!==void 0?t:null}get componentAspectRatioY(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.aspect_ratio_y)!==null&&t!==void 0?t:null}get componentAutoScales(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.autoscale)!==null&&t!==void 0?t:null}get componentScalePixels(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.scale_pixels)!==null&&t!==void 0?t:null}get componentTargetHeight(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.target_height)!==null&&t!==void 0?t:null}get componentSize(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.size)!==null&&t!==void 0?t:null}get componentZoom(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom)!==null&&t!==void 0?t:null}get componentZoomPixels(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.zoom_pixels)!==null&&t!==void 0?t:null}get componentCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.component)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}get configViewerUrl(){var e,t;return(t=(e=this[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.viewer_url)!==null&&t!==void 0?t:null}get configCanLinkExternalContent(){var e,t;return(t=(e=this[D.rawDataSymbol].views.config)===null||e===void 0?void 0:e.can_link_external_content)!==null&&t!==void 0?t:null}};gi.HelixExtension=Kc;gi.HelixExtension=Kc=AH.__decorate([(0,DH.rtfm)("api","HelixExtension","id")],Kc)});var vf=u(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.HellFreezesOverError=void 0;var IH=io(),Jc=class extends IH.CustomError{static{n(this,"HellFreezesOverError")}constructor(e){super(`${e} - this should never happen, please file a bug in the GitHub issue tracker`)}};oo.HellFreezesOverError=Jc});var Sf=u(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.extractUserName=Dr.extractUserId=void 0;function TH(i){return typeof i=="string"?i:typeof i=="number"?i.toString(10):i.id}n(TH,"extractUserId");Dr.extractUserId=TH;function RH(i){return typeof i=="string"?i:i.name}n(RH,"extractUserName");Dr.extractUserName=RH});var m=u(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.extractUserName=K.extractUserId=K.RelationAssertionError=K.HellFreezesOverError=K.CustomError=K.HelixExtension=K.rtfm=K.checkRelationAssertion=K.rawDataSymbol=K.getRawData=K.DataObject=void 0;var Zc=Gc();Object.defineProperty(K,"DataObject",{enumerable:!0,get:n(function(){return Zc.DataObject},"get")});Object.defineProperty(K,"getRawData",{enumerable:!0,get:n(function(){return Zc.getRawData},"get")});Object.defineProperty(K,"rawDataSymbol",{enumerable:!0,get:n(function(){return Zc.rawDataSymbol},"get")});var UH=xf();Object.defineProperty(K,"checkRelationAssertion",{enumerable:!0,get:n(function(){return UH.checkRelationAssertion},"get")});var BH=zc();Object.defineProperty(K,"rtfm",{enumerable:!0,get:n(function(){return BH.rtfm},"get")});var OH=wf();Object.defineProperty(K,"HelixExtension",{enumerable:!0,get:n(function(){return OH.HelixExtension},"get")});var jH=io();Object.defineProperty(K,"CustomError",{enumerable:!0,get:n(function(){return jH.CustomError},"get")});var kH=vf();Object.defineProperty(K,"HellFreezesOverError",{enumerable:!0,get:n(function(){return kH.HellFreezesOverError},"get")});var MH=$c();Object.defineProperty(K,"RelationAssertionError",{enumerable:!0,get:n(function(){return MH.RelationAssertionError},"get")});var Hf=Sf();Object.defineProperty(K,"extractUserId",{enumerable:!0,get:n(function(){return Hf.extractUserId},"get")});Object.defineProperty(K,"extractUserName",{enumerable:!0,get:n(function(){return Hf.extractUserName},"get")})});var Yc=u(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.HttpStatusCodeError=void 0;var LH=m(),Xc=class extends LH.CustomError{static{n(this,"HttpStatusCodeError")}constructor(e,t,r,a,s,o){super(`Encountered HTTP status code ${e}: ${t}
|
|
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}};lo.HttpStatusCodeError=Xc});var ed=u(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.transformTwitchApiResponse=Ir.handleTwitchApiResponseError=void 0;var FH=Nc(),NH=Yc();async function QH(i,e){var t;if(!i.ok){let r=i.headers.get("Content-Type")==="application/json",a=r?JSON.stringify(await i.json(),null,2):await i.text(),s=(0,FH.stringify)(e.query,{arrayFormat:"repeat",addQueryPrefix:!0}),o=`${e.url}${s}`;throw new NH.HttpStatusCodeError(i.status,i.statusText,o,(t=e.method)!==null&&t!==void 0?t:"GET",a,r)}}n(QH,"handleTwitchApiResponseError");Ir.handleTwitchApiResponseError=QH;async function GH(i){if(i.status===204)return;let e=await i.text();if(e)return JSON.parse(e)}n(GH,"transformTwitchApiResponse");Ir.transformTwitchApiResponse=GH});var Cf=u(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.getTwitchApiUrl=void 0;function WH(i,e,t){switch(e){case"helix":{let r=i.replace(/^\//,"");return t?r==="eventsub/subscriptions"?`http://localhost:${t}/${r}`:`http://localhost:${t}/mock/${r}`:`https://api.twitch.tv/helix/${r}`}case"auth":return`https://id.twitch.tv/oauth2/${i.replace(/^\//,"")}`;case"custom":return i;default:return i}}n(WH,"getTwitchApiUrl");uo.getTwitchApiUrl=WH});var Af=u(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callTwitchApi=Tr.callTwitchApiRaw=void 0;var qf=rf(),VH=Nc(),Ef=ed(),$H=Cf();async function Pf(i,e,t,r,a={},s){var o,l;let d=(o=i.type)!==null&&o!==void 0?o:"helix",h=(0,$H.getTwitchApiUrl)(i.url,d,s),p=(0,VH.stringify)(i.query,{arrayFormat:"repeat",addQueryPrefix:!0}),x=new qf.Headers({Accept:"application/json"}),q;i.jsonBody&&(q=JSON.stringify(i.jsonBody),x.append("Content-Type","application/json")),e&&d!=="auth"&&x.append("Client-ID",e),t&&x.append("Authorization",`${d==="helix"?r??"Bearer":"OAuth"} ${t}`);let E={...a,method:(l=i.method)!==null&&l!==void 0?l:"GET",headers:x,body:q};return await(0,qf.default)(`${h}${p}`,E)}n(Pf,"callTwitchApiRaw");Tr.callTwitchApiRaw=Pf;async function zH(i,e,t,r,a={}){let s=await Pf(i,e,t,r,a);return await(0,Ef.handleTwitchApiResponseError)(s,i),await(0,Ef.transformTwitchApiResponse)(s)}n(zH,"callTwitchApi");Tr.callTwitchApi=zH});var Df=u(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.createBroadcasterQuery=void 0;var KH=m();function JH(i){return{broadcaster_id:(0,KH.extractUserId)(i)}}n(JH,"createBroadcasterQuery");co.createBroadcasterQuery=JH});var Z=u(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.HttpStatusCodeError=Pe.transformTwitchApiResponse=Pe.handleTwitchApiResponseError=Pe.createBroadcasterQuery=Pe.callTwitchApiRaw=Pe.callTwitchApi=void 0;var If=Af();Object.defineProperty(Pe,"callTwitchApi",{enumerable:!0,get:n(function(){return If.callTwitchApi},"get")});Object.defineProperty(Pe,"callTwitchApiRaw",{enumerable:!0,get:n(function(){return If.callTwitchApiRaw},"get")});var ZH=Df();Object.defineProperty(Pe,"createBroadcasterQuery",{enumerable:!0,get:n(function(){return ZH.createBroadcasterQuery},"get")});var Tf=ed();Object.defineProperty(Pe,"handleTwitchApiResponseError",{enumerable:!0,get:n(function(){return Tf.handleTwitchApiResponseError},"get")});Object.defineProperty(Pe,"transformTwitchApiResponse",{enumerable:!0,get:n(function(){return Tf.transformTwitchApiResponse},"get")});var XH=Yc();Object.defineProperty(Pe,"HttpStatusCodeError",{enumerable:!0,get:n(function(){return XH.HttpStatusCodeError},"get")})});var rd=u(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.ConfigError=void 0;var YH=m(),td=class extends YH.CustomError{static{n(this,"ConfigError")}};ho.ConfigError=td});var Rf=u(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.HelixRateLimiter=void 0;var eC=Ys(),tC=Z(),id=class extends eC.ResponseBasedRateLimiter{static{n(this,"HelixRateLimiter")}async doRequest({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:s,mockServerPort:o}){return await(0,tC.callTwitchApiRaw)(e,t,r,a,s,o)}needsToRetryAfter(e){return e.status===429&&(!e.headers.has("ratelimit-remaining")||Number(e.headers.get("ratelimit-remaining"))===0)?+e.headers.get("ratelimit-reset")*1e3-Date.now():null}getParametersFromResponse(e){let{headers:t}=e;return{limit:+t.get("ratelimit-limit"),remaining:+t.get("ratelimit-remaining"),resetsAt:+t.get("ratelimit-reset")*1e3}}};po.HelixRateLimiter=id});var bi=u(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.createCacheKey=void 0;function rC(i){switch(typeof i){case"undefined":return"";case"object":{if(i===null)return"";if("cacheKey"in i)return i.cacheKey;let e=JSON.stringify(i);if(e!=="{}")return e}default:return i.toString()}}n(rC,"createSingleCacheKey");function iC(i,e,t){return[i,...e.map(rC)].join("/")+(t?"/":"")}n(iC,"createCacheKey");mo.createCacheKey=iC});var Uf=u(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.Cacheable=void 0;var nC=bi(),ft=Symbol("cache");function aC(i){var e,t;return t=class extends i{static{n(this,"_b")}constructor(){super(...arguments),this[e]=new Map}getFromCache(r){if(this._cleanCache(),this[ft].has(r)){let a=this[ft].get(r);if(a)return a.value}}setCache(r,a,s){this[ft].set(r,{value:a,expires:Date.now()+s*1e3})}removeFromCache(r,a){let s=this._getInternalCacheKey(r,a);a?this[ft].forEach((o,l)=>{l.startsWith(s)&&this[ft].delete(l)}):this[ft].delete(s)}_cleanCache(){let r=Date.now();this[ft].forEach((a,s)=>{a.expires<r&&this[ft].delete(s)})}_getInternalCacheKey(r,a){if(typeof r=="string"){let s=r;return s.endsWith("/")||(s+="/"),s}else{let s=r.shift();return(0,nC.createCacheKey)(s,r,a)}}},e=ft,t}n(aC,"Cacheable");_o.Cacheable=aC});var Bf=u(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.Cached=void 0;var sC=bi();function oC(i=1/0,e=!1){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=(0,sC.createCacheKey)(r,o),d=this.getFromCache(l);if(d)return d;let h=await s.apply(this,o);return(h!=null||e)&&this.setCache(l,h,i),h},a}}n(oC,"Cached");yo.Cached=oC});var Of=u(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.CachedGetter=void 0;var lC=bi();function uC(i=1/0){return function(e,t,r){if(r.get){let a=r.get;r.get=function(){let s=(0,lC.createCacheKey)(t,[]),o=this.getFromCache(s);if(o)return o;let l=a.call(this);return this.setCache(s,l,i),l}}return r}}n(uC,"CachedGetter");fo.CachedGetter=uC});var jf=u(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.ClearsCache=void 0;function cC(i,e){return function(t,r,a){let s=a.value;return a.value=async function(...o){let l=await s.apply(this,o),d=e===void 0?o.slice():o.slice(0,e);return this.removeFromCache([i,...d],!0),l},a}}n(cC,"ClearsCache");go.ClearsCache=cC});var xi=u(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.createCacheKey=ke.ClearsCache=ke.CachedGetter=ke.Cached=ke.Cacheable=void 0;var dC=Uf();Object.defineProperty(ke,"Cacheable",{enumerable:!0,get:n(function(){return dC.Cacheable},"get")});var hC=Bf();Object.defineProperty(ke,"Cached",{enumerable:!0,get:n(function(){return hC.Cached},"get")});var pC=Of();Object.defineProperty(ke,"CachedGetter",{enumerable:!0,get:n(function(){return pC.CachedGetter},"get")});var mC=jf();Object.defineProperty(ke,"ClearsCache",{enumerable:!0,get:n(function(){return mC.ClearsCache},"get")});var _C=bi();Object.defineProperty(ke,"createCacheKey",{enumerable:!0,get:n(function(){return _C.createCacheKey},"get")})});var ad=u(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.Listener=void 0;var nd=class{static{n(this,"Listener")}constructor(e,t,r,a=!1){this.owner=e,this.event=t,this.listener=r,this._internal=a}unbind(){this.owner.removeListener(this)}};bo.Listener=nd});var kf=u(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.EventEmitter=void 0;var yC=ad(),sd=class{static{n(this,"EventEmitter")}constructor(){this._eventListeners=new Map,this._internalEventListeners=new Map}on(e,t){return this._addListener(!1,e,t)}addListener(e,t){return this._addListener(!1,e,t)}removeListener(e,t){this._removeListener(!1,e,t)}registerEvent(){let e=n(t=>this.addListener(e,t),"eventBinder");return e}emit(e,...t){if(this._eventListeners.has(e))for(let r of this._eventListeners.get(e))r(...t);if(this._internalEventListeners.has(e))for(let r of this._internalEventListeners.get(e))r(...t)}registerInternalEvent(){let e=n(t=>this.addInternalListener(e,t),"eventBinder");return e}addInternalListener(e,t){return this._addListener(!0,e,t)}removeInternalListener(e,t){this._removeListener(!0,e,t)}_addListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;return a.has(t)?a.get(t).push(r):a.set(t,[r]),new yC.Listener(this,t,r,e)}_removeListener(e,t,r){let a=e?this._eventListeners:this._internalEventListeners;if(!t)a.clear();else if(typeof t=="object"){let s=t;this._removeListener(s._internal,s.event,s.listener)}else{let s=t;if(a.has(s))if(r){let o=a.get(s),l=0;for(;(l=o.indexOf(r))!==-1;)o.splice(l,1)}else a.delete(s)}}};xo.EventEmitter=sd});var od=u(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Listener=Rr.EventEmitter=void 0;var fC=kf();Object.defineProperty(Rr,"EventEmitter",{enumerable:!0,get:n(function(){return fC.EventEmitter},"get")});var gC=ad();Object.defineProperty(Rr,"Listener",{enumerable:!0,get:n(function(){return gC.Listener},"get")})});var wo=u(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.accessTokenIsExpired=Ur.getExpiryDateOfAccessToken=void 0;var ld=C(),bC=6e4;function Mf(i){return(0,ld.mapNullable)(i.expiresIn,e=>i.obtainmentTimestamp+e*1e3-bC)}n(Mf,"getExpiryMillis");function xC(i){return(0,ld.mapNullable)(Mf(i),e=>new Date(e))}n(xC,"getExpiryDateOfAccessToken");Ur.getExpiryDateOfAccessToken=xC;function wC(i){var e;return(e=(0,ld.mapNullable)(Mf(i),t=>Date.now()>t))!==null&&e!==void 0?e:!1}n(wC,"accessTokenIsExpired");Ur.accessTokenIsExpired=wC});var So=u(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.InvalidTokenError=void 0;var vC=m(),ud=class extends vC.CustomError{static{n(this,"InvalidTokenError")}constructor(e){super("Invalid token supplied",e)}};vo.InvalidTokenError=ud});var Co=u(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.InvalidTokenTypeError=void 0;var SC=m(),cd=class extends SC.CustomError{static{n(this,"InvalidTokenTypeError")}};Ho.InvalidTokenTypeError=cd});var Lf=u(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.createRevokeTokenQuery=lt.createRefreshTokenQuery=lt.createGetAppTokenQuery=lt.createExchangeCodeQuery=void 0;function HC(i,e,t,r){return{grant_type:"authorization_code",client_id:i,client_secret:e,code:t,redirect_uri:r}}n(HC,"createExchangeCodeQuery");lt.createExchangeCodeQuery=HC;function CC(i,e){return{grant_type:"client_credentials",client_id:i,client_secret:e}}n(CC,"createGetAppTokenQuery");lt.createGetAppTokenQuery=CC;function qC(i,e,t){return{grant_type:"refresh_token",client_id:i,client_secret:e,refresh_token:t}}n(qC,"createRefreshTokenQuery");lt.createRefreshTokenQuery=qC;function EC(i,e){return{client_id:i,token:e}}n(EC,"createRevokeTokenQuery");lt.createRevokeTokenQuery=EC});var hd=u(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.TokenInfo=void 0;var PC=(f(),b(y)),AC=C(),Yt=m(),dd=class extends Yt.DataObject{static{n(this,"TokenInfo")}constructor(e){super(e),this._obtainmentDate=new Date}get clientId(){return this[Yt.rawDataSymbol].client_id}get userId(){var e;return(e=this[Yt.rawDataSymbol].user_id)!==null&&e!==void 0?e:null}get userName(){var e;return(e=this[Yt.rawDataSymbol].login)!==null&&e!==void 0?e:null}get scopes(){return this[Yt.rawDataSymbol].scopes}get expiryDate(){return(0,AC.mapNullable)(this[Yt.rawDataSymbol].expires_in,e=>new Date(this._obtainmentDate.getTime()+e*1e3))}};wi.TokenInfo=dd;wi.TokenInfo=dd=PC.__decorate([(0,Yt.rtfm)("auth","TokenInfo","clientId")],dd)});var Si=u(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.loadAndCompareTokenInfo=X.compareScopeSets=X.compareScopes=X.getValidTokenFromProviderForIntent=X.getValidTokenFromProviderForUser=X.getTokenInfo=X.revokeToken=X.refreshUserToken=X.getAppToken=X.exchangeCode=void 0;var Br=Z(),vi=So(),DC=Co(),qo=Lf(),IC=hd();function pd(i){var e,t;return{accessToken:i.access_token,refreshToken:i.refresh_token||null,scope:(e=i.scope)!==null&&e!==void 0?e:[],expiresIn:(t=i.expires_in)!==null&&t!==void 0?t:null,obtainmentTimestamp:Date.now()}}n(pd,"createAccessTokenFromData");async function TC(i,e,t,r){return pd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,qo.createExchangeCodeQuery)(i,e,t,r)}))}n(TC,"exchangeCode");X.exchangeCode=TC;async function RC(i,e){return pd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,qo.createGetAppTokenQuery)(i,e)}))}n(RC,"getAppToken");X.getAppToken=RC;async function UC(i,e,t){return pd(await(0,Br.callTwitchApi)({type:"auth",url:"token",method:"POST",query:(0,qo.createRefreshTokenQuery)(i,e,t)}))}n(UC,"refreshUserToken");X.refreshUserToken=UC;async function BC(i,e){await(0,Br.callTwitchApi)({type:"auth",url:"revoke",method:"POST",query:(0,qo.createRevokeTokenQuery)(i,e)})}n(BC,"revokeToken");X.revokeToken=BC;async function Or(i,e){try{let t=await(0,Br.callTwitchApi)({type:"auth",url:"validate"},e,i);return new IC.TokenInfo(t)}catch(t){throw t instanceof Br.HttpStatusCodeError&&t.statusCode===401?new vi.InvalidTokenError({cause:t}):t}}n(Or,"getTokenInfo");X.getTokenInfo=Or;async function OC(i,e,t,r){let a=null,s=!1;try{let o=await i.getAccessTokenForUser(e,t);if(o){s=!0;let l=await Or(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof vi.InvalidTokenError?a=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForUser))try{let o=await i.refreshAccessTokenForUser(e),l=await Or(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof vi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(OC,"getValidTokenFromProviderForUser");X.getValidTokenFromProviderForUser=OC;async function jC(i,e,t,r){let a=null,s=!1;if(!i.getAccessTokenForIntent)throw new DC.InvalidTokenTypeError("This call requires an AuthProvider that supports intents.\nPlease use an auth provider that does, such as `RefreshingAuthProvider`.");try{let o=await i.getAccessTokenForIntent(e,t);if(o){s=!0;let l=await Or(o.accessToken);return{accessToken:o,tokenInfo:l}}}catch(o){o instanceof vi.InvalidTokenError?a=o:r?.error(`Retrieving an access token failed: ${o.message}`)}if(s&&(r?.warn("No valid token available; trying to refresh"),i.refreshAccessTokenForIntent))try{let o=await i.refreshAccessTokenForIntent(e),l=await Or(o.accessToken);return{accessToken:o,tokenInfo:l}}catch(o){o instanceof vi.InvalidTokenError?a=o:r?.error(`Refreshing the access token failed: ${o.message}`)}throw a??new Error("Could not retrieve a valid token")}n(jC,"getValidTokenFromProviderForIntent");X.getValidTokenFromProviderForIntent=jC;var kC=new Map([["channel_commercial",["channel:edit:commercial"]],["channel_editor",["channel:manage:broadcast"]],["channel_read",["channel:read:stream_key"]],["channel_subscriptions",["channel:read:subscriptions"]],["user_blocks_read",["user:read:blocked_users"]],["user_blocks_edit",["user:manage:blocked_users"]],["user_follows_edit",["user:edit:follows"]],["user_read",["user:read:email"]],["user_subscriptions",["user:read:subscriptions"]],["user:edit:broadcast",["channel:manage:broadcast","channel:manage:extensions"]]]);function Ff(i,e){if(e?.length){let t=new Set(i.flatMap(r=>{var a;return[r,...(a=kC.get(r))!==null&&a!==void 0?a:[]]}));if(e.every(r=>!t.has(r))){let r=e.join(", ");throw new Error(`This token does not have any of the requested scopes (${r}) and can not be upgraded.
|
|
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(
|
|
14
|
+
https://twurple.js.org/reference/auth/interfaces/AuthProvider.html`)}}}n(Ff,"compareScopes");X.compareScopes=Ff;function Nf(i,e){for(let t of e)Ff(i,t)}n(Nf,"compareScopeSets");X.compareScopeSets=Nf;async function MC(i,e,t,r,a){if(a?.length||!t){let s=await Or(e,i);if(!s.userId)throw new Error("Trying to use an app access token as a user access token");let o=r??s.scopes;return a&&Nf(o,a.filter(l=>!!l)),[o,s.userId]}return[r,t]}n(MC,"loadAndCompareTokenInfo");X.loadAndCompareTokenInfo=MC});var Po=u(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.TokenFetcher=void 0;var Qf=C(),md=class{static{n(this,"TokenFetcher")}constructor(e){this._newTokenScopeSets=[],this._newTokenPromise=null,this._queuedScopeSets=[],this._queueExecutor=null,this._queuePromise=null,this._executor=e}async fetch(...e){var t;let r=e.filter(l=>!!l);if(this._newTokenPromise){if(!r.length)return await this._newTokenPromise;if(this._queueExecutor?this._queuedScopeSets.push(...r):this._queuedScopeSets=[...r],!this._queuePromise){let{promise:l,resolve:d,reject:h}=(0,Qf.promiseWithResolvers)();this._queuePromise=l,this._queueExecutor=async()=>{var p;if(this._queuePromise){this._newTokenScopeSets=this._queuedScopeSets,this._queuedScopeSets=[],this._newTokenPromise=this._queuePromise,this._queuePromise=null,this._queueExecutor=null;try{d(await this._executor(this._newTokenScopeSets))}catch(x){h(x)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(p=this._queueExecutor)===null||p===void 0||p.call(this)}}}}return await this._queuePromise}this._newTokenScopeSets=[...r];let{promise:a,resolve:s,reject:o}=(0,Qf.promiseWithResolvers)();this._newTokenPromise=a;try{s(await this._executor(this._newTokenScopeSets))}catch(l){o(l)}finally{this._newTokenPromise=null,this._newTokenScopeSets=[],(t=this._queueExecutor)===null||t===void 0||t.call(this)}return await a}};Eo.TokenFetcher=md});var Wf=u(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.AppTokenAuthProvider=void 0;var Ao=(f(),b(y)),_d=C(),Gf=m(),LC=wo(),FC=Si(),NC=Po(),jr=class{static{n(this,"AppTokenAuthProvider")}constructor(e,t,r=[]){this._clientId=e,this._clientSecret=t,this._impliedScopes=r,this._fetcher=new NC.TokenFetcher(async a=>await this._fetch(a))}get clientId(){return this._clientId}get currentScopes(){return this._impliedScopes}async getAccessTokenForUser(e,...t){if(t.every(r=>{var a;return(a=r?.some(s=>this._impliedScopes.includes(s)))!==null&&a!==void 0?a:!0}))return{...await this.getAppAccessToken(),userId:(0,Gf.extractUserId)(e)};throw new Error("Can not get user access token for AppTokenAuthProvider")}getCurrentScopesForUser(){return this._impliedScopes}async getAnyAccessToken(){return await this._fetcher.fetch()}async getAppAccessToken(e=!1){return e&&(this._token=void 0),await this._fetcher.fetch()}async _fetch(e){if(e.length>0)for(let t of e)if(this._impliedScopes.length){if(t.every(r=>!this._impliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._impliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._token||(0,LC.accessTokenIsExpired)(this._token)?this._token=await(0,FC.getAppToken)(this._clientId,this._clientSecret):this._token}};Hi.AppTokenAuthProvider=jr;Ao.__decorate([(0,_d.Enumerable)(!1)],jr.prototype,"_clientSecret",void 0);Ao.__decorate([(0,_d.Enumerable)(!1)],jr.prototype,"_token",void 0);Ao.__decorate([(0,_d.Enumerable)(!1)],jr.prototype,"_fetcher",void 0);Hi.AppTokenAuthProvider=jr=Ao.__decorate([(0,Gf.rtfm)("auth","AppTokenAuthProvider","clientId")],jr)});var fd=u(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.CachedRefreshFailureError=void 0;var QC=m(),yd=class extends QC.CustomError{static{n(this,"CachedRefreshFailureError")}constructor(e){super(`The user context for the user ${e} has been disabled.
|
|
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}};
|
|
17
|
+
Use .addUser(), .addUserForToken() or .addUserForCode() for the same user context to re-enable the user with a new, valid token.`),this.userId=e}};Do.CachedRefreshFailureError=yd});var bd=u(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.IntermediateUserRemovalError=void 0;var GC=m(),gd=class extends GC.CustomError{static{n(this,"IntermediateUserRemovalError")}constructor(e){super(`User ${e} was removed while trying to fetch a token.
|
|
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}};Io.IntermediateUserRemovalError=gd});var wd=u(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.UnknownIntentError=void 0;var WC=m(),xd=class extends WC.CustomError{static{n(this,"UnknownIntentError")}constructor(e){super(`Unknown intent: ${e}`),this.intent=e}};To.UnknownIntentError=xd});var zf=u(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.RefreshingAuthProvider=void 0;var kr=(f(),b(y)),Ci=C(),VC=od(),Me=m(),vd=wo(),Vf=fd(),$C=bd(),Sd=So(),zC=Co(),KC=wd(),ut=Si(),$f=Po(),Ut=class extends VC.EventEmitter{static{n(this,"RefreshingAuthProvider")}constructor(e){var t;super(),this._userAccessTokens=new Map,this._userTokenFetchers=new Map,this._intentToUserId=new Map,this._userIdToIntents=new Map,this._cachedRefreshFailures=new Set,this.onRefresh=this.registerEvent(),this.onRefreshFailure=this.registerEvent(),this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._redirectUri=e.redirectUri,this._appImpliedScopes=(t=e.appImpliedScopes)!==null&&t!==void 0?t:[],this._appTokenFetcher=new $f.TokenFetcher(async r=>await this._fetchAppToken(r))}addUser(e,t,r){let a=(0,Me.extractUserId)(e);if(!t.refreshToken)throw new Error(`Trying to add user ${a} without refresh token`);this._cachedRefreshFailures.delete(a),this._userAccessTokens.set(a,{...t,userId:a}),this._userTokenFetchers.has(a)||this._userTokenFetchers.set(a,new $f.TokenFetcher(async s=>await this._fetchUserToken(a,s))),r&&this.addIntentsToUser(e,r)}async addUserForToken(e,t){let r=null;if(e.accessToken&&!(0,vd.accessTokenIsExpired)(e))try{let l=await(0,ut.getTokenInfo)(e.accessToken);r=[e,l]}catch(l){if(!(l instanceof Sd.InvalidTokenError))throw l}if(!r){if(!e.refreshToken)throw new Sd.InvalidTokenError;let l=await(0,ut.refreshUserToken)(this._clientId,this._clientSecret,e.refreshToken),d=await(0,ut.getTokenInfo)(l.accessToken);this.emit(this.onRefresh,d.userId,l),r=[l,d]}let[a,s]=r;if(!s.userId)throw new zC.InvalidTokenTypeError("Could not determine a user ID for your token; you might be trying to disguise an app token as a user token.");let o=a.scope?a:{...a,scope:s.scopes};return this.addUser(s.userId,o,t),s.userId}async addUserForCode(e,t){if(!this._redirectUri)throw new Error("This method requires you to pass a `redirectUri` as a configuration property");let r=await(0,ut.exchangeCode)(this._clientId,this._clientSecret,e,this._redirectUri);return await this.addUserForToken(r,t)}hasUser(e){return this._userTokenFetchers.has((0,Me.extractUserId)(e))}removeUser(e){let t=(0,Me.extractUserId)(e);if(this._userIdToIntents.has(t)){let r=this._userIdToIntents.get(t);for(let a of r)this._intentToUserId.delete(a);this._userIdToIntents.delete(t)}this._userAccessTokens.delete(t),this._userTokenFetchers.delete(t),this._cachedRefreshFailures.delete(t)}addIntentsToUser(e,t){let r=(0,Me.extractUserId)(e);if(!this._userAccessTokens.has(r))throw new Error("Trying to add intents to a user that was not added to this provider");for(let a of t)this._intentToUserId.has(a)&&this._userIdToIntents.get(this._intentToUserId.get(a)).delete(a),this._intentToUserId.set(a,r),this._userIdToIntents.has(r)?this._userIdToIntents.get(r).add(a):this._userIdToIntents.set(r,new Set([a]))}getIntentsForUser(e){let t=(0,Me.extractUserId)(e);return this._userIdToIntents.has(t)?Array.from(this._userIdToIntents.get(t)):[]}removeIntents(e){var t;for(let r of e)if(this._intentToUserId.has(r)){let a=this._intentToUserId.get(r);(t=this._userIdToIntents.get(a))===null||t===void 0||t.delete(r),this._intentToUserId.delete(r)}}async refreshAccessTokenForUser(e){let t=(0,Me.extractUserId)(e);if(this._cachedRefreshFailures.has(t))throw new Vf.CachedRefreshFailureError(t);let r=this._userAccessTokens.get(t);if(!r)throw new Error("Trying to refresh token for user that was not added to the provider");let a=await this._refreshUserTokenWithCallback(t,r.refreshToken);return this._checkIntermediateUserRemoval(t),this._userAccessTokens.set(t,{...a,userId:t}),this.emit(this.onRefresh,t,a),{...a,userId:t}}async refreshAccessTokenForIntent(e){if(!this._intentToUserId.has(e))throw new KC.UnknownIntentError(e);let t=this._intentToUserId.get(e);return await this.refreshAccessTokenForUser(t)}get clientId(){return this._clientId}getCurrentScopesForUser(e){var t;let r=this._userAccessTokens.get((0,Me.extractUserId)(e));if(!r)throw new Error("Trying to get scopes for user that was not added to the provider");return(t=r.scope)!==null&&t!==void 0?t:[]}async getAccessTokenForUser(e,...t){let r=(0,Me.extractUserId)(e),a=this._userTokenFetchers.get(r);if(!a)return null;if(this._cachedRefreshFailures.has(r))throw new Vf.CachedRefreshFailureError(r);return(0,ut.compareScopeSets)(this.getCurrentScopesForUser(r),t.filter(Boolean)),await a.fetch(...t)}async getAccessTokenForIntent(e,...t){if(!this._intentToUserId.has(e))return null;let r=this._intentToUserId.get(e),a=await this.getAccessTokenForUser(r,...t);if(!a)throw new Me.HellFreezesOverError(`Found intent ${e} corresponding to user ID ${r} but no token was found`);return{...a,userId:r}}async getAnyAccessToken(e){if(e){let t=(0,Me.extractUserId)(e);if(this._userAccessTokens.has(t)){let r=await this.getAccessTokenForUser(t);if(!r)throw new Me.HellFreezesOverError(`Token for user ID ${t} exists but nothing was returned by getAccessTokenForUser`);return{...r,userId:t}}}return await this.getAppAccessToken()}async getAppAccessToken(e=!1){return e&&(this._appAccessToken=void 0),await this._appTokenFetcher.fetch(...this._appImpliedScopes.map(t=>[t]))}_checkIntermediateUserRemoval(e){if(!this._userTokenFetchers.has(e))throw this._cachedRefreshFailures.delete(e),new $C.IntermediateUserRemovalError(e)}async _fetchUserToken(e,t){let r=this._userAccessTokens.get(e);if(!r)throw new Error("Trying to get token for user that was not added to the provider");if(r.accessToken&&!(0,vd.accessTokenIsExpired)(r))try{if(r.scope)return(0,ut.compareScopeSets)(r.scope,t),r;let[s=[]]=await(0,ut.loadAndCompareTokenInfo)(this._clientId,r.accessToken,e,r.scope,t),o={...r,scope:s};return this._checkIntermediateUserRemoval(e),this._userAccessTokens.set(e,o),o}catch(s){if(!(s instanceof Sd.InvalidTokenError))throw s}this._checkIntermediateUserRemoval(e);let a=await this.refreshAccessTokenForUser(e);return(0,ut.compareScopeSets)(a.scope,t),a}async _refreshUserTokenWithCallback(e,t){try{return await(0,ut.refreshUserToken)(this.clientId,this._clientSecret,t)}catch(r){throw this._cachedRefreshFailures.add(e),this.emit(this.onRefreshFailure,e,r),r}}async _fetchAppToken(e){if(e.length>0)for(let t of e)if(this._appImpliedScopes.length){if(t.every(r=>!this._appImpliedScopes.includes(r)))throw new Error(`One of the scopes ${t.join(", ")} requested but only the scope ${this._appImpliedScopes.join(", ")} is implied`)}else throw new Error(`One of the scopes ${t.join(", ")} requested but the client credentials flow does not support scopes`);return!this._appAccessToken||(0,vd.accessTokenIsExpired)(this._appAccessToken)?await this._refreshAppToken():this._appAccessToken}async _refreshAppToken(){return this._appAccessToken=await(0,ut.getAppToken)(this._clientId,this._clientSecret)}};qi.RefreshingAuthProvider=Ut;kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_clientSecret",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_userAccessTokens",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_userTokenFetchers",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_appAccessToken",void 0);kr.__decorate([(0,Ci.Enumerable)(!1)],Ut.prototype,"_appTokenFetcher",void 0);qi.RefreshingAuthProvider=Ut=kr.__decorate([(0,Me.rtfm)("auth","RefreshingAuthProvider","clientId")],Ut)});var Jf=u(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.StaticAuthProvider=void 0;var Hd=(f(),b(y)),Kf=C(),JC=m(),ZC=Si(),Ei=class{static{n(this,"StaticAuthProvider")}constructor(e,t,r){this._clientId=e||"",this._accessToken=typeof t=="string"?{accessToken:t,refreshToken:null,scope:r??[],expiresIn:null,obtainmentTimestamp:Date.now()}:t,this._scopes=r}get clientId(){return this._clientId}async getAccessTokenForUser(e,...t){return await this._getAccessToken(t)}async getAccessTokenForIntent(e,...t){return await this._getAccessToken(t)}async getAnyAccessToken(){return await this._getAccessToken()}getCurrentScopesForUser(){var e;return(e=this._scopes)!==null&&e!==void 0?e:[]}async _getAccessToken(e){let[t,r]=await(0,ZC.loadAndCompareTokenInfo)(this._clientId,this._accessToken.accessToken,this._userId,this._scopes,e);return this._scopes=t,this._userId=r,{...this._accessToken,userId:r}}};Pi.StaticAuthProvider=Ei;Hd.__decorate([(0,Kf.Enumerable)(!1)],Ei.prototype,"_clientId",void 0);Hd.__decorate([(0,Kf.Enumerable)(!1)],Ei.prototype,"_accessToken",void 0);Pi.StaticAuthProvider=Ei=Hd.__decorate([(0,JC.rtfm)("auth","StaticAuthProvider","clientId")],Ei)});var Cd=u(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.UnknownIntentError=T.InvalidTokenTypeError=T.InvalidTokenError=T.IntermediateUserRemovalError=T.CachedRefreshFailureError=T.StaticAuthProvider=T.RefreshingAuthProvider=T.AppTokenAuthProvider=T.TokenInfo=T.TokenFetcher=T.revokeToken=T.refreshUserToken=T.getValidTokenFromProviderForIntent=T.getValidTokenFromProviderForUser=T.getTokenInfo=T.getAppToken=T.exchangeCode=T.getExpiryDateOfAccessToken=T.accessTokenIsExpired=void 0;var Zf=wo();Object.defineProperty(T,"accessTokenIsExpired",{enumerable:!0,get:n(function(){return Zf.accessTokenIsExpired},"get")});Object.defineProperty(T,"getExpiryDateOfAccessToken",{enumerable:!0,get:n(function(){return Zf.getExpiryDateOfAccessToken},"get")});var er=Si();Object.defineProperty(T,"exchangeCode",{enumerable:!0,get:n(function(){return er.exchangeCode},"get")});Object.defineProperty(T,"getAppToken",{enumerable:!0,get:n(function(){return er.getAppToken},"get")});Object.defineProperty(T,"getTokenInfo",{enumerable:!0,get:n(function(){return er.getTokenInfo},"get")});Object.defineProperty(T,"getValidTokenFromProviderForUser",{enumerable:!0,get:n(function(){return er.getValidTokenFromProviderForUser},"get")});Object.defineProperty(T,"getValidTokenFromProviderForIntent",{enumerable:!0,get:n(function(){return er.getValidTokenFromProviderForIntent},"get")});Object.defineProperty(T,"refreshUserToken",{enumerable:!0,get:n(function(){return er.refreshUserToken},"get")});Object.defineProperty(T,"revokeToken",{enumerable:!0,get:n(function(){return er.revokeToken},"get")});var XC=Po();Object.defineProperty(T,"TokenFetcher",{enumerable:!0,get:n(function(){return XC.TokenFetcher},"get")});var YC=hd();Object.defineProperty(T,"TokenInfo",{enumerable:!0,get:n(function(){return YC.TokenInfo},"get")});var eq=Wf();Object.defineProperty(T,"AppTokenAuthProvider",{enumerable:!0,get:n(function(){return eq.AppTokenAuthProvider},"get")});var tq=zf();Object.defineProperty(T,"RefreshingAuthProvider",{enumerable:!0,get:n(function(){return tq.RefreshingAuthProvider},"get")});var rq=Jf();Object.defineProperty(T,"StaticAuthProvider",{enumerable:!0,get:n(function(){return rq.StaticAuthProvider},"get")});var iq=fd();Object.defineProperty(T,"CachedRefreshFailureError",{enumerable:!0,get:n(function(){return iq.CachedRefreshFailureError},"get")});var nq=bd();Object.defineProperty(T,"IntermediateUserRemovalError",{enumerable:!0,get:n(function(){return nq.IntermediateUserRemovalError},"get")});var aq=So();Object.defineProperty(T,"InvalidTokenError",{enumerable:!0,get:n(function(){return aq.InvalidTokenError},"get")});var sq=Co();Object.defineProperty(T,"InvalidTokenTypeError",{enumerable:!0,get:n(function(){return sq.InvalidTokenTypeError},"get")});var oq=wd();Object.defineProperty(T,"UnknownIntentError",{enumerable:!0,get:n(function(){return oq.UnknownIntentError},"get")})});var Yf=u((Uj,Xf)=>{function Le(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}n(Le,"RetryOperation");Xf.exports=Le;Le.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Le.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Le.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};Le.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Le.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};Le.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};Le.prototype.start=Le.prototype.try;Le.prototype.errors=function(){return this._errors};Le.prototype.attempts=function(){return this._attempts};Le.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var a=this._errors[r],s=a.message,o=(i[s]||0)+1;i[s]=o,o>=t&&(e=a,t=o)}return e}});var eg=u(tr=>{var lq=Yf();tr.operation=function(i){var e=tr.timeouts(i);return new lq(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};tr.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<e.retries;a++)r.push(this.createTimeout(a,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(a,e)),r.sort(function(s,o){return s-o}),r};tr.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};tr.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var a=0;a<t.length;a++){var s=t[a],o=i[s];i[s]=n(function(d){var h=tr.operation(e),p=Array.prototype.slice.call(arguments,1),x=p.pop();p.push(function(q){h.retry(q)||(q&&(arguments[0]=h.mainError()),x.apply(this,arguments))}),h.attempt(function(){d.apply(i,p)})},"retryWrapper").bind(i,o),i[s].options=e}}});var rg=u((kj,tg)=>{tg.exports=eg()});var ig=u(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.createBitsLeaderboardQuery=void 0;function uq(i={}){let{count:e=10,period:t="all",startDate:r,contextUserId:a}=i;return{count:e.toString(),period:t,started_at:r?.toISOString(),user_id:a}}n(uq,"createBitsLeaderboardQuery");Ro.createBitsLeaderboardQuery=uq});var Q=u(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BaseApi=void 0;var cq=(f(),b(y)),dq=C(),Uo=class{static{n(this,"BaseApi")}constructor(e){this._client=e}_getUserContextIdWithDefault(e){var t;return(t=this._client._getUserIdFromRequestContext(e))!==null&&t!==void 0?t:e}};Bo.BaseApi=Uo;cq.__decorate([(0,dq.Enumerable)(!1)],Uo.prototype,"_client",void 0)});var qd=u(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.HelixBitsLeaderboardEntry=void 0;var ng=(f(),b(y)),hq=C(),gt=m(),Oo=class extends gt.DataObject{static{n(this,"HelixBitsLeaderboardEntry")}constructor(e,t){super(e),this._client=t}get userId(){return this[gt.rawDataSymbol].user_id}get userName(){return this[gt.rawDataSymbol].user_login}get userDisplayName(){return this[gt.rawDataSymbol].user_name}get rank(){return this[gt.rawDataSymbol].rank}get amount(){return this[gt.rawDataSymbol].score}async getUser(){return(0,gt.checkRelationAssertion)(await this._client.users.getUserById(this[gt.rawDataSymbol].user_id))}};Ai.HelixBitsLeaderboardEntry=Oo;ng.__decorate([(0,hq.Enumerable)(!1)],Oo.prototype,"_client",void 0);Ai.HelixBitsLeaderboardEntry=Oo=ng.__decorate([(0,gt.rtfm)("api","HelixBitsLeaderboardEntry","userId")],Oo)});var Pd=u(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.HelixBitsLeaderboard=void 0;var Ed=(f(),b(y)),ag=xi(),pq=C(),jo=m(),mq=qd(),Di=class extends jo.DataObject{static{n(this,"HelixBitsLeaderboard")}constructor(e,t){super(e),this._client=t}get entries(){return this[jo.rawDataSymbol].data.map(e=>new mq.HelixBitsLeaderboardEntry(e,this._client))}get totalCount(){return this[jo.rawDataSymbol].total}};Ii.HelixBitsLeaderboard=Di;Ed.__decorate([(0,pq.Enumerable)(!1)],Di.prototype,"_client",void 0);Ed.__decorate([(0,ag.CachedGetter)()],Di.prototype,"entries",null);Ii.HelixBitsLeaderboard=Di=Ed.__decorate([ag.Cacheable,(0,jo.rtfm)("api","HelixBitsLeaderboard")],Di)});var Dd=u(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.HelixCheermoteList=void 0;var _q=(f(),b(y)),yq=C(),Ti=m(),Ad=class extends Ti.DataObject{static{n(this,"HelixCheermoteList")}constructor(e){super((0,yq.indexBy)(e,t=>t.prefix.toLowerCase()))}getCheermoteDisplayInfo(e,t,r){e=e.toLowerCase();let{background:a,state:s,scale:o}=r,{tiers:l}=this[Ti.rawDataSymbol][e],d=l.sort((h,p)=>p.min_bits-h.min_bits).find(h=>h.min_bits<=t);if(!d)throw new Ti.HellFreezesOverError(`Cheermote "${e}" does not have an applicable tier for ${t} bits`);return{url:d.images[a][s][o],color:d.color}}getPossibleNames(){return Object.keys(this[Ti.rawDataSymbol])}};Ri.HelixCheermoteList=Ad;Ri.HelixCheermoteList=Ad=_q.__decorate([(0,Ti.rtfm)("api","HelixCheermoteList")],Ad)});var Rd=u(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.HelixBitsApi=void 0;var fq=(f(),b(y)),sg=C(),gq=Z(),Id=m(),bq=ig(),xq=Q(),wq=Pd(),vq=Dd(),Td=class extends xq.BaseApi{static{n(this,"HelixBitsApi")}async getLeaderboard(e,t={}){let r=await this._client.callApi({type:"helix",url:"bits/leaderboard",userId:(0,Id.extractUserId)(e),scopes:["bits:read"],query:(0,bq.createBitsLeaderboardQuery)(t)});return new wq.HelixBitsLeaderboard(r,this._client)}async getCheermotes(e){let t=await this._client.callApi({type:"helix",url:"bits/cheermotes",userId:(0,sg.mapOptional)(e,Id.extractUserId),query:(0,sg.mapOptional)(e,gq.createBroadcasterQuery)});return new vq.HelixCheermoteList(t.data)}};Ui.HelixBitsApi=Td;Ui.HelixBitsApi=Td=fq.__decorate([(0,Id.rtfm)("api","HelixBitsApi")],Td)});var lg=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createFollowedChannelQuery=Fe.createChannelFollowerQuery=Fe.createChannelVipUpdateQuery=Fe.createChannelCommercialBody=Fe.createChannelUpdateBody=void 0;var og=C(),rr=m();function Sq(i){var e;return{game_id:i.gameId,broadcaster_language:i.language,title:i.title,delay:(e=i.delay)===null||e===void 0?void 0:e.toString(),tags:i.tags,content_classification_labels:i.contentClassificationLabels,is_branded_content:i.isBrandedContent}}n(Sq,"createChannelUpdateBody");Fe.createChannelUpdateBody=Sq;function Hq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),length:e}}n(Hq,"createChannelCommercialBody");Fe.createChannelCommercialBody=Hq;function Cq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),user_id:(0,rr.extractUserId)(e)}}n(Cq,"createChannelVipUpdateQuery");Fe.createChannelVipUpdateQuery=Cq;function qq(i,e){return{broadcaster_id:(0,rr.extractUserId)(i),user_id:(0,og.mapOptional)(e,rr.extractUserId)}}n(qq,"createChannelFollowerQuery");Fe.createChannelFollowerQuery=qq;function Eq(i,e){return{broadcaster_id:(0,og.mapOptional)(e,rr.extractUserId),user_id:(0,rr.extractUserId)(i)}}n(Eq,"createFollowedChannelQuery");Fe.createFollowedChannelQuery=Eq});var Ue=u(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.createChannelUsersCheckQuery=Ne.createGetByIdsQuery=Ne.createModeratorActionQuery=Ne.createUserQuery=Ne.createSingleKeyQuery=void 0;var ko=m();function Pq(i,e){return{[i]:e}}n(Pq,"createSingleKeyQuery");Ne.createSingleKeyQuery=Pq;function Aq(i){return{user_id:(0,ko.extractUserId)(i)}}n(Aq,"createUserQuery");Ne.createUserQuery=Aq;function Dq(i,e){return{broadcaster_id:i,moderator_id:e}}n(Dq,"createModeratorActionQuery");Ne.createModeratorActionQuery=Dq;function Iq(i,e){return{broadcaster_id:(0,ko.extractUserId)(i),id:e}}n(Iq,"createGetByIdsQuery");Ne.createGetByIdsQuery=Iq;function Tq(i,e){return{broadcaster_id:(0,ko.extractUserId)(i),user_id:e.map(ko.extractUserId)}}n(Tq,"createChannelUsersCheckQuery");Ne.createChannelUsersCheckQuery=Tq});var Lo=u(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.HelixUserRelation=void 0;var ug=(f(),b(y)),Rq=C(),ir=m(),Mo=class extends ir.DataObject{static{n(this,"HelixUserRelation")}constructor(e,t){super(e),this._client=t}get id(){return this[ir.rawDataSymbol].user_id}get name(){return this[ir.rawDataSymbol].user_login}get displayName(){return this[ir.rawDataSymbol].user_name}async getUser(){return(0,ir.checkRelationAssertion)(await this._client.users.getUserById(this[ir.rawDataSymbol].user_id))}};Bi.HelixUserRelation=Mo;ug.__decorate([(0,Rq.Enumerable)(!1)],Mo.prototype,"_client",void 0);Bi.HelixUserRelation=Mo=ug.__decorate([(0,ir.rtfm)("api","HelixUserRelation","id")],Mo)});var Bt=u(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.HelixRequestBatcher=void 0;var Uq=(f(),b(y)),Ud=C(),Fo=class{static{n(this,"HelixRequestBatcher")}constructor(e,t,r,a,s,o=100){this._callOptions=e,this._queryParamName=t,this._matchKey=r,this._mapper=s,this._limitPerRequest=o,this._requestedIds=[],this._requestResolversById=new Map,this._waitTimer=null,this._client=a,this._delay=a._batchDelay}async request(e){let{promise:t,resolve:r,reject:a}=(0,Ud.promiseWithResolvers)();return this._requestedIds.includes(e)||this._requestedIds.push(e),this._requestResolversById.has(e)?this._requestResolversById.get(e).push({resolve:r,reject:a}):this._requestResolversById.set(e,[{resolve:r,reject:a}]),this._waitTimer&&(clearTimeout(this._waitTimer),this._waitTimer=null),this._requestedIds.length>=this._limitPerRequest?this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest)):this._waitTimer=setTimeout(()=>{this._handleBatch(this._requestedIds.splice(0,this._limitPerRequest))},this._delay),await t}async _handleBatch(e){var t;try{let{data:r}=await this._doRequest(e),a=(0,Ud.indexBy)(r,this._matchKey);for(let s of e){for(let o of(t=this._requestResolversById.get(s))!==null&&t!==void 0?t:[])Object.prototype.hasOwnProperty.call(a,s)?o.resolve(this._mapper(a[s])):o.resolve(null);this._requestResolversById.delete(s)}}catch{await Promise.all(e.map(async a=>{var s,o;try{let l=await this._doRequest([a]);for(let d of(s=this._requestResolversById.get(a))!==null&&s!==void 0?s:[])d.resolve(l.data.length?this._mapper(l.data[0]):null)}catch(l){for(let d of(o=this._requestResolversById.get(a))!==null&&o!==void 0?o:[])d.reject(l)}this._requestResolversById.delete(a)}))}}async _doRequest(e){return await this._client.callApi({type:"helix",...this._callOptions,query:{...this._callOptions.query,[this._queryParamName]:e}})}};No.HelixRequestBatcher=Fo;Uq.__decorate([(0,Ud.Enumerable)(!1)],Fo.prototype,"_client",void 0)});var ae=u(Oi=>{"use strict";var Bd;Object.defineProperty(Oi,"__esModule",{value:!0});Oi.HelixPaginatedRequest=void 0;var cg=(f(),b(y)),Bq=C(),Oq=m();Object.prototype.hasOwnProperty.call(Symbol,"asyncIterator")||(Symbol.asyncIterator=(Bd=Symbol.asyncIterator)!==null&&Bd!==void 0?Bd:Symbol.for("Symbol.asyncIterator"));var Qo=class{static{n(this,"HelixPaginatedRequest")}constructor(e,t,r,a=100){this._callOptions=e,this._mapper=r,this._limitPerPage=a,this._isFinished=!1,this._client=t}get current(){var e;return(e=this._currentData)===null||e===void 0?void 0:e.data}async getNext(){var e;if(this._isFinished)return[];let t=await this._fetchData();return!((e=t.data)===null||e===void 0)&&e.length?this._processResult(t):(this._isFinished=!0,[])}async getAll(){this.reset();let e=[];do{let t=await this.getNext();if(!t.length)break;e.push(...t)}while(this._currentCursor);return this.reset(),e}get currentCursor(){return this._currentCursor}reset(){this._currentCursor=void 0,this._isFinished=!1,this._currentData=void 0}async*[Symbol.asyncIterator](){for(this.reset();;){let e=await this.getNext();if(!e.length)break;yield*e[Symbol.iterator]()}}async _fetchData(e={}){return await this._client.callApi({type:"helix",...this._callOptions,...e,query:{...this._callOptions.query,after:this._currentCursor,first:this._limitPerPage.toString(),...e.query}})}_processResult(e){var t;return this._currentCursor=typeof e.pagination=="string"?e.pagination:(t=e.pagination)===null||t===void 0?void 0:t.cursor,this._currentCursor===void 0&&(this._isFinished=!0),this._currentData=e,e.data.reduce((r,a)=>{let s=this._mapper(a);return Array.isArray(s)?[...r,...s]:[...r,s]},[])}};Oi.HelixPaginatedRequest=Qo;cg.__decorate([(0,Bq.Enumerable)(!1)],Qo.prototype,"_client",void 0);Oi.HelixPaginatedRequest=Qo=cg.__decorate([(0,Oq.rtfm)("api","HelixPaginatedRequest")],Qo)});var Mr=u(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.HelixPaginatedRequestWithTotal=void 0;var jq=(f(),b(y)),kq=m(),Mq=ae(),Od=class extends Mq.HelixPaginatedRequest{static{n(this,"HelixPaginatedRequestWithTotal")}async getTotalCount(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total}};ji.HelixPaginatedRequestWithTotal=Od;ji.HelixPaginatedRequestWithTotal=Od=jq.__decorate([(0,kq.rtfm)("api","HelixPaginatedRequestWithTotal")],Od)});var ce=u(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.createPaginatedResultWithTotal=Lr.createPaginatedResult=void 0;function Lq(i,e,t){var r;let a;return{get data(){var s,o;return a??(a=(o=(s=i.data)===null||s===void 0?void 0:s.map(l=>new e(l,t)))!==null&&o!==void 0?o:[])},cursor:typeof i.pagination=="string"?i.pagination:(r=i.pagination)===null||r===void 0?void 0:r.cursor}}n(Lq,"createPaginatedResult");Lr.createPaginatedResult=Lq;function Fq(i,e,t){let r;return{get data(){var a,s;return r??(r=(s=(a=i.data)===null||a===void 0?void 0:a.map(o=>new e(o,t)))!==null&&s!==void 0?s:[])},cursor:i.pagination.cursor,total:i.total}}n(Fq,"createPaginatedResultWithTotal");Lr.createPaginatedResultWithTotal=Fq});var se=u(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.createPaginationQuery=void 0;function Nq({after:i,before:e,limit:t}={}){return{after:i,before:e,first:t?.toString()}}n(Nq,"createPaginationQuery");Go.createPaginationQuery=Nq});var jd=u(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.HelixChannel=void 0;var dg=(f(),b(y)),Qq=C(),pe=m(),Wo=class extends pe.DataObject{static{n(this,"HelixChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[pe.rawDataSymbol].broadcaster_id}get name(){return this[pe.rawDataSymbol].broadcaster_login}get displayName(){return this[pe.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,pe.checkRelationAssertion)(await this._client.users.getUserById(this[pe.rawDataSymbol].broadcaster_id))}get language(){return this[pe.rawDataSymbol].broadcaster_language}get gameId(){return this[pe.rawDataSymbol].game_id}get gameName(){return this[pe.rawDataSymbol].game_name}async getGame(){return this[pe.rawDataSymbol].game_id?(0,pe.checkRelationAssertion)(await this._client.games.getGameById(this[pe.rawDataSymbol].game_id)):null}get title(){return this[pe.rawDataSymbol].title}get delay(){return this[pe.rawDataSymbol].delay}get tags(){return this[pe.rawDataSymbol].tags}get contentClassificationLabels(){return this[pe.rawDataSymbol].content_classification_labels}get isBrandedContent(){return this[pe.rawDataSymbol].is_branded_content}};ki.HelixChannel=Wo;dg.__decorate([(0,Qq.Enumerable)(!1)],Wo.prototype,"_client",void 0);ki.HelixChannel=Wo=dg.__decorate([(0,pe.rtfm)("api","HelixChannel","id")],Wo)});var kd=u(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.HelixChannelEditor=void 0;var hg=(f(),b(y)),Gq=C(),nr=m(),Vo=class extends nr.DataObject{static{n(this,"HelixChannelEditor")}constructor(e,t){super(e),this._client=t}get userId(){return this[nr.rawDataSymbol].user_id}get userDisplayName(){return this[nr.rawDataSymbol].user_name}async getUser(){return(0,nr.checkRelationAssertion)(await this._client.users.getUserById(this[nr.rawDataSymbol].user_id))}get creationDate(){return new Date(this[nr.rawDataSymbol].created_at)}};Mi.HelixChannelEditor=Vo;hg.__decorate([(0,Gq.Enumerable)(!1)],Vo.prototype,"_client",void 0);Mi.HelixChannelEditor=Vo=hg.__decorate([(0,nr.rtfm)("api","HelixChannelEditor","userId")],Vo)});var Md=u(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.HelixChannelFollower=void 0;var pg=(f(),b(y)),Wq=C(),Ot=m(),$o=class extends Ot.DataObject{static{n(this,"HelixChannelFollower")}constructor(e,t){super(e),this._client=t}get userId(){return this[Ot.rawDataSymbol].user_id}get userName(){return this[Ot.rawDataSymbol].user_login}get userDisplayName(){return this[Ot.rawDataSymbol].user_name}async getUser(){return(0,Ot.checkRelationAssertion)(await this._client.users.getUserById(this[Ot.rawDataSymbol].user_id))}get followDate(){return new Date(this[Ot.rawDataSymbol].followed_at)}};Li.HelixChannelFollower=$o;pg.__decorate([(0,Wq.Enumerable)(!1)],$o.prototype,"_client",void 0);Li.HelixChannelFollower=$o=pg.__decorate([(0,Ot.rtfm)("api","HelixChannelFollower","userId")],$o)});var Ld=u(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.HelixFollowedChannel=void 0;var mg=(f(),b(y)),Vq=C(),jt=m(),zo=class extends jt.DataObject{static{n(this,"HelixFollowedChannel")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[jt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[jt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[jt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,jt.checkRelationAssertion)(await this._client.users.getUserById(this[jt.rawDataSymbol].broadcaster_id))}get followDate(){return new Date(this[jt.rawDataSymbol].followed_at)}};Fi.HelixFollowedChannel=zo;mg.__decorate([(0,Vq.Enumerable)(!1)],zo.prototype,"_client",void 0);Fi.HelixFollowedChannel=zo=mg.__decorate([(0,jt.rtfm)("api","HelixFollowedChannel","broadcasterId")],zo)});var Nd=u(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.HelixAdSchedule=void 0;var $q=(f(),b(y)),Je=m(),Fd=class extends Je.DataObject{static{n(this,"HelixAdSchedule")}get snoozeCount(){return this[Je.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return this[Je.rawDataSymbol].snooze_refresh_at?new Date(this[Je.rawDataSymbol].snooze_refresh_at*1e3):null}get nextAdDate(){return this[Je.rawDataSymbol].next_ad_at?new Date(this[Je.rawDataSymbol].next_ad_at*1e3):null}get duration(){return this[Je.rawDataSymbol].duration}get lastAdDate(){return this[Je.rawDataSymbol].last_ad_at?new Date(this[Je.rawDataSymbol].last_ad_at*1e3):null}get prerollFreeTime(){return this[Je.rawDataSymbol].preroll_free_time}};Ni.HelixAdSchedule=Fd;Ni.HelixAdSchedule=Fd=$q.__decorate([(0,Je.rtfm)("api","HelixAdSchedule")],Fd)});var _g=u(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.HelixSnoozeNextAdResult=void 0;var zq=(f(),b(y)),Qi=m(),Qd=class extends Qi.DataObject{static{n(this,"HelixSnoozeNextAdResult")}get snoozeCount(){return this[Qi.rawDataSymbol].snooze_count}get snoozeRefreshDate(){return new Date(this[Qi.rawDataSymbol].snooze_refresh_at*1e3)}get nextAdDate(){return new Date(this[Qi.rawDataSymbol].next_ad_at*1e3)}};Gi.HelixSnoozeNextAdResult=Qd;Gi.HelixSnoozeNextAdResult=Qd=zq.__decorate([(0,Qi.rtfm)("api","HelixSnoozeNextAdResult")],Qd)});var $d=u(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.HelixChannelApi=void 0;var xg=(f(),b(y)),wg=C(),ar=Z(),oe=m(),bt=lg(),yg=Ue(),Gd=Lo(),Kq=Bt(),Jq=ae(),fg=Mr(),Wd=ce(),Ko=se(),Zq=Q(),Vd=jd(),Xq=kd(),gg=Md(),bg=Ld(),Yq=Nd(),eE=_g(),Jo=class extends Zq.BaseApi{static{n(this,"HelixChannelApi")}constructor(){super(...arguments),this._getChannelByIdBatcher=new Kq.HelixRequestBatcher({url:"channels"},"broadcaster_id","broadcaster_id",this._client,e=>new Vd.HelixChannel(e,this._client))}async getChannelInfoById(e){let t=(0,oe.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"channels",userId:t,query:(0,ar.createBroadcasterQuery)(t)});return(0,wg.mapNullable)(r.data[0],a=>new Vd.HelixChannel(a,this._client))}async getChannelInfoByIdBatched(e){return await this._getChannelByIdBatcher.request((0,oe.extractUserId)(e))}async getChannelInfoByIds(e){let t=e.map(oe.extractUserId);return(await this._client.callApi({type:"helix",url:"channels",query:(0,yg.createSingleKeyQuery)("broadcaster_id",t)})).data.map(a=>new Vd.HelixChannel(a,this._client))}async updateChannelInfo(e,t){await this._client.callApi({type:"helix",url:"channels",method:"PATCH",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:broadcast"],query:(0,ar.createBroadcasterQuery)(e),jsonBody:(0,bt.createChannelUpdateBody)(t)})}async startChannelCommercial(e,t){await this._client.callApi({type:"helix",url:"channels/commercial",method:"POST",userId:(0,oe.extractUserId)(e),scopes:["channel:edit:commercial"],jsonBody:(0,bt.createChannelCommercialBody)(e,t)})}async getChannelEditors(e){return(await this._client.callApi({type:"helix",url:"channels/editors",userId:(0,oe.extractUserId)(e),scopes:["channel:read:editors"],query:(0,ar.createBroadcasterQuery)(e)})).data.map(r=>new Xq.HelixChannelEditor(r,this._client))}async getVips(e,t){let r=await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,oe.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:{...(0,ar.createBroadcasterQuery)(e),...(0,Ko.createPaginationQuery)(t)}});return(0,Wd.createPaginatedResult)(r,Gd.HelixUserRelation,this._client)}getVipsPaginated(e){return new Jq.HelixPaginatedRequest({url:"channels/vips",userId:(0,oe.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,ar.createBroadcasterQuery)(e)},this._client,t=>new Gd.HelixUserRelation(t,this._client))}async checkVipForUsers(e,t){return(await this._client.callApi({type:"helix",url:"channels/vips",userId:(0,oe.extractUserId)(e),scopes:["channel:read:vips","channel:manage:vips"],query:(0,yg.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new Gd.HelixUserRelation(a,this._client))}async checkVipForUser(e,t){let r=(0,oe.extractUserId)(t);return(await this.checkVipForUsers(e,[r])).some(s=>s.id===r)}async addVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"POST",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,bt.createChannelVipUpdateQuery)(e,t)})}async removeVip(e,t){await this._client.callApi({type:"helix",url:"channels/vips",method:"DELETE",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:vips"],query:(0,bt.createChannelVipUpdateQuery)(e,t)})}async getChannelFollowerCount(e){return(await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,oe.extractUserId)(e),query:{...(0,bt.createChannelFollowerQuery)(e),...(0,Ko.createPaginationQuery)({limit:1})}})).total}async getChannelFollowers(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followers",method:"GET",userId:(0,oe.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:{...(0,bt.createChannelFollowerQuery)(e,t),...(0,Ko.createPaginationQuery)(r)}});return(0,Wd.createPaginatedResultWithTotal)(a,gg.HelixChannelFollower,this._client)}getChannelFollowersPaginated(e){return new fg.HelixPaginatedRequestWithTotal({url:"channels/followers",method:"GET",userId:(0,oe.extractUserId)(e),canOverrideScopedUserContext:!0,scopes:["moderator:read:followers"],query:(0,bt.createChannelFollowerQuery)(e)},this._client,t=>new gg.HelixChannelFollower(t,this._client))}async getFollowedChannels(e,t,r){let a=await this._client.callApi({type:"helix",url:"channels/followed",method:"GET",userId:(0,oe.extractUserId)(e),scopes:["user:read:follows"],query:{...(0,bt.createFollowedChannelQuery)(e,t),...(0,Ko.createPaginationQuery)(r)}});return(0,Wd.createPaginatedResultWithTotal)(a,bg.HelixFollowedChannel,this._client)}getFollowedChannelsPaginated(e,t){return new fg.HelixPaginatedRequestWithTotal({url:"channels/followed",method:"GET",userId:(0,oe.extractUserId)(e),scopes:["user:read:follows"],query:(0,bt.createFollowedChannelQuery)(e,t)},this._client,r=>new bg.HelixFollowedChannel(r,this._client))}async getAdSchedule(e){let t=await this._client.callApi({type:"helix",url:"channels/ads",method:"GET",userId:(0,oe.extractUserId)(e),scopes:["channel:read:ads"],query:(0,ar.createBroadcasterQuery)(e)});return new Yq.HelixAdSchedule(t.data[0])}async snoozeNextAd(e){let t=await this._client.callApi({type:"helix",url:"channels/ads/schedule/snooze",method:"POST",userId:(0,oe.extractUserId)(e),scopes:["channel:manage:ads"],query:(0,ar.createBroadcasterQuery)(e)});return new eE.HelixSnoozeNextAdResult(t.data[0])}};Wi.HelixChannelApi=Jo;xg.__decorate([(0,wg.Enumerable)(!1)],Jo.prototype,"_getChannelByIdBatcher",void 0);Wi.HelixChannelApi=Jo=xg.__decorate([(0,oe.rtfm)("api","HelixChannelApi")],Jo)});var vg=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createRedemptionsForBroadcasterQuery=Qe.createRewardRedemptionsByIdsQuery=Qe.createCustomRewardBody=Qe.createCustomRewardChangeQuery=Qe.createCustomRewardsQuery=void 0;var Zo=m();function tE(i,e){return{broadcaster_id:(0,Zo.extractUserId)(i),only_manageable_rewards:e?.toString()}}n(tE,"createCustomRewardsQuery");Qe.createCustomRewardsQuery=tE;function rE(i,e){return{broadcaster_id:(0,Zo.extractUserId)(i),id:e}}n(rE,"createCustomRewardChangeQuery");Qe.createCustomRewardChangeQuery=rE;function iE(i){var e,t,r;let a={title:i.title,cost:i.cost,prompt:i.prompt,background_color:i.backgroundColor,is_enabled:i.isEnabled,is_user_input_required:i.userInputRequired,should_redemptions_skip_request_queue:i.autoFulfill};return i.maxRedemptionsPerStream!==void 0&&(a.is_max_per_stream_enabled=!!i.maxRedemptionsPerStream,a.max_per_stream=(e=i.maxRedemptionsPerStream)!==null&&e!==void 0?e:0),i.maxRedemptionsPerUserPerStream!==void 0&&(a.is_max_per_user_per_stream_enabled=!!i.maxRedemptionsPerUserPerStream,a.max_per_user_per_stream=(t=i.maxRedemptionsPerUserPerStream)!==null&&t!==void 0?t:0),i.globalCooldown!==void 0&&(a.is_global_cooldown_enabled=!!i.globalCooldown,a.global_cooldown_seconds=(r=i.globalCooldown)!==null&&r!==void 0?r:0),"isPaused"in i&&(a.is_paused=i.isPaused),a}n(iE,"createCustomRewardBody");Qe.createCustomRewardBody=iE;function nE(i,e,t){return{broadcaster_id:(0,Zo.extractUserId)(i),reward_id:e,id:t}}n(nE,"createRewardRedemptionsByIdsQuery");Qe.createRewardRedemptionsByIdsQuery=nE;function aE(i,e,t,r){return{broadcaster_id:(0,Zo.extractUserId)(i),reward_id:e,status:t,sort:r.newestFirst?"NEWEST":"OLDEST"}}n(aE,"createRedemptionsForBroadcasterQuery");Qe.createRedemptionsForBroadcasterQuery=aE});var zd=u(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.HelixCustomReward=void 0;var Sg=(f(),b(y)),sE=C(),j=m(),Xo=class extends j.DataObject{static{n(this,"HelixCustomReward")}constructor(e,t){super(e),this._client=t}get id(){return this[j.rawDataSymbol].id}get broadcasterId(){return this[j.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[j.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[j.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,j.checkRelationAssertion)(await this._client.users.getUserById(this[j.rawDataSymbol].broadcaster_id))}getImageUrl(e){var t,r;let a=`url_${e}x`;return(r=(t=this[j.rawDataSymbol].image)===null||t===void 0?void 0:t[a])!==null&&r!==void 0?r:this[j.rawDataSymbol].default_image[a]}get backgroundColor(){return this[j.rawDataSymbol].background_color}get isEnabled(){return this[j.rawDataSymbol].is_enabled}get cost(){return this[j.rawDataSymbol].cost}get title(){return this[j.rawDataSymbol].title}get prompt(){return this[j.rawDataSymbol].prompt}get userInputRequired(){return this[j.rawDataSymbol].is_user_input_required}get maxRedemptionsPerStream(){return this[j.rawDataSymbol].max_per_stream_setting.is_enabled?this[j.rawDataSymbol].max_per_stream_setting.max_per_stream:null}get maxRedemptionsPerUserPerStream(){return this[j.rawDataSymbol].max_per_user_per_stream_setting.is_enabled?this[j.rawDataSymbol].max_per_user_per_stream_setting.max_per_user_per_stream:null}get globalCooldown(){return this[j.rawDataSymbol].global_cooldown_setting.is_enabled?this[j.rawDataSymbol].global_cooldown_setting.global_cooldown_seconds:null}get isPaused(){return this[j.rawDataSymbol].is_paused}get isInStock(){return this[j.rawDataSymbol].is_in_stock}get redemptionsThisStream(){return this[j.rawDataSymbol].redemptions_redeemed_current_stream}get autoFulfill(){return this[j.rawDataSymbol].should_redemptions_skip_request_queue}get cooldownExpiryDate(){return this[j.rawDataSymbol].cooldown_expires_at?new Date(this[j.rawDataSymbol].cooldown_expires_at):null}};Vi.HelixCustomReward=Xo;Sg.__decorate([(0,sE.Enumerable)(!1)],Xo.prototype,"_client",void 0);Vi.HelixCustomReward=Xo=Sg.__decorate([(0,j.rtfm)("api","HelixCustomReward","id")],Xo)});var Kd=u($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.HelixCustomRewardRedemption=void 0;var Hg=(f(),b(y)),oE=C(),N=m(),Yo=class extends N.DataObject{static{n(this,"HelixCustomRewardRedemption")}constructor(e,t){super(e),this._client=t}get id(){return this[N.rawDataSymbol].id}get broadcasterId(){return this[N.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[N.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[N.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,N.checkRelationAssertion)(await this._client.users.getUserById(this[N.rawDataSymbol].broadcaster_id))}get userId(){return this[N.rawDataSymbol].user_id}get userName(){return this[N.rawDataSymbol].user_login}get userDisplayName(){return this[N.rawDataSymbol].user_name}async getUser(){return(0,N.checkRelationAssertion)(await this._client.users.getUserById(this[N.rawDataSymbol].user_id))}get userInput(){return this[N.rawDataSymbol].user_input}get isFulfilled(){return this[N.rawDataSymbol].status==="FULFILLED"}get isCanceled(){return this[N.rawDataSymbol].status==="CANCELED"}get redemptionDate(){return new Date(this[N.rawDataSymbol].redeemed_at)}get rewardId(){return this[N.rawDataSymbol].reward.id}get rewardTitle(){return this[N.rawDataSymbol].reward.title}get rewardPrompt(){return this[N.rawDataSymbol].reward.prompt}get rewardCost(){return this[N.rawDataSymbol].reward.cost}async getReward(){return(0,N.checkRelationAssertion)(await this._client.channelPoints.getCustomRewardById(this[N.rawDataSymbol].broadcaster_id,this[N.rawDataSymbol].reward.id))}async updateStatus(e){return(await this._client.channelPoints.updateRedemptionStatusByIds(this[N.rawDataSymbol].broadcaster_id,this[N.rawDataSymbol].reward.id,[this[N.rawDataSymbol].id],e))[0]}};$i.HelixCustomRewardRedemption=Yo;Hg.__decorate([(0,oE.Enumerable)(!1)],Yo.prototype,"_client",void 0);$i.HelixCustomRewardRedemption=Yo=Hg.__decorate([(0,N.rtfm)("api","HelixCustomRewardRedemption","id")],Yo)});var Zd=u(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.HelixChannelPointsApi=void 0;var lE=(f(),b(y)),uE=Z(),ct=m(),xt=vg(),cE=Ue(),dE=ae(),hE=ce(),pE=se(),mE=Q(),el=zd(),tl=Kd(),Jd=class extends mE.BaseApi{static{n(this,"HelixChannelPointsApi")}async getCustomRewards(e,t){return(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,xt.createCustomRewardsQuery)(e,t)})).data.map(a=>new el.HelixCustomReward(a,this._client))}async getCustomRewardsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,cE.createGetByIdsQuery)(e,t)})).data.map(a=>new el.HelixCustomReward(a,this._client)):[]}async getCustomRewardById(e,t){let r=await this.getCustomRewardsByIds(e,[t]);return r.length?r[0]:null}async createCustomReward(e,t){let r=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"POST",userId:(0,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,uE.createBroadcasterQuery)(e),jsonBody:(0,xt.createCustomRewardBody)(t)});return new el.HelixCustomReward(r.data[0],this._client)}async updateCustomReward(e,t,r){let a=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"PATCH",userId:(0,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xt.createCustomRewardChangeQuery)(e,t),jsonBody:(0,xt.createCustomRewardBody)(r)});return new el.HelixCustomReward(a.data[0],this._client)}async deleteCustomReward(e,t){await this._client.callApi({type:"helix",url:"channel_points/custom_rewards",method:"DELETE",userId:(0,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xt.createCustomRewardChangeQuery)(e,t)})}async getRedemptionsByIds(e,t,r){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,xt.createRewardRedemptionsByIdsQuery)(e,t,r)})).data.map(s=>new tl.HelixCustomRewardRedemption(s,this._client)):[]}async getRedemptionById(e,t,r){let a=await this.getRedemptionsByIds(e,t,[r]);return a.length?a[0]:null}async getRedemptionsForBroadcaster(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:{...(0,xt.createRedemptionsForBroadcasterQuery)(e,t,r,a),...(0,pE.createPaginationQuery)(a)}});return(0,hE.createPaginatedResult)(s,tl.HelixCustomRewardRedemption,this._client)}getRedemptionsForBroadcasterPaginated(e,t,r,a){return new dE.HelixPaginatedRequest({url:"channel_points/custom_rewards/redemptions",userId:(0,ct.extractUserId)(e),scopes:["channel:read:redemptions","channel:manage:redemptions"],query:(0,xt.createRedemptionsForBroadcasterQuery)(e,t,r,a)},this._client,s=>new tl.HelixCustomRewardRedemption(s,this._client),50)}async updateRedemptionStatusByIds(e,t,r,a){return r.length?(await this._client.callApi({type:"helix",url:"channel_points/custom_rewards/redemptions",method:"PATCH",userId:(0,ct.extractUserId)(e),scopes:["channel:manage:redemptions"],query:(0,xt.createRewardRedemptionsByIdsQuery)(e,t,r),jsonBody:{status:a}})).data.map(o=>new tl.HelixCustomRewardRedemption(o,this._client)):[]}};zi.HelixChannelPointsApi=Jd;zi.HelixChannelPointsApi=Jd=lE.__decorate([(0,ct.rtfm)("api","HelixChannelPointsApi")],Jd)});var rl=u(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.HelixCharityCampaignAmount=void 0;var _E=(f(),b(y)),Ki=m(),Xd=class extends Ki.DataObject{static{n(this,"HelixCharityCampaignAmount")}get value(){return this[Ki.rawDataSymbol].value}get decimalPlaces(){return this[Ki.rawDataSymbol].decimal_places}get localizedValue(){return this.value/10**this.decimalPlaces}get currency(){return this[Ki.rawDataSymbol].currency}};Ji.HelixCharityCampaignAmount=Xd;Ji.HelixCharityCampaignAmount=Xd=_E.__decorate([(0,Ki.rtfm)("api","HelixCharityCampaignAmount")],Xd)});var Yd=u(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.HelixCharityCampaign=void 0;var qg=(f(),b(y)),yE=C(),Ae=m(),Cg=rl(),il=class extends Ae.DataObject{static{n(this,"HelixCharityCampaign")}constructor(e,t){super(e),this._client=t}get id(){return this[Ae.rawDataSymbol].id}get broadcasterId(){return this[Ae.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Ae.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[Ae.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,Ae.checkRelationAssertion)(await this._client.users.getUserById(this[Ae.rawDataSymbol].broadcaster_id))}get charityName(){return this[Ae.rawDataSymbol].charity_name}get charityDescription(){return this[Ae.rawDataSymbol].charity_description}get charityLogo(){return this[Ae.rawDataSymbol].charity_logo}get charityWebsite(){return this[Ae.rawDataSymbol].charity_website}get currentAmount(){return new Cg.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].current_amount)}get targetAmount(){return new Cg.HelixCharityCampaignAmount(this[Ae.rawDataSymbol].target_amount)}};Zi.HelixCharityCampaign=il;qg.__decorate([(0,yE.Enumerable)(!1)],il.prototype,"_client",void 0);Zi.HelixCharityCampaign=il=qg.__decorate([(0,Ae.rtfm)("api","HelixCharityCampaign","id")],il)});var eh=u(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.HelixCharityCampaignDonation=void 0;var Eg=(f(),b(y)),fE=C(),wt=m(),gE=rl(),nl=class extends wt.DataObject{static{n(this,"HelixCharityCampaignDonation")}constructor(e,t){super(e),this._client=t}get campaignId(){return this[wt.rawDataSymbol].campaign_id}get donorId(){return this[wt.rawDataSymbol].user_id}get donorName(){return this[wt.rawDataSymbol].user_login}get donorDisplayName(){return this[wt.rawDataSymbol].user_name}async getDonor(){return(0,wt.checkRelationAssertion)(await this._client.users.getUserById(this[wt.rawDataSymbol].user_id))}get amount(){return new gE.HelixCharityCampaignAmount(this[wt.rawDataSymbol].amount)}};Xi.HelixCharityCampaignDonation=nl;Eg.__decorate([(0,fE.Enumerable)(!1)],nl.prototype,"_client",void 0);Xi.HelixCharityCampaignDonation=nl=Eg.__decorate([(0,wt.rtfm)("api","HelixCharityCampaignDonation")],nl)});var ih=u(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.HelixCharityApi=void 0;var bE=(f(),b(y)),Pg=Z(),th=m(),xE=ce(),wE=se(),vE=Q(),SE=Yd(),HE=eh(),rh=class extends vE.BaseApi{static{n(this,"HelixCharityApi")}async getCharityCampaign(e){let t=await this._client.callApi({type:"helix",url:"charity/campaigns",method:"GET",userId:(0,th.extractUserId)(e),scopes:["channel:read:charity"],query:(0,Pg.createBroadcasterQuery)(e)});return new SE.HelixCharityCampaign(t.data[0],this._client)}async getCharityCampaignDonations(e,t){let r=await this._client.callApi({type:"helix",url:"charity/donations",userId:(0,th.extractUserId)(e),scopes:["channel:read:charity"],query:{...(0,Pg.createBroadcasterQuery)(e),...(0,wE.createPaginationQuery)(t)}});return(0,xE.createPaginatedResult)(r,HE.HelixCharityCampaignDonation,this._client)}};Yi.HelixCharityApi=rh;Yi.HelixCharityApi=rh=bE.__decorate([(0,th.rtfm)("api","HelixCharityApi")],rh)});var Ag=u(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.createSendChatMessageBody=Ge.createSendChatMessageQuery=Ge.createShoutoutQuery=Ge.createChatColorUpdateQuery=Ge.createChatSettingsUpdateBody=void 0;var nh=m();function CE(i){return{slow_mode:i.slowModeEnabled,slow_mode_wait_time:i.slowModeDelay,follower_mode:i.followerOnlyModeEnabled,follower_mode_duration:i.followerOnlyModeDelay,subscriber_mode:i.subscriberOnlyModeEnabled,emote_mode:i.emoteOnlyModeEnabled,unique_chat_mode:i.uniqueChatModeEnabled,non_moderator_chat_delay:i.nonModeratorChatDelayEnabled,non_moderator_chat_delay_duration:i.nonModeratorChatDelay}}n(CE,"createChatSettingsUpdateBody");Ge.createChatSettingsUpdateBody=CE;function qE(i,e){return{user_id:(0,nh.extractUserId)(i),color:e}}n(qE,"createChatColorUpdateQuery");Ge.createChatColorUpdateQuery=qE;function EE(i,e,t){return{from_broadcaster_id:(0,nh.extractUserId)(i),to_broadcaster_id:(0,nh.extractUserId)(e),moderator_id:t}}n(EE,"createShoutoutQuery");Ge.createShoutoutQuery=EE;function PE(i,e){return{broadcaster_id:i,sender_id:e}}n(PE,"createSendChatMessageQuery");Ge.createSendChatMessageQuery=PE;function AE(i,e){return{message:i,reply_parent_message_id:e?.replyParentMessageId}}n(AE,"createSendChatMessageBody");Ge.createSendChatMessageBody=AE});var sh=u(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.HelixEmoteBase=void 0;var Ze=m(),ah=class extends Ze.DataObject{static{n(this,"HelixEmoteBase")}get id(){return this[Ze.rawDataSymbol].id}get name(){return this[Ze.rawDataSymbol].name}get formats(){return this[Ze.rawDataSymbol].format}get scales(){return this[Ze.rawDataSymbol].scale}get themeModes(){return this[Ze.rawDataSymbol].theme_mode}getStaticImageUrl(e="1.0",t="light"){return this[Ze.rawDataSymbol].format.includes("static")&&this[Ze.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"static",t):null}getAnimatedImageUrl(e="1.0",t="light"){return this[Ze.rawDataSymbol].format.includes("animated")&&this[Ze.rawDataSymbol].scale.includes(e)?this.getFormattedImageUrl(e,"animated",t):null}getFormattedImageUrl(e="1.0",t="static",r="light"){return`https://static-cdn.jtvnw.net/emoticons/v2/${this[Ze.rawDataSymbol].id}/${t}/${r}/${e}`}};al.HelixEmoteBase=ah});var tn=u(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.HelixEmote=void 0;var DE=(f(),b(y)),Dg=m(),IE=sh(),oh=class extends IE.HelixEmoteBase{static{n(this,"HelixEmote")}getImageUrl(e){return this[Dg.rawDataSymbol].images[`url_${e}x`]}};en.HelixEmote=oh;en.HelixEmote=oh=DE.__decorate([(0,Dg.rtfm)("api","HelixEmote","id")],oh)});var lh=u(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.HelixChannelEmote=void 0;var Ig=(f(),b(y)),TE=C(),rn=m(),RE=tn(),sl=class extends RE.HelixEmote{static{n(this,"HelixChannelEmote")}constructor(e,t){super(e),this._client=t}get tier(){return this[rn.rawDataSymbol].tier||null}get type(){return this[rn.rawDataSymbol].emote_type}get emoteSetId(){return this[rn.rawDataSymbol].emote_set_id}async getAllEmotesFromSet(){return await this._client.chat.getEmotesFromSets([this[rn.rawDataSymbol].emote_set_id])}};nn.HelixChannelEmote=sl;Ig.__decorate([(0,TE.Enumerable)(!1)],sl.prototype,"_client",void 0);nn.HelixChannelEmote=sl=Ig.__decorate([(0,rn.rtfm)("api","HelixChannelEmote","id")],sl)});var ch=u(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.HelixChatBadgeVersion=void 0;var UE=(f(),b(y)),kt=m(),uh=class extends kt.DataObject{static{n(this,"HelixChatBadgeVersion")}get id(){return this[kt.rawDataSymbol].id}getImageUrl(e){return this[kt.rawDataSymbol][`image_url_${e}x`]}get title(){return this[kt.rawDataSymbol].title}get description(){return this[kt.rawDataSymbol].description}get clickAction(){return this[kt.rawDataSymbol].click_action}get clickUrl(){return this[kt.rawDataSymbol].click_url}};an.HelixChatBadgeVersion=uh;an.HelixChatBadgeVersion=uh=UE.__decorate([(0,kt.rtfm)("api","HelixChatBadgeVersion","id")],uh)});var dh=u(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.HelixChatBadgeSet=void 0;var Tg=(f(),b(y)),Rg=xi(),ol=m(),BE=ch(),ll=class extends ol.DataObject{static{n(this,"HelixChatBadgeSet")}get id(){return this[ol.rawDataSymbol].set_id}get versions(){return this[ol.rawDataSymbol].versions.map(e=>new BE.HelixChatBadgeVersion(e))}getVersion(e){var t;return(t=this.versions.find(r=>r.id===e))!==null&&t!==void 0?t:null}};sn.HelixChatBadgeSet=ll;Tg.__decorate([(0,Rg.CachedGetter)()],ll.prototype,"versions",null);sn.HelixChatBadgeSet=ll=Tg.__decorate([Rg.Cacheable,(0,ol.rtfm)("api","HelixChatBadgeSet","id")],ll)});var hh=u(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.HelixChatChatter=void 0;var Ug=(f(),b(y)),OE=C(),sr=m(),ul=class extends sr.DataObject{static{n(this,"HelixChatChatter")}constructor(e,t){super(e),this._client=t}get userId(){return this[sr.rawDataSymbol].user_id}get userName(){return this[sr.rawDataSymbol].user_login}get userDisplayName(){return this[sr.rawDataSymbol].user_name}async getUser(){return(0,sr.checkRelationAssertion)(await this._client.users.getUserById(this[sr.rawDataSymbol].user_id))}};on.HelixChatChatter=ul;Ug.__decorate([(0,OE.Enumerable)(!1)],ul.prototype,"_client",void 0);on.HelixChatChatter=ul=Ug.__decorate([(0,sr.rtfm)("api","HelixChatChatter")],ul)});var cl=u(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.HelixChatSettings=void 0;var jE=(f(),b(y)),dt=m(),ph=class extends dt.DataObject{static{n(this,"HelixChatSettings")}get broadcasterId(){return this[dt.rawDataSymbol].broadcaster_id}get slowModeEnabled(){return this[dt.rawDataSymbol].slow_mode}get slowModeDelay(){return this[dt.rawDataSymbol].slow_mode_wait_time}get followerOnlyModeEnabled(){return this[dt.rawDataSymbol].follower_mode}get followerOnlyModeDelay(){return this[dt.rawDataSymbol].follower_mode_duration}get subscriberOnlyModeEnabled(){return this[dt.rawDataSymbol].subscriber_mode}get emoteOnlyModeEnabled(){return this[dt.rawDataSymbol].emote_mode}get uniqueChatModeEnabled(){return this[dt.rawDataSymbol].unique_chat_mode}};ln.HelixChatSettings=ph;ln.HelixChatSettings=ph=jE.__decorate([(0,dt.rtfm)("api","HelixChatSettings","broadcasterId")],ph)});var mh=u(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.HelixEmoteFromSet=void 0;var Bg=(f(),b(y)),kE=C(),or=m(),ME=tn(),dl=class extends ME.HelixEmote{static{n(this,"HelixEmoteFromSet")}constructor(e,t){super(e),this._client=t}get type(){return this[or.rawDataSymbol].emote_type}get emoteSetId(){return this[or.rawDataSymbol].emote_set_id}get ownerId(){switch(this[or.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return this[or.rawDataSymbol].owner_id}}async getOwner(){switch(this[or.rawDataSymbol].owner_id){case"0":case"twitch":return null;default:return await this._client.users.getUserById(this[or.rawDataSymbol].owner_id)}}};un.HelixEmoteFromSet=dl;Bg.__decorate([(0,kE.Enumerable)(!1)],dl.prototype,"_client",void 0);un.HelixEmoteFromSet=dl=Bg.__decorate([(0,or.rtfm)("api","HelixEmoteFromSet","id")],dl)});var _h=u(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.HelixUserEmote=void 0;var Og=(f(),b(y)),Mt=m(),LE=sh(),FE=C(),hl=class extends LE.HelixEmoteBase{static{n(this,"HelixUserEmote")}constructor(e,t){super(e),this._client=t}get type(){return this[Mt.rawDataSymbol].emote_type}get emoteSetId(){return this[Mt.rawDataSymbol].emote_set_id||null}get ownerId(){return this[Mt.rawDataSymbol].owner_id||null}async getAllEmotesFromSet(){return this[Mt.rawDataSymbol].emote_set_id?await this._client.chat.getEmotesFromSets([this[Mt.rawDataSymbol].emote_set_id]):null}async getOwner(){return this[Mt.rawDataSymbol].owner_id?await this._client.users.getUserById(this[Mt.rawDataSymbol].owner_id):null}};cn.HelixUserEmote=hl;Og.__decorate([(0,FE.Enumerable)(!1)],hl.prototype,"_client",void 0);cn.HelixUserEmote=hl=Og.__decorate([(0,Mt.rtfm)("api","HelixUserEmote","id")],hl)});var gh=u(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.HelixPrivilegedChatSettings=void 0;var NE=(f(),b(y)),yh=m(),QE=cl(),fh=class extends QE.HelixChatSettings{static{n(this,"HelixPrivilegedChatSettings")}get nonModeratorChatDelayEnabled(){return this[yh.rawDataSymbol].non_moderator_chat_delay}get nonModeratorChatDelay(){return this[yh.rawDataSymbol].non_moderator_chat_delay_duration}};dn.HelixPrivilegedChatSettings=fh;dn.HelixPrivilegedChatSettings=fh=NE.__decorate([(0,yh.rtfm)("api","HelixPrivilegedChatSettings","broadcasterId")],fh)});var xh=u(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.HelixSentChatMessage=void 0;var GE=(f(),b(y)),Fr=m(),bh=class extends Fr.DataObject{static{n(this,"HelixSentChatMessage")}get id(){return this[Fr.rawDataSymbol].message_id}get isSent(){return this[Fr.rawDataSymbol].is_sent}get dropReasonCode(){var e;return(e=this[Fr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.code}get dropReasonMessage(){var e;return(e=this[Fr.rawDataSymbol].drop_reason)===null||e===void 0?void 0:e.message}};hn.HelixSentChatMessage=bh;hn.HelixSentChatMessage=bh=GE.__decorate([(0,Fr.rtfm)("api","HelixSentChatMessage","id")],bh)});var jg=u(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.createSharedChatSessionQuery=void 0;var WE=m();function VE(i){return{broadcaster_id:(0,WE.extractUserId)(i)}}n(VE,"createSharedChatSessionQuery");pl.createSharedChatSessionQuery=VE});var wh=u(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.HelixSharedChatSessionParticipant=void 0;var kg=(f(),b(y)),$E=C(),pn=m(),ml=class extends pn.DataObject{static{n(this,"HelixSharedChatSessionParticipant")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[pn.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,pn.checkRelationAssertion)(await this._client.users.getUserById(this[pn.rawDataSymbol].broadcaster_id))}};mn.HelixSharedChatSessionParticipant=ml;kg.__decorate([(0,$E.Enumerable)(!1)],ml.prototype,"_client",void 0);mn.HelixSharedChatSessionParticipant=ml=kg.__decorate([(0,pn.rtfm)("api","HelixSharedChatSessionParticipant","broadcasterId")],ml)});var vh=u(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.HelixSharedChatSession=void 0;var Mg=(f(),b(y)),zE=C(),vt=m(),KE=wh(),_l=class extends vt.DataObject{static{n(this,"HelixSharedChatSession")}constructor(e,t){super(e),this._client=t}get sessionId(){return this[vt.rawDataSymbol].session_id}get hostBroadcasterId(){return this[vt.rawDataSymbol].host_broadcaster_id}async getHostBroadcaster(){return(0,vt.checkRelationAssertion)(await this._client.users.getUserById(this[vt.rawDataSymbol].host_broadcaster_id))}get participants(){return this[vt.rawDataSymbol].participants.map(e=>new KE.HelixSharedChatSessionParticipant(e,this._client))}get createdDate(){return new Date(this[vt.rawDataSymbol].created_at)}get updatedDate(){return new Date(this[vt.rawDataSymbol].updated_at)}};_n.HelixSharedChatSession=_l;Mg.__decorate([(0,zE.Enumerable)(!1)],_l.prototype,"_client",void 0);_n.HelixSharedChatSession=_l=Mg.__decorate([(0,vt.rtfm)("api","HelixSharedChatSession","sessionId")],_l)});var Ch=u(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.HelixChatApi=void 0;var JE=(f(),b(y)),Sh=Z(),J=m(),lr=Ag(),Lt=Ue(),ZE=ae(),XE=Mr(),Lg=ce(),Fg=se(),YE=Q(),eP=lh(),Ng=dh(),Qg=hh(),tP=cl(),rP=tn(),iP=mh(),Gg=_h(),Wg=gh(),Vg=xh(),nP=jg(),aP=vh(),Hh=class extends YE.BaseApi{static{n(this,"HelixChatApi")}async getChatters(e,t){let r=(0,J.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/chatters",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:{...this._createModeratorActionQuery(r),...(0,Fg.createPaginationQuery)(t)}});return(0,Lg.createPaginatedResultWithTotal)(a,Qg.HelixChatChatter,this._client)}getChattersPaginated(e){let t=(0,J.extractUserId)(e);return new XE.HelixPaginatedRequestWithTotal({url:"chat/chatters",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chatters"],query:this._createModeratorActionQuery(t)},this._client,r=>new Qg.HelixChatChatter(r,this._client),1e3)}async getGlobalBadges(){return(await this._client.callApi({type:"helix",url:"chat/badges/global"})).data.map(t=>new Ng.HelixChatBadgeSet(t))}async getChannelBadges(e){return(await this._client.callApi({type:"helix",url:"chat/badges",userId:(0,J.extractUserId)(e),query:(0,Sh.createBroadcasterQuery)(e)})).data.map(r=>new Ng.HelixChatBadgeSet(r))}async getGlobalEmotes(){return(await this._client.callApi({type:"helix",url:"chat/emotes/global"})).data.map(t=>new rP.HelixEmote(t))}async getChannelEmotes(e){return(await this._client.callApi({type:"helix",url:"chat/emotes",userId:(0,J.extractUserId)(e),query:(0,Sh.createBroadcasterQuery)(e)})).data.map(r=>new eP.HelixChannelEmote(r,this._client))}async getEmotesFromSets(e){return(await this._client.callApi({type:"helix",url:"chat/emotes/set",query:(0,Lt.createSingleKeyQuery)("emote_set_id",e)})).data.map(r=>new iP.HelixEmoteFromSet(r,this._client))}async getUserEmotes(e,t){let r=(0,J.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/emotes/user",userId:(0,J.extractUserId)(e),scopes:["user:read:emotes"],query:{...(0,Lt.createSingleKeyQuery)("user_id",r),...(0,Lt.createSingleKeyQuery)("broadcasterId",t?.broadcaster?(0,J.extractUserId)(t.broadcaster):void 0),...(0,Fg.createPaginationQuery)(t)}});return(0,Lg.createPaginatedResult)(a,Gg.HelixUserEmote,this._client)}getUserEmotesPaginated(e,t){let r=(0,J.extractUserId)(e);return new ZE.HelixPaginatedRequest({url:"chat/emotes/user",userId:r,scopes:["user:read:emotes"],query:{...(0,Lt.createSingleKeyQuery)("user_id",r),...(0,Lt.createSingleKeyQuery)("broadcasterId",t?(0,J.extractUserId)(t):void 0)}},this._client,a=>new Gg.HelixUserEmote(a,this._client))}async getSettings(e){let t=await this._client.callApi({type:"helix",url:"chat/settings",userId:(0,J.extractUserId)(e),query:(0,Sh.createBroadcasterQuery)(e)});return new tP.HelixChatSettings(t.data[0])}async getSettingsPrivileged(e){let t=(0,J.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"chat/settings",userId:t,canOverrideScopedUserContext:!0,scopes:["moderator:read:chat_settings"],query:this._createModeratorActionQuery(t)});return new Wg.HelixPrivilegedChatSettings(r.data[0])}async updateSettings(e,t){let r=(0,J.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"chat/settings",method:"PATCH",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:chat_settings"],query:this._createModeratorActionQuery(r),jsonBody:(0,lr.createChatSettingsUpdateBody)(t)});return new Wg.HelixPrivilegedChatSettings(a.data[0])}async sendChatMessage(e,t,r){let a=(0,J.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",userId:a,canOverrideScopedUserContext:!0,scopes:["user:write:chat"],query:(0,lr.createSendChatMessageQuery)(a,this._getUserContextIdWithDefault(a)),jsonBody:(0,lr.createSendChatMessageBody)(t,r)});return new Vg.HelixSentChatMessage(s.data[0])}async sendChatMessageAsApp(e,t,r,a){let s=(0,J.extractUserId)(e),o=(0,J.extractUserId)(t),l=await this._client.callApi({type:"helix",url:"chat/messages",method:"POST",forceType:"app",query:(0,lr.createSendChatMessageQuery)(o,s),jsonBody:(0,lr.createSendChatMessageBody)(r,a)});return new Vg.HelixSentChatMessage(l.data[0])}async sendAnnouncement(e,t){let r=(0,J.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/announcements",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:announcements"],query:this._createModeratorActionQuery(r),jsonBody:{message:t.message,color:t.color}})}async getColorsForUsers(e){let t=await this._client.callApi({type:"helix",url:"chat/color",query:(0,Lt.createSingleKeyQuery)("user_id",e.map(J.extractUserId))});return new Map(t.data.map(r=>[r.user_id,r.color||null]))}async getColorForUser(e){let t=await this._client.callApi({type:"helix",url:"chat/color",userId:(0,J.extractUserId)(e),query:(0,Lt.createSingleKeyQuery)("user_id",(0,J.extractUserId)(e))});if(t.data.length)return t.data[0].color||null}async setColorForUser(e,t){await this._client.callApi({type:"helix",url:"chat/color",method:"PUT",userId:(0,J.extractUserId)(e),scopes:["user:manage:chat_color"],query:(0,lr.createChatColorUpdateQuery)(e,t)})}async shoutoutUser(e,t){let r=(0,J.extractUserId)(e);await this._client.callApi({type:"helix",url:"chat/shoutouts",method:"POST",userId:r,canOverrideScopedUserContext:!0,scopes:["moderator:manage:shoutouts"],query:(0,lr.createShoutoutQuery)(e,t,this._getUserContextIdWithDefault(r))})}async getSharedChatSession(e){let t=(0,J.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"shared_chat/session",userId:t,query:(0,nP.createSharedChatSessionQuery)(t)});return r.data.length===0?null:new aP.HelixSharedChatSession(r.data[0],this._client)}_createModeratorActionQuery(e){return(0,Lt.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};yn.HelixChatApi=Hh;yn.HelixChatApi=Hh=JE.__decorate([(0,J.rtfm)("api","HelixChatApi")],Hh)});var $g=u(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createClipQuery=Nr.createClipCreateQuery=void 0;var sP=m();function oP(i,e){return{broadcaster_id:(0,sP.extractUserId)(i),has_delay:e.toString()}}n(oP,"createClipCreateQuery");Nr.createClipCreateQuery=oP;function lP(i){let{filterType:e,ids:t,startDate:r,endDate:a,isFeatured:s}=i;return{[e]:t,started_at:r,ended_at:a,is_featured:s?.toString()}}n(lP,"createClipQuery");Nr.createClipQuery=lP});var qh=u(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.HelixClip=void 0;var zg=(f(),b(y)),uP=C(),k=m(),yl=class extends k.DataObject{static{n(this,"HelixClip")}constructor(e,t){super(e),this._client=t}get id(){return this[k.rawDataSymbol].id}get url(){return this[k.rawDataSymbol].url}get embedUrl(){return this[k.rawDataSymbol].embed_url}get broadcasterId(){return this[k.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[k.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,k.checkRelationAssertion)(await this._client.users.getUserById(this[k.rawDataSymbol].broadcaster_id))}get creatorId(){return this[k.rawDataSymbol].creator_id}get creatorDisplayName(){return this[k.rawDataSymbol].creator_name}async getCreator(){return(0,k.checkRelationAssertion)(await this._client.users.getUserById(this[k.rawDataSymbol].creator_id))}get videoId(){return this[k.rawDataSymbol].video_id}async getVideo(){return(0,k.checkRelationAssertion)(await this._client.videos.getVideoById(this[k.rawDataSymbol].video_id))}get gameId(){return this[k.rawDataSymbol].game_id}async getGame(){return this[k.rawDataSymbol].game_id?(0,k.checkRelationAssertion)(await this._client.games.getGameById(this[k.rawDataSymbol].game_id)):null}get language(){return this[k.rawDataSymbol].language}get title(){return this[k.rawDataSymbol].title}get views(){return this[k.rawDataSymbol].view_count}get creationDate(){return new Date(this[k.rawDataSymbol].created_at)}get thumbnailUrl(){return this[k.rawDataSymbol].thumbnail_url}get duration(){return this[k.rawDataSymbol].duration}get vodOffset(){return this[k.rawDataSymbol].vod_offset}get isFeatured(){return this[k.rawDataSymbol].is_featured}};fn.HelixClip=yl;zg.__decorate([(0,uP.Enumerable)(!1)],yl.prototype,"_client",void 0);fn.HelixClip=yl=zg.__decorate([(0,k.rtfm)("api","HelixClip","id")],yl)});var Ah=u(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.HelixClipApi=void 0;var Kg=(f(),b(y)),cP=C(),Qr=m(),Eh=$g(),dP=Bt(),hP=ae(),pP=ce(),mP=se(),_P=Q(),Ph=qh(),fl=class extends _P.BaseApi{static{n(this,"HelixClipApi")}constructor(){super(...arguments),this._getClipByIdBatcher=new dP.HelixRequestBatcher({url:"clips"},"id","id",this._client,e=>new Ph.HelixClip(e,this._client))}async getClipsForBroadcaster(e,t={}){return await this._getClips({...t,filterType:"broadcaster_id",ids:(0,Qr.extractUserId)(e),userId:(0,Qr.extractUserId)(e)})}getClipsForBroadcasterPaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"broadcaster_id",ids:(0,Qr.extractUserId)(e),userId:(0,Qr.extractUserId)(e)})}async getClipsForGame(e,t={}){return await this._getClips({...t,filterType:"game_id",ids:e})}getClipsForGamePaginated(e,t={}){return this._getClipsPaginated({...t,filterType:"game_id",ids:e})}async getClipsByIds(e){return(await this._getClips({filterType:"id",ids:e})).data}async getClipById(e){let t=await this.getClipsByIds([e]);return t.length?t[0]:null}async getClipByIdBatched(e){return await this._getClipByIdBatcher.request(e)}async createClip(e){let{channel:t,createAfterDelay:r=!1}=e;return(await this._client.callApi({type:"helix",url:"clips",method:"POST",userId:(0,Qr.extractUserId)(t),scopes:["clips:edit"],canOverrideScopedUserContext:!0,query:(0,Eh.createClipCreateQuery)(t,r)})).data[0].id}async _getClips(e){if(!e.ids.length)return{data:[]};let t=await this._client.callApi({type:"helix",url:"clips",userId:e.userId,query:{...(0,Eh.createClipQuery)(e),...(0,mP.createPaginationQuery)(e)}});return(0,pP.createPaginatedResult)(t,Ph.HelixClip,this._client)}_getClipsPaginated(e){return new hP.HelixPaginatedRequest({url:"clips",userId:e.userId,query:(0,Eh.createClipQuery)(e)},this._client,t=>new Ph.HelixClip(t,this._client))}};gn.HelixClipApi=fl;Kg.__decorate([(0,cP.Enumerable)(!1)],fl.prototype,"_getClipByIdBatcher",void 0);gn.HelixClipApi=fl=Kg.__decorate([(0,Qr.rtfm)("api","HelixClipApi")],fl)});var Ih=u(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.HelixContentClassificationLabel=void 0;var gl=m(),Dh=class extends gl.DataObject{static{n(this,"HelixContentClassificationLabel")}get id(){return this[gl.rawDataSymbol].id}get name(){return this[gl.rawDataSymbol].name}get description(){return this[gl.rawDataSymbol].description}};bl.HelixContentClassificationLabel=Dh});var Rh=u(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.HelixContentClassificationLabelApi=void 0;var yP=(f(),b(y)),fP=m(),gP=Q(),bP=Ih(),Th=class extends gP.BaseApi{static{n(this,"HelixContentClassificationLabelApi")}async getAll(e){return(await this._client.callApi({url:"content_classification_labels",query:{locale:e}})).data.map(r=>new bP.HelixContentClassificationLabel(r))}};bn.HelixContentClassificationLabelApi=Th;bn.HelixContentClassificationLabelApi=Th=yP.__decorate([(0,fP.rtfm)("api","HelixContentClassificationLabelApi")],Th)});var Jg=u(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createDropsEntitlementUpdateBody=Gr.createDropsEntitlementQuery=void 0;var xP=C(),wP=m();function vP(i,e){return{user_id:e?(0,xP.mapOptional)(i.user,wP.extractUserId):void 0,game_id:i.gameId,fulfillment_status:i.fulfillmentStatus}}n(vP,"createDropsEntitlementQuery");Gr.createDropsEntitlementQuery=vP;function SP(i,e){return{fulfillment_status:e,entitlement_ids:i}}n(SP,"createDropsEntitlementUpdateBody");Gr.createDropsEntitlementUpdateBody=SP});var Uh=u(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.HelixDropsEntitlement=void 0;var Zg=(f(),b(y)),HP=C(),Be=m(),xl=class extends Be.DataObject{static{n(this,"HelixDropsEntitlement")}constructor(e,t){super(e),this._client=t}get id(){return this[Be.rawDataSymbol].id}get rewardId(){return this[Be.rawDataSymbol].benefit_id}get grantDate(){return new Date(this[Be.rawDataSymbol].timestamp)}get userId(){return this[Be.rawDataSymbol].user_id}async getUser(){return(0,Be.checkRelationAssertion)(await this._client.users.getUserById(this[Be.rawDataSymbol].user_id))}get gameId(){return this[Be.rawDataSymbol].game_id}async getGame(){return(0,Be.checkRelationAssertion)(await this._client.games.getGameById(this[Be.rawDataSymbol].game_id))}get fulfillmentStatus(){return this[Be.rawDataSymbol].fulfillment_status}get updateDate(){return new Date(this[Be.rawDataSymbol].last_updated)}};xn.HelixDropsEntitlement=xl;Zg.__decorate([(0,HP.Enumerable)(!1)],xl.prototype,"_client",void 0);xn.HelixDropsEntitlement=xl=Zg.__decorate([(0,Be.rtfm)("api","HelixDropsEntitlement")],xl)});var kh=u(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.HelixEntitlementApi=void 0;var Xg=(f(),b(y)),Oh=C(),jh=m(),Bh=Jg(),CP=Bt(),qP=ae(),EP=ce(),PP=se(),AP=Q(),wl=Uh(),vl=class extends AP.BaseApi{static{n(this,"HelixEntitlementApi")}constructor(){super(...arguments),this._getDropsEntitlementByIdBatcher=new CP.HelixRequestBatcher({url:"entitlements/drops"},"id","id",this._client,e=>new wl.HelixDropsEntitlement(e,this._client))}async getDropsEntitlements(e,t=!1){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",userId:(0,Oh.mapOptional)(e.user,jh.extractUserId),forceType:e.user&&t?"app":void 0,query:{...(0,Bh.createDropsEntitlementQuery)(e,t),...(0,PP.createPaginationQuery)(e)}});return(0,EP.createPaginatedResult)(r,wl.HelixDropsEntitlement,this._client)}getDropsEntitlementsPaginated(e,t=!1){return new qP.HelixPaginatedRequest({url:"entitlements/drops",userId:(0,Oh.mapOptional)(e.user,jh.extractUserId),forceType:e.user&&t?"app":void 0,query:(0,Bh.createDropsEntitlementQuery)(e,t)},this._client,r=>new wl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementsByIds(e){return(await this._client.callApi({type:"helix",url:"entitlements/drops",query:{id:e}})).data.map(r=>new wl.HelixDropsEntitlement(r,this._client))}async getDropsEntitlementById(e){var t;return(t=(await this.getDropsEntitlementsByIds([e]))[0])!==null&&t!==void 0?t:null}async getDropsEntitlementByIdBatched(e){return await this._getDropsEntitlementByIdBatcher.request(e)}async updateDropsEntitlements(e,t){let r=await this._client.callApi({type:"helix",url:"entitlements/drops",method:"PATCH",jsonBody:(0,Bh.createDropsEntitlementUpdateBody)(e,t)});return new Map(r.data.flatMap(a=>a.ids.map(s=>[s,a.status])))}};wn.HelixEntitlementApi=vl;Xg.__decorate([(0,Oh.Enumerable)(!1)],vl.prototype,"_getDropsEntitlementByIdBatcher",void 0);wn.HelixEntitlementApi=vl=Xg.__decorate([(0,jh.rtfm)("api","HelixEntitlementApi")],vl)});var eb=u(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.createEventSubConduitShardsUpdateCondition=me.createEventSubConduitUpdateCondition=me.createEventSubConduitCondition=me.createEventSubDropEntitlementGrantCondition=me.createEventSubUserCondition=me.createEventSubModeratorCondition=me.createEventSubRewardCondition=me.createEventSubBroadcasterCondition=void 0;var Yg=m();function DP(i){return{broadcaster_user_id:(0,Yg.extractUserId)(i)}}n(DP,"createEventSubBroadcasterCondition");me.createEventSubBroadcasterCondition=DP;function IP(i,e){return{broadcaster_user_id:(0,Yg.extractUserId)(i),reward_id:e}}n(IP,"createEventSubRewardCondition");me.createEventSubRewardCondition=IP;function TP(i,e){return{broadcaster_user_id:i,moderator_user_id:e}}n(TP,"createEventSubModeratorCondition");me.createEventSubModeratorCondition=TP;function RP(i,e){return{broadcaster_user_id:i,user_id:e}}n(RP,"createEventSubUserCondition");me.createEventSubUserCondition=RP;function UP(i){return{organization_id:i.organizationId,category_id:i.categoryId,campaign_id:i.campaignId}}n(UP,"createEventSubDropEntitlementGrantCondition");me.createEventSubDropEntitlementGrantCondition=UP;function BP(i,e){return{conduit_id:i,status:e}}n(BP,"createEventSubConduitCondition");me.createEventSubConduitCondition=BP;function OP(i,e){return{id:i,shard_count:e.toString()}}n(OP,"createEventSubConduitUpdateCondition");me.createEventSubConduitUpdateCondition=OP;function jP(i,e){return{conduit_id:i,shards:e}}n(jP,"createEventSubConduitShardsUpdateCondition");me.createEventSubConduitShardsUpdateCondition=jP});var Hl=u(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.HelixEventSubSubscription=void 0;var tb=(f(),b(y)),kP=C(),We=m(),Sl=class extends We.DataObject{static{n(this,"HelixEventSubSubscription")}constructor(e,t){super(e),this._client=t}get id(){return this[We.rawDataSymbol].id}get status(){return this[We.rawDataSymbol].status}get type(){return this[We.rawDataSymbol].type}get cost(){return this[We.rawDataSymbol].cost}get condition(){return this[We.rawDataSymbol].condition}get creationDate(){return new Date(this[We.rawDataSymbol].created_at)}get transportMethod(){return this[We.rawDataSymbol].transport.method}async unsubscribe(){await this._client.eventSub.deleteSubscription(this[We.rawDataSymbol].id)}get _transport(){return this[We.rawDataSymbol].transport}set _status(e){this[We.rawDataSymbol].status=e}};vn.HelixEventSubSubscription=Sl;tb.__decorate([(0,kP.Enumerable)(!1)],Sl.prototype,"_client",void 0);vn.HelixEventSubSubscription=Sl=tb.__decorate([(0,We.rtfm)("api","HelixEventSubSubscription","id")],Sl)});var Lh=u(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.HelixPaginatedEventSubSubscriptionsRequest=void 0;var MP=(f(),b(y)),LP=m(),FP=Mr(),NP=Hl(),Mh=class extends FP.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedEventSubSubscriptionsRequest")}constructor(e,t,r){super({url:"eventsub/subscriptions",userId:t,query:e},r,a=>new NP.HelixEventSubSubscription(a,r))}async getTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).total_cost}async getMaxTotalCost(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).max_total_cost}};Sn.HelixPaginatedEventSubSubscriptionsRequest=Mh;Sn.HelixPaginatedEventSubSubscriptionsRequest=Mh=MP.__decorate([(0,LP.rtfm)("api","HelixPaginatedEventSubSubscriptionsRequest")],Mh)});var Fh=u(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.HelixEventSubConduit=void 0;var rb=(f(),b(y)),QP=C(),ur=m(),Cl=class extends ur.DataObject{static{n(this,"HelixEventSubConduit")}constructor(e,t){super(e),this._client=t}get id(){return this[ur.rawDataSymbol].id}get shardCount(){return this[ur.rawDataSymbol].shard_count}async update(e){return await this._client.eventSub.updateConduit(this[ur.rawDataSymbol].id,e)}async delete(){await this._client.eventSub.deleteConduit(this[ur.rawDataSymbol].id)}async getShards(){return await this._client.eventSub.getConduitShards(this[ur.rawDataSymbol].id)}};Hn.HelixEventSubConduit=Cl;rb.__decorate([(0,QP.Enumerable)(!1)],Cl.prototype,"_client",void 0);Hn.HelixEventSubConduit=Cl=rb.__decorate([(0,ur.rtfm)("api","HelixEventSubConduit")],Cl)});var Qh=u(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HelixEventSubConduitShard=void 0;var GP=(f(),b(y)),Cn=m(),Nh=class extends Cn.DataObject{static{n(this,"HelixEventSubConduitShard")}get id(){return this[Cn.rawDataSymbol].id}get status(){return this[Cn.rawDataSymbol].status}get transportMethod(){return this[Cn.rawDataSymbol].transport.method}};qn.HelixEventSubConduitShard=Nh;qn.HelixEventSubConduitShard=Nh=GP.__decorate([(0,Cn.rtfm)("api","HelixEventSubConduitShard")],Nh)});var $h=u(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.HelixEventSubApi=void 0;var WP=(f(),b(y)),VP=C(),U=m(),H=eb(),Xe=Ue(),$P=ae(),En=ce(),Pn=se(),zP=Q(),An=Hl(),ql=Lh(),Gh=Fh(),Wh=Qh(),Vh=class extends zP.BaseApi{static{n(this,"HelixEventSubApi")}async getSubscriptions(e){let t=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:(0,Pn.createPaginationQuery)(e)});return{...(0,En.createPaginatedResultWithTotal)(t,An.HelixEventSubSubscription,this._client),totalCost:t.total_cost,maxTotalCost:t.max_total_cost}}getSubscriptionsPaginated(){return new ql.HelixPaginatedEventSubSubscriptionsRequest({},void 0,this._client)}async getSubscriptionsForStatus(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Pn.createPaginationQuery)(t),status:e}});return{...(0,En.createPaginatedResultWithTotal)(r,An.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForStatusPaginated(e){return new ql.HelixPaginatedEventSubSubscriptionsRequest({status:e},void 0,this._client)}async getSubscriptionsForType(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",query:{...(0,Pn.createPaginationQuery)(t),type:e}});return{...(0,En.createPaginatedResultWithTotal)(r,An.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForTypePaginated(e){return new ql.HelixPaginatedEventSubSubscriptionsRequest({type:e},void 0,this._client)}async getSubscriptionsForUser(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",userId:(0,U.extractUserId)(e),query:{...(0,Xe.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),...(0,Pn.createPaginationQuery)(t)}});return{...(0,En.createPaginatedResultWithTotal)(r,An.HelixEventSubSubscription,this._client),totalCost:r.total_cost,maxTotalCost:r.max_total_cost}}getSubscriptionsForUserPaginated(e){let t=(0,U.extractUserId)(e);return new ql.HelixPaginatedEventSubSubscriptionsRequest((0,Xe.createSingleKeyQuery)("user_id",t),t,this._client)}async createSubscription(e,t,r,a,s,o,l,d){let h=a.method==="webhook"||a.method==="conduit",p=h?void 0:o;if(!h&&!s)throw new Error(`Transport ${a.method} can only handle subscriptions with user context`);let x={type:e,version:t,condition:r,transport:a};d&&(x.is_batching_enabled=!0);let q=await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"POST",scopes:p,userId:(0,VP.mapOptional)(s,U.extractUserId),canOverrideScopedUserContext:l,forceType:h?"app":"user",jsonBody:x});return new An.HelixEventSubSubscription(q.data[0],this._client)}async deleteSubscription(e){await this._client.callApi({type:"helix",url:"eventsub/subscriptions",method:"DELETE",query:{id:e}})}async deleteAllSubscriptions(){await this._deleteSubscriptionsWithCondition()}async deleteBrokenSubscriptions(){await this._deleteSubscriptionsWithCondition(e=>e.status!=="enabled"&&e.status!=="webhook_callback_verification_pending")}async subscribeToStreamOnlineEvents(e,t){return await this.createSubscription("stream.online","1",(0,H.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToStreamOfflineEvents(e,t){return await this.createSubscription("stream.offline","1",(0,H.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelUpdateEvents(e,t){return await this.createSubscription("channel.update","2",(0,H.createEventSubBroadcasterCondition)(e),t,e)}async subscribeToChannelFollowEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.follow","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:followers"],!0)}async subscribeToChannelSubscriptionEvents(e,t){return await this.createSubscription("channel.subscribe","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionGiftEvents(e,t){return await this.createSubscription("channel.subscription.gift","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionMessageEvents(e,t){return await this.createSubscription("channel.subscription.message","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelSubscriptionEndEvents(e,t){return await this.createSubscription("channel.subscription.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:subscriptions"])}async subscribeToChannelCheerEvents(e,t){return await this.createSubscription("channel.cheer","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["bits:read"])}async subscribeToChannelCharityCampaignStartEvents(e,t){return await this.createSubscription("channel.charity_campaign.start","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignStopEvents(e,t){return await this.createSubscription("channel.charity_campaign.stop","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityDonationEvents(e,t){return await this.createSubscription("channel.charity_campaign.donate","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelCharityCampaignProgressEvents(e,t){return await this.createSubscription("channel.charity_campaign.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:charity"])}async subscribeToChannelBanEvents(e,t){return await this.createSubscription("channel.ban","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelUnbanEvents(e,t){return await this.createSubscription("channel.unban","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:moderate"])}async subscribeToChannelShieldModeBeginEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shield_mode.begin","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelShieldModeEndEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shield_mode.end","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shield_mode","moderator:manage:shield_mode"],!0)}async subscribeToChannelModeratorAddEvents(e,t){return await this.createSubscription("channel.moderator.add","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelModeratorRemoveEvents(e,t){return await this.createSubscription("channel.moderator.remove","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["moderation:read"])}async subscribeToChannelRaidEventsFrom(e,t){return await this.createSubscription("channel.raid","1",(0,Xe.createSingleKeyQuery)("from_broadcaster_user_id",(0,U.extractUserId)(e)),t,e)}async subscribeToChannelRaidEventsTo(e,t){return await this.createSubscription("channel.raid","1",(0,Xe.createSingleKeyQuery)("to_broadcaster_user_id",(0,U.extractUserId)(e)),t,e)}async subscribeToChannelRewardAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.add","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.update","1",(0,H.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRewardRemoveEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward.remove","1",(0,H.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionAddEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.add","1",(0,H.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEvents(e,t){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelRedemptionUpdateEventsForReward(e,t,r){return await this.createSubscription("channel.channel_points_custom_reward_redemption.update","1",(0,H.createEventSubRewardCondition)(e,t),r,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelAutomaticRewardRedemptionAddEvents(e,t){return await this.createSubscription("channel.channel_points_automatic_reward_redemption.add","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:redemptions","channel:manage:redemptions"])}async subscribeToChannelPollBeginEvents(e,t){return await this.createSubscription("channel.poll.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollProgressEvents(e,t){return await this.createSubscription("channel.poll.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPollEndEvents(e,t){return await this.createSubscription("channel.poll.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:polls","channel:manage:polls"])}async subscribeToChannelPredictionBeginEvents(e,t){return await this.createSubscription("channel.prediction.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionProgressEvents(e,t){return await this.createSubscription("channel.prediction.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionLockEvents(e,t){return await this.createSubscription("channel.prediction.lock","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelPredictionEndEvents(e,t){return await this.createSubscription("channel.prediction.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:predictions","channel:manage:predictions"])}async subscribeToChannelGoalBeginEvents(e,t){return await this.createSubscription("channel.goal.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalProgressEvents(e,t){return await this.createSubscription("channel.goal.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelGoalEndEvents(e,t){return await this.createSubscription("channel.goal.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:goals"])}async subscribeToChannelHypeTrainBeginEvents(e,t){return await this.createSubscription("channel.hype_train.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainProgressEvents(e,t){return await this.createSubscription("channel.hype_train.progress","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelHypeTrainEndEvents(e,t){return await this.createSubscription("channel.hype_train.end","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:hype_train"])}async subscribeToChannelShoutoutCreateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shoutout.create","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelShoutoutReceiveEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shoutout.receive","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,r,["moderator:read:shoutouts","moderator:manage:shoutouts"],!0)}async subscribeToChannelAdBreakBeginEvents(e,t){return await this.createSubscription("channel.ad_break.begin","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:ads"])}async subscribeToChannelChatClearEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.clear","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatClearUserMessagesEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.clear_user_messages","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageDeleteEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.message_delete","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatNotificationEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.notification","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatMessageEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.message","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatSettingsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat_settings.update","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelUnbanRequestCreateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.unban_request.create","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelUnbanRequestResolveEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.unban_request.resolve","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:unban_requests","moderator:manage:unban_requests"],!0)}async subscribeToChannelModerateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.moderate","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,[],!0)}async subscribeToChannelWarningAcknowledgeEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.warning.acknowledge","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelWarningSendEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.warning.send","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:warnings","moderator:manage:warnings"],!0)}async subscribeToChannelVipAddEvents(e,t){return await this.createSubscription("channel.vip.add","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToChannelVipRemoveEvents(e,t){return await this.createSubscription("channel.vip.remove","1",(0,H.createEventSubBroadcasterCondition)(e),t,e,["channel:read:vips","channel:manage:vips"])}async subscribeToExtensionBitsTransactionCreateEvents(e,t){return await this.createSubscription("extension.bits_transaction.create","1",(0,Xe.createSingleKeyQuery)("extension_client_id",e),t)}async subscribeToUserAuthorizationGrantEvents(e,t){return await this.createSubscription("user.authorization.grant","1",(0,Xe.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserAuthorizationRevokeEvents(e,t){return await this.createSubscription("user.authorization.revoke","1",(0,Xe.createSingleKeyQuery)("client_id",e),t)}async subscribeToUserUpdateEvents(e,t,r){return await this.createSubscription("user.update","1",(0,Xe.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),t,e,r?["user:read:email"]:void 0)}async subscribeToUserWhisperMessageEvents(e,t){return await this.createSubscription("user.whisper.message","1",(0,Xe.createSingleKeyQuery)("user_id",(0,U.extractUserId)(e)),t,e,["user:read:whispers","user:manage:whispers"])}async subscribeToDropEntitlementGrantEvents(e,t){return await this.createSubscription("drop.entitlement.grant","1",(0,H.createEventSubDropEntitlementGrantCondition)(e),t,void 0,void 0,!1,!0)}async subscribeToAutoModMessageHoldEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.hold","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageHoldV2Events(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.hold","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModMessageUpdateV2Events(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.message.update","2",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToAutoModSettingsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.settings.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:automod_settings"],!0)}async subscribeToAutoModTermsUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("automod.terms.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:manage:automod"],!0)}async subscribeToChannelChatUserMessageHoldEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_hold","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelChatUserMessageUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.chat.user_message_update","1",(0,H.createEventSubUserCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["user:read:chat"],!0)}async subscribeToChannelSuspiciousUserUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.update","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSuspiciousUserMessageEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.suspicious_user.message","1",(0,H.createEventSubModeratorCondition)(r,this._getUserContextIdWithDefault(r)),t,e,["moderator:read:suspicious_users"],!0)}async subscribeToChannelSharedChatSessionBeginEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.begin","1",(0,H.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionUpdateEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.update","1",(0,H.createEventSubBroadcasterCondition)(r),t,r)}async subscribeToChannelSharedChatSessionEndEvents(e,t){let r=(0,U.extractUserId)(e);return await this.createSubscription("channel.shared_chat.end","1",(0,H.createEventSubBroadcasterCondition)(r),t,r)}async getConduits(){return(await this._client.callApi({type:"helix",url:"eventsub/conduits"})).data.map(t=>new Gh.HelixEventSubConduit(t,this._client))}async createConduit(e){let t=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"POST",query:{...(0,Xe.createSingleKeyQuery)("shard_count",e.toString())}});return new Gh.HelixEventSubConduit(t.data[0],this._client)}async updateConduit(e,t){let r=await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"PATCH",query:(0,H.createEventSubConduitUpdateCondition)(e,t)});return new Gh.HelixEventSubConduit(r.data[0],this._client)}async deleteConduit(e){await this._client.callApi({type:"helix",url:"eventsub/conduits",method:"DELETE",query:{...(0,Xe.createSingleKeyQuery)("id",e)}})}async getConduitShards(e,t,r){let a=await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",query:{...(0,H.createEventSubConduitCondition)(e,t),...(0,Pn.createPaginationQuery)(r)}});return{...(0,En.createPaginatedResult)(a,Wh.HelixEventSubConduitShard,this._client)}}getConduitShardsPaginated(e,t){return new $P.HelixPaginatedRequest({url:"eventsub/conduits/shards",query:(0,H.createEventSubConduitCondition)(e,t)},this._client,r=>new Wh.HelixEventSubConduitShard(r))}async updateConduitShards(e,t){return(await this._client.callApi({type:"helix",url:"eventsub/conduits/shards",method:"PATCH",jsonBody:(0,H.createEventSubConduitShardsUpdateCondition)(e,t)})).data.map(a=>new Wh.HelixEventSubConduitShard(a))}async _deleteSubscriptionsWithCondition(e){let t=this.getSubscriptionsPaginated();for await(let r of t)(!e||e(r))&&await r.unsubscribe()}};Dn.HelixEventSubApi=Vh;Dn.HelixEventSubApi=Vh=WP.__decorate([(0,U.rtfm)("api","HelixEventSubApi")],Vh)});var ib=u(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.createExtensionTransactionQuery=Ft.createExtensionProductBody=Ft.createReleasedExtensionFilter=void 0;function KP(i,e){return{extension_id:i,extension_version:e}}n(KP,"createReleasedExtensionFilter");Ft.createReleasedExtensionFilter=KP;function JP(i){return{sku:i.sku,cost:{amount:i.cost,type:"bits"},display_name:i.displayName,in_development:i.inDevelopment,expiration:i.expirationDate,is_broadcast:i.broadcast}}n(JP,"createExtensionProductBody");Ft.createExtensionProductBody=JP;function ZP(i,e){return{extension_id:i,id:e.transactionIds}}n(ZP,"createExtensionTransactionQuery");Ft.createExtensionTransactionQuery=ZP});var zh=u(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.HelixChannelReference=void 0;var nb=(f(),b(y)),XP=C(),De=m(),El=class extends De.DataObject{static{n(this,"HelixChannelReference")}constructor(e,t){super(e),this._client=t}get id(){return this[De.rawDataSymbol].broadcaster_id}get displayName(){return this[De.rawDataSymbol].broadcaster_name}async getChannel(){return(0,De.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[De.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,De.checkRelationAssertion)(await this._client.users.getUserById(this[De.rawDataSymbol].broadcaster_id))}get gameId(){return this[De.rawDataSymbol].game_id}get gameName(){return this[De.rawDataSymbol].game_name}async getGame(){return this[De.rawDataSymbol].game_id?(0,De.checkRelationAssertion)(await this._client.games.getGameById(this[De.rawDataSymbol].game_id)):null}get title(){return this[De.rawDataSymbol].title}};In.HelixChannelReference=El;nb.__decorate([(0,XP.Enumerable)(!1)],El.prototype,"_client",void 0);In.HelixChannelReference=El=nb.__decorate([(0,De.rtfm)("api","HelixChannelReference","id")],El)});var Jh=u(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.HelixExtensionBitsProduct=void 0;var YP=(f(),b(y)),eA=C(),Nt=m(),Kh=class extends Nt.DataObject{static{n(this,"HelixExtensionBitsProduct")}get sku(){return this[Nt.rawDataSymbol].sku}get cost(){return this[Nt.rawDataSymbol].cost.amount}get displayName(){return this[Nt.rawDataSymbol].display_name}get inDevelopment(){return this[Nt.rawDataSymbol].in_development}get isBroadcast(){return this[Nt.rawDataSymbol].is_broadcast}get expirationDate(){return(0,eA.mapNullable)(this[Nt.rawDataSymbol].expiration,e=>new Date(e))}};Tn.HelixExtensionBitsProduct=Kh;Tn.HelixExtensionBitsProduct=Kh=YP.__decorate([(0,Nt.rtfm)("api","HelixExtensionBitsProduct","sku")],Kh)});var Zh=u(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.HelixExtensionTransaction=void 0;var ab=(f(),b(y)),tA=C(),de=m(),Pl=class extends de.DataObject{static{n(this,"HelixExtensionTransaction")}constructor(e,t){super(e),this._client=t}get id(){return this[de.rawDataSymbol].id}get transactionDate(){return new Date(this[de.rawDataSymbol].timestamp)}get broadcasterId(){return this[de.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[de.rawDataSymbol].broadcaster_name}get broadcasterDisplayName(){return this[de.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].broadcaster_id))}get userId(){return this[de.rawDataSymbol].user_id}get userName(){return this[de.rawDataSymbol].user_login}get userDisplayName(){return this[de.rawDataSymbol].user_name}async getUser(){return(0,de.checkRelationAssertion)(await this._client.users.getUserById(this[de.rawDataSymbol].user_id))}get productType(){return this[de.rawDataSymbol].product_type}get productSku(){return this[de.rawDataSymbol].product_data.sku}get productCost(){return this[de.rawDataSymbol].product_data.cost.amount}get productDisplayName(){return this[de.rawDataSymbol].product_data.displayName}get productInDevelopment(){return this[de.rawDataSymbol].product_data.inDevelopment}};Rn.HelixExtensionTransaction=Pl;ab.__decorate([(0,tA.Enumerable)(!1)],Pl.prototype,"_client",void 0);Rn.HelixExtensionTransaction=Pl=ab.__decorate([(0,de.rtfm)("api","HelixExtensionTransaction","id")],Pl)});var ep=u(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.HelixExtensionsApi=void 0;var rA=(f(),b(y)),hb=m(),Al=ib(),Xh=Ue(),sb=ae(),ob=ce(),lb=se(),iA=Q(),ub=zh(),cb=Jh(),db=Zh(),Yh=class extends iA.BaseApi{static{n(this,"HelixExtensionsApi")}async getReleasedExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/released",query:(0,Al.createReleasedExtensionFilter)(e,t)});return new hb.HelixExtension(r.data[0])}async getLiveChannelsWithExtension(e,t){let r=await this._client.callApi({type:"helix",url:"extensions/live",query:{...(0,Xh.createSingleKeyQuery)("extension_id",e),...(0,lb.createPaginationQuery)(t)}});return(0,ob.createPaginatedResult)(r,ub.HelixChannelReference,this._client)}getLiveChannelsWithExtensionPaginated(e){return new sb.HelixPaginatedRequest({url:"extensions/live",query:(0,Xh.createSingleKeyQuery)("extension_id",e)},this._client,t=>new ub.HelixChannelReference(t,this._client))}async getExtensionBitsProducts(e){return(await this._client.callApi({type:"helix",url:"bits/extensions",forceType:"app",query:(0,Xh.createSingleKeyQuery)("should_include_all",e?.toString())})).data.map(r=>new cb.HelixExtensionBitsProduct(r))}async putExtensionBitsProduct(e){let t=await this._client.callApi({type:"helix",url:"bits/extensions",method:"PUT",forceType:"app",jsonBody:(0,Al.createExtensionProductBody)(e)});return new cb.HelixExtensionBitsProduct(t.data[0])}async getExtensionTransactions(e,t={}){let r=await this._client.callApi({type:"helix",url:"extensions/transactions",forceType:"app",query:{...(0,Al.createExtensionTransactionQuery)(e,t),...(0,lb.createPaginationQuery)(t)}});return(0,ob.createPaginatedResult)(r,db.HelixExtensionTransaction,this._client)}getExtensionTransactionsPaginated(e,t={}){return new sb.HelixPaginatedRequest({url:"extensions/transactions",forceType:"app",query:(0,Al.createExtensionTransactionQuery)(e,t)},this._client,r=>new db.HelixExtensionTransaction(r,this._client))}};Un.HelixExtensionsApi=Yh;Un.HelixExtensionsApi=Yh=rA.__decorate([(0,hb.rtfm)("api","HelixExtensionsApi")],Yh)});var Il=u(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.HelixGame=void 0;var pb=(f(),b(y)),nA=C(),St=m(),Dl=class extends St.DataObject{static{n(this,"HelixGame")}constructor(e,t){super(e),this._client=t}get id(){return this[St.rawDataSymbol].id}get name(){return this[St.rawDataSymbol].name}get boxArtUrl(){return this[St.rawDataSymbol].box_art_url}get igdbId(){return this[St.rawDataSymbol].igdb_id||null}getBoxArtUrl(e,t){return this[St.rawDataSymbol].box_art_url.replace("{width}",e.toString()).replace("{height}",t.toString())}async getStreams(e){return await this._client.streams.getStreams({...e,game:this[St.rawDataSymbol].id})}getStreamsPaginated(){return this._client.streams.getStreamsPaginated({game:this[St.rawDataSymbol].id})}};Bn.HelixGame=Dl;pb.__decorate([(0,nA.Enumerable)(!1)],Dl.prototype,"_client",void 0);Bn.HelixGame=Dl=pb.__decorate([(0,St.rtfm)("api","HelixGame","id")],Dl)});var ip=u(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.HelixGameApi=void 0;var Tl=(f(),b(y)),rp=C(),aA=m(),tp=Bt(),sA=ae(),oA=ce(),lA=se(),uA=Q(),Wr=Il(),Vr=class extends uA.BaseApi{static{n(this,"HelixGameApi")}constructor(){super(...arguments),this._getGameByIdBatcher=new tp.HelixRequestBatcher({url:"games"},"id","id",this._client,e=>new Wr.HelixGame(e,this._client)),this._getGameByNameBatcher=new tp.HelixRequestBatcher({url:"games"},"name","name",this._client,e=>new Wr.HelixGame(e,this._client)),this._getGameByIgdbIdBatcher=new tp.HelixRequestBatcher({url:"games"},"igdb_id","igdb_id",this._client,e=>new Wr.HelixGame(e,this._client))}async getGamesByIds(e){return await this._getGames("id",e)}async getGamesByNames(e){return await this._getGames("name",e)}async getGamesByIgdbIds(e){return await this._getGames("igdb_id",e)}async getGameById(e){var t;return(t=(await this._getGames("id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByName(e){var t;return(t=(await this._getGames("name",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIgdbId(e){var t;return(t=(await this._getGames("igdb_id",[e]))[0])!==null&&t!==void 0?t:null}async getGameByIdBatched(e){return await this._getGameByIdBatcher.request(e)}async getGameByNameBatched(e){return await this._getGameByNameBatcher.request(e)}async getGameByIgdbIdBatched(e){return await this._getGameByIgdbIdBatcher.request(e)}async getTopGames(e){let t=await this._client.callApi({type:"helix",url:"games/top",query:(0,lA.createPaginationQuery)(e)});return(0,oA.createPaginatedResult)(t,Wr.HelixGame,this._client)}getTopGamesPaginated(){return new sA.HelixPaginatedRequest({url:"games/top"},this._client,e=>new Wr.HelixGame(e,this._client))}async _getGames(e,t){return t.length?(await this._client.callApi({type:"helix",url:"games",query:{[e]:t}})).data.map(a=>new Wr.HelixGame(a,this._client)):[]}};On.HelixGameApi=Vr;Tl.__decorate([(0,rp.Enumerable)(!1)],Vr.prototype,"_getGameByIdBatcher",void 0);Tl.__decorate([(0,rp.Enumerable)(!1)],Vr.prototype,"_getGameByNameBatcher",void 0);Tl.__decorate([(0,rp.Enumerable)(!1)],Vr.prototype,"_getGameByIgdbIdBatcher",void 0);On.HelixGameApi=Vr=Tl.__decorate([(0,aA.rtfm)("api","HelixGameApi")],Vr)});var np=u(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.HelixGoal=void 0;var mb=(f(),b(y)),cA=C(),Oe=m(),Rl=class extends Oe.DataObject{static{n(this,"HelixGoal")}constructor(e,t){super(e),this._client=t}get id(){return this[Oe.rawDataSymbol].id}get broadcasterId(){return this[Oe.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Oe.rawDataSymbol].broadcaster_name}get broadcasterName(){return this[Oe.rawDataSymbol].broadcaster_login}async getBroadcaster(){return(0,Oe.checkRelationAssertion)(await this._client.users.getUserById(this[Oe.rawDataSymbol].broadcaster_id))}get type(){return this[Oe.rawDataSymbol].type}get description(){return this[Oe.rawDataSymbol].description}get currentAmount(){return this[Oe.rawDataSymbol].current_amount}get targetAmount(){return this[Oe.rawDataSymbol].target_amount}get creationDate(){return this[Oe.rawDataSymbol].created_at}};jn.HelixGoal=Rl;mb.__decorate([(0,cA.Enumerable)(!1)],Rl.prototype,"_client",void 0);jn.HelixGoal=Rl=mb.__decorate([(0,Oe.rtfm)("api","HelixGoal","id")],Rl)});var sp=u(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.HelixGoalApi=void 0;var dA=(f(),b(y)),hA=Z(),_b=m(),pA=Q(),mA=np(),ap=class extends pA.BaseApi{static{n(this,"HelixGoalApi")}async getGoals(e){return(await this._client.callApi({type:"helix",url:"goals",userId:(0,_b.extractUserId)(e),scopes:["channel:read:goals"],query:(0,hA.createBroadcasterQuery)(e)})).data.map(r=>new mA.HelixGoal(r,this._client))}};kn.HelixGoalApi=ap;kn.HelixGoalApi=ap=dA.__decorate([(0,_b.rtfm)("api","HelixGoalApi")],ap)});var op=u(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.HelixHypeTrainContribution=void 0;var yb=(f(),b(y)),_A=C(),cr=m(),Ul=class extends cr.DataObject{static{n(this,"HelixHypeTrainContribution")}constructor(e,t){super(e),this._client=t}get userId(){return this[cr.rawDataSymbol].user}async getUser(){return(0,cr.checkRelationAssertion)(await this._client.users.getUserById(this[cr.rawDataSymbol].user))}get type(){return this[cr.rawDataSymbol].type}get total(){return this[cr.rawDataSymbol].total}};Mn.HelixHypeTrainContribution=Ul;yb.__decorate([(0,_A.Enumerable)(!1)],Ul.prototype,"_client",void 0);Mn.HelixHypeTrainContribution=Ul=yb.__decorate([(0,cr.rtfm)("api","HelixHypeTrainContribution","userId")],Ul)});var lp=u(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.HelixHypeTrainEvent=void 0;var gb=(f(),b(y)),yA=C(),_e=m(),fb=op(),Bl=class extends _e.DataObject{static{n(this,"HelixHypeTrainEvent")}constructor(e,t){super(e),this._client=t}get eventId(){return this[_e.rawDataSymbol].id}get eventType(){return this[_e.rawDataSymbol].event_type}get eventDate(){return new Date(this[_e.rawDataSymbol].event_timestamp)}get eventVersion(){return this[_e.rawDataSymbol].version}get id(){return this[_e.rawDataSymbol].event_data.id}get broadcasterId(){return this[_e.rawDataSymbol].event_data.broadcaster_id}async getBroadcaster(){return(0,_e.checkRelationAssertion)(await this._client.users.getUserById(this[_e.rawDataSymbol].event_data.broadcaster_id))}get level(){return this[_e.rawDataSymbol].event_data.level}get startDate(){return new Date(this[_e.rawDataSymbol].event_data.started_at)}get expiryDate(){return new Date(this[_e.rawDataSymbol].event_data.expires_at)}get cooldownDate(){return new Date(this[_e.rawDataSymbol].event_data.cooldown_end_time)}get total(){return this[_e.rawDataSymbol].event_data.total}get goal(){return this[_e.rawDataSymbol].event_data.goal}get lastContribution(){return new fb.HelixHypeTrainContribution(this[_e.rawDataSymbol].event_data.last_contribution,this._client)}get topContributions(){return this[_e.rawDataSymbol].event_data.top_contributions.map(e=>new fb.HelixHypeTrainContribution(e,this._client))}};Ln.HelixHypeTrainEvent=Bl;gb.__decorate([(0,yA.Enumerable)(!1)],Bl.prototype,"_client",void 0);Ln.HelixHypeTrainEvent=Bl=gb.__decorate([(0,_e.rtfm)("api","HelixHypeTrainEvent","id")],Bl)});var cp=u(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.HelixHypeTrainApi=void 0;var bb=Z(),xb=m(),fA=ae(),gA=ce(),bA=se(),xA=Q(),wb=lp(),up=class extends xA.BaseApi{static{n(this,"HelixHypeTrainApi")}async getHypeTrainEventsForBroadcaster(e,t){let r=await this._client.callApi({type:"helix",url:"hypetrain/events",userId:(0,xb.extractUserId)(e),scopes:["channel:read:hype_train"],query:{...(0,bb.createBroadcasterQuery)(e),...(0,bA.createPaginationQuery)(t)}});return(0,gA.createPaginatedResult)(r,wb.HelixHypeTrainEvent,this._client)}getHypeTrainEventsForBroadcasterPaginated(e){return new fA.HelixPaginatedRequest({url:"hypetrain/events",userId:(0,xb.extractUserId)(e),scopes:["channel:read:hype_train"],query:(0,bb.createBroadcasterQuery)(e)},this._client,t=>new wb.HelixHypeTrainEvent(t,this._client))}};Ol.HelixHypeTrainApi=up});var vb=u(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.createWarnUserBody=le.createCheckAutoModStatusBody=le.createUpdateShieldModeStatusBody=le.createBanUserBody=le.createAutoModSettingsBody=le.createAutoModProcessBody=le.createResolveUnbanRequestQuery=le.createModeratorModifyQuery=le.createModerationUserListQuery=void 0;var Qt=m();function wA(i,e){return{broadcaster_id:(0,Qt.extractUserId)(i),user_id:e?.userId}}n(wA,"createModerationUserListQuery");le.createModerationUserListQuery=wA;function vA(i,e){return{broadcaster_id:(0,Qt.extractUserId)(i),user_id:(0,Qt.extractUserId)(e)}}n(vA,"createModeratorModifyQuery");le.createModeratorModifyQuery=vA;function SA(i,e,t,r,a){return{unban_request_id:t,broadcaster_id:(0,Qt.extractUserId)(i),moderator_id:(0,Qt.extractUserId)(e),status:r?"approved":"denied",resolution_text:a}}n(SA,"createResolveUnbanRequestQuery");le.createResolveUnbanRequestQuery=SA;function HA(i,e,t){return{user_id:(0,Qt.extractUserId)(i),msg_id:e,action:t?"ALLOW":"DENY"}}n(HA,"createAutoModProcessBody");le.createAutoModProcessBody=HA;function CA(i){return{overall_level:i.overallLevel,aggression:i.aggression,bullying:i.bullying,disability:i.disability,misogyny:i.misogyny,race_ethnicity_or_religion:i.raceEthnicityOrReligion,sex_based_terms:i.sexBasedTerms,sexuality_sex_or_gender:i.sexualitySexOrGender,swearing:i.swearing}}n(CA,"createAutoModSettingsBody");le.createAutoModSettingsBody=CA;function qA(i){return{data:{duration:i.duration,reason:i.reason,user_id:(0,Qt.extractUserId)(i.user)}}}n(qA,"createBanUserBody");le.createBanUserBody=qA;function EA(i){return{is_active:i}}n(EA,"createUpdateShieldModeStatusBody");le.createUpdateShieldModeStatusBody=EA;function PA(i){return{data:i.map(e=>({msg_id:e.messageId,msg_text:e.messageText}))}}n(PA,"createCheckAutoModStatusBody");le.createCheckAutoModStatusBody=PA;function AA(i,e){return{data:{user_id:(0,Qt.extractUserId)(i),reason:e}}}n(AA,"createWarnUserBody");le.createWarnUserBody=AA});var Sb=u(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.HelixAutoModSettings=void 0;var DA=(f(),b(y)),Ie=m(),dp=class extends Ie.DataObject{static{n(this,"HelixAutoModSettings")}get broadcasterId(){return this[Ie.rawDataSymbol].broadcaster_id}get moderatorId(){return this[Ie.rawDataSymbol].moderator_id}get overallLevel(){return this[Ie.rawDataSymbol].overall_level?this[Ie.rawDataSymbol].overall_level:null}get disability(){return this[Ie.rawDataSymbol].disability}get aggression(){return this[Ie.rawDataSymbol].aggression}get sexualitySexOrGender(){return this[Ie.rawDataSymbol].sexuality_sex_or_gender}get misogyny(){return this[Ie.rawDataSymbol].misogyny}get bullying(){return this[Ie.rawDataSymbol].bullying}get swearing(){return this[Ie.rawDataSymbol].swearing}get raceEthnicityOrReligion(){return this[Ie.rawDataSymbol].race_ethnicity_or_religion}get sexBasedTerms(){return this[Ie.rawDataSymbol].sex_based_terms}};Fn.HelixAutoModSettings=dp;Fn.HelixAutoModSettings=dp=DA.__decorate([(0,Ie.rtfm)("api","HelixAutoModSettings","broadcasterId")],dp)});var Hb=u(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.HelixAutoModStatus=void 0;var IA=(f(),b(y)),jl=m(),hp=class extends jl.DataObject{static{n(this,"HelixAutoModStatus")}get messageId(){return this[jl.rawDataSymbol].msg_id}get isPermitted(){return this[jl.rawDataSymbol].is_permitted}};Nn.HelixAutoModStatus=hp;Nn.HelixAutoModStatus=hp=IA.__decorate([(0,jl.rtfm)("api","HelixAutoModStatus","messageId")],hp)});var kl=u(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.HelixBanUser=void 0;var pp=(f(),b(y)),mp=C(),Ht=m(),Qn=class extends Ht.DataObject{static{n(this,"HelixBanUser")}constructor(e,t,r){super(e),this._expiryTimestamp=t,this._client=r}get creationDate(){return new Date(this[Ht.rawDataSymbol].created_at)}get expiryDate(){return(0,mp.mapNullable)(this._expiryTimestamp,e=>new Date(e))}get moderatorId(){return this[Ht.rawDataSymbol].moderator_id}async getModerator(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].moderator_id))}get userId(){return this[Ht.rawDataSymbol].user_id}async getUser(){return(0,Ht.checkRelationAssertion)(await this._client.users.getUserById(this[Ht.rawDataSymbol].user_id))}};Gn.HelixBanUser=Qn;pp.__decorate([(0,mp.Enumerable)(!1)],Qn.prototype,"_client",void 0);pp.__decorate([(0,mp.Enumerable)(!1)],Qn.prototype,"_expiryTimestamp",void 0);Gn.HelixBanUser=Qn=pp.__decorate([(0,Ht.rtfm)("api","HelixBanUser","userId")],Qn)});var yp=u(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.HelixBan=void 0;var TA=(f(),b(y)),$r=m(),RA=kl(),_p=class extends RA.HelixBanUser{static{n(this,"HelixBan")}constructor(e,t){super(e,e.expires_at||null,t)}get userName(){return this[$r.rawDataSymbol].user_login}get userDisplayName(){return this[$r.rawDataSymbol].user_name}get moderatorName(){return this[$r.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[$r.rawDataSymbol].moderator_name}get reason(){return this[$r.rawDataSymbol].reason||null}};Wn.HelixBan=_p;Wn.HelixBan=_p=TA.__decorate([(0,$r.rtfm)("api","HelixBan","userId")],_p)});var gp=u(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.HelixBlockedTerm=void 0;var UA=(f(),b(y)),ht=m(),fp=class extends ht.DataObject{static{n(this,"HelixBlockedTerm")}get broadcasterId(){return this[ht.rawDataSymbol].broadcaster_id}get creationDate(){return new Date(this[ht.rawDataSymbol].created_at)}get expirationDate(){return this[ht.rawDataSymbol].expires_at?new Date(this[ht.rawDataSymbol].expires_at):null}get id(){return this[ht.rawDataSymbol].id}get moderatorId(){return this[ht.rawDataSymbol].moderator_id}get text(){return this[ht.rawDataSymbol].text}get updatedDate(){return new Date(this[ht.rawDataSymbol].updated_at)}};Vn.HelixBlockedTerm=fp;Vn.HelixBlockedTerm=fp=UA.__decorate([(0,ht.rtfm)("api","HelixBlockedTerm","id")],fp)});var bp=u($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.HelixModeratedChannel=void 0;var Cb=(f(),b(y)),BA=C(),Ct=m(),Ml=class extends Ct.DataObject{static{n(this,"HelixModeratedChannel")}constructor(e,t){super(e),this._client=t}get id(){return this[Ct.rawDataSymbol].broadcaster_id}get name(){return this[Ct.rawDataSymbol].broadcaster_login}get displayName(){return this[Ct.rawDataSymbol].broadcaster_name}async getChannel(){return(0,Ct.checkRelationAssertion)(await this._client.channels.getChannelInfoById(this[Ct.rawDataSymbol].broadcaster_id))}async getBroadcaster(){return(0,Ct.checkRelationAssertion)(await this._client.users.getUserById(this[Ct.rawDataSymbol].broadcaster_id))}};$n.HelixModeratedChannel=Ml;Cb.__decorate([(0,BA.Enumerable)(!1)],Ml.prototype,"_client",void 0);$n.HelixModeratedChannel=Ml=Cb.__decorate([(0,Ct.rtfm)("api","HelixModeratedChannel","id")],Ml)});var xp=u(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.HelixModerator=void 0;var qb=(f(),b(y)),OA=C(),dr=m(),Ll=class extends dr.DataObject{static{n(this,"HelixModerator")}constructor(e,t){super(e),this._client=t}get userId(){return this[dr.rawDataSymbol].user_id}get userName(){return this[dr.rawDataSymbol].user_login}get userDisplayName(){return this[dr.rawDataSymbol].user_name}async getUser(){return(0,dr.checkRelationAssertion)(await this._client.users.getUserById(this[dr.rawDataSymbol].user_id))}};zn.HelixModerator=Ll;qb.__decorate([(0,OA.Enumerable)(!1)],Ll.prototype,"_client",void 0);zn.HelixModerator=Ll=qb.__decorate([(0,dr.rtfm)("api","HelixModerator","userId")],Ll)});var wp=u(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.HelixShieldModeStatus=void 0;var Eb=(f(),b(y)),jA=C(),pt=m(),Fl=class extends pt.DataObject{static{n(this,"HelixShieldModeStatus")}constructor(e,t){super(e),this._client=t}get isActive(){return this[pt.rawDataSymbol].is_active}get moderatorId(){return this[pt.rawDataSymbol].moderator_id}get moderatorName(){return this[pt.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[pt.rawDataSymbol].moderator_name}async getModerator(){return(0,pt.checkRelationAssertion)(await this._client.users.getUserById(this[pt.rawDataSymbol].moderator_id))}get lastActivationDate(){return this[pt.rawDataSymbol].last_activated_at===""?null:new Date(this[pt.rawDataSymbol].last_activated_at)}};Kn.HelixShieldModeStatus=Fl;Eb.__decorate([(0,jA.Enumerable)(!1)],Fl.prototype,"_client",void 0);Kn.HelixShieldModeStatus=Fl=Eb.__decorate([(0,pt.rtfm)("api","HelixShieldModeStatus")],Fl)});var vp=u(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.HelixUnbanRequest=void 0;var Pb=(f(),b(y)),Ab=C(),Y=m(),Nl=class extends Y.DataObject{static{n(this,"HelixUnbanRequest")}constructor(e,t){super(e),this._client=t}get id(){return this[Y.rawDataSymbol].id}get broadcasterId(){return this[Y.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[Y.rawDataSymbol].broadcaster_id}get broadcasterDisplayName(){return this[Y.rawDataSymbol].broadcaster_id}async getBroadcaster(){return(0,Y.checkRelationAssertion)(await this._client.users.getUserById(this[Y.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[Y.rawDataSymbol].moderator_id}get moderatorName(){return this[Y.rawDataSymbol].moderator_login}get moderatorDisplayName(){return this[Y.rawDataSymbol].moderator_name}async getModerator(){return(0,Y.checkRelationAssertion)(await this._client.users.getUserById(this[Y.rawDataSymbol].moderator_id))}get userId(){return this[Y.rawDataSymbol].user_id}get userName(){return this[Y.rawDataSymbol].user_login}get userDisplayName(){return this[Y.rawDataSymbol].user_name}async getUser(){return(0,Y.checkRelationAssertion)(await this._client.users.getUserById(this[Y.rawDataSymbol].user_id))}get message(){return this[Y.rawDataSymbol].text}get creationDate(){return new Date(this[Y.rawDataSymbol].created_at)}get resolutionMessage(){return this[Y.rawDataSymbol].resolution_text||null}get resolutionDate(){return(0,Ab.mapNullable)(this[Y.rawDataSymbol].resolved_at,e=>new Date(e))}};Jn.HelixUnbanRequest=Nl;Pb.__decorate([(0,Ab.Enumerable)(!1)],Nl.prototype,"_client",void 0);Jn.HelixUnbanRequest=Nl=Pb.__decorate([(0,Y.rtfm)("api","HelixUnbanRequest","id")],Nl)});var Sp=u(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.HelixWarning=void 0;var Db=(f(),b(y)),kA=C(),Ve=m(),Ql=class extends Ve.DataObject{static{n(this,"HelixWarning")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[Ve.rawDataSymbol].user_id}async getBroadcaster(){return(0,Ve.checkRelationAssertion)(await this._client.users.getUserById(this[Ve.rawDataSymbol].broadcaster_id))}get moderatorId(){return this[Ve.rawDataSymbol].moderator_id}async getModerator(){return(0,Ve.checkRelationAssertion)(await this._client.users.getUserById(this[Ve.rawDataSymbol].moderator_id))}get userId(){return this[Ve.rawDataSymbol].user_id}async getUser(){return(0,Ve.checkRelationAssertion)(await this._client.users.getUserById(this[Ve.rawDataSymbol].user_id))}get reason(){return this[Ve.rawDataSymbol].reason}};Zn.HelixWarning=Ql;Db.__decorate([(0,kA.Enumerable)(!1)],Ql.prototype,"_client",void 0);Zn.HelixWarning=Ql=Db.__decorate([(0,Ve.rtfm)("api","HelixWarning","userId")],Ql)});var Ep=u(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.HelixModerationApi=void 0;var MA=(f(),b(y)),Hp=Z(),M=m(),hr=Ue(),Ye=vb(),Gl=ae(),Xn=ce(),Yn=se(),LA=Q(),Ib=Sb(),FA=Hb(),Tb=yp(),NA=kl(),Rb=gp(),Ub=bp(),Bb=xp(),Ob=wp(),Cp=vp(),QA=Sp(),qp=class extends LA.BaseApi{static{n(this,"HelixModerationApi")}async getBannedUsers(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/banned",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:{...(0,Ye.createModerationUserListQuery)(e,t),...(0,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(r,Tb.HelixBan,this._client)}getBannedUsersPaginated(e){return new Gl.HelixPaginatedRequest({url:"moderation/banned",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:(0,Hp.createBroadcasterQuery)(e)},this._client,t=>new Tb.HelixBan(t,this._client),50)}async checkUserBan(e,t){let r=(0,M.extractUserId)(t);return(await this.getBannedUsers(e,{userId:r})).data.some(s=>s.userId===r)}async getModerators(e,t){let r=await this._client.callApi({type:"helix",url:"moderation/moderators",userId:(0,M.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:{...(0,Ye.createModerationUserListQuery)(e,t),...(0,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(r,Bb.HelixModerator,this._client)}getModeratorsPaginated(e){return new Gl.HelixPaginatedRequest({url:"moderation/moderators",userId:(0,M.extractUserId)(e),scopes:["moderation:read","channel:manage:moderators"],query:(0,Hp.createBroadcasterQuery)(e)},this._client,t=>new Bb.HelixModerator(t,this._client))}async getModeratedChannels(e,t){let r=(0,M.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/channels",userId:r,scopes:["user:read:moderated_channels"],query:{...(0,hr.createSingleKeyQuery)("user_id",r),...(0,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(a,Ub.HelixModeratedChannel,this._client)}getModeratedChannelsPaginated(e){let t=(0,M.extractUserId)(e);return new Gl.HelixPaginatedRequest({url:"moderation/channels",userId:t,scopes:["user:read:moderated_channels"],query:(0,hr.createSingleKeyQuery)("user_id",t)},this._client,r=>new Ub.HelixModeratedChannel(r,this._client))}async checkUserMod(e,t){let r=(0,M.extractUserId)(t);return(await this.getModerators(e,{userId:r})).data.some(s=>s.userId===r)}async addModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"POST",userId:(0,M.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,Ye.createModeratorModifyQuery)(e,t)})}async removeModerator(e,t){await this._client.callApi({type:"helix",url:"moderation/moderators",method:"DELETE",userId:(0,M.extractUserId)(e),scopes:["channel:manage:moderators"],query:(0,Ye.createModeratorModifyQuery)(e,t)})}async checkAutoModStatus(e,t){return(await this._client.callApi({type:"helix",url:"moderation/enforcements/status",method:"POST",userId:(0,M.extractUserId)(e),scopes:["moderation:read"],query:(0,Hp.createBroadcasterQuery)(e),jsonBody:(0,Ye.createCheckAutoModStatusBody)(t)})).data.map(a=>new FA.HelixAutoModStatus(a))}async processHeldAutoModMessage(e,t,r){await this._client.callApi({type:"helix",url:"moderation/automod/message",method:"POST",userId:(0,M.extractUserId)(e),scopes:["moderator:manage:automod"],jsonBody:(0,Ye.createAutoModProcessBody)(e,t,r)})}async getAutoModSettings(e){let t=(0,M.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",userId:t,scopes:["moderator:read:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)})).data.map(a=>new Ib.HelixAutoModSettings(a))}async updateAutoModSettings(e,t){let r=(0,M.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/automod/settings",method:"PUT",userId:r,scopes:["moderator:manage:automod_settings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,Ye.createAutoModSettingsBody)(t)})).data.map(s=>new Ib.HelixAutoModSettings(s))}async banUser(e,t){let r=(0,M.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/bans",method:"POST",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,Ye.createBanUserBody)(t)})).data.map(s=>new NA.HelixBanUser(s,s.end_time,this._client))}async unbanUser(e,t){let r=(0,M.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/bans",method:"DELETE",userId:r,scopes:["moderator:manage:banned_users"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,hr.createSingleKeyQuery)("user_id",(0,M.extractUserId)(t))}})}async getBlockedTerms(e,t){let r=(0,M.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/blocked_terms",userId:r,scopes:["moderator:read:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,Yn.createPaginationQuery)(t)}});return(0,Xn.createPaginatedResult)(a,Rb.HelixBlockedTerm,this._client)}async addBlockedTerm(e,t){let r=(0,M.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"POST",userId:r,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:{text:t}})).data.map(s=>new Rb.HelixBlockedTerm(s))}async removeBlockedTerm(e,t,r){let a=(0,M.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/blocked_terms",method:"DELETE",userId:a,scopes:["moderator:manage:blocked_terms"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),id:r}})}async deleteChatMessages(e,t){let r=(0,M.extractUserId)(e);await this._client.callApi({type:"helix",url:"moderation/chat",method:"DELETE",userId:r,scopes:["moderator:manage:chat_messages"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,hr.createSingleKeyQuery)("message_id",t)}})}async getShieldModeStatus(e){let t=(0,M.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"GET",userId:t,scopes:["moderator:read:shield_mode","moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(t)});return new Ob.HelixShieldModeStatus(r.data[0],this._client)}async updateShieldModeStatus(e,t){let r=(0,M.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"moderation/shield_mode",method:"PUT",userId:r,scopes:["moderator:manage:shield_mode"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(r),jsonBody:(0,Ye.createUpdateShieldModeStatusBody)(t)});return new Ob.HelixShieldModeStatus(a.data[0],this._client)}async getUnbanRequests(e,t,r){let a=(0,M.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"GET",userId:a,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(a),...(0,hr.createSingleKeyQuery)("status",t),...(0,Yn.createPaginationQuery)(r)}});return(0,Xn.createPaginatedResult)(s,Cp.HelixUnbanRequest,this._client)}getUnbanRequestsPaginated(e,t){let r=(0,M.extractUserId)(e);return new Gl.HelixPaginatedRequest({url:"moderation/unban_requests",method:"GET",userId:r,scopes:["moderator:read:unban_requests","moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:{...this._createModeratorActionQuery(r),...(0,hr.createSingleKeyQuery)("status",t)}},this._client,a=>new Cp.HelixUnbanRequest(a,this._client))}async resolveUnbanRequest(e,t,r,a){let s=(0,M.extractUserId)(e),o=await this._client.callApi({type:"helix",url:"moderation/unban_requests",method:"PATCH",userId:s,scopes:["moderator:manage:unban_requests"],canOverrideScopedUserContext:!0,query:(0,Ye.createResolveUnbanRequestQuery)(s,this._getUserContextIdWithDefault(s),t,r,a?.slice(0,500))});return new Cp.HelixUnbanRequest(o.data[0],this._client)}async warnUser(e,t,r){let a=(0,M.extractUserId)(e),s=await this._client.callApi({type:"helix",url:"moderation/warnings",method:"POST",userId:a,scopes:["moderator:manage:warnings"],canOverrideScopedUserContext:!0,query:this._createModeratorActionQuery(a),jsonBody:(0,Ye.createWarnUserBody)(t,r.slice(0,500))});return new QA.HelixWarning(s.data[0],this._client)}_createModeratorActionQuery(e){return(0,hr.createModeratorActionQuery)(e,this._getUserContextIdWithDefault(e))}};ea.HelixModerationApi=qp;ea.HelixModerationApi=qp=MA.__decorate([(0,M.rtfm)("api","HelixModerationApi")],qp)});var kb=u(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.createPollEndBody=zr.createPollBody=void 0;var jb=m();function GA(i,e){var t;return{broadcaster_id:(0,jb.extractUserId)(i),title:e.title,choices:e.choices.map(r=>({title:r})),duration:e.duration,channel_points_voting_enabled:e.channelPointsPerVote!=null,channel_points_per_vote:(t=e.channelPointsPerVote)!==null&&t!==void 0?t:0}}n(GA,"createPollBody");zr.createPollBody=GA;function WA(i,e,t){return{broadcaster_id:(0,jb.extractUserId)(i),id:e,status:t?"TERMINATED":"ARCHIVED"}}n(WA,"createPollEndBody");zr.createPollEndBody=WA});var Ap=u(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.HelixPollChoice=void 0;var VA=(f(),b(y)),Kr=m(),Pp=class extends Kr.DataObject{static{n(this,"HelixPollChoice")}get id(){return this[Kr.rawDataSymbol].id}get title(){return this[Kr.rawDataSymbol].title}get totalVotes(){return this[Kr.rawDataSymbol].votes}get channelPointsVotes(){return this[Kr.rawDataSymbol].channel_points_votes}};ta.HelixPollChoice=Pp;ta.HelixPollChoice=Pp=VA.__decorate([(0,Kr.rtfm)("api","HelixPollChoice","id")],Pp)});var Dp=u(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.HelixPoll=void 0;var Mb=(f(),b(y)),$A=C(),He=m(),zA=Ap(),Wl=class extends He.DataObject{static{n(this,"HelixPoll")}constructor(e,t){super(e),this._client=t}get id(){return this[He.rawDataSymbol].id}get broadcasterId(){return this[He.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[He.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[He.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,He.checkRelationAssertion)(await this._client.users.getUserById(this[He.rawDataSymbol].broadcaster_id))}get title(){return this[He.rawDataSymbol].title}get isChannelPointsVotingEnabled(){return this[He.rawDataSymbol].channel_points_voting_enabled}get channelPointsPerVote(){return this[He.rawDataSymbol].channel_points_per_vote}get status(){return this[He.rawDataSymbol].status}get durationInSeconds(){return this[He.rawDataSymbol].duration}get startDate(){return new Date(this[He.rawDataSymbol].started_at)}get endDate(){return new Date(this.startDate.getTime()+this[He.rawDataSymbol].duration*1e3)}get choices(){return this[He.rawDataSymbol].choices.map(e=>new zA.HelixPollChoice(e))}};ra.HelixPoll=Wl;Mb.__decorate([(0,$A.Enumerable)(!1)],Wl.prototype,"_client",void 0);ra.HelixPoll=Wl=Mb.__decorate([(0,He.rtfm)("api","HelixPoll","id")],Wl)});var Tp=u(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.HelixPollApi=void 0;var KA=(f(),b(y)),Lb=Z(),Jr=m(),JA=Ue(),Fb=kb(),ZA=ae(),XA=ce(),YA=se(),eD=Q(),ia=Dp(),Ip=class extends eD.BaseApi{static{n(this,"HelixPollApi")}async getPolls(e,t){let r=await this._client.callApi({type:"helix",url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:{...(0,Lb.createBroadcasterQuery)(e),...(0,YA.createPaginationQuery)(t)}});return(0,XA.createPaginatedResult)(r,ia.HelixPoll,this._client)}getPollsPaginated(e){return new ZA.HelixPaginatedRequest({url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,Lb.createBroadcasterQuery)(e)},this._client,t=>new ia.HelixPoll(t,this._client),20)}async getPollsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"polls",userId:(0,Jr.extractUserId)(e),scopes:["channel:read:polls","channel:manage:polls"],query:(0,JA.createGetByIdsQuery)(e,t)})).data.map(a=>new ia.HelixPoll(a,this._client)):[]}async getPollById(e,t){let r=await this.getPollsByIds(e,[t]);return r.length?r[0]:null}async createPoll(e,t){let r=await this._client.callApi({type:"helix",url:"polls",method:"POST",userId:(0,Jr.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Fb.createPollBody)(e,t)});return new ia.HelixPoll(r.data[0],this._client)}async endPoll(e,t,r=!0){let a=await this._client.callApi({type:"helix",url:"polls",method:"PATCH",userId:(0,Jr.extractUserId)(e),scopes:["channel:manage:polls"],jsonBody:(0,Fb.createPollEndBody)(e,t,r)});return new ia.HelixPoll(a.data[0],this._client)}};na.HelixPollApi=Ip;na.HelixPollApi=Ip=KA.__decorate([(0,Jr.rtfm)("api","HelixPollApi")],Ip)});var Qb=u(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.createEndPredictionBody=Zr.createPredictionBody=void 0;var Nb=m();function tD(i,e){return{broadcaster_id:(0,Nb.extractUserId)(i),title:e.title,outcomes:e.outcomes.map(t=>({title:t})),prediction_window:e.autoLockAfter}}n(tD,"createPredictionBody");Zr.createPredictionBody=tD;function rD(i,e,t,r){return{broadcaster_id:(0,Nb.extractUserId)(i),id:e,status:t,winning_outcome_id:r}}n(rD,"createEndPredictionBody");Zr.createEndPredictionBody=rD});var Rp=u(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.HelixPredictor=void 0;var Gb=(f(),b(y)),iD=C(),Gt=m(),Vl=class extends Gt.DataObject{static{n(this,"HelixPredictor")}constructor(e,t){super(e),this._client=t}get userId(){return this[Gt.rawDataSymbol].user_id}get userName(){return this[Gt.rawDataSymbol].user_login}get userDisplayName(){return this[Gt.rawDataSymbol].user_name}async getUser(){return await this._client.users.getUserById(this[Gt.rawDataSymbol].user_id)}get channelPointsUsed(){return this[Gt.rawDataSymbol].channel_points_used}get channelPointsWon(){return this[Gt.rawDataSymbol].channel_points_won}};aa.HelixPredictor=Vl;Gb.__decorate([(0,iD.Enumerable)(!1)],Vl.prototype,"_client",void 0);aa.HelixPredictor=Vl=Gb.__decorate([(0,Gt.rtfm)("api","HelixPredictor","userId")],Vl)});var Up=u(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.HelixPredictionOutcome=void 0;var Wb=(f(),b(y)),nD=C(),Wt=m(),aD=Rp(),$l=class extends Wt.DataObject{static{n(this,"HelixPredictionOutcome")}constructor(e,t){super(e),this._client=t}get id(){return this[Wt.rawDataSymbol].id}get title(){return this[Wt.rawDataSymbol].title}get users(){return this[Wt.rawDataSymbol].users}get totalChannelPoints(){return this[Wt.rawDataSymbol].channel_points}get color(){return this[Wt.rawDataSymbol].color}get topPredictors(){var e,t;return(t=(e=this[Wt.rawDataSymbol].top_predictors)===null||e===void 0?void 0:e.map(r=>new aD.HelixPredictor(r,this._client)))!==null&&t!==void 0?t:[]}};sa.HelixPredictionOutcome=$l;Wb.__decorate([(0,nD.Enumerable)(!1)],$l.prototype,"_client",void 0);sa.HelixPredictionOutcome=$l=Wb.__decorate([(0,Wt.rtfm)("api","HelixPredictionOutcome","id")],$l)});var Bp=u(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.HelixPrediction=void 0;var $b=(f(),b(y)),sD=C(),ee=m(),Vb=Up(),zl=class extends ee.DataObject{static{n(this,"HelixPrediction")}constructor(e,t){super(e),this._client=t}get id(){return this[ee.rawDataSymbol].id}get broadcasterId(){return this[ee.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ee.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ee.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ee.checkRelationAssertion)(await this._client.users.getUserById(this[ee.rawDataSymbol].broadcaster_id))}get title(){return this[ee.rawDataSymbol].title}get status(){return this[ee.rawDataSymbol].status}get autoLockAfter(){return this[ee.rawDataSymbol].prediction_window}get creationDate(){return new Date(this[ee.rawDataSymbol].created_at)}get endDate(){return this[ee.rawDataSymbol].ended_at?new Date(this[ee.rawDataSymbol].ended_at):null}get lockDate(){return this[ee.rawDataSymbol].locked_at?new Date(this[ee.rawDataSymbol].locked_at):null}get outcomes(){return this[ee.rawDataSymbol].outcomes.map(e=>new Vb.HelixPredictionOutcome(e,this._client))}get winningOutcomeId(){return this[ee.rawDataSymbol].winning_outcome_id||null}get winningOutcome(){if(!this[ee.rawDataSymbol].winning_outcome_id)return null;let e=this[ee.rawDataSymbol].outcomes.find(t=>t.id===this[ee.rawDataSymbol].winning_outcome_id);if(!e)throw new ee.HellFreezesOverError("Winning outcome not found in outcomes array");return new Vb.HelixPredictionOutcome(e,this._client)}};oa.HelixPrediction=zl;$b.__decorate([(0,sD.Enumerable)(!1)],zl.prototype,"_client",void 0);oa.HelixPrediction=zl=$b.__decorate([(0,ee.rtfm)("api","HelixPrediction","id")],zl)});var jp=u(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.HelixPredictionApi=void 0;var oD=(f(),b(y)),zb=Z(),Xr=m(),lD=Ue(),Kb=Qb(),uD=ae(),cD=ce(),dD=se(),hD=Q(),la=Bp(),Op=class extends hD.BaseApi{static{n(this,"HelixPredictionApi")}async getPredictions(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:{...(0,zb.createBroadcasterQuery)(e),...(0,dD.createPaginationQuery)(t)}});return(0,cD.createPaginatedResult)(r,la.HelixPrediction,this._client)}getPredictionsPaginated(e){return new uD.HelixPaginatedRequest({url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,zb.createBroadcasterQuery)(e)},this._client,t=>new la.HelixPrediction(t,this._client),20)}async getPredictionsByIds(e,t){return t.length?(await this._client.callApi({type:"helix",url:"predictions",userId:(0,Xr.extractUserId)(e),scopes:["channel:read:predictions"],query:(0,lD.createGetByIdsQuery)(e,t)})).data.map(a=>new la.HelixPrediction(a,this._client)):[]}async getPredictionById(e,t){let r=await this.getPredictionsByIds(e,[t]);return r.length?r[0]:null}async createPrediction(e,t){let r=await this._client.callApi({type:"helix",url:"predictions",method:"POST",userId:(0,Xr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,Kb.createPredictionBody)(e,t)});return new la.HelixPrediction(r.data[0],this._client)}async lockPrediction(e,t){return await this._endPrediction(e,t,"LOCKED")}async resolvePrediction(e,t,r){return await this._endPrediction(e,t,"RESOLVED",r)}async cancelPrediction(e,t){return await this._endPrediction(e,t,"CANCELED")}async _endPrediction(e,t,r,a){let s=await this._client.callApi({type:"helix",url:"predictions",method:"PATCH",userId:(0,Xr.extractUserId)(e),scopes:["channel:manage:predictions"],jsonBody:(0,Kb.createEndPredictionBody)(e,t,r,a)});return new la.HelixPrediction(s.data[0],this._client)}};ua.HelixPredictionApi=Op;ua.HelixPredictionApi=Op=oD.__decorate([(0,Xr.rtfm)("api","HelixPredictionApi")],Op)});var Zb=u(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.createRaidStartQuery=void 0;var Jb=m();function pD(i,e){return{from_broadcaster_id:(0,Jb.extractUserId)(i),to_broadcaster_id:(0,Jb.extractUserId)(e)}}n(pD,"createRaidStartQuery");Kl.createRaidStartQuery=pD});var Mp=u(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.HelixRaid=void 0;var mD=(f(),b(y)),Jl=m(),kp=class extends Jl.DataObject{static{n(this,"HelixRaid")}get creationDate(){return new Date(this[Jl.rawDataSymbol].created_at)}get targetIsMature(){return this[Jl.rawDataSymbol].is_mature}};ca.HelixRaid=kp;ca.HelixRaid=kp=mD.__decorate([(0,Jl.rtfm)("api","HelixRaid")],kp)});var Np=u(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.HelixRaidApi=void 0;var _D=(f(),b(y)),yD=Z(),Lp=m(),fD=Zb(),gD=Q(),bD=Mp(),Fp=class extends gD.BaseApi{static{n(this,"HelixRaidApi")}async startRaid(e,t){let r=await this._client.callApi({type:"helix",url:"raids",method:"POST",userId:(0,Lp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,fD.createRaidStartQuery)(e,t)});return new bD.HelixRaid(r.data[0])}async cancelRaid(e){await this._client.callApi({type:"helix",url:"raids",method:"DELETE",userId:(0,Lp.extractUserId)(e),scopes:["channel:manage:raids"],query:(0,yD.createBroadcasterQuery)(e)})}};da.HelixRaidApi=Fp;da.HelixRaidApi=Fp=_D.__decorate([(0,Lp.rtfm)("api","HelixRaidApi")],Fp)});var Qp=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.createScheduleSegmentUpdateBody=$e.createScheduleSegmentModifyQuery=$e.createScheduleSegmentBody=$e.createScheduleSettingsUpdateQuery=$e.createScheduleQuery=void 0;var Zl=m();function xD(i,e){var t;return{broadcaster_id:(0,Zl.extractUserId)(i),start_time:e?.startDate,utc_offset:(t=e?.utcOffset)===null||t===void 0?void 0:t.toString()}}n(xD,"createScheduleQuery");$e.createScheduleQuery=xD;function wD(i,e){return e.vacation?{broadcaster_id:(0,Zl.extractUserId)(i),is_vacation_enabled:"true",vacation_start_time:e.vacation.startDate,vacation_end_time:e.vacation.endDate,timezone:e.vacation.timezone}:{broadcaster_id:(0,Zl.extractUserId)(i),is_vacation_enabled:"false"}}n(wD,"createScheduleSettingsUpdateQuery");$e.createScheduleSettingsUpdateQuery=wD;function vD(i){return{start_time:i.startDate,timezone:i.timezone,is_recurring:i.isRecurring,duration:i.duration,category_id:i.categoryId,title:i.title}}n(vD,"createScheduleSegmentBody");$e.createScheduleSegmentBody=vD;function SD(i,e){return{broadcaster_id:(0,Zl.extractUserId)(i),id:e}}n(SD,"createScheduleSegmentModifyQuery");$e.createScheduleSegmentModifyQuery=SD;function HD(i){return{start_time:i.startDate,timezone:i.timezone,is_canceled:i.isCanceled,duration:i.duration,category_id:i.categoryId,title:i.title}}n(HD,"createScheduleSegmentUpdateBody");$e.createScheduleSegmentUpdateBody=HD});var pa=u(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.HelixScheduleSegment=void 0;var Xb=(f(),b(y)),Yb=C(),et=m(),Xl=class extends et.DataObject{static{n(this,"HelixScheduleSegment")}constructor(e,t){super(e),this._client=t}get id(){return this[et.rawDataSymbol].id}get startDate(){return new Date(this[et.rawDataSymbol].start_time)}get endDate(){return new Date(this[et.rawDataSymbol].end_time)}get title(){return this[et.rawDataSymbol].title}get cancelEndDate(){return(0,Yb.mapNullable)(this[et.rawDataSymbol].canceled_until,e=>new Date(e))}get categoryId(){var e,t;return(t=(e=this[et.rawDataSymbol].category)===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null}get categoryName(){var e,t;return(t=(e=this[et.rawDataSymbol].category)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:null}async getCategory(){var e;let t=(e=this[et.rawDataSymbol].category)===null||e===void 0?void 0:e.id;return t?await this._client.games.getGameById(t):null}get isRecurring(){return this[et.rawDataSymbol].is_recurring}};ha.HelixScheduleSegment=Xl;Xb.__decorate([(0,Yb.Enumerable)(!1)],Xl.prototype,"_client",void 0);ha.HelixScheduleSegment=Xl=Xb.__decorate([(0,et.rtfm)("api","HelixScheduleSegment","id")],Xl)});var Wp=u(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.HelixPaginatedScheduleSegmentRequest=void 0;var CD=(f(),b(y)),qD=m(),ED=Qp(),PD=ae(),AD=pa(),Gp=class extends PD.HelixPaginatedRequest{static{n(this,"HelixPaginatedScheduleSegmentRequest")}constructor(e,t,r){super({url:"schedule",query:(0,ED.createScheduleQuery)(e,r)},t,a=>new AD.HelixScheduleSegment(a,t),25)}async _fetchData(e={}){var t;let r=await super._fetchData(e);return{data:(t=r.data.segments)!==null&&t!==void 0?t:[],pagination:r.pagination}}};ma.HelixPaginatedScheduleSegmentRequest=Gp;ma.HelixPaginatedScheduleSegmentRequest=Gp=CD.__decorate([(0,qD.rtfm)("api","HelixPaginatedScheduleSegmentRequest")],Gp)});var Vp=u(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.HelixSchedule=void 0;var ex=(f(),b(y)),DD=C(),mt=m(),ID=pa(),Yl=class extends mt.DataObject{static{n(this,"HelixSchedule")}constructor(e,t){super(e),this._client=t}get segments(){var e,t;return(t=(e=this[mt.rawDataSymbol].segments)===null||e===void 0?void 0:e.map(r=>new ID.HelixScheduleSegment(r,this._client)))!==null&&t!==void 0?t:[]}get broadcasterId(){return this[mt.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[mt.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[mt.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,mt.checkRelationAssertion)(await this._client.users.getUserById(this[mt.rawDataSymbol].broadcaster_id))}get vacationStartDate(){var e;let t=(e=this[mt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.start_time;return t?new Date(t):null}get vacationEndDate(){var e;let t=(e=this[mt.rawDataSymbol].vacation)===null||e===void 0?void 0:e.end_time;return t?new Date(t):null}};_a.HelixSchedule=Yl;ex.__decorate([(0,DD.Enumerable)(!1)],Yl.prototype,"_client",void 0);_a.HelixSchedule=Yl=ex.__decorate([(0,mt.rtfm)("api","HelixSchedule","broadcasterId")],Yl)});var Kp=u(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.HelixScheduleApi=void 0;var tx=Z(),Yr=m(),TD=Ue(),ei=Qp(),RD=se(),UD=Q(),BD=Wp(),OD=Vp(),$p=pa(),zp=class extends UD.BaseApi{static{n(this,"HelixScheduleApi")}async getSchedule(e,t){let r=await this._client.callApi({type:"helix",url:"schedule",userId:(0,Yr.extractUserId)(e),query:{...(0,ei.createScheduleQuery)(e,t),...(0,RD.createPaginationQuery)(t)}});return{data:new OD.HelixSchedule(r.data,this._client),cursor:r.pagination.cursor}}getScheduleSegmentsPaginated(e,t){return new BD.HelixPaginatedScheduleSegmentRequest(e,this._client,t)}async getScheduleSegmentsByIds(e,t){var r,a;return(a=(r=(await this._client.callApi({type:"helix",url:"schedule",userId:(0,Yr.extractUserId)(e),query:(0,TD.createGetByIdsQuery)(e,t)})).data.segments)===null||r===void 0?void 0:r.map(o=>new $p.HelixScheduleSegment(o,this._client)))!==null&&a!==void 0?a:[]}async getScheduleSegmentById(e,t){let r=await this.getScheduleSegmentsByIds(e,[t]);return r.length?r[0]:null}async getScheduleAsIcal(e){return await this._client.callApi({type:"helix",url:"schedule/icalendar",query:(0,tx.createBroadcasterQuery)(e)})}async updateScheduleSettings(e,t){await this._client.callApi({type:"helix",url:"schedule/settings",method:"PATCH",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ei.createScheduleSettingsUpdateQuery)(e,t)})}async createScheduleSegment(e,t){let r=await this._client.callApi({type:"helix",url:"schedule/segment",method:"POST",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,tx.createBroadcasterQuery)(e),jsonBody:(0,ei.createScheduleSegmentBody)(t)});return new $p.HelixScheduleSegment(r.data.segments[0],this._client)}async updateScheduleSegment(e,t,r){let a=await this._client.callApi({type:"helix",url:"schedule/segment",method:"PATCH",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ei.createScheduleSegmentModifyQuery)(e,t),jsonBody:(0,ei.createScheduleSegmentUpdateBody)(r)});return new $p.HelixScheduleSegment(a.data.segments[0],this._client)}async deleteScheduleSegment(e,t){await this._client.callApi({type:"helix",url:"schedule/segment",method:"DELETE",userId:(0,Yr.extractUserId)(e),scopes:["channel:manage:schedule"],query:(0,ei.createScheduleSegmentModifyQuery)(e,t)})}};eu.HelixScheduleApi=zp});var rx=u(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.createSearchChannelsQuery=void 0;function jD(i,e){var t;return{query:i,live_only:(t=e.liveOnly)===null||t===void 0?void 0:t.toString()}}n(jD,"createSearchChannelsQuery");tu.createSearchChannelsQuery=jD});var Jp=u(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.HelixChannelSearchResult=void 0;var ix=(f(),b(y)),kD=C(),ye=m(),ru=class extends ye.DataObject{static{n(this,"HelixChannelSearchResult")}constructor(e,t){super(e),this._client=t}get language(){return this[ye.rawDataSymbol].broadcaster_language}get id(){return this[ye.rawDataSymbol].id}get name(){return this[ye.rawDataSymbol].broadcaster_login}get displayName(){return this[ye.rawDataSymbol].display_name}async getUser(){return(0,ye.checkRelationAssertion)(await this._client.users.getUserById(this[ye.rawDataSymbol].id))}get gameId(){return this[ye.rawDataSymbol].game_id}get gameName(){return this[ye.rawDataSymbol].game_name}async getGame(){return this[ye.rawDataSymbol].game_id?(0,ye.checkRelationAssertion)(await this._client.games.getGameById(this[ye.rawDataSymbol].game_id)):null}get isLive(){return this[ye.rawDataSymbol].is_live}get tags(){return this[ye.rawDataSymbol].tags}get thumbnailUrl(){return this[ye.rawDataSymbol].thumbnail_url}get startDate(){return this[ye.rawDataSymbol].is_live?new Date(this[ye.rawDataSymbol].started_at):null}};ya.HelixChannelSearchResult=ru;ix.__decorate([(0,kD.Enumerable)(!1)],ru.prototype,"_client",void 0);ya.HelixChannelSearchResult=ru=ix.__decorate([(0,ye.rtfm)("api","HelixChannelSearchResult","id")],ru)});var Xp=u(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.HelixSearchApi=void 0;var MD=(f(),b(y)),LD=m(),nx=rx(),ax=ae(),sx=ce(),ox=se(),FD=Q(),lx=Il(),ux=Jp(),Zp=class extends FD.BaseApi{static{n(this,"HelixSearchApi")}async searchCategories(e,t){let r=await this._client.callApi({type:"helix",url:"search/categories",query:{query:e,...(0,ox.createPaginationQuery)(t)}});return(0,sx.createPaginatedResult)(r,lx.HelixGame,this._client)}searchCategoriesPaginated(e){return new ax.HelixPaginatedRequest({url:"search/categories",query:{query:e}},this._client,t=>new lx.HelixGame(t,this._client))}async searchChannels(e,t={}){let r=await this._client.callApi({type:"helix",url:"search/channels",query:{...(0,nx.createSearchChannelsQuery)(e,t),...(0,ox.createPaginationQuery)(t)}});return(0,sx.createPaginatedResult)(r,ux.HelixChannelSearchResult,this._client)}searchChannelsPaginated(e,t={}){return new ax.HelixPaginatedRequest({url:"search/channels",query:(0,nx.createSearchChannelsQuery)(e,t)},this._client,r=>new ux.HelixChannelSearchResult(r,this._client))}};fa.HelixSearchApi=Zp;fa.HelixSearchApi=Zp=MD.__decorate([(0,LD.rtfm)("api","HelixSearchApi")],Zp)});var em=u(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.StreamNotLiveError=void 0;var ND=m(),Yp=class extends ND.CustomError{static{n(this,"StreamNotLiveError")}constructor(e){super("Your stream needs to be live to do this",e)}};iu.StreamNotLiveError=Yp});var cx=u(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.createVideoQuery=Vt.createStreamMarkerBody=Vt.createStreamQuery=void 0;var QD=m();function GD(i){return{game_id:i.game,language:i.language,type:i.type,user_id:i.userId,user_login:i.userName}}n(GD,"createStreamQuery");Vt.createStreamQuery=GD;function WD(i,e){return{user_id:(0,QD.extractUserId)(i),description:e}}n(WD,"createStreamMarkerBody");Vt.createStreamMarkerBody=WD;function VD(i){return{video_id:i}}n(VD,"createVideoQuery");Vt.createVideoQuery=VD});var tm=u(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.HelixStream=void 0;var dx=(f(),b(y)),$D=C(),te=m(),nu=class extends te.DataObject{static{n(this,"HelixStream")}constructor(e,t){super(e),this._client=t}get id(){return this[te.rawDataSymbol].id}get userId(){return this[te.rawDataSymbol].user_id}get userName(){return this[te.rawDataSymbol].user_login}get userDisplayName(){return this[te.rawDataSymbol].user_name}async getUser(){return(0,te.checkRelationAssertion)(await this._client.users.getUserById(this[te.rawDataSymbol].user_id))}get gameId(){return this[te.rawDataSymbol].game_id}get gameName(){return this[te.rawDataSymbol].game_name}async getGame(){return this[te.rawDataSymbol].game_id?(0,te.checkRelationAssertion)(await this._client.games.getGameById(this[te.rawDataSymbol].game_id)):null}get type(){return this[te.rawDataSymbol].type}get title(){return this[te.rawDataSymbol].title}get viewers(){return this[te.rawDataSymbol].viewer_count}get startDate(){return new Date(this[te.rawDataSymbol].started_at)}get language(){return this[te.rawDataSymbol].language}get thumbnailUrl(){return this[te.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[te.rawDataSymbol].thumbnail_url.replace("{width}",e.toString()).replace("{height}",t.toString())}get tags(){return this[te.rawDataSymbol].tags}get isMature(){return this[te.rawDataSymbol].is_mature}};ga.HelixStream=nu;dx.__decorate([(0,$D.Enumerable)(!1)],nu.prototype,"_client",void 0);ga.HelixStream=nu=dx.__decorate([(0,te.rtfm)("api","HelixStream","id")],nu)});var su=u(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.HelixStreamMarker=void 0;var hx=(f(),b(y)),zD=C(),ti=m(),au=class extends ti.DataObject{static{n(this,"HelixStreamMarker")}constructor(e,t){super(e),this._client=t}get id(){return this[ti.rawDataSymbol].id}get creationDate(){return new Date(this[ti.rawDataSymbol].created_at)}get description(){return this[ti.rawDataSymbol].description}get positionInSeconds(){return this[ti.rawDataSymbol].position_seconds}};ba.HelixStreamMarker=au;hx.__decorate([(0,zD.Enumerable)(!1)],au.prototype,"_client",void 0);ba.HelixStreamMarker=au=hx.__decorate([(0,ti.rtfm)("api","HelixStreamMarker","id")],au)});var nm=u(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.HelixStreamMarkerWithVideo=void 0;var KD=(f(),b(y)),rm=m(),JD=su(),im=class extends JD.HelixStreamMarker{static{n(this,"HelixStreamMarkerWithVideo")}constructor(e,t,r){super(e,r),this._videoId=t}get url(){return this[rm.rawDataSymbol].URL}get videoId(){return this._videoId}async getVideo(){return(0,rm.checkRelationAssertion)(await this._client.videos.getVideoById(this._videoId))}};xa.HelixStreamMarkerWithVideo=im;xa.HelixStreamMarkerWithVideo=im=KD.__decorate([(0,rm.rtfm)("api","HelixStreamMarkerWithVideo","id")],im)});var sm=u(Sa=>{"use strict";var ii;Object.defineProperty(Sa,"__esModule",{value:!0});Sa.HelixStreamApi=void 0;var am=(f(),b(y)),wa=C(),px=Z(),Te=m(),ZD=em(),ou=Ue(),ri=cx(),mx=Bt(),lu=ae(),_x=ce(),uu=se(),XD=Q(),pr=tm(),YD=su(),e1=nm(),va=ii=class extends XD.BaseApi{static{n(this,"HelixStreamApi")}constructor(){super(...arguments),this._getStreamByUserIdBatcher=new mx.HelixRequestBatcher({url:"streams"},"user_id","user_id",this._client,e=>new pr.HelixStream(e,this._client)),this._getStreamByUserNameBatcher=new mx.HelixRequestBatcher({url:"streams"},"user_login","user_login",this._client,e=>new pr.HelixStream(e,this._client))}async getStreams(e={}){let t=await this._client.callApi({url:"streams",type:"helix",query:{...(0,ri.createStreamQuery)(e),...(0,uu.createPaginationQuery)(e)}});return(0,_x.createPaginatedResult)(t,pr.HelixStream,this._client)}getStreamsPaginated(e={}){return new lu.HelixPaginatedRequest({url:"streams",query:(0,ri.createStreamQuery)(e)},this._client,t=>new pr.HelixStream(t,this._client))}async getStreamsByUserNames(e){return(await this.getStreams({userName:e.map(Te.extractUserName)})).data}async getStreamByUserName(e){var t;return(t=(await this.getStreamsByUserNames([e]))[0])!==null&&t!==void 0?t:null}async getStreamByUserNameBatched(e){return await this._getStreamByUserNameBatcher.request((0,Te.extractUserName)(e))}async getStreamsByUserIds(e){return(await this.getStreams({userId:e.map(Te.extractUserId)})).data}async getStreamByUserId(e){let t=(0,Te.extractUserId)(e),r=await this._client.callApi({url:"streams",type:"helix",userId:t,query:(0,ri.createStreamQuery)({userId:t})});return(0,wa.mapNullable)(r.data[0],a=>new pr.HelixStream(a,this._client))}async getStreamByUserIdBatched(e){return await this._getStreamByUserIdBatcher.request((0,Te.extractUserId)(e))}async getStreamMarkersForUser(e,t){var r;let a=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,ou.createUserQuery)(e),...(0,uu.createPaginationQuery)(t)},userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,wa.flatten)(a.data.map(s=>ii._mapGetStreamMarkersResult(s,this._client))),cursor:(r=a.pagination)===null||r===void 0?void 0:r.cursor}}getStreamMarkersForUserPaginated(e){return new lu.HelixPaginatedRequest({url:"streams/markers",query:(0,ou.createUserQuery)(e),userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,t=>ii._mapGetStreamMarkersResult(t,this._client))}async getStreamMarkersForVideo(e,t,r){var a;let s=await this._client.callApi({url:"streams/markers",type:"helix",query:{...(0,ri.createVideoQuery)(t),...(0,uu.createPaginationQuery)(r)},userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0});return{data:(0,wa.flatten)(s.data.map(o=>ii._mapGetStreamMarkersResult(o,this._client))),cursor:(a=s.pagination)===null||a===void 0?void 0:a.cursor}}getStreamMarkersForVideoPaginated(e,t){return new lu.HelixPaginatedRequest({url:"streams/markers",query:(0,ri.createVideoQuery)(t),userId:(0,Te.extractUserId)(e),scopes:["user:read:broadcast"],canOverrideScopedUserContext:!0},this._client,r=>ii._mapGetStreamMarkersResult(r,this._client))}async createStreamMarker(e,t){try{let r=await this._client.callApi({url:"streams/markers",method:"POST",type:"helix",userId:(0,Te.extractUserId)(e),scopes:["channel:manage:broadcast"],canOverrideScopedUserContext:!0,jsonBody:(0,ri.createStreamMarkerBody)(e,t)});return new YD.HelixStreamMarker(r.data[0],this._client)}catch(r){throw r instanceof px.HttpStatusCodeError&&r.statusCode===404?new ZD.StreamNotLiveError({cause:r}):r}}async getStreamKey(e){let t=(0,Te.extractUserId)(e);return(await this._client.callApi({type:"helix",url:"streams/key",userId:t,scopes:["channel:read:stream_key"],query:(0,px.createBroadcasterQuery)(e)})).data[0].stream_key}async getFollowedStreams(e,t){let r=(0,Te.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"streams/followed",userId:r,scopes:["user:read:follows"],query:{...(0,ou.createSingleKeyQuery)("user_id",r),...(0,uu.createPaginationQuery)(t)}});return(0,_x.createPaginatedResult)(a,pr.HelixStream,this._client)}getFollowedStreamsPaginated(e){let t=(0,Te.extractUserId)(e);return new lu.HelixPaginatedRequest({url:"streams/followed",userId:t,scopes:["user:read:follows"],query:(0,ou.createSingleKeyQuery)("user_id",t)},this._client,r=>new pr.HelixStream(r,this._client))}static _mapGetStreamMarkersResult(e,t){return e.videos.reduce((r,a)=>[...r,...a.markers.map(s=>new e1.HelixStreamMarkerWithVideo(s,a.video_id,t))],[])}};Sa.HelixStreamApi=va;am.__decorate([(0,wa.Enumerable)(!1)],va.prototype,"_getStreamByUserIdBatcher",void 0);am.__decorate([(0,wa.Enumerable)(!1)],va.prototype,"_getStreamByUserNameBatcher",void 0);Sa.HelixStreamApi=va=ii=am.__decorate([(0,Te.rtfm)("api","HelixStreamApi")],va)});var fx=u(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.createSubscriptionCheckQuery=void 0;var yx=m();function t1(i,e){return{broadcaster_id:(0,yx.extractUserId)(i),user_id:(0,yx.extractUserId)(e)}}n(t1,"createSubscriptionCheckQuery");cu.createSubscriptionCheckQuery=t1});var hu=u(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.HelixUserSubscription=void 0;var gx=(f(),b(y)),r1=C(),$t=m(),du=class extends $t.DataObject{static{n(this,"HelixUserSubscription")}constructor(e,t){super(e),this._client=t}get broadcasterId(){return this[$t.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[$t.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[$t.rawDataSymbol].broadcaster_name}async getBroadcaster(){return await this._client.users.getUserById(this[$t.rawDataSymbol].broadcaster_id)}get isGift(){return this[$t.rawDataSymbol].is_gift}get tier(){return this[$t.rawDataSymbol].tier}};Ha.HelixUserSubscription=du;gx.__decorate([(0,r1.Enumerable)(!1)],du.prototype,"_client",void 0);Ha.HelixUserSubscription=du=gx.__decorate([(0,$t.rtfm)("api","HelixUserSubscription","broadcasterId")],du)});var pu=u(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.HelixSubscription=void 0;var i1=(f(),b(y)),ue=m(),n1=hu(),om=class extends n1.HelixUserSubscription{static{n(this,"HelixSubscription")}get broadcasterId(){return this[ue.rawDataSymbol].broadcaster_id}get broadcasterName(){return this[ue.rawDataSymbol].broadcaster_login}get broadcasterDisplayName(){return this[ue.rawDataSymbol].broadcaster_name}async getBroadcaster(){return(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].broadcaster_id))}get gifterId(){return this[ue.rawDataSymbol].is_gift?this[ue.rawDataSymbol].gifter_id:null}get gifterName(){return this[ue.rawDataSymbol].is_gift?this[ue.rawDataSymbol].gifter_login:null}get gifterDisplayName(){return this[ue.rawDataSymbol].is_gift?this[ue.rawDataSymbol].gifter_name:null}async getGifter(){return this[ue.rawDataSymbol].is_gift?(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].gifter_id)):null}get userId(){return this[ue.rawDataSymbol].user_id}get userName(){return this[ue.rawDataSymbol].user_login}get userDisplayName(){return this[ue.rawDataSymbol].user_name}async getUser(){return(0,ue.checkRelationAssertion)(await this._client.users.getUserById(this[ue.rawDataSymbol].user_id))}};Ca.HelixSubscription=om;Ca.HelixSubscription=om=i1.__decorate([(0,ue.rtfm)("api","HelixSubscription","userId")],om)});var um=u(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.HelixPaginatedSubscriptionsRequest=void 0;var a1=(f(),b(y)),s1=Z(),bx=m(),o1=Mr(),l1=pu(),lm=class extends o1.HelixPaginatedRequestWithTotal{static{n(this,"HelixPaginatedSubscriptionsRequest")}constructor(e,t){super({url:"subscriptions",scopes:["channel:read:subscriptions"],userId:(0,bx.extractUserId)(e),query:(0,s1.createBroadcasterQuery)(e)},t,r=>new l1.HelixSubscription(r,t))}async getPoints(){var e;return((e=this._currentData)!==null&&e!==void 0?e:await this._fetchData({query:{after:void 0}})).points}};qa.HelixPaginatedSubscriptionsRequest=lm;qa.HelixPaginatedSubscriptionsRequest=lm=a1.__decorate([(0,bx.rtfm)("api","HelixPaginatedSubscriptionsRequest")],lm)});var dm=u(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.HelixSubscriptionApi=void 0;var u1=(f(),b(y)),xx=Z(),mu=m(),c1=Ue(),d1=fx(),h1=ce(),p1=se(),m1=Q(),_1=um(),wx=pu(),y1=hu(),cm=class extends m1.BaseApi{static{n(this,"HelixSubscriptionApi")}async getSubscriptions(e,t){let r=await this._client.callApi({url:"subscriptions",scopes:["channel:read:subscriptions"],type:"helix",userId:(0,mu.extractUserId)(e),query:{...(0,xx.createBroadcasterQuery)(e),...(0,p1.createPaginationQuery)(t)}});return{...(0,h1.createPaginatedResultWithTotal)(r,wx.HelixSubscription,this._client),points:r.points}}getSubscriptionsPaginated(e){return new _1.HelixPaginatedSubscriptionsRequest(e,this._client)}async getSubscriptionsForUsers(e,t){return(await this._client.callApi({type:"helix",url:"subscriptions",userId:(0,mu.extractUserId)(e),scopes:["channel:read:subscriptions"],query:(0,c1.createChannelUsersCheckQuery)(e,t)})).data.map(a=>new wx.HelixSubscription(a,this._client))}async getSubscriptionForUser(e,t){let r=await this.getSubscriptionsForUsers(e,[t]);return r.length?r[0]:null}async checkUserSubscription(e,t){try{let r=await this._client.callApi({type:"helix",url:"subscriptions/user",userId:(0,mu.extractUserId)(e),scopes:["user:read:subscriptions"],query:(0,d1.createSubscriptionCheckQuery)(t,e)});return new y1.HelixUserSubscription(r.data[0],this._client)}catch(r){if(r instanceof xx.HttpStatusCodeError&&r.statusCode===404)return null;throw r}}};Ea.HelixSubscriptionApi=cm;Ea.HelixSubscriptionApi=cm=u1.__decorate([(0,mu.rtfm)("api","HelixSubscriptionApi")],cm)});var yu=u(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.HelixTeam=void 0;var vx=(f(),b(y)),f1=C(),tt=m(),_u=class extends tt.DataObject{static{n(this,"HelixTeam")}constructor(e,t){super(e),this._client=t}get id(){return this[tt.rawDataSymbol].id}get name(){return this[tt.rawDataSymbol].team_name}get displayName(){return this[tt.rawDataSymbol].team_display_name}get backgroundImageUrl(){return this[tt.rawDataSymbol].background_image_url}get bannerUrl(){return this[tt.rawDataSymbol].banner}get creationDate(){return new Date(this[tt.rawDataSymbol].created_at)}get updateDate(){return new Date(this[tt.rawDataSymbol].updated_at)}get info(){return this[tt.rawDataSymbol].info}get logoThumbnailUrl(){return this[tt.rawDataSymbol].thumbnail_url}async getUserRelations(){return(await this._client.teams.getTeamById(this.id)).userRelations}};Pa.HelixTeam=_u;vx.__decorate([(0,f1.Enumerable)(!1)],_u.prototype,"_client",void 0);Pa.HelixTeam=_u=vx.__decorate([(0,tt.rtfm)("api","HelixTeam","id")],_u)});var pm=u(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.HelixTeamWithUsers=void 0;var g1=(f(),b(y)),Sx=m(),b1=Lo(),x1=yu(),hm=class extends x1.HelixTeam{static{n(this,"HelixTeamWithUsers")}get userRelations(){return this[Sx.rawDataSymbol].users.map(e=>new b1.HelixUserRelation(e,this._client))}};Aa.HelixTeamWithUsers=hm;Aa.HelixTeamWithUsers=hm=g1.__decorate([(0,Sx.rtfm)("api","HelixTeamWithUsers","id")],hm)});var ym=u(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.HelixTeamApi=void 0;var w1=(f(),b(y)),mm=Z(),Cx=m(),v1=Q(),S1=yu(),Hx=pm(),_m=class extends v1.BaseApi{static{n(this,"HelixTeamApi")}async getTeamsForBroadcaster(e){var t,r;return(r=(t=(await this._client.callApi({type:"helix",url:"teams/channel",userId:(0,Cx.extractUserId)(e),query:(0,mm.createBroadcasterQuery)(e)})).data)===null||t===void 0?void 0:t.map(s=>new S1.HelixTeam(s,this._client)))!==null&&r!==void 0?r:[]}async getTeamById(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{id:e}});return new Hx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof mm.HttpStatusCodeError&&t.statusCode===500)return null;throw t}}async getTeamByName(e){try{let t=await this._client.callApi({type:"helix",url:"teams",query:{name:e}});return new Hx.HelixTeamWithUsers(t.data[0],this._client)}catch(t){if(t instanceof mm.HttpStatusCodeError&&t.statusCode===404)return null;throw t}}};Da.HelixTeamApi=_m;Da.HelixTeamApi=_m=w1.__decorate([(0,Cx.rtfm)("api","HelixTeamApi")],_m)});var Ex=u(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.createUserBlockDeleteQuery=ni.createUserBlockCreateQuery=void 0;var qx=m();function H1(i,e){return{target_user_id:(0,qx.extractUserId)(i),source_context:e.sourceContext,reason:e.reason}}n(H1,"createUserBlockCreateQuery");ni.createUserBlockCreateQuery=H1;function C1(i){return{target_user_id:(0,qx.extractUserId)(i)}}n(C1,"createUserBlockDeleteQuery");ni.createUserBlockDeleteQuery=C1});var bu=u(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.HelixBaseExtension=void 0;var fu=m(),fm=class extends fu.DataObject{static{n(this,"HelixBaseExtension")}get id(){return this[fu.rawDataSymbol].id}get version(){return this[fu.rawDataSymbol].version}get name(){return this[fu.rawDataSymbol].name}};gu.HelixBaseExtension=fm});var bm=u(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HelixInstalledExtension=void 0;var q1=(f(),b(y)),E1=m(),P1=bu(),gm=class extends P1.HelixBaseExtension{static{n(this,"HelixInstalledExtension")}constructor(e,t,r){super(r),this._slotType=e,this._slotId=t}get slotType(){return this._slotType}get slotId(){return this._slotId}};Ia.HelixInstalledExtension=gm;Ia.HelixInstalledExtension=gm=q1.__decorate([(0,E1.rtfm)("api","HelixInstalledExtension","id")],gm)});var vm=u(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.HelixInstalledExtensionList=void 0;var A1=(f(),b(y)),Ta=m(),xm=bm(),wm=class extends Ta.DataObject{static{n(this,"HelixInstalledExtensionList")}getExtensionAtSlot(e,t){let r=this[Ta.rawDataSymbol][e][t];return r.active?new xm.HelixInstalledExtension(e,t,r):null}getExtensionsForSlotType(e){return[...Object.entries(this[Ta.rawDataSymbol][e])].filter(t=>t[1].active).map(([t,r])=>new xm.HelixInstalledExtension(e,t,r))}getAllExtensions(){return[...Object.entries(this[Ta.rawDataSymbol])].flatMap(([e,t])=>[...Object.entries(t)].filter(r=>r[1].active).map(([r,a])=>new xm.HelixInstalledExtension(e,r,a)))}};Ra.HelixInstalledExtensionList=wm;Ra.HelixInstalledExtensionList=wm=A1.__decorate([(0,Ta.rtfm)("api","HelixInstalledExtensionList")],wm)});var Cm=u(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.HelixUserExtension=void 0;var D1=(f(),b(y)),Sm=m(),I1=bu(),Hm=class extends I1.HelixBaseExtension{static{n(this,"HelixUserExtension")}get canActivate(){return this[Sm.rawDataSymbol].can_activate}get types(){return this[Sm.rawDataSymbol].type}};Ua.HelixUserExtension=Hm;Ua.HelixUserExtension=Hm=D1.__decorate([(0,Sm.rtfm)("api","HelixUserExtension","id")],Hm)});var wu=u(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.HelixUser=void 0;var Px=(f(),b(y)),T1=C(),rt=m(),xu=class extends rt.DataObject{static{n(this,"HelixUser")}constructor(e,t){super(e),this._client=t}get id(){return this[rt.rawDataSymbol].id}get name(){return this[rt.rawDataSymbol].login}get displayName(){return this[rt.rawDataSymbol].display_name}get description(){return this[rt.rawDataSymbol].description}get type(){return this[rt.rawDataSymbol].type}get broadcasterType(){return this[rt.rawDataSymbol].broadcaster_type}get profilePictureUrl(){return this[rt.rawDataSymbol].profile_image_url}get offlinePlaceholderUrl(){return this[rt.rawDataSymbol].offline_image_url}get creationDate(){return new Date(this[rt.rawDataSymbol].created_at)}async getStream(){return await this._client.streams.getStreamByUserId(this)}async getFollowedChannels(){return await this._client.channels.getFollowedChannels(this)}async getFollowedChannel(e){var t;return(t=(await this._client.channels.getFollowedChannels(this,e)).data[0])!==null&&t!==void 0?t:null}async follows(e){return await this.getFollowedChannel(e)!==null}async getChannelFollowers(){return await this._client.channels.getChannelFollowers(this)}async getChannelFollower(e){var t;return(t=(await this._client.channels.getChannelFollowers(this,e)).data[0])!==null&&t!==void 0?t:null}async isFollowedBy(e){return await this.getChannelFollower(e)!==null}async getSubscriptionTo(e){return await this._client.subscriptions.checkUserSubscription(this,e)}async isSubscribedTo(e){return await this.getSubscriptionTo(e)!==null}async getSubscriber(e){return await this._client.subscriptions.getSubscriptionForUser(this,e)}async hasSubscriber(e){return await this.getSubscriber(e)!==null}};Ba.HelixUser=xu;Px.__decorate([(0,T1.Enumerable)(!1)],xu.prototype,"_client",void 0);Ba.HelixUser=xu=Px.__decorate([(0,rt.rtfm)("api","HelixUser","id")],xu)});var Em=u(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.HelixPrivilegedUser=void 0;var R1=(f(),b(y)),Ax=m(),U1=wu(),qm=class extends U1.HelixUser{static{n(this,"HelixPrivilegedUser")}get email(){return this[Ax.rawDataSymbol].email}async setDescription(e){return await this._client.users.updateAuthenticatedUser(this,{description:e})}};Oa.HelixPrivilegedUser=qm;Oa.HelixPrivilegedUser=qm=R1.__decorate([(0,Ax.rtfm)("api","HelixPrivilegedUser","id")],qm)});var Pm=u(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.HelixUserBlock=void 0;var Dx=(f(),b(y)),B1=C(),mr=m(),vu=class extends mr.DataObject{static{n(this,"HelixUserBlock")}constructor(e,t){super(e),this._client=t}get userId(){return this[mr.rawDataSymbol].user_id}get userName(){return this[mr.rawDataSymbol].user_login}get userDisplayName(){return this[mr.rawDataSymbol].display_name}async getUser(){return(0,mr.checkRelationAssertion)(await this._client.users.getUserById(this[mr.rawDataSymbol].user_id))}};ja.HelixUserBlock=vu;Dx.__decorate([(0,B1.Enumerable)(!1)],vu.prototype,"_client",void 0);ja.HelixUserBlock=vu=Dx.__decorate([(0,mr.rtfm)("api","HelixUserBlock","userId")],vu)});var Im=u(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.HelixUserApi=void 0;var Am=(f(),b(y)),Dm=C(),Ix=Z(),be=m(),O1=Ue(),Tx=Ex(),Rx=Bt(),j1=ae(),k1=ce(),M1=se(),L1=Q(),Ux=vm(),F1=Cm(),Bx=Em(),Su=wu(),Ox=Pm(),ka=class extends L1.BaseApi{static{n(this,"HelixUserApi")}constructor(){super(...arguments),this._getUserByIdBatcher=new Rx.HelixRequestBatcher({url:"users"},"id","id",this._client,e=>new Su.HelixUser(e,this._client)),this._getUserByNameBatcher=new Rx.HelixRequestBatcher({url:"users"},"login","login",this._client,e=>new Su.HelixUser(e,this._client))}async getUsersByIds(e){return await this._getUsers("id",e.map(be.extractUserId))}async getUsersByNames(e){return await this._getUsers("login",e.map(be.extractUserName))}async getUserById(e){let t=(0,be.extractUserId)(e),r=await this._client.callApi({type:"helix",url:"users",userId:t,query:{id:t}});return(0,Dm.mapNullable)(r.data[0],a=>new Su.HelixUser(a,this._client))}async getUserByIdBatched(e){return await this._getUserByIdBatcher.request((0,be.extractUserId)(e))}async getUserByName(e){let t=await this._getUsers("login",[(0,be.extractUserName)(e)]);return t.length?t[0]:null}async getUserByNameBatched(e){return await this._getUserByNameBatcher.request((0,be.extractUserName)(e))}async getAuthenticatedUser(e,t=!1){var r;let a=await this._client.callApi({type:"helix",url:"users",forceType:"user",userId:(0,be.extractUserId)(e),scopes:t?["user:read:email"]:void 0});if(!(!((r=a.data)===null||r===void 0)&&r.length))throw new be.HellFreezesOverError("Could not get authenticated user");return new Bx.HelixPrivilegedUser(a.data[0],this._client)}async updateAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users",method:"PUT",userId:(0,be.extractUserId)(e),scopes:["user:edit"],query:{description:t.description}});return new Bx.HelixPrivilegedUser(r.data[0],this._client)}async getBlocks(e,t){let r=await this._client.callApi({type:"helix",url:"users/blocks",userId:(0,be.extractUserId)(e),scopes:["user:read:blocked_users"],query:{...(0,Ix.createBroadcasterQuery)(e),...(0,M1.createPaginationQuery)(t)}});return(0,k1.createPaginatedResult)(r,Ox.HelixUserBlock,this._client)}getBlocksPaginated(e){return new j1.HelixPaginatedRequest({url:"users/blocks",userId:(0,be.extractUserId)(e),scopes:["user:read:blocked_users"],query:(0,Ix.createBroadcasterQuery)(e)},this._client,t=>new Ox.HelixUserBlock(t,this._client))}async createBlock(e,t,r={}){await this._client.callApi({type:"helix",url:"users/blocks",method:"PUT",userId:(0,be.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,Tx.createUserBlockCreateQuery)(t,r)})}async deleteBlock(e,t){await this._client.callApi({type:"helix",url:"users/blocks",method:"DELETE",userId:(0,be.extractUserId)(e),scopes:["user:manage:blocked_users"],query:(0,Tx.createUserBlockDeleteQuery)(t)})}async getExtensionsForAuthenticatedUser(e,t=!1){return(await this._client.callApi({type:"helix",url:"users/extensions/list",userId:(0,be.extractUserId)(e),scopes:t?["channel:manage:extensions"]:["user:read:broadcast","channel:manage:extensions"]})).data.map(a=>new F1.HelixUserExtension(a))}async getActiveExtensions(e,t=!1){let r=(0,be.extractUserId)(e),a=await this._client.callApi({type:"helix",url:"users/extensions",userId:r,scopes:t?["user:read:broadcast","channel:manage:extensions"]:void 0,query:(0,O1.createSingleKeyQuery)("user_id",r)});return new Ux.HelixInstalledExtensionList(a.data)}async updateActiveExtensionsForAuthenticatedUser(e,t){let r=await this._client.callApi({type:"helix",url:"users/extensions",method:"PUT",userId:(0,be.extractUserId)(e),scopes:["channel:manage:extensions"],jsonBody:{data:t}});return new Ux.HelixInstalledExtensionList(r.data)}async _getUsers(e,t){if(t.length===0)return[];let r={[e]:t};return(await this._client.callApi({type:"helix",url:"users",query:r})).data.map(s=>new Su.HelixUser(s,this._client))}};Ma.HelixUserApi=ka;Am.__decorate([(0,Dm.Enumerable)(!1)],ka.prototype,"_getUserByIdBatcher",void 0);Am.__decorate([(0,Dm.Enumerable)(!1)],ka.prototype,"_getUserByNameBatcher",void 0);Ma.HelixUserApi=ka=Am.__decorate([(0,be.rtfm)("api","HelixUserApi")],ka)});var Rm=u(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.HelixVideo=void 0;var Tm=(f(),b(y)),jx=xi(),N1=C(),O=m(),La=class extends O.DataObject{static{n(this,"HelixVideo")}constructor(e,t){super(e),this._client=t}get id(){return this[O.rawDataSymbol].id}get userId(){return this[O.rawDataSymbol].user_id}get userName(){return this[O.rawDataSymbol].user_login}get userDisplayName(){return this[O.rawDataSymbol].user_name}async getUser(){return(0,O.checkRelationAssertion)(await this._client.users.getUserById(this[O.rawDataSymbol].user_id))}get title(){return this[O.rawDataSymbol].title}get description(){return this[O.rawDataSymbol].description}get creationDate(){return new Date(this[O.rawDataSymbol].created_at)}get publishDate(){return new Date(this[O.rawDataSymbol].published_at)}get url(){return this[O.rawDataSymbol].url}get thumbnailUrl(){return this[O.rawDataSymbol].thumbnail_url}getThumbnailUrl(e,t){return this[O.rawDataSymbol].thumbnail_url.replace("%{width}",e.toString()).replace("%{height}",t.toString())}get isPublic(){return this[O.rawDataSymbol].viewable==="public"}get views(){return this[O.rawDataSymbol].view_count}get language(){return this[O.rawDataSymbol].language}get type(){return this[O.rawDataSymbol].type}get duration(){return this[O.rawDataSymbol].duration}get durationInSeconds(){let e=this[O.rawDataSymbol].duration.match(/\d+[hms]/g);if(!e)throw new O.HellFreezesOverError(`Could not parse duration string: ${this[O.rawDataSymbol].duration}`);return e.map(t=>{let r=/(\d+)([hms])/.exec(t);if(!r)throw new O.HellFreezesOverError(`Could not parse partial duration string: ${t}`);let[,a,s]=r;return parseInt(a,10)*{h:3600,m:60,s:1}[s]}).reduce((t,r)=>t+r)}get streamId(){return this[O.rawDataSymbol].stream_id}get mutedSegmentData(){var e,t;return(t=(e=this[O.rawDataSymbol].muted_segments)===null||e===void 0?void 0:e.slice())!==null&&t!==void 0?t:[]}isMutedAt(e,t,r=!1){if(this[O.rawDataSymbol].muted_segments===null)return!1;if(t==null)return this[O.rawDataSymbol].muted_segments.some(s=>s.offset<=e&&e<=s.offset+s.duration);let a=e+t;return r?this[O.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return e<o&&s.offset<a}):this[O.rawDataSymbol].muted_segments.some(s=>{let o=s.offset+s.duration;return s.offset<=e&&a<=o})}};Fa.HelixVideo=La;Tm.__decorate([(0,N1.Enumerable)(!1)],La.prototype,"_client",void 0);Tm.__decorate([(0,jx.CachedGetter)()],La.prototype,"durationInSeconds",null);Fa.HelixVideo=La=Tm.__decorate([jx.Cacheable,(0,O.rtfm)("api","HelixVideo","id")],La)});var Bm=u(Na=>{"use strict";var Hu;Object.defineProperty(Na,"__esModule",{value:!0});Na.HelixVideoApi=void 0;var kx=(f(),b(y)),Q1=C(),Cu=m(),G1=Bt(),W1=ae(),V1=ce(),$1=se(),z1=Q(),Um=Rm(),qu=Hu=class extends z1.BaseApi{static{n(this,"HelixVideoApi")}constructor(){super(...arguments),this._getVideoByIdBatcher=new G1.HelixRequestBatcher({url:"videos"},"id","id",this._client,e=>new Um.HelixVideo(e,this._client))}async getVideosByIds(e){return(await this._getVideos("id",e)).data}async getVideoById(e){let t=await this.getVideosByIds([e]);return t.length?t[0]:null}async getVideoByIdBatched(e){return await this._getVideoByIdBatcher.request(e)}async getVideosByUser(e,t={}){let r=(0,Cu.extractUserId)(e);return await this._getVideos("user_id",[r],t)}getVideosByUserPaginated(e,t={}){let r=(0,Cu.extractUserId)(e);return this._getVideosPaginated("user_id",[r],t)}async getVideosByGame(e,t={}){return await this._getVideos("game_id",[e],t)}getVideosByGamePaginated(e,t={}){return this._getVideosPaginated("game_id",[e],t)}async deleteVideosByIds(e,t){await this._client.callApi({type:"helix",url:"videos",method:"DELETE",scopes:["channel:manage:videos"],userId:(0,Cu.extractUserId)(e),query:{id:t}})}async _getVideos(e,t,r={}){if(!t.length)return{data:[]};let a=await this._client.callApi({type:"helix",url:"videos",userId:e==="user_id"?t[0]:void 0,query:{...Hu._makeVideosQuery(e,t,r),...(0,$1.createPaginationQuery)(r)}});return(0,V1.createPaginatedResult)(a,Um.HelixVideo,this._client)}_getVideosPaginated(e,t,r={}){return new W1.HelixPaginatedRequest({url:"videos",userId:e==="user_id"?t[0]:void 0,query:Hu._makeVideosQuery(e,t,r)},this._client,a=>new Um.HelixVideo(a,this._client))}static _makeVideosQuery(e,t,r={}){let{language:a,period:s,orderBy:o,type:l}=r;return{[e]:t,language:a,period:s,sort:o,type:l}}};Na.HelixVideoApi=qu;kx.__decorate([(0,Q1.Enumerable)(!1)],qu.prototype,"_getVideoByIdBatcher",void 0);Na.HelixVideoApi=qu=Hu=kx.__decorate([(0,Cu.rtfm)("api","HelixVideoApi")],qu)});var Lx=u(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.createWhisperQuery=void 0;var Mx=m();function K1(i,e){return{from_user_id:(0,Mx.extractUserId)(i),to_user_id:(0,Mx.extractUserId)(e)}}n(K1,"createWhisperQuery");Eu.createWhisperQuery=K1});var jm=u(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.HelixWhisperApi=void 0;var J1=(f(),b(y)),Fx=m(),Z1=Lx(),X1=Q(),Om=class extends X1.BaseApi{static{n(this,"HelixWhisperApi")}async sendWhisper(e,t,r){await this._client.callApi({type:"helix",url:"whispers",method:"POST",userId:(0,Fx.extractUserId)(e),scopes:["user:manage:whispers"],query:(0,Z1.createWhisperQuery)(e,t),jsonBody:{message:r}})}};Qa.HelixWhisperApi=Om;Qa.HelixWhisperApi=Om=J1.__decorate([(0,Fx.rtfm)("api","HelixWhisperApi")],Om)});var Mm=u(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.ApiReportedRequest=void 0;var km=class{static{n(this,"ApiReportedRequest")}constructor(e,t,r){this._options=e,this._httpStatus=t,this._resolvedUserId=r}get options(){return this._options}get httpStatus(){return this._httpStatus}get resolvedUserId(){return this._resolvedUserId}};Pu.ApiReportedRequest=km});var Du=u(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.BaseApiClient=void 0;var G=(f(),b(y)),W=xi(),Y1=Ys(),eI=C(),tI=od(),ai=Z(),Au=Cd(),Nx=m(),rI=rg(),iI=Rd(),nI=$d(),aI=Zd(),sI=ih(),oI=Ch(),lI=Ah(),uI=Rh(),cI=kh(),dI=$h(),hI=ep(),pI=ip(),mI=sp(),_I=cp(),yI=Ep(),fI=Tp(),gI=jp(),bI=Np(),xI=Kp(),wI=Xp(),vI=sm(),SI=dm(),HI=ym(),CI=Im(),qI=Bm(),EI=jm(),PI=Mm(),L=class extends tI.EventEmitter{static{n(this,"BaseApiClient")}constructor(e,t,r){super(),this.onRequest=this.registerEvent(),this._config=e,this._logger=t,this._rateLimiter=r}async requestScopesForUser(e,t){await this._config.authProvider.getAccessTokenForUser(e,...t.map(r=>[r]))}async getTokenInfo(){try{let e=await this.callApi({type:"auth",url:"validate"});return new Au.TokenInfo(e)}catch(e){throw e instanceof ai.HttpStatusCodeError&&e.statusCode===401?new Au.InvalidTokenError({cause:e}):e}}async callApi(e){var t;let{authProvider:r}=this._config;if(!((t=e.auth)!==null&&t!==void 0?t:!0))return await(0,ai.callTwitchApi)(e,r.clientId,void 0,void 0,this._config.fetchOptions);let s=!1;if(e.forceType)switch(e.forceType){case"app":{if(!r.getAppAccessToken)throw new Error("Tried to make an API call that requires an app access token but your auth provider does not support that");let d=await r.getAppAccessToken();return await this._callApiUsingInitialToken(e,d)}case"user":{s=!0;break}default:throw new Nx.HellFreezesOverError(`Unknown forced token type: ${e.forceType}`)}if(e.scopes&&(s=!0),s){let d=e.canOverrideScopedUserContext?this._getUserIdFromRequestContext(e.userId):e.userId;if(!d)throw new Error("Tried to make an API call with a user context but no context user ID");let h=await r.getAccessTokenForUser(d,e.scopes);if(!h)throw new Error(`Tried to make an API call with a user context for user ID ${d} but no token was found`);if((0,Au.accessTokenIsExpired)(h)&&r.refreshAccessTokenForUser){let p=await r.refreshAccessTokenForUser(d);return await this._callApiUsingInitialToken(e,p,!0)}return await this._callApiUsingInitialToken(e,h)}let o=this._getUserIdFromRequestContext(e.userId),l=o===null?await r.getAnyAccessToken():await r.getAnyAccessToken(o??e.userId);if((0,Au.accessTokenIsExpired)(l)&&l.userId&&r.refreshAccessTokenForUser){let d=await r.refreshAccessTokenForUser(l.userId);return await this._callApiUsingInitialToken(e,d,!0)}return await this._callApiUsingInitialToken(e,l)}get bits(){return new iI.HelixBitsApi(this)}get channels(){return new nI.HelixChannelApi(this)}get channelPoints(){return new aI.HelixChannelPointsApi(this)}get charity(){return new sI.HelixCharityApi(this)}get chat(){return new oI.HelixChatApi(this)}get clips(){return new lI.HelixClipApi(this)}get contentClassificationLabels(){return new uI.HelixContentClassificationLabelApi(this)}get entitlements(){return new cI.HelixEntitlementApi(this)}get eventSub(){return new dI.HelixEventSubApi(this)}get extensions(){return new hI.HelixExtensionsApi(this)}get games(){return new pI.HelixGameApi(this)}get hypeTrain(){return new _I.HelixHypeTrainApi(this)}get goals(){return new mI.HelixGoalApi(this)}get moderation(){return new yI.HelixModerationApi(this)}get polls(){return new fI.HelixPollApi(this)}get predictions(){return new gI.HelixPredictionApi(this)}get raids(){return new bI.HelixRaidApi(this)}get schedule(){return new xI.HelixScheduleApi(this)}get search(){return new wI.HelixSearchApi(this)}get streams(){return new vI.HelixStreamApi(this)}get subscriptions(){return new SI.HelixSubscriptionApi(this)}get teams(){return new HI.HelixTeamApi(this)}get users(){return new CI.HelixUserApi(this)}get videos(){return new qI.HelixVideoApi(this)}get whispers(){return new EI.HelixWhisperApi(this)}get rateLimiterStats(){return this._rateLimiter instanceof Y1.ResponseBasedRateLimiter?this._rateLimiter.stats:null}get _authProvider(){return this._config.authProvider}get _mockServerPort(){return this._config.mockServerPort}get _batchDelay(){var e;return(e=this._config.batchDelay)!==null&&e!==void 0?e:0}_getUserIdFromRequestContext(e){return e}async _callApiUsingInitialToken(e,t,r=!1){var a;let{authProvider:s}=this._config,{authorizationType:o}=s,l=await this._callApiInternal(e,s.clientId,t.accessToken,o);if(l.status===401&&!r){if(t.userId){if(s.refreshAccessTokenForUser){let d=await s.refreshAccessTokenForUser(t.userId);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}else if(s.getAppAccessToken){let d=await s.getAppAccessToken(!0);l=await this._callApiInternal(e,s.clientId,d.accessToken,o)}}return this.emit(this.onRequest,new PI.ApiReportedRequest(e,l.status,(a=t.userId)!==null&&a!==void 0?a:null)),await(0,ai.handleTwitchApiResponseError)(l,e),await(0,ai.transformTwitchApiResponse)(l)}async _callApiInternal(e,t,r,a){var s,o,l;let{fetchOptions:d,mockServerPort:h}=this._config,p=(s=e.type)!==null&&s!==void 0?s:"helix";this._logger.debug(`Calling ${p} API: ${(o=e.method)!==null&&o!==void 0?o:"GET"} ${e.url}`),this._logger.trace(`Query: ${JSON.stringify(e.query)}`),e.jsonBody&&this._logger.trace(`Request body: ${JSON.stringify(e.jsonBody)}`);let x=rI.operation({retries:3,minTimeout:500,factor:2}),{promise:q,resolve:E,reject:w}=(0,eI.promiseWithResolvers)();x.attempt(async()=>{try{let v=p==="helix"?await this._rateLimiter.request({options:e,clientId:t,accessToken:r,authorizationType:a,fetchOptions:d,mockServerPort:h}):await(0,ai.callTwitchApiRaw)(e,t,r,a,d,h);!v.ok&&v.status>=500&&v.status<600&&await(0,ai.handleTwitchApiResponseError)(v,e),E(v)}catch(v){if(x.retry(v))return;w(x.mainError())}});let P=await q;return this._logger.debug(`Called ${p} API: ${(l=e.method)!==null&&l!==void 0?l:"GET"} ${e.url} - result: ${P.status}`),P}};Ga.BaseApiClient=L;G.__decorate([(0,W.CachedGetter)()],L.prototype,"bits",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"channels",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"channelPoints",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"charity",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"chat",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"clips",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"contentClassificationLabels",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"entitlements",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"eventSub",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"extensions",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"games",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"hypeTrain",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"goals",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"moderation",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"polls",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"predictions",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"raids",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"schedule",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"search",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"streams",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"subscriptions",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"teams",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"users",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"videos",null);G.__decorate([(0,W.CachedGetter)()],L.prototype,"whispers",null);Ga.BaseApiClient=L=G.__decorate([W.Cacheable,(0,Nx.rtfm)("api","ApiClient")],L)});var Qx=u(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.NoContextApiClient=void 0;var AI=(f(),b(y)),DI=m(),II=Du(),Lm=class extends II.BaseApiClient{static{n(this,"NoContextApiClient")}_getUserIdFromRequestContext(){return null}};Wa.NoContextApiClient=Lm;Wa.NoContextApiClient=Lm=AI.__decorate([(0,DI.rtfm)("api","ApiClient")],Lm)});var Gx=u(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.UserContextApiClient=void 0;var TI=(f(),b(y)),RI=m(),UI=Du(),Fm=class extends UI.BaseApiClient{static{n(this,"UserContextApiClient")}constructor(e,t,r,a){super(e,t,r),this._userId=a}_getUserIdFromRequestContext(){return this._userId}};Va.UserContextApiClient=Fm;Va.UserContextApiClient=Fm=TI.__decorate([(0,RI.rtfm)("api","ApiClient")],Fm)});var zx=u($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.ApiClient=void 0;var BI=(f(),b(y)),OI=hi(),jI=mi(),Wx=Ys(),kI=Z(),$x=m(),MI=rd(),LI=Rf(),FI=Du(),NI=Qx(),Vx=Gx(),Nm=class extends FI.BaseApiClient{static{n(this,"ApiClient")}constructor(e){if(!e.authProvider)throw new MI.ConfigError("No auth provider given. Please supply the `authProvider` option.");let t={name:"twurple:api:rate-limiter",...e.logger};super(e,(0,jI.createLogger)({name:"twurple:api:client",...e.logger}),OI.isNode?new Wx.PartitionedRateLimiter({getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey"),createChild:n(()=>new LI.HelixRateLimiter({logger:t}),"createChild")}):new Wx.PartitionedTimeBasedRateLimiter({logger:t,bucketSize:800,timeFrame:64e3,doRequest:n(async({options:r,clientId:a,accessToken:s,authorizationType:o,fetchOptions:l,mockServerPort:d})=>await(0,kI.callTwitchApiRaw)(r,a,s,o,l,d),"doRequest"),getPartitionKey:n(r=>{var a;return(a=r.userId)!==null&&a!==void 0?a:null},"getPartitionKey")}))}async asUser(e,t){let r=new Vx.UserContextApiClient(this._config,this._logger,this._rateLimiter,(0,$x.extractUserId)(e));return await t(r)}async asIntent(e,t){if(!this._authProvider.getAccessTokenForIntent)throw new Error("Trying to use intents with an auth provider that does not support them");for(let r of e){let a=await this._authProvider.getAccessTokenForIntent(r);if(a){let s=new Vx.UserContextApiClient(this._config,this._logger,this._rateLimiter,a.userId);return await t(s)}}throw new Error(`Intents [${e.join(", ")}] not found in auth provider`)}async withoutUser(e){let t=new NI.NoContextApiClient(this._config,this._logger,this._rateLimiter);return await e(t)}};$a.ApiClient=Nm;$a.ApiClient=Nm=BI.__decorate([(0,$x.rtfm)("api","ApiClient")],Nm)});var Jx=u(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.HelixFollow=void 0;var Kx=(f(),b(y)),QI=C(),je=m(),Iu=class extends je.DataObject{static{n(this,"HelixFollow")}constructor(e,t){super(e),this._client=t}get userId(){return this[je.rawDataSymbol].from_id}get userName(){return this[je.rawDataSymbol].from_login}get userDisplayName(){return this[je.rawDataSymbol].from_name}async getUser(){return(0,je.checkRelationAssertion)(await this._client.users.getUserById(this[je.rawDataSymbol].from_id))}get followedUserId(){return this[je.rawDataSymbol].to_id}get followedUserName(){return this[je.rawDataSymbol].to_login}get followedUserDisplayName(){return this[je.rawDataSymbol].to_name}async getFollowedUser(){return(0,je.checkRelationAssertion)(await this._client.users.getUserById(this[je.rawDataSymbol].to_id))}get followDate(){return new Date(this[je.rawDataSymbol].followed_at)}};za.HelixFollow=Iu;Kx.__decorate([(0,QI.Enumerable)(!1)],Iu.prototype,"_client",void 0);za.HelixFollow=Iu=Kx.__decorate([(0,je.rtfm)("api","HelixFollow")],Iu)});var Zx=u(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.HelixGoal=c.HelixGoalApi=c.HelixGame=c.HelixGameApi=c.HelixExtensionTransaction=c.HelixExtensionBitsProduct=c.HelixExtensionsApi=c.HelixPaginatedEventSubSubscriptionsRequest=c.HelixEventSubSubscription=c.HelixEventSubConduitShard=c.HelixEventSubConduit=c.HelixEventSubApi=c.HelixDropsEntitlement=c.HelixEntitlementApi=c.HelixContentClassificationLabel=c.HelixContentClassificationLabelApi=c.HelixClip=c.HelixClipApi=c.HelixSharedChatSession=c.HelixSharedChatSessionParticipant=c.HelixSentChatMessage=c.HelixPrivilegedChatSettings=c.HelixUserEmote=c.HelixEmoteFromSet=c.HelixChannelEmote=c.HelixEmote=c.HelixChatChatter=c.HelixChatSettings=c.HelixChatBadgeVersion=c.HelixChatBadgeSet=c.HelixChatApi=c.HelixCharityCampaignAmount=c.HelixCharityCampaignDonation=c.HelixCharityCampaign=c.HelixCharityApi=c.HelixCustomRewardRedemption=c.HelixCustomReward=c.HelixChannelPointsApi=c.HelixChannelReference=c.HelixFollowedChannel=c.HelixChannelFollower=c.HelixChannelEditor=c.HelixChannel=c.HelixAdSchedule=c.HelixChannelApi=c.HelixCheermoteList=c.HelixBitsLeaderboardEntry=c.HelixBitsLeaderboard=c.HelixBitsApi=c.ApiClient=void 0;c.HelixVideo=c.HelixVideoApi=c.HelixUserExtension=c.HelixInstalledExtensionList=c.HelixInstalledExtension=c.HelixBaseExtension=c.HelixUser=c.HelixPrivilegedUser=c.HelixFollow=c.HelixUserBlock=c.HelixUserApi=c.HelixTeamWithUsers=c.HelixTeam=c.HelixTeamApi=c.HelixUserSubscription=c.HelixSubscription=c.HelixSubscriptionApi=c.HelixPaginatedSubscriptionsRequest=c.HelixStreamMarkerWithVideo=c.HelixStreamMarker=c.HelixStream=c.HelixStreamApi=c.HelixChannelSearchResult=c.HelixSearchApi=c.HelixPaginatedScheduleSegmentRequest=c.HelixScheduleSegment=c.HelixSchedule=c.HelixScheduleApi=c.HelixUserRelation=c.HelixRaid=c.HelixRaidApi=c.HelixPredictor=c.HelixPredictionOutcome=c.HelixPrediction=c.HelixPredictionApi=c.HelixPollChoice=c.HelixPoll=c.HelixPollApi=c.HelixWarning=c.HelixUnbanRequest=c.HelixShieldModeStatus=c.HelixBlockedTerm=c.HelixBanUser=c.HelixModeratedChannel=c.HelixModerator=c.HelixBan=c.HelixModerationApi=c.HelixHypeTrainEvent=c.HelixHypeTrainContribution=c.HelixHypeTrainApi=void 0;c.HellFreezesOverError=c.HelixExtension=c.extractUserName=c.extractUserId=c.HelixPaginatedRequestWithTotal=c.HelixPaginatedRequest=c.ApiReportedRequest=c.StreamNotLiveError=c.ConfigError=c.HelixWhisperApi=void 0;var GI=zx();Object.defineProperty(c,"ApiClient",{enumerable:!0,get:n(function(){return GI.ApiClient},"get")});var WI=Rd();Object.defineProperty(c,"HelixBitsApi",{enumerable:!0,get:n(function(){return WI.HelixBitsApi},"get")});var VI=Pd();Object.defineProperty(c,"HelixBitsLeaderboard",{enumerable:!0,get:n(function(){return VI.HelixBitsLeaderboard},"get")});var $I=qd();Object.defineProperty(c,"HelixBitsLeaderboardEntry",{enumerable:!0,get:n(function(){return $I.HelixBitsLeaderboardEntry},"get")});var zI=Dd();Object.defineProperty(c,"HelixCheermoteList",{enumerable:!0,get:n(function(){return zI.HelixCheermoteList},"get")});var KI=$d();Object.defineProperty(c,"HelixChannelApi",{enumerable:!0,get:n(function(){return KI.HelixChannelApi},"get")});var JI=Nd();Object.defineProperty(c,"HelixAdSchedule",{enumerable:!0,get:n(function(){return JI.HelixAdSchedule},"get")});var ZI=jd();Object.defineProperty(c,"HelixChannel",{enumerable:!0,get:n(function(){return ZI.HelixChannel},"get")});var XI=kd();Object.defineProperty(c,"HelixChannelEditor",{enumerable:!0,get:n(function(){return XI.HelixChannelEditor},"get")});var YI=Md();Object.defineProperty(c,"HelixChannelFollower",{enumerable:!0,get:n(function(){return YI.HelixChannelFollower},"get")});var eT=Ld();Object.defineProperty(c,"HelixFollowedChannel",{enumerable:!0,get:n(function(){return eT.HelixFollowedChannel},"get")});var tT=zh();Object.defineProperty(c,"HelixChannelReference",{enumerable:!0,get:n(function(){return tT.HelixChannelReference},"get")});var rT=Zd();Object.defineProperty(c,"HelixChannelPointsApi",{enumerable:!0,get:n(function(){return rT.HelixChannelPointsApi},"get")});var iT=zd();Object.defineProperty(c,"HelixCustomReward",{enumerable:!0,get:n(function(){return iT.HelixCustomReward},"get")});var nT=Kd();Object.defineProperty(c,"HelixCustomRewardRedemption",{enumerable:!0,get:n(function(){return nT.HelixCustomRewardRedemption},"get")});var aT=ih();Object.defineProperty(c,"HelixCharityApi",{enumerable:!0,get:n(function(){return aT.HelixCharityApi},"get")});var sT=Yd();Object.defineProperty(c,"HelixCharityCampaign",{enumerable:!0,get:n(function(){return sT.HelixCharityCampaign},"get")});var oT=eh();Object.defineProperty(c,"HelixCharityCampaignDonation",{enumerable:!0,get:n(function(){return oT.HelixCharityCampaignDonation},"get")});var lT=rl();Object.defineProperty(c,"HelixCharityCampaignAmount",{enumerable:!0,get:n(function(){return lT.HelixCharityCampaignAmount},"get")});var uT=Ch();Object.defineProperty(c,"HelixChatApi",{enumerable:!0,get:n(function(){return uT.HelixChatApi},"get")});var cT=dh();Object.defineProperty(c,"HelixChatBadgeSet",{enumerable:!0,get:n(function(){return cT.HelixChatBadgeSet},"get")});var dT=ch();Object.defineProperty(c,"HelixChatBadgeVersion",{enumerable:!0,get:n(function(){return dT.HelixChatBadgeVersion},"get")});var hT=cl();Object.defineProperty(c,"HelixChatSettings",{enumerable:!0,get:n(function(){return hT.HelixChatSettings},"get")});var pT=hh();Object.defineProperty(c,"HelixChatChatter",{enumerable:!0,get:n(function(){return pT.HelixChatChatter},"get")});var mT=tn();Object.defineProperty(c,"HelixEmote",{enumerable:!0,get:n(function(){return mT.HelixEmote},"get")});var _T=lh();Object.defineProperty(c,"HelixChannelEmote",{enumerable:!0,get:n(function(){return _T.HelixChannelEmote},"get")});var yT=mh();Object.defineProperty(c,"HelixEmoteFromSet",{enumerable:!0,get:n(function(){return yT.HelixEmoteFromSet},"get")});var fT=_h();Object.defineProperty(c,"HelixUserEmote",{enumerable:!0,get:n(function(){return fT.HelixUserEmote},"get")});var gT=gh();Object.defineProperty(c,"HelixPrivilegedChatSettings",{enumerable:!0,get:n(function(){return gT.HelixPrivilegedChatSettings},"get")});var bT=xh();Object.defineProperty(c,"HelixSentChatMessage",{enumerable:!0,get:n(function(){return bT.HelixSentChatMessage},"get")});var xT=wh();Object.defineProperty(c,"HelixSharedChatSessionParticipant",{enumerable:!0,get:n(function(){return xT.HelixSharedChatSessionParticipant},"get")});var wT=vh();Object.defineProperty(c,"HelixSharedChatSession",{enumerable:!0,get:n(function(){return wT.HelixSharedChatSession},"get")});var vT=Ah();Object.defineProperty(c,"HelixClipApi",{enumerable:!0,get:n(function(){return vT.HelixClipApi},"get")});var ST=qh();Object.defineProperty(c,"HelixClip",{enumerable:!0,get:n(function(){return ST.HelixClip},"get")});var HT=Rh();Object.defineProperty(c,"HelixContentClassificationLabelApi",{enumerable:!0,get:n(function(){return HT.HelixContentClassificationLabelApi},"get")});var CT=Ih();Object.defineProperty(c,"HelixContentClassificationLabel",{enumerable:!0,get:n(function(){return CT.HelixContentClassificationLabel},"get")});var qT=kh();Object.defineProperty(c,"HelixEntitlementApi",{enumerable:!0,get:n(function(){return qT.HelixEntitlementApi},"get")});var ET=Uh();Object.defineProperty(c,"HelixDropsEntitlement",{enumerable:!0,get:n(function(){return ET.HelixDropsEntitlement},"get")});var PT=$h();Object.defineProperty(c,"HelixEventSubApi",{enumerable:!0,get:n(function(){return PT.HelixEventSubApi},"get")});var AT=Fh();Object.defineProperty(c,"HelixEventSubConduit",{enumerable:!0,get:n(function(){return AT.HelixEventSubConduit},"get")});var DT=Qh();Object.defineProperty(c,"HelixEventSubConduitShard",{enumerable:!0,get:n(function(){return DT.HelixEventSubConduitShard},"get")});var IT=Hl();Object.defineProperty(c,"HelixEventSubSubscription",{enumerable:!0,get:n(function(){return IT.HelixEventSubSubscription},"get")});var TT=Lh();Object.defineProperty(c,"HelixPaginatedEventSubSubscriptionsRequest",{enumerable:!0,get:n(function(){return TT.HelixPaginatedEventSubSubscriptionsRequest},"get")});var RT=ep();Object.defineProperty(c,"HelixExtensionsApi",{enumerable:!0,get:n(function(){return RT.HelixExtensionsApi},"get")});var UT=Jh();Object.defineProperty(c,"HelixExtensionBitsProduct",{enumerable:!0,get:n(function(){return UT.HelixExtensionBitsProduct},"get")});var BT=Zh();Object.defineProperty(c,"HelixExtensionTransaction",{enumerable:!0,get:n(function(){return BT.HelixExtensionTransaction},"get")});var OT=ip();Object.defineProperty(c,"HelixGameApi",{enumerable:!0,get:n(function(){return OT.HelixGameApi},"get")});var jT=Il();Object.defineProperty(c,"HelixGame",{enumerable:!0,get:n(function(){return jT.HelixGame},"get")});var kT=sp();Object.defineProperty(c,"HelixGoalApi",{enumerable:!0,get:n(function(){return kT.HelixGoalApi},"get")});var MT=np();Object.defineProperty(c,"HelixGoal",{enumerable:!0,get:n(function(){return MT.HelixGoal},"get")});var LT=cp();Object.defineProperty(c,"HelixHypeTrainApi",{enumerable:!0,get:n(function(){return LT.HelixHypeTrainApi},"get")});var FT=op();Object.defineProperty(c,"HelixHypeTrainContribution",{enumerable:!0,get:n(function(){return FT.HelixHypeTrainContribution},"get")});var NT=lp();Object.defineProperty(c,"HelixHypeTrainEvent",{enumerable:!0,get:n(function(){return NT.HelixHypeTrainEvent},"get")});var QT=Ep();Object.defineProperty(c,"HelixModerationApi",{enumerable:!0,get:n(function(){return QT.HelixModerationApi},"get")});var GT=yp();Object.defineProperty(c,"HelixBan",{enumerable:!0,get:n(function(){return GT.HelixBan},"get")});var WT=xp();Object.defineProperty(c,"HelixModerator",{enumerable:!0,get:n(function(){return WT.HelixModerator},"get")});var VT=bp();Object.defineProperty(c,"HelixModeratedChannel",{enumerable:!0,get:n(function(){return VT.HelixModeratedChannel},"get")});var $T=kl();Object.defineProperty(c,"HelixBanUser",{enumerable:!0,get:n(function(){return $T.HelixBanUser},"get")});var zT=gp();Object.defineProperty(c,"HelixBlockedTerm",{enumerable:!0,get:n(function(){return zT.HelixBlockedTerm},"get")});var KT=wp();Object.defineProperty(c,"HelixShieldModeStatus",{enumerable:!0,get:n(function(){return KT.HelixShieldModeStatus},"get")});var JT=vp();Object.defineProperty(c,"HelixUnbanRequest",{enumerable:!0,get:n(function(){return JT.HelixUnbanRequest},"get")});var ZT=Sp();Object.defineProperty(c,"HelixWarning",{enumerable:!0,get:n(function(){return ZT.HelixWarning},"get")});var XT=Tp();Object.defineProperty(c,"HelixPollApi",{enumerable:!0,get:n(function(){return XT.HelixPollApi},"get")});var YT=Dp();Object.defineProperty(c,"HelixPoll",{enumerable:!0,get:n(function(){return YT.HelixPoll},"get")});var eR=Ap();Object.defineProperty(c,"HelixPollChoice",{enumerable:!0,get:n(function(){return eR.HelixPollChoice},"get")});var tR=jp();Object.defineProperty(c,"HelixPredictionApi",{enumerable:!0,get:n(function(){return tR.HelixPredictionApi},"get")});var rR=Bp();Object.defineProperty(c,"HelixPrediction",{enumerable:!0,get:n(function(){return rR.HelixPrediction},"get")});var iR=Up();Object.defineProperty(c,"HelixPredictionOutcome",{enumerable:!0,get:n(function(){return iR.HelixPredictionOutcome},"get")});var nR=Rp();Object.defineProperty(c,"HelixPredictor",{enumerable:!0,get:n(function(){return nR.HelixPredictor},"get")});var aR=Np();Object.defineProperty(c,"HelixRaidApi",{enumerable:!0,get:n(function(){return aR.HelixRaidApi},"get")});var sR=Mp();Object.defineProperty(c,"HelixRaid",{enumerable:!0,get:n(function(){return sR.HelixRaid},"get")});var oR=Lo();Object.defineProperty(c,"HelixUserRelation",{enumerable:!0,get:n(function(){return oR.HelixUserRelation},"get")});var lR=Kp();Object.defineProperty(c,"HelixScheduleApi",{enumerable:!0,get:n(function(){return lR.HelixScheduleApi},"get")});var uR=Vp();Object.defineProperty(c,"HelixSchedule",{enumerable:!0,get:n(function(){return uR.HelixSchedule},"get")});var cR=pa();Object.defineProperty(c,"HelixScheduleSegment",{enumerable:!0,get:n(function(){return cR.HelixScheduleSegment},"get")});var dR=Wp();Object.defineProperty(c,"HelixPaginatedScheduleSegmentRequest",{enumerable:!0,get:n(function(){return dR.HelixPaginatedScheduleSegmentRequest},"get")});var hR=Xp();Object.defineProperty(c,"HelixSearchApi",{enumerable:!0,get:n(function(){return hR.HelixSearchApi},"get")});var pR=Jp();Object.defineProperty(c,"HelixChannelSearchResult",{enumerable:!0,get:n(function(){return pR.HelixChannelSearchResult},"get")});var mR=sm();Object.defineProperty(c,"HelixStreamApi",{enumerable:!0,get:n(function(){return mR.HelixStreamApi},"get")});var _R=tm();Object.defineProperty(c,"HelixStream",{enumerable:!0,get:n(function(){return _R.HelixStream},"get")});var yR=su();Object.defineProperty(c,"HelixStreamMarker",{enumerable:!0,get:n(function(){return yR.HelixStreamMarker},"get")});var fR=nm();Object.defineProperty(c,"HelixStreamMarkerWithVideo",{enumerable:!0,get:n(function(){return fR.HelixStreamMarkerWithVideo},"get")});var gR=um();Object.defineProperty(c,"HelixPaginatedSubscriptionsRequest",{enumerable:!0,get:n(function(){return gR.HelixPaginatedSubscriptionsRequest},"get")});var bR=dm();Object.defineProperty(c,"HelixSubscriptionApi",{enumerable:!0,get:n(function(){return bR.HelixSubscriptionApi},"get")});var xR=pu();Object.defineProperty(c,"HelixSubscription",{enumerable:!0,get:n(function(){return xR.HelixSubscription},"get")});var wR=hu();Object.defineProperty(c,"HelixUserSubscription",{enumerable:!0,get:n(function(){return wR.HelixUserSubscription},"get")});var vR=ym();Object.defineProperty(c,"HelixTeamApi",{enumerable:!0,get:n(function(){return vR.HelixTeamApi},"get")});var SR=yu();Object.defineProperty(c,"HelixTeam",{enumerable:!0,get:n(function(){return SR.HelixTeam},"get")});var HR=pm();Object.defineProperty(c,"HelixTeamWithUsers",{enumerable:!0,get:n(function(){return HR.HelixTeamWithUsers},"get")});var CR=Im();Object.defineProperty(c,"HelixUserApi",{enumerable:!0,get:n(function(){return CR.HelixUserApi},"get")});var qR=Pm();Object.defineProperty(c,"HelixUserBlock",{enumerable:!0,get:n(function(){return qR.HelixUserBlock},"get")});var ER=Jx();Object.defineProperty(c,"HelixFollow",{enumerable:!0,get:n(function(){return ER.HelixFollow},"get")});var PR=Em();Object.defineProperty(c,"HelixPrivilegedUser",{enumerable:!0,get:n(function(){return PR.HelixPrivilegedUser},"get")});var AR=wu();Object.defineProperty(c,"HelixUser",{enumerable:!0,get:n(function(){return AR.HelixUser},"get")});var DR=bu();Object.defineProperty(c,"HelixBaseExtension",{enumerable:!0,get:n(function(){return DR.HelixBaseExtension},"get")});var IR=bm();Object.defineProperty(c,"HelixInstalledExtension",{enumerable:!0,get:n(function(){return IR.HelixInstalledExtension},"get")});var TR=vm();Object.defineProperty(c,"HelixInstalledExtensionList",{enumerable:!0,get:n(function(){return TR.HelixInstalledExtensionList},"get")});var RR=Cm();Object.defineProperty(c,"HelixUserExtension",{enumerable:!0,get:n(function(){return RR.HelixUserExtension},"get")});var UR=Bm();Object.defineProperty(c,"HelixVideoApi",{enumerable:!0,get:n(function(){return UR.HelixVideoApi},"get")});var BR=Rm();Object.defineProperty(c,"HelixVideo",{enumerable:!0,get:n(function(){return BR.HelixVideo},"get")});var OR=jm();Object.defineProperty(c,"HelixWhisperApi",{enumerable:!0,get:n(function(){return OR.HelixWhisperApi},"get")});var jR=rd();Object.defineProperty(c,"ConfigError",{enumerable:!0,get:n(function(){return jR.ConfigError},"get")});var kR=em();Object.defineProperty(c,"StreamNotLiveError",{enumerable:!0,get:n(function(){return kR.StreamNotLiveError},"get")});var MR=Mm();Object.defineProperty(c,"ApiReportedRequest",{enumerable:!0,get:n(function(){return MR.ApiReportedRequest},"get")});var LR=ae();Object.defineProperty(c,"HelixPaginatedRequest",{enumerable:!0,get:n(function(){return LR.HelixPaginatedRequest},"get")});var FR=Mr();Object.defineProperty(c,"HelixPaginatedRequestWithTotal",{enumerable:!0,get:n(function(){return FR.HelixPaginatedRequestWithTotal},"get")});var Tu=m();Object.defineProperty(c,"extractUserId",{enumerable:!0,get:n(function(){return Tu.extractUserId},"get")});Object.defineProperty(c,"extractUserName",{enumerable:!0,get:n(function(){return Tu.extractUserName},"get")});Object.defineProperty(c,"HelixExtension",{enumerable:!0,get:n(function(){return Tu.HelixExtension},"get")});Object.defineProperty(c,"HellFreezesOverError",{enumerable:!0,get:n(function(){return Tu.HellFreezesOverError},"get")})});var nw=u((LG,iw)=>{var Xx=ju(),NR=Lu(),Yx=Za(),zt=qt(),ew=Nu(),tw=Gu(),rw=Vu(),Ru=k_(),{ApiClient:QR}=Zx(),{AppTokenAuthProvider:GR}=Cd(),Qm=class{static{n(this,"EmoteFetcher")}constructor(e,t,r){if(r&&r.apiClient)this.apiClient=r.apiClient;else if(e!==void 0&&t!==void 0){let a=new GR(e,t);this.apiClient=new QR({authProvider:a})}this.emotes=new Yx,this.channels=new Yx,this.ffzModifiersFetched=!1}get globalChannel(){return this.channels.get(null)}_setupChannel(e,t=null){let r=this.channels.get(e);return r||(r=new NR(this,e),this.channels.set(e,r)),t&&(r.format=t),r}_getRawTwitchEmotes(e){if(!this.apiClient)throw new Error("Client id or client secret not provided.");return e?this.apiClient.chat.getChannelEmotes(e):this.apiClient.chat.getGlobalEmotes()}_cacheTwitchEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new rw(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawBTTVEmotes(e){let t=e?zt.BTTV.Channel(e):zt.BTTV.Global;return Ru.get(t).then(r=>r.data instanceof Array?r.data:[...r.data.channelEmotes,...r.data.sharedEmotes])}_cacheBTTVEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new Xx(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawFFZEmoteSet(e){let t=zt.FFZ.Set(e);return Ru.get(t).then(r=>r.data.set.emoticons)}_getRawFFZEmotes(e){let t=zt.FFZ.Channel(e);return Ru.get(t).then(r=>{let a=[];for(let s of Object.keys(r.data.sets)){let o=r.data.sets[s];a.push(...o.emoticons)}return a})}_cacheFFZEmote(e,t,r=null){let a=this._setupChannel(e),s=r||new ew(a,t.id,t);return this.emotes.set(s.code,s),a.emotes.set(s.code,s),s}_getRawSevenTVEmotes(e){let t=e?zt.SevenTV.Channel(e):zt.SevenTV.Global;return Ru.get(t).then(r=>r.data)}_cacheSevenTVEmote(e,t,r,a=null){let s=this._setupChannel(e,r),o=a||new tw(s,t.id,t);return this.emotes.set(o.code,o),s.emotes.set(o.code,o),o}fetchTwitchEmotes(e=null){return this._getRawTwitchEmotes(e).then(t=>{for(let r of t)this._cacheTwitchEmote(e,{code:r.name,id:r.id,formats:r.formats});return this.channels.get(e).emotes.filter(r=>r.type==="twitch")})}fetchBTTVEmotes(e=null){return this._getRawBTTVEmotes(e).then(t=>{for(let r of t)this._cacheBTTVEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="bttv")})}async fetchFFZEmotes(e=null){return this.ffzModifiersFetched||(this.ffzModifiersFetched=!0,await this._getRawFFZEmoteSet(zt.FFZ.sets.Modifiers).then(t=>{for(let r of t)this._cacheFFZEmote(null,r)})),e?this._getRawFFZEmotes(e).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")}):this._getRawFFZEmoteSet(zt.FFZ.sets.Global).then(t=>{for(let r of t)this._cacheFFZEmote(e,r);return this.channels.get(e).emotes.filter(r=>r.type==="ffz")})}fetchSevenTVEmotes(e=null,t="webp"){return this._getRawSevenTVEmotes(e).then(r=>{if("emotes"in r)for(let a of r.emotes)this._cacheSevenTVEmote(e,a,t);else for(let a of r.emote_set.emotes)this._cacheSevenTVEmote(e,a,t);return this.channels.get(e).emotes.filter(a=>a.type==="7tv")})}fromObject(e){let t=[],r={bttv:{class:Xx,cache:n((a,s,o)=>this._cacheBTTVEmote(s,null,o),"cache")},ffz:{class:ew,cache:n((a,s,o)=>this._cacheFFZEmote(s,null,o),"cache")},"7tv":{class:tw,cache:n((a,s,o)=>this._cacheSevenTVEmote(s,null,a.imageType,o),"cache")},twitch:{class:rw,cache:n((a,s,o)=>this._cacheTwitchEmote(s,null,o),"cache")}};for(let a of e){let{type:s}=a;if(!Object.keys(r).includes(s))throw new TypeError(`Unknown type: ${s}`);let o=r[s].class;this._setupChannel(a.channel_id,s==="7tv"?a.imageType:null);let l=o.fromObject(a,this.channels.get(a.channel_id));r[s].cache(a,a.channel_id,l),t.push(l)}return t}};iw.exports=Qm});var sw=u((NG,aw)=>{var WR=qt(),Gm=class{static{n(this,"EmoteParser")}constructor(e,t={}){this.fetcher=e,this.options=Object.assign({template:"",type:"markdown",match:/:(.+?):/g},t),this._validateOptions(this.options)}_validateOptions(e){if(e.template&&typeof e.template!="string")throw new TypeError("Template must be a string");if(!["markdown","html","bbcode","plain"].includes(e.type))throw new TypeError("Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`");if(!(e.match instanceof RegExp)||!e.match.global)throw new TypeError("Match must be a global RegExp.")}parse(e,t=0){return e.replace(this.options.match,(a,s)=>{let o=this.fetcher.emotes.get(s);if(!o)return a;if(o.modifier)return"";let l=this.options.template||WR.Templates[this.options.type],d=o.toLink(t);return l.replace(/{link}/g,d).replace(/{name}/g,o.code).replace(/{size}/g,t).replace(/{creator}/g,o.ownerName||"global")})}};aw.exports=Gm});var VR=u((GG,ow)=>{ow.exports={BTTVEmote:ju(),Channel:Lu(),Collection:Za(),Constants:qt(),Emote:fr(),EmoteFetcher:nw(),EmoteParser:sw(),FFZEmote:Nu(),SevenTVEmote:Gu(),TwitchEmote:Vu()}});export default VR();
|
|
20
20
|
/*! Bundled license information:
|
|
21
21
|
|
|
22
22
|
axios/dist/browser/axios.cjs:
|
|
23
|
-
(*! Axios v1.
|
|
23
|
+
(*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors *)
|
|
24
24
|
*/
|
|
25
25
|
//# sourceMappingURL=TwitchEmoticons.min.js.map
|