1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- (function() {
- 'use strict';
- var object = (
-
- typeof exports === 'object' && exports != null &&
- typeof exports.nodeType !== 'number' ?
- exports :
-
- typeof self !== 'undefined' ?
- self :
-
- $.global
- );
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
- function InvalidCharacterError(message) {
- this.message = message;
- }
- InvalidCharacterError.prototype = new Error ();
- InvalidCharacterError.prototype.name = 'InvalidCharacterError';
-
-
- object.btoa || (
- object.btoa = function(input) {
- var str = String (input);
- for (
-
- var block, charCode, idx = 0, map = chars, output = '';
-
-
-
- str.charAt (idx | 0) || (map = '=', idx % 1);
-
- output += map.charAt (63 & block >> 8 - idx % 1 * 8)
- ) {
- charCode = str.charCodeAt (idx += 3 / 4);
- if (charCode > 0xFF) {
- throw new InvalidCharacterError ("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
- }
- block = block << 8 | charCode;
- }
- return output;
- });
-
-
- object.atob || (
- object.atob = function(input) {
- var str = (String (input)).replace (/[=]+$/, '');
- if (str.length % 4 === 1) {
- throw new InvalidCharacterError ("'atob' failed: The string to be decoded is not correctly encoded.");
- }
- for (
-
- var bc = 0, bs, buffer, idx = 0, output = '';
-
- buffer = str.charAt (idx++);
-
- ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
-
-
- bc++ % 4) ? output += String.fromCharCode (255 & bs >> (-2 * bc & 6)) : 0
- ) {
-
- buffer = chars.indexOf (buffer);
- }
- return output;
- });
- } ());
|