/*
 * Copyright 2018 Scytl Secure Electronic Voting SA
 *
 * All rights reserved
 *
 * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
 */
var B64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",encode:function(r){var e,t,o,a,n,c,d,h="",C=0;for(r=B64._utf8_encode(r);C<r.length;)a=(e=r.charCodeAt(C++))>>2,n=(3&e)<<4|(t=r.charCodeAt(C++))>>4,c=(15&t)<<2|(o=r.charCodeAt(C++))>>6,d=63&o,isNaN(t)?c=d=64:isNaN(o)&&(d=64),h=h+B64._keyStr.charAt(a)+B64._keyStr.charAt(n)+B64._keyStr.charAt(c)+B64._keyStr.charAt(d);return h},decode:function(r){var e,t,o,a,n,c,d="",h=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<r.length;)e=B64._keyStr.indexOf(r.charAt(h++))<<2|(a=B64._keyStr.indexOf(r.charAt(h++)))>>4,t=(15&a)<<4|(n=B64._keyStr.indexOf(r.charAt(h++)))>>2,o=(3&n)<<6|(c=B64._keyStr.indexOf(r.charAt(h++))),d+=String.fromCharCode(e),64!=n&&(d+=String.fromCharCode(t)),64!=c&&(d+=String.fromCharCode(o));return d=B64._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):o>127&&o<2048?(e+=String.fromCharCode(o>>6|192),e+=String.fromCharCode(63&o|128)):(e+=String.fromCharCode(o>>12|224),e+=String.fromCharCode(o>>6&63|128),e+=String.fromCharCode(63&o|128))}return e},_utf8_decode:function(r){for(var e="",t=0,o=c1=c2=0;t<r.length;)(o=r.charCodeAt(t))<128?(e+=String.fromCharCode(o),t++):o>191&&o<224?(c2=r.charCodeAt(t+1),e+=String.fromCharCode((31&o)<<6|63&c2),t+=2):(c2=r.charCodeAt(t+1),c3=r.charCodeAt(t+2),e+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),t+=3);return e}};