dzserver/dist/worker.js

10 lines
39 KiB
JavaScript
Raw Normal View History

!function(t){self.webpackChunk=function(e,n){for(var i in n)t[i]=n[i];for(;e.length;)r[e.pop()]=1};var e={},r={0:1},n={};var i={11:function(){return{"./index_bg.js":{__wbindgen_throw:function(t,r){return e[10].exports.b(t,r)}}}}};function a(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.e=function(t){var e=[];return e.push(Promise.resolve().then((function(){r[t]||importScripts(a.p+""+t+".worker.js")}))),({1:[11]}[t]||[]).forEach((function(t){var r=n[t];if(r)e.push(r);else{var o,s=i[t](),u=fetch(a.p+""+{11:"6778a0238c8462ed4a85"}[t]+".module.wasm");if(s instanceof Promise&&"function"==typeof WebAssembly.compileStreaming)o=Promise.all([WebAssembly.compileStreaming(u),s]).then((function(t){return WebAssembly.instantiate(t[0],t[1])}));else if("function"==typeof WebAssembly.instantiateStreaming)o=WebAssembly.instantiateStreaming(u,s);else{o=u.then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,s)}))}e.push(n[t]=o.then((function(e){return a.w[t]=(e.instance||e).exports})))}})),Promise.all(e)},a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a.w={},a(a.s=1)}([function(t,e){t.exports={Router:({base:t="",routes:e=[]}={})=>({__proto__:new Proxy({},{get:(r,n,i)=>(r,...a)=>e.push([n.toUpperCase(),RegExp(`^${(t+r).replace(/(\/?)\*/g,"($1.*)?").replace(/\/$/,"").replace(/:(\w+)(\?)?(\.)?/g,"$2(?<$1>[^/]+)$2$3").replace(/\.(?=[\w(])/,"\\.")}/*$`),a])&&i}),routes:e,async handle(t,...r){let n,i,a=new URL(t.url);for(var[o,s,u]of(t.query=Object.fromEntries(a.searchParams),e))if((o===t.method||"ALL"===o)&&(i=a.pathname.match(s)))for(var f of(t.params=i.groups,u))if(void 0!==(n=await f(t.proxy||t,...r)))return n}})}},function(t,e,r){"use strict";r.r(e),function(t){var e=r(0);const n=r(7),i=Object(e.Router)(),a={aac_96:{num:"8",gw:"AAC_96",mime:"audio/aac"},64:{num:"10",gw:"MP3_64",mime:"audio/mpeg"},128:{num:"1",gw:"MP3_128",mime:"audio/mpeg"},320:{num:"3",gw:"MP3_320",mime:"audio/mpeg"},flac:{num:"9",gw:"FLAC",mime:"audio/flac"},mp4_ra1:{num:"13",gw:"MP4_RA1",mime:"audio/mp4"},mp4_ra2:{num:"14",gw:"MP4_RA2",mime:"audio/mp4"},mp4_ra3:{num:"15",gw:"MP4_RA3",mime:"audio/mp4"},mhm1_ra1:{num:"16",gw:"MHM1_RA1",mime:"audio/mp4"},mhm1_ra2:{num:"17",gw:"MHM1_RA2",mime:"audio/mp4"},mhm1_ra3:{num:"18",gw:"MHM1_RA3",mime:"audio/mp4"},sbc_256:{num:"12",gw:"SBC_256",mime:""},misc:{num:"0",gw:"MP3_MISC",mime:"audio/mpeg"}};async function o(t,e){"deezer.getUserData"===t&&(u=""),e||(e={});let r="arl="+ARL;f&&(r+="; sid="+f);const n={method:"POST",headers:new Headers({cookie:r}),body:JSON.stringify(e)},i=await fetch(`https://www.deezer.com/ajax/gw-light.php?method=${t}&input=3&api_version=1.0&api_token=${encodeURIComponent(u)}&cid=${Math.floor(1e9*Math.random())}`,n),a=await i.json();return 0!==a.error.length?new Response(JSON.stringify(a.error),{status:500,headers:{"content-type":"application/json"}}):("deezer.getUserData"===t&&(u=a.results.checkForm,await KV.put("checkForm",u),f=i.headers.get("set-cookie").split(",").map(t=>t.trimStart())[0],f=f.match(/^sid=(fr[\da-f]+)/)[1],await KV.put("sid",f)),a.results)}let s,u,f,c;i.get("/:type/:id",async e=>{const{query:i}=e;let{type:h,id:l}=e.params;if(!["track","album","playlist"].includes(h))return new Response("not found",{status:404,headers:{"content-type":"text/plain"}});if(l=parseInt(l),NaN===l||"track"!==
2021-05-25 21:42:00 +00:00
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var n=r(4),i=r(5),a=r(6);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(o()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|p(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):l(t,e);if("Buffer"===e.type&&a(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(c(e),t=s(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|p(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(n)return D(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return R(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){var a,o=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"
2021-05-25 21:42:00 +00:00
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
e.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,f=u>>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=l,c-=8);if(0===a)a=1-f;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=f}return(p?-1:1)*o*Math.pow(2,a-n)},e.write=function(t,e,r,n,i,a){var o,s,u,f=8*a-i-1,c=(1<<f)-1,h=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,g=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(e*u-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&s,p+=g,s/=256,i-=8);for(o=o<<i|s,f+=i;f>0;t[r+p]=255&o,p+=g,o/=256,f-=8);t[r+p-g]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){t.exports=function(){"use strict";function t(t){return String(t).split("").map((function(t){return t.charCodeAt(0)}))}function e(e){return new Uint8Array(t(e))}function r(e){var r=new Uint8Array(2*e.length);return new Uint16Array(r.buffer).set(t(e)),r}return function(){var t=n.prototype;function n(t){if(!t||"object"!=typeof t||!("byteLength"in t))throw new Error("First argument should be an instance of ArrayBuffer or Buffer");this.arrayBuffer=t,this.padding=4096,this.frames=[],this.url=""}return t._setIntegerFrame=function(t,e){var r=parseInt(e,10);this.frames.push({name:t,value:r,size:11+r.toString().length})},t._setStringFrame=function(t,e){var r=e.toString();this.frames.push({name:t,value:r,size:13+2*r.length})},t._setPictureFrame=function(t,e,r,n){var i,a,o,s=function(t){if(!t||!t.length)return null;if(255===t[0]&&216===t[1]&&255===t[2])return"image/jpeg";if(137===t[0]&&80===t[1]&&78===t[2]&&71===t[3])return"image/png";if(71===t[0]&&73===t[1]&&70===t[2])return"image/gif";if(87===t[8]&&69===t[9]&&66===t[10]&&80===t[11])return"image/webp";var e=73===t[0]&&73===t[1]&&42===t[2]&&0===t[3],r=77===t[0]&&77===t[1]&&0===t[2]&&42===t[3];return e||r?"image/tiff":66===t[0]&&77===t[1]?"image/bmp":0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?"image/x-icon":null}(new Uint8Array(e)),u=r.toString();if(!s)throw new Error("Unknown picture MIME type");r||(n=!1),this.frames.push({name:"APIC",value:e,pictureType:t,mimeType:s,useUnicodeEncoding:n,description:u,size:(i=e.byteLength,a=s.length,o=u.length,11+a+1+1+(n?2+2*(o+1):o+1)+i)})},t._setLyricsFrame=function(t,e,r){var n,i,a=t.split("").map((function(t){return t.charCodeAt(0)})),o=e.toString(),s=r.toString();this.frames.push({name:"USLT",value:s,language:a,description:o,size:(n=o.length,i=s.length,16+2*n+2+2+2*i)})},t._setCommentFrame=function(t,e,r){var n,i,a=t.split("").map((function(t){return t.charCodeAt(0)})),o=e.toString(),s=r.toString();this.frames.push({name:"COMM",value:s,language:a,description:o,size:(n=o.length,i=s.length,16+2*n+2+2+2*i)})},t._setPrivateFrame=function(t,e){var r,n,i=t.toString();this.frames.push({name:"PRIV",value:e,id:i,size:(r=i.length,n=e.byteLength,10+r+1+n)})},t._setUserStringFrame=function(t,e){var r,n,i=t.toString(),a=e.toString();this.frames.push({name:"TXXX",description:i,value:a,size:(r=i.length,n=a.length,13+2*r+2+2+2*n)})},t._setUrlLinkFrame=function(t,e){var r=e.toString();this.frames.push({name:t,value:r,size:10+r.length})},t.setFrame=function(t,e){switch(t){case"TPE1":case"TCOM":case"TCON":if(!Array.isArray(e))throw new Error(t+" frame value should be an array of strings");var r="TCON"===t?";":"/",n=e.join(r);this._setStringFrame(t,n);break;case"TLAN":case"TIT1":case"TIT2":case"TIT3":case"TALB":case"TPE2":case"TPE3":case"TPE4":case"TRCK":case"TPOS":case"TMED":case"TPUB":case"TCOP":case"TKEY":case"TEXT":case"TSRC":this._setStringFrame(t,e);break;case"TBPM":case"TLEN":case"TDAT":case"TYER":this._setIntegerFrame(t,e);break;case"USLT":if(e.language=e.language||"eng","object"!=typeof e||!("description"in e)||!("lyrics"in e))throw new Error("USLT frame value should be an object with ke