diff --git a/precompiled/app.js b/precompiled/app.js index 7d2f23a0c1..32c07b1b23 100644 --- a/precompiled/app.js +++ b/precompiled/app.js @@ -1,6 +1,6 @@ #!/usr/bin/env node (()=>{var e={6718:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(952),r(1200),r(9778),r(3307),r(310),r(4980),r(4504),r(4038),r(8208),r(7274),r(1469),r(3039),r(845),r(200),r(1363),r(8210),r(153),r(530),r(3586),r(3096),r(5872),r(4483),r(5277),r(3136),r(3625),r(8350),r(7737),r(391),r(1414),r(4558),r(695),r(3605),r(1447),r(5609),r(993),r(6676),r(2826),r(6570),r(932),r(580);let{EventEmitter:i}=r(4434),{logScope:o}=r(6166),s=o("cache"),a={CLEANUP:"cs@cleanup"};class u extends i{id="Default Cache Storage";cacheMap=new Map;aliveDuration=18e5;constructor(e){super(),e&&(this.id=e),this.on(a.CLEANUP,async()=>this.removeExpiredCache())}get WillExpireAt(){return Date.now()+this.aliveDuration}getLoggerContext(e={}){return{...e,cacheStorageId:this.id}}removeExpiredCache(){s.debug(this.getLoggerContext(),"Cleaning up the expired caches..."),this.cacheMap.forEach((e,t)=>{e.expireAt<=Date.now()&&this.cacheMap.delete(t)})}async cache(e,t,r){if("true"===process.env.NO_CACHE)return t();this.emit(a.CLEANUP);let i=this.cacheMap.get(e),o="object"==typeof e?"Something":e,u=this.getLoggerContext({logKey:o});if(i)return s.debug(u,`${o} hit!`),i.data;s.debug(u,`${o} did not hit. Storing the execution result...`);let c=await t();return this.cacheMap.set(e,{data:c,expireAt:new Date(r||this.WillExpireAt)}),c}}class c{static instance=void 0;cacheStorages=new Set;constructor(){}static getInstance(){return c.instance||(c.instance=new c),c.instance}cleanup(){this.cacheStorages.forEach(e=>e.removeExpiredCache())}}let l=c.getInstance();e.exports={CacheStorage:u,CacheStorageEvents:a,CacheStorageGroup:c,getManagedCacheStorage:function(e){let t=new u(e);return l.cacheStorages.add(t),t}}},2672:(e,t,r)=>{"use strict";let i=r(4434),o="cancel";e.exports={CancelRequest:class extends i{cancelled=!1;cancel(){this.cancelled=!0,this.emit(o)}},ON_CANCEL:o}},3946:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9635),r(9320),r(15),r(7022),r(9551),r(153),r(1363),r(8210),r(1750),r(6006),r(7907);let i={width:80,_program:{},_options:[],program:(e={})=>(i._program=e,i),option:(e,t={})=>(e=Array.isArray(e)?e:[e],t.dest=t.dest||e.slice(-1)[0].toLowerCase().replace(/^-+/,"").replace(/-[a-z]/g,e=>e.slice(1).toUpperCase()),t.help=t.help||({help:"output usage information",version:"output the version number"})[t.action],i._options.push(Object.assign(t,{flags:e,positional:!e[0].startsWith("-")})),i),parse:e=>{let t=i._options.map((e,t)=>e.positional?t:null).filter(e=>null!==e),o={};i._options.forEach((e,t)=>e.positional?null:e.flags.forEach(e=>o[e]=t)),i._program.name=i._program.name||r(6928).parse(e[1]).base;let s=e.slice(2).reduce((e,t)=>/^-[^-]/.test(t)?e.concat(t.slice(1).split("").map(e=>"-"+e)):e.concat(t),[]),l=0;for(;le in o),a=-1===t?s.length:l+t;0===(e=s.slice(l,a)).length&&(i._options[f].positional?c(`the following arguments are required: ${r}`):"+"===i._options[f].nargs?c(`argument ${r}: expected at least one argument`):c(`argument ${r}: expected one argument`)),"+"!==i._options[f].nargs?(e=e[0],l+=1):l=a}i[i._options[f].dest]=e}return t.length&&c(`the following arguments are required: ${t.map(e=>i._options[e].flags[0]).join(", ")}`),i}},o=e=>Array(e+1).join(" "),s=()=>{let e=i._options.map(e=>{let t=e.flags.sort((e,t)=>e.length-t.length)[0],r=e.metavar||e.dest;return e.positional?"+"===e.nargs?`${r} [${r} ...]`:`${r}`:["store_true","store_false","help","version"].includes(e.action)?`[${t}]`:"+"===e.nargs?`[${t} ${r} [${r} ...]]`:`[${t} ${r}]`}),t=i.width,r=`usage: ${i._program.name}`,s=[r];e.map(e=>" "+e).forEach(e=>{s[s.length-1].length+e.length{s();let e=i._options.filter(e=>e.positional).map(e=>[e.metavar||e.dest,e.help]),t=i._options.filter(e=>!e.positional).map(e=>{let{flags:t}=e,r=e.metavar||e.dest;return[["store_true","store_false","help","version"].includes(e.action)?t.map(e=>`${e}`).join(", "):"+"===e.nargs?t.map(e=>`${e} ${r} [${r} ...]`).join(", "):t.map(e=>`${e} ${r}`).join(", "),e.help]}),r=Math.max.apply(null,e.concat(t).map(e=>e[0].length));r=r>30?30:r;let a=i.width-r-4,u=e=>{let t=e=>Array.from(Array(Math.ceil(e.length/a)).keys()).map(t=>e.slice(t*a,(t+1)*a)).join("\n"+o(r+4));e[0].length{console.log(i._program.version),process.exit()},c=e=>{s(),console.log(i._program.name+":","error:",e),process.exit(1)};e.exports=i},6406:(e,t,r)=>{"use strict";let i={qq:r(1128),kugou:r(2777),kuwo:r(2076),migu:r(8516),joox:r(9222),youtube:r(8829),youtubedl:r(5374),ytdlp:r(9282),bilibili:r(8114),pyncmd:r(1727)};e.exports={DEFAULT_SOURCE:["kugou","kuwo","migu","bilibili","ytdlp"],PROVIDERS:i}},23:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15);let i=r(6982),o=r(7016).parse,s=r(3480).stringify,a="e82ckenh8dichen8",u="rFgB&h#%2?^eDg:Q",c=(e,t)=>{let r=i.createDecipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])},l=(e,t)=>{let r=i.createCipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])};e.exports={eapi:{encrypt:e=>l(e,a),decrypt:e=>c(e,a),encryptRequest:(t,r)=>{t=o(t);let a=JSON.stringify(r),u=`nobody${t.path}use${a}md5forencrypt`,c=i.createHash("md5").update(u).digest("hex"),l=`${t.path}-36cd479b6b5-${a}-36cd479b6b5-${c}`;return{url:t.href.replace(/\w*api/,"eapi"),body:s({params:e.exports.eapi.encrypt(Buffer.from(l)).toString("hex").toUpperCase()})}}},api:{encryptRequest:(e,t)=>({url:(e=o(e)).href.replace(/\w*api/,"api"),body:s(t)})},linuxapi:{encrypt:e=>l(e,u),decrypt:e=>c(e,u),encryptRequest:(t,r)=>{let i=JSON.stringify({method:"POST",url:(t=o(t)).href,params:r});return{url:t.resolve("/api/linux/forward"),body:s({eparams:e.exports.linuxapi.encrypt(Buffer.from(i)).toString("hex").toUpperCase()})}}},miguapi:{encryptBody:e=>{let t=JSON.stringify(e),r=Buffer.from(i.randomBytes(32).toString("hex")),o=i.randomBytes(8),a=((e,t,r,o)=>{t=t||Buffer.alloc(0);let s=r/8,a=Math.ceil((s+8*o)/32),u=Buffer.concat(Array(a).fill(null).reduce(r=>r.concat(i.createHash("md5").update(Buffer.concat([r.slice(-1)[0],e,t])).digest()),[Buffer.alloc(0)]));return{key:u.slice(0,s),iv:u.slice(s,s+o)}})(r,o,256,16),u=i.createCipheriv("aes-256-cbc",a.key,a.iv);return s({data:Buffer.concat([Buffer.from("Salted__"),o,u.update(Buffer.from(t)),u.final()]).toString("base64"),secKey:i.publicEncrypt({key:"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8asrfSaoOb4je+DSmKdriQJKWVJ2oDZrs3wi5W67m3LwTB9QVR+cE3XWU21Nx+YBxS0yun8wDcjgQvYt625ZCcgin2ro/eOkNyUOTBIbuj9CvMnhUYiR61lC1f1IGbrSYYimqBVSjpifVufxtx/I3exReZosTByYp4Xwpb1+WAQIDAQAB\n-----END PUBLIC KEY-----",padding:i.constants.RSA_PKCS1_PADDING},r).toString("base64")})}},base64:{encode:(e,t)=>Buffer.from(e,t).toString("base64").replace(/\+/g,"-").replace(/\//g,"_"),decode:(e,t)=>Buffer.from(e.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString(t)},uri:{retrieve:e=>{e=e.toString().trim();let t="3go8&$8*3*3h0k(2)2",r=Array.from(Array(e.length).keys()).map(r=>String.fromCharCode(e.charCodeAt(r)^t.charCodeAt(r%t.length))).join(""),o=i.createHash("md5").update(r).digest("base64").replace(/\//g,"_").replace(/\+/g,"-");return`http://p1.music.126.net/${o}/${e}`}},md5:{digest:e=>i.createHash("md5").update(e).digest("hex"),pipe:e=>new Promise((t,r)=>{let o=i.createHash("md5").setEncoding("hex");e.pipe(o).on("error",e=>r(e)).once("finish",()=>t(o.read()))})},sha1:{digest:e=>i.createHash("sha1").update(e).digest("hex")},random:{hex:e=>i.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e)}};try{e.exports.kuwoapi=r(9726)}catch(e){}},8729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super(`The audio data is incomplete: ${e}`),this.name="IncompleteAudioData"}}},1828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t){super(`${e} exited with ${t}, which is not zero.`),this.process=e,this.exitCode=t,this.name="ProcessExitNotSuccessfully"}}},2396:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super(`This request URL has been cancelled: ${e}`),this.name="RequestCancelled"}}},7591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t){super(`Failed to get the response. Status code: ${t}`),this.url=e,this.code=t,this.name="RequestFailed"}}},806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t="?"){super(`This song "${t}" is not available in ${e}`),this.name="SongNotAvailable"}}},8696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of youtube-dl is malformed."),this.name="YoutubeDlInvalidResponse",this.response=e}}},6587:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "youtube-dl" before using the "youtubedl" source.'),this.name="YoutubeDlNotInstalled"}}},816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of yt-dlp is malformed."),this.name="YtDlpInvalidResponse",this.response=e}}},7229:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "yt-dlp" before using the "ytdlp" source.'),this.name="YtDlpNotInstalled"}}},6117:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153),r(530),r(3586),r(3096),r(5872),r(4483),r(5277),r(3136),r(3625),r(8350),r(7737),r(391),r(1414),r(4558),r(695),r(3605),r(1447),r(5609),r(993),r(6676),r(2826),r(6570),r(932),r(580),r(2708),r(5097),r(1363),r(8210),r(4494),r(3351),r(6006),r(7907);let i=r(7016).parse,o=r(23),s=r(2965),a=r(3093),u=r(3480),{isHost:c,cookieToMap:l,mapToCookie:f}=r(1084),{getManagedCacheStorage:p}=r(6718),{logScope:h}=r(6166),d=h("hook"),g=p("hook");g.aliveDuration=6048e5;let y=["true","cvip","svip"].includes((process.env.ENABLE_LOCAL_VIP||"").toLowerCase()),m="true"===(process.env.BLOCK_ADS||"").toLowerCase(),b="true"===(process.env.DISABLE_UPGRADE_CHECK||"").toLowerCase(),v="svip"===(process.env.ENABLE_LOCAL_VIP||"").toLowerCase(),w=(process.env.LOCAL_VIP_UID||"").split(",").map(e=>parseInt(e)).filter(e=>!Number.isNaN(e)),_={request:{before:()=>{},after:()=>{}},connect:{before:()=>{}},negotiate:{before:()=>{}},target:{host:new Set,path:new Set}};_.target.host=new Set(["music.163.com","interface.music.163.com","interface3.music.163.com","apm.music.163.com","apm3.music.163.com","interface.music.163.com.163jiasu.com","interface3.music.163.com.163jiasu.com"]),_.target.path=new Set(["/api/v3/playlist/detail","/api/v3/song/detail","/api/v6/playlist/detail","/api/album/play","/api/artist/privilege","/api/album/privilege","/api/v1/artist","/api/v1/artist/songs","/api/v2/artist/songs","/api/artist/top/song","/api/v1/album","/api/album/v3/detail","/api/playlist/privilege","/api/song/enhance/player/url","/api/song/enhance/player/url/v1","/api/song/enhance/download/url","/api/song/enhance/download/url/v1","/api/song/enhance/privilege","/api/ad","/batch","/api/batch","/api/listen/together/privilege/get","/api/v1/search/get","/api/v1/search/song/get","/api/search/complex/get","/api/search/complex/page","/api/search/song/page","/api/cloudsearch/pc","/api/v1/playlist/manipulate/tracks","/api/song/like","/api/v1/play/record","/api/playlist/v4/detail","/api/v1/radio/get","/api/v1/discovery/recommend/songs","/api/usertool/sound/mobile/promote","/api/usertool/sound/mobile/theme","/api/usertool/sound/mobile/animationList","/api/usertool/sound/mobile/all","/api/usertool/sound/mobile/detail","/api/vipauth/app/auth/query","/api/music-vip-membership/client/vip/info"]);let S=["music.163.com","music.126.net","iplay.163.com","look.163.com","y.163.com","interface.music.163.com","interface3.music.163.com"];_.request.before=e=>{let{req:t}=e;t.url=(t.url.startsWith("http://")?"":(t.socket.encrypted?"https:":"http:")+"//"+(S.some(e=>(t.headers.host||"").includes(e))?t.headers.host:null))+t.url;let r=i(t.url);if([r.hostname,t.headers.host].some(e=>c(e,"music.163.com"))&&(e.decision="proxy"),process.env.NETEASE_COOKIE&&r.path.includes("url")){var a=l(t.headers.cookie);Object.entries(l(process.env.NETEASE_COOKIE)).forEach(([e,t])=>{a[e]=t}),t.headers.cookie=f(a),d.debug("Replace netease cookie")}if([r.hostname,t.headers.host].some(e=>_.target.host.has(e))&&"POST"===t.method&&(r.path.startsWith("/eapi/")||r.path.startsWith("/api/")))return s.read(t).then(e=>t.body=e).then(s=>{if("x-napm-retry"in t.headers&&delete t.headers["x-napm-retry"],t.headers["X-Real-IP"]="118.88.88.88",!(t.url.includes("stream")||t.url.includes("/eapi/cloud/upload/check"))&&(t.headers["Accept-Encoding"]="gzip, deflate",s)){let t;let a={};switch(a.pad=(s.match(/%0+$/)||[""])[0],"/api/linux/forward"===r.path?a.crypto="linuxapi":r.path.startsWith("/eapi/")?a.crypto="eapi":r.path.startsWith("/api/")&&(a.crypto="api"),a.crypto){case"linuxapi":t=JSON.parse(o.linuxapi.decrypt(Buffer.from(s.slice(8,s.length-a.pad.length),"hex")).toString()),a.path=i(t.url).path,a.param=t.params;break;case"eapi":t=o.eapi.decrypt(Buffer.from(s.slice(7,s.length-a.pad.length),"hex")).toString().split("-36cd479b6b5-"),a.path=t[0],a.param=JSON.parse(t[1]),a.param.hasOwnProperty("e_r")&&("true"==a.param.e_r||!0==a.param.e_r)?a.e_r=!0:a.e_r=!1;break;case"api":t={},decodeURIComponent(s).split("&").forEach(e=>{let[r,i]=e.split("=");t[r]=i}),a.path=r.path,a.param=t}if(a.path=a.path.replace(/\/\d*$/,""),e.netease=a,"/api/song/enhance/download/url"===a.path)return x(e);if("/api/song/enhance/download/url/v1"===a.path)return E(e);m&&a.path.startsWith("/api/ad")&&(e.error=Error("ADs blocked."),e.decision="close"),b&&a.path.match(/^\/api(\/v1)?\/(android|ios|osx|pc)\/(upgrade|version)/)&&(e.error=Error("Upgrade check blocked."),e.decision="close")}}).catch(e=>e&&d.error(e,`A error occurred in hook.request.before when hooking ${t.url}.`));if(_.target.host.has(r.hostname)&&(r.path.startsWith("/weapi/")||r.path.startsWith("/api/")))t.headers["X-Real-IP"]="118.88.88.88",e.netease={web:!0,path:r.path.replace(/^\/weapi\//,"/api/").split("?").shift().replace(/\/\d*$/,"")};else if(t.url.includes("package"))try{let r=t.url.split("package/").pop().split("/"),s=i(o.base64.decode(r[0])),a=r[1].replace(/\.\w+/,"");t.url=s.href,t.headers.host=s.hostname,t.headers.cookie=null,e.package={id:a},e.decision="proxy"}catch(t){e.error=t,e.decision="close"}},_.request.after=e=>{let{req:t,proxyRes:r,netease:a,package:u}=e;if("tyst.migu.cn"===t.headers.host&&r.headers["content-range"]&&200===r.statusCode&&(r.statusCode=206),a&&_.target.path.has(a.path)&&200===r.statusCode)return s.read(r,!0).then(e=>e.length?r.body=e:Promise.reject()).then(t=>{let r=e=>e.replace(/([^\\]"\s*:\s*)(\d{16,})(\s*[}|,])/g,'$1"$2L"$3');if(a.e_r?a.jsonBody=JSON.parse(r(o.eapi.decrypt(t).toString())):a.jsonBody=JSON.parse(r(t.toString())),y){let e="/api/music-vip-membership/client/vip/info";if("/batch"===a.path||"/api/batch"===a.path||a.path===e){let t=a.path===e?a.jsonBody:a.jsonBody[e],r={iconUrl:null,dynamicIconUrl:null,isSign:!1,isSignIap:!1,isSignDeduct:!1,isSignIapDeduct:!1};if(t&&(0===w.length||w.includes(t.data.userId)))try{let i=(t.data.now||new Date().getTime())+316224e5;t.data.redVipLevel=7,t.data.redVipAnnualCount=1,t.data.musicPackage={...r,...t.data.musicPackage,vipCode:230,vipLevel:7,expireTime:i},t.data.associator={...r,...t.data.associator,vipCode:100,vipLevel:7,expireTime:i},v&&(t.data.redplus={...r,...t.data.redplus,vipCode:300,vipLevel:7,expireTime:i},t.data.albumVip={...r,...t.data.albumVip,vipCode:400,vipLevel:0,expireTime:i}),a.path===e?a.jsonBody=t:a.jsonBody[e]=t}catch(e){d.debug({err:e},"Unable to apply the local VIP.")}}}if(new Set([401,512]).has(a.jsonBody.code)&&!a.web){if(a.path.includes("manipulate"))return O(e);if("/api/song/like"===a.path)return k(e)}else if(a.path.includes("url"))return T(e);else if(a.path.includes("/usertool/sound/"))return R(a.jsonBody);else if(a.path.includes("batch"))for(let e in a.jsonBody)e.includes("/usertool/sound/")&&R(a.jsonBody[e]);else if(a.path.includes("/vipauth/app/auth/query"))return P(a.jsonBody)}).then(()=>{["transfer-encoding","content-encoding","content-length"].filter(e=>e in r.headers).forEach(e=>delete r.headers[e]);let e=JSON.stringify(a.jsonBody,(e,t)=>("object"==typeof t&&null!=t&&("cp"in t&&(t.cp=1),"fee"in t&&(t.fee=0),"downloadMaxbr"in t&&0===t.downloadMaxbr&&(t.downloadMaxbr=32e4),"dl"in t&&"downloadMaxbr"in t&&t.dle&&d.error(e,`A error occurred in hook.request.after when hooking ${t.url}.`));if(u){if(new Set([201,301,302,303,307,308]).has(r.statusCode))return s(t.method,i(t.url).resolve(r.headers.location),t.headers).then(t=>e.proxyRes=t);/p\d+c*\.music\.126\.net/.test(t.url)&&(r.headers["content-type"]="audio/*")}},_.connect.before=e=>{let{req:t}=e,r=i("https://"+t.url);[r.hostname,t.headers.host].some(e=>_.target.host.has(e))?80===parseInt(r.port)?(t.url=`${global.address||"localhost"}:${global.port[0]}`,t.local=!0):global.port[1]?(t.url=`${global.address||"localhost"}:${global.port[1]}`,t.local=!0):e.decision="blank":r.href.includes(global.endpoint)&&(e.decision="proxy")},_.negotiate.before=e=>{let{req:t,socket:r,decision:o}=e,s=i("https://"+t.url),a=_.target.host;!t.local&&!o&&a.has(r.sni)&&!a.has(s.hostname)&&(a.add(s.hostname),e.decision="blank")};let x=e=>{let t;let{req:r,netease:i}=e,s="http://music.163.com/api/song/enhance/player/url",{id:a,br:u,e_r:c,header:l}=i.param;switch(i.crypto){case"linuxapi":i.param={ids:`["${a}"]`,br:u},t=o.linuxapi.encryptRequest(s,i.param);break;case"eapi":case"api":i.param={ids:`["${a}"]`,br:u,e_r:c,header:l},"eapi"==i.crypto?t=o.eapi.encryptRequest(s,i.param):"api"==i.crypto&&(t=o.api.encryptRequest(s,i.param))}r.url=t.url,r.body=t.body+i.pad},E=e=>{let t;let{req:r,netease:i}=e,s="http://music.163.com/api/song/enhance/player/url/v1",{id:a,level:u,immerseType:c,e_r:l,header:f}=i.param;switch(i.crypto){case"linuxapi":i.param={ids:`["${a}"]`,level:u,encodeType:"flac",immerseType:c},t=o.linuxapi.encryptRequest(s,i.param);break;case"eapi":case"api":i.param={ids:`["${a}"]`,level:u,encodeType:"flac",immerseType:c,e_r:l,header:f},"eapi"==i.crypto?t=o.eapi.encryptRequest(s,i.param):"api"==i.crypto&&(t=o.api.encryptRequest(s,i.param))}r.url=t.url,r.body=t.body+i.pad},O=e=>{let{req:t,netease:r}=e,{trackIds:i,pid:o,op:a}=r.param,u=(Array.isArray(i)?i:JSON.parse(i))[0];return s("POST","http://music.163.com/api/playlist/manipulate/tracks",t.headers,`trackIds=[${u},${u}]&pid=${o}&op=${a}`).then(e=>e.json()).then(e=>{r.jsonBody=e}).catch(e=>e&&d.error(e))},k=e=>{let{req:t,netease:r}=e,{trackId:i}=r.param,o=0,a=0;return s("GET","http://music.163.com/api/v1/user/info",t.headers).then(e=>e.json()).then(e=>(a=e.userPoint.userId,s("GET",`http://music.163.com/api/user/playlist?uid=${a}&limit=1`,t.headers).then(e=>e.json()))).then(e=>(o=e.playlist[0].id,s("POST","http://music.163.com/api/playlist/manipulate/tracks",t.headers,`trackIds=[${i},${i}]&pid=${o}&op=add`).then(e=>e.json()))).then(e=>{new Set([200,502]).has(e.code)&&(r.jsonBody={code:200,playlistId:o})}).catch(e=>e&&d.error(e))},j=e=>s("GET",e.url).then(e=>o.md5.pipe(e)),T=e=>{let t;let{req:r,netease:i}=e,{jsonBody:s}=i,c=Number(process.env.MIN_BR)||0,l=0,f=e=>{if(e.flag=0,(200!==e.code||e.freeTrialInfo||e.br{let s="";try{let{header:e}=i.param;e="string"==typeof e?JSON.parse(e):e;let t=u.parse(r.headers.cookie.replace(/\s/g,""),";");s=e.os||t.os}catch(e){}return e.type=999e3===t.br?"flac":"mp3","pc"===s||"uwp"===s?e.url=global.endpoint?`${global.endpoint.replace("https://","http://")}/package/${o.base64.encode(t.url)}/${e.id}.${e.type}`:t.url:e.url=global.endpoint?`${global.endpoint}/package/${o.base64.encode(t.url)}/${e.id}.${e.type}`:t.url,e.md5=t.md5||o.md5.digest(t.url),e.br=t.br||128e3,e.size=t.size,e.code=200,e.freeTrialInfo=null,t}).then(t=>{if(!i.path.includes("download")||t.md5)return;let o={android:"0.0.0",osx:"0.0.0"},s={key:t.url.replace(/\?.*$/,"").replace(/(?<=kugou\.com\/)\w+\/\w+\//,"").replace(/(?<=kuwo\.cn\/)\w+\/\w+\/resource\//,""),url:t.url};try{let{header:t}=i.param;t="string"==typeof t?JSON.parse(t):t;let a=u.parse(r.headers.cookie.replace(/\s/g,""),";"),c=t.os||a.os,l=t.appver||a.appver;if(c in o&&((e,t)=>{let r=Array.from([e,t]).map(e=>e.split(".").slice(0,3).map(e=>parseInt(e)||0)).reduce((e,t)=>e.length?e.map((e,r)=>e.concat(t[r])):t.map(e=>[e]),[]).filter(e=>e[0]!==e[1])[0];return!r||r[0]<=r[1]})(o[c],l))return g.cache(s,()=>j(s)).then(t=>e.md5=t)}catch(e){}}).catch(e=>e&&d.error(e));200===e.code&&i.web&&(e.url=e.url.replace(/(m\d+?)(?!c)\.music\.126\.net/,"$1c.music.126.net"))};return Array.isArray(s.data)?i.path.includes("download")?(s.data=s.data[0],t=[f(s.data)]):(l=i.web?0:parseInt(((Array.isArray(i.param.ids)?i.param.ids:JSON.parse(i.param.ids))[0]||0).toString().replace("_0","")),t=s.data.map(e=>f(e))):t=[f(s.data)],Promise.all(t).catch(e=>e&&d.error(e))},R=e=>{d.debug("unblockSoundEffects() has been triggered.");let{data:t,code:r}=e;200===r&&(Array.isArray(t)?t.map(e=>{e.type&&(e.type=1)}):t.type&&(t.type=1))},P=e=>{d.debug("unblockLyricsEffects() has been triggered.");let{data:t,code:r}=e;200===r&&Array.isArray(t)&&t.forEach(e=>{"canUse"in e&&(e.canUse=!0),"canNotUseReasonCode"in e&&(e.canNotUseReasonCode=200)})};e.exports=_},9726:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(1363),r(8210);let i=e=>{let t=BigInt(e);return{low:Number(t),valueOf:()=>t.valueOf(),toString:()=>t.toString(),not:()=>i(~t),isNegative:()=>t<0,or:e=>i(t|BigInt(e)),and:e=>i(t&BigInt(e)),xor:e=>i(t^BigInt(e)),equals:e=>t===BigInt(e),multiply:e=>i(t*BigInt(e)),shiftLeft:e=>i(t<i(t>>BigInt(e))}},o=e=>Array.from(Array(e).keys()),s=(e,t)=>Array(t).fill(null).reduce(t=>t.multiply(e),i(1)),a=(...e)=>e.map(e=>-1===e?i(-1,-1):i(e)),u=a(31,0,1,2,3,4,-1,-1,3,4,5,6,7,8,-1,-1,7,8,9,10,11,12,-1,-1,11,12,13,14,15,16,-1,-1,15,16,17,18,19,20,-1,-1,19,20,21,22,23,24,-1,-1,23,24,25,26,27,28,-1,-1,27,28,29,30,31,30,-1,-1),c=a(57,49,41,33,25,17,9,1,59,51,43,35,27,19,11,3,61,53,45,37,29,21,13,5,63,55,47,39,31,23,15,7,56,48,40,32,24,16,8,0,58,50,42,34,26,18,10,2,60,52,44,36,28,20,12,4,62,54,46,38,30,22,14,6),l=a(39,7,47,15,55,23,63,31,38,6,46,14,54,22,62,30,37,5,45,13,53,21,61,29,36,4,44,12,52,20,60,28,35,3,43,11,51,19,59,27,34,2,42,10,50,18,58,26,33,1,41,9,49,17,57,25,32,0,40,8,48,16,56,24),f=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1],p=a(0,1048577,3145731),h=o(64).map(e=>s(2,e));h[h.length-1]=h[h.length-1].multiply(-1);let d=a(15,6,19,20,28,11,27,16,0,14,22,25,4,17,30,9,1,7,23,13,31,26,2,8,18,12,29,5,21,10,3,24),g=a(56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3),y=a(13,16,10,23,0,4,-1,-1,2,27,14,5,20,9,-1,-1,22,18,11,3,25,7,-1,-1,15,6,26,19,12,1,-1,-1,40,51,30,36,46,54,-1,-1,29,39,50,44,32,47,-1,-1,43,48,38,55,33,52,-1,-1,45,41,49,35,28,31,-1,-1),m=[[14,4,3,15,2,13,5,3,13,14,6,9,11,2,0,5,4,1,10,12,15,6,9,10,1,8,12,7,8,11,7,0,0,15,10,5,14,4,9,10,7,8,12,3,13,1,3,6,15,12,6,11,2,9,5,0,4,2,11,14,1,7,8,13],[15,0,9,5,6,10,12,9,8,7,2,12,3,13,5,2,1,14,7,8,11,4,0,3,14,11,13,6,4,1,10,15,3,13,12,11,15,3,6,0,4,10,1,7,8,4,11,14,13,8,0,6,2,15,9,5,7,1,10,12,14,2,5,9],[10,13,1,11,6,8,11,5,9,4,12,2,15,3,2,14,0,6,13,1,3,15,4,10,14,9,7,12,5,0,8,7,13,1,2,4,3,6,12,11,0,13,5,14,6,8,15,2,7,10,8,15,4,9,11,5,9,0,14,3,10,7,1,12],[7,10,1,15,0,12,11,5,14,9,8,3,9,7,4,8,13,6,2,1,6,11,12,2,3,0,5,14,10,13,15,4,13,3,4,9,6,10,1,12,11,0,2,5,0,13,14,2,8,15,7,4,15,1,10,7,5,6,12,11,3,8,9,14],[2,4,8,15,7,10,13,6,4,1,3,12,11,7,14,0,12,2,5,9,10,13,0,3,1,11,15,5,6,8,9,14,14,11,5,6,4,1,3,10,2,12,15,0,13,2,8,5,11,8,0,15,7,14,9,4,12,7,10,9,1,13,6,3],[12,9,0,7,9,2,14,1,10,15,3,4,6,12,5,11,1,14,13,0,2,8,7,13,15,5,4,10,8,3,11,6,10,4,6,11,7,9,0,6,4,2,13,1,9,15,3,8,15,3,1,14,12,5,11,0,2,12,14,7,5,10,8,13],[4,1,3,10,15,12,5,0,2,11,9,6,8,7,6,9,11,4,12,15,0,3,10,5,14,13,7,8,13,14,1,2,13,6,14,9,4,1,2,14,11,13,5,0,1,10,8,3,0,11,3,5,9,4,15,2,7,8,12,15,10,7,6,12],[13,7,10,0,6,9,5,15,8,4,3,10,11,14,12,5,2,11,9,6,15,12,0,3,4,1,14,13,1,2,7,8,1,2,12,15,10,4,0,3,13,14,6,9,7,8,9,6,15,1,5,12,3,10,14,5,8,7,11,0,4,13,2,11]],b=(e,t,r)=>{let s=i(0);return o(t).forEach(t=>{e[t].isNegative()||r.and(h[e[t].low]).equals(0)||(s=s.or(h[t]))}),s},v=(e,t)=>{let r=o(8).map(()=>i(0)),s=[i(0),i(0)],a=i(0),f=i(0),p=b(c,64,t);return s[0]=p.and(4294967295),s[1]=p.and(-4294967296).shiftRight(32),o(16).forEach(t=>{let c=i(0);f=(f=b(u,64,f=i(s[1]))).xor(e[t]),o(8).forEach(e=>{r[e]=f.shiftRight(8*e).and(255)}),o(8).reverse().forEach(e=>{c=c.shiftLeft(4).or(m[e][r[e]])}),f=b(d,32,c),a=i(s[0]),s[0]=i(s[1]),s[1]=a.xor(f)}),s.reverse(),p=b(l,64,p=s[1].shiftLeft(32).and(-4294967296).or(s[0].and(4294967295)))},w=(e,t,r)=>{let i=b(g,56,e);o(16).forEach(e=>{i=i.and(p[f[e]]).shiftLeft(28-f[e]).or(i.and(p[f[e]].not()).shiftRight(f[e])),t[e]=b(y,64,i)}),1===r&&o(8).forEach(e=>{[t[e],t[15-e]]=[t[15-e],t[e]]})},_=(e,t,r)=>{let s=i(0);o(8).forEach(e=>{s=i(t[e]).shiftLeft(8*e).or(s)});let a=Math.floor(e.length/8),u=o(16).map(()=>i(0));w(s,u,r);let c=o(a).map(()=>i(0));o(a).forEach(t=>{o(8).forEach(r=>{c[t]=i(e[r+8*t]).shiftLeft(8*r).or(c[t])})});let l=o(Math.floor((1+8*(a+1))/8)).map(()=>i(0));o(a).forEach(e=>{l[e]=v(u,c[e])});let f=e.slice(8*a),p=i(0);o(e.length%8).forEach(e=>{p=i(f[e]).shiftLeft(8*e).or(p)}),(f.length||0===r)&&(l[a]=v(u,p));let h=o(8*l.length).map(()=>0),d=0;return l.forEach(e=>{o(8).forEach(t=>{h[d]=e.shiftRight(8*t).and(255).low,d+=1})}),Buffer.from(h)},S=Buffer.from("ylzsxkwm"),x=e=>_(e,S,0);e.exports={encrypt:x,decrypt:e=>_(e,S,1),encryptQuery:e=>x(Buffer.from(e)).toString("base64")}},6166:(e,t,r)=>{"use strict";var i;let o=r(2306),s=process.env.LOG_FILE,a=process.stdout.isTTY,u=o({level:null!==(i=process.env.LOG_LEVEL)&&void 0!==i?i:"info",prettyPrint:"true"!==process.env.JSON_LOG&&{colorize:a,messageFormat:a?"\x1b[1m\x1b[32m({scope})\x1b[0m\x1b[36m {msg}":"({scope}) {msg}",ignore:"time,pid,hostname,scope",errorProps:"*"}},s&&o.destination(s));e.exports={logger:u,logScope:function(e){return u.child({scope:e})}}},8114:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15);let{cacheStorage:i,CacheStorageGroup:o,getManagedCacheStorage:s}=r(6718),a=r(9588),u=r(3186),c=r(2965),l=e=>({id:e.id,name:e.title,artists:{id:e.mid,name:e.author}}),f=e=>c("GET",`https://api.bilibili.com/audio/music-service-c/s?search_type=music&page=1&pagesize=30&keyword=${encodeURIComponent(e.keyword)}`).then(e=>e.json()).then(t=>{let r=u(t.data.result.map(l),e);return r?r.id:Promise.reject()}),p=e=>c("GET","https://www.bilibili.com/audio/music-service-c/web/url?rivilege=2&quality=2&sid="+e).then(e=>e.json()).then(e=>0===e.code?e.data.cdns[0].replace("https","http"):Promise.reject()).catch(()=>a().bilibili.track(e)),h=s("provider/bilibili");e.exports={check:e=>h.cache(e,()=>f(e)).then(p),track:p}},9041:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(2708),r(5097),r(9635),r(9320),r(15);let i=r(2965),{getManagedCacheStorage:o}=r(6718),s=(e,t)=>Object.keys(e).reduce((r,i)=>Object.assign(r,t.includes(i)&&{[i]:e[i]}),{}),a=e=>{let t=[e[0]],r=()=>t.reduce((e,t)=>e+t.length,0);return e.slice(1).some(e=>r()>15||(t.push(e),!1)),t},u=e=>{try{let r=s(e,["id","name","alias","duration"]);if(r.name=(r.name||"").replace(/(\s*cover[::\s][^)]+)/i,"").replace(/\(\s*cover[::\s][^)]+\)/i,"").replace(/(\s*翻自[::\s][^)]+)/,"").replace(/\(\s*翻自[::\s][^)]+\)/,""),r.album=s(e.album,["id","name"]),r.artists=e.artists.map(e=>s(e,["id","name"])),r.keyword=r.name+" - "+a(r.artists.map(e=>e.name)).join(" / "),"true"===process.env.SEARCH_ALBUM){var t;let e=null===(t=r.album)||void 0===t?void 0:t.name;e&&e!==r.name&&(r.keyword+=` ${e}`)}return r}catch(e){return console.log("getFormatData err: ",e),{}}},c=(e,t)=>{if(!t)return i("GET","https://music.163.com/api/song/detail?ids=["+e+"]").then(e=>e.json()).then(e=>{if(e&&e.songs&&e.songs.length){let t=u(e.songs[0]);return t.name?t:Promise.reject()}return Promise.reject()});{let e=u(t);return e.name?Promise.resolve(e):Promise.reject()}},l=o("provider/find");e.exports=(e,t)=>t?c(e,t):l.cache(e,()=>c(e))},9588:(e,t,r)=>{"use strict";let i=r(2965);e.exports=()=>{let t=global.cnrelay,r=new Proxy(()=>{},{get:(e,t)=>(e.route=(e.route||[]).concat(t),r),apply:(r,o,s)=>{if(e.exports.disable||!t)return Promise.reject();let a=r.route.join("/"),u="object"==typeof s[0]?JSON.stringify(s[0]):s[0];return i("GET",`${t}/${a}?${encodeURIComponent(u)}`).then(e=>e.body())}});return r}},9222:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(4494);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c={origin:"http://www.joox.com",referer:"http://www.joox.com",cookie:process.env.JOOX_COOKIE||null},l=e=>/[\u0800-\u4e00]/.test(e.name)?e.name:e.keyword,f=e=>{let{decode:t}=s.base64;return{id:e.songid,name:t(e.info1||""),duration:1e3*e.playtime,album:{id:e.albummid,name:t(e.info3||"")},artists:e.singer_list.map(({id:e,name:r})=>({id:e,name:t(r||"")}))}},p=e=>a("GET","http://api-jooxtt.sanook.com/web-fcgi-bin/web_search?country=hk&lang=zh_TW&search_input="+encodeURIComponent(l(e))+"&sin=0&ein=30",c).then(e=>e.body()).then(t=>{let r=o(JSON.parse(t.replace(/'/g,'"')).itemlist.map(f),e);return r?r.id:Promise.reject()}),h=e=>a("GET","http://api.joox.com/web-fcgi-bin/web_get_songinfo?songid="+e+"&country=hk&lang=zh_cn&from_type=-1&channel_id=-1&_="+new Date().getTime(),c).then(e=>e.jsonp()).then(e=>(e.r320Url||e.r192Url||e.mp3Url||e.m4aUrl).replace(/M\d00([\w]+).mp3/,"M800$1.mp3")||Promise.reject()).catch(()=>i().joox.track(e)),d=u("provider/joox");e.exports={check:e=>d.cache(e,()=>p(e)).then(h),track:h}},2777:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.hash,id_hq:e["320hash"],id_sq:e.sqhash,name:e.songname,duration:1e3*e.duration,album:{id:e.album_id,name:e.album_name}}),l=e=>a("GET","http://mobilecdn.kugou.com/api/v3/search/song?keyword="+encodeURIComponent(e.keyword)+"&page=1&pagesize=10").then(e=>e.json()).then(t=>o(t.data.info.map(c),e)||Promise.reject()).catch(()=>i().kugou.search(e)),f=(e,t)=>{let r=()=>{switch(t){case"hash":return e.id;case"hqhash":return e.id_hq;case"sqhash":return e.id_sq}return""};return a("GET","http://trackercdn.kugou.com/i/v2/?key="+s.md5.digest(`${r()}kgcloudv2`)+"&hash="+r()+"&appid=1005&pid=2&cmd=25&behavior=play&album_id="+e.album.id).then(e=>e.json()).then(e=>e.url[0]||Promise.reject())},p=e=>Promise.all(["sqhash","hqhash","hash"].slice(o.ENABLE_FLAC?0:1).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().kugou.track(e)),h=u("provider/kugou");e.exports={check:e=>h.cache(e,()=>l(e)).then(p),search:l}},2076:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.MUSICRID.split("_").pop(),name:e.SONGNAME,duration:1e3*e.DURATION,album:{id:e.ALBUMID,name:e.ALBUM},artists:e.ARTIST.split("&").map((t,r)=>({id:r?null:e.ARTISTID,name:t}))}),l=e=>a("GET","http://search.kuwo.cn/r.s?&correct=1&stype=comprehensive&encoding=utf8&rformat=json&mobi=1&show_copyright_off=1&searchapi=6&all="+encodeURIComponent(e.keyword.replace(" - "," "))).then(e=>e.json()).then(t=>{if(!t||t.content.length<2||!t.content[1].musicpage||t.content[1].musicpage.abslist.length<1)return Promise.reject();let r=o(t.content[1].musicpage.abslist.filter(e=>"0"===e.tpay).map(c),e);return r?r.id:Promise.reject()}),f=e=>a("GET",s.kuwoapi?"http://mobi.kuwo.cn/mobi.s?f=kuwo&q="+s.kuwoapi.encryptQuery("corp=kuwo&source=kwplayer_ar_1.1.9_oppo_118980_320.apk&p2p=1&type=convert_url2&sig=0&format="+["flac","mp3"].slice(o.ENABLE_FLAC?0:1).join("|")+"&rid="+e):"http://antiserver.kuwo.cn/anti.s?type=convert_url&format=mp3&response=url&rid=MUSIC_"+e,{"user-agent":"okhttp/3.10.0"}).then(e=>e.body()).then(e=>(e.match(/http[^\s$"]+/)||[])[0]||Promise.reject()).catch(()=>i().kuwo.track(e)),p=u("provider/kuwo");e.exports={check:e=>p.cache(e,()=>l(e)).then(f),track:f}},3093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(952),r(1200),r(9778),r(3307),r(310),r(4980),r(4504),r(4038),r(8208),r(7274),r(1469),r(3039),r(845),r(200),r(7022),r(9551),r(153),r(6199),r(9320),r(15),r(6006),r(7907),r(1673),r(6060),r(1363),r(8210);let i=r(9041),o=r(2965),{PROVIDERS:s,DEFAULT_SOURCE:a}=r(6406),{isHostWrapper:u}=r(1084),c=r(806),l=r(7591),f=r(8729),{logScope:p}=r(6166),h=r(2396),d=p("provider/match"),g=e=>e>=200&&e<=299,y=new Map([["bilivideo.com","https://www.bilibili.com/"]]);async function m(e,t){d.debug({source:e,info:t},"Getting the audio...");let r=await s[e].check(t);if(!r)throw new c(e);let i=await v(r);if(d.debug(i,"The matched song is:"),!i||"string"!=typeof i.url)throw new f("song is undefined, or song.url is not a string.");return d.debug({source:e,info:t},"The audio matched!"),{...i,source:e}}async function b(e,t,r){let o=(t||global.source||a).filter(e=>e in s),u=await i(e,r),l=null;if(process.env.SELECT_MAX_BR){let e=await Promise.allSettled(o.map(async e=>m(e,u).catch(e=>{throw e&&(e instanceof h?d.debug(e):d.error(e)),e})));if(0===(e=e.filter(e=>"fulfilled"===e.status)).length)throw new c("any source");l=(e=e.map(e=>e.value)).reduce((e,t)=>e.br>=t.br?e:t)}else if(process.env.FOLLOW_SOURCE_ORDER){for(let e=0;em(e,u).catch(e=>{throw e&&(e instanceof h?d.debug(e):d.error(e)),e})));let{id:f,name:p}=u,{url:g}=l;return d.debug({audioInfo:u,audioData:l},"The data to replace:"),d.info({audioId:f,songName:p,url:g},`Replaced: [${f}] ${p}`),l}async function v(e){let t=u(e),r={size:0,br:null,url:null,md5:null},i={range:"bytes=0-8191","accept-encoding":"identity"};y.forEach((e,r)=>{t(r)&&(i.referer=e)});let s=await o("GET",e,i),{headers:a}=s;if(!g(s.statusCode))throw new l(e,s.statusCode);r.url=s.url.href;let c=await s.body(!0);try{let e=function(e){let t={3:{3:["free",32,64,96,128,160,192,224,256,288,320,352,384,416,448,"bad"],2:["free",32,48,56,64,80,96,112,128,160,192,224,256,320,384,"bad"],1:["free",32,40,48,56,64,80,96,112,128,160,192,224,256,320,"bad"]},2:{3:["free",32,48,56,64,80,96,112,128,144,160,176,192,224,256,"bad"],2:["free",8,16,24,32,40,48,56,64,80,96,112,128,144,160,"bad"]}};t[2][1]=t[2][2],t[0]=t[2];let r=0;if("fLaC"===e.slice(0,4).toString())return 999;"ID3"===e.slice(0,3).toString()&&(r=6,r=10+e.slice(r,r+4).reduce((e,t,r)=>e+(127&t)<<7*(3-r),0));let i=e.slice(r,r+4);if(4===i.length&&255===i[0]&&(i[1]>>5&7)==7&&(i[1]>>1&3)!=0&&(i[2]>>4&15)!=15&&(i[2]>>2&3)!=3){let e=i[1]>>3&3,r=i[1]>>1&3,o=i[2]>>4;return t[e][r][o]}}(c);r.br=e&&!isNaN(e)?1e3*e:null}catch(e){d.debug(e,"Failed to decode and extract the bitrate")}if(!r.br){if(t("qq.com")&&r.url.includes(".m4a")&&(r.br=96e3),t("bilivideo.com")&&r.url.includes(".m4a")){let e=parseInt(r.url.match(/-(\d+)k\.m4a/));isNaN(e)?e=192e3:e<96||e>999?e=192e3:e*=1e3,r.br=e}t("googlevideo.com")&&(r.br=128e3)}return a&&(t("126.net")&&(r.md5=r.url.split("/").slice(-1)[0].replace(/\..*/g,"")),t("qq.com")&&(r.md5=a["server-md5"]),r.size=parseInt((a["content-range"]||"").split("/").pop()||a["content-length"])||0,"8192"!==a["content-length"])?Promise.reject():r}e.exports=b},8516:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://music.migu.cn/",referer:"http://m.music.migu.cn/v3/",aversionid:process.env.MIGU_COOKIE||null,channel:"0146921"},c=e=>{let t=e.singerId.split(/\s*,\s*/),r=e.singerName.split(/\s*,\s*/);return{id:e.id,name:e.title,album:{id:e.albumId,name:e.albumName},artists:t.map((e,t)=>({id:e,name:r[t]}))}},l=e=>s("GET","https://m.music.migu.cn/migu/remoting/scr_search_tag?keyword="+encodeURIComponent(e.keyword)+"&type=2&rows=20&pgc=1",u).then(e=>e.json()).then(t=>{let r=o(((t||{}).musics||[]).map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r="https://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4?netType=01&resourceType=2&songId="+e.toString()+"&toneFlag="+t;return s("GET",r,u).then(e=>e.json()).then(e=>{let{audioFormatType:i}=e.data;return i!==t?Promise.reject():r?e.data.url:Promise.reject()})},p=e=>Promise.all(["ZQ24","SQ","HQ","PQ"].slice(o.ENABLE_FLAC?0:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().migu.track(e)),h=a("provider/migu");e.exports={check:e=>h.cache(e,()=>l(e)).then(p),track:p}},1727:(e,t,r)=>{"use strict";let i=r(3186),o=r(2965),{getManagedCacheStorage:s}=r(6718),a=e=>o("GET","https://music-api.gdstudio.xyz/api.php?types=url&source=netease&id="+e.id+"&br="+["999","320"].slice(i.ENABLE_FLAC?0:1,i.ENABLE_FLAC?1:2)).then(e=>e.json()).then(e=>e&&"object"==typeof e&&!1 in e?Promise.reject():e.br>0?e.url:Promise.reject()),u=s("provider/pyncmd");e.exports={check:e=>u.cache(e,()=>a(e))}},1128:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://y.qq.com/",referer:"http://y.qq.com/",cookie:process.env.QQ_COOKIE||null},c=e=>({id:{song:e.mid,file:e.mid},name:e.name,duration:1e3*e.interval,album:{id:e.album.mid,name:e.album.name},artists:e.singer.map(({mid:e,name:t})=>({id:e,name:t}))}),l=e=>s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({search:{method:"DoSearchForQQMusicDesktop",module:"music.search.SearchCgiService",param:{num_per_page:5,page_num:1,query:e.keyword,search_type:0}}})),u).then(e=>e.json()).then(t=>{let r=o(t.search.data.body.song.list.map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r=((u.cookie||"").match(/uin=(\d+)/)||[])[1]||"0";return s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({req_0:{module:"vkey.GetVkeyServer",method:"CgiGetVkey",param:{guid:(1e7*Math.random()).toFixed(0),loginflag:1,filename:t[0]?[t.join(e.file)]:null,songmid:[e.song],songtype:[0],uin:r,platform:"20"}}})),u).then(e=>e.json()).then(e=>{let{sip:t,midurlinfo:r}=e.req_0.data;if(!r[0].purl)return Promise.reject();let i=t[0]+r[0].purl;return s("GET",i,{range:"bytes=0-8191","accept-encoding":"identity"}).then(e=>e.statusCode<200||e.statusCode>299?Promise.reject():i)})},p=e=>(e.key=e.file,Promise.all([["F000",".flac"],["M800",".mp3"],["M500",".mp3"],[null,null]].slice(u.cookie||"undefined"!=typeof window?o.ENABLE_FLAC?0:1:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().qq.track(e))),h=a("provider/qq");e.exports={check:e=>h.cache(e,()=>l(e)).then(p),track:p}},3186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3639),r(4898),r(153),e.exports=(e,t)=>{let{duration:r}=t;return e.slice(0,5).find(e=>e.duration&&5e3>Math.abs(e.duration-r))||e[0]},e.exports.ENABLE_FLAC="true"===(process.env.ENABLE_FLAC||"").toLowerCase()},5374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),s=r(8696),a=r(6587),{spawnStdout:u}=r(5319),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,p=o("provider/youtube-dl");async function h(e){try{let{stdout:t}=await u("youtube-dl",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new s(r)}catch(e){if(e&&"ENOENT"===e.code)throw new a;throw e}}let d=async e=>{let{id:t}=await h(c(f(e.keyword)));return t},g=async e=>{let{url:t}=await h(c(l(e)));return t},y=i("youtube-dl");e.exports={check:e=>y.cache(e,()=>d(e)).then(g).catch(e=>{throw e&&p.error(e),e}),track:g}},8829:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(4494),r(3639),r(4898);let i=r(2965),{getManagedCacheStorage:o}=r(6718),s=e=>(e||"").split("&").reduce((e,t)=>{let r=t.split("=").map(decodeURIComponent);return Object.assign({},e,{[r[0]]:r[1]})},{}),a=o("provider/youtube"),u=void 0,c=process.env.YOUTUBE_KEY||null,l=(e="-tKVN2mAKRI")=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>{let t=/"WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO":{[^}]+}/.exec(e)[0];return i("GET","https://youtube.com"+(t=JSON.parse(`{${t}}}`).WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO).jsUrl,{},null,u).then(e=>e.body())}).then(e=>{let[,t,r]=/function\((\w+)\)\s*{([^}]+split\(""\)[^}]+join\(""\))};/.exec(e),i=/;(.+?)\..+?\(/.exec(r)[1];return Function([t],RegExp(`var ${i}={[\\s\\S]+?};`).exec(e)[0]+"\n"+r)}),f=e=>i("GET",`https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(e.keyword)}&type=video&key=${c}`,{accept:"application/json"},null,u).then(e=>e.json()).then(e=>{let t=e.items[0];return t?t.id.videoId:Promise.reject()}),p=e=>i("GET",`https://www.youtube.com/results?search_query=${encodeURIComponent(e.keyword)}`,{},null,u).then(e=>e.body()).then(e=>{let t=JSON.parse(e.match(/ytInitialData\s*=\s*([^;]+);/)[1]).contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0].itemSectionRenderer.contents[1];return t?t.videoRenderer.videoId:Promise.reject()}),h=e=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>JSON.parse(e.match(/ytInitialPlayerResponse\s*=\s*{[^]+};\s*var\s*meta/)[0].replace(/;var meta/,"").replace(/ytInitialPlayerResponse = /,"")).streamingData).then(e=>{let t=e.formats.concat(e.adaptiveFormats).find(e=>140===e.itag),r=s(t.signatureCipher);return t.url||(r.sp.includes("sig")?a.cache("YOUTUBE_SIGNATURE",()=>l(),Date.now()+864e5).then(e=>r.url+"&sig="+e(r.s)):r.url)});e.exports={check:e=>a.cache(e,()=>c?f(e):p(e)).then(h),track:h}},9282:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),{spawnStdout:s}=r(5319),a=r(816),u=r(7229),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,p=o("provider/yt-dlp");async function h(e){try{let{stdout:t}=await s("yt-dlp",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new a(r)}catch(e){if(e&&"ENOENT"===e.code)throw new u;throw e}}let d=async e=>{let{id:t}=await h(c(f(e.keyword)));return t},g=async e=>{let{url:t}=await h(c(l(e)));return t},y=i("yt-dlp");e.exports={check:e=>y.cache(e,()=>d(e)).then(g).catch(e=>{throw e&&p.error(e),e}),track:g}},2965:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9635),r(4494);let i=r(3106),o=r(8611),s=r(5692),a=r(2672),u=r(2396),{logScope:c}=r(6166),l=r(7016).parse,f=r(7016).format,p=c("request"),h=e=>(global.hosts||{})[e]||e,d=(e,t)=>("https:"===((void 0===t?global.proxy:t)||e).protocol?s:o).request,g=(e,t,r,i)=>{r=r||{},i=void 0===i?global.proxy:i,"content-length"in r&&delete r["content-length"];let o={};return o._headers=r,i&&"https:"===t.protocol?(o.method="CONNECT",o.headers=Object.keys(r).reduce((e,t)=>Object.assign(e,["host","user-agent"].includes(t)&&{[t]:r[t]}),{})):(o.method=e,o.headers=r),i?(o.hostname=h(i.hostname),o.port=i.port||("https:"===i.protocol?443:80),o.path="https:"===t.protocol?h(t.hostname)+":"+(t.port||443):"http://"+h(t.hostname)+t.path):(o.hostname=h(t.hostname),o.port=t.port||("https:"===t.protocol?443:80),o.path=t.path),o},y=(e,t,r,i,o,c)=>{let h=l(t),w=r||{},_=g(e,h,{host:h.hostname,accept:"application/json, text/plain, */*","accept-encoding":"gzip, deflate","accept-language":"zh-CN,zh;q=0.9","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",...w},o);return new Promise((r,l)=>{var g;p.debug(`Start requesting ${t}`);let y=d(h,o)(_),m=function(){y.destroy(new u(f(h)))};null==c||c.on(a,m),null!==(g=null==c?void 0:c.cancelled)&&void 0!==g&&g&&m(),y.setTimeout(1e4,()=>{p.warn({url:f(h)},"The request timed out, or the requester didn't handle the response."),m()}).on("response",e=>r(e)).on("connect",(t,o)=>{p.debug("received CONNECT, continuing with https.request()..."),s.request({method:e,path:h.path,headers:_._headers,socket:o,agent:!1}).on("response",e=>r(e)).on("error",e=>l(e)).end(i)}).on("error",e=>l(e)).end("CONNECT"===_.method.toUpperCase()?void 0:i)}).then(t=>{var r;if(null!==(r=null==c?void 0:c.cancelled)&&void 0!==r&&r)return Promise.reject(new u(f(h)));if([201,301,302,303,307,308].includes(t.statusCode)){let r=h.resolve(t.headers.location||h.href);return p.debug(`Redirect to ${r}`),delete w.host,y(e,r,w,i,o)}return Object.assign(t,{url:h,body:e=>m(t,e),json:()=>b(t),jsonp:()=>v(t)})})},m=(e,t)=>new Promise((t,r)=>{let i=[];e.on("data",e=>i.push(e)).on("end",()=>t(Buffer.concat(i))).on("error",e=>r(e))}).then(r=>{if(r.length)switch(e.headers["content-encoding"]){case"deflate":case"gzip":r=i.unzipSync(r);break;case"br":r=i.brotliDecompressSync(r)}return t?r:r.toString()}),b=e=>m(e,!1).then(e=>JSON.parse(e)),v=e=>m(e,!1).then(e=>JSON.parse(e.slice(e.indexOf("(")+1,-1)));y.read=m,y.create=d,y.translate=h,y.configure=g,e.exports=y},8885:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153),r(2708),r(5097);let i=r(7515),o=r(9278),s=r(6928),a=r(7016).parse,{logScope:u}=r(6166),c=u("server"),l=r(2428),f=r(6117),p=r(2965),{isHost:h}=r(1084),d={core:{mitm:(e,t)=>{if("/proxy.pac"===e.url){let r=a("http://"+e.headers.host);t.writeHead(200,{"Content-Type":"application/x-ns-proxy-autoconfig"}),t.end(` +${o(r+4)}${t(e[1])}`)};e.length&&console.log("\npositional arguments:"),e.forEach(u),t.length&&console.log("\noptional arguments:"),t.forEach(u),process.exit()},u=()=>{console.log(i._program.version),process.exit()},c=e=>{s(),console.log(i._program.name+":","error:",e),process.exit(1)};e.exports=i},6406:(e,t,r)=>{"use strict";let i={qq:r(1128),kugou:r(2777),kuwo:r(2076),migu:r(8516),joox:r(9222),youtube:r(8829),youtubedl:r(5374),ytdlp:r(9282),bilibili:r(8114),pyncmd:r(1727)};e.exports={DEFAULT_SOURCE:["kugou","kuwo","migu","bilibili","ytdlp"],PROVIDERS:i}},23:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15);let i=r(6982),o=r(7016).parse,s=r(3480).stringify,a="e82ckenh8dichen8",u="rFgB&h#%2?^eDg:Q",c=(e,t)=>{let r=i.createDecipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])},l=(e,t)=>{let r=i.createCipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])};e.exports={eapi:{encrypt:e=>l(e,a),decrypt:e=>c(e,a),encryptRequest:(t,r)=>{t=o(t);let a=JSON.stringify(r),u=`nobody${t.path}use${a}md5forencrypt`,c=i.createHash("md5").update(u).digest("hex"),l=`${t.path}-36cd479b6b5-${a}-36cd479b6b5-${c}`;return{url:t.href.replace(/\w*api/,"eapi"),body:s({params:e.exports.eapi.encrypt(Buffer.from(l)).toString("hex").toUpperCase()})}}},api:{encryptRequest:(e,t)=>({url:(e=o(e)).href.replace(/\w*api/,"api"),body:s(t)})},linuxapi:{encrypt:e=>l(e,u),decrypt:e=>c(e,u),encryptRequest:(t,r)=>{let i=JSON.stringify({method:"POST",url:(t=o(t)).href,params:r});return{url:t.resolve("/api/linux/forward"),body:s({eparams:e.exports.linuxapi.encrypt(Buffer.from(i)).toString("hex").toUpperCase()})}}},miguapi:{encryptBody:e=>{let t=JSON.stringify(e),r=Buffer.from(i.randomBytes(32).toString("hex")),o=i.randomBytes(8),a=((e,t,r,o)=>{t=t||Buffer.alloc(0);let s=r/8,a=Math.ceil((s+8*o)/32),u=Buffer.concat(Array(a).fill(null).reduce(r=>r.concat(i.createHash("md5").update(Buffer.concat([r.slice(-1)[0],e,t])).digest()),[Buffer.alloc(0)]));return{key:u.slice(0,s),iv:u.slice(s,s+o)}})(r,o,256,16),u=i.createCipheriv("aes-256-cbc",a.key,a.iv);return s({data:Buffer.concat([Buffer.from("Salted__"),o,u.update(Buffer.from(t)),u.final()]).toString("base64"),secKey:i.publicEncrypt({key:"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8asrfSaoOb4je+DSmKdriQJKWVJ2oDZrs3wi5W67m3LwTB9QVR+cE3XWU21Nx+YBxS0yun8wDcjgQvYt625ZCcgin2ro/eOkNyUOTBIbuj9CvMnhUYiR61lC1f1IGbrSYYimqBVSjpifVufxtx/I3exReZosTByYp4Xwpb1+WAQIDAQAB\n-----END PUBLIC KEY-----",padding:i.constants.RSA_PKCS1_PADDING},r).toString("base64")})}},base64:{encode:(e,t)=>Buffer.from(e,t).toString("base64").replace(/\+/g,"-").replace(/\//g,"_"),decode:(e,t)=>Buffer.from(e.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString(t)},uri:{retrieve:e=>{e=e.toString().trim();let t="3go8&$8*3*3h0k(2)2",r=Array.from(Array(e.length).keys()).map(r=>String.fromCharCode(e.charCodeAt(r)^t.charCodeAt(r%t.length))).join(""),o=i.createHash("md5").update(r).digest("base64").replace(/\//g,"_").replace(/\+/g,"-");return`http://p1.music.126.net/${o}/${e}`}},md5:{digest:e=>i.createHash("md5").update(e).digest("hex"),pipe:e=>new Promise((t,r)=>{let o=i.createHash("md5").setEncoding("hex");e.pipe(o).on("error",e=>r(e)).once("finish",()=>t(o.read()))})},sha1:{digest:e=>i.createHash("sha1").update(e).digest("hex")},random:{hex:e=>i.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e)}};try{e.exports.kuwoapi=r(9726)}catch(e){}},8729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super(`The audio data is incomplete: ${e}`),this.name="IncompleteAudioData"}}},1828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t){super(`${e} exited with ${t}, which is not zero.`),this.process=e,this.exitCode=t,this.name="ProcessExitNotSuccessfully"}}},2396:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super(`This request URL has been cancelled: ${e}`),this.name="RequestCancelled"}}},7591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t){super(`Failed to get the response. Status code: ${t}`),this.url=e,this.code=t,this.name="RequestFailed"}}},806:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t="?"){super(`This song "${t}" is not available in ${e}`),this.name="SongNotAvailable"}}},8696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of youtube-dl is malformed."),this.name="YoutubeDlInvalidResponse",this.response=e}}},6587:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "youtube-dl" before using the "youtubedl" source.'),this.name="YoutubeDlNotInstalled"}}},816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of yt-dlp is malformed."),this.name="YtDlpInvalidResponse",this.response=e}}},7229:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "yt-dlp" before using the "ytdlp" source.'),this.name="YtDlpNotInstalled"}}},6117:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153),r(530),r(3586),r(3096),r(5872),r(4483),r(5277),r(3136),r(3625),r(8350),r(7737),r(391),r(1414),r(4558),r(695),r(3605),r(1447),r(5609),r(993),r(6676),r(2826),r(6570),r(932),r(580),r(2708),r(5097),r(1363),r(8210),r(4494),r(3351),r(6006),r(7907);let i=r(7016).parse,o=r(23),s=r(2965),a=r(3093),u=r(3480),{isHost:c,cookieToMap:l,mapToCookie:f}=r(1084),{getManagedCacheStorage:p}=r(6718),{logScope:h}=r(6166),d=h("hook"),g=p("hook");g.aliveDuration=6048e5;let y=["true","cvip","svip"].includes((process.env.ENABLE_LOCAL_VIP||"").toLowerCase()),m="true"===(process.env.BLOCK_ADS||"").toLowerCase(),b="true"===(process.env.DISABLE_UPGRADE_CHECK||"").toLowerCase(),v="svip"===(process.env.ENABLE_LOCAL_VIP||"").toLowerCase(),w=(process.env.LOCAL_VIP_UID||"").split(",").map(e=>parseInt(e)).filter(e=>!Number.isNaN(e)),_={request:{before:()=>{},after:()=>{}},connect:{before:()=>{}},negotiate:{before:()=>{}},target:{host:new Set,path:new Set}};_.target.host=new Set(["music.163.com","interface.music.163.com","interface3.music.163.com","apm.music.163.com","apm3.music.163.com","interface.music.163.com.163jiasu.com","interface3.music.163.com.163jiasu.com"]),_.target.path=new Set(["/api/v3/playlist/detail","/api/v3/song/detail","/api/v6/playlist/detail","/api/album/play","/api/artist/privilege","/api/album/privilege","/api/v1/artist","/api/v1/artist/songs","/api/v2/artist/songs","/api/artist/top/song","/api/v1/album","/api/album/v3/detail","/api/playlist/privilege","/api/song/enhance/player/url","/api/song/enhance/player/url/v1","/api/song/enhance/download/url","/api/song/enhance/download/url/v1","/api/song/enhance/privilege","/api/ad","/batch","/api/batch","/api/listen/together/privilege/get","/api/v1/search/get","/api/v1/search/song/get","/api/search/complex/get","/api/search/complex/page","/api/search/song/page","/api/cloudsearch/pc","/api/v1/playlist/manipulate/tracks","/api/song/like","/api/v1/play/record","/api/playlist/v4/detail","/api/v1/radio/get","/api/v1/discovery/recommend/songs","/api/usertool/sound/mobile/promote","/api/usertool/sound/mobile/theme","/api/usertool/sound/mobile/animationList","/api/usertool/sound/mobile/all","/api/usertool/sound/mobile/detail","/api/vipauth/app/auth/query","/api/music-vip-membership/client/vip/info"]);let S=["music.163.com","music.126.net","iplay.163.com","look.163.com","y.163.com","interface.music.163.com","interface3.music.163.com"];_.request.before=e=>{let{req:t}=e;t.url=(t.url.startsWith("http://")?"":(t.socket.encrypted?"https:":"http:")+"//"+(S.some(e=>(t.headers.host||"").includes(e))?t.headers.host:null))+t.url;let r=i(t.url);if([r.hostname,t.headers.host].some(e=>c(e,"music.163.com"))&&(e.decision="proxy"),process.env.NETEASE_COOKIE&&r.path.includes("url")){var a=l(t.headers.cookie);Object.entries(l(process.env.NETEASE_COOKIE)).forEach(([e,t])=>{a[e]=t}),t.headers.cookie=f(a),d.debug("Replace netease cookie")}if([r.hostname,t.headers.host].some(e=>_.target.host.has(e))&&"POST"===t.method&&(r.path.startsWith("/eapi/")||r.path.startsWith("/api/")))return s.read(t).then(e=>t.body=e).then(s=>{if("x-napm-retry"in t.headers&&delete t.headers["x-napm-retry"],t.headers["X-Real-IP"]="118.88.88.88",!(t.url.includes("stream")||t.url.includes("/eapi/cloud/upload/check"))&&(t.headers["Accept-Encoding"]="gzip, deflate",s)){let t;let a={};switch(a.pad=(s.match(/%0+$/)||[""])[0],"/api/linux/forward"===r.path?a.crypto="linuxapi":r.path.startsWith("/eapi/")?a.crypto="eapi":r.path.startsWith("/api/")&&(a.crypto="api"),a.crypto){case"linuxapi":t=JSON.parse(o.linuxapi.decrypt(Buffer.from(s.slice(8,s.length-a.pad.length),"hex")).toString()),a.path=i(t.url).path,a.param=t.params;break;case"eapi":t=o.eapi.decrypt(Buffer.from(s.slice(7,s.length-a.pad.length),"hex")).toString().split("-36cd479b6b5-"),a.path=t[0],a.param=JSON.parse(t[1]),a.param.hasOwnProperty("e_r")&&("true"==a.param.e_r||!0==a.param.e_r)?a.e_r=!0:a.e_r=!1;break;case"api":t={},decodeURIComponent(s).split("&").forEach(e=>{let[r,i]=e.split("=");t[r]=i}),a.path=r.path,a.param=t}if(a.path=a.path.replace(/\/\d*$/,""),e.netease=a,"/api/song/enhance/download/url"===a.path)return x(e);if("/api/song/enhance/download/url/v1"===a.path)return E(e);m&&a.path.startsWith("/api/ad")&&(e.error=Error("ADs blocked."),e.decision="close"),b&&a.path.match(/^\/api(\/v1)?\/(android|ios|osx|pc)\/(upgrade|version)/)&&(e.error=Error("Upgrade check blocked."),e.decision="close")}}).catch(e=>e&&d.error(e,`A error occurred in hook.request.before when hooking ${t.url}.`));if(_.target.host.has(r.hostname)&&(r.path.startsWith("/weapi/")||r.path.startsWith("/api/")))t.headers["X-Real-IP"]="118.88.88.88",e.netease={web:!0,path:r.path.replace(/^\/weapi\//,"/api/").split("?").shift().replace(/\/\d*$/,"")};else if(t.url.includes("package"))try{let r=t.url.split("package/").pop().split("/"),s=i(o.base64.decode(r[0])),a=r[1].replace(/\.\w+/,"");t.url=s.href,t.headers.host=s.hostname,t.headers.cookie=null,e.package={id:a},e.decision="proxy"}catch(t){e.error=t,e.decision="close"}},_.request.after=e=>{let{req:t,proxyRes:r,netease:a,package:u}=e;if("tyst.migu.cn"===t.headers.host&&r.headers["content-range"]&&200===r.statusCode&&(r.statusCode=206),a&&_.target.path.has(a.path)&&200===r.statusCode)return s.read(r,!0).then(e=>e.length?r.body=e:Promise.reject()).then(t=>{let r=e=>e.replace(/([^\\]"\s*:\s*)(\d{16,})(\s*[}|,])/g,'$1"$2L"$3');if(a.e_r?a.jsonBody=JSON.parse(r(o.eapi.decrypt(t).toString())):a.jsonBody=JSON.parse(r(t.toString())),y){let e="/api/music-vip-membership/client/vip/info";if("/batch"===a.path||"/api/batch"===a.path||a.path===e){let t=a.path===e?a.jsonBody:a.jsonBody[e],r={iconUrl:null,dynamicIconUrl:null,isSign:!1,isSignIap:!1,isSignDeduct:!1,isSignIapDeduct:!1};if(t&&(0===w.length||w.includes(t.data.userId)))try{let i=(t.data.now||new Date().getTime())+316224e5;t.data.redVipLevel=7,t.data.redVipAnnualCount=1,t.data.musicPackage={...r,...t.data.musicPackage,vipCode:230,vipLevel:7,expireTime:i},t.data.associator={...r,...t.data.associator,vipCode:100,vipLevel:7,expireTime:i},v&&(t.data.redplus={...r,...t.data.redplus,vipCode:300,vipLevel:7,expireTime:i},t.data.albumVip={...r,...t.data.albumVip,vipCode:400,vipLevel:0,expireTime:i}),a.path===e?a.jsonBody=t:a.jsonBody[e]=t}catch(e){d.debug({err:e},"Unable to apply the local VIP.")}}}if(new Set([401,512]).has(a.jsonBody.code)&&!a.web){if(a.path.includes("manipulate"))return O(e);if("/api/song/like"===a.path)return k(e)}else if(a.path.includes("url"))return T(e);else if(a.path.includes("/usertool/sound/"))return R(a.jsonBody);else if(a.path.includes("batch"))for(let e in a.jsonBody)e.includes("/usertool/sound/")&&R(a.jsonBody[e]);else if(a.path.includes("/vipauth/app/auth/query"))return P(a.jsonBody)}).then(()=>{["transfer-encoding","content-encoding","content-length"].filter(e=>e in r.headers).forEach(e=>delete r.headers[e]);let e=JSON.stringify(a.jsonBody,(e,t)=>("object"==typeof t&&null!=t&&("cp"in t&&(t.cp=1),"fee"in t&&(t.fee=0),"downloadMaxbr"in t&&0===t.downloadMaxbr&&(t.downloadMaxbr=32e4),"dl"in t&&"downloadMaxbr"in t&&t.dle&&d.error(e,`A error occurred in hook.request.after when hooking ${t.url}.`));if(u){if(new Set([201,301,302,303,307,308]).has(r.statusCode))return s(t.method,i(t.url).resolve(r.headers.location),t.headers).then(t=>e.proxyRes=t);/p\d+c*\.music\.126\.net/.test(t.url)&&(r.headers["content-type"]="audio/*")}},_.connect.before=e=>{let{req:t}=e,r=i("https://"+t.url);[r.hostname,t.headers.host].some(e=>_.target.host.has(e))?80===parseInt(r.port)?(t.url=`${global.address||"localhost"}:${global.port[0]}`,t.local=!0):global.port[1]?(t.url=`${global.address||"localhost"}:${global.port[1]}`,t.local=!0):e.decision="blank":r.href.includes(global.endpoint)&&(e.decision="proxy")},_.negotiate.before=e=>{let{req:t,socket:r,decision:o}=e,s=i("https://"+t.url),a=_.target.host;!t.local&&!o&&a.has(r.sni)&&!a.has(s.hostname)&&(a.add(s.hostname),e.decision="blank")};let x=e=>{let t;let{req:r,netease:i}=e,s="http://music.163.com/api/song/enhance/player/url",{id:a,br:u,e_r:c,header:l}=i.param;switch(i.crypto){case"linuxapi":i.param={ids:`["${a}"]`,br:u},t=o.linuxapi.encryptRequest(s,i.param);break;case"eapi":case"api":i.param={ids:`["${a}"]`,br:u,e_r:c,header:l},"eapi"==i.crypto?t=o.eapi.encryptRequest(s,i.param):"api"==i.crypto&&(t=o.api.encryptRequest(s,i.param))}r.url=t.url,r.body=t.body+i.pad},E=e=>{let t;let{req:r,netease:i}=e,s="http://music.163.com/api/song/enhance/player/url/v1",{id:a,level:u,immerseType:c,e_r:l,header:f}=i.param;switch(i.crypto){case"linuxapi":i.param={ids:`["${a}"]`,level:u,encodeType:"flac",immerseType:c},t=o.linuxapi.encryptRequest(s,i.param);break;case"eapi":case"api":i.param={ids:`["${a}"]`,level:u,encodeType:"flac",immerseType:c,e_r:l,header:f},"eapi"==i.crypto?t=o.eapi.encryptRequest(s,i.param):"api"==i.crypto&&(t=o.api.encryptRequest(s,i.param))}r.url=t.url,r.body=t.body+i.pad},O=e=>{let{req:t,netease:r}=e,{trackIds:i,pid:o,op:a}=r.param,u=(Array.isArray(i)?i:JSON.parse(i))[0];return s("POST","http://music.163.com/api/playlist/manipulate/tracks",t.headers,`trackIds=[${u},${u}]&pid=${o}&op=${a}`).then(e=>e.json()).then(e=>{r.jsonBody=e}).catch(e=>e&&d.error(e))},k=e=>{let{req:t,netease:r}=e,{trackId:i}=r.param,o=0,a=0;return s("GET","http://music.163.com/api/v1/user/info",t.headers).then(e=>e.json()).then(e=>(a=e.userPoint.userId,s("GET",`http://music.163.com/api/user/playlist?uid=${a}&limit=1`,t.headers).then(e=>e.json()))).then(e=>(o=e.playlist[0].id,s("POST","http://music.163.com/api/playlist/manipulate/tracks",t.headers,`trackIds=[${i},${i}]&pid=${o}&op=add`).then(e=>e.json()))).then(e=>{new Set([200,502]).has(e.code)&&(r.jsonBody={code:200,playlistId:o})}).catch(e=>e&&d.error(e))},j=e=>s("GET",e.url).then(e=>o.md5.pipe(e)),T=e=>{let t;let{req:r,netease:i}=e,{jsonBody:s}=i,c=Number(process.env.MIN_BR)||0,l=0,f=e=>{if(e.flag=0,(200!==e.code||e.freeTrialInfo||e.br{let s="";try{let{header:e}=i.param;e="string"==typeof e?JSON.parse(e):e;let t=u.parse(r.headers.cookie.replace(/\s/g,""),";");s=e.os||t.os}catch(e){}return e.type=999e3===t.br?"flac":"mp3","pc"===s||"uwp"===s?e.url=global.endpoint?`${global.endpoint.replace("https://","http://")}/package/${o.base64.encode(t.url)}/${e.id}.${e.type}`:t.url:e.url=global.endpoint?`${global.endpoint}/package/${o.base64.encode(t.url)}/${e.id}.${e.type}`:t.url,e.md5=t.md5||o.md5.digest(t.url),e.br=t.br||128e3,e.size=t.size,e.code=200,e.freeTrialInfo=null,t}).then(t=>{if(!i.path.includes("download")||t.md5)return;let o={android:"0.0.0",osx:"0.0.0"},s={key:t.url.replace(/\?.*$/,"").replace(/(?<=kugou\.com\/)\w+\/\w+\//,"").replace(/(?<=kuwo\.cn\/)\w+\/\w+\/resource\//,""),url:t.url};try{let{header:t}=i.param;t="string"==typeof t?JSON.parse(t):t;let a=u.parse(r.headers.cookie.replace(/\s/g,""),";"),c=t.os||a.os,l=t.appver||a.appver;if(c in o&&((e,t)=>{let r=Array.from([e,t]).map(e=>e.split(".").slice(0,3).map(e=>parseInt(e)||0)).reduce((e,t)=>e.length?e.map((e,r)=>e.concat(t[r])):t.map(e=>[e]),[]).filter(e=>e[0]!==e[1])[0];return!r||r[0]<=r[1]})(o[c],l))return g.cache(s,()=>j(s)).then(t=>e.md5=t)}catch(e){}}).catch(e=>e&&d.error(e));200===e.code&&i.web&&(e.url=e.url.replace(/(m\d+?)(?!c)\.music\.126\.net/,"$1c.music.126.net"))};return Array.isArray(s.data)?i.path.includes("download")?(s.data=s.data[0],t=[f(s.data)]):(l=i.web?0:parseInt(((Array.isArray(i.param.ids)?i.param.ids:JSON.parse(i.param.ids))[0]||0).toString().replace("_0","")),t=s.data.map(e=>f(e))):t=[f(s.data)],Promise.all(t).catch(e=>e&&d.error(e))},R=e=>{d.debug("unblockSoundEffects() has been triggered.");let{data:t,code:r}=e;200===r&&(Array.isArray(t)?t.map(e=>{e.type&&(e.type=1)}):t.type&&(t.type=1))},P=e=>{d.debug("unblockLyricsEffects() has been triggered.");let{data:t,code:r}=e;200===r&&Array.isArray(t)&&t.forEach(e=>{"canUse"in e&&(e.canUse=!0),"canNotUseReasonCode"in e&&(e.canNotUseReasonCode=200)})};e.exports=_},9726:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(1363),r(8210);let i=e=>{let t=BigInt(e);return{low:Number(t),valueOf:()=>t.valueOf(),toString:()=>t.toString(),not:()=>i(~t),isNegative:()=>t<0,or:e=>i(t|BigInt(e)),and:e=>i(t&BigInt(e)),xor:e=>i(t^BigInt(e)),equals:e=>t===BigInt(e),multiply:e=>i(t*BigInt(e)),shiftLeft:e=>i(t<i(t>>BigInt(e))}},o=e=>Array.from(Array(e).keys()),s=(e,t)=>Array(t).fill(null).reduce(t=>t.multiply(e),i(1)),a=(...e)=>e.map(e=>-1===e?i(-1,-1):i(e)),u=a(31,0,1,2,3,4,-1,-1,3,4,5,6,7,8,-1,-1,7,8,9,10,11,12,-1,-1,11,12,13,14,15,16,-1,-1,15,16,17,18,19,20,-1,-1,19,20,21,22,23,24,-1,-1,23,24,25,26,27,28,-1,-1,27,28,29,30,31,30,-1,-1),c=a(57,49,41,33,25,17,9,1,59,51,43,35,27,19,11,3,61,53,45,37,29,21,13,5,63,55,47,39,31,23,15,7,56,48,40,32,24,16,8,0,58,50,42,34,26,18,10,2,60,52,44,36,28,20,12,4,62,54,46,38,30,22,14,6),l=a(39,7,47,15,55,23,63,31,38,6,46,14,54,22,62,30,37,5,45,13,53,21,61,29,36,4,44,12,52,20,60,28,35,3,43,11,51,19,59,27,34,2,42,10,50,18,58,26,33,1,41,9,49,17,57,25,32,0,40,8,48,16,56,24),f=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1],p=a(0,1048577,3145731),h=o(64).map(e=>s(2,e));h[h.length-1]=h[h.length-1].multiply(-1);let d=a(15,6,19,20,28,11,27,16,0,14,22,25,4,17,30,9,1,7,23,13,31,26,2,8,18,12,29,5,21,10,3,24),g=a(56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3),y=a(13,16,10,23,0,4,-1,-1,2,27,14,5,20,9,-1,-1,22,18,11,3,25,7,-1,-1,15,6,26,19,12,1,-1,-1,40,51,30,36,46,54,-1,-1,29,39,50,44,32,47,-1,-1,43,48,38,55,33,52,-1,-1,45,41,49,35,28,31,-1,-1),m=[[14,4,3,15,2,13,5,3,13,14,6,9,11,2,0,5,4,1,10,12,15,6,9,10,1,8,12,7,8,11,7,0,0,15,10,5,14,4,9,10,7,8,12,3,13,1,3,6,15,12,6,11,2,9,5,0,4,2,11,14,1,7,8,13],[15,0,9,5,6,10,12,9,8,7,2,12,3,13,5,2,1,14,7,8,11,4,0,3,14,11,13,6,4,1,10,15,3,13,12,11,15,3,6,0,4,10,1,7,8,4,11,14,13,8,0,6,2,15,9,5,7,1,10,12,14,2,5,9],[10,13,1,11,6,8,11,5,9,4,12,2,15,3,2,14,0,6,13,1,3,15,4,10,14,9,7,12,5,0,8,7,13,1,2,4,3,6,12,11,0,13,5,14,6,8,15,2,7,10,8,15,4,9,11,5,9,0,14,3,10,7,1,12],[7,10,1,15,0,12,11,5,14,9,8,3,9,7,4,8,13,6,2,1,6,11,12,2,3,0,5,14,10,13,15,4,13,3,4,9,6,10,1,12,11,0,2,5,0,13,14,2,8,15,7,4,15,1,10,7,5,6,12,11,3,8,9,14],[2,4,8,15,7,10,13,6,4,1,3,12,11,7,14,0,12,2,5,9,10,13,0,3,1,11,15,5,6,8,9,14,14,11,5,6,4,1,3,10,2,12,15,0,13,2,8,5,11,8,0,15,7,14,9,4,12,7,10,9,1,13,6,3],[12,9,0,7,9,2,14,1,10,15,3,4,6,12,5,11,1,14,13,0,2,8,7,13,15,5,4,10,8,3,11,6,10,4,6,11,7,9,0,6,4,2,13,1,9,15,3,8,15,3,1,14,12,5,11,0,2,12,14,7,5,10,8,13],[4,1,3,10,15,12,5,0,2,11,9,6,8,7,6,9,11,4,12,15,0,3,10,5,14,13,7,8,13,14,1,2,13,6,14,9,4,1,2,14,11,13,5,0,1,10,8,3,0,11,3,5,9,4,15,2,7,8,12,15,10,7,6,12],[13,7,10,0,6,9,5,15,8,4,3,10,11,14,12,5,2,11,9,6,15,12,0,3,4,1,14,13,1,2,7,8,1,2,12,15,10,4,0,3,13,14,6,9,7,8,9,6,15,1,5,12,3,10,14,5,8,7,11,0,4,13,2,11]],b=(e,t,r)=>{let s=i(0);return o(t).forEach(t=>{e[t].isNegative()||r.and(h[e[t].low]).equals(0)||(s=s.or(h[t]))}),s},v=(e,t)=>{let r=o(8).map(()=>i(0)),s=[i(0),i(0)],a=i(0),f=i(0),p=b(c,64,t);return s[0]=p.and(4294967295),s[1]=p.and(-4294967296).shiftRight(32),o(16).forEach(t=>{let c=i(0);f=(f=b(u,64,f=i(s[1]))).xor(e[t]),o(8).forEach(e=>{r[e]=f.shiftRight(8*e).and(255)}),o(8).reverse().forEach(e=>{c=c.shiftLeft(4).or(m[e][r[e]])}),f=b(d,32,c),a=i(s[0]),s[0]=i(s[1]),s[1]=a.xor(f)}),s.reverse(),p=b(l,64,p=s[1].shiftLeft(32).and(-4294967296).or(s[0].and(4294967295)))},w=(e,t,r)=>{let i=b(g,56,e);o(16).forEach(e=>{i=i.and(p[f[e]]).shiftLeft(28-f[e]).or(i.and(p[f[e]].not()).shiftRight(f[e])),t[e]=b(y,64,i)}),1===r&&o(8).forEach(e=>{[t[e],t[15-e]]=[t[15-e],t[e]]})},_=(e,t,r)=>{let s=i(0);o(8).forEach(e=>{s=i(t[e]).shiftLeft(8*e).or(s)});let a=Math.floor(e.length/8),u=o(16).map(()=>i(0));w(s,u,r);let c=o(a).map(()=>i(0));o(a).forEach(t=>{o(8).forEach(r=>{c[t]=i(e[r+8*t]).shiftLeft(8*r).or(c[t])})});let l=o(Math.floor((1+8*(a+1))/8)).map(()=>i(0));o(a).forEach(e=>{l[e]=v(u,c[e])});let f=e.slice(8*a),p=i(0);o(e.length%8).forEach(e=>{p=i(f[e]).shiftLeft(8*e).or(p)}),(f.length||0===r)&&(l[a]=v(u,p));let h=o(8*l.length).map(()=>0),d=0;return l.forEach(e=>{o(8).forEach(t=>{h[d]=e.shiftRight(8*t).and(255).low,d+=1})}),Buffer.from(h)},S=Buffer.from("ylzsxkwm"),x=e=>_(e,S,0);e.exports={encrypt:x,decrypt:e=>_(e,S,1),encryptQuery:e=>x(Buffer.from(e)).toString("base64")}},6166:(e,t,r)=>{"use strict";var i;let o=r(2306),s=process.env.LOG_FILE,a=process.stdout.isTTY,u=o({level:null!==(i=process.env.LOG_LEVEL)&&void 0!==i?i:"info",prettyPrint:"true"!==process.env.JSON_LOG&&{colorize:a,messageFormat:a?"\x1b[1m\x1b[32m({scope})\x1b[0m\x1b[36m {msg}":"({scope}) {msg}",ignore:"time,pid,hostname,scope",errorProps:"*"}},s&&o.destination(s));e.exports={logger:u,logScope:function(e){return u.child({scope:e})}}},8114:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15);let{cacheStorage:i,CacheStorageGroup:o,getManagedCacheStorage:s}=r(6718),a=r(9588),u=r(3186),c=r(2965),l=e=>({id:e.id,name:e.title,artists:{id:e.mid,name:e.author}}),f=e=>c("GET",`https://api.bilibili.com/audio/music-service-c/s?search_type=music&page=1&pagesize=30&keyword=${encodeURIComponent(e.keyword)}`).then(e=>e.json()).then(t=>{let r=u(t.data.result.map(l),e);return r?r.id:Promise.reject()}),p=e=>c("GET","https://www.bilibili.com/audio/music-service-c/web/url?rivilege=2&quality=2&sid="+e).then(e=>e.json()).then(e=>0===e.code?e.data.cdns[0].replace("https","http"):Promise.reject()).catch(()=>a().bilibili.track(e)),h=s("provider/bilibili");e.exports={check:e=>h.cache(e,()=>f(e)).then(p),track:p}},9041:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(2708),r(5097),r(9635),r(9320),r(15);let i=r(2965),{getManagedCacheStorage:o}=r(6718),s=(e,t)=>Object.keys(e).reduce((r,i)=>Object.assign(r,t.includes(i)&&{[i]:e[i]}),{}),a=e=>{let t=[e[0]],r=()=>t.reduce((e,t)=>e+t.length,0);return e.slice(1).some(e=>r()>15||(t.push(e),!1)),t},u=e=>{try{let r=s(e,["id","name","alias","duration"]);if(r.name=(r.name||"").replace(/(\s*cover[::\s][^)]+)/i,"").replace(/\(\s*cover[::\s][^)]+\)/i,"").replace(/(\s*翻自[::\s][^)]+)/,"").replace(/\(\s*翻自[::\s][^)]+\)/,""),r.album=s(e.album,["id","name"]),r.artists=e.artists.map(e=>s(e,["id","name"])),r.keyword=r.name+" - "+a(r.artists.map(e=>e.name)).join(" / "),"true"===process.env.SEARCH_ALBUM){var t;let e=null===(t=r.album)||void 0===t?void 0:t.name;e&&e!==r.name&&(r.keyword+=` ${e}`)}return r}catch(e){return console.log("getFormatData err: ",e),{}}},c=(e,t)=>{if(!t)return i("GET","https://music.163.com/api/song/detail?ids=["+e+"]").then(e=>e.json()).then(e=>{if(e&&e.songs&&e.songs.length){let t=u(e.songs[0]);return t.name?t:Promise.reject()}return Promise.reject()});{let e=u(t);return e.name?Promise.resolve(e):Promise.reject()}},l=o("provider/find");e.exports=(e,t)=>t?c(e,t):l.cache(e,()=>c(e))},9588:(e,t,r)=>{"use strict";let i=r(2965);e.exports=()=>{let t=global.cnrelay,r=new Proxy(()=>{},{get:(e,t)=>(e.route=(e.route||[]).concat(t),r),apply:(r,o,s)=>{if(e.exports.disable||!t)return Promise.reject();let a=r.route.join("/"),u="object"==typeof s[0]?JSON.stringify(s[0]):s[0];return i("GET",`${t}/${a}?${encodeURIComponent(u)}`).then(e=>e.body())}});return r}},9222:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(4494);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c={origin:"http://www.joox.com",referer:"http://www.joox.com",cookie:process.env.JOOX_COOKIE||null},l=e=>/[\u0800-\u4e00]/.test(e.name)?e.name:e.keyword,f=e=>{let{decode:t}=s.base64;return{id:e.songid,name:t(e.info1||""),duration:1e3*e.playtime,album:{id:e.albummid,name:t(e.info3||"")},artists:e.singer_list.map(({id:e,name:r})=>({id:e,name:t(r||"")}))}},p=e=>a("GET","http://api-jooxtt.sanook.com/web-fcgi-bin/web_search?country=hk&lang=zh_TW&search_input="+encodeURIComponent(l(e))+"&sin=0&ein=30",c).then(e=>e.body()).then(t=>{let r=o(JSON.parse(t.replace(/'/g,'"')).itemlist.map(f),e);return r?r.id:Promise.reject()}),h=e=>a("GET","http://api.joox.com/web-fcgi-bin/web_get_songinfo?songid="+e+"&country=hk&lang=zh_cn&from_type=-1&channel_id=-1&_="+new Date().getTime(),c).then(e=>e.jsonp()).then(e=>(e.r320Url||e.r192Url||e.mp3Url||e.m4aUrl).replace(/M\d00([\w]+).mp3/,"M800$1.mp3")||Promise.reject()).catch(()=>i().joox.track(e)),d=u("provider/joox");e.exports={check:e=>d.cache(e,()=>p(e)).then(h),track:h}},2777:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.hash,id_hq:e["320hash"],id_sq:e.sqhash,name:e.songname,duration:1e3*e.duration,album:{id:e.album_id,name:e.album_name}}),l=e=>a("GET","http://mobilecdn.kugou.com/api/v3/search/song?keyword="+encodeURIComponent(e.keyword)+"&page=1&pagesize=10").then(e=>e.json()).then(t=>o(t.data.info.map(c),e)||Promise.reject()).catch(()=>i().kugou.search(e)),f=(e,t)=>{let r=()=>{switch(t){case"hash":return e.id;case"hqhash":return e.id_hq;case"sqhash":return e.id_sq}return""};return a("GET","http://trackercdn.kugou.com/i/v2/?key="+s.md5.digest(`${r()}kgcloudv2`)+"&hash="+r()+"&appid=1005&pid=2&cmd=25&behavior=play&album_id="+e.album.id).then(e=>e.json()).then(e=>e.url[0]||Promise.reject())},p=e=>Promise.all(["sqhash","hqhash","hash"].slice(o.ENABLE_FLAC?0:1).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().kugou.track(e)),h=u("provider/kugou");e.exports={check:e=>h.cache(e,()=>l(e)).then(p),search:l}},2076:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.MUSICRID.split("_").pop(),name:e.SONGNAME,duration:1e3*e.DURATION,album:{id:e.ALBUMID,name:e.ALBUM},artists:e.ARTIST.split("&").map((t,r)=>({id:r?null:e.ARTISTID,name:t}))}),l=e=>a("GET","http://search.kuwo.cn/r.s?&correct=1&stype=comprehensive&encoding=utf8&rformat=json&mobi=1&show_copyright_off=1&searchapi=6&all="+encodeURIComponent(e.keyword.replace(" - "," "))).then(e=>e.json()).then(t=>{if(!t||t.content.length<2||!t.content[1].musicpage||t.content[1].musicpage.abslist.length<1)return Promise.reject();let r=o(t.content[1].musicpage.abslist.filter(e=>"0"===e.tpay).map(c),e);return r?r.id:Promise.reject()}),f=e=>a("GET",s.kuwoapi?"http://mobi.kuwo.cn/mobi.s?f=kuwo&q="+s.kuwoapi.encryptQuery("corp=kuwo&source=kwplayer_ar_4.9.2.7_B_nuoweida_vh.apk&p2p=1&type=convert_url2&sig=0&format="+["flac","mp3"].slice(o.ENABLE_FLAC?0:1)[0]+"&rid="+e):"http://antiserver.kuwo.cn/anti.s?type=convert_url&format=mp3&response=url&rid=MUSIC_"+e,{"user-agent":"okhttp/3.10.0"}).then(e=>e.body()).then(e=>(e.match(/http[^\s$"]+/)||[])[0]||Promise.reject()).catch(()=>i().kuwo.track(e)),p=u("provider/kuwo");e.exports={check:e=>p.cache(e,()=>l(e)).then(f),track:f}},3093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(952),r(1200),r(9778),r(3307),r(310),r(4980),r(4504),r(4038),r(8208),r(7274),r(1469),r(3039),r(845),r(200),r(7022),r(9551),r(153),r(6199),r(9320),r(15),r(6006),r(7907),r(1673),r(6060),r(1363),r(8210);let i=r(9041),o=r(2965),{PROVIDERS:s,DEFAULT_SOURCE:a}=r(6406),{isHostWrapper:u}=r(1084),c=r(806),l=r(7591),f=r(8729),{logScope:p}=r(6166),h=r(2396),d=p("provider/match"),g=e=>e>=200&&e<=299,y=new Map([["bilivideo.com","https://www.bilibili.com/"]]);async function m(e,t){d.debug({source:e,info:t},"Getting the audio...");let r=await s[e].check(t);if(!r)throw new c(e);let i=await v(r);if(d.debug(i,"The matched song is:"),!i||"string"!=typeof i.url)throw new f("song is undefined, or song.url is not a string.");return d.debug({source:e,info:t},"The audio matched!"),{...i,source:e}}async function b(e,t,r){let o=(t||global.source||a).filter(e=>e in s),u=await i(e,r),l=null;if(process.env.SELECT_MAX_BR){let e=await Promise.allSettled(o.map(async e=>m(e,u).catch(e=>{throw e&&(e instanceof h?d.debug(e):d.error(e)),e})));if(0===(e=e.filter(e=>"fulfilled"===e.status)).length)throw new c("any source");l=(e=e.map(e=>e.value)).reduce((e,t)=>e.br>=t.br?e:t)}else if(process.env.FOLLOW_SOURCE_ORDER){for(let e=0;em(e,u).catch(e=>{throw e&&(e instanceof h?d.debug(e):d.error(e)),e})));let{id:f,name:p}=u,{url:g}=l;return d.debug({audioInfo:u,audioData:l},"The data to replace:"),d.info({audioId:f,songName:p,url:g},`Replaced: [${f}] ${p}`),l}async function v(e){let t=u(e),r={size:0,br:null,url:null,md5:null},i={range:"bytes=0-8191","accept-encoding":"identity"};y.forEach((e,r)=>{t(r)&&(i.referer=e)});let s=await o("GET",e,i),{headers:a}=s;if(!g(s.statusCode))throw new l(e,s.statusCode);r.url=s.url.href;let c=await s.body(!0);try{let e=function(e){let t={3:{3:["free",32,64,96,128,160,192,224,256,288,320,352,384,416,448,"bad"],2:["free",32,48,56,64,80,96,112,128,160,192,224,256,320,384,"bad"],1:["free",32,40,48,56,64,80,96,112,128,160,192,224,256,320,"bad"]},2:{3:["free",32,48,56,64,80,96,112,128,144,160,176,192,224,256,"bad"],2:["free",8,16,24,32,40,48,56,64,80,96,112,128,144,160,"bad"]}};t[2][1]=t[2][2],t[0]=t[2];let r=0;if("fLaC"===e.slice(0,4).toString())return 999;"ID3"===e.slice(0,3).toString()&&(r=6,r=10+e.slice(r,r+4).reduce((e,t,r)=>e+(127&t)<<7*(3-r),0));let i=e.slice(r,r+4);if(4===i.length&&255===i[0]&&(i[1]>>5&7)==7&&(i[1]>>1&3)!=0&&(i[2]>>4&15)!=15&&(i[2]>>2&3)!=3){let e=i[1]>>3&3,r=i[1]>>1&3,o=i[2]>>4;return t[e][r][o]}}(c);r.br=e&&!isNaN(e)?1e3*e:null}catch(e){d.debug(e,"Failed to decode and extract the bitrate")}if(!r.br){if(t("qq.com")&&r.url.includes(".m4a")&&(r.br=96e3),t("bilivideo.com")&&r.url.includes(".m4a")){let e=parseInt(r.url.match(/-(\d+)k\.m4a/));isNaN(e)?e=192e3:e<96||e>999?e=192e3:e*=1e3,r.br=e}t("googlevideo.com")&&(r.br=128e3)}return a&&(t("126.net")&&(r.md5=r.url.split("/").slice(-1)[0].replace(/\..*/g,"")),t("qq.com")&&(r.md5=a["server-md5"]),r.size=parseInt((a["content-range"]||"").split("/").pop()||a["content-length"])||0,"8192"!==a["content-length"])?Promise.reject():r}e.exports=b},8516:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://music.migu.cn/",referer:"http://m.music.migu.cn/v3/",aversionid:process.env.MIGU_COOKIE||null,channel:"0146921"},c=e=>{let t=e.singerId.split(/\s*,\s*/),r=e.singerName.split(/\s*,\s*/);return{id:e.id,name:e.title,album:{id:e.albumId,name:e.albumName},artists:t.map((e,t)=>({id:e,name:r[t]}))}},l=e=>s("GET","https://m.music.migu.cn/migu/remoting/scr_search_tag?keyword="+encodeURIComponent(e.keyword)+"&type=2&rows=20&pgc=1",u).then(e=>e.json()).then(t=>{let r=o(((t||{}).musics||[]).map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r="https://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4?netType=01&resourceType=2&songId="+e.toString()+"&toneFlag="+t;return s("GET",r,u).then(e=>e.json()).then(e=>{let{audioFormatType:i}=e.data;return i!==t?Promise.reject():r?e.data.url:Promise.reject()})},p=e=>Promise.all(["ZQ24","SQ","HQ","PQ"].slice(o.ENABLE_FLAC?0:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().migu.track(e)),h=a("provider/migu");e.exports={check:e=>h.cache(e,()=>l(e)).then(p),track:p}},1727:(e,t,r)=>{"use strict";let i=r(3186),o=r(2965),{getManagedCacheStorage:s}=r(6718),a=e=>o("GET","https://music-api.gdstudio.xyz/api.php?types=url&source=netease&id="+e.id+"&br="+["999","320"].slice(i.ENABLE_FLAC?0:1,i.ENABLE_FLAC?1:2)).then(e=>e.json()).then(e=>e&&"object"==typeof e&&!1 in e?Promise.reject():e.br>0?e.url:Promise.reject()),u=s("provider/pyncmd");e.exports={check:e=>u.cache(e,()=>a(e))}},1128:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://y.qq.com/",referer:"http://y.qq.com/",cookie:process.env.QQ_COOKIE||null},c=e=>({id:{song:e.mid,file:e.mid},name:e.name,duration:1e3*e.interval,album:{id:e.album.mid,name:e.album.name},artists:e.singer.map(({mid:e,name:t})=>({id:e,name:t}))}),l=e=>s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({search:{method:"DoSearchForQQMusicDesktop",module:"music.search.SearchCgiService",param:{num_per_page:5,page_num:1,query:e.keyword,search_type:0}}})),u).then(e=>e.json()).then(t=>{let r=o(t.search.data.body.song.list.map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r=((u.cookie||"").match(/uin=(\d+)/)||[])[1]||"0";return s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({req_0:{module:"vkey.GetVkeyServer",method:"CgiGetVkey",param:{guid:(1e7*Math.random()).toFixed(0),loginflag:1,filename:t[0]?[t.join(e.file)]:null,songmid:[e.song],songtype:[0],uin:r,platform:"20"}}})),u).then(e=>e.json()).then(e=>{let{sip:t,midurlinfo:r}=e.req_0.data;if(!r[0].purl)return Promise.reject();let i=t[0]+r[0].purl;return s("GET",i,{range:"bytes=0-8191","accept-encoding":"identity"}).then(e=>e.statusCode<200||e.statusCode>299?Promise.reject():i)})},p=e=>(e.key=e.file,Promise.all([["F000",".flac"],["M800",".mp3"],["M500",".mp3"],[null,null]].slice(u.cookie||"undefined"!=typeof window?o.ENABLE_FLAC?0:1:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().qq.track(e))),h=a("provider/qq");e.exports={check:e=>h.cache(e,()=>l(e)).then(p),track:p}},3186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3639),r(4898),r(153),e.exports=(e,t)=>{let{duration:r}=t;return e.slice(0,5).find(e=>e.duration&&5e3>Math.abs(e.duration-r))||e[0]},e.exports.ENABLE_FLAC="true"===(process.env.ENABLE_FLAC||"").toLowerCase()},5374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),s=r(8696),a=r(6587),{spawnStdout:u}=r(5319),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,p=o("provider/youtube-dl");async function h(e){try{let{stdout:t}=await u("youtube-dl",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new s(r)}catch(e){if(e&&"ENOENT"===e.code)throw new a;throw e}}let d=async e=>{let{id:t}=await h(c(f(e.keyword)));return t},g=async e=>{let{url:t}=await h(c(l(e)));return t},y=i("youtube-dl");e.exports={check:e=>y.cache(e,()=>d(e)).then(g).catch(e=>{throw e&&p.error(e),e}),track:g}},8829:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(4494),r(3639),r(4898);let i=r(2965),{getManagedCacheStorage:o}=r(6718),s=e=>(e||"").split("&").reduce((e,t)=>{let r=t.split("=").map(decodeURIComponent);return Object.assign({},e,{[r[0]]:r[1]})},{}),a=o("provider/youtube"),u=void 0,c=process.env.YOUTUBE_KEY||null,l=(e="-tKVN2mAKRI")=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>{let t=/"WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO":{[^}]+}/.exec(e)[0];return i("GET","https://youtube.com"+(t=JSON.parse(`{${t}}}`).WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO).jsUrl,{},null,u).then(e=>e.body())}).then(e=>{let[,t,r]=/function\((\w+)\)\s*{([^}]+split\(""\)[^}]+join\(""\))};/.exec(e),i=/;(.+?)\..+?\(/.exec(r)[1];return Function([t],RegExp(`var ${i}={[\\s\\S]+?};`).exec(e)[0]+"\n"+r)}),f=e=>i("GET",`https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(e.keyword)}&type=video&key=${c}`,{accept:"application/json"},null,u).then(e=>e.json()).then(e=>{let t=e.items[0];return t?t.id.videoId:Promise.reject()}),p=e=>i("GET",`https://www.youtube.com/results?search_query=${encodeURIComponent(e.keyword)}`,{},null,u).then(e=>e.body()).then(e=>{let t=JSON.parse(e.match(/ytInitialData\s*=\s*([^;]+);/)[1]).contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0].itemSectionRenderer.contents[1];return t?t.videoRenderer.videoId:Promise.reject()}),h=e=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>JSON.parse(e.match(/ytInitialPlayerResponse\s*=\s*{[^]+};\s*var\s*meta/)[0].replace(/;var meta/,"").replace(/ytInitialPlayerResponse = /,"")).streamingData).then(e=>{let t=e.formats.concat(e.adaptiveFormats).find(e=>140===e.itag),r=s(t.signatureCipher);return t.url||(r.sp.includes("sig")?a.cache("YOUTUBE_SIGNATURE",()=>l(),Date.now()+864e5).then(e=>r.url+"&sig="+e(r.s)):r.url)});e.exports={check:e=>a.cache(e,()=>c?f(e):p(e)).then(h),track:h}},9282:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),{spawnStdout:s}=r(5319),a=r(816),u=r(7229),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,p=o("provider/yt-dlp");async function h(e){try{let{stdout:t}=await s("yt-dlp",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new a(r)}catch(e){if(e&&"ENOENT"===e.code)throw new u;throw e}}let d=async e=>{let{id:t}=await h(c(f(e.keyword)));return t},g=async e=>{let{url:t}=await h(c(l(e)));return t},y=i("yt-dlp");e.exports={check:e=>y.cache(e,()=>d(e)).then(g).catch(e=>{throw e&&p.error(e),e}),track:g}},2965:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9635),r(4494);let i=r(3106),o=r(8611),s=r(5692),a=r(2672),u=r(2396),{logScope:c}=r(6166),l=r(7016).parse,f=r(7016).format,p=c("request"),h=e=>(global.hosts||{})[e]||e,d=(e,t)=>("https:"===((void 0===t?global.proxy:t)||e).protocol?s:o).request,g=(e,t,r,i)=>{r=r||{},i=void 0===i?global.proxy:i,"content-length"in r&&delete r["content-length"];let o={};return o._headers=r,i&&"https:"===t.protocol?(o.method="CONNECT",o.headers=Object.keys(r).reduce((e,t)=>Object.assign(e,["host","user-agent"].includes(t)&&{[t]:r[t]}),{})):(o.method=e,o.headers=r),i?(o.hostname=h(i.hostname),o.port=i.port||("https:"===i.protocol?443:80),o.path="https:"===t.protocol?h(t.hostname)+":"+(t.port||443):"http://"+h(t.hostname)+t.path):(o.hostname=h(t.hostname),o.port=t.port||("https:"===t.protocol?443:80),o.path=t.path),o},y=(e,t,r,i,o,c)=>{let h=l(t),w=r||{},_=g(e,h,{host:h.hostname,accept:"application/json, text/plain, */*","accept-encoding":"gzip, deflate","accept-language":"zh-CN,zh;q=0.9","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",...w},o);return new Promise((r,l)=>{var g;p.debug(`Start requesting ${t}`);let y=d(h,o)(_),m=function(){y.destroy(new u(f(h)))};null==c||c.on(a,m),null!==(g=null==c?void 0:c.cancelled)&&void 0!==g&&g&&m(),y.setTimeout(1e4,()=>{p.warn({url:f(h)},"The request timed out, or the requester didn't handle the response."),m()}).on("response",e=>r(e)).on("connect",(t,o)=>{p.debug("received CONNECT, continuing with https.request()..."),s.request({method:e,path:h.path,headers:_._headers,socket:o,agent:!1}).on("response",e=>r(e)).on("error",e=>l(e)).end(i)}).on("error",e=>l(e)).end("CONNECT"===_.method.toUpperCase()?void 0:i)}).then(t=>{var r;if(null!==(r=null==c?void 0:c.cancelled)&&void 0!==r&&r)return Promise.reject(new u(f(h)));if([201,301,302,303,307,308].includes(t.statusCode)){let r=h.resolve(t.headers.location||h.href);return p.debug(`Redirect to ${r}`),delete w.host,y(e,r,w,i,o)}return Object.assign(t,{url:h,body:e=>m(t,e),json:()=>b(t),jsonp:()=>v(t)})})},m=(e,t)=>new Promise((t,r)=>{let i=[];e.on("data",e=>i.push(e)).on("end",()=>t(Buffer.concat(i))).on("error",e=>r(e))}).then(r=>{if(r.length)switch(e.headers["content-encoding"]){case"deflate":case"gzip":r=i.unzipSync(r);break;case"br":r=i.brotliDecompressSync(r)}return t?r:r.toString()}),b=e=>m(e,!1).then(e=>JSON.parse(e)),v=e=>m(e,!1).then(e=>JSON.parse(e.slice(e.indexOf("(")+1,-1)));y.read=m,y.create=d,y.translate=h,y.configure=g,e.exports=y},8885:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153),r(2708),r(5097);let i=r(7515),o=r(9278),s=r(6928),a=r(7016).parse,{logScope:u}=r(6166),c=u("server"),l=r(2428),f=r(6117),p=r(2965),{isHost:h}=r(1084),d={core:{mitm:(e,t)=>{if("/proxy.pac"===e.url){let r=a("http://"+e.headers.host);t.writeHead(200,{"Content-Type":"application/x-ns-proxy-autoconfig"}),t.end(` function FindProxyForURL(url, host) { if (${Array.from(f.target.host).map(e=>`host == '${e}'`).join(" || ")}) { return 'PROXY ${r.hostname}:${r.port||80}' diff --git a/precompiled/bridge.js b/precompiled/bridge.js index 41e20ae1e7..cf5a3b4358 100644 --- a/precompiled/bridge.js +++ b/precompiled/bridge.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -(()=>{var e={6718:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(952),r(1200),r(9778),r(3307),r(310),r(4980),r(4504),r(4038),r(8208),r(7274),r(1469),r(3039),r(845),r(200),r(1363),r(8210),r(153),r(530),r(3586),r(3096),r(5872),r(4483),r(5277),r(3136),r(3625),r(8350),r(7737),r(391),r(1414),r(4558),r(695),r(3605),r(1447),r(5609),r(993),r(6676),r(2826),r(6570),r(932),r(580);let{EventEmitter:i}=r(4434),{logScope:o}=r(6166),s=o("cache"),a={CLEANUP:"cs@cleanup"};class u extends i{id="Default Cache Storage";cacheMap=new Map;aliveDuration=18e5;constructor(e){super(),e&&(this.id=e),this.on(a.CLEANUP,async()=>this.removeExpiredCache())}get WillExpireAt(){return Date.now()+this.aliveDuration}getLoggerContext(e={}){return{...e,cacheStorageId:this.id}}removeExpiredCache(){s.debug(this.getLoggerContext(),"Cleaning up the expired caches..."),this.cacheMap.forEach((e,t)=>{e.expireAt<=Date.now()&&this.cacheMap.delete(t)})}async cache(e,t,r){if("true"===process.env.NO_CACHE)return t();this.emit(a.CLEANUP);let i=this.cacheMap.get(e),o="object"==typeof e?"Something":e,u=this.getLoggerContext({logKey:o});if(i)return s.debug(u,`${o} hit!`),i.data;s.debug(u,`${o} did not hit. Storing the execution result...`);let c=await t();return this.cacheMap.set(e,{data:c,expireAt:new Date(r||this.WillExpireAt)}),c}}class c{static instance=void 0;cacheStorages=new Set;constructor(){}static getInstance(){return c.instance||(c.instance=new c),c.instance}cleanup(){this.cacheStorages.forEach(e=>e.removeExpiredCache())}}let l=c.getInstance();e.exports={CacheStorage:u,CacheStorageEvents:a,CacheStorageGroup:c,getManagedCacheStorage:function(e){let t=new u(e);return l.cacheStorages.add(t),t}}},2672:(e,t,r)=>{"use strict";let i=r(4434),o="cancel";e.exports={CancelRequest:class extends i{cancelled=!1;cancel(){this.cancelled=!0,this.emit(o)}},ON_CANCEL:o}},6406:(e,t,r)=>{"use strict";let i={qq:r(1128),kugou:r(2777),kuwo:r(2076),migu:r(8516),joox:r(9222),youtube:r(8829),youtubedl:r(5374),ytdlp:r(9282),bilibili:r(8114),pyncmd:r(1727)};e.exports={DEFAULT_SOURCE:["kugou","kuwo","migu","bilibili","ytdlp"],PROVIDERS:i}},23:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15);let i=r(6982),o=r(7016).parse,s=r(3480).stringify,a="e82ckenh8dichen8",u="rFgB&h#%2?^eDg:Q",c=(e,t)=>{let r=i.createDecipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])},l=(e,t)=>{let r=i.createCipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])};e.exports={eapi:{encrypt:e=>l(e,a),decrypt:e=>c(e,a),encryptRequest:(t,r)=>{t=o(t);let a=JSON.stringify(r),u=`nobody${t.path}use${a}md5forencrypt`,c=i.createHash("md5").update(u).digest("hex"),l=`${t.path}-36cd479b6b5-${a}-36cd479b6b5-${c}`;return{url:t.href.replace(/\w*api/,"eapi"),body:s({params:e.exports.eapi.encrypt(Buffer.from(l)).toString("hex").toUpperCase()})}}},api:{encryptRequest:(e,t)=>({url:(e=o(e)).href.replace(/\w*api/,"api"),body:s(t)})},linuxapi:{encrypt:e=>l(e,u),decrypt:e=>c(e,u),encryptRequest:(t,r)=>{let i=JSON.stringify({method:"POST",url:(t=o(t)).href,params:r});return{url:t.resolve("/api/linux/forward"),body:s({eparams:e.exports.linuxapi.encrypt(Buffer.from(i)).toString("hex").toUpperCase()})}}},miguapi:{encryptBody:e=>{let t=JSON.stringify(e),r=Buffer.from(i.randomBytes(32).toString("hex")),o=i.randomBytes(8),a=((e,t,r,o)=>{t=t||Buffer.alloc(0);let s=r/8,a=Math.ceil((s+8*o)/32),u=Buffer.concat(Array(a).fill(null).reduce(r=>r.concat(i.createHash("md5").update(Buffer.concat([r.slice(-1)[0],e,t])).digest()),[Buffer.alloc(0)]));return{key:u.slice(0,s),iv:u.slice(s,s+o)}})(r,o,256,16),u=i.createCipheriv("aes-256-cbc",a.key,a.iv);return s({data:Buffer.concat([Buffer.from("Salted__"),o,u.update(Buffer.from(t)),u.final()]).toString("base64"),secKey:i.publicEncrypt({key:"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8asrfSaoOb4je+DSmKdriQJKWVJ2oDZrs3wi5W67m3LwTB9QVR+cE3XWU21Nx+YBxS0yun8wDcjgQvYt625ZCcgin2ro/eOkNyUOTBIbuj9CvMnhUYiR61lC1f1IGbrSYYimqBVSjpifVufxtx/I3exReZosTByYp4Xwpb1+WAQIDAQAB\n-----END PUBLIC KEY-----",padding:i.constants.RSA_PKCS1_PADDING},r).toString("base64")})}},base64:{encode:(e,t)=>Buffer.from(e,t).toString("base64").replace(/\+/g,"-").replace(/\//g,"_"),decode:(e,t)=>Buffer.from(e.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString(t)},uri:{retrieve:e=>{e=e.toString().trim();let t="3go8&$8*3*3h0k(2)2",r=Array.from(Array(e.length).keys()).map(r=>String.fromCharCode(e.charCodeAt(r)^t.charCodeAt(r%t.length))).join(""),o=i.createHash("md5").update(r).digest("base64").replace(/\//g,"_").replace(/\+/g,"-");return`http://p1.music.126.net/${o}/${e}`}},md5:{digest:e=>i.createHash("md5").update(e).digest("hex"),pipe:e=>new Promise((t,r)=>{let o=i.createHash("md5").setEncoding("hex");e.pipe(o).on("error",e=>r(e)).once("finish",()=>t(o.read()))})},sha1:{digest:e=>i.createHash("sha1").update(e).digest("hex")},random:{hex:e=>i.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e)}};try{e.exports.kuwoapi=r(9726)}catch(e){}},1828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t){super(`${e} exited with ${t}, which is not zero.`),this.process=e,this.exitCode=t,this.name="ProcessExitNotSuccessfully"}}},2396:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super(`This request URL has been cancelled: ${e}`),this.name="RequestCancelled"}}},8696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of youtube-dl is malformed."),this.name="YoutubeDlInvalidResponse",this.response=e}}},6587:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "youtube-dl" before using the "youtubedl" source.'),this.name="YoutubeDlNotInstalled"}}},816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of yt-dlp is malformed."),this.name="YtDlpInvalidResponse",this.response=e}}},7229:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "yt-dlp" before using the "ytdlp" source.'),this.name="YtDlpNotInstalled"}}},9726:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(1363),r(8210);let i=e=>{let t=BigInt(e);return{low:Number(t),valueOf:()=>t.valueOf(),toString:()=>t.toString(),not:()=>i(~t),isNegative:()=>t<0,or:e=>i(t|BigInt(e)),and:e=>i(t&BigInt(e)),xor:e=>i(t^BigInt(e)),equals:e=>t===BigInt(e),multiply:e=>i(t*BigInt(e)),shiftLeft:e=>i(t<i(t>>BigInt(e))}},o=e=>Array.from(Array(e).keys()),s=(e,t)=>Array(t).fill(null).reduce(t=>t.multiply(e),i(1)),a=(...e)=>e.map(e=>-1===e?i(-1,-1):i(e)),u=a(31,0,1,2,3,4,-1,-1,3,4,5,6,7,8,-1,-1,7,8,9,10,11,12,-1,-1,11,12,13,14,15,16,-1,-1,15,16,17,18,19,20,-1,-1,19,20,21,22,23,24,-1,-1,23,24,25,26,27,28,-1,-1,27,28,29,30,31,30,-1,-1),c=a(57,49,41,33,25,17,9,1,59,51,43,35,27,19,11,3,61,53,45,37,29,21,13,5,63,55,47,39,31,23,15,7,56,48,40,32,24,16,8,0,58,50,42,34,26,18,10,2,60,52,44,36,28,20,12,4,62,54,46,38,30,22,14,6),l=a(39,7,47,15,55,23,63,31,38,6,46,14,54,22,62,30,37,5,45,13,53,21,61,29,36,4,44,12,52,20,60,28,35,3,43,11,51,19,59,27,34,2,42,10,50,18,58,26,33,1,41,9,49,17,57,25,32,0,40,8,48,16,56,24),f=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1],h=a(0,1048577,3145731),d=o(64).map(e=>s(2,e));d[d.length-1]=d[d.length-1].multiply(-1);let p=a(15,6,19,20,28,11,27,16,0,14,22,25,4,17,30,9,1,7,23,13,31,26,2,8,18,12,29,5,21,10,3,24),y=a(56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3),g=a(13,16,10,23,0,4,-1,-1,2,27,14,5,20,9,-1,-1,22,18,11,3,25,7,-1,-1,15,6,26,19,12,1,-1,-1,40,51,30,36,46,54,-1,-1,29,39,50,44,32,47,-1,-1,43,48,38,55,33,52,-1,-1,45,41,49,35,28,31,-1,-1),m=[[14,4,3,15,2,13,5,3,13,14,6,9,11,2,0,5,4,1,10,12,15,6,9,10,1,8,12,7,8,11,7,0,0,15,10,5,14,4,9,10,7,8,12,3,13,1,3,6,15,12,6,11,2,9,5,0,4,2,11,14,1,7,8,13],[15,0,9,5,6,10,12,9,8,7,2,12,3,13,5,2,1,14,7,8,11,4,0,3,14,11,13,6,4,1,10,15,3,13,12,11,15,3,6,0,4,10,1,7,8,4,11,14,13,8,0,6,2,15,9,5,7,1,10,12,14,2,5,9],[10,13,1,11,6,8,11,5,9,4,12,2,15,3,2,14,0,6,13,1,3,15,4,10,14,9,7,12,5,0,8,7,13,1,2,4,3,6,12,11,0,13,5,14,6,8,15,2,7,10,8,15,4,9,11,5,9,0,14,3,10,7,1,12],[7,10,1,15,0,12,11,5,14,9,8,3,9,7,4,8,13,6,2,1,6,11,12,2,3,0,5,14,10,13,15,4,13,3,4,9,6,10,1,12,11,0,2,5,0,13,14,2,8,15,7,4,15,1,10,7,5,6,12,11,3,8,9,14],[2,4,8,15,7,10,13,6,4,1,3,12,11,7,14,0,12,2,5,9,10,13,0,3,1,11,15,5,6,8,9,14,14,11,5,6,4,1,3,10,2,12,15,0,13,2,8,5,11,8,0,15,7,14,9,4,12,7,10,9,1,13,6,3],[12,9,0,7,9,2,14,1,10,15,3,4,6,12,5,11,1,14,13,0,2,8,7,13,15,5,4,10,8,3,11,6,10,4,6,11,7,9,0,6,4,2,13,1,9,15,3,8,15,3,1,14,12,5,11,0,2,12,14,7,5,10,8,13],[4,1,3,10,15,12,5,0,2,11,9,6,8,7,6,9,11,4,12,15,0,3,10,5,14,13,7,8,13,14,1,2,13,6,14,9,4,1,2,14,11,13,5,0,1,10,8,3,0,11,3,5,9,4,15,2,7,8,12,15,10,7,6,12],[13,7,10,0,6,9,5,15,8,4,3,10,11,14,12,5,2,11,9,6,15,12,0,3,4,1,14,13,1,2,7,8,1,2,12,15,10,4,0,3,13,14,6,9,7,8,9,6,15,1,5,12,3,10,14,5,8,7,11,0,4,13,2,11]],b=(e,t,r)=>{let s=i(0);return o(t).forEach(t=>{e[t].isNegative()||r.and(d[e[t].low]).equals(0)||(s=s.or(d[t]))}),s},v=(e,t)=>{let r=o(8).map(()=>i(0)),s=[i(0),i(0)],a=i(0),f=i(0),h=b(c,64,t);return s[0]=h.and(4294967295),s[1]=h.and(-4294967296).shiftRight(32),o(16).forEach(t=>{let c=i(0);f=(f=b(u,64,f=i(s[1]))).xor(e[t]),o(8).forEach(e=>{r[e]=f.shiftRight(8*e).and(255)}),o(8).reverse().forEach(e=>{c=c.shiftLeft(4).or(m[e][r[e]])}),f=b(p,32,c),a=i(s[0]),s[0]=i(s[1]),s[1]=a.xor(f)}),s.reverse(),h=b(l,64,h=s[1].shiftLeft(32).and(-4294967296).or(s[0].and(4294967295)))},w=(e,t,r)=>{let i=b(y,56,e);o(16).forEach(e=>{i=i.and(h[f[e]]).shiftLeft(28-f[e]).or(i.and(h[f[e]].not()).shiftRight(f[e])),t[e]=b(g,64,i)}),1===r&&o(8).forEach(e=>{[t[e],t[15-e]]=[t[15-e],t[e]]})},_=(e,t,r)=>{let s=i(0);o(8).forEach(e=>{s=i(t[e]).shiftLeft(8*e).or(s)});let a=Math.floor(e.length/8),u=o(16).map(()=>i(0));w(s,u,r);let c=o(a).map(()=>i(0));o(a).forEach(t=>{o(8).forEach(r=>{c[t]=i(e[r+8*t]).shiftLeft(8*r).or(c[t])})});let l=o(Math.floor((1+8*(a+1))/8)).map(()=>i(0));o(a).forEach(e=>{l[e]=v(u,c[e])});let f=e.slice(8*a),h=i(0);o(e.length%8).forEach(e=>{h=i(f[e]).shiftLeft(8*e).or(h)}),(f.length||0===r)&&(l[a]=v(u,h));let d=o(8*l.length).map(()=>0),p=0;return l.forEach(e=>{o(8).forEach(t=>{d[p]=e.shiftRight(8*t).and(255).low,p+=1})}),Buffer.from(d)},S=Buffer.from("ylzsxkwm"),x=e=>_(e,S,0);e.exports={encrypt:x,decrypt:e=>_(e,S,1),encryptQuery:e=>x(Buffer.from(e)).toString("base64")}},6166:(e,t,r)=>{"use strict";var i;let o=r(2306),s=process.env.LOG_FILE,a=process.stdout.isTTY,u=o({level:null!==(i=process.env.LOG_LEVEL)&&void 0!==i?i:"info",prettyPrint:"true"!==process.env.JSON_LOG&&{colorize:a,messageFormat:a?"\x1b[1m\x1b[32m({scope})\x1b[0m\x1b[36m {msg}":"({scope}) {msg}",ignore:"time,pid,hostname,scope",errorProps:"*"}},s&&o.destination(s));e.exports={logger:u,logScope:function(e){return u.child({scope:e})}}},8114:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15);let{cacheStorage:i,CacheStorageGroup:o,getManagedCacheStorage:s}=r(6718),a=r(9588),u=r(3186),c=r(2965),l=e=>({id:e.id,name:e.title,artists:{id:e.mid,name:e.author}}),f=e=>c("GET",`https://api.bilibili.com/audio/music-service-c/s?search_type=music&page=1&pagesize=30&keyword=${encodeURIComponent(e.keyword)}`).then(e=>e.json()).then(t=>{let r=u(t.data.result.map(l),e);return r?r.id:Promise.reject()}),h=e=>c("GET","https://www.bilibili.com/audio/music-service-c/web/url?rivilege=2&quality=2&sid="+e).then(e=>e.json()).then(e=>0===e.code?e.data.cdns[0].replace("https","http"):Promise.reject()).catch(()=>a().bilibili.track(e)),d=s("provider/bilibili");e.exports={check:e=>d.cache(e,()=>f(e)).then(h),track:h}},9588:(e,t,r)=>{"use strict";let i=r(2965);e.exports=()=>{let t=global.cnrelay,r=new Proxy(()=>{},{get:(e,t)=>(e.route=(e.route||[]).concat(t),r),apply:(r,o,s)=>{if(e.exports.disable||!t)return Promise.reject();let a=r.route.join("/"),u="object"==typeof s[0]?JSON.stringify(s[0]):s[0];return i("GET",`${t}/${a}?${encodeURIComponent(u)}`).then(e=>e.body())}});return r}},9222:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(4494);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c={origin:"http://www.joox.com",referer:"http://www.joox.com",cookie:process.env.JOOX_COOKIE||null},l=e=>/[\u0800-\u4e00]/.test(e.name)?e.name:e.keyword,f=e=>{let{decode:t}=s.base64;return{id:e.songid,name:t(e.info1||""),duration:1e3*e.playtime,album:{id:e.albummid,name:t(e.info3||"")},artists:e.singer_list.map(({id:e,name:r})=>({id:e,name:t(r||"")}))}},h=e=>a("GET","http://api-jooxtt.sanook.com/web-fcgi-bin/web_search?country=hk&lang=zh_TW&search_input="+encodeURIComponent(l(e))+"&sin=0&ein=30",c).then(e=>e.body()).then(t=>{let r=o(JSON.parse(t.replace(/'/g,'"')).itemlist.map(f),e);return r?r.id:Promise.reject()}),d=e=>a("GET","http://api.joox.com/web-fcgi-bin/web_get_songinfo?songid="+e+"&country=hk&lang=zh_cn&from_type=-1&channel_id=-1&_="+new Date().getTime(),c).then(e=>e.jsonp()).then(e=>(e.r320Url||e.r192Url||e.mp3Url||e.m4aUrl).replace(/M\d00([\w]+).mp3/,"M800$1.mp3")||Promise.reject()).catch(()=>i().joox.track(e)),p=u("provider/joox");e.exports={check:e=>p.cache(e,()=>h(e)).then(d),track:d}},2777:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.hash,id_hq:e["320hash"],id_sq:e.sqhash,name:e.songname,duration:1e3*e.duration,album:{id:e.album_id,name:e.album_name}}),l=e=>a("GET","http://mobilecdn.kugou.com/api/v3/search/song?keyword="+encodeURIComponent(e.keyword)+"&page=1&pagesize=10").then(e=>e.json()).then(t=>o(t.data.info.map(c),e)||Promise.reject()).catch(()=>i().kugou.search(e)),f=(e,t)=>{let r=()=>{switch(t){case"hash":return e.id;case"hqhash":return e.id_hq;case"sqhash":return e.id_sq}return""};return a("GET","http://trackercdn.kugou.com/i/v2/?key="+s.md5.digest(`${r()}kgcloudv2`)+"&hash="+r()+"&appid=1005&pid=2&cmd=25&behavior=play&album_id="+e.album.id).then(e=>e.json()).then(e=>e.url[0]||Promise.reject())},h=e=>Promise.all(["sqhash","hqhash","hash"].slice(o.ENABLE_FLAC?0:1).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().kugou.track(e)),d=u("provider/kugou");e.exports={check:e=>d.cache(e,()=>l(e)).then(h),search:l}},2076:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.MUSICRID.split("_").pop(),name:e.SONGNAME,duration:1e3*e.DURATION,album:{id:e.ALBUMID,name:e.ALBUM},artists:e.ARTIST.split("&").map((t,r)=>({id:r?null:e.ARTISTID,name:t}))}),l=e=>a("GET","http://search.kuwo.cn/r.s?&correct=1&stype=comprehensive&encoding=utf8&rformat=json&mobi=1&show_copyright_off=1&searchapi=6&all="+encodeURIComponent(e.keyword.replace(" - "," "))).then(e=>e.json()).then(t=>{if(!t||t.content.length<2||!t.content[1].musicpage||t.content[1].musicpage.abslist.length<1)return Promise.reject();let r=o(t.content[1].musicpage.abslist.filter(e=>"0"===e.tpay).map(c),e);return r?r.id:Promise.reject()}),f=e=>a("GET",s.kuwoapi?"http://mobi.kuwo.cn/mobi.s?f=kuwo&q="+s.kuwoapi.encryptQuery("corp=kuwo&source=kwplayer_ar_1.1.9_oppo_118980_320.apk&p2p=1&type=convert_url2&sig=0&format="+["flac","mp3"].slice(o.ENABLE_FLAC?0:1).join("|")+"&rid="+e):"http://antiserver.kuwo.cn/anti.s?type=convert_url&format=mp3&response=url&rid=MUSIC_"+e,{"user-agent":"okhttp/3.10.0"}).then(e=>e.body()).then(e=>(e.match(/http[^\s$"]+/)||[])[0]||Promise.reject()).catch(()=>i().kuwo.track(e)),h=u("provider/kuwo");e.exports={check:e=>h.cache(e,()=>l(e)).then(f),track:f}},8516:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://music.migu.cn/",referer:"http://m.music.migu.cn/v3/",aversionid:process.env.MIGU_COOKIE||null,channel:"0146921"},c=e=>{let t=e.singerId.split(/\s*,\s*/),r=e.singerName.split(/\s*,\s*/);return{id:e.id,name:e.title,album:{id:e.albumId,name:e.albumName},artists:t.map((e,t)=>({id:e,name:r[t]}))}},l=e=>s("GET","https://m.music.migu.cn/migu/remoting/scr_search_tag?keyword="+encodeURIComponent(e.keyword)+"&type=2&rows=20&pgc=1",u).then(e=>e.json()).then(t=>{let r=o(((t||{}).musics||[]).map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r="https://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4?netType=01&resourceType=2&songId="+e.toString()+"&toneFlag="+t;return s("GET",r,u).then(e=>e.json()).then(e=>{let{audioFormatType:i}=e.data;return i!==t?Promise.reject():r?e.data.url:Promise.reject()})},h=e=>Promise.all(["ZQ24","SQ","HQ","PQ"].slice(o.ENABLE_FLAC?0:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().migu.track(e)),d=a("provider/migu");e.exports={check:e=>d.cache(e,()=>l(e)).then(h),track:h}},1727:(e,t,r)=>{"use strict";let i=r(3186),o=r(2965),{getManagedCacheStorage:s}=r(6718),a=e=>o("GET","https://music-api.gdstudio.xyz/api.php?types=url&source=netease&id="+e.id+"&br="+["999","320"].slice(i.ENABLE_FLAC?0:1,i.ENABLE_FLAC?1:2)).then(e=>e.json()).then(e=>e&&"object"==typeof e&&!1 in e?Promise.reject():e.br>0?e.url:Promise.reject()),u=s("provider/pyncmd");e.exports={check:e=>u.cache(e,()=>a(e))}},1128:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://y.qq.com/",referer:"http://y.qq.com/",cookie:process.env.QQ_COOKIE||null},c=e=>({id:{song:e.mid,file:e.mid},name:e.name,duration:1e3*e.interval,album:{id:e.album.mid,name:e.album.name},artists:e.singer.map(({mid:e,name:t})=>({id:e,name:t}))}),l=e=>s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({search:{method:"DoSearchForQQMusicDesktop",module:"music.search.SearchCgiService",param:{num_per_page:5,page_num:1,query:e.keyword,search_type:0}}})),u).then(e=>e.json()).then(t=>{let r=o(t.search.data.body.song.list.map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r=((u.cookie||"").match(/uin=(\d+)/)||[])[1]||"0";return s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({req_0:{module:"vkey.GetVkeyServer",method:"CgiGetVkey",param:{guid:(1e7*Math.random()).toFixed(0),loginflag:1,filename:t[0]?[t.join(e.file)]:null,songmid:[e.song],songtype:[0],uin:r,platform:"20"}}})),u).then(e=>e.json()).then(e=>{let{sip:t,midurlinfo:r}=e.req_0.data;if(!r[0].purl)return Promise.reject();let i=t[0]+r[0].purl;return s("GET",i,{range:"bytes=0-8191","accept-encoding":"identity"}).then(e=>e.statusCode<200||e.statusCode>299?Promise.reject():i)})},h=e=>(e.key=e.file,Promise.all([["F000",".flac"],["M800",".mp3"],["M500",".mp3"],[null,null]].slice(u.cookie||"undefined"!=typeof window?o.ENABLE_FLAC?0:1:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().qq.track(e))),d=a("provider/qq");e.exports={check:e=>d.cache(e,()=>l(e)).then(h),track:h}},3186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3639),r(4898),r(153),e.exports=(e,t)=>{let{duration:r}=t;return e.slice(0,5).find(e=>e.duration&&5e3>Math.abs(e.duration-r))||e[0]},e.exports.ENABLE_FLAC="true"===(process.env.ENABLE_FLAC||"").toLowerCase()},5374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),s=r(8696),a=r(6587),{spawnStdout:u}=r(5319),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,h=o("provider/youtube-dl");async function d(e){try{let{stdout:t}=await u("youtube-dl",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new s(r)}catch(e){if(e&&"ENOENT"===e.code)throw new a;throw e}}let p=async e=>{let{id:t}=await d(c(f(e.keyword)));return t},y=async e=>{let{url:t}=await d(c(l(e)));return t},g=i("youtube-dl");e.exports={check:e=>g.cache(e,()=>p(e)).then(y).catch(e=>{throw e&&h.error(e),e}),track:y}},8829:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(4494),r(3639),r(4898);let i=r(2965),{getManagedCacheStorage:o}=r(6718),s=e=>(e||"").split("&").reduce((e,t)=>{let r=t.split("=").map(decodeURIComponent);return Object.assign({},e,{[r[0]]:r[1]})},{}),a=o("provider/youtube"),u=void 0,c=process.env.YOUTUBE_KEY||null,l=(e="-tKVN2mAKRI")=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>{let t=/"WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO":{[^}]+}/.exec(e)[0];return i("GET","https://youtube.com"+(t=JSON.parse(`{${t}}}`).WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO).jsUrl,{},null,u).then(e=>e.body())}).then(e=>{let[,t,r]=/function\((\w+)\)\s*{([^}]+split\(""\)[^}]+join\(""\))};/.exec(e),i=/;(.+?)\..+?\(/.exec(r)[1];return Function([t],RegExp(`var ${i}={[\\s\\S]+?};`).exec(e)[0]+"\n"+r)}),f=e=>i("GET",`https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(e.keyword)}&type=video&key=${c}`,{accept:"application/json"},null,u).then(e=>e.json()).then(e=>{let t=e.items[0];return t?t.id.videoId:Promise.reject()}),h=e=>i("GET",`https://www.youtube.com/results?search_query=${encodeURIComponent(e.keyword)}`,{},null,u).then(e=>e.body()).then(e=>{let t=JSON.parse(e.match(/ytInitialData\s*=\s*([^;]+);/)[1]).contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0].itemSectionRenderer.contents[1];return t?t.videoRenderer.videoId:Promise.reject()}),d=e=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>JSON.parse(e.match(/ytInitialPlayerResponse\s*=\s*{[^]+};\s*var\s*meta/)[0].replace(/;var meta/,"").replace(/ytInitialPlayerResponse = /,"")).streamingData).then(e=>{let t=e.formats.concat(e.adaptiveFormats).find(e=>140===e.itag),r=s(t.signatureCipher);return t.url||(r.sp.includes("sig")?a.cache("YOUTUBE_SIGNATURE",()=>l(),Date.now()+864e5).then(e=>r.url+"&sig="+e(r.s)):r.url)});e.exports={check:e=>a.cache(e,()=>c?f(e):h(e)).then(d),track:d}},9282:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),{spawnStdout:s}=r(5319),a=r(816),u=r(7229),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,h=o("provider/yt-dlp");async function d(e){try{let{stdout:t}=await s("yt-dlp",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new a(r)}catch(e){if(e&&"ENOENT"===e.code)throw new u;throw e}}let p=async e=>{let{id:t}=await d(c(f(e.keyword)));return t},y=async e=>{let{url:t}=await d(c(l(e)));return t},g=i("yt-dlp");e.exports={check:e=>g.cache(e,()=>p(e)).then(y).catch(e=>{throw e&&h.error(e),e}),track:y}},2965:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9635),r(4494);let i=r(3106),o=r(8611),s=r(5692),a=r(2672),u=r(2396),{logScope:c}=r(6166),l=r(7016).parse,f=r(7016).format,h=c("request"),d=e=>(global.hosts||{})[e]||e,p=(e,t)=>("https:"===((void 0===t?global.proxy:t)||e).protocol?s:o).request,y=(e,t,r,i)=>{r=r||{},i=void 0===i?global.proxy:i,"content-length"in r&&delete r["content-length"];let o={};return o._headers=r,i&&"https:"===t.protocol?(o.method="CONNECT",o.headers=Object.keys(r).reduce((e,t)=>Object.assign(e,["host","user-agent"].includes(t)&&{[t]:r[t]}),{})):(o.method=e,o.headers=r),i?(o.hostname=d(i.hostname),o.port=i.port||("https:"===i.protocol?443:80),o.path="https:"===t.protocol?d(t.hostname)+":"+(t.port||443):"http://"+d(t.hostname)+t.path):(o.hostname=d(t.hostname),o.port=t.port||("https:"===t.protocol?443:80),o.path=t.path),o},g=(e,t,r,i,o,c)=>{let d=l(t),w=r||{},_=y(e,d,{host:d.hostname,accept:"application/json, text/plain, */*","accept-encoding":"gzip, deflate","accept-language":"zh-CN,zh;q=0.9","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",...w},o);return new Promise((r,l)=>{var y;h.debug(`Start requesting ${t}`);let g=p(d,o)(_),m=function(){g.destroy(new u(f(d)))};null==c||c.on(a,m),null!==(y=null==c?void 0:c.cancelled)&&void 0!==y&&y&&m(),g.setTimeout(1e4,()=>{h.warn({url:f(d)},"The request timed out, or the requester didn't handle the response."),m()}).on("response",e=>r(e)).on("connect",(t,o)=>{h.debug("received CONNECT, continuing with https.request()..."),s.request({method:e,path:d.path,headers:_._headers,socket:o,agent:!1}).on("response",e=>r(e)).on("error",e=>l(e)).end(i)}).on("error",e=>l(e)).end("CONNECT"===_.method.toUpperCase()?void 0:i)}).then(t=>{var r;if(null!==(r=null==c?void 0:c.cancelled)&&void 0!==r&&r)return Promise.reject(new u(f(d)));if([201,301,302,303,307,308].includes(t.statusCode)){let r=d.resolve(t.headers.location||d.href);return h.debug(`Redirect to ${r}`),delete w.host,g(e,r,w,i,o)}return Object.assign(t,{url:d,body:e=>m(t,e),json:()=>b(t),jsonp:()=>v(t)})})},m=(e,t)=>new Promise((t,r)=>{let i=[];e.on("data",e=>i.push(e)).on("end",()=>t(Buffer.concat(i))).on("error",e=>r(e))}).then(r=>{if(r.length)switch(e.headers["content-encoding"]){case"deflate":case"gzip":r=i.unzipSync(r);break;case"br":r=i.brotliDecompressSync(r)}return t?r:r.toString()}),b=e=>m(e,!1).then(e=>JSON.parse(e)),v=e=>m(e,!1).then(e=>JSON.parse(e.slice(e.indexOf("(")+1,-1)));g.read=m,g.create=p,g.translate=d,g.configure=y,e.exports=g},5319:(e,t,r)=>{"use strict";let i=r(5317),{logScope:o}=r(6166),s=r(1828),a=o("spawn");async function u(e,t=[]){return new Promise((r,o)=>{let u=0,c=0,l=Buffer.alloc(5e6),f=Buffer.alloc(5e6),h=i.spawn(e,t);h.on("spawn",()=>{a.info(`running ${e} ${t.join(" ")}`)}),h.on("error",e=>o(e)),h.on("close",t=>{0!==t?o(new s(e,t)):(a.debug(`process ${e} exited successfully`),r({stdout:l.slice(0,u),stderr:f.slice(0,c)}))}),h.stdout.on("data",e=>{u+=e.copy(l,u)}),h.stderr.on("data",t=>{a.warn(`[${e}][stderr] ${t}`),c+=t.copy(f,c)})})}e.exports={spawnStdout:u}},7048:e=>{"use strict";if("undefined"!=typeof SharedArrayBuffer&&"undefined"!=typeof Atomics){let t=new Int32Array(new SharedArrayBuffer(4));e.exports=function(e){if(!1==(e>0&&e<1/0)){if("number"!=typeof e&&"bigint"!=typeof e)throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}Atomics.wait(t,0,0,Number(e))}}else e.exports=function(e){if(!1==(e>0&&e<1/0)){if("number"!=typeof e&&"bigint"!=typeof e)throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}let t=Date.now()+Number(e);for(;t>Date.now(););}},5402:(e,t,r)=>{"use strict";var i;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(s){var a,u,c,l=arguments,f=(a=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,u=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,c=/[^-+\dA-Z]/g,function(e,t,r,i){if(1!==l.length||"string"!==g(e)||/\d/.test(e)||(t=e,e=void 0),(e=e||0===e?e:new Date)instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");var o=(t=String(f.masks[t]||t||f.masks.default)).slice(0,4);("UTC:"===o||"GMT:"===o)&&(t=t.slice(4),r=!0,"GMT:"===o&&(i=!0));var s=function(){return r?"getUTC":"get"},m=function(){return e[s()+"Date"]()},b=function(){return e[s()+"Day"]()},v=function(){return e[s()+"Month"]()},w=function(){return e[s()+"FullYear"]()},_=function(){return e[s()+"Hours"]()},S=function(){return e[s()+"Minutes"]()},x=function(){return e[s()+"Seconds"]()},E=function(){return e[s()+"Milliseconds"]()},O=function(){return r?0:e.getTimezoneOffset()},j=function(){return p(e)},k={d:function(){return m()},dd:function(){return h(m())},ddd:function(){return f.i18n.dayNames[b()]},DDD:function(){return d({y:w(),m:v(),d:m(),_:s(),dayName:f.i18n.dayNames[b()],short:!0})},dddd:function(){return f.i18n.dayNames[b()+7]},DDDD:function(){return d({y:w(),m:v(),d:m(),_:s(),dayName:f.i18n.dayNames[b()+7]})},m:function(){return v()+1},mm:function(){return h(v()+1)},mmm:function(){return f.i18n.monthNames[v()]},mmmm:function(){return f.i18n.monthNames[v()+12]},yy:function(){return String(w()).slice(2)},yyyy:function(){return h(w(),4)},h:function(){return _()%12||12},hh:function(){return h(_()%12||12)},H:function(){return _()},HH:function(){return h(_())},M:function(){return S()},MM:function(){return h(S())},s:function(){return x()},ss:function(){return h(x())},l:function(){return h(E(),3)},L:function(){return h(Math.floor(E()/10))},t:function(){return 12>_()?f.i18n.timeNames[0]:f.i18n.timeNames[1]},tt:function(){return 12>_()?f.i18n.timeNames[2]:f.i18n.timeNames[3]},T:function(){return 12>_()?f.i18n.timeNames[4]:f.i18n.timeNames[5]},TT:function(){return 12>_()?f.i18n.timeNames[6]:f.i18n.timeNames[7]},Z:function(){return i?"GMT":r?"UTC":(String(e).match(u)||[""]).pop().replace(c,"").replace(/GMT\+0000/g,"UTC")},o:function(){return(O()>0?"-":"+")+h(100*Math.floor(Math.abs(O())/60)+Math.abs(O())%60,4)},p:function(){return(O()>0?"-":"+")+h(Math.floor(Math.abs(O())/60),2)+":"+h(Math.floor(Math.abs(O())%60),2)},S:function(){return["th","st","nd","rd"][m()%10>3?0:(m()%100-m()%10!=10)*m()%10]},W:function(){return j()},WW:function(){return h(j())},N:function(){return y(e)}};return t.replace(a,function(e){return e in k?k[e]():e.slice(1,e.length-1)})});f.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},f.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]};var h=function(e,t){for(e=String(e),t=t||2;e.length{var i=r(9491),o=r(5486),s=r(3081),a=r(3049),u=Buffer.from&&Buffer.from!==Uint8Array.from?Buffer.from([0]):new Buffer([0]),c=function(e,t){e._corked?e.once("uncork",t):t()},l=function(e,t){e._autoDestroy&&e.destroy(t)},f=function(e,t){return function(r){r?l(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},h=function(){},d=function(e,t,r){if(!(this instanceof d))return new d(e,t,r);i.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};s(d,i.Duplex),d.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new d(e,t,r)},d.prototype.cork=function(){1==++this._corked&&this.emit("cork")},d.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},d.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed){e&&e.destroy&&e.destroy();return}if(null===e||!1===e){this.end();return}var t=this,r=o(e,{writable:!0,readable:!1},f(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&process.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=function(){t._writable.removeListener("drain",i),r()},this.uncork()},d.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed){e&&e.destroy&&e.destroy();return}if(null===e||!1===e){this.push(null),this.resume();return}var t=this,r=o(e,{writable:!1,readable:!0},f(this)),s=function(){t._forward()},a=function(){t.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:new i.Readable({objectMode:!0,highWaterMark:16}).wrap(e),this._readable2.on("readable",s),this._readable2.on("end",a),this._unread=function(){t._readable2.removeListener("readable",s),t._readable2.removeListener("end",a),r()},this._forward()},d.prototype._read=function(){this._drained=!0,this._forward()},d.prototype._forward=function(){var e;if(!this._forwarding&&this._readable2&&this._drained){for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},d.prototype.destroy=function(e,t){if(t||(t=h),this.destroyed)return t(null);this.destroyed=!0;var r=this;process.nextTick(function(){r._destroy(e),t(null)})},d.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},d.prototype._write=function(e,t,r){if(!this.destroyed){if(this._corked)return c(this,this._write.bind(this,e,t,r));if(e===u)return this._finish(r);if(!this._writable)return r();!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()}},d.prototype._finish=function(e){var t=this;this.emit("preend"),c(this,function(){var r,i;r=t._forwardEnd&&t._writable,i=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),c(t,e)},!r||r._writableState&&r._writableState.finished?i():r._writableState?r.end(i):(r.end(),i())})},d.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(u),i.Writable.prototype.end.call(this,r))},e.exports=d},5486:(e,t,r)=>{var i=r(5645),o=function(){},s=function(e,t,r){if("function"==typeof t)return s(e,null,t);t||(t={}),r=i(r||o);var a=e._writableState,u=e._readableState,c=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,f=!1,h=function(){e.writable||d()},d=function(){l=!1,c||r.call(e)},p=function(){c=!1,l||r.call(e)},y=function(t){r.call(e,t?Error("exited with error code: "+t):null)},g=function(t){r.call(e,t)},m=function(){process.nextTick(b)},b=function(){if(!f&&(c&&!(u&&u.ended&&!u.destroyed)||l&&!(a&&a.ended&&!a.destroyed)))return r.call(e,Error("premature close"))},v=function(){e.req.on("finish",d)};return e.setHeader&&"function"==typeof e.abort?(e.on("complete",d),e.on("abort",m),e.req?v():e.on("request",v)):l&&!a&&(e.on("end",h),e.on("close",h)),e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length&&e.on("exit",y),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",g),e.on("close",m),function(){f=!0,e.removeListener("complete",d),e.removeListener("abort",m),e.removeListener("request",v),e.req&&e.req.removeListener("finish",d),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("exit",y),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}};e.exports=s},4408:(e,t,r)=>{"use strict";let i=r(7054),o=r(2023),s=r(3610),a=r(5014),{groupRedact:u,nestedRedact:c}=r(5158),l=r(6994),f=r(6600),h=i(),d=e=>e;function p(e={}){let t=Array.from(new Set(e.paths||[])),r="serialize"in e?!1===e.serialize?e.serialize:"function"==typeof e.serialize?e.serialize:JSON.stringify:JSON.stringify,i=e.remove;if(!0===i&&r!==JSON.stringify)throw Error("fast-redact – remove option may only be set when serializer is JSON.stringify");let f=!0===i?void 0:"censor"in e?e.censor:"[REDACTED]",y="function"==typeof f,g=y&&f.length>1;if(0===t.length)return r||d;h({paths:t,serialize:r,censor:f});let{wildcards:m,wcLen:b,secret:v}=o({paths:t,censor:f}),w=a({secret:v,wcLen:b});return s({secret:v,wcLen:b,serialize:r,strict:!("strict"in e)||e.strict,isCensorFct:y,censorFctTakesPath:g},l({secret:v,censor:f,compileRestore:w,serialize:r,groupRedact:u,nestedRedact:c,wildcards:m,wcLen:b}))}d.restore=d,p.rx=f,p.validator=i,e.exports=p},5158:e=>{"use strict";function t(e,t){for(var r=-1,i=t.length,o=e;null!=o&&++r{"use strict";let i=r(6600);e.exports=function({paths:e}){let t=[];var r=0;let o=e.reduce(function(e,o,s){var a=o.match(i).map(e=>e.replace(/'|"|`/g,""));let u="["===o[0],c=(a=a.map(e=>"["===e[0]?e.substr(1,e.length-2):e)).indexOf("*");if(c>-1){let e=a.slice(0,c),i=e.join("."),o=a.slice(c+1,a.length);if(o.indexOf("*")>-1)throw Error("fast-redact – Only one wildcard per path is supported");let s=o.length>0;r++,t.push({before:e,beforeStr:i,after:o,nested:s})}else e[o]={path:a,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(o),leadingBracket:u};return e},{});return{wildcards:t,wcLen:r,secret:o}}},3610:(e,t,r)=>{"use strict";let i=r(6600);e.exports=function({secret:e,serialize:t,wcLen:r,strict:o,isCensorFct:s,censorFctTakesPath:a},u){let c=Function("o",` +(()=>{var e={6718:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(952),r(1200),r(9778),r(3307),r(310),r(4980),r(4504),r(4038),r(8208),r(7274),r(1469),r(3039),r(845),r(200),r(1363),r(8210),r(153),r(530),r(3586),r(3096),r(5872),r(4483),r(5277),r(3136),r(3625),r(8350),r(7737),r(391),r(1414),r(4558),r(695),r(3605),r(1447),r(5609),r(993),r(6676),r(2826),r(6570),r(932),r(580);let{EventEmitter:i}=r(4434),{logScope:o}=r(6166),s=o("cache"),a={CLEANUP:"cs@cleanup"};class u extends i{id="Default Cache Storage";cacheMap=new Map;aliveDuration=18e5;constructor(e){super(),e&&(this.id=e),this.on(a.CLEANUP,async()=>this.removeExpiredCache())}get WillExpireAt(){return Date.now()+this.aliveDuration}getLoggerContext(e={}){return{...e,cacheStorageId:this.id}}removeExpiredCache(){s.debug(this.getLoggerContext(),"Cleaning up the expired caches..."),this.cacheMap.forEach((e,t)=>{e.expireAt<=Date.now()&&this.cacheMap.delete(t)})}async cache(e,t,r){if("true"===process.env.NO_CACHE)return t();this.emit(a.CLEANUP);let i=this.cacheMap.get(e),o="object"==typeof e?"Something":e,u=this.getLoggerContext({logKey:o});if(i)return s.debug(u,`${o} hit!`),i.data;s.debug(u,`${o} did not hit. Storing the execution result...`);let c=await t();return this.cacheMap.set(e,{data:c,expireAt:new Date(r||this.WillExpireAt)}),c}}class c{static instance=void 0;cacheStorages=new Set;constructor(){}static getInstance(){return c.instance||(c.instance=new c),c.instance}cleanup(){this.cacheStorages.forEach(e=>e.removeExpiredCache())}}let l=c.getInstance();e.exports={CacheStorage:u,CacheStorageEvents:a,CacheStorageGroup:c,getManagedCacheStorage:function(e){let t=new u(e);return l.cacheStorages.add(t),t}}},2672:(e,t,r)=>{"use strict";let i=r(4434),o="cancel";e.exports={CancelRequest:class extends i{cancelled=!1;cancel(){this.cancelled=!0,this.emit(o)}},ON_CANCEL:o}},6406:(e,t,r)=>{"use strict";let i={qq:r(1128),kugou:r(2777),kuwo:r(2076),migu:r(8516),joox:r(9222),youtube:r(8829),youtubedl:r(5374),ytdlp:r(9282),bilibili:r(8114),pyncmd:r(1727)};e.exports={DEFAULT_SOURCE:["kugou","kuwo","migu","bilibili","ytdlp"],PROVIDERS:i}},23:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15);let i=r(6982),o=r(7016).parse,s=r(3480).stringify,a="e82ckenh8dichen8",u="rFgB&h#%2?^eDg:Q",c=(e,t)=>{let r=i.createDecipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])},l=(e,t)=>{let r=i.createCipheriv("aes-128-ecb",t,null);return Buffer.concat([r.update(e),r.final()])};e.exports={eapi:{encrypt:e=>l(e,a),decrypt:e=>c(e,a),encryptRequest:(t,r)=>{t=o(t);let a=JSON.stringify(r),u=`nobody${t.path}use${a}md5forencrypt`,c=i.createHash("md5").update(u).digest("hex"),l=`${t.path}-36cd479b6b5-${a}-36cd479b6b5-${c}`;return{url:t.href.replace(/\w*api/,"eapi"),body:s({params:e.exports.eapi.encrypt(Buffer.from(l)).toString("hex").toUpperCase()})}}},api:{encryptRequest:(e,t)=>({url:(e=o(e)).href.replace(/\w*api/,"api"),body:s(t)})},linuxapi:{encrypt:e=>l(e,u),decrypt:e=>c(e,u),encryptRequest:(t,r)=>{let i=JSON.stringify({method:"POST",url:(t=o(t)).href,params:r});return{url:t.resolve("/api/linux/forward"),body:s({eparams:e.exports.linuxapi.encrypt(Buffer.from(i)).toString("hex").toUpperCase()})}}},miguapi:{encryptBody:e=>{let t=JSON.stringify(e),r=Buffer.from(i.randomBytes(32).toString("hex")),o=i.randomBytes(8),a=((e,t,r,o)=>{t=t||Buffer.alloc(0);let s=r/8,a=Math.ceil((s+8*o)/32),u=Buffer.concat(Array(a).fill(null).reduce(r=>r.concat(i.createHash("md5").update(Buffer.concat([r.slice(-1)[0],e,t])).digest()),[Buffer.alloc(0)]));return{key:u.slice(0,s),iv:u.slice(s,s+o)}})(r,o,256,16),u=i.createCipheriv("aes-256-cbc",a.key,a.iv);return s({data:Buffer.concat([Buffer.from("Salted__"),o,u.update(Buffer.from(t)),u.final()]).toString("base64"),secKey:i.publicEncrypt({key:"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8asrfSaoOb4je+DSmKdriQJKWVJ2oDZrs3wi5W67m3LwTB9QVR+cE3XWU21Nx+YBxS0yun8wDcjgQvYt625ZCcgin2ro/eOkNyUOTBIbuj9CvMnhUYiR61lC1f1IGbrSYYimqBVSjpifVufxtx/I3exReZosTByYp4Xwpb1+WAQIDAQAB\n-----END PUBLIC KEY-----",padding:i.constants.RSA_PKCS1_PADDING},r).toString("base64")})}},base64:{encode:(e,t)=>Buffer.from(e,t).toString("base64").replace(/\+/g,"-").replace(/\//g,"_"),decode:(e,t)=>Buffer.from(e.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString(t)},uri:{retrieve:e=>{e=e.toString().trim();let t="3go8&$8*3*3h0k(2)2",r=Array.from(Array(e.length).keys()).map(r=>String.fromCharCode(e.charCodeAt(r)^t.charCodeAt(r%t.length))).join(""),o=i.createHash("md5").update(r).digest("base64").replace(/\//g,"_").replace(/\+/g,"-");return`http://p1.music.126.net/${o}/${e}`}},md5:{digest:e=>i.createHash("md5").update(e).digest("hex"),pipe:e=>new Promise((t,r)=>{let o=i.createHash("md5").setEncoding("hex");e.pipe(o).on("error",e=>r(e)).once("finish",()=>t(o.read()))})},sha1:{digest:e=>i.createHash("sha1").update(e).digest("hex")},random:{hex:e=>i.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e)}};try{e.exports.kuwoapi=r(9726)}catch(e){}},1828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e,t){super(`${e} exited with ${t}, which is not zero.`),this.process=e,this.exitCode=t,this.name="ProcessExitNotSuccessfully"}}},2396:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super(`This request URL has been cancelled: ${e}`),this.name="RequestCancelled"}}},8696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of youtube-dl is malformed."),this.name="YoutubeDlInvalidResponse",this.response=e}}},6587:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "youtube-dl" before using the "youtubedl" source.'),this.name="YoutubeDlNotInstalled"}}},816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(e){super("The response of yt-dlp is malformed."),this.name="YtDlpInvalidResponse",this.response=e}}},7229:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3351),e.exports=class extends Error{constructor(){super('You must install "yt-dlp" before using the "ytdlp" source.'),this.name="YtDlpNotInstalled"}}},9726:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(1363),r(8210);let i=e=>{let t=BigInt(e);return{low:Number(t),valueOf:()=>t.valueOf(),toString:()=>t.toString(),not:()=>i(~t),isNegative:()=>t<0,or:e=>i(t|BigInt(e)),and:e=>i(t&BigInt(e)),xor:e=>i(t^BigInt(e)),equals:e=>t===BigInt(e),multiply:e=>i(t*BigInt(e)),shiftLeft:e=>i(t<i(t>>BigInt(e))}},o=e=>Array.from(Array(e).keys()),s=(e,t)=>Array(t).fill(null).reduce(t=>t.multiply(e),i(1)),a=(...e)=>e.map(e=>-1===e?i(-1,-1):i(e)),u=a(31,0,1,2,3,4,-1,-1,3,4,5,6,7,8,-1,-1,7,8,9,10,11,12,-1,-1,11,12,13,14,15,16,-1,-1,15,16,17,18,19,20,-1,-1,19,20,21,22,23,24,-1,-1,23,24,25,26,27,28,-1,-1,27,28,29,30,31,30,-1,-1),c=a(57,49,41,33,25,17,9,1,59,51,43,35,27,19,11,3,61,53,45,37,29,21,13,5,63,55,47,39,31,23,15,7,56,48,40,32,24,16,8,0,58,50,42,34,26,18,10,2,60,52,44,36,28,20,12,4,62,54,46,38,30,22,14,6),l=a(39,7,47,15,55,23,63,31,38,6,46,14,54,22,62,30,37,5,45,13,53,21,61,29,36,4,44,12,52,20,60,28,35,3,43,11,51,19,59,27,34,2,42,10,50,18,58,26,33,1,41,9,49,17,57,25,32,0,40,8,48,16,56,24),f=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1],h=a(0,1048577,3145731),d=o(64).map(e=>s(2,e));d[d.length-1]=d[d.length-1].multiply(-1);let p=a(15,6,19,20,28,11,27,16,0,14,22,25,4,17,30,9,1,7,23,13,31,26,2,8,18,12,29,5,21,10,3,24),y=a(56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3),g=a(13,16,10,23,0,4,-1,-1,2,27,14,5,20,9,-1,-1,22,18,11,3,25,7,-1,-1,15,6,26,19,12,1,-1,-1,40,51,30,36,46,54,-1,-1,29,39,50,44,32,47,-1,-1,43,48,38,55,33,52,-1,-1,45,41,49,35,28,31,-1,-1),m=[[14,4,3,15,2,13,5,3,13,14,6,9,11,2,0,5,4,1,10,12,15,6,9,10,1,8,12,7,8,11,7,0,0,15,10,5,14,4,9,10,7,8,12,3,13,1,3,6,15,12,6,11,2,9,5,0,4,2,11,14,1,7,8,13],[15,0,9,5,6,10,12,9,8,7,2,12,3,13,5,2,1,14,7,8,11,4,0,3,14,11,13,6,4,1,10,15,3,13,12,11,15,3,6,0,4,10,1,7,8,4,11,14,13,8,0,6,2,15,9,5,7,1,10,12,14,2,5,9],[10,13,1,11,6,8,11,5,9,4,12,2,15,3,2,14,0,6,13,1,3,15,4,10,14,9,7,12,5,0,8,7,13,1,2,4,3,6,12,11,0,13,5,14,6,8,15,2,7,10,8,15,4,9,11,5,9,0,14,3,10,7,1,12],[7,10,1,15,0,12,11,5,14,9,8,3,9,7,4,8,13,6,2,1,6,11,12,2,3,0,5,14,10,13,15,4,13,3,4,9,6,10,1,12,11,0,2,5,0,13,14,2,8,15,7,4,15,1,10,7,5,6,12,11,3,8,9,14],[2,4,8,15,7,10,13,6,4,1,3,12,11,7,14,0,12,2,5,9,10,13,0,3,1,11,15,5,6,8,9,14,14,11,5,6,4,1,3,10,2,12,15,0,13,2,8,5,11,8,0,15,7,14,9,4,12,7,10,9,1,13,6,3],[12,9,0,7,9,2,14,1,10,15,3,4,6,12,5,11,1,14,13,0,2,8,7,13,15,5,4,10,8,3,11,6,10,4,6,11,7,9,0,6,4,2,13,1,9,15,3,8,15,3,1,14,12,5,11,0,2,12,14,7,5,10,8,13],[4,1,3,10,15,12,5,0,2,11,9,6,8,7,6,9,11,4,12,15,0,3,10,5,14,13,7,8,13,14,1,2,13,6,14,9,4,1,2,14,11,13,5,0,1,10,8,3,0,11,3,5,9,4,15,2,7,8,12,15,10,7,6,12],[13,7,10,0,6,9,5,15,8,4,3,10,11,14,12,5,2,11,9,6,15,12,0,3,4,1,14,13,1,2,7,8,1,2,12,15,10,4,0,3,13,14,6,9,7,8,9,6,15,1,5,12,3,10,14,5,8,7,11,0,4,13,2,11]],b=(e,t,r)=>{let s=i(0);return o(t).forEach(t=>{e[t].isNegative()||r.and(d[e[t].low]).equals(0)||(s=s.or(d[t]))}),s},v=(e,t)=>{let r=o(8).map(()=>i(0)),s=[i(0),i(0)],a=i(0),f=i(0),h=b(c,64,t);return s[0]=h.and(4294967295),s[1]=h.and(-4294967296).shiftRight(32),o(16).forEach(t=>{let c=i(0);f=(f=b(u,64,f=i(s[1]))).xor(e[t]),o(8).forEach(e=>{r[e]=f.shiftRight(8*e).and(255)}),o(8).reverse().forEach(e=>{c=c.shiftLeft(4).or(m[e][r[e]])}),f=b(p,32,c),a=i(s[0]),s[0]=i(s[1]),s[1]=a.xor(f)}),s.reverse(),h=b(l,64,h=s[1].shiftLeft(32).and(-4294967296).or(s[0].and(4294967295)))},w=(e,t,r)=>{let i=b(y,56,e);o(16).forEach(e=>{i=i.and(h[f[e]]).shiftLeft(28-f[e]).or(i.and(h[f[e]].not()).shiftRight(f[e])),t[e]=b(g,64,i)}),1===r&&o(8).forEach(e=>{[t[e],t[15-e]]=[t[15-e],t[e]]})},_=(e,t,r)=>{let s=i(0);o(8).forEach(e=>{s=i(t[e]).shiftLeft(8*e).or(s)});let a=Math.floor(e.length/8),u=o(16).map(()=>i(0));w(s,u,r);let c=o(a).map(()=>i(0));o(a).forEach(t=>{o(8).forEach(r=>{c[t]=i(e[r+8*t]).shiftLeft(8*r).or(c[t])})});let l=o(Math.floor((1+8*(a+1))/8)).map(()=>i(0));o(a).forEach(e=>{l[e]=v(u,c[e])});let f=e.slice(8*a),h=i(0);o(e.length%8).forEach(e=>{h=i(f[e]).shiftLeft(8*e).or(h)}),(f.length||0===r)&&(l[a]=v(u,h));let d=o(8*l.length).map(()=>0),p=0;return l.forEach(e=>{o(8).forEach(t=>{d[p]=e.shiftRight(8*t).and(255).low,p+=1})}),Buffer.from(d)},S=Buffer.from("ylzsxkwm"),x=e=>_(e,S,0);e.exports={encrypt:x,decrypt:e=>_(e,S,1),encryptQuery:e=>x(Buffer.from(e)).toString("base64")}},6166:(e,t,r)=>{"use strict";var i;let o=r(2306),s=process.env.LOG_FILE,a=process.stdout.isTTY,u=o({level:null!==(i=process.env.LOG_LEVEL)&&void 0!==i?i:"info",prettyPrint:"true"!==process.env.JSON_LOG&&{colorize:a,messageFormat:a?"\x1b[1m\x1b[32m({scope})\x1b[0m\x1b[36m {msg}":"({scope}) {msg}",ignore:"time,pid,hostname,scope",errorProps:"*"}},s&&o.destination(s));e.exports={logger:u,logScope:function(e){return u.child({scope:e})}}},8114:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15);let{cacheStorage:i,CacheStorageGroup:o,getManagedCacheStorage:s}=r(6718),a=r(9588),u=r(3186),c=r(2965),l=e=>({id:e.id,name:e.title,artists:{id:e.mid,name:e.author}}),f=e=>c("GET",`https://api.bilibili.com/audio/music-service-c/s?search_type=music&page=1&pagesize=30&keyword=${encodeURIComponent(e.keyword)}`).then(e=>e.json()).then(t=>{let r=u(t.data.result.map(l),e);return r?r.id:Promise.reject()}),h=e=>c("GET","https://www.bilibili.com/audio/music-service-c/web/url?rivilege=2&quality=2&sid="+e).then(e=>e.json()).then(e=>0===e.code?e.data.cdns[0].replace("https","http"):Promise.reject()).catch(()=>a().bilibili.track(e)),d=s("provider/bilibili");e.exports={check:e=>d.cache(e,()=>f(e)).then(h),track:h}},9588:(e,t,r)=>{"use strict";let i=r(2965);e.exports=()=>{let t=global.cnrelay,r=new Proxy(()=>{},{get:(e,t)=>(e.route=(e.route||[]).concat(t),r),apply:(r,o,s)=>{if(e.exports.disable||!t)return Promise.reject();let a=r.route.join("/"),u="object"==typeof s[0]?JSON.stringify(s[0]):s[0];return i("GET",`${t}/${a}?${encodeURIComponent(u)}`).then(e=>e.body())}});return r}},9222:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(4494);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c={origin:"http://www.joox.com",referer:"http://www.joox.com",cookie:process.env.JOOX_COOKIE||null},l=e=>/[\u0800-\u4e00]/.test(e.name)?e.name:e.keyword,f=e=>{let{decode:t}=s.base64;return{id:e.songid,name:t(e.info1||""),duration:1e3*e.playtime,album:{id:e.albummid,name:t(e.info3||"")},artists:e.singer_list.map(({id:e,name:r})=>({id:e,name:t(r||"")}))}},h=e=>a("GET","http://api-jooxtt.sanook.com/web-fcgi-bin/web_search?country=hk&lang=zh_TW&search_input="+encodeURIComponent(l(e))+"&sin=0&ein=30",c).then(e=>e.body()).then(t=>{let r=o(JSON.parse(t.replace(/'/g,'"')).itemlist.map(f),e);return r?r.id:Promise.reject()}),d=e=>a("GET","http://api.joox.com/web-fcgi-bin/web_get_songinfo?songid="+e+"&country=hk&lang=zh_cn&from_type=-1&channel_id=-1&_="+new Date().getTime(),c).then(e=>e.jsonp()).then(e=>(e.r320Url||e.r192Url||e.mp3Url||e.m4aUrl).replace(/M\d00([\w]+).mp3/,"M800$1.mp3")||Promise.reject()).catch(()=>i().joox.track(e)),p=u("provider/joox");e.exports={check:e=>p.cache(e,()=>h(e)).then(d),track:d}},2777:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.hash,id_hq:e["320hash"],id_sq:e.sqhash,name:e.songname,duration:1e3*e.duration,album:{id:e.album_id,name:e.album_name}}),l=e=>a("GET","http://mobilecdn.kugou.com/api/v3/search/song?keyword="+encodeURIComponent(e.keyword)+"&page=1&pagesize=10").then(e=>e.json()).then(t=>o(t.data.info.map(c),e)||Promise.reject()).catch(()=>i().kugou.search(e)),f=(e,t)=>{let r=()=>{switch(t){case"hash":return e.id;case"hqhash":return e.id_hq;case"sqhash":return e.id_sq}return""};return a("GET","http://trackercdn.kugou.com/i/v2/?key="+s.md5.digest(`${r()}kgcloudv2`)+"&hash="+r()+"&appid=1005&pid=2&cmd=25&behavior=play&album_id="+e.album.id).then(e=>e.json()).then(e=>e.url[0]||Promise.reject())},h=e=>Promise.all(["sqhash","hqhash","hash"].slice(o.ENABLE_FLAC?0:1).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().kugou.track(e)),d=u("provider/kugou");e.exports={check:e=>d.cache(e,()=>l(e)).then(h),search:l}},2076:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(7022),r(9551),r(153);let i=r(9588),o=r(3186),s=r(23),a=r(2965),{getManagedCacheStorage:u}=r(6718),c=e=>({id:e.MUSICRID.split("_").pop(),name:e.SONGNAME,duration:1e3*e.DURATION,album:{id:e.ALBUMID,name:e.ALBUM},artists:e.ARTIST.split("&").map((t,r)=>({id:r?null:e.ARTISTID,name:t}))}),l=e=>a("GET","http://search.kuwo.cn/r.s?&correct=1&stype=comprehensive&encoding=utf8&rformat=json&mobi=1&show_copyright_off=1&searchapi=6&all="+encodeURIComponent(e.keyword.replace(" - "," "))).then(e=>e.json()).then(t=>{if(!t||t.content.length<2||!t.content[1].musicpage||t.content[1].musicpage.abslist.length<1)return Promise.reject();let r=o(t.content[1].musicpage.abslist.filter(e=>"0"===e.tpay).map(c),e);return r?r.id:Promise.reject()}),f=e=>a("GET",s.kuwoapi?"http://mobi.kuwo.cn/mobi.s?f=kuwo&q="+s.kuwoapi.encryptQuery("corp=kuwo&source=kwplayer_ar_4.9.2.7_B_nuoweida_vh.apk&p2p=1&type=convert_url2&sig=0&format="+["flac","mp3"].slice(o.ENABLE_FLAC?0:1)[0]+"&rid="+e):"http://antiserver.kuwo.cn/anti.s?type=convert_url&format=mp3&response=url&rid=MUSIC_"+e,{"user-agent":"okhttp/3.10.0"}).then(e=>e.body()).then(e=>(e.match(/http[^\s$"]+/)||[])[0]||Promise.reject()).catch(()=>i().kuwo.track(e)),h=u("provider/kuwo");e.exports={check:e=>h.cache(e,()=>l(e)).then(f),track:f}},8516:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://music.migu.cn/",referer:"http://m.music.migu.cn/v3/",aversionid:process.env.MIGU_COOKIE||null,channel:"0146921"},c=e=>{let t=e.singerId.split(/\s*,\s*/),r=e.singerName.split(/\s*,\s*/);return{id:e.id,name:e.title,album:{id:e.albumId,name:e.albumName},artists:t.map((e,t)=>({id:e,name:r[t]}))}},l=e=>s("GET","https://m.music.migu.cn/migu/remoting/scr_search_tag?keyword="+encodeURIComponent(e.keyword)+"&type=2&rows=20&pgc=1",u).then(e=>e.json()).then(t=>{let r=o(((t||{}).musics||[]).map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r="https://app.c.nf.migu.cn/MIGUM2.0/strategy/listen-url/v2.4?netType=01&resourceType=2&songId="+e.toString()+"&toneFlag="+t;return s("GET",r,u).then(e=>e.json()).then(e=>{let{audioFormatType:i}=e.data;return i!==t?Promise.reject():r?e.data.url:Promise.reject()})},h=e=>Promise.all(["ZQ24","SQ","HQ","PQ"].slice(o.ENABLE_FLAC?0:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().migu.track(e)),d=a("provider/migu");e.exports={check:e=>d.cache(e,()=>l(e)).then(h),track:h}},1727:(e,t,r)=>{"use strict";let i=r(3186),o=r(2965),{getManagedCacheStorage:s}=r(6718),a=e=>o("GET","https://music-api.gdstudio.xyz/api.php?types=url&source=netease&id="+e.id+"&br="+["999","320"].slice(i.ENABLE_FLAC?0:1,i.ENABLE_FLAC?1:2)).then(e=>e.json()).then(e=>e&&"object"==typeof e&&!1 in e?Promise.reject():e.br>0?e.url:Promise.reject()),u=s("provider/pyncmd");e.exports={check:e=>u.cache(e,()=>a(e))}},1128:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(9320),r(15),r(3639),r(4898),r(153);let i=r(9588),o=r(3186),s=r(2965),{getManagedCacheStorage:a}=r(6718),u={origin:"http://y.qq.com/",referer:"http://y.qq.com/",cookie:process.env.QQ_COOKIE||null},c=e=>({id:{song:e.mid,file:e.mid},name:e.name,duration:1e3*e.interval,album:{id:e.album.mid,name:e.album.name},artists:e.singer.map(({mid:e,name:t})=>({id:e,name:t}))}),l=e=>s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({search:{method:"DoSearchForQQMusicDesktop",module:"music.search.SearchCgiService",param:{num_per_page:5,page_num:1,query:e.keyword,search_type:0}}})),u).then(e=>e.json()).then(t=>{let r=o(t.search.data.body.song.list.map(c),e);return r?r.id:Promise.reject()}),f=(e,t)=>{let r=((u.cookie||"").match(/uin=(\d+)/)||[])[1]||"0";return s("GET","https://u.y.qq.com/cgi-bin/musicu.fcg?data="+encodeURIComponent(JSON.stringify({req_0:{module:"vkey.GetVkeyServer",method:"CgiGetVkey",param:{guid:(1e7*Math.random()).toFixed(0),loginflag:1,filename:t[0]?[t.join(e.file)]:null,songmid:[e.song],songtype:[0],uin:r,platform:"20"}}})),u).then(e=>e.json()).then(e=>{let{sip:t,midurlinfo:r}=e.req_0.data;if(!r[0].purl)return Promise.reject();let i=t[0]+r[0].purl;return s("GET",i,{range:"bytes=0-8191","accept-encoding":"identity"}).then(e=>e.statusCode<200||e.statusCode>299?Promise.reject():i)})},h=e=>(e.key=e.file,Promise.all([["F000",".flac"],["M800",".mp3"],["M500",".mp3"],[null,null]].slice(u.cookie||"undefined"!=typeof window?o.ENABLE_FLAC?0:1:2).map(t=>f(e,t).catch(()=>null))).then(e=>e.find(e=>e)||Promise.reject()).catch(()=>i().qq.track(e))),d=a("provider/qq");e.exports={check:e=>d.cache(e,()=>l(e)).then(h),track:h}},3186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(3639),r(4898),r(153),e.exports=(e,t)=>{let{duration:r}=t;return e.slice(0,5).find(e=>e.duration&&5e3>Math.abs(e.duration-r))||e[0]},e.exports.ENABLE_FLAC="true"===(process.env.ENABLE_FLAC||"").toLowerCase()},5374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),s=r(8696),a=r(6587),{spawnStdout:u}=r(5319),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,h=o("provider/youtube-dl");async function d(e){try{let{stdout:t}=await u("youtube-dl",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new s(r)}catch(e){if(e&&"ENOENT"===e.code)throw new a;throw e}}let p=async e=>{let{id:t}=await d(c(f(e.keyword)));return t},y=async e=>{let{url:t}=await d(c(l(e)));return t},g=i("youtube-dl");e.exports={check:e=>g.cache(e,()=>p(e)).then(y).catch(e=>{throw e&&h.error(e),e}),track:y}},8829:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9320),r(15),r(4494),r(3639),r(4898);let i=r(2965),{getManagedCacheStorage:o}=r(6718),s=e=>(e||"").split("&").reduce((e,t)=>{let r=t.split("=").map(decodeURIComponent);return Object.assign({},e,{[r[0]]:r[1]})},{}),a=o("provider/youtube"),u=void 0,c=process.env.YOUTUBE_KEY||null,l=(e="-tKVN2mAKRI")=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>{let t=/"WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO":{[^}]+}/.exec(e)[0];return i("GET","https://youtube.com"+(t=JSON.parse(`{${t}}}`).WEB_PLAYER_CONTEXT_CONFIG_ID_KEVLAR_VERTICAL_LANDING_PAGE_PROMO).jsUrl,{},null,u).then(e=>e.body())}).then(e=>{let[,t,r]=/function\((\w+)\)\s*{([^}]+split\(""\)[^}]+join\(""\))};/.exec(e),i=/;(.+?)\..+?\(/.exec(r)[1];return Function([t],RegExp(`var ${i}={[\\s\\S]+?};`).exec(e)[0]+"\n"+r)}),f=e=>i("GET",`https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(e.keyword)}&type=video&key=${c}`,{accept:"application/json"},null,u).then(e=>e.json()).then(e=>{let t=e.items[0];return t?t.id.videoId:Promise.reject()}),h=e=>i("GET",`https://www.youtube.com/results?search_query=${encodeURIComponent(e.keyword)}`,{},null,u).then(e=>e.body()).then(e=>{let t=JSON.parse(e.match(/ytInitialData\s*=\s*([^;]+);/)[1]).contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0].itemSectionRenderer.contents[1];return t?t.videoRenderer.videoId:Promise.reject()}),d=e=>i("GET",`https://www.youtube.com/watch?v=${e}`,{},null,u).then(e=>e.body()).then(e=>JSON.parse(e.match(/ytInitialPlayerResponse\s*=\s*{[^]+};\s*var\s*meta/)[0].replace(/;var meta/,"").replace(/ytInitialPlayerResponse = /,"")).streamingData).then(e=>{let t=e.formats.concat(e.adaptiveFormats).find(e=>140===e.itag),r=s(t.signatureCipher);return t.url||(r.sp.includes("sig")?a.cache("YOUTUBE_SIGNATURE",()=>l(),Date.now()+864e5).then(e=>r.url+"&sig="+e(r.s)):r.url)});e.exports={check:e=>a.cache(e,()=>c?f(e):h(e)).then(d),track:d}},9282:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4494);let{getManagedCacheStorage:i}=r(6718),{logScope:o}=r(6166),{spawnStdout:s}=r(5319),a=r(816),u=r(7229),c=e=>["-f","140","--dump-json",e],l=e=>`https://www.youtube.com/watch?v=${e}`,f=e=>`ytsearch1:${e}`,h=o("provider/yt-dlp");async function d(e){try{let{stdout:t}=await s("yt-dlp",e),r=JSON.parse(t.toString());if("object"==typeof r&&"string"==typeof r.id&&"string"==typeof r.url)return r;throw new a(r)}catch(e){if(e&&"ENOENT"===e.code)throw new u;throw e}}let p=async e=>{let{id:t}=await d(c(f(e.keyword)));return t},y=async e=>{let{url:t}=await d(c(l(e)));return t},g=i("yt-dlp");e.exports={check:e=>g.cache(e,()=>p(e)).then(y).catch(e=>{throw e&&h.error(e),e}),track:y}},2965:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(6006),r(7907),r(153),r(9635),r(4494);let i=r(3106),o=r(8611),s=r(5692),a=r(2672),u=r(2396),{logScope:c}=r(6166),l=r(7016).parse,f=r(7016).format,h=c("request"),d=e=>(global.hosts||{})[e]||e,p=(e,t)=>("https:"===((void 0===t?global.proxy:t)||e).protocol?s:o).request,y=(e,t,r,i)=>{r=r||{},i=void 0===i?global.proxy:i,"content-length"in r&&delete r["content-length"];let o={};return o._headers=r,i&&"https:"===t.protocol?(o.method="CONNECT",o.headers=Object.keys(r).reduce((e,t)=>Object.assign(e,["host","user-agent"].includes(t)&&{[t]:r[t]}),{})):(o.method=e,o.headers=r),i?(o.hostname=d(i.hostname),o.port=i.port||("https:"===i.protocol?443:80),o.path="https:"===t.protocol?d(t.hostname)+":"+(t.port||443):"http://"+d(t.hostname)+t.path):(o.hostname=d(t.hostname),o.port=t.port||("https:"===t.protocol?443:80),o.path=t.path),o},g=(e,t,r,i,o,c)=>{let d=l(t),w=r||{},_=y(e,d,{host:d.hostname,accept:"application/json, text/plain, */*","accept-encoding":"gzip, deflate","accept-language":"zh-CN,zh;q=0.9","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",...w},o);return new Promise((r,l)=>{var y;h.debug(`Start requesting ${t}`);let g=p(d,o)(_),m=function(){g.destroy(new u(f(d)))};null==c||c.on(a,m),null!==(y=null==c?void 0:c.cancelled)&&void 0!==y&&y&&m(),g.setTimeout(1e4,()=>{h.warn({url:f(d)},"The request timed out, or the requester didn't handle the response."),m()}).on("response",e=>r(e)).on("connect",(t,o)=>{h.debug("received CONNECT, continuing with https.request()..."),s.request({method:e,path:d.path,headers:_._headers,socket:o,agent:!1}).on("response",e=>r(e)).on("error",e=>l(e)).end(i)}).on("error",e=>l(e)).end("CONNECT"===_.method.toUpperCase()?void 0:i)}).then(t=>{var r;if(null!==(r=null==c?void 0:c.cancelled)&&void 0!==r&&r)return Promise.reject(new u(f(d)));if([201,301,302,303,307,308].includes(t.statusCode)){let r=d.resolve(t.headers.location||d.href);return h.debug(`Redirect to ${r}`),delete w.host,g(e,r,w,i,o)}return Object.assign(t,{url:d,body:e=>m(t,e),json:()=>b(t),jsonp:()=>v(t)})})},m=(e,t)=>new Promise((t,r)=>{let i=[];e.on("data",e=>i.push(e)).on("end",()=>t(Buffer.concat(i))).on("error",e=>r(e))}).then(r=>{if(r.length)switch(e.headers["content-encoding"]){case"deflate":case"gzip":r=i.unzipSync(r);break;case"br":r=i.brotliDecompressSync(r)}return t?r:r.toString()}),b=e=>m(e,!1).then(e=>JSON.parse(e)),v=e=>m(e,!1).then(e=>JSON.parse(e.slice(e.indexOf("(")+1,-1)));g.read=m,g.create=p,g.translate=d,g.configure=y,e.exports=g},5319:(e,t,r)=>{"use strict";let i=r(5317),{logScope:o}=r(6166),s=r(1828),a=o("spawn");async function u(e,t=[]){return new Promise((r,o)=>{let u=0,c=0,l=Buffer.alloc(5e6),f=Buffer.alloc(5e6),h=i.spawn(e,t);h.on("spawn",()=>{a.info(`running ${e} ${t.join(" ")}`)}),h.on("error",e=>o(e)),h.on("close",t=>{0!==t?o(new s(e,t)):(a.debug(`process ${e} exited successfully`),r({stdout:l.slice(0,u),stderr:f.slice(0,c)}))}),h.stdout.on("data",e=>{u+=e.copy(l,u)}),h.stderr.on("data",t=>{a.warn(`[${e}][stderr] ${t}`),c+=t.copy(f,c)})})}e.exports={spawnStdout:u}},7048:e=>{"use strict";if("undefined"!=typeof SharedArrayBuffer&&"undefined"!=typeof Atomics){let t=new Int32Array(new SharedArrayBuffer(4));e.exports=function(e){if(!1==(e>0&&e<1/0)){if("number"!=typeof e&&"bigint"!=typeof e)throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}Atomics.wait(t,0,0,Number(e))}}else e.exports=function(e){if(!1==(e>0&&e<1/0)){if("number"!=typeof e&&"bigint"!=typeof e)throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}let t=Date.now()+Number(e);for(;t>Date.now(););}},5402:(e,t,r)=>{"use strict";var i;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(s){var a,u,c,l=arguments,f=(a=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,u=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,c=/[^-+\dA-Z]/g,function(e,t,r,i){if(1!==l.length||"string"!==g(e)||/\d/.test(e)||(t=e,e=void 0),(e=e||0===e?e:new Date)instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");var o=(t=String(f.masks[t]||t||f.masks.default)).slice(0,4);("UTC:"===o||"GMT:"===o)&&(t=t.slice(4),r=!0,"GMT:"===o&&(i=!0));var s=function(){return r?"getUTC":"get"},m=function(){return e[s()+"Date"]()},b=function(){return e[s()+"Day"]()},v=function(){return e[s()+"Month"]()},w=function(){return e[s()+"FullYear"]()},_=function(){return e[s()+"Hours"]()},S=function(){return e[s()+"Minutes"]()},x=function(){return e[s()+"Seconds"]()},E=function(){return e[s()+"Milliseconds"]()},O=function(){return r?0:e.getTimezoneOffset()},j=function(){return p(e)},k={d:function(){return m()},dd:function(){return h(m())},ddd:function(){return f.i18n.dayNames[b()]},DDD:function(){return d({y:w(),m:v(),d:m(),_:s(),dayName:f.i18n.dayNames[b()],short:!0})},dddd:function(){return f.i18n.dayNames[b()+7]},DDDD:function(){return d({y:w(),m:v(),d:m(),_:s(),dayName:f.i18n.dayNames[b()+7]})},m:function(){return v()+1},mm:function(){return h(v()+1)},mmm:function(){return f.i18n.monthNames[v()]},mmmm:function(){return f.i18n.monthNames[v()+12]},yy:function(){return String(w()).slice(2)},yyyy:function(){return h(w(),4)},h:function(){return _()%12||12},hh:function(){return h(_()%12||12)},H:function(){return _()},HH:function(){return h(_())},M:function(){return S()},MM:function(){return h(S())},s:function(){return x()},ss:function(){return h(x())},l:function(){return h(E(),3)},L:function(){return h(Math.floor(E()/10))},t:function(){return 12>_()?f.i18n.timeNames[0]:f.i18n.timeNames[1]},tt:function(){return 12>_()?f.i18n.timeNames[2]:f.i18n.timeNames[3]},T:function(){return 12>_()?f.i18n.timeNames[4]:f.i18n.timeNames[5]},TT:function(){return 12>_()?f.i18n.timeNames[6]:f.i18n.timeNames[7]},Z:function(){return i?"GMT":r?"UTC":(String(e).match(u)||[""]).pop().replace(c,"").replace(/GMT\+0000/g,"UTC")},o:function(){return(O()>0?"-":"+")+h(100*Math.floor(Math.abs(O())/60)+Math.abs(O())%60,4)},p:function(){return(O()>0?"-":"+")+h(Math.floor(Math.abs(O())/60),2)+":"+h(Math.floor(Math.abs(O())%60),2)},S:function(){return["th","st","nd","rd"][m()%10>3?0:(m()%100-m()%10!=10)*m()%10]},W:function(){return j()},WW:function(){return h(j())},N:function(){return y(e)}};return t.replace(a,function(e){return e in k?k[e]():e.slice(1,e.length-1)})});f.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},f.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]};var h=function(e,t){for(e=String(e),t=t||2;e.length{var i=r(9491),o=r(5486),s=r(3081),a=r(3049),u=Buffer.from&&Buffer.from!==Uint8Array.from?Buffer.from([0]):new Buffer([0]),c=function(e,t){e._corked?e.once("uncork",t):t()},l=function(e,t){e._autoDestroy&&e.destroy(t)},f=function(e,t){return function(r){r?l(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},h=function(){},d=function(e,t,r){if(!(this instanceof d))return new d(e,t,r);i.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};s(d,i.Duplex),d.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new d(e,t,r)},d.prototype.cork=function(){1==++this._corked&&this.emit("cork")},d.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},d.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed){e&&e.destroy&&e.destroy();return}if(null===e||!1===e){this.end();return}var t=this,r=o(e,{writable:!0,readable:!1},f(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&process.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=function(){t._writable.removeListener("drain",i),r()},this.uncork()},d.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed){e&&e.destroy&&e.destroy();return}if(null===e||!1===e){this.push(null),this.resume();return}var t=this,r=o(e,{writable:!1,readable:!0},f(this)),s=function(){t._forward()},a=function(){t.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:new i.Readable({objectMode:!0,highWaterMark:16}).wrap(e),this._readable2.on("readable",s),this._readable2.on("end",a),this._unread=function(){t._readable2.removeListener("readable",s),t._readable2.removeListener("end",a),r()},this._forward()},d.prototype._read=function(){this._drained=!0,this._forward()},d.prototype._forward=function(){var e;if(!this._forwarding&&this._readable2&&this._drained){for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},d.prototype.destroy=function(e,t){if(t||(t=h),this.destroyed)return t(null);this.destroyed=!0;var r=this;process.nextTick(function(){r._destroy(e),t(null)})},d.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},d.prototype._write=function(e,t,r){if(!this.destroyed){if(this._corked)return c(this,this._write.bind(this,e,t,r));if(e===u)return this._finish(r);if(!this._writable)return r();!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()}},d.prototype._finish=function(e){var t=this;this.emit("preend"),c(this,function(){var r,i;r=t._forwardEnd&&t._writable,i=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),c(t,e)},!r||r._writableState&&r._writableState.finished?i():r._writableState?r.end(i):(r.end(),i())})},d.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(u),i.Writable.prototype.end.call(this,r))},e.exports=d},5486:(e,t,r)=>{var i=r(5645),o=function(){},s=function(e,t,r){if("function"==typeof t)return s(e,null,t);t||(t={}),r=i(r||o);var a=e._writableState,u=e._readableState,c=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,f=!1,h=function(){e.writable||d()},d=function(){l=!1,c||r.call(e)},p=function(){c=!1,l||r.call(e)},y=function(t){r.call(e,t?Error("exited with error code: "+t):null)},g=function(t){r.call(e,t)},m=function(){process.nextTick(b)},b=function(){if(!f&&(c&&!(u&&u.ended&&!u.destroyed)||l&&!(a&&a.ended&&!a.destroyed)))return r.call(e,Error("premature close"))},v=function(){e.req.on("finish",d)};return e.setHeader&&"function"==typeof e.abort?(e.on("complete",d),e.on("abort",m),e.req?v():e.on("request",v)):l&&!a&&(e.on("end",h),e.on("close",h)),e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length&&e.on("exit",y),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",g),e.on("close",m),function(){f=!0,e.removeListener("complete",d),e.removeListener("abort",m),e.removeListener("request",v),e.req&&e.req.removeListener("finish",d),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("exit",y),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}};e.exports=s},4408:(e,t,r)=>{"use strict";let i=r(7054),o=r(2023),s=r(3610),a=r(5014),{groupRedact:u,nestedRedact:c}=r(5158),l=r(6994),f=r(6600),h=i(),d=e=>e;function p(e={}){let t=Array.from(new Set(e.paths||[])),r="serialize"in e?!1===e.serialize?e.serialize:"function"==typeof e.serialize?e.serialize:JSON.stringify:JSON.stringify,i=e.remove;if(!0===i&&r!==JSON.stringify)throw Error("fast-redact – remove option may only be set when serializer is JSON.stringify");let f=!0===i?void 0:"censor"in e?e.censor:"[REDACTED]",y="function"==typeof f,g=y&&f.length>1;if(0===t.length)return r||d;h({paths:t,serialize:r,censor:f});let{wildcards:m,wcLen:b,secret:v}=o({paths:t,censor:f}),w=a({secret:v,wcLen:b});return s({secret:v,wcLen:b,serialize:r,strict:!("strict"in e)||e.strict,isCensorFct:y,censorFctTakesPath:g},l({secret:v,censor:f,compileRestore:w,serialize:r,groupRedact:u,nestedRedact:c,wildcards:m,wcLen:b}))}d.restore=d,p.rx=f,p.validator=i,e.exports=p},5158:e=>{"use strict";function t(e,t){for(var r=-1,i=t.length,o=e;null!=o&&++r{"use strict";let i=r(6600);e.exports=function({paths:e}){let t=[];var r=0;let o=e.reduce(function(e,o,s){var a=o.match(i).map(e=>e.replace(/'|"|`/g,""));let u="["===o[0],c=(a=a.map(e=>"["===e[0]?e.substr(1,e.length-2):e)).indexOf("*");if(c>-1){let e=a.slice(0,c),i=e.join("."),o=a.slice(c+1,a.length);if(o.indexOf("*")>-1)throw Error("fast-redact – Only one wildcard per path is supported");let s=o.length>0;r++,t.push({before:e,beforeStr:i,after:o,nested:s})}else e[o]={path:a,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(o),leadingBracket:u};return e},{});return{wildcards:t,wcLen:r,secret:o}}},3610:(e,t,r)=>{"use strict";let i=r(6600);e.exports=function({secret:e,serialize:t,wcLen:r,strict:o,isCensorFct:s,censorFctTakesPath:a},u){let c=Function("o",` if (typeof o !== 'object' || o == null) { ${!0===o?"throw Error('fast-redact: primitives cannot be redacted')":!1===t?"return o":"return this.serialize(o)"} }