diff --git a/examples/client/vendor/satellizer.js b/examples/client/vendor/satellizer.js index 4f7bafff..25437616 100644 --- a/examples/client/vendor/satellizer.js +++ b/examples/client/vendor/satellizer.js @@ -37,7 +37,7 @@ facebook: { url: '/auth/facebook', authorizationEndpoint: 'https://www.facebook.com/dialog/oauth', - redirectUri: window.location.origin + '/' || window.location.protocol + '//' + window.location.host + '/', + redirectUri: window.location.origin ? window.location.origin + '/' : window.location.protocol + '//' + window.location.host + '/', scope: ['email'], scopeDelimiter: ',', requiredUrlParams: ['display', 'scope'], diff --git a/satellizer.js b/satellizer.js index 4f7bafff..25437616 100644 --- a/satellizer.js +++ b/satellizer.js @@ -37,7 +37,7 @@ facebook: { url: '/auth/facebook', authorizationEndpoint: 'https://www.facebook.com/dialog/oauth', - redirectUri: window.location.origin + '/' || window.location.protocol + '//' + window.location.host + '/', + redirectUri: window.location.origin ? window.location.origin + '/' : window.location.protocol + '//' + window.location.host + '/', scope: ['email'], scopeDelimiter: ',', requiredUrlParams: ['display', 'scope'], diff --git a/satellizer.min.js b/satellizer.min.js index 93e0bfc4..b69bba3a 100644 --- a/satellizer.min.js +++ b/satellizer.min.js @@ -1 +1 @@ -!function(e,t){"use strict";t.module("satellizer",[]).constant("satellizer.config",{loginOnSignup:!0,loginRedirect:"/",logoutRedirect:"/",signupRedirect:"/login",loginUrl:"/auth/login",signupUrl:"/auth/signup",loginRoute:"/login",signupRoute:"/signup",tokenName:"token",tokenPrefix:"satellizer",unlinkUrl:"/auth/unlink/",providers:{google:{url:"/auth/google",authorizationEndpoint:"https://accounts.google.com/o/oauth2/auth",redirectUri:e.location.origin||e.location.protocol+"//"+e.location.host,scope:["profile","email"],scopePrefix:"openid",scopeDelimiter:" ",requiredUrlParams:["scope"],optionalUrlParams:["display"],display:"popup",type:"2.0",popupOptions:{width:452,height:633}},facebook:{url:"/auth/facebook",authorizationEndpoint:"https://www.facebook.com/dialog/oauth",redirectUri:e.location.origin+"/"||e.location.protocol+"//"+e.location.host+"/",scope:["email"],scopeDelimiter:",",requiredUrlParams:["display","scope"],display:"popup",type:"2.0",popupOptions:{width:481,height:269}},linkedin:{url:"/auth/linkedin",authorizationEndpoint:"https://www.linkedin.com/uas/oauth2/authorization",redirectUri:e.location.origin||e.location.protocol+"//"+e.location.host,requiredUrlParams:["state"],scope:["r_emailaddress"],scopeDelimiter:" ",state:"STATE",type:"2.0",popupOptions:{width:527,height:582}},github:{name:"github",url:"/auth/github",authorizationEndpoint:"https://github.com/login/oauth/authorize",redirectUri:e.location.origin||e.location.protocol+"//"+e.location.host,scope:[],scopeDelimiter:" ",type:"2.0",popupOptions:{width:1020,height:618}},twitter:{url:"/auth/twitter",type:"1.0",popupOptions:{width:495,height:645}},yahoo:{url:"/auth/yahoo",type:"1.0",popupOptions:{width:559,height:519}}}}).provider("$auth",["satellizer.config",function(e){Object.defineProperties(this,{logoutRedirect:{get:function(){return e.logoutRedirect},set:function(t){e.logoutRedirect=t}},loginRedirect:{set:function(t){e.loginRedirect=t},get:function(){return e.loginRedirect}},signupRedirect:{get:function(){return e.signupRedirect},set:function(t){e.signupRedirect=t}},loginOnSignup:{get:function(){return e.loginOnSignup},set:function(t){e.loginOnSignup=t}},loginUrl:{get:function(){return e.loginUrl},set:function(t){e.loginUrl=t}},signupUrl:{get:function(){return e.signupUrl},set:function(t){e.signupUrl=t}},loginRoute:{get:function(){return e.loginRoute},set:function(t){e.loginRoute=t}},signupRoute:{get:function(){return e.signupRoute},set:function(t){e.signupRoute=t}},tokenName:{get:function(){return e.tokenName},set:function(t){e.tokenName=t}},tokenPrefix:{get:function(){return e.tokenPrefix},set:function(t){e.tokenPrefix=t}},unlinkUrl:{get:function(){return e.unlinkUrl},set:function(t){e.unlinkUrl=t}}}),t.forEach(Object.keys(e.providers),function(n){this[n]=function(o){return t.extend(e.providers[n],o)}},this);var n=function(n){e.providers[n.name]=e.providers[n.name]||{},t.extend(e.providers[n.name],n)};this.oauth1=function(t){n(t),e.providers[t.name].type="1.0"},this.oauth2=function(t){n(t),e.providers[t.name].type="2.0"},this.$get=["$q","satellizer.shared","satellizer.local","satellizer.oauth",function(e,t,n,o){var r={};return r.authenticate=function(e,t){return o.authenticate(e,!1,t)},r.login=function(e){return n.login(e)},r.signup=function(e){return n.signup(e)},r.logout=function(){return t.logout()},r.isAuthenticated=function(){return t.isAuthenticated()},r.link=function(e,t){return o.authenticate(e,!0,t)},r.unlink=function(e){return o.unlink(e)},r}]}]).factory("satellizer.shared",["$q","$window","$location","satellizer.config",function(e,t,n,o){var r={};return r.saveToken=function(e,r,i){var u=e.data[o.tokenName],a=o.tokenPrefix?o.tokenPrefix+"_"+o.tokenName:o.tokenName;t.localStorage[a]=u,o.loginRedirect&&!i&&n.path(o.loginRedirect),r.resolve(e)},r.isAuthenticated=function(){var e=o.tokenPrefix?o.tokenPrefix+"_"+o.tokenName:o.tokenName,n=t.localStorage[e];if(n){var r=n.split(".")[1],i=r.replace("-","+").replace("_","/"),u=JSON.parse(t.atob(i)).exp;return Math.round((new Date).getTime()/1e3)<=u}return!1},r.logout=function(){var r=e.defer(),i=o.tokenPrefix?o.tokenPrefix+"_"+o.tokenName:o.tokenName;return delete t.localStorage[i],o.logoutRedirect&&n.path(o.logoutRedirect),r.resolve(),r.promise},r}]).factory("satellizer.oauth",["$q","$http","satellizer.config","satellizer.shared","satellizer.Oauth1","satellizer.Oauth2",function(e,t,n,o,r,i){var u={};return u.authenticate=function(t,u,a){var l=e.defer(),c="1.0"===n.providers[t].type?new r:new i;return c.open(n.providers[t],a||{}).then(function(e){o.saveToken(e,l,u)}).then(null,function(e){l.reject(e)}),l.promise},u.unlink=function(e){return t.get(n.unlinkUrl+e)},u}]).factory("satellizer.local",["$q","$http","$location","satellizer.utils","satellizer.shared","satellizer.config",function(e,t,n,o,r,i){var u={};return u.login=function(n){var o=e.defer();return t.post(i.loginUrl,n).then(function(e){r.saveToken(e,o)}).then(null,function(e){o.reject(e)}),o.promise},u.signup=function(o){var u=e.defer();return t.post(i.signupUrl,o).then(function(e){i.loginOnSignup?r.saveToken(e,u):(n.path(i.signupRedirect),u.resolve(e))}).then(null,function(e){u.reject(e)}),u.promise},u}]).factory("satellizer.Oauth2",["$q","$http","satellizer.popup","satellizer.utils",function(e,n,o,r){return function(){var i={url:null,name:null,scope:null,scopeDelimiter:null,clientId:null,redirectUri:null,popupOptions:null,authorizationEndpoint:null,requiredUrlParams:null,optionalUrlParams:null,defaultUrlParams:["response_type","client_id","redirect_uri"],responseType:"code"},u={};return u.open=function(n,r){t.extend(i,n);var a=e.defer(),l=u.buildUrl();return o.open(l,i.popupOptions).then(function(e){u.exchangeForToken(e,r).then(function(e){a.resolve(e)}).then(null,function(e){a.reject(e)})}).then(null,function(e){a.reject(e)}),a.promise},u.exchangeForToken=function(e,o){var r=t.extend({},o,{code:e.code,clientId:i.clientId,redirectUri:i.redirectUri});return n.post(i.url,r)},u.buildUrl=function(){var e=i.authorizationEndpoint,t=u.buildQueryString();return[e,t].join("?")},u.buildQueryString=function(){var e=[],n=["defaultUrlParams","requiredUrlParams","optionalUrlParams"];return t.forEach(n,function(n){t.forEach(i[n],function(t){var n=r.camelCase(t),o=i[n];"scope"===t&&Array.isArray(o)&&(o=o.join(i.scopeDelimiter),i.scopePrefix&&(o=[i.scopePrefix,o].join(i.scopeDelimiter))),e.push([t,encodeURIComponent(o)])})}),e.map(function(e){return e.join("=")}).join("&")},u}}]).factory("satellizer.Oauth1",["$q","$http","satellizer.popup",function(e,n,o){return function(){var r={url:null,name:null,popupOptions:null},i={};return i.open=function(n,u){t.extend(r,n);var a=e.defer();return o.open(r.url,r.popupOptions).then(function(e){i.exchangeForToken(e,u).then(function(e){a.resolve(e)}).then(null,function(e){a.reject(e)})}).then(null,function(e){a.reject(e)}),a.promise},i.exchangeForToken=function(e,o){var u=t.extend({},o,e),a=i.buildQueryString(u);return n.get(r.url+"?"+a)},i.buildQueryString=function(e){var n=[];return t.forEach(e,function(e,t){n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),n.join("&")},i}}]).factory("satellizer.popup",["$q","$interval","$window","$location","satellizer.utils",function(n,o,r,i,u){var a=null,l=null,c={};return c.popupWindow=a,c.open=function(t,o){var r=n.defer(),i=c.stringifyOptions(c.prepareOptions(o||{}));return a=e.open(t,"_blank",i),a&&a.focus&&a.focus(),c.pollPopup(r),r.promise},c.pollPopup=function(e){l=o(function(){try{if(a.document.domain===document.domain&&a.location.search){var t=a.location.search.substring(1).replace(/\/$/,""),n=Object.keys(i.search()).length?i.search():u.parseQueryString(t);n.oauth_token&&n.oauth_verifier?e.resolve({oauth_token:n.oauth_token,oauth_verifier:n.oauth_verifier}):n.code?e.resolve({code:n.code}):n.error&&e.reject({error:n.error}),a.close(),o.cancel(l)}}catch(r){}a.closed&&(o.cancel(l),e.reject({data:"Authorization Failed"}))},35)},c.prepareOptions=function(e){var n=e.width||500,o=e.height||500;return t.extend({width:n,height:o,left:r.screenX+(r.outerWidth-n)/2,top:r.screenY+(r.outerHeight-o)/2.5},e)},c.stringifyOptions=function(e){var n=[];return t.forEach(e,function(e,t){n.push(t+"="+e)}),n.join(",")},c}]).service("satellizer.utils",function(){this.camelCase=function(e){return e.replace(/([\:\-\_]+(.))/g,function(e,t,n,o){return o?n.toUpperCase():n})},this.parseQueryString=function(e){var n,o,r={};return t.forEach((e||"").split("&"),function(e){e&&(o=e.split("="),n=decodeURIComponent(o[0]),r[n]=t.isDefined(o[1])?decodeURIComponent(o[1]):!0)}),r}}).config(["$httpProvider","satellizer.config",function(e,t){e.interceptors.push(["$q",function(e){var n=t.tokenPrefix?t.tokenPrefix+"_"+t.tokenName:t.tokenName;return{request:function(e){return localStorage.getItem(n)&&(e.headers.Authorization="Bearer "+localStorage.getItem(n)),e},responseError:function(t){return 401===t.status&&localStorage.removeItem(n),e.reject(t)}}}])}])}(window,window.angular),function(){function e(e){this.message=e}var t="undefined"!=typeof exports?exports:this,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var o,r,i=String(t),u=0,a=n,l="";i.charAt(0|u)||(a="=",u%1);l+=a.charAt(63&o>>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|r}return l}),t.atob||(t.atob=function(t){var o=String(t).replace(/=+$/,"");if(o.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,u=0,a=0,l="";i=o.charAt(a++);~i&&(r=u%4?64*r+i:i,u++%4)?l+=String.fromCharCode(255&r>>(-2*u&6)):0)i=n.indexOf(i);return l})}(); \ No newline at end of file +!function(e,t){"use strict";t.module("satellizer",[]).constant("satellizer.config",{loginOnSignup:!0,loginRedirect:"/",logoutRedirect:"/",signupRedirect:"/login",loginUrl:"/auth/login",signupUrl:"/auth/signup",loginRoute:"/login",signupRoute:"/signup",tokenName:"token",tokenPrefix:"satellizer",unlinkUrl:"/auth/unlink/",providers:{google:{url:"/auth/google",authorizationEndpoint:"https://accounts.google.com/o/oauth2/auth",redirectUri:e.location.origin||e.location.protocol+"//"+e.location.host,scope:["profile","email"],scopePrefix:"openid",scopeDelimiter:" ",requiredUrlParams:["scope"],optionalUrlParams:["display"],display:"popup",type:"2.0",popupOptions:{width:452,height:633}},facebook:{url:"/auth/facebook",authorizationEndpoint:"https://www.facebook.com/dialog/oauth",redirectUri:e.location.origin?e.location.origin+"/":e.location.protocol+"//"+e.location.host+"/",scope:["email"],scopeDelimiter:",",requiredUrlParams:["display","scope"],display:"popup",type:"2.0",popupOptions:{width:481,height:269}},linkedin:{url:"/auth/linkedin",authorizationEndpoint:"https://www.linkedin.com/uas/oauth2/authorization",redirectUri:e.location.origin||e.location.protocol+"//"+e.location.host,requiredUrlParams:["state"],scope:["r_emailaddress"],scopeDelimiter:" ",state:"STATE",type:"2.0",popupOptions:{width:527,height:582}},github:{name:"github",url:"/auth/github",authorizationEndpoint:"https://github.com/login/oauth/authorize",redirectUri:e.location.origin||e.location.protocol+"//"+e.location.host,scope:[],scopeDelimiter:" ",type:"2.0",popupOptions:{width:1020,height:618}},twitter:{url:"/auth/twitter",type:"1.0",popupOptions:{width:495,height:645}},yahoo:{url:"/auth/yahoo",type:"1.0",popupOptions:{width:559,height:519}}}}).provider("$auth",["satellizer.config",function(e){Object.defineProperties(this,{logoutRedirect:{get:function(){return e.logoutRedirect},set:function(t){e.logoutRedirect=t}},loginRedirect:{set:function(t){e.loginRedirect=t},get:function(){return e.loginRedirect}},signupRedirect:{get:function(){return e.signupRedirect},set:function(t){e.signupRedirect=t}},loginOnSignup:{get:function(){return e.loginOnSignup},set:function(t){e.loginOnSignup=t}},loginUrl:{get:function(){return e.loginUrl},set:function(t){e.loginUrl=t}},signupUrl:{get:function(){return e.signupUrl},set:function(t){e.signupUrl=t}},loginRoute:{get:function(){return e.loginRoute},set:function(t){e.loginRoute=t}},signupRoute:{get:function(){return e.signupRoute},set:function(t){e.signupRoute=t}},tokenName:{get:function(){return e.tokenName},set:function(t){e.tokenName=t}},tokenPrefix:{get:function(){return e.tokenPrefix},set:function(t){e.tokenPrefix=t}},unlinkUrl:{get:function(){return e.unlinkUrl},set:function(t){e.unlinkUrl=t}}}),t.forEach(Object.keys(e.providers),function(n){this[n]=function(o){return t.extend(e.providers[n],o)}},this);var n=function(n){e.providers[n.name]=e.providers[n.name]||{},t.extend(e.providers[n.name],n)};this.oauth1=function(t){n(t),e.providers[t.name].type="1.0"},this.oauth2=function(t){n(t),e.providers[t.name].type="2.0"},this.$get=["$q","satellizer.shared","satellizer.local","satellizer.oauth",function(e,t,n,o){var r={};return r.authenticate=function(e,t){return o.authenticate(e,!1,t)},r.login=function(e){return n.login(e)},r.signup=function(e){return n.signup(e)},r.logout=function(){return t.logout()},r.isAuthenticated=function(){return t.isAuthenticated()},r.link=function(e,t){return o.authenticate(e,!0,t)},r.unlink=function(e){return o.unlink(e)},r}]}]).factory("satellizer.shared",["$q","$window","$location","satellizer.config",function(e,t,n,o){var r={};return r.saveToken=function(e,r,i){var u=e.data[o.tokenName],a=o.tokenPrefix?o.tokenPrefix+"_"+o.tokenName:o.tokenName;t.localStorage[a]=u,o.loginRedirect&&!i&&n.path(o.loginRedirect),r.resolve(e)},r.isAuthenticated=function(){var e=o.tokenPrefix?o.tokenPrefix+"_"+o.tokenName:o.tokenName,n=t.localStorage[e];if(n){var r=n.split(".")[1],i=r.replace("-","+").replace("_","/"),u=JSON.parse(t.atob(i)).exp;return Math.round((new Date).getTime()/1e3)<=u}return!1},r.logout=function(){var r=e.defer(),i=o.tokenPrefix?o.tokenPrefix+"_"+o.tokenName:o.tokenName;return delete t.localStorage[i],o.logoutRedirect&&n.path(o.logoutRedirect),r.resolve(),r.promise},r}]).factory("satellizer.oauth",["$q","$http","satellizer.config","satellizer.shared","satellizer.Oauth1","satellizer.Oauth2",function(e,t,n,o,r,i){var u={};return u.authenticate=function(t,u,a){var l=e.defer(),c="1.0"===n.providers[t].type?new r:new i;return c.open(n.providers[t],a||{}).then(function(e){o.saveToken(e,l,u)}).then(null,function(e){l.reject(e)}),l.promise},u.unlink=function(e){return t.get(n.unlinkUrl+e)},u}]).factory("satellizer.local",["$q","$http","$location","satellizer.utils","satellizer.shared","satellizer.config",function(e,t,n,o,r,i){var u={};return u.login=function(n){var o=e.defer();return t.post(i.loginUrl,n).then(function(e){r.saveToken(e,o)}).then(null,function(e){o.reject(e)}),o.promise},u.signup=function(o){var u=e.defer();return t.post(i.signupUrl,o).then(function(e){i.loginOnSignup?r.saveToken(e,u):(n.path(i.signupRedirect),u.resolve(e))}).then(null,function(e){u.reject(e)}),u.promise},u}]).factory("satellizer.Oauth2",["$q","$http","satellizer.popup","satellizer.utils",function(e,n,o,r){return function(){var i={url:null,name:null,scope:null,scopeDelimiter:null,clientId:null,redirectUri:null,popupOptions:null,authorizationEndpoint:null,requiredUrlParams:null,optionalUrlParams:null,defaultUrlParams:["response_type","client_id","redirect_uri"],responseType:"code"},u={};return u.open=function(n,r){t.extend(i,n);var a=e.defer(),l=u.buildUrl();return o.open(l,i.popupOptions).then(function(e){u.exchangeForToken(e,r).then(function(e){a.resolve(e)}).then(null,function(e){a.reject(e)})}).then(null,function(e){a.reject(e)}),a.promise},u.exchangeForToken=function(e,o){var r=t.extend({},o,{code:e.code,clientId:i.clientId,redirectUri:i.redirectUri});return n.post(i.url,r)},u.buildUrl=function(){var e=i.authorizationEndpoint,t=u.buildQueryString();return[e,t].join("?")},u.buildQueryString=function(){var e=[],n=["defaultUrlParams","requiredUrlParams","optionalUrlParams"];return t.forEach(n,function(n){t.forEach(i[n],function(t){var n=r.camelCase(t),o=i[n];"scope"===t&&Array.isArray(o)&&(o=o.join(i.scopeDelimiter),i.scopePrefix&&(o=[i.scopePrefix,o].join(i.scopeDelimiter))),e.push([t,encodeURIComponent(o)])})}),e.map(function(e){return e.join("=")}).join("&")},u}}]).factory("satellizer.Oauth1",["$q","$http","satellizer.popup",function(e,n,o){return function(){var r={url:null,name:null,popupOptions:null},i={};return i.open=function(n,u){t.extend(r,n);var a=e.defer();return o.open(r.url,r.popupOptions).then(function(e){i.exchangeForToken(e,u).then(function(e){a.resolve(e)}).then(null,function(e){a.reject(e)})}).then(null,function(e){a.reject(e)}),a.promise},i.exchangeForToken=function(e,o){var u=t.extend({},o,e),a=i.buildQueryString(u);return n.get(r.url+"?"+a)},i.buildQueryString=function(e){var n=[];return t.forEach(e,function(e,t){n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),n.join("&")},i}}]).factory("satellizer.popup",["$q","$interval","$window","$location","satellizer.utils",function(n,o,r,i,u){var a=null,l=null,c={};return c.popupWindow=a,c.open=function(t,o){var r=n.defer(),i=c.stringifyOptions(c.prepareOptions(o||{}));return a=e.open(t,"_blank",i),a&&a.focus&&a.focus(),c.pollPopup(r),r.promise},c.pollPopup=function(e){l=o(function(){try{if(a.document.domain===document.domain&&a.location.search){var t=a.location.search.substring(1).replace(/\/$/,""),n=Object.keys(i.search()).length?i.search():u.parseQueryString(t);n.oauth_token&&n.oauth_verifier?e.resolve({oauth_token:n.oauth_token,oauth_verifier:n.oauth_verifier}):n.code?e.resolve({code:n.code}):n.error&&e.reject({error:n.error}),a.close(),o.cancel(l)}}catch(r){}a.closed&&(o.cancel(l),e.reject({data:"Authorization Failed"}))},35)},c.prepareOptions=function(e){var n=e.width||500,o=e.height||500;return t.extend({width:n,height:o,left:r.screenX+(r.outerWidth-n)/2,top:r.screenY+(r.outerHeight-o)/2.5},e)},c.stringifyOptions=function(e){var n=[];return t.forEach(e,function(e,t){n.push(t+"="+e)}),n.join(",")},c}]).service("satellizer.utils",function(){this.camelCase=function(e){return e.replace(/([\:\-\_]+(.))/g,function(e,t,n,o){return o?n.toUpperCase():n})},this.parseQueryString=function(e){var n,o,r={};return t.forEach((e||"").split("&"),function(e){e&&(o=e.split("="),n=decodeURIComponent(o[0]),r[n]=t.isDefined(o[1])?decodeURIComponent(o[1]):!0)}),r}}).config(["$httpProvider","satellizer.config",function(e,t){e.interceptors.push(["$q",function(e){var n=t.tokenPrefix?t.tokenPrefix+"_"+t.tokenName:t.tokenName;return{request:function(e){return localStorage.getItem(n)&&(e.headers.Authorization="Bearer "+localStorage.getItem(n)),e},responseError:function(t){return 401===t.status&&localStorage.removeItem(n),e.reject(t)}}}])}])}(window,window.angular),function(){function e(e){this.message=e}var t="undefined"!=typeof exports?exports:this,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var o,r,i=String(t),u=0,a=n,l="";i.charAt(0|u)||(a="=",u%1);l+=a.charAt(63&o>>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|r}return l}),t.atob||(t.atob=function(t){var o=String(t).replace(/=+$/,"");if(o.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,u=0,a=0,l="";i=o.charAt(a++);~i&&(r=u%4?64*r+i:i,u++%4)?l+=String.fromCharCode(255&r>>(-2*u&6)):0)i=n.indexOf(i);return l})}(); \ No newline at end of file