mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
7.6 KiB
JSON
1 line
7.6 KiB
JSON
{"ast":null,"code":"function e(e) {\n this.message = e;\n}\n\ne.prototype = new Error(), e.prototype.name = \"InvalidCharacterError\";\n\nvar r = \"undefined\" != typeof window && window.atob && window.atob.bind(window) || function (r) {\n var t = String(r).replace(/=+$/, \"\");\n if (t.length % 4 == 1) throw new e(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n\n for (var n, o, a = 0, i = 0, c = \"\"; o = t.charAt(i++); ~o && (n = a % 4 ? 64 * n + o : o, a++ % 4) ? c += String.fromCharCode(255 & n >> (-2 * a & 6)) : 0) o = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".indexOf(o);\n\n return c;\n};\n\nfunction t(e) {\n var t = e.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n switch (t.length % 4) {\n case 0:\n break;\n\n case 2:\n t += \"==\";\n break;\n\n case 3:\n t += \"=\";\n break;\n\n default:\n throw \"Illegal base64url string!\";\n }\n\n try {\n return function (e) {\n return decodeURIComponent(r(e).replace(/(.)/g, function (e, r) {\n var t = r.charCodeAt(0).toString(16).toUpperCase();\n return t.length < 2 && (t = \"0\" + t), \"%\" + t;\n }));\n }(t);\n } catch (e) {\n return r(t);\n }\n}\n\nfunction n(e) {\n this.message = e;\n}\n\nfunction o(e, r) {\n if (\"string\" != typeof e) throw new n(\"Invalid token specified\");\n var o = !0 === (r = r || {}).header ? 0 : 1;\n\n try {\n return JSON.parse(t(e.split(\".\")[o]));\n } catch (e) {\n throw new n(\"Invalid token specified: \" + e.message);\n }\n}\n\nn.prototype = new Error(), n.prototype.name = \"InvalidTokenError\";\nexport default o;\nexport { n as InvalidTokenError };","map":{"version":3,"sources":["../lib/atob.js","../lib/base64_url_decode.js","../lib/index.js"],"names":["InvalidCharacterError","message","this","prototype","Error","name","input","str","String","replace","length","bc","bs","buffer","idx","output","charAt","fromCharCode","indexOf","window","atob","bind","decodeURIComponent","m","p","code","charCodeAt","toString","toUpperCase","b64DecodeUnicode","err","InvalidTokenError","token","options","pos","header","JSON","parse","base64_url_decode","split","e"],"mappings":"AAOA,SAASA,CAAT,CAA+BC,CAA/B,EAA+BA;AAC3BC,OAAKD,OAALC,GAAeD,CAAfC;AAGJF;;AAAAA,CAAAA,CAAsBG,SAAtBH,GAAkC,IAAII,KAAJ,EAAlCJ,EACAA,CAAAA,CAAsBG,SAAtBH,CAAgCK,IAAhCL,GAAuC,uBADvCA;;AA8BA,IAAA,CAAA,GAAkC,eAAA,OAAXmB,MAAW,IAC9BA,MAAAA,CAAOC,IADuB,IAE9BD,MAAAA,CAAOC,IAAPD,CAAYE,IAAZF,CAAiBA,MAAjBA,CAF8B,IA3BlC,UAAkBb,CAAlB,EAAkBA;AACd,MAAIC,CAAAA,GAAMC,MAAAA,CAAOF,CAAPE,CAAAA,CAAcC,OAAdD,CAAsB,KAAtBA,EAA6B,EAA7BA,CAAV;AACA,MAAID,CAAAA,CAAIG,MAAJH,GAAa,CAAbA,IAAkB,CAAtB,EACI,MAAM,IAAIP,CAAJ,CACF,mEADE,CAAN;;AAIJ,OAEI,IAAYY,CAAZ,EAAgBC,CAAhB,EAAIF,CAAAA,GAAK,CAAT,EAAwBG,CAAAA,GAAM,CAA9B,EAAiCC,CAAAA,GAAS,EAF9C,EAIKF,CAAAA,GAASN,CAAAA,CAAIS,MAAJT,CAAWO,CAAAA,EAAXP,CAJd,EAIyBO,CAEpBD,CAFoBC,KAGnBF,CAAAA,GAAKD,CAAAA,GAAK,CAALA,GAAc,KAALC,CAAK,GAAKC,CAAnBF,GAA4BE,CAAjCD,EAGED,CAAAA,KAAO,CANUG,IAOpBC,CAAAA,IAAUP,MAAAA,CAAOS,YAAPT,CAAoB,MAAOI,CAAAA,KAAAA,CAAS,CAATA,GAAaD,CAAbC,GAAmB,CAAnBA,CAA3BJ,CAPUM,GAQrB,CAZJ,EAeID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,CAAJ,CAAsB,yBAAtB,CAAN;AAIJ,MAAIG,CAAAA,GAAAA,CAAyB,CAAzBA,KAAyB,CAD7BD,CAAAA,GAAUA,CAAAA,IAAW,EACQ,EAAXE,MAAdD,GAAgC,CAAhCA,GAAoC,CAAxC;;AACA,MAAA;AACI,WAAOE,IAAAA,CAAKC,KAALD,CAAWE,CAAAA,CAAkBN,CAAAA,CAAMO,KAANP,CAAY,GAAZA,EAAiBE,CAAjBF,CAAlBM,CAAXF,CAAP;AACF,GAFF,CAEE,OAAOI,CAAP,EAAOA;AACL,UAAM,IAAIT,CAAJ,CAAsB,8BAA8BS,CAAAA,CAAEvC,OAAtD,CAAN;AAA4DA;AAbpE8B;;AAAAA,CAAAA,CAAkB5B,SAAlB4B,GAA8B,IAAI3B,KAAJ,EAA9B2B,EACAA,CAAAA,CAAkB5B,SAAlB4B,CAA4B1B,IAA5B0B,GAAmC,mBADnCA;AACmC,eAAA,CAAA;AAAA,SAAA,CAAA,IAAA,iBAAA","sourcesContent":["/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = \"InvalidCharacterError\";\n\nfunction polyfill(input) {\n var str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\n \"'atob' failed: The string to be decoded is not correctly encoded.\"\n );\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? bs * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\nexport default (typeof window !== \"undefined\" &&\n window.atob &&\n window.atob.bind(window)) ||\npolyfill;","import atob from \"./atob\";\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(\n atob(str).replace(/(.)/g, function(m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n })\n );\n}\n\nexport default function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try {\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n}","\"use strict\";\n\nimport base64_url_decode from \"./base64_url_decode\";\n\nexport function InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\n\nexport default function(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified\");\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split(\".\")[pos]));\n } catch (e) {\n throw new InvalidTokenError(\"Invalid token specified: \" + e.message);\n }\n}"]},"metadata":{},"sourceType":"module"} |