@tbogard/itunes-search
Version:
An iTunes Search library that uses Apple Web Search API. It performes blazing fast searches on iTunes Web API to fetch anything you want to search related to music tracks, music videos, artists, albums, movies, apps in the appStore, books, audiobooks and
7 lines (6 loc) • 46 kB
JavaScript
var Zr=Object.create;var ie=Object.defineProperty,Xr=Object.defineProperties,Qr=Object.getOwnPropertyDescriptor,es=Object.getOwnPropertyDescriptors,ts=Object.getOwnPropertyNames,dt=Object.getOwnPropertySymbols,rs=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable;var pt=(t,e,r)=>e in t?ie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,q=(t,e)=>{for(var r in e||(e={}))mt.call(e,r)&&pt(t,r,e[r]);if(dt)for(var r of dt(e))ss.call(e,r)&&pt(t,r,e[r]);return t},M=(t,e)=>Xr(t,es(e));var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ns=(t,e)=>{for(var r in e)ie(t,r,{get:e[r],enumerable:!0})},vt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ts(e))!mt.call(t,s)&&s!==r&&ie(t,s,{get:()=>e[s],enumerable:!(n=Qr(e,s))||n.enumerable});return t};var is=(t,e,r)=>(r=t!=null?Zr(rs(t)):{},vt(e||!t||!t.__esModule?ie(r,"default",{value:t,enumerable:!0}):r,t)),os=t=>vt(ie({},"__esModule",{value:!0}),t);var L=(t,e,r)=>new Promise((n,s)=>{var o=l=>{try{u(r.next(l))}catch(f){s(f)}},a=l=>{try{u(r.throw(l))}catch(f){s(f)}},u=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);u((r=r.apply(t,e)).next())});var Le=d((ei,yt)=>{"use strict";yt.exports=function(e,r){return function(){for(var s=new Array(arguments.length),o=0;o<s.length;o++)s[o]=arguments[o];return e.apply(r,s)}}});var R=d((ti,gt)=>{"use strict";var as=Le(),D=Object.prototype.toString;function Be(t){return Array.isArray(t)}function Ne(t){return typeof t>"u"}function us(t){return t!==null&&!Ne(t)&&t.constructor!==null&&!Ne(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ct(t){return D.call(t)==="[object ArrayBuffer]"}function cs(t){return D.call(t)==="[object FormData]"}function ls(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ct(t.buffer),e}function fs(t){return typeof t=="string"}function hs(t){return typeof t=="number"}function bt(t){return t!==null&&typeof t=="object"}function fe(t){if(D.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ds(t){return D.call(t)==="[object Date]"}function ps(t){return D.call(t)==="[object File]"}function ms(t){return D.call(t)==="[object Blob]"}function wt(t){return D.call(t)==="[object Function]"}function vs(t){return bt(t)&&wt(t.pipe)}function ys(t){return D.call(t)==="[object URLSearchParams]"}function Cs(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function bs(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Ie(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Be(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function Pe(){var t={};function e(s,o){fe(t[o])&&fe(s)?t[o]=Pe(t[o],s):fe(s)?t[o]=Pe({},s):Be(s)?t[o]=s.slice():t[o]=s}for(var r=0,n=arguments.length;r<n;r++)Ie(arguments[r],e);return t}function ws(t,e,r){return Ie(e,function(s,o){r&&typeof s=="function"?t[o]=as(s,r):t[o]=s}),t}function gs(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}gt.exports={isArray:Be,isArrayBuffer:Ct,isBuffer:us,isFormData:cs,isArrayBufferView:ls,isString:fs,isNumber:hs,isObject:bt,isPlainObject:fe,isUndefined:Ne,isDate:ds,isFile:ps,isBlob:ms,isFunction:wt,isStream:vs,isURLSearchParams:ys,isStandardBrowserEnv:bs,forEach:Ie,merge:Pe,extend:ws,trim:Cs,stripBOM:gs}});var he=d((ri,Rt)=>{"use strict";var W=R();function Et(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Rt.exports=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(W.isURLSearchParams(r))s=r.toString();else{var o=[];W.forEach(r,function(l,f){l===null||typeof l>"u"||(W.isArray(l)?f=f+"[]":l=[l],W.forEach(l,function(c){W.isDate(c)?c=c.toISOString():W.isObject(c)&&(c=JSON.stringify(c)),o.push(Et(f)+"="+Et(c))}))}),s=o.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}});var St=d((si,Tt)=>{"use strict";var Es=R();function de(){this.handlers=[]}de.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};de.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};de.prototype.forEach=function(e){Es.forEach(this.handlers,function(n){n!==null&&e(n)})};Tt.exports=de});var At=d((ni,Ot)=>{"use strict";var Rs=R();Ot.exports=function(e,r){Rs.forEach(e,function(s,o){o!==r&&o.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[o])})}});var pe=d((ii,qt)=>{"use strict";qt.exports=function(e,r,n,s,o){return e.config=r,n&&(e.code=n),e.request=s,e.response=o,e.isAxiosError=!0,e.toJSON=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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var me=d((oi,_t)=>{"use strict";var Ts=pe();_t.exports=function(e,r,n,s,o){var a=new Error(e);return Ts(a,r,n,s,o)}});var Me=d((ai,xt)=>{"use strict";var Ss=me();xt.exports=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(Ss("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Lt=d((ui,Ft)=>{"use strict";var ve=R();Ft.exports=ve.isStandardBrowserEnv()?function(){return{write:function(r,n,s,o,a,u){var l=[];l.push(r+"="+encodeURIComponent(n)),ve.isNumber(s)&&l.push("expires="+new Date(s).toGMTString()),ve.isString(o)&&l.push("path="+o),ve.isString(a)&&l.push("domain="+a),u===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Pt=d((ci,Nt)=>{"use strict";Nt.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var It=d((li,Bt)=>{"use strict";Bt.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var ke=d((fi,Mt)=>{"use strict";var Os=Pt(),As=It();Mt.exports=function(e,r){return e&&!Os(r)?As(e,r):r}});var Ut=d((hi,kt)=>{"use strict";var Ue=R(),qs=["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"];kt.exports=function(e){var r={},n,s,o;return e&&Ue.forEach(e.split(`
`),function(u){if(o=u.indexOf(":"),n=Ue.trim(u.substr(0,o)).toLowerCase(),s=Ue.trim(u.substr(o+1)),n){if(r[n]&&qs.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r}});var Ht=d((di,jt)=>{"use strict";var Dt=R();jt.exports=Dt.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(o){var a=o;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(a){var u=Dt.isString(a)?s(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var K=d((pi,Gt)=>{"use strict";function De(t){this.message=t}De.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};De.prototype.__CANCEL__=!0;Gt.exports=De});var Jt=d((mi,zt)=>{"use strict";var ye=R(),_s=Me(),xs=Lt(),Fs=he(),Ls=ke(),Ns=Ut(),Ps=Ht(),je=me(),Bs=Y(),Is=K();zt.exports=function(e){return new Promise(function(n,s){var o=e.data,a=e.headers,u=e.responseType,l;function f(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}ye.isFormData(o)&&delete a["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(c+":"+h)}var v=Ls(e.baseURL,e.url);i.open(e.method.toUpperCase(),Fs(v,e.params,e.paramsSerializer),!0),i.timeout=e.timeout;function O(){if(!!i){var y="getAllResponseHeaders"in i?Ns(i.getAllResponseHeaders()):null,m=!u||u==="text"||u==="json"?i.responseText:i.response,g={data:m,status:i.status,statusText:i.statusText,headers:y,config:e,request:i};_s(function(P){n(P),f()},function(P){s(P),f()},g),i=null}}if("onloadend"in i?i.onloadend=O:i.onreadystatechange=function(){!i||i.readyState!==4||i.status===0&&!(i.responseURL&&i.responseURL.indexOf("file:")===0)||setTimeout(O)},i.onabort=function(){!i||(s(je("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){s(je("Network Error",e,null,i)),i=null},i.ontimeout=function(){var m=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Bs.transitional;e.timeoutErrorMessage&&(m=e.timeoutErrorMessage),s(je(m,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",i)),i=null},ye.isStandardBrowserEnv()){var T=(e.withCredentials||Ps(v))&&e.xsrfCookieName?xs.read(e.xsrfCookieName):void 0;T&&(a[e.xsrfHeaderName]=T)}"setRequestHeader"in i&&ye.forEach(a,function(m,g){typeof o>"u"&&g.toLowerCase()==="content-type"?delete a[g]:i.setRequestHeader(g,m)}),ye.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),u&&u!=="json"&&(i.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&i.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(y){!i||(s(!y||y&&y.type?new Is("canceled"):y),i.abort(),i=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),o||(o=null),i.send(o)})}});var $t=d((vi,Vt)=>{var Z=1e3,X=Z*60,Q=X*60,H=Q*24,Ms=H*7,ks=H*365.25;Vt.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Us(t);if(r==="number"&&isFinite(t))return e.long?js(t):Ds(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Us(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!!e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*ks;case"weeks":case"week":case"w":return r*Ms;case"days":case"day":case"d":return r*H;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Q;case"minutes":case"minute":case"mins":case"min":case"m":return r*X;case"seconds":case"second":case"secs":case"sec":case"s":return r*Z;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Ds(t){var e=Math.abs(t);return e>=H?Math.round(t/H)+"d":e>=Q?Math.round(t/Q)+"h":e>=X?Math.round(t/X)+"m":e>=Z?Math.round(t/Z)+"s":t+"ms"}function js(t){var e=Math.abs(t);return e>=H?Ce(t,e,H,"day"):e>=Q?Ce(t,e,Q,"hour"):e>=X?Ce(t,e,X,"minute"):e>=Z?Ce(t,e,Z,"second"):t+" ms"}function Ce(t,e,r,n){var s=e>=r*1.5;return Math.round(t/r)+" "+n+(s?"s":"")}});var He=d((yi,Wt)=>{function Hs(t){r.debug=r,r.default=r,r.coerce=l,r.disable=o,r.enable=s,r.enabled=a,r.humanize=$t(),r.destroy=f,Object.keys(t).forEach(i=>{r[i]=t[i]}),r.names=[],r.skips=[],r.formatters={};function e(i){let c=0;for(let h=0;h<i.length;h++)c=(c<<5)-c+i.charCodeAt(h),c|=0;return r.colors[Math.abs(c)%r.colors.length]}r.selectColor=e;function r(i){let c,h=null,v,O;function T(...y){if(!T.enabled)return;let m=T,g=Number(new Date),J=g-(c||g);m.diff=J,m.prev=c,m.curr=g,c=g,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let P=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(V,_e)=>{if(V==="%%")return"%";P++;let A=r.formatters[_e];if(typeof A=="function"){let B=y[P];V=A.call(m,B),y.splice(P,1),P--}return V}),r.formatArgs.call(m,y),(m.log||r.log).apply(m,y)}return T.namespace=i,T.useColors=r.useColors(),T.color=r.selectColor(i),T.extend=n,T.destroy=r.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(v!==r.namespaces&&(v=r.namespaces,O=r.enabled(i)),O),set:y=>{h=y}}),typeof r.init=="function"&&r.init(T),T}function n(i,c){let h=r(this.namespace+(typeof c>"u"?":":c)+i);return h.log=this.log,h}function s(i){r.save(i),r.namespaces=i,r.names=[],r.skips=[];let c,h=(typeof i=="string"?i:"").split(/[\s,]+/),v=h.length;for(c=0;c<v;c++)!h[c]||(i=h[c].replace(/\*/g,".*?"),i[0]==="-"?r.skips.push(new RegExp("^"+i.slice(1)+"$")):r.names.push(new RegExp("^"+i+"$")))}function o(){let i=[...r.names.map(u),...r.skips.map(u).map(c=>"-"+c)].join(",");return r.enable(""),i}function a(i){if(i[i.length-1]==="*")return!0;let c,h;for(c=0,h=r.skips.length;c<h;c++)if(r.skips[c].test(i))return!1;for(c=0,h=r.names.length;c<h;c++)if(r.names[c].test(i))return!0;return!1}function u(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}function l(i){return i instanceof Error?i.stack||i.message:i}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Wt.exports=Hs});var Kt=d((_,be)=>{_.formatArgs=zs;_.save=Js;_.load=Vs;_.useColors=Gs;_.storage=$s();_.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Gs(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function zs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+be.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(r++,s==="%c"&&(n=r))}),t.splice(n,0,e)}_.log=console.debug||console.log||(()=>{});function Js(t){try{t?_.storage.setItem("debug",t):_.storage.removeItem("debug")}catch{}}function Vs(){let t;try{t=_.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function $s(){try{return localStorage}catch{}}be.exports=He()(_);var{formatters:Ws}=be.exports;Ws.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Zt=d((Ci,Yt)=>{"use strict";Yt.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),s=e.indexOf("--");return n!==-1&&(s===-1||n<s)}});var er=d((bi,Qt)=>{"use strict";var Ks=require("os"),Xt=require("tty"),N=Zt(),{env:C}=process,j;N("no-color")||N("no-colors")||N("color=false")||N("color=never")?j=0:(N("color")||N("colors")||N("color=true")||N("color=always"))&&(j=1);"FORCE_COLOR"in C&&(C.FORCE_COLOR==="true"?j=1:C.FORCE_COLOR==="false"?j=0:j=C.FORCE_COLOR.length===0?1:Math.min(parseInt(C.FORCE_COLOR,10),3));function Ge(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function ze(t,e){if(j===0)return 0;if(N("color=16m")||N("color=full")||N("color=truecolor"))return 3;if(N("color=256"))return 2;if(t&&!e&&j===void 0)return 0;let r=j||0;if(C.TERM==="dumb")return r;if(process.platform==="win32"){let n=Ks.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in C)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in C)||C.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in C)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(C.TEAMCITY_VERSION)?1:0;if(C.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in C){let n=parseInt((C.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(C.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(C.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(C.TERM)||"COLORTERM"in C?1:r}function Ys(t){let e=ze(t,t&&t.isTTY);return Ge(e)}Qt.exports={supportsColor:Ys,stdout:Ge(ze(!0,Xt.isatty(1))),stderr:Ge(ze(!0,Xt.isatty(2)))}});var rr=d((b,ge)=>{var Zs=require("tty"),we=require("util");b.init=nn;b.log=tn;b.formatArgs=Qs;b.save=rn;b.load=sn;b.useColors=Xs;b.destroy=we.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");b.colors=[6,2,3,4,5,1];try{let t=er();t&&(t.stderr||t).level>=2&&(b.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}b.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,o)=>o.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function Xs(){return"colors"in b.inspectOpts?Boolean(b.inspectOpts.colors):Zs.isatty(process.stderr.fd)}function Qs(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${s};1m${e} \x1B[0m`;t[0]=o+t[0].split(`
`).join(`
`+o),t.push(s+"m+"+ge.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=en()+e+" "+t[0]}function en(){return b.inspectOpts.hideDate?"":new Date().toISOString()+" "}function tn(...t){return process.stderr.write(we.format(...t)+`
`)}function rn(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function sn(){return process.env.DEBUG}function nn(t){t.inspectOpts={};let e=Object.keys(b.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=b.inspectOpts[e[r]]}ge.exports=He()(b);var{formatters:tr}=ge.exports;tr.o=function(t){return this.inspectOpts.colors=this.useColors,we.inspect(t,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};tr.O=function(t){return this.inspectOpts.colors=this.useColors,we.inspect(t,this.inspectOpts)}});var sr=d((wi,Je)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Je.exports=Kt():Je.exports=rr()});var ir=d((gi,nr)=>{var oe;nr.exports=function(){if(!oe){try{oe=sr()("follow-redirects")}catch{}typeof oe!="function"&&(oe=function(){})}oe.apply(null,arguments)}});var Ye=d((Ei,Ke)=>{var G=require("url"),Ve=G.URL,on=require("http"),an=require("https"),ur=require("stream").Writable,un=require("assert"),cr=ir(),z=["abort","aborted","connect","error","socket","timeout"],We=Object.create(null);z.forEach(function(t){We[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var or=Ee("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),cn=Ee("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),ln=Ee("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),fn=Ee("ERR_STREAM_WRITE_AFTER_END","write after end");function x(t,e){ur.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var r=this;this._onNativeResponse=function(n){r._processResponse(n)},this._performRequest()}x.prototype=Object.create(ur.prototype);x.prototype.abort=function(){fr(this._currentRequest),this.emit("abort")};x.prototype.write=function(t,e,r){if(this._ending)throw new fn;if(!(typeof t=="string"||typeof t=="object"&&"length"in t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(typeof e=="function"&&(r=e,e=null),t.length===0){r&&r();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,r)):(this.emit("error",new ln),this.abort())};x.prototype.end=function(t,e,r){if(typeof t=="function"?(r=t,t=e=null):typeof e=="function"&&(r=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,r);else{var n=this,s=this._currentRequest;this.write(t,e,function(){n._ended=!0,s.end(null,null,r)}),this._ending=!0}};x.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};x.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};x.prototype.setTimeout=function(t,e){var r=this;function n(a){a.setTimeout(t),a.removeListener("timeout",a.destroy),a.addListener("timeout",a.destroy)}function s(a){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout(function(){r.emit("timeout"),o()},t),n(a)}function o(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),r.removeListener("abort",o),r.removeListener("error",o),r.removeListener("response",o),e&&r.removeListener("timeout",e),r.socket||r._currentRequest.removeListener("socket",s)}return e&&this.on("timeout",e),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",n),this.on("abort",o),this.on("error",o),this.on("response",o),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){x.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(x.prototype,t,{get:function(){return this._currentRequest[t]}})});x.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};x.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);this._currentUrl=G.format(this._options),n._redirectable=this;for(var s=0;s<z.length;s++)n.on(z[s],We[z[s]]);if(this._isRedirect){var o=0,a=this,u=this._requestBodyBuffers;(function l(f){if(n===a._currentRequest)if(f)a.emit("error",f);else if(o<u.length){var i=u[o++];n.finished||n.write(i.data,i.encoding,l)}else a._ended&&n.end()})()}};x.prototype._processResponse=function(t){var e=t.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e});var r=t.headers.location;if(!r||this._options.followRedirects===!1||e<300||e>=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(fr(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects){this.emit("error",new cn);return}var n,s=this._options.beforeRedirect;s&&(n=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var o=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],$e(/^content-/i,this._options.headers));var a=$e(/^host$/i,this._options.headers),u=G.parse(this._currentUrl),l=a||u.host,f=/^\w+:/.test(r)?this._currentUrl:G.format(Object.assign(u,{host:l})),i;try{i=G.resolve(f,r)}catch(O){this.emit("error",new or(O));return}cr("redirecting to",i),this._isRedirect=!0;var c=G.parse(i);if(Object.assign(this._options,c),(c.protocol!==u.protocol&&c.protocol!=="https:"||c.host!==l&&!dn(c.host,l))&&$e(/^(?:authorization|cookie)$/i,this._options.headers),typeof s=="function"){var h={headers:t.headers,statusCode:e},v={url:f,method:o,headers:n};try{s(this._options,h,v)}catch(O){this.emit("error",O);return}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(O){this.emit("error",new or(O))}};function lr(t){var e={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(t).forEach(function(n){var s=n+":",o=r[s]=t[n],a=e[n]=Object.create(o);function u(f,i,c){if(typeof f=="string"){var h=f;try{f=ar(new Ve(h))}catch{f=G.parse(h)}}else Ve&&f instanceof Ve?f=ar(f):(c=i,i=f,f={protocol:s});return typeof i=="function"&&(c=i,i=null),i=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},f,i),i.nativeProtocols=r,un.equal(i.protocol,s,"protocol mismatch"),cr("options",i),new x(i,c)}function l(f,i,c){var h=a.request(f,i,c);return h.end(),h}Object.defineProperties(a,{request:{value:u,configurable:!0,enumerable:!0,writable:!0},get:{value:l,configurable:!0,enumerable:!0,writable:!0}})}),e}function hn(){}function ar(t){var e={protocol:t.protocol,hostname:t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:t.pathname+t.search,href:t.href};return t.port!==""&&(e.port=Number(t.port)),e}function $e(t,e){var r;for(var n in e)t.test(n)&&(r=e[n],delete e[n]);return r===null||typeof r>"u"?void 0:String(r).trim()}function Ee(t,e){function r(n){Error.captureStackTrace(this,this.constructor),n?(this.message=e+": "+n.message,this.cause=n):this.message=e}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+t+"]",r.prototype.code=t,r}function fr(t){for(var e=0;e<z.length;e++)t.removeListener(z[e],We[z[e]]);t.on("error",hn),t.abort()}function dn(t,e){let r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}Ke.exports=lr({http:on,https:an});Ke.exports.wrap=lr});var Re=d((Ri,hr)=>{hr.exports={version:"0.25.0"}});var Cr=d((Ti,yr)=>{"use strict";var ae=R(),dr=Me(),pn=ke(),mn=he(),vn=require("http"),yn=require("https"),Cn=Ye().http,bn=Ye().https,pr=require("url"),wn=require("zlib"),gn=Re().version,ee=me(),Te=pe(),En=Y(),Rn=K(),mr=/https:?/;function vr(t,e,r){if(t.hostname=e.host,t.host=e.host,t.port=e.port,t.path=r,e.auth){var n=Buffer.from(e.auth.username+":"+e.auth.password,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.beforeRedirect=function(o){o.headers.host=o.host,vr(o,e,o.href)}}yr.exports=function(e){return new Promise(function(n,s){var o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}var u=function(p){a(),n(p)},l=!1,f=function(p){a(),l=!0,s(p)},i=e.data,c=e.headers,h={};if(Object.keys(c).forEach(function(p){h[p.toLowerCase()]=p}),"user-agent"in h?c[h["user-agent"]]||delete c[h["user-agent"]]:c["User-Agent"]="axios/"+gn,i&&!ae.isStream(i)){if(!Buffer.isBuffer(i))if(ae.isArrayBuffer(i))i=Buffer.from(new Uint8Array(i));else if(ae.isString(i))i=Buffer.from(i,"utf-8");else return f(ee("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));if(e.maxBodyLength>-1&&i.length>e.maxBodyLength)return f(ee("Request body larger than maxBodyLength limit",e));h["content-length"]||(c["Content-Length"]=i.length)}var v=void 0;if(e.auth){var O=e.auth.username||"",T=e.auth.password||"";v=O+":"+T}var y=pn(e.baseURL,e.url),m=pr.parse(y),g=m.protocol||"http:";if(!v&&m.auth){var J=m.auth.split(":"),P=J[0]||"",nt=J[1]||"";v=P+":"+nt}v&&h.authorization&&delete c[h.authorization];var V=mr.test(g),_e=V?e.httpsAgent:e.httpAgent,A={path:mn(m.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:c,agent:_e,agents:{http:e.httpAgent,https:e.httpsAgent},auth:v};e.socketPath?A.socketPath=e.socketPath:(A.hostname=m.hostname,A.port=m.port);var B=e.proxy;if(!B&&B!==!1){var it=g.slice(0,-1)+"_proxy",ot=process.env[it]||process.env[it.toUpperCase()];if(ot){var se=pr.parse(ot),at=process.env.no_proxy||process.env.NO_PROXY,ut=!0;if(at){var Yr=at.split(",").map(function(p){return p.trim()});ut=!Yr.some(function(p){return p?p==="*"||p[0]==="."&&m.hostname.substr(m.hostname.length-p.length)===p?!0:m.hostname===p:!1})}if(ut&&(B={host:se.hostname,port:se.port,protocol:se.protocol},se.auth)){var ct=se.auth.split(":");B.auth={username:ct[0],password:ct[1]}}}}B&&(A.headers.host=m.hostname+(m.port?":"+m.port:""),vr(A,B,g+"//"+m.hostname+(m.port?":"+m.port:"")+A.path));var ce,lt=V&&(B?mr.test(B.protocol):!0);e.transport?ce=e.transport:e.maxRedirects===0?ce=lt?yn:vn:(e.maxRedirects&&(A.maxRedirects=e.maxRedirects),ce=lt?bn:Cn),e.maxBodyLength>-1&&(A.maxBodyLength=e.maxBodyLength),e.insecureHTTPParser&&(A.insecureHTTPParser=e.insecureHTTPParser);var E=ce.request(A,function(p){if(!E.aborted){var U=p,ne=p.req||E;if(p.statusCode!==204&&ne.method!=="HEAD"&&e.decompress!==!1)switch(p.headers["content-encoding"]){case"gzip":case"compress":case"deflate":U=U.pipe(wn.createUnzip()),delete p.headers["content-encoding"];break}var $={status:p.statusCode,statusText:p.statusMessage,headers:p.headers,config:e,request:ne};if(e.responseType==="stream")$.data=U,dr(u,f,$);else{var le=[],ft=0;U.on("data",function(I){le.push(I),ft+=I.length,e.maxContentLength>-1&&ft>e.maxContentLength&&(l=!0,U.destroy(),f(ee("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,ne)))}),U.on("aborted",function(){l||(U.destroy(),f(ee("error request aborted",e,"ERR_REQUEST_ABORTED",ne)))}),U.on("error",function(I){E.aborted||f(Te(I,e,null,ne))}),U.on("end",function(){try{var I=le.length===1?le[0]:Buffer.concat(le);e.responseType!=="arraybuffer"&&(I=I.toString(e.responseEncoding),(!e.responseEncoding||e.responseEncoding==="utf8")&&(I=ae.stripBOM(I))),$.data=I}catch(ht){f(Te(ht,e,ht.code,$.request,$))}dr(u,f,$)})}}});if(E.on("error",function(p){E.aborted&&p.code!=="ERR_FR_TOO_MANY_REDIRECTS"||f(Te(p,e,null,E))}),E.on("socket",function(p){p.setKeepAlive(!0,1e3*60)}),e.timeout){var xe=parseInt(e.timeout,10);if(isNaN(xe)){f(ee("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",E));return}E.setTimeout(xe,function(){E.abort();var p=e.transitional||En.transitional;f(ee("timeout of "+xe+"ms exceeded",e,p.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",E))})}(e.cancelToken||e.signal)&&(o=function(S){E.aborted||(E.abort(),f(!S||S&&S.type?new Rn("canceled"):S))},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o))),ae.isStream(i)?i.on("error",function(p){f(Te(p,e,null,E))}).pipe(E):E.end(i)})}});var Y=d((Si,gr)=>{"use strict";var w=R(),br=At(),Tn=pe(),Sn={"Content-Type":"application/x-www-form-urlencoded"};function wr(t,e){!w.isUndefined(t)&&w.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function On(){var t;return typeof XMLHttpRequest<"u"?t=Jt():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Cr()),t}function An(t,e,r){if(w.isString(t))try{return(e||JSON.parse)(t),w.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Se={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:On(),transformRequest:[function(e,r){return br(r,"Accept"),br(r,"Content-Type"),w.isFormData(e)||w.isArrayBuffer(e)||w.isBuffer(e)||w.isStream(e)||w.isFile(e)||w.isBlob(e)?e:w.isArrayBufferView(e)?e.buffer:w.isURLSearchParams(e)?(wr(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):w.isObject(e)||r&&r["Content-Type"]==="application/json"?(wr(r,"application/json"),An(e)):e}],transformResponse:[function(e){var r=this.transitional||Se.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,o=!n&&this.responseType==="json";if(o||s&&w.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Tn(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};w.forEach(["delete","get","head"],function(e){Se.headers[e]={}});w.forEach(["post","put","patch"],function(e){Se.headers[e]=w.merge(Sn)});gr.exports=Se});var Rr=d((Oi,Er)=>{"use strict";var qn=R(),_n=Y();Er.exports=function(e,r,n){var s=this||_n;return qn.forEach(n,function(a){e=a.call(s,e,r)}),e}});var Ze=d((Ai,Tr)=>{"use strict";Tr.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ar=d((qi,Or)=>{"use strict";var Sr=R(),Xe=Rr(),xn=Ze(),Fn=Y(),Ln=K();function Qe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ln("canceled")}Or.exports=function(e){Qe(e),e.headers=e.headers||{},e.data=Xe.call(e,e.data,e.headers,e.transformRequest),e.headers=Sr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Sr.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||Fn.adapter;return r(e).then(function(s){return Qe(e),s.data=Xe.call(e,s.data,s.headers,e.transformResponse),s},function(s){return xn(s)||(Qe(e),s&&s.response&&(s.response.data=Xe.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})}});var et=d((_i,qr)=>{"use strict";var F=R();qr.exports=function(e,r){r=r||{};var n={};function s(i,c){return F.isPlainObject(i)&&F.isPlainObject(c)?F.merge(i,c):F.isPlainObject(c)?F.merge({},c):F.isArray(c)?c.slice():c}function o(i){if(F.isUndefined(r[i])){if(!F.isUndefined(e[i]))return s(void 0,e[i])}else return s(e[i],r[i])}function a(i){if(!F.isUndefined(r[i]))return s(void 0,r[i])}function u(i){if(F.isUndefined(r[i])){if(!F.isUndefined(e[i]))return s(void 0,e[i])}else return s(void 0,r[i])}function l(i){if(i in r)return s(e[i],r[i]);if(i in e)return s(void 0,e[i])}var f={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l};return F.forEach(Object.keys(e).concat(Object.keys(r)),function(c){var h=f[c]||o,v=h(c);F.isUndefined(v)&&h!==l||(n[c]=v)}),n}});var Fr=d((xi,xr)=>{"use strict";var Nn=Re().version,tt={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){tt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var _r={};tt.transitional=function(e,r,n){function s(o,a){return"[Axios v"+Nn+"] Transitional option '"+o+"'"+a+(n?". "+n:"")}return function(o,a,u){if(e===!1)throw new Error(s(a," has been removed"+(r?" in "+r:"")));return r&&!_r[a]&&(_r[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,a,u):!0}};function Pn(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var o=n[s],a=e[o];if(a){var u=t[o],l=u===void 0||a(u,o,t);if(l!==!0)throw new TypeError("option "+o+" must be "+l);continue}if(r!==!0)throw Error("Unknown option "+o)}}xr.exports={assertOptions:Pn,validators:tt}});var Mr=d((Fi,Ir)=>{"use strict";var Pr=R(),Bn=he(),Lr=St(),Nr=Ar(),Oe=et(),Br=Fr(),te=Br.validators;function ue(t){this.defaults=t,this.interceptors={request:new Lr,response:new Lr}}ue.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=Oe(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&Br.assertOptions(n,{silentJSONParsing:te.transitional(te.boolean),forcedJSONParsing:te.transitional(te.boolean),clarifyTimeoutError:te.transitional(te.boolean)},!1);var s=[],o=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(r)===!1||(o=o&&v.synchronous,s.unshift(v.fulfilled,v.rejected))});var a=[];this.interceptors.response.forEach(function(v){a.push(v.fulfilled,v.rejected)});var u;if(!o){var l=[Nr,void 0];for(Array.prototype.unshift.apply(l,s),l=l.concat(a),u=Promise.resolve(r);l.length;)u=u.then(l.shift(),l.shift());return u}for(var f=r;s.length;){var i=s.shift(),c=s.shift();try{f=i(f)}catch(h){c(h);break}}try{u=Nr(f)}catch(h){return Promise.reject(h)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};ue.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=Oe(this.defaults,e),Bn(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Pr.forEach(["delete","get","head","options"],function(e){ue.prototype[e]=function(r,n){return this.request(Oe(n||{},{method:e,url:r,data:(n||{}).data}))}});Pr.forEach(["post","put","patch"],function(e){ue.prototype[e]=function(r,n,s){return this.request(Oe(s||{},{method:e,url:r,data:n}))}});Ir.exports=ue});var Ur=d((Li,kr)=>{"use strict";var In=K();function re(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;this.promise.then(function(n){if(!!r._listeners){var s,o=r._listeners.length;for(s=0;s<o;s++)r._listeners[s](n);r._listeners=null}}),this.promise.then=function(n){var s,o=new Promise(function(a){r.subscribe(a),s=a}).then(n);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s){r.reason||(r.reason=new In(s),e(r.reason))})}re.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};re.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};re.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};re.source=function(){var e,r=new re(function(s){e=s});return{token:r,cancel:e}};kr.exports=re});var jr=d((Ni,Dr)=>{"use strict";Dr.exports=function(e){return function(n){return e.apply(null,n)}}});var Gr=d((Pi,Hr)=>{"use strict";var Mn=R();Hr.exports=function(e){return Mn.isObject(e)&&e.isAxiosError===!0}});var Vr=d((Bi,rt)=>{"use strict";var zr=R(),kn=Le(),Ae=Mr(),Un=et(),Dn=Y();function Jr(t){var e=new Ae(t),r=kn(Ae.prototype.request,e);return zr.extend(r,Ae.prototype,e),zr.extend(r,e),r.create=function(s){return Jr(Un(t,s))},r}var k=Jr(Dn);k.Axios=Ae;k.Cancel=K();k.CancelToken=Ur();k.isCancel=Ze();k.VERSION=Re().version;k.all=function(e){return Promise.all(e)};k.spread=jr();k.isAxiosError=Gr();rt.exports=k;rt.exports.default=k});var Wr=d((Ii,$r)=>{$r.exports=Vr()});var Xn={};ns(Xn,{default:()=>Zn,searchAlbum:()=>jn,searchAll:()=>Gn,searchApp:()=>zn,searchArtist:()=>Hn,searchAudiobook:()=>Jn,searchBook:()=>Vn,searchMovie:()=>$n,searchMusicVideo:()=>Wn,searchPodcast:()=>Kn,searchSong:()=>Yn});module.exports=os(Xn);var st=is(Wr()),qe=class{constructor(){this.options={};this.defaultOptions={limit:1,country:"US",language:"en",attribute:null,entity:null,timeout:2e3};this.searchAlbum=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"album"}),"searchAlbum")});this.searchSong=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{media:"music"}),"searchSong")});this.searchArtist=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"allArtist",attribute:"allArtistTerm"}),"searchArtist")});this.searchApp=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"software"}),"searchApp")});this.searchMovie=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"movie"}),"searchMovie")});this.searchMusicVideo=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{media:"musicVideo"}),"searchMusicVideo")});this.searchBook=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"ebook"}),"searchBook")});this.searchAudiobook=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"audiobook"}),"searchAudiobook")});this.searchPodcast=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,M(q({},r),{entity:"podcast"}),"searchPodcast")});this.searchAll=(e,r)=>L(this,null,function*(){return yield this.performSearch(e,q({},r),"searchAll")});this.performSearch=(e,r,n)=>L(this,null,function*(){let s=this.validate(e,r,n);try{let o=st.default.create({baseURL:"https://itunes.apple.com",timeout:s.timeout});s.timeout&&delete s.timeout;let a=new URLSearchParams(s),u=`/search?term=${encodeURI(e)}&${a.toString()}`,{data:l}=yield o.get(u);return l}catch(o){if(st.default.isAxiosError(o))throw o.code?new Error(`Error: ${o.code}. Reference: https://www.ibm.com/docs/en/zos/2.2.0?topic=codes-sockets-return-errnos`):new Error("Network Disconnected")}})}validate(e,r,n){let s=Object.fromEntries(Object.entries(q(q({},this.defaultOptions),r)).filter(([f,i])=>i!==null)),o=new RegExp(/^(AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|YE|YT|ZA|ZM|ZW)$/,"g"),a=new RegExp(/^(ab|aa|af|ak|sq|am|ar|an|hy|as|av|ae|ay|az|bm|ba|eu|be|bn|bi|bs|br|bg|my|ca|ch|ce|ny|zh|cv|kw|co|cr|hr|cs|da|dv|nl|dz|en|eo|et|ee|fo|fj|fi|fr|ff|gl|ka|de|el|gn|gu|ht|ha|he|hz|hi|ho|hu|ia|id|ie|ga|ig|ik|io|is|it|iu|ja|jv|kl|kn|kr|ks|kk|km|ki|rw|ky|kv|kg|ko|ku|kj|la|lb|lg|li|ln|lo|lt|lu|lv|gv|mk|mg|ms|ml|mt|mi|mr|mh|mn|na|nv|nd|ne|ng|nb|nn|no|ii|nr|oc|oj|cu|om|or|os|pa|pi|fa|pl|ps|pt|qu|rm|rn|ro|ru|sa|sc|sd|se|sm|sg|sr|gd|sn|si|sk|sl|so|st|es|su|sw|ss|sv|ta|te|tg|th|ti|bo|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|cy|wo|fy|xh|yi|yo|za|zu)$/,"g"),u=["album","allArtist","allTrack","audiobook","audiobookAuthor","ebook","iPadSoftware","macSoftware","mix","movie","movieArtist","musicArtist","musicTrack","musicVideo","podcast","podcastAuthor","shortFilm","shortFilmArtist","software","song","tvEpisode","tvSeason"],l=["actorTerm","albumTerm","allArtistTerm","allTrackTerm","artistTerm","authorTerm","composerTerm","descriptionTerm","directorTerm","featureFilmTerm","genreIndex","keywordsTerm","languageTerm","mixTerm","movieArtistTerm","movieTerm","producerTerm","ratingIndex","ratingTerm","releaseYearTerm","shortFilmTerm","showTerm","softwareDeveloper","songTerm","titleTerm","tvEpisodeTerm","tvSeasonTerm"];if(n==="searchAll"){if(s.entity&&!u.includes(s.entity))throw new TypeError(`The entity with value ${JSON.stringify(s.entity)} is not valid. Expected one of the following list ${JSON.stringify(u)}`);if(s.attribute&&!l.includes(s.attribute))throw new TypeError(`The attribute with value ${JSON.stringify(s.attribute)} is not valid. Expected one of the following list ${JSON.stringify(l)}`);if(!s.entity||!s.attribute)throw new TypeError('searchAll expects to have both "entity" and "attribute" values in the options object')}if(typeof e!="string"||!e.trim().length)throw new TypeError('A "term" is a string required on any search. "term" cannot have empty spaces as well.');if(!Number.isInteger(s.limit))throw new TypeError(`Optional argument "limit" must be a number. Passed ${typeof s.limit}(${s.limit})`);if(!o.test(s.country))throw new TypeError(`Optional argument "country" must be a string and should be a valid ISO 3166-1 Alpha 2 country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Passed ${typeof s.country}( ${JSON.stringify(s.country)} )`);if(!a.test(s.language))throw new TypeError(`Optional argument "language" must be a string and should be a valid ISO 639-1 language code (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). Passed ${typeof s.language}( ${JSON.stringify(s.language)} )`);return s}};var Kr=new qe,{searchAlbum:jn,searchArtist:Hn,searchAll:Gn,searchApp:zn,searchAudiobook:Jn,searchBook:Vn,searchMovie:$n,searchMusicVideo:Wn,searchPodcast:Kn,searchSong:Yn}=Kr,Zn=Kr;0&&(module.exports={searchAlbum,searchAll,searchApp,searchArtist,searchAudiobook,searchBook,searchMovie,searchMusicVideo,searchPodcast,searchSong});