!function(){return function e(t,n,i){function o(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(r)return r(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){return o(t[a][1][e]||e)},c,c.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}}()({1:[function(e,t,n){(function(e,n){
/*! hellojs v1.18.4 | (c) 2012-2020 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */
Object.create||(Object.create=function(){function e(){}return function(t){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Object.keys||(Object.keys=function(e,t,n){for(t in n=[],e)n.hasOwnProperty.call(e,t)&&n.push(t);return n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(void 0===this||null===this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var i=arguments.length>=2?arguments[1]:void 0,o=0;o<n;o++)o in t&&e.call(i,t[o],o,t);return this}),Array.prototype.filter||(Array.prototype.filter=function(e,t){var n=[];return this.forEach(function(i,o,r){e.call(t||void 0,i,o,r)&&n.push(i)}),n}),Array.prototype.map||(Array.prototype.map=function(e,t){var n=[];return this.forEach(function(i,o,r){n.push(e.call(t||void 0,i,o,r))}),n}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),"object"!=typeof window||"object"!=typeof window.location||window.location.assign||(window.location.assign=function(e){window.location=e}),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");function t(){}var n=[].slice,i=n.call(arguments,1),o=this,r=function(){return o.apply(this instanceof t?this:e||window,i.concat(n.call(arguments)))};return t.prototype=this.prototype,r.prototype=new t,r})
/**
 * @hello.js
 *
 * HelloJS is a client side Javascript SDK for making OAuth2 logins and subsequent REST calls.
 *
 * @author Andrew Dodson
 * @website https://adodson.com/hello.js/
 *
 * @copyright Andrew Dodson, 2012 - 2015
 * @license MIT: You are free to use and modify this code for any use, on the condition that this copyright notice remains.
 */;var i=function(e){return i.use(e)};i.utils={extend:function(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(Array.isArray(e)&&Array.isArray(t))Array.prototype.push.apply(e,t);else if(e&&(e instanceof Object||"object"==typeof e)&&t&&(t instanceof Object||"object"==typeof t)&&e!==t)for(var n in t)e[n]=i.utils.extend(e[n],t[n]);else Array.isArray(t)&&(t=t.slice(0)),e=t}),e}},i.utils.extend(i,{settings:{redirect_uri:window.location.href.split("#")[0],response_type:"token",display:"popup",state:"",oauth_proxy:"https://auth-server.herokuapp.com/proxy",timeout:2e4,popup:{resizable:1,scrollbars:1,width:500,height:550},scope:["basic"],scope_map:{basic:""},default_service:null,force:null,page_uri:window.location.href},services:{},use:function(e){var t=Object.create(this);return t.settings=Object.create(this.settings),e&&(t.settings.default_service=e),t.utils.Event.call(t),t},init:function(e,t){var n=this.utils;if(!e)return this.services;for(var i in e)e.hasOwnProperty(i)&&"object"!=typeof e[i]&&(e[i]={id:e[i]});return n.extend(this.services,e),t&&(n.extend(this.settings,t),"redirect_uri"in t&&(this.settings.redirect_uri=n.url(t.redirect_uri).href)),this},login:function(){var e,t=this.utils,n=t.error,o=t.Promise(),r=t.args({network:"s",options:"o",callback:"f"},arguments),a=t.diffKey(r.options,this.settings),s=r.options=t.merge(this.settings,r.options||{});function l(e,t){i.emit(e,t)}if(s.popup=t.merge(this.settings.popup,r.options.popup||{}),r.network=r.network||this.settings.default_service,o.proxy.then(r.callback,r.callback),o.proxy.then(l.bind(this,"auth.login auth"),l.bind(this,"auth.failed auth")),"string"!=typeof r.network||!(r.network in this.services))return o.reject(n("invalid_network","The provided network was not recognized"));var u=this.services[r.network],c=t.globalEvent(function(e){e?"string"==typeof e&&(e=JSON.parse(e)):e=n("cancelled","The authentication was not completed"),e.error?o.reject(e):(t.store(e.network,e),o.fulfill({network:e.network,authResponse:e}))}),f=t.url(s.redirect_uri).href,d=u.oauth.response_type||s.response_type;/\bcode\b/.test(d)&&!u.oauth.grant&&(d=d.replace(/\bcode\b/,"token")),r.qs=t.merge(a,{client_id:encodeURIComponent(u.id),response_type:encodeURIComponent(d),redirect_uri:encodeURIComponent(f),state:{client_id:u.id,network:r.network,display:s.display,callback:c,state:s.state,redirect_uri:f}});var p=t.store(r.network),m=/[,\s]+/,h=this.settings.scope?[this.settings.scope.toString()]:[],g=t.merge(this.settings.scope_map,u.scope||{});if((s.scope&&h.push(s.scope.toString()),p&&"scope"in p&&p.scope instanceof String&&h.push(p.scope),h=h.join(",").split(m),h=t.unique(h).filter(_),r.qs.state.scope=h.join(","),h=(h=h.map(function(e){return e in g?g[e]:e})).join(",").split(m),h=t.unique(h).filter(_),r.qs.scope=h.join(u.scope_delim||","),!1===s.force)&&(p&&"access_token"in p&&p.access_token&&"expires"in p&&p.expires>(new Date).getTime()/1e3&&0===t.diff((p.scope||"").split(m),(r.qs.state.scope||"").split(m)).length))return o.fulfill({unchanged:!0,network:r.network,authResponse:p}),o;if("page"===s.display&&s.page_uri&&(r.qs.state.page_uri=t.url(s.page_uri).href),"login"in u&&"function"==typeof u.login&&u.login(r),(!/\btoken\b/.test(d)||parseInt(u.oauth.version,10)<2||"none"===s.display&&u.oauth.grant&&p&&p.refresh_token)&&(r.qs.state.oauth=u.oauth,r.qs.state.oauth_proxy=s.oauth_proxy),r.qs.state=encodeURIComponent(JSON.stringify(r.qs.state)),1===parseInt(u.oauth.version,10)?e=t.qs(s.oauth_proxy,r.qs,w):"none"===s.display&&u.oauth.grant&&p&&p.refresh_token?(r.qs.refresh_token=p.refresh_token,e=t.qs(s.oauth_proxy,r.qs,w)):e=t.qs(u.oauth.auth,r.qs,w),l("auth.init",r),"none"===s.display)t.iframe(e,f);else if("popup"===s.display)var v=t.popup(e,f,s.popup),y=setInterval(function(){if((!v||v.closed)&&(clearInterval(y),!o.state)){var e=n("cancelled","Login has been cancelled");v||(e=n("blocked","Popup was blocked")),e.network=r.network,o.reject(e)}},100);else window.location=e;return o.proxy;function w(e){return e}function _(e){return!!e}},logout:function(){var e=this.utils,t=e.error,n=e.Promise(),o=e.args({name:"s",options:"o",callback:"f"},arguments);function r(e,t){i.emit(e,t)}if(o.options=o.options||{},n.proxy.then(o.callback,o.callback),n.proxy.then(r.bind(this,"auth.logout auth"),r.bind(this,"error")),o.name=o.name||this.settings.default_service,o.authResponse=e.store(o.name),!o.name||o.name in this.services)if(o.name&&o.authResponse){var a=function(t){e.store(o.name,null),n.fulfill(i.utils.merge({network:o.name},t||{}))},s={};if(o.options.force){var l=this.services[o.name].logout;if(l)if("function"==typeof l&&(l=l(a,o)),"string"==typeof l)e.iframe(l),s.force=null,s.message="Logout success on providers site was indeterminate";else if(void 0===l)return n.proxy}a(s)}else n.reject(t("invalid_session","There was no session to remove"));else n.reject(t("invalid_network","The network was unrecognized"));return n.proxy},getAuthResponse:function(e){return(e=e||this.settings.default_service)&&e in this.services&&this.utils.store(e)||null},events:{}}),i.utils.extend(i.utils,{error:function(e,t){return{error:{code:e,message:t}}},qs:function(e,t,n){if(t)for(var i in n=n||encodeURIComponent,t){var o=new RegExp("([\\?\\&])"+i+"=[^\\&]*");e.match(o)&&(e=e.replace(o,"$1"+i+"="+n(t[i])),delete t[i])}return this.isEmpty(t)?e:e+(e.indexOf("?")>-1?"&":"?")+this.param(t,n)},param:function(e,t){var n,i,o={};if("string"==typeof e){if(t=t||decodeURIComponent,i=e.replace(/^[\#\?]/,"").match(/([^=\/\&]+)=([^\&]+)/g))for(var r=0;r<i.length;r++)o[(n=i[r].match(/([^=]+)=(.*)/))[1]]=t(n[2]);return o}t=t||encodeURIComponent;var a=e;for(var s in o=[],a)a.hasOwnProperty(s)&&a.hasOwnProperty(s)&&o.push([s,"?"===a[s]?"?":t(a[s])].join("="));return o.join("&")},store:function(){for(var e,t=["localStorage","sessionStorage"],n=-1;t[++n];)try{(e=window[t[n]]).setItem("test"+n,n),e.removeItem("test"+n);break}catch(t){e=null}if(!e){var i=null;e={getItem:function(e){e+="=";for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var o=t[n].replace(/(^\s+|\s+$)/,"");if(o&&0===o.indexOf(e))return o.substr(e.length)}return i},setItem:function(e,t){i=t,document.cookie=e+"="+t}},i=e.getItem("hello")}return function(t,n,i){var o=function(){var t={};try{t=JSON.parse(e.getItem("hello"))||{}}catch(e){}return t}();if(t&&void 0===n)return o[t]||null;if(t&&null===n)try{delete o[t]}catch(e){o[t]=null}else{if(!t)return o;o[t]=n}return function(t){e.setItem("hello",JSON.stringify(t))}(o),o||null}}(),append:function(e,t,n){var i="string"==typeof e?document.createElement(e):e;if("object"==typeof t)if("tagName"in t)n=t;else for(var o in t)if(t.hasOwnProperty(o))if("object"==typeof t[o])for(var r in t[o])t[o].hasOwnProperty(r)&&(i[o][r]=t[o][r]);else"html"===o?i.innerHTML=t[o]:/^on/.test(o)?i[o]=t[o]:i.setAttribute(o,t[o]);return"body"===n?function e(){document.body?document.body.appendChild(i):setTimeout(e,16)}():"object"==typeof n?n.appendChild(i):"string"==typeof n&&document.getElementsByTagName(n)[0].appendChild(i),i},iframe:function(e){this.append("iframe",{src:e,style:{position:"absolute",left:"-1000px",bottom:0,height:"1px",width:"1px"}},"body")},merge:function(){var e=Array.prototype.slice.call(arguments);return e.unshift({}),this.extend.apply(null,e)},args:function(e,t){var n={},i=0,o=null,r=null;for(r in e)if(e.hasOwnProperty(r))break;if(1===t.length&&"object"==typeof t[0]&&"o!"!=e[r])for(r in t[0])if(e.hasOwnProperty(r)&&r in e)return t[0];for(r in e)if(e.hasOwnProperty(r))if(o=typeof t[i],"function"==typeof e[r]&&e[r].test(t[i])||"string"==typeof e[r]&&(e[r].indexOf("s")>-1&&"string"===o||e[r].indexOf("o")>-1&&"object"===o||e[r].indexOf("i")>-1&&"number"===o||e[r].indexOf("a")>-1&&"object"===o||e[r].indexOf("f")>-1&&"function"===o))n[r]=t[i++];else if("string"==typeof e[r]&&e[r].indexOf("!")>-1)return!1;return n},url:function(e){if(e){if(window.URL&&URL instanceof Function&&0!==URL.length)return new URL(e,window.location);var t=document.createElement("a");return t.href=e,t.cloneNode(!1)}return window.location},diff:function(e,t){return t.filter(function(t){return-1===e.indexOf(t)})},diffKey:function(e,t){if(e||!t){var n={};for(var i in e)i in t||(n[i]=e[i]);return n}return e},unique:function(e){return Array.isArray(e)?e.filter(function(t,n){return e.indexOf(t)===n}):[]},isEmpty:function(e){if(!e)return!0;if(Array.isArray(e))return!e.length;if("object"==typeof e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},
/*!
	 **  Thenable -- Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
	 **  Copyright (c) 2013-2014 Ralf S. Engelschall <http://engelschall.com>
	 **  Licensed under The MIT License <http://opensource.org/licenses/MIT>
	 **  Source-Code distributed on <http://github.com/rse/thenable>
	 */
Promise:function(){var t=function(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.6",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};t.prototype={fulfill:function(e){return i(this,1,"fulfillValue",e)},reject:function(e){return i(this,2,"rejectReason",e)},then:function(e,n){var i=new t;return this.onFulfilled.push(a(e,i,"fulfill")),this.onRejected.push(a(n,i,"reject")),o(this),i.proxy}};var i=function(e,t,n,i){return 0===e.state&&(e.state=t,e[n]=i,o(e)),e},o=function(e){1===e.state?r(e,"onFulfilled",e.fulfillValue):2===e.state&&r(e,"onRejected",e.rejectReason)},r=function(t,i,o){if(0!==t[i].length){var r=t[i];t[i]=[];var a=function(){for(var e=0;e<r.length;e++)r[e](o)};"object"==typeof e&&"function"==typeof e.nextTick?e.nextTick(a):"function"==typeof n?n(a):setTimeout(a,0)}},a=function(e,t,n){return function(i){if("function"!=typeof e)t[n].call(t,i);else{var o;try{o=e(i)}catch(e){return void t.reject(e)}s(t,o)}}},s=function(e,t){if(e!==t&&e.proxy!==t){var n;if("object"==typeof t&&null!==t||"function"==typeof t)try{n=t.then}catch(t){return void e.reject(t)}if("function"!=typeof n)e.fulfill(t);else{var i=!1;try{n.call(t,function(n){i||(i=!0,n===t?e.reject(new TypeError("circular thenable chain")):s(e,n))},function(t){i||(i=!0,e.reject(t))})}catch(t){i||e.reject(t)}}}else e.reject(new TypeError("cannot resolve promise with itself"))};return t}(),Event:function(){var e=/[\s\,]+/;return this.parent={events:this.events,findEvents:this.findEvents,parent:this.parent,utils:this.utils},this.events={},this.on=function(t,n){if(n&&"function"==typeof n)for(var i=t.split(e),o=0;o<i.length;o++)this.events[i[o]]=[n].concat(this.events[i[o]]||[]);return this},this.off=function(e,t){return this.findEvents(e,function(e,n){t&&this.events[e][n]!==t||(this.events[e][n]=null)}),this},this.emit=function(e){var t=Array.prototype.slice.call(arguments,1);t.push(e);for(var n=function(n,i){t[t.length-1]="*"===n?e:n,this.events[n][i].apply(this,t)},i=this;i&&i.findEvents;)i.findEvents(e+",*",n),i=i.parent;return this},this.emitAfter=function(){var e=this,t=arguments;return setTimeout(function(){e.emit.apply(e,t)},0),this},this.findEvents=function(t,n){var i=t.split(e);for(var o in this.events)if(this.events.hasOwnProperty(o)&&i.indexOf(o)>-1)for(var r=0;r<this.events[o].length;r++)this.events[o][r]&&n.call(this,o,r)},this},globalEvent:function(e,t){return t=t||"_hellojs_"+parseInt(1e12*Math.random(),10).toString(36),window[t]=function(){try{e.apply(this,arguments)&&delete window[t]}catch(e){console.error(e)}},t},popup:function(e,t,n){var i=document.documentElement;if(n.height&&void 0===n.top){var o=void 0!==window.screenTop?window.screenTop:screen.top,r=screen.height||window.innerHeight||i.clientHeight;n.top=parseInt((r-n.height)/2,10)+o}if(n.width&&void 0===n.left){var a=void 0!==window.screenLeft?window.screenLeft:screen.left,s=screen.width||window.innerWidth||i.clientWidth;n.left=parseInt((s-n.width)/2,10)+a}var l=[];Object.keys(n).forEach(function(e){var t=n[e];l.push(e+(null!==t?"="+t:""))}),-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")&&(e=t+"#oauth_redirect="+encodeURIComponent(encodeURIComponent(e)));var u=window.open(e,"_blank",l.join(","));return u&&u.focus&&u.focus(),u},responseHandler:function(e,t){var n,i=this,o=e.location;if((n=i.param(o.search))&&n.state&&(n.code||n.oauth_token)){var r=JSON.parse(n.state);n.redirect_uri=r.redirect_uri||o.href.replace(/[\?\#].*$/,"");var a=i.qs(r.oauth_proxy,n);o.assign(a)}else{if((n=i.merge(i.param(o.search||""),i.param(o.hash||"")))&&"state"in n){try{var s=JSON.parse(n.state);i.extend(n,s)}catch(e){var l=decodeURIComponent(n.state);try{var u=JSON.parse(l);i.extend(n,u)}catch(e){console.error("Could not decode state parameter")}}if("access_token"in n&&n.access_token&&n.network)n.expires_in&&0!==parseInt(n.expires_in,10)||(n.expires_in=0),n.expires_in=parseInt(n.expires_in,10),n.expires=(new Date).getTime()/1e3+(n.expires_in||31536e3),d(n,e,t);else if("error"in n&&n.error&&n.network)n.error={code:n.error,message:n.error_message||n.error_description},d(n,e,t);else if(n.callback&&n.callback in t){var c=!!("result"in n&&n.result)&&JSON.parse(n.result);p(t,n.callback)(c),m()}n.page_uri&&(f=n.page_uri,/^https?:/.test(f))&&o.assign(n.page_uri)}else if("oauth_redirect"in n)return void o.assign(decodeURIComponent(n.oauth_redirect));var f}function d(e,t,n){var o=e.callback,r=e.network;if(i.store(r,e),!("display"in e&&"page"===e.display)){if(n&&o&&o in n){try{delete e.callback}catch(e){}i.store(r,e);var a=JSON.stringify(e);try{p(n,o)(a)}catch(e){}}m()}}function p(e,t){return 0!==t.indexOf("_hellojs_")?function(){throw"Could not execute callback "+t}:e[t]}function m(){if(e.frameElement)t.document.body.removeChild(e.frameElement);else{try{e.close()}catch(e){}e.addEventListener&&e.addEventListener("load",function(){e.close()})}}}}),i.utils.Event.call(i),function(e){var t={},n={};e.on("auth.login, auth.logout",function(n){n&&"object"==typeof n&&n.network&&(t[n.network]=e.utils.store(n.network)||{})}),function i(){var o=(new Date).getTime()/1e3,r=function(t){e.emit("auth."+t,{network:a,authResponse:s})};for(var a in e.services)if(e.services.hasOwnProperty(a)){if(!e.services[a].id)continue;var s=e.utils.store(a)||{},l=e.services[a],u=t[a]||{};if(s&&"callback"in s){var c=s.callback;try{delete s.callback}catch(e){}e.utils.store(a,s);try{window[c](s)}catch(e){}}if(s&&"expires"in s&&s.expires<o){var f=l.refresh||s.refresh_token;!f||a in n&&!(n[a]<o)?f||a in n||(r("expired"),n[a]=!0):(e.emit("notice",a+" has expired trying to resignin"),e.login(a,{display:"none",force:!1}),n[a]=o+600);continue}if(u.access_token===s.access_token&&u.expires===s.expires)continue;!s.access_token&&u.access_token?r("logout"):s.access_token&&!u.access_token?r("login"):s.expires!==u.expires&&r("update"),t[a]=s,a in n&&delete n[a]}setTimeout(i,1e3)}()}(i),i.api=function(){var e=this.utils,t=e.error,n=e.Promise(),i=e.args({path:"s!",query:"o",method:"s",data:"o",timeout:"i",callback:"f"},arguments);i.method=(i.method||"get").toLowerCase(),i.headers=i.headers||{},i.query=i.query||{},"get"!==i.method&&"delete"!==i.method||(e.extend(i.query,i.data),i.data={});var o=i.data=i.data||{};if(n.then(i.callback,i.callback),!i.path)return n.reject(t("invalid_path","Missing the path parameter from the request"));i.path=i.path.replace(/^\/+/,"");var r=(i.path.split(/[\/\:]/,2)||[])[0].toLowerCase();if(r in this.services){i.network=r;var a=new RegExp("^"+r+":?/?");i.path=i.path.replace(a,"")}i.network=this.settings.default_service=i.network||this.settings.default_service;var s=this.services[i.network];if(!s)return n.reject(t("invalid_network","Could not match the service requested: "+i.network));if(i.method in s&&i.path in s[i.method]&&!1===s[i.method][i.path])return n.reject(t("invalid_path","The provided path is not available on the selected network"));i.oauth_proxy||(i.oauth_proxy=this.settings.oauth_proxy),"proxy"in i||(i.proxy=i.oauth_proxy&&s.oauth&&1===parseInt(s.oauth.version,10)),"timeout"in i||(i.timeout=this.settings.timeout),"formatResponse"in i||(i.formatResponse=!0),i.authResponse=this.getAuthResponse(i.network),i.authResponse&&i.authResponse.access_token&&(i.query.access_token=i.authResponse.access_token);var l,u=i.path;i.options=e.clone(i.query),i.data=e.clone(o);var c=s[{delete:"del"}[i.method]||i.method]||{};if("get"===i.method){var f=u.split(/[\?#]/)[1];f&&(e.extend(i.query,e.param(f)),u=u.replace(/\?.*?(#|$)/,"$1"))}return(l=u.match(/#(.+)/,""))?(u=u.split("#")[0],i.path=l[1]):u in c?(i.path=u,u=c[u]):"default"in c&&(u=c.default),i.redirect_uri=this.settings.redirect_uri,i.xhr=s.xhr,i.jsonp=s.jsonp,i.form=s.form,"function"==typeof u?u(i,d):d(u),n.proxy;function d(o){(o=o.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi,function(e,o,r){var a=r?r.replace(/^\|/,""):"";return o in i.query?(a=i.query[o],delete i.query[o]):i.data&&o in i.data?(a=i.data[o],delete i.data[o]):r||n.reject(t("missing_attribute","The attribute "+o+" is missing from the request")),a})).match(/^https?:\/\//)||(o=s.base+o),i.url=o,e.request(i,function(t,o){if(i.formatResponse){if(!0===t?t={success:!0}:t||(t={}),"delete"===i.method&&(t=!t||e.isEmpty(t)?{success:!0}:t),s.wrap&&(i.path in s.wrap||"default"in s.wrap)){var r=i.path in s.wrap?i.path:"default",a=((new Date).getTime(),s.wrap[r](t,o,i));a&&(t=a)}t&&"paging"in t&&t.paging.next&&("?"===t.paging.next[0]?t.paging.next=i.path+t.paging.next:t.paging.next+="#"+i.path),!t||"error"in t?n.reject(t):n.fulfill(t)}else("object"==typeof o?o.statusCode>=400:"object"==typeof t&&"error"in t)?n.reject(t):n.fulfill(t)})}},i.utils.extend(i.utils,{request:function(e,t){var n=this,i=n.error;if(n.isEmpty(e.data)||"FileList"in window||!n.hasBinary(e.data)||(e.xhr=!1,e.jsonp=!1),this.request_cors(function(){return void 0===e.xhr||e.xhr&&("function"!=typeof e.xhr||e.xhr(e,e.query))}))a(e,function(i){var o=n.xhr(e.method,i,e.headers,e.data,t);o.onprogress=e.onprogress||null,o.upload&&e.onuploadprogress&&(o.upload.onprogress=e.onuploadprogress)});else{var o,r=e.query;if(e.query=n.clone(e.query),e.callbackID=n.globalEvent(),!1!==e.jsonp){if(e.query.callback=e.callbackID,"function"==typeof e.jsonp&&e.jsonp(e,e.query),"get"===e.method)return void a(e,function(i){n.jsonp(i,t,e.callbackID,e.timeout)});e.query=r}if(!1!==e.form&&(e.query.redirect_uri=e.redirect_uri,e.query.state=JSON.stringify({callback:e.callbackID}),"function"==typeof e.form&&(o=e.form(e,e.query)),"post"===e.method&&!1!==o))return void a(e,function(i){n.post(i,e.data,o,t,e.callbackID,e.timeout)});t(i("invalid_request","There was no mechanism for handling this request"))}function a(e,t){var i;e.authResponse&&e.authResponse.oauth&&1===parseInt(e.authResponse.oauth.version,10)&&(i=e.query.access_token,delete e.query.access_token,e.proxy=!0),!e.data||"get"!==e.method&&"delete"!==e.method||(n.extend(e.query,e.data),e.data=null);var o=n.qs(e.url,e.query);e.proxy&&(o=n.qs(e.oauth_proxy,{path:o,access_token:i||"",then:e.proxy_response_type||("get"===e.method.toLowerCase()?"redirect":"proxy"),method:e.method.toLowerCase(),suppress_response_codes:e.suppress_response_codes||!0})),t(o)}},request_cors:function(e){return"withCredentials"in new XMLHttpRequest&&e()},domInstance:function(e,t){var n="HTML"+(e||"").replace(/^[a-z]/,function(e){return e.toUpperCase()})+"Element";return!!t&&(window[n]?t instanceof window[n]:window.Element?t instanceof window.Element&&(!e||t.tagName&&t.tagName.toLowerCase()===e):!(t instanceof Object||t instanceof Array||t instanceof String||t instanceof Number)&&t.tagName&&t.tagName.toLowerCase()===e)},clone:function(e){if(null===e||"object"!=typeof e||e instanceof Date||"nodeName"in e||this.isBinary(e)||"function"==typeof FormData&&e instanceof FormData)return e;if(Array.isArray(e))return e.map(this.clone.bind(this));var t={};for(var n in e)t[n]=this.clone(e[n]);return t},xhr:function(e,t,n,i,o){var r,a=new XMLHttpRequest,s=this.error,l=!1;if("blob"===e&&(l=e,e="GET"),e=e.toUpperCase(),a.onload=function(t){var n=a.response;try{n=JSON.parse(a.responseText)}catch(e){401===a.status&&(n=s("access_denied",a.statusText))}var i=function(e){var t,n={},i=/([a-z\-]+):\s?(.*);?/gi;for(;t=i.exec(e);)n[t[1]]=t[2];return n}(a.getAllResponseHeaders());i.statusCode=a.status,o(n||("GET"===e?s("empty_response","Could not get resource"):{}),i)},a.onerror=function(e){var t=a.responseText;try{t=JSON.parse(a.responseText)}catch(e){}o(t||s("access_denied","Could not get resource"))},"GET"===e||"DELETE"===e)i=null;else if(i&&"string"!=typeof i&&!(i instanceof FormData)&&!(i instanceof File)&&!(i instanceof Blob)){var u=new FormData;for(r in i)i.hasOwnProperty(r)&&(i[r]instanceof HTMLInputElement?"files"in i[r]&&i[r].files.length>0&&u.append(r,i[r].files[0]):i[r]instanceof Blob?u.append(r,i[r],i.name):u.append(r,i[r]));i=u}if(a.open(e,t,!0),l&&("responseType"in a?a.responseType=l:a.overrideMimeType("text/plain; charset=x-user-defined")),n)for(r in n)a.setRequestHeader(r,n[r]);return a.send(i),a},jsonp:function(e,t,n,i){var o,r=this.error,a=0,s=document.getElementsByTagName("head")[0],l=r("server_error","server_error"),u=function(){a++||window.setTimeout(function(){t(l),s.removeChild(c)},0)};n=this.globalEvent(function(e){return l=e,!0},n),e=e.replace(new RegExp("=\\?(&|$)"),"="+n+"$1");var c=this.append("script",{id:n,name:n,src:e,async:!0,onload:u,onerror:u,onreadystatechange:function(){/loaded|complete/i.test(this.readyState)&&u()}});window.navigator.userAgent.toLowerCase().indexOf("opera")>-1&&(o=this.append("script",{text:"document.getElementById('"+n+"').onerror();"}),c.async=!1),i&&window.setTimeout(function(){l=r("timeout","timeout"),u()},i),s.appendChild(c),o&&s.appendChild(o)},post:function(e,t,n,i,o,r){var a,s,l=this.error,u=document,c=null,f=[],d=0,p=null,m=0,h=function(e){m++||i(e)};this.globalEvent(h,o);try{s=u.createElement('<iframe name="'+o+'">')}catch(e){s=u.createElement("iframe")}if(s.name=o,s.id=o,s.style.display="none",n&&n.callbackonload&&(s.onload=function(){h({response:"posted",message:"Content was posted"})}),r&&setTimeout(function(){h(l("timeout","The post operation timed out"))},r),u.body.appendChild(s),this.domInstance("form",t)){for(c=t.form,d=0;d<c.elements.length;d++)c.elements[d]!==t&&c.elements[d].setAttribute("disabled",!0);t=c}if(this.domInstance("form",t))for(c=t,d=0;d<c.elements.length;d++)c.elements[d].disabled||"file"!==c.elements[d].type||(c.encoding=c.enctype="multipart/form-data",c.elements[d].setAttribute("name","file"));else{for(p in t)t.hasOwnProperty(p)&&this.domInstance("input",t[p])&&"file"===t[p].type&&((c=t[p].form).encoding=c.enctype="multipart/form-data");var g;for(p in c||(c=u.createElement("form"),u.body.appendChild(c),a=c),t)if(t.hasOwnProperty(p)){var v=this.domInstance("input",t[p])||this.domInstance("textArea",t[p])||this.domInstance("select",t[p]);if(v&&t[p].form===c)v&&t[p].name!==p&&(t[p].setAttribute("name",p),t[p].name=p);else{var y=c.elements[p];if(g)for(y instanceof NodeList||(y=[y]),d=0;d<y.length;d++)y[d].parentNode.removeChild(y[d]);(g=u.createElement("input")).setAttribute("type","hidden"),g.setAttribute("name",p),v?g.value=t[p].value:this.domInstance(null,t[p])?g.value=t[p].innerHTML||t[p].innerText:g.value=t[p],c.appendChild(g)}}for(d=0;d<c.elements.length;d++)(g=c.elements[d]).name in t||!0===g.getAttribute("disabled")||(g.setAttribute("disabled",!0),f.push(g))}c.setAttribute("method","POST"),c.setAttribute("target",o),c.target=o,c.setAttribute("action",e),setTimeout(function(){c.submit(),setTimeout(function(){try{a&&a.parentNode.removeChild(a)}catch(e){try{console.error("HelloJS: could not remove iframe")}catch(e){}}for(var e=0;e<f.length;e++)f[e]&&(f[e].setAttribute("disabled",!1),f[e].disabled=!1)},0)},100)},hasBinary:function(e){for(var t in e)if(e.hasOwnProperty(t)&&this.isBinary(e[t]))return!0;return!1},isBinary:function(e){return e instanceof Object&&(this.domInstance("input",e)&&"file"===e.type||"FileList"in window&&e instanceof window.FileList||"File"in window&&e instanceof window.File||"Blob"in window&&e instanceof window.Blob)},toBlob:function(e){var t=/^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i,n=e.match(t);if(!n)return e;for(var i=atob(e.replace(t,"")),o=[],r=0;r<i.length;r++)o.push(i.charCodeAt(r));return new Blob([new Uint8Array(o)],{type:n[1]})}}),function(e){var t=e.api,n=e.utils;n.extend(n,{dataToJSON:function(e){var t=window,n=e.data;if(this.domInstance("form",n)?n=this.nodeListToJSON(n.elements):"NodeList"in t&&n instanceof NodeList?n=this.nodeListToJSON(n):this.domInstance("input",n)&&(n=this.nodeListToJSON([n])),("File"in t&&n instanceof t.File||"Blob"in t&&n instanceof t.Blob||"FileList"in t&&n instanceof t.FileList)&&(n={file:n}),!("FormData"in t&&n instanceof t.FormData))for(var i in n)if(n.hasOwnProperty(i))if("FileList"in t&&n[i]instanceof t.FileList)1===n[i].length&&(n[i]=n[i][0]);else{if(this.domInstance("input",n[i])&&"file"===n[i].type)continue;this.domInstance("input",n[i])||this.domInstance("select",n[i])||this.domInstance("textArea",n[i])?n[i]=n[i].value:this.domInstance(null,n[i])&&(n[i]=n[i].innerHTML||n[i].innerText)}return e.data=n,n},nodeListToJSON:function(e){for(var t={},n=0;n<e.length;n++){var i=e[n];!i.disabled&&i.name&&("file"===i.type?t[i.name]=i:t[i.name]=i.value||i.innerHTML)}return t}}),e.api=function(){var e=n.args({path:"s!",method:"s",data:"o",timeout:"i",callback:"f"},arguments);return e.data&&n.dataToJSON(e),t.call(this,e)}}(i),i.utils.responseHandler(window,window.opener||window.parent),"object"==typeof chrome&&"object"==typeof chrome.identity&&chrome.identity.launchWebAuthFlow&&function(){i.utils.popup=function(e){return t(e,!0)},i.utils.iframe=function(e){t(e,!1)},i.utils.request_cors=function(e){return e(),!0};var e={};function t(e,n){var o={closed:!1};return chrome.identity.launchWebAuthFlow({url:e,interactive:n},function(e){if(void 0!==e){var n=i.utils.url(e),r={location:{assign:function(e){t(e,!1)},search:n.search,hash:n.hash,href:n.href},close:function(){}};i.utils.responseHandler(r,window)}else o.closed=!0}),o}chrome.storage.local.get("hello",function(t){e=t.hello||{}}),i.utils.store=function(t,n){return 0===arguments.length?e:1===arguments.length?e[t]||null:n?(e[t]=n,chrome.storage.local.set({hello:e}),n):null===n?(delete e[t],chrome.storage.local.set({hello:e}),null):void 0}}(),function(){if(/^file:\/{3}[^\/]/.test(window.location.href)&&window.cordova){i.utils.iframe=function(e,t){i.utils.popup(e,t,{hidden:"yes"})};var e=i.utils.popup;i.utils.popup=function(t,n,o){var r=e.call(this,t,n,o);try{if(r&&r.addEventListener){var a=i.utils.url(n),s=a.origin||a.protocol+"//"+a.hostname;r.addEventListener("loadstart",function(e){var t=e.url;if(0===t.indexOf(s)){var n=i.utils.url(t),o={location:{assign:function(e){r.executeScript({code:'window.location.href = "'+e+';"'})},search:n.search,hash:n.hash,href:n.href},close:function(){if(r.close){r.close();try{r.closed=!0}catch(e){}}}};i.utils.responseHandler(o,window)}})}}catch(e){}return r}}}(),function(e){var t={version:"1.0",auth:"https://www.dropbox.com/1/oauth/authorize",request:"https://api.dropbox.com/1/oauth/request_token",token:"https://api.dropbox.com/1/oauth/access_token"},n={version:2,auth:"https://www.dropbox.com/1/oauth2/authorize",grant:"https://api.dropbox.com/1/oauth2/token"};function i(e){e&&"error"in e&&(e.error={code:"server_error",message:e.error.message||e.error})}function o(t,n,i){if(!("object"!=typeof t||"undefined"!=typeof Blob&&t instanceof Blob||"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer||"error"in t)){var o=("app_folder"!==t.root?t.root:"")+t.path.replace(/\&/g,"%26");o=o.replace(/^\//,""),t.thumb_exists&&(t.thumbnail=i.oauth_proxy+"?path="+encodeURIComponent("https://api-content.dropbox.com/1/thumbnails/auto/"+o+"?format=jpeg&size=m")+"&access_token="+i.options.access_token),t.type=t.is_dir?"folder":t.mime_type,t.name=t.path.replace(/.*\//g,""),t.is_dir?t.files=o.replace(/^\//,""):(t.downloadLink=e.settings.oauth_proxy+"?path="+encodeURIComponent("https://api-content.dropbox.com/1/files/auto/"+o)+"&access_token="+i.options.access_token,t.file="https://api-content.dropbox.com/1/files/auto/"+o),t.id||(t.id=t.path.replace(/^\//,""))}}function r(e){return function(t,n){delete t.query.limit,n(e)}}e.init({dropbox:{name:"Dropbox",oauth:n,login:function(i){i.qs.scope="";var o=decodeURIComponent(i.qs.redirect_uri);0===o.indexOf("http:")&&0!==o.indexOf("http://localhost/")?e.services.dropbox.oauth=t:e.services.dropbox.oauth=n,i.options.popup.width=1e3,i.options.popup.height=1e3},base:"https://api.dropbox.com/1/",root:"sandbox",get:{me:"account/info","me/files":r("metadata/auto/@{parent|}"),"me/folder":r("metadata/auto/@{id}"),"me/folders":r("metadata/auto/"),default:function(e,t){e.path.match("https://api-content.dropbox.com/1/files/")&&(e.method="blob"),t(e.path)}},post:{"me/files":function(t,n){var i=t.data.parent,o=t.data.name;t.data={file:t.data.file},"string"==typeof t.data.file&&(t.data.file=e.utils.toBlob(t.data.file)),n("https://api-content.dropbox.com/1/files_put/auto/"+i+"/"+o)},"me/folders":function(t,n){var i=t.data.name;t.data={},n("fileops/create_folder?root=@{root|sandbox}&"+e.utils.param({path:i}))}},del:{"me/files":"fileops/delete?root=@{root|sandbox}&path=@{id}","me/folder":"fileops/delete?root=@{root|sandbox}&path=@{id}"},wrap:{me:function(e){if(i(e),!e.uid)return e;e.name=e.display_name;var t=e.name.split(" ");return e.first_name=t.shift(),e.last_name=t.join(" "),e.id=e.uid,delete e.uid,delete e.display_name,e},default:function(e,t,n){return i(e),e.is_dir&&e.contents&&(e.data=e.contents,delete e.contents,e.data.forEach(function(i){i.root=e.root,o(i,t,n)})),o(e,t,n),e.is_deleted&&(e.success=!0),e}},xhr:function(e){if(e.data&&e.data.file){var t=e.data.file;t&&(t.files?e.data=t.files[0]:e.data=t)}return"delete"===e.method&&(e.method="post"),!0},form:function(e,t){delete t.state,delete t.redirect_uri}}})}(i),function(e){e.init({facebook:{name:"Facebook",oauth:{version:2,auth:"https://www.facebook.com/v2.9/dialog/oauth/",grant:"https://graph.facebook.com/oauth/access_token"},scope:{basic:"public_profile",email:"email",share:"user_posts",birthday:"user_birthday",events:"user_events",photos:"user_photos",videos:"user_videos",friends:"user_friends",files:"user_photos,user_videos",publish_files:"user_photos,user_videos,publish_actions",publish:"publish_actions",offline_access:""},refresh:!1,login:function(e){e.options.force&&(e.qs.auth_type="reauthenticate"),e.qs.display=e.options.display||"popup"},logout:function(t,n){var i=e.utils.globalEvent(t),o=encodeURIComponent(e.settings.redirect_uri+"?"+e.utils.param({callback:i,result:JSON.stringify({force:!0}),state:"{}"})),r=(n.authResponse||{}).access_token;if(e.utils.iframe("https://www.facebook.com/logout.php?next="+o+"&access_token="+r),!r)return!1},base:"https://graph.facebook.com/v2.9/",get:{me:"me?fields=email,first_name,last_name,name,timezone,verified","me/friends":"me/friends","me/following":"me/friends","me/followers":"me/friends","me/share":"me/feed","me/like":"me/likes","me/files":"me/albums","me/albums":"me/albums?fields=cover_photo,name","me/album":"@{id}/photos?fields=picture","me/photos":"me/photos","me/photo":"@{id}","friend/albums":"@{id}/albums","friend/photos":"@{id}/photos"},post:{"me/share":"me/feed","me/photo":"@{id}"},wrap:{me:n,"me/friends":i,"me/following":i,"me/followers":i,"me/albums":o,"me/photos":o,"me/files":o,default:o},xhr:function(t,n){return"get"!==t.method&&"post"!==t.method||(n.suppress_response_codes=!0),"post"===t.method&&t.data&&"string"==typeof t.data.file&&(t.data.file=e.utils.toBlob(t.data.file)),!0},jsonp:function(t,n){var i=t.method;"get"===i||e.utils.hasBinary(t.data)?"delete"===t.method&&(n.method="delete",t.method="post"):(t.data.method=i,t.method="get")},form:function(e){return{callbackonload:!0}}}});var t="https://graph.facebook.com/";function n(e){return e.id&&(e.thumbnail=e.picture="https://graph.facebook.com/"+e.id+"/picture"),e}function i(e){return"data"in e&&e.data.forEach(n),e}function o(e,n,i){if("boolean"==typeof e&&(e={success:e}),e&&"data"in e){var o=i.query.access_token;if(!(e.data instanceof Array)){var r=e.data;delete e.data,e.data=[r]}e.data.forEach(function(e){e.picture&&(e.thumbnail=e.picture),e.pictures=(e.images||[]).sort(function(e,t){return e.width-t.width}),e.cover_photo&&e.cover_photo.id&&(e.thumbnail=t+e.cover_photo.id+"/picture?access_token="+o),"album"===e.type&&(e.files=e.photos=t+e.id+"/photos"),e.can_upload&&(e.upload_location=t+e.id+"/photos")})}return e}}(i),function(e){function t(t,n,i){var o=(i?"":"flickr:")+"?method="+t+"&api_key="+e.services.flickr.id+"&format=json";for(var r in n)n.hasOwnProperty(r)&&(o+="&"+r+"="+n[r]);return o}function n(n,i){return i||(i={}),function(o,r){var a,s;a=function(e){i.user_id=e,r(t(n,i,!0))},s=e.getAuthResponse("flickr"),a(s&&s.user_nsid?s.user_nsid:null)}}function i(e,t){var n="https://www.flickr.com/images/buddyicon.gif";return e.nsid&&e.iconserver&&e.iconfarm&&(n="https://farm"+e.iconfarm+".staticflickr.com/"+e.iconserver+"/buddyicons/"+e.nsid+(t?"_"+t:"")+".jpg"),n}function o(e,t,n,i,o){return"https://farm"+t+".staticflickr.com/"+n+"/"+e+"_"+i+(o=o?"_"+o:"")+".jpg"}function r(e){e&&e.stat&&"ok"!=e.stat.toLowerCase()&&(e.error={code:"invalid_request",message:e.message})}function a(e){if(e.photoset||e.photos){c(e=l(e,"photoset"in e?"photoset":"photos")),e.data=e.photo,delete e.photo;for(var t=0;t<e.data.length;t++){var n=e.data[t];n.name=n.title,n.picture=o(n.id,n.farm,n.server,n.secret,""),n.pictures=s(n.id,n.farm,n.server,n.secret),n.source=o(n.id,n.farm,n.server,n.secret,"b"),n.thumbnail=o(n.id,n.farm,n.server,n.secret,"m")}}return e}function s(e,t,n,i){return[{id:"t",max:100},{id:"m",max:240},{id:"n",max:320},{id:"",max:500},{id:"z",max:640},{id:"c",max:800},{id:"b",max:1024},{id:"h",max:1600},{id:"k",max:2048},{id:"o",max:2048}].map(function(r){return{source:o(e,t,n,i,r.id),width:r.max,height:r.max}})}function l(e,t){return t in e?e=e[t]:"error"in e||(e.error={code:"invalid_request",message:e.message||"Failed to get data from Flickr"}),e}function u(e){if(r(e),e.contacts){c(e=l(e,"contacts")),e.data=e.contact,delete e.contact;for(var t=0;t<e.data.length;t++){var n=e.data[t];n.id=n.nsid,n.name=n.realname||n.username,n.thumbnail=i(n,"m")}}return e}function c(e){e.page&&e.pages&&e.page!==e.pages&&(e.paging={next:"?page="+ ++e.page})}e.init({flickr:{name:"Flickr",oauth:{version:"1.0a",auth:"https://www.flickr.com/services/oauth/authorize?perms=read",request:"https://www.flickr.com/services/oauth/request_token",token:"https://www.flickr.com/services/oauth/access_token"},base:"https://api.flickr.com/services/rest",get:{me:n("flickr.people.getInfo"),"me/friends":n("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/following":n("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/followers":n("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/albums":n("flickr.photosets.getList",{per_page:"@{limit|50}"}),"me/album":n("flickr.photosets.getPhotos",{photoset_id:"@{id}"}),"me/photos":n("flickr.people.getPhotos",{per_page:"@{limit|50}"})},wrap:{me:function(e){if(r(e),(e=l(e,"person")).id){if(e.realname){e.name=e.realname._content;var t=e.name.split(" ");e.first_name=t.shift(),e.last_name=t.join(" ")}e.thumbnail=i(e,"l"),e.picture=i(e,"l")}return e},"me/friends":u,"me/followers":u,"me/following":u,"me/albums":function(e){return r(e),c(e=l(e,"photosets")),e.photoset&&(e.data=e.photoset,e.data.forEach(function(e){e.name=e.title._content,e.photos="https://api.flickr.com/services/rest"+t("flickr.photosets.getPhotos",{photoset_id:e.id},!0)}),delete e.photoset),e},"me/photos":function(e){return r(e),a(e)},default:function(e){return r(e),a(e)}},xhr:!1,jsonp:function(e,t){"get"==e.method&&(delete t.callback,t.jsoncallback=e.callbackID)}}})}(i),function(e){function t(e){!e.meta||400!==e.meta.code&&401!==e.meta.code||(e.error={code:"access_denied",message:e.meta.errorDetail})}function n(e){e&&e.id&&(e.thumbnail=e.photo.prefix+"100x100"+e.photo.suffix,e.name=e.firstName+" "+e.lastName,e.first_name=e.firstName,e.last_name=e.lastName,e.contact&&e.contact.email&&(e.email=e.contact.email))}function i(e,t){var n=t.access_token;return delete t.access_token,t.oauth_token=n,t.v=20121125,!0}e.init({foursquare:{name:"Foursquare",oauth:{version:2,auth:"https://foursquare.com/oauth2/authenticate",grant:"https://foursquare.com/oauth2/access_token"},refresh:!0,base:"https://api.foursquare.com/v2/",get:{me:"users/self","me/friends":"users/self/friends","me/followers":"users/self/friends","me/following":"users/self/friends"},wrap:{me:function(e){return t(e),e&&e.response&&n(e=e.response.user),e},default:function(e){return t(e),e&&"response"in e&&"friends"in e.response&&"items"in e.response.friends&&(e.data=e.response.friends.items,e.data.forEach(n),delete e.response),e}},xhr:i,jsonp:i}})}(i),function(e){function t(e,t){var n=t?t.statusCode:e&&"meta"in e&&"status"in e.meta&&e.meta.status;401!==n&&403!==n||(e.error={code:"access_denied",message:e.message||(e.data?e.data.message:"Could not get response")},delete e.message)}function n(e){e.id&&(e.thumbnail=e.picture=e.avatar_url,e.name=e.login)}e.init({github:{name:"GitHub",oauth:{version:2,auth:"https://github.com/login/oauth/authorize",grant:"https://github.com/login/oauth/access_token",response_type:"code"},scope:{email:"user:email"},base:"https://api.github.com/",get:{me:"user","me/friends":"user/following?per_page=@{limit|100}","me/following":"user/following?per_page=@{limit|100}","me/followers":"user/followers?per_page=@{limit|100}","me/like":"user/starred?per_page=@{limit|100}"},wrap:{me:function(e,i){return t(e,i),n(e),e},default:function(e,i,o){return t(e,i),Array.isArray(e)&&(e={data:e}),e.data&&(!function(e,t,n){if(e.data&&e.data.length&&t&&t.Link){var i=t.Link.match(/<(.*?)>;\s*rel=\"next\"/);i&&(e.paging={next:i[1]})}}(e,i),e.data.forEach(n)),e}},xhr:function(e){return"get"!==e.method&&e.data&&(e.headers=e.headers||{},e.headers["Content-Type"]="application/json","object"==typeof e.data&&(e.data=JSON.stringify(e.data))),!0}}})}(i),function(e){var t="https://www.google.com/m8/feeds/contacts/default/full?v=3.0&alt=json&max-results=@{limit|1000}&start-index=@{start|1}";function n(e){return parseInt(e,10)}function i(e){return c(e),e.data=e.items,delete e.items,e}function o(e){if(!e.error)return e.name||(e.name=e.title||e.message),e.picture||(e.picture=e.thumbnailLink),e.thumbnail||(e.thumbnail=e.thumbnailLink),"application/vnd.google-apps.folder"===e.mimeType&&(e.type="folder",e.files="https://www.googleapis.com/drive/v2/files?q=%22"+e.id+"%22+in+parents"),e}function r(e){return{source:e.url,width:e.width,height:e.height}}function a(e){if(c(e),"feed"in e&&"entry"in e.feed)e.data=e.feed.entry.map(u),delete e.feed;else{if("entry"in e)return u(e.entry);"items"in e?(e.data=e.items.map(o),delete e.items):o(e)}return e}function s(e){e.name=e.displayName||e.name,e.picture=e.picture||(e.image?e.image.url:null),e.thumbnail=e.picture}function l(e,t,n){c(e);if("feed"in e&&"entry"in e.feed){for(var i=n.query.access_token,o=0;o<e.feed.entry.length;o++){var r=e.feed.entry[o];if(r.id=r.id.$t,r.name=r.title.$t,delete r.title,r.gd$email&&(r.email=r.gd$email&&r.gd$email.length>0?r.gd$email[0].address:null,r.emails=r.gd$email,delete r.gd$email),r.updated&&(r.updated=r.updated.$t),r.link){var a=r.link.length>0?r.link[0].href:null;a&&r.link[0].gd$etag&&(a+=(a.indexOf("?")>-1?"&":"?")+"access_token="+i,r.picture=a,r.thumbnail=a),delete r.link}r.category&&delete r.category}e.data=e.feed.entry,delete e.feed}return e}function u(e){var t,n=e.media$group,i=n.media$content.length?n.media$content[0]:{},o=n.media$content||[],a=n.media$thumbnail||[],s=o.concat(a).map(r).sort(function(e,t){return e.width-t.width}),l=0,u={id:e.id.$t,name:e.title.$t,description:e.summary.$t,updated_time:e.updated.$t,created_time:e.published.$t,picture:i?i.url:null,pictures:s,images:[],thumbnail:i?i.url:null,width:i.width,height:i.height};if("link"in e)for(l=0;l<e.link.length;l++){var c=e.link[l];if(c.rel.match(/\#feed$/)){u.upload_location=u.files=u.photos=c.href;break}}if("category"in e&&e.category.length)for(t=e.category,l=0;l<t.length;l++)t[l].scheme&&t[l].scheme.match(/\#kind$/)&&(u.type=t[l].term.replace(/^.*?\#/,""));return"media$thumbnail"in n&&n.media$thumbnail.length&&(t=n.media$thumbnail,u.thumbnail=t[0].url,u.images=t.map(r)),(t=n.media$content)&&t.length&&u.images.push(r(t[0])),u}function c(e){if("feed"in e&&e.feed.openSearch$itemsPerPage){var t=n(e.feed.openSearch$itemsPerPage.$t),i=n(e.feed.openSearch$startIndex.$t);i+t<n(e.feed.openSearch$totalResults.$t)&&(e.paging={next:"?start="+(i+t)})}else"nextPageToken"in e&&(e.paging={next:"?pageToken="+e.nextPageToken})}function f(e,t){var n,i={};if(e.data&&"undefined"!=typeof HTMLInputElement&&e.data instanceof HTMLInputElement&&(e.data={file:e.data}),!e.data.name&&Object(Object(e.data.file).files).length&&"post"===e.method&&(e.data.name=e.data.file.files[0].name),"post"===e.method?e.data={title:e.data.name,parents:[{id:e.data.parent||"root"}],file:e.data.file}:(i=e.data,e.data={},i.parent&&(e.data.parents=[{id:e.data.parent||"root"}]),i.file&&(e.data.file=i.file),i.name&&(e.data.title=i.name)),"file"in e.data&&(n=e.data.file,delete e.data.file,"object"==typeof n&&"files"in n&&(n=n.files),!n||!n.length))t({error:{code:"request_invalid",message:"There were no files attached with this request to upload"}});else{var o=new function(){var e=[],t=(1e10*Math.random()).toString(32),n=0,i="\r\n",o=i+"--"+t,r=function(){},a=/^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i;function s(e){var t=new FileReader;t.onload=function(t){l(btoa(t.target.result),e.type+i+"Content-Transfer-Encoding: base64")},t.readAsBinaryString(e)}function l(t,o){e.push(i+"Content-Type: "+o+i+i+t),n--,r()}this.append=function(e,t){"string"!=typeof e&&"length"in Object(e)||(e=[e]);for(var o=0;o<e.length;o++){n++;var r=e[o];if("undefined"!=typeof File&&r instanceof File||"undefined"!=typeof Blob&&r instanceof Blob)s(r);else if("string"==typeof r&&r.match(a)){var u=r.match(a);l(r.replace(a,""),u[1]+i+"Content-Transfer-Encoding: base64")}else l(r,t)}},this.onready=function(i){(r=function(){0===n&&(e.unshift(""),e.push("--"),i(e.join(o),t),e=[])})()}};o.append(JSON.stringify(e.data),"application/json"),n&&o.append(n),o.onready(function(n,o){e.headers["content-type"]='multipart/related; boundary="'+o+'"',e.data=n,t("upload/drive/v2/files"+(i.id?"/"+i.id:"")+"?uploadType=multipart")})}}e.init({google:{name:"Google Sign-In",oauth:{version:2,auth:"https://accounts.google.com/o/oauth2/v2/auth",grant:"https://www.googleapis.com/oauth2/v4/token"},scope:{basic:"openid profile",email:"email",birthday:"",events:"",photos:"https://picasaweb.google.com/data/",videos:"http://gdata.youtube.com",files:"https://www.googleapis.com/auth/drive.readonly",publish:"",publish_files:"https://www.googleapis.com/auth/drive",share:"",create_event:"",offline_access:""},scope_delim:" ",login:function(e){"code"===e.qs.response_type?e.qs.access_type="offline":e.qs.response_type.indexOf("id_token")>-1&&(e.qs.nonce=parseInt(1e12*Math.random(),10).toString(36)),e.options.force&&(e.qs.approval_prompt="force")},base:"https://www.googleapis.com/",get:{me:"oauth2/v3/userinfo?alt=json","me/following":t,"me/followers":t,"me/contacts":t,"me/albums":"https://picasaweb.google.com/data/feed/api/user/default?alt=json&max-results=@{limit|100}&start-index=@{start|1}","me/album":function(e,t){var n=e.query.id;delete e.query.id,t(n.replace("/entry/","/feed/"))},"me/photos":"https://picasaweb.google.com/data/feed/api/user/default?alt=json&kind=photo&max-results=@{limit|100}&start-index=@{start|1}","me/file":"drive/v2/files/@{id}","me/files":"drive/v2/files?q=%22@{parent|root}%22+in+parents+and+trashed=false&maxResults=@{limit|100}","me/folders":"drive/v2/files?q=%22@{id|root}%22+in+parents+and+mimeType+=+%22application/vnd.google-apps.folder%22+and+trashed=false&maxResults=@{limit|100}","me/folder":"drive/v2/files?q=%22@{id|root}%22+in+parents+and+trashed=false&maxResults=@{limit|100}"},post:{"me/files":f,"me/folders":function(e,t){e.data={title:e.data.name,parents:[{id:e.data.parent||"root"}],mimeType:"application/vnd.google-apps.folder"},t("drive/v2/files")}},put:{"me/files":f},del:{"me/files":"drive/v2/files/@{id}","me/folder":"drive/v2/files/@{id}"},patch:{"me/file":"drive/v2/files/@{id}"},wrap:{me:function(e){return e.sub&&(e.id=e.sub),e.id&&(e.last_name=e.family_name||(e.name?e.name.familyName:null),e.first_name=e.given_name||(e.name?e.name.givenName:null),e.emails&&e.emails.length&&(e.email=e.emails[0].value),s(e)),e},"me/friends":function(e){return e.items&&(c(e),e.data=e.items,e.data.forEach(s),delete e.items),e},"me/contacts":l,"me/followers":l,"me/following":l,"me/share":i,"me/feed":i,"me/albums":a,"me/photos":function(e){"feed"in e&&(e.data="entry"in e.feed?e.feed.entry.map(u):[],delete e.feed);return e},default:a},xhr:function(t){return"post"===t.method||"put"===t.method?function(e){if("object"==typeof e.data)try{e.data=JSON.stringify(e.data),e.headers["content-type"]="application/json"}catch(e){}}(t):"patch"===t.method&&(e.utils.extend(t.query,t.data),t.data=null),!0},form:!1}})}(i),function(e){function t(e){return"string"==typeof e?{error:{code:"invalid_request",message:e}}:(e&&"meta"in e&&"error_type"in e.meta&&(e.error={code:e.meta.error_type,message:e.meta.error_message}),e)}function n(e){return o(e),e&&"data"in e&&e.data.forEach(i),e}function i(e){e.id&&(e.thumbnail=e.profile_picture,e.name=e.full_name||e.username)}function o(e){"pagination"in e&&(e.paging={next:e.pagination.next_url},delete e.pagination)}e.init({instagram:{name:"Instagram",oauth:{version:2,auth:"https://instagram.com/oauth/authorize/",grant:"https://api.instagram.com/oauth/access_token"},refresh:!0,scope:{basic:"basic",photos:"",friends:"relationships",publish:"likes comments",email:"",share:"",publish_files:"",files:"",videos:"",offline_access:""},scope_delim:" ",base:"https://api.instagram.com/v1/",get:{me:"users/self","me/feed":"users/self/feed?count=@{limit|100}","me/photos":"users/self/media/recent?min_id=0&count=@{limit|100}","me/friends":"users/self/follows?count=@{limit|100}","me/following":"users/self/follows?count=@{limit|100}","me/followers":"users/self/followed-by?count=@{limit|100}","friend/photos":"users/@{id}/media/recent?min_id=0&count=@{limit|100}"},post:{"me/like":function(e,t){var n=e.data.id;e.data={},t("media/"+n+"/likes")}},del:{"me/like":"media/@{id}/likes"},wrap:{me:function(e){return t(e),"data"in e&&(e.id=e.data.id,e.thumbnail=e.data.profile_picture,e.name=e.data.full_name||e.data.username),e},"me/friends":n,"me/following":n,"me/followers":n,"me/photos":function(e){return t(e),o(e),"data"in e&&(e.data=e.data.filter(function(e){return"image"===e.type}),e.data.forEach(function(e){e.name=e.caption?e.caption.text:null,e.thumbnail=e.images.thumbnail.url,e.picture=e.images.standard_resolution.url,e.pictures=Object.keys(e.images).map(function(t){return function(e){return{source:e.url,width:e.width,height:e.height}}(e.images[t])}).sort(function(e,t){return e.width-t.width})})),e},default:function(e){return o(e=t(e)),e}},xhr:function(e,t){var n=e.method,i="get"!==n;return i&&("post"!==n&&"put"!==n||!e.query.access_token||(e.data.access_token=e.query.access_token,delete e.query.access_token),e.proxy=i),i},form:!1}})}(i),function(e){function t(e,t){var n,i;return e&&"Message"in e&&(i=e.Message,delete e.Message,"ErrorCode"in e?(n=e.ErrorCode,delete e.ErrorCode):n=function(e){switch(e.statusCode){case 400:return"invalid_request";case 403:return"stale_token";case 401:return"invalid_token";case 500:default:return"server_error"}}(t),e.error={code:n,message:i,details:e}),e}e.init({joinme:{name:"join.me",oauth:{version:2,auth:"https://secure.join.me/api/public/v1/auth/oauth2",grant:"https://secure.join.me/api/public/v1/auth/oauth2"},refresh:!1,scope:{basic:"user_info",user:"user_info",scheduler:"scheduler",start:"start_meeting",email:"",friends:"",share:"",publish:"",photos:"",publish_files:"",files:"",videos:"",offline_access:""},scope_delim:" ",login:function(e){e.options.popup.width=400,e.options.popup.height=700},base:"https://api.join.me/v1/",get:{me:"user",meetings:"meetings","meetings/info":"meetings/@{id}"},post:{"meetings/start/adhoc":function(e,t){t("meetings/start")},"meetings/start/scheduled":function(e,t){var n=e.data.meetingId;e.data={},t("meetings/"+n+"/start")},"meetings/schedule":function(e,t){t("meetings")}},patch:{"meetings/update":function(e,t){t("meetings/"+e.data.meetingId)}},del:{"meetings/delete":"meetings/@{id}"},wrap:{me:function(e,n){return t(e,n),e.email?(e.name=e.fullName,e.first_name=e.name.split(" ")[0],e.last_name=e.name.split(" ")[1],e.id=e.email,e):e},default:function(e,n){return t(e,n),e}},xhr:function(e,t){var n=t.access_token;delete t.access_token,e.headers.Authorization="Bearer "+n,"get"!==e.method&&e.data&&(e.headers["Content-Type"]="application/json","object"==typeof e.data&&(e.data=JSON.stringify(e.data)));"put"===e.method&&(e.method="patch");return!0}}})}(i),function(e){function t(e){e&&"errorCode"in e&&(e.error={code:e.status,message:e.message})}function n(e){if(!e.error)return e.first_name=e.firstName,e.last_name=e.lastName,e.name=e.formattedName||e.first_name+" "+e.last_name,e.thumbnail=e.pictureUrl,e.email=e.emailAddress,e}function i(e){return t(e),o(e),e.values&&(e.data=e.values.map(n),delete e.values),e}function o(e){"_count"in e&&"_start"in e&&e._count+e._start<e._total&&(e.paging={next:"?start="+(e._start+e._count)+"&count="+e._count})}function r(e){e.access_token&&(e.oauth2_access_token=e.access_token,delete e.access_token)}function a(e,t){e.headers["x-li-format"]="json";var n=e.data.id;e.data=("delete"!==e.method).toString(),e.method="put",t("people/~/network/updates/key="+n+"/is-liked")}e.init({linkedin:{oauth:{version:2,response_type:"code",auth:"https://www.linkedin.com/uas/oauth2/authorization",grant:"https://www.linkedin.com/uas/oauth2/accessToken"},refresh:!0,scope:{basic:"r_basicprofile",email:"r_emailaddress",files:"",friends:"",photos:"",publish:"w_share",publish_files:"w_share",share:"",videos:"",offline_access:""},scope_delim:" ",base:"https://api.linkedin.com/v1/",get:{me:"people/~:(picture-url,first-name,last-name,id,formatted-name,email-address)","me/share":"people/~/network/updates?count=@{limit|250}"},post:{"me/share":function(e,t){var n={visibility:{code:"anyone"}};e.data.id?n.attribution={share:{id:e.data.id}}:(n.comment=e.data.message,e.data.picture&&e.data.link&&(n.content={"submitted-url":e.data.link,"submitted-image-url":e.data.picture})),e.data=JSON.stringify(n),t("people/~/shares?format=json")},"me/like":a},del:{"me/like":a},wrap:{me:function(e){return t(e),n(e),e},"me/friends":i,"me/following":i,"me/followers":i,"me/share":function(e){return t(e),o(e),e.values&&(e.data=e.values.map(n),e.data.forEach(function(e){e.message=e.headline}),delete e.values),e},default:function(e,n){t(e),function(e,t){"{}"===JSON.stringify(e)&&200===t.statusCode&&(e.success=!0)}(e,n),o(e)}},jsonp:function(e,t){r(t),"get"===e.method&&(t.format="jsonp",t["error-callback"]=e.callbackID)},xhr:function(e,t){return"get"!==e.method&&(r(t),e.headers["Content-Type"]="application/json",e.headers["x-li-format"]="json",e.proxy=!0,!0)}}})}(i),function(e){function t(e,t){var n=t.access_token;return delete t.access_token,t.oauth_token=n,t["_status_code_map[302]"]=200,!0}function n(e){return e.id&&(e.picture=e.avatar_url,e.thumbnail=e.avatar_url,e.name=e.username||e.full_name),e}e.init({soundcloud:{name:"SoundCloud",oauth:{version:2,auth:"https://soundcloud.com/connect",grant:"https://soundcloud.com/oauth2/token"},base:"https://api.soundcloud.com/",get:{me:"me.json","me/friends":"me/followings.json","me/followers":"me/followers.json","me/following":"me/followings.json",default:function(e,t){t(e.path+".json")}},wrap:{me:function(e){return n(e),e},default:function(e){var t;return Array.isArray(e)&&(e={data:e.map(n)}),"next_href"in(t=e)&&(t.paging={next:t.next_href}),e}},xhr:t,jsonp:t}})}(i),function(e){function t(e){return e.id&&(e.name=e.display_name,e.thumbnail=e.images.length?e.images[0].url:null,e.picture=e.thumbnail),e}function n(e){e&&"next"in e&&(e.paging={next:e.next},delete e.next)}e.init({spotify:{name:"Spotify",oauth:{version:2,auth:"https://accounts.spotify.com/authorize",grant:"https://accounts.spotify.com/api/token"},scope_delim:" ",scope:{basic:"",photos:"",friends:"user-follow-read",publish:"user-library-read",email:"user-read-email",share:"",publish_files:"",files:"",videos:"",offline_access:""},base:"https://api.spotify.com",get:{me:"/v1/me","me/following":"/v1/me/following?type=artist","me/like":"/v1/me/tracks"},wrap:{me:t,"me/following":function(e){n(e),e&&"artists"in e&&(e.data=e.artists.items.forEach(t));return e},"me/like":function(e){return n(e),e.data=e.items,e}},xhr:function(e,t){var n=t.access_token;return delete t.access_token,e.headers.Authorization="Bearer "+n,!0},jsonp:!1}})}(i),function(e){var t="https://api.twitter.com/";function n(e){if(e.id){if(e.name){var t=e.name.split(" ");e.first_name=t.shift(),e.last_name=t.join(" ")}e.thumbnail=e.profile_image_url_https||e.profile_image_url}return e}function i(e){return o(e),r(e),e.users&&(e.data=e.users.map(n),delete e.users),e}function o(e){if(e.errors){var t=e.errors[0];e.error={code:"request_failed",message:t.message}}}function r(e){"next_cursor_str"in e&&(e.paging={next:"?cursor="+e.next_cursor_str})}e.init({twitter:{oauth:{version:"1.0a",auth:t+"oauth/authenticate",request:t+"oauth/request_token",token:t+"oauth/access_token"},login:function(e){this.oauth.auth=this.oauth.auth.replace("?force_login=true","")+(e.options.force?"?force_login=true":"")},base:t+"1.1/",get:{me:"account/verify_credentials.json","me/friends":"friends/list.json?count=@{limit|200}","me/following":"friends/list.json?count=@{limit|200}","me/followers":"followers/list.json?count=@{limit|200}","me/share":"statuses/user_timeline.json?count=@{limit|200}","me/like":"favorites/list.json?count=@{limit|200}"},post:{"me/share":function(t,n){var i=t.data;t.data=null;var o=[];i.message&&(o.push(i.message),delete i.message),i.link&&(o.push(i.link),delete i.link),i.picture&&(o.push(i.picture),delete i.picture),o.length&&(i.status=o.join(" ")),i.file?(i["media[]"]=i.file,delete i.file,t.data=i,n("statuses/update_with_media.json")):"id"in i?n("statuses/retweet/"+i.id+".json"):(e.utils.extend(t.query,i),n("statuses/update.json?include_entities=1"))},"me/like":function(e,t){var n=e.data.id;e.data=null,t("favorites/create.json?id="+n)}},del:{"me/like":function(){p.method="post";var e=p.data.id;p.data=null,callback("favorites/destroy.json?id="+e)}},wrap:{me:function(e){return o(e),n(e),e},"me/friends":i,"me/followers":i,"me/following":i,"me/share":function(e){return o(e),r(e),!e.error&&"length"in e?{data:e}:e},default:function(e){return r(e=function(e){return Array.isArray(e)?{data:e}:e}(e)),e}},xhr:function(e){return"get"!==e.method}}})}(i),function(e){e.init({vk:{name:"Vk",oauth:{version:2,auth:"https://oauth.vk.com/authorize",grant:"https://oauth.vk.com/access_token"},scope:{email:"email",friends:"friends",photos:"photos",videos:"video",share:"share",offline_access:"offline"},refresh:!0,login:function(e){e.qs.display=window.navigator&&window.navigator.userAgent&&/ipad|phone|phone|android/.test(window.navigator.userAgent.toLowerCase())?"mobile":"popup"},base:"https://api.vk.com/method/",get:{me:function(e,t){e.query.fields="id,first_name,last_name,photo_max",t("users.get")}},wrap:{me:function(e,t,n){return function(e){if(e.error){var t=e.error;e.error={code:t.error_code,message:t.error_msg}}}(e),function(e,t){null!==e&&"response"in e&&null!==e.response&&e.response.length&&((e=e.response[0]).id=e.uid,e.thumbnail=e.picture=e.photo_max,e.name=e.first_name+" "+e.last_name,t.authResponse&&null!==t.authResponse.email&&(e.email=t.authResponse.email));return e}(e,n)}},xhr:!1,jsonp:!0,form:!1}})}(i),function(e){function t(e){return"data"in e&&e.data.forEach(function(e){e.picture&&(e.thumbnail=e.picture),e.images&&(e.pictures=e.images.map(n).sort(function(e,t){return e.width-t.width}))}),e}function n(e){return{width:e.width,height:e.height,source:e.source}}function i(e,t,n){if(e.id){var i=n.query.access_token;if(e.emails&&(e.email=e.emails.preferred),!1!==e.is_friend){var o=e.user_id||e.id;e.thumbnail=e.picture="https://apis.live.net/v5.0/"+o+"/picture?access_token="+i}}return e}function o(e,t,n){return"data"in e&&e.data.forEach(function(e){i(e,0,n)}),e}e.init({windows:{name:"Windows live",oauth:{version:2,auth:"https://login.live.com/oauth20_authorize.srf",grant:"https://login.live.com/oauth20_token.srf"},refresh:!0,logout:function(){return"http://login.live.com/oauth20_logout.srf?ts="+(new Date).getTime()},scope:{basic:"wl.signin,wl.basic",email:"wl.emails",birthday:"wl.birthday",events:"wl.calendars",photos:"wl.photos",videos:"wl.photos",friends:"wl.contacts_emails",files:"wl.skydrive",publish:"wl.share",publish_files:"wl.skydrive_update",share:"wl.share",create_event:"wl.calendars_update,wl.events_create",offline_access:"wl.offline_access"},base:"https://apis.live.net/v5.0/",get:{me:"me","me/friends":"me/friends","me/following":"me/contacts","me/followers":"me/friends","me/contacts":"me/contacts","me/albums":"me/albums","me/album":"@{id}/files","me/photo":"@{id}","me/files":"@{parent|me/skydrive}/files","me/folders":"@{id|me/skydrive}/files","me/folder":"@{id|me/skydrive}/files"},post:{"me/albums":"me/albums","me/album":"@{id}/files/","me/folders":"@{id|me/skydrive/}","me/files":"@{parent|me/skydrive}/files"},del:{"me/album":"@{id}","me/photo":"@{id}","me/folder":"@{id}","me/files":"@{id}"},wrap:{me:i,"me/friends":o,"me/contacts":o,"me/followers":o,"me/following":o,"me/albums":function(e){"data"in e&&e.data.forEach(function(e){e.photos=e.files="https://apis.live.net/v5.0/"+e.id+"/photos"});return e},"me/photos":t,default:t},xhr:function(t){return"get"===t.method||"delete"===t.method||e.utils.hasBinary(t.data)||("string"==typeof t.data.file?t.data.file=e.utils.toBlob(t.data.file):(t.data=JSON.stringify(t.data),t.headers={"Content-Type":"application/json"})),!0},jsonp:function(t){"get"===t.method||e.utils.hasBinary(t.data)||(t.data.method=t.method,t.method="get")}}})}(i),function(e){function t(e){e&&"meta"in e&&"error_type"in e.meta&&(e.error={code:e.meta.error_type,message:e.meta.error_message})}function n(e,n,r){return t(e),o(e,n,r),e.query&&e.query.results&&e.query.results.contact&&(e.data=e.query.results.contact,delete e.query,Array.isArray(e.data)||(e.data=[e.data]),e.data.forEach(i)),e}function i(e){e.id=null,!e.fields||e.fields instanceof Array||(e.fields=[e.fields]),(e.fields||[]).forEach(function(t){"email"===t.type&&(e.email=t.value),"name"===t.type&&(e.first_name=t.value.givenName,e.last_name=t.value.familyName,e.name=t.value.givenName+" "+t.value.familyName),"yahooid"===t.type&&(e.id=t.value)})}function o(e,t,n){return e.query&&e.query.count&&n.options&&(e.paging={next:"?start="+(e.query.count+(+n.options.start||1))}),e}function r(e){return"https://query.yahooapis.com/v1/yql?q="+(e+" limit @{limit|100} offset @{start|0}").replace(/\s/g,"%20")+"&format=json"}e.init({yahoo:{oauth:{version:"1.0a",auth:"https://api.login.yahoo.com/oauth/v2/request_auth",request:"https://api.login.yahoo.com/oauth/v2/get_request_token",token:"https://api.login.yahoo.com/oauth/v2/get_token"},login:function(e){e.options.popup.width=560;try{delete e.qs.state.scope}catch(e){}},base:"https://social.yahooapis.com/v1/",get:{me:r("select * from social.profile(0) where guid=me"),"me/friends":r("select * from social.contacts(0) where guid=me"),"me/following":r("select * from social.contacts(0) where guid=me")},wrap:{me:function(e){if(t(e),e.query&&e.query.results&&e.query.results.profile){(e=e.query.results.profile).id=e.guid,e.last_name=e.familyName,e.first_name=e.givenName||e.nickname;var n=[];e.first_name&&n.push(e.first_name),e.last_name&&n.push(e.last_name),e.name=n.join(" "),e.email=e.emails&&e.emails[0]?e.emails[0].handle:null,e.thumbnail=e.image?e.image.imageUrl:null}return e},"me/friends":n,"me/following":n,default:o}}})}(i),"function"==typeof define&&define.amd&&define(function(){return i}),"object"==typeof t&&t.exports&&(t.exports=i)}).call(this,e("_process"),e("timers").setImmediate)},{_process:2,timers:3}],2:[function(e,t,n){var i,o,r=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(i===setTimeout)return setTimeout(e,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(e){i=a}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(e){o=s}}();var u,c=[],f=!1,d=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&m())}function m(){if(!f){var e=l(p);f=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,f=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new h(e,t)),1!==c.length||f||l(m)},h.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},{}],3:[function(e,t,n){(function(t,i){var o=e("process/browser.js").nextTick,r=Function.prototype.apply,a=Array.prototype.slice,s={},l=0;function u(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new u(r.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new u(r.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=l++,i=!(arguments.length<2)&&a.call(arguments,1);return s[t]=!0,o(function(){s[t]&&(i?e.apply(null,i):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof i?i:function(e){delete s[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":2,timers:3}],4:[function(e,t,n){"use strict";e("hellojs")},{hellojs:1}]},{},[4]);