{"version":3,"file":"jwt-decode.js","sources":["../lib/atob.js","../lib/base64_url_decode.js","../lib/index.js","../lib/index.standalone.js"],"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}","/*\n * Expose the function on the window object\n */\nimport jwtDecode from \"./index\";\n\n//use amd or just through the window object.\nif (window) {\n if (typeof window.define == \"function\" && window.define.amd) {\n window.define(\"jwt_decode\", function() {\n return jwtDecode;\n });\n } else if (window) {\n window.jwt_decode = jwtDecode;\n }\n}\n"],"names":[],"mappings":";;;;;IAAA;IACA;IACA;IACA;AACA;IACA,IAAI,KAAK,GAAG,mEAAmE,CAAC;AAChF;IACA,SAAS,qBAAqB,CAAC,OAAO,EAAE;IACxC,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;AACD;IACA,qBAAqB,CAAC,SAAS,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9C,qBAAqB,CAAC,SAAS,CAAC,IAAI,GAAG,uBAAuB,CAAC;AAC/D;IACA,SAAS,QAAQ,CAAC,KAAK,EAAE;IACzB,IAAI,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE;IAC7B,QAAQ,MAAM,IAAI,qBAAqB;IACvC,YAAY,mEAAmE;IAC/E,SAAS,CAAC;IACV,KAAK;IACL,IAAI;IACJ;IACA,QAAQ,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,MAAM,GAAG,EAAE;IACpD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