@zklogic/draw.io
Version:
Draw.IO - Graph Editor integration in Angular-cli
1 lines • 1.53 kB
JavaScript
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(r,t){var e,o,a,h,n,c,d,C="",i=0;for((t=null!=t&&t)||(r=Base64._utf8_encode(r));i<r.length;)h=(e=r.charCodeAt(i++))>>2,n=(3&e)<<4|(o=r.charCodeAt(i++))>>4,c=(15&o)<<2|(a=r.charCodeAt(i++))>>6,d=63&a,isNaN(o)?c=d=64:isNaN(a)&&(d=64),C=C+this._keyStr.charAt(h)+this._keyStr.charAt(n)+this._keyStr.charAt(c)+this._keyStr.charAt(d);return C},decode:function(r,t){t=null!=t&&t;var e,o,a,h,n,c,d="",C=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");C<r.length;)e=this._keyStr.indexOf(r.charAt(C++))<<2|(h=this._keyStr.indexOf(r.charAt(C++)))>>4,o=(15&h)<<4|(n=this._keyStr.indexOf(r.charAt(C++)))>>2,a=(3&n)<<6|(c=this._keyStr.indexOf(r.charAt(C++))),d+=String.fromCharCode(e),64!=n&&(d+=String.fromCharCode(o)),64!=c&&(d+=String.fromCharCode(a));return t||(d=Base64._utf8_decode(d)),d},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var t="",e=0;e<r.length;e++){var o=r.charCodeAt(e);o<128?t+=String.fromCharCode(o):o>127&&o<2048?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128))}return t},_utf8_decode:function(r){for(var t="",e=0,o=c1=c2=0;e<r.length;)(o=r.charCodeAt(e))<128?(t+=String.fromCharCode(o),e++):o>191&&o<224?(c2=r.charCodeAt(e+1),t+=String.fromCharCode((31&o)<<6|63&c2),e+=2):(c2=r.charCodeAt(e+1),c3=r.charCodeAt(e+2),t+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),e+=3);return t}};