UNPKG

octopus-ad

Version:

Quickapp Sample Template

1 lines 1.58 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Base64=void 0;const Base64=exports.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(r){var e,t,o,a,h,n,d="",c=0;for(r=Base64._utf8_encode(r);c<r.length;)o=(e=r.charCodeAt(c++))>>2,a=(3&e)<<4|(e=r.charCodeAt(c++))>>4,h=(15&e)<<2|(t=r.charCodeAt(c++))>>6,n=63&t,isNaN(e)?h=n=64:isNaN(t)&&(n=64),d=d+this._keyStr.charAt(o)+this._keyStr.charAt(a)+this._keyStr.charAt(h)+this._keyStr.charAt(n);return d},decode:function(r){var e,t,o,a,h,n,d="",c=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<r.length;)o=this._keyStr.indexOf(r.charAt(c++)),e=(15&(a=this._keyStr.indexOf(r.charAt(c++))))<<4|(h=this._keyStr.indexOf(r.charAt(c++)))>>2,t=(3&h)<<6|(n=this._keyStr.indexOf(r.charAt(c++))),d+=String.fromCharCode(o<<2|a>>4),64!=h&&(d+=String.fromCharCode(e)),64!=n&&(d+=String.fromCharCode(t));return d=Base64._utf8_decode(d)},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var e="",t=0;t<r.length;t++){var o=r.charCodeAt(t);o<128?e+=String.fromCharCode(o):e=127<o&&o<2048?(e+=String.fromCharCode(o>>6|192))+String.fromCharCode(63&o|128):(e=(e+=String.fromCharCode(o>>12|224))+String.fromCharCode(o>>6&63|128))+String.fromCharCode(63&o|128)}return e},_utf8_decode:function(r){for(var e,t="",o=0,a=0;o<r.length;)(e=r.charCodeAt(o))<128?(t+=String.fromCharCode(e),o++):191<e&&e<224?(a=r.charCodeAt(o+1),t+=String.fromCharCode((31&e)<<6|63&a),o+=2):(a=r.charCodeAt(o+1),c3=r.charCodeAt(o+2),t+=String.fromCharCode((15&e)<<12|(63&a)<<6|63&c3),o+=3);return t}};