!function(t,n){var r,e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r=t.Base64,(e=n()).noConflict=function(){return t.Base64=r,e},t.Meteor&&(Base64=e),t.Base64=e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,(function(){"use strict";var t,n="3.7.6",r=n,e="function"==typeof atob,o="function"==typeof btoa,u="function"==typeof Buffer,i="function"==typeof TextDecoder?new TextDecoder:void 0,f="function"==typeof TextEncoder?new TextEncoder:void 0,c=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),a=(t={},c.forEach((function(n,r){return t[n]=r})),t),d=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,s=String.fromCharCode.bind(String),l="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},h=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},p=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var n,r,e,o,u="",i=t.length%3,f=0;f<t.length;){if((r=t.charCodeAt(f++))>255||(e=t.charCodeAt(f++))>255||(o=t.charCodeAt(f++))>255)throw new TypeError("invalid character found");u+=c[(n=r<<16|e<<8|o)>>18&63]+c[n>>12&63]+c[n>>6&63]+c[63&n]}return i?u.slice(0,i-3)+"===".substring(i):u},A=o?function(t){return btoa(t)}:u?function(t){return Buffer.from(t,"binary").toString("base64")}:y,b=u?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var n=[],r=0,e=t.length;r<e;r+=4096)n.push(s.apply(null,t.subarray(r,r+4096)));return A(n.join(""))},g=function(t,n){return void 0===n&&(n=!1),n?h(b(t)):b(t)},B=function(t){if(t.length<2)return(n=t.charCodeAt(0))<128?t:n<2048?s(192|n>>>6)+s(128|63&n):s(224|n>>>12&15)+s(128|n>>>6&63)+s(128|63&n);var n=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return s(240|n>>>18&7)+s(128|n>>>12&63)+s(128|n>>>6&63)+s(128|63&n)},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(t){return t.replace(x,B)},m=u?function(t){return Buffer.from(t,"utf8").toString("base64")}:f?function(t){return b(f.encode(t))}:function(t){return A(C(t))},v=function(t,n){return void 0===n&&(n=!1),n?h(m(t)):m(t)},U=function(t){return v(t,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=function(t){switch(t.length){case 4:var n=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return s(55296+(n>>>10))+s(56320+(1023&n));case 3:return s((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return s((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},S=function(t){return t.replace(F,w)},E=function(t){if(t=t.replace(/\s+/g,""),!d.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var n,r,e,o="",u=0;u<t.length;)n=a[t.charAt(u++)]<<18|a[t.charAt(u++)]<<12|(r=a[t.charAt(u++)])<<6|(e=a[t.charAt(u++)]),o+=64===r?s(n>>16&255):64===e?s(n>>16&255,n>>8&255):s(n>>16&255,n>>8&255,255&n);return o},D=e?function(t){return atob(p(t))}:u?function(t){return Buffer.from(t,"base64").toString("binary")}:E,R=u?function(t){return l(Buffer.from(t,"base64"))}:function(t){return l(D(t).split("").map((function(t){return t.charCodeAt(0)})))},z=function(t){return R(Z(t))},T=u?function(t){return Buffer.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(R(t))}:function(t){return S(D(t))},Z=function(t){return p(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},j=function(t){return T(Z(t))},I=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},O=function(){var t=function(t,n){return Object.defineProperty(String.prototype,t,I(n))};t("fromBase64",(function(){return j(this)})),t("toBase64",(function(t){return v(this,t)})),t("toBase64URI",(function(){return v(this,!0)})),t("toBase64URL",(function(){return v(this,!0)})),t("toUint8Array",(function(){return z(this)}))},P=function(){var t=function(t,n){return Object.defineProperty(Uint8Array.prototype,t,I(n))};t("toBase64",(function(t){return g(this,t)})),t("toBase64URI",(function(){return g(this,!0)})),t("toBase64URL",(function(){return g(this,!0)}))},L={version:n,VERSION:r,atob:D,atobPolyfill:E,btoa:A,btoaPolyfill:y,fromBase64:j,toBase64:v,encode:v,encodeURI:U,encodeURL:U,utob:C,btou:S,decode:j,isValid:function(t){if("string"!=typeof t)return!1;var n=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(n)||!/[^\s0-9a-zA-Z\-_]/.test(n)},fromUint8Array:g,toUint8Array:z,extendString:O,extendUint8Array:P,extendBuiltins:function(){O(),P()},Base64:{}};return Object.keys(L).forEach((function(t){return L.Base64[t]=L[t]})),L}));