forked from Web2Integrators/boa
/
scripts.81ed5c128e6500b8a92f.bundle.js
1 lines (1 loc) · 28.1 KB
/
scripts.81ed5c128e6500b8a92f.bundle.js
1
webpackJsonp([2,5],{3:function(e,t,n){e.exports=n("roYo")},DEzS:function(e,t){e.exports='/*! hellojs v1.14.1 | (c) 2012-2017 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */\nObject.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){n=[];for(t in 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 r=arguments.length>=2?arguments[1]:void 0,o=0;n>o;o++)o in t&&e.call(r,t[o],o,t);return this}),Array.prototype.filter||(Array.prototype.filter=function(e,t){var n=[];return this.forEach(function(r,o,i){e.call(t||void 0,r,o,i)&&n.push(r)}),n}),Array.prototype.map||(Array.prototype.map=function(e,t){var n=[];return this.forEach(function(r,o,i){n.push(e.call(t||void 0,r,o,i))}),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){function t(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var n=[].slice,r=n.call(arguments,1),o=this,i=function(){return o.apply(this instanceof t?this:e||window,r.concat(n.call(arguments)))};return t.prototype=this.prototype,i.prototype=new t,i});var hello=function(e){return hello.use(e)};hello.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]=hello.utils.extend(e[n],t[n]);else Array.isArray(t)&&(t=t.slice(0)),e=t}),e}},hello.utils.extend(hello,{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 r in e)e.hasOwnProperty(r)&&"object"!=typeof e[r]&&(e[r]={id:e[r]});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(){function e(e,t){hello.emit(e,t)}function t(e){return e}function n(e){return!!e}var r,o=this,i=o.utils,s=i.error,a=i.Promise(),c=i.args({network:"s",options:"o",callback:"f"},arguments),l=i.diffKey(c.options,o.settings),u=c.options=i.merge(o.settings,c.options||{});if(u.popup=i.merge(o.settings.popup,c.options.popup||{}),c.network=c.network||o.settings.default_service,a.proxy.then(c.callback,c.callback),a.proxy.then(e.bind(this,"auth.login auth"),e.bind(this,"auth.failed auth")),"string"!=typeof c.network||!(c.network in o.services))return a.reject(s("invalid_network","The provided network was not recognized"));var f=o.services[c.network],p=i.globalEvent(function(e){var t;t=e?JSON.parse(e):s("cancelled","The authentication was not completed"),t.error?a.reject(t):(i.store(t.network,t),a.fulfill({network:t.network,authResponse:t}))}),h=i.url(u.redirect_uri).href,d=f.oauth.response_type||u.response_type;/\\bcode\\b/.test(d)&&!f.oauth.grant&&(d=d.replace(/\\bcode\\b/,"token")),c.qs=i.merge(l,{client_id:encodeURIComponent(f.id),response_type:encodeURIComponent(d),redirect_uri:encodeURIComponent(h),state:{client_id:f.id,network:c.network,display:u.display,callback:p,state:u.state,redirect_uri:h}});var m=i.store(c.network),y=/[,\\s]+/,v=o.settings.scope?[o.settings.scope.toString()]:[],g=i.merge(o.settings.scope_map,f.scope||{});if(u.scope&&v.push(u.scope.toString()),m&&"scope"in m&&m.scope instanceof String&&v.push(m.scope),v=v.join(",").split(y),v=i.unique(v).filter(n),c.qs.state.scope=v.join(","),v=v.map(function(e){return e in g?g[e]:e}),v=v.join(",").split(y),v=i.unique(v).filter(n),c.qs.scope=v.join(f.scope_delim||","),u.force===!1&&m&&"access_token"in m&&m.access_token&&"expires"in m&&m.expires>(new Date).getTime()/1e3){var w=i.diff((m.scope||"").split(y),(c.qs.state.scope||"").split(y));if(0===w.length)return a.fulfill({unchanged:!0,network:c.network,authResponse:m}),a}if("page"===u.display&&u.page_uri&&(c.qs.state.page_uri=i.url(u.page_uri).href),"login"in f&&"function"==typeof f.login&&f.login(c),(!/\\btoken\\b/.test(d)||parseInt(f.oauth.version,10)<2||"none"===u.display&&f.oauth.grant&&m&&m.refresh_token)&&(c.qs.state.oauth=f.oauth,c.qs.state.oauth_proxy=u.oauth_proxy),c.qs.state=encodeURIComponent(JSON.stringify(c.qs.state)),1===parseInt(f.oauth.version,10)?r=i.qs(u.oauth_proxy,c.qs,t):"none"===u.display&&f.oauth.grant&&m&&m.refresh_token?(c.qs.refresh_token=m.refresh_token,r=i.qs(u.oauth_proxy,c.qs,t)):r=i.qs(f.oauth.auth,c.qs,t),e("auth.init",c),"none"===u.display)i.iframe(r,h);else if("popup"===u.display)var b=i.popup(r,h,u.popup),x=setInterval(function(){if((!b||b.closed)&&(clearInterval(x),!a.state)){var e=s("cancelled","Login has been cancelled");b||(e=s("blocked","Popup was blocked")),e.network=c.network,a.reject(e)}},100);else window.location=r;return a.proxy},logout:function(){function e(e,t){hello.emit(e,t)}var t=this,n=t.utils,r=n.error,o=n.Promise(),i=n.args({name:"s",options:"o",callback:"f"},arguments);if(i.options=i.options||{},o.proxy.then(i.callback,i.callback),o.proxy.then(e.bind(this,"auth.logout auth"),e.bind(this,"error")),i.name=i.name||this.settings.default_service,i.authResponse=n.store(i.name),!i.name||i.name in t.services)if(i.name&&i.authResponse){var s=function(e){n.store(i.name,null),o.fulfill(hello.utils.merge({network:i.name},e||{}))},a={};if(i.options.force){var c=t.services[i.name].logout;if(c)if("function"==typeof c&&(c=c(s,i)),"string"==typeof c)n.iframe(c),a.force=null,a.message="Logout success on providers site was indeterminate";else if(void 0===c)return o.proxy}s(a)}else o.reject(r("invalid_session","There was no session to remove"));else o.reject(r("invalid_network","The network was unrecognized"));return o.proxy},getAuthResponse:function(e){return e=e||this.settings.default_service,e&&e in this.services?this.utils.store(e)||null:null},events:{}}),hello.utils.extend(hello.utils,{error:function(e,t){return{error:{code:e,message:t}}},qs:function(e,t,n){if(t){n=n||encodeURIComponent;for(var r in t){var o="([\\\\?\\\\&])"+r+"=[^\\\\&]*",i=new RegExp(o);e.match(i)&&(e=e.replace(i,"$1"+r+"="+n(t[r])),delete t[r])}}return this.isEmpty(t)?e:e+(e.indexOf("?")>-1?"&":"?")+this.param(t,n)},param:function(e,t){var n,r,o={};if("string"==typeof e){if(t=t||decodeURIComponent,r=e.replace(/^[\\#\\?]/,"").match(/([^=\\/\\&]+)=([^\\&]+)/g))for(var i=0;i<r.length;i++)n=r[i].match(/([^=]+)=(.*)/),o[n[1]]=t(n[2]);return o}t=t||encodeURIComponent;var s=e;o=[];for(var a in s)s.hasOwnProperty(a)&&s.hasOwnProperty(a)&&o.push([a,"?"===s[a]?"?":t(s[a])].join("="));return o.join("&")},store:function(){function e(){var e={};try{e=JSON.parse(n.getItem("hello"))||{}}catch(t){}return e}function t(e){n.setItem("hello",JSON.stringify(e))}for(var n,r=["localStorage","sessionStorage"],o=-1,i="test";r[++o];)try{n=window[r[o]],n.setItem(i+o,o),n.removeItem(i+o);break}catch(s){n=null}if(!n){var a=null;n={getItem:function(e){e+="=";for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var r=t[n].replace(/(^\\s+|\\s+$)/,"");if(r&&0===r.indexOf(e))return r.substr(e.length)}return a},setItem:function(e,t){a=t,document.cookie=e+"="+t}},a=n.getItem("hello")}return function(n,r,o){var i=e();if(n&&void 0===r)return i[n]||null;if(n&&null===r)try{delete i[n]}catch(s){i[n]=null}else{if(!n)return i;i[n]=r}return t(i),i||null}}(),append:function(e,t,n){var r="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 i in t[o])t[o].hasOwnProperty(i)&&(r[o][i]=t[o][i]);else"html"===o?r.innerHTML=t[o]:/^on/.test(o)?r[o]=t[o]:r.setAttribute(o,t[o]);return"body"===n?!function s(){document.body?document.body.appendChild(r):setTimeout(s,16)}():"object"==typeof n?n.appendChild(r):"string"==typeof n&&document.getElementsByTagName(n)[0].appendChild(r),r},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={},r=0,o=null,i=null;for(i in e)if(e.hasOwnProperty(i))break;if(1===t.length&&"object"==typeof t[0]&&"o!"!=e[i])for(i in t[0])if(e.hasOwnProperty(i)&&i in e)return t[0];for(i in e)if(e.hasOwnProperty(i))if(o=typeof t[r],"function"==typeof e[i]&&e[i].test(t[r])||"string"==typeof e[i]&&(e[i].indexOf("s")>-1&&"string"===o||e[i].indexOf("o")>-1&&"object"===o||e[i].indexOf("i")>-1&&"number"===o||e[i].indexOf("a")>-1&&"object"===o||e[i].indexOf("f")>-1&&"function"===o))n[i]=t[r++];else if("string"==typeof e[i]&&e[i].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 r in e)r in t||(n[r]=e[r]);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},Promise:function(){var e=0,t=1,n=2,r=function(t){return this instanceof r?(this.id="Thenable/1.0.6",this.state=e,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},void("function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this)))):new r(t)};r.prototype={fulfill:function(e){return o(this,t,"fulfillValue",e)},reject:function(e){return o(this,n,"rejectReason",e)},then:function(e,t){var n=this,o=new r;return n.onFulfilled.push(a(e,o,"fulfill")),n.onRejected.push(a(t,o,"reject")),i(n),o.proxy}};var o=function(t,n,r,o){return t.state===e&&(t.state=n,t[r]=o,i(t)),t},i=function(e){e.state===t?s(e,"onFulfilled",e.fulfillValue):e.state===n&&s(e,"onRejected",e.rejectReason)},s=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var o=function(){for(var e=0;e<r.length;e++)r[e](n)};"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick(o):"function"==typeof setImmediate?setImmediate(o):setTimeout(o,0)}},a=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var o;try{o=e(r)}catch(i){return void t.reject(i)}c(t,o)}}},c=function(e,t){if(e===t||e.proxy===t)return void e.reject(new TypeError("cannot resolve promise with itself"));var n;if("object"==typeof t&&null!==t||"function"==typeof t)try{n=t.then}catch(r){return void e.reject(r)}if("function"!=typeof n)e.fulfill(t);else{var o=!1;try{n.call(t,function(n){o||(o=!0,n===t?e.reject(new TypeError("circular thenable chain")):c(e,n))},function(t){o||(o=!0,e.reject(t))})}catch(r){o||e.reject(r)}}};return r}(),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 r=t.split(e),o=0;o<r.length;o++)this.events[r[o]]=[n].concat(this.events[r[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,r){t[t.length-1]="*"===n?e:n,this.events[n][r].apply(this,t)},r=this;r&&r.findEvents;)r.findEvents(e+",*",n),r=r.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 r=t.split(e);for(var o in this.events)if(this.events.hasOwnProperty(o)&&r.indexOf(o)>-1)for(var i=0;i<this.events[o].length;i++)this.events[o][i]&&n.call(this,o,i)},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(n){console.error(n)}},t},popup:function(e,t,n){var r=document.documentElement;if(n.height){var o=void 0!==window.screenTop?window.screenTop:screen.top,i=screen.height||window.innerHeight||r.clientHeight;n.top=parseInt((i-n.height)/2,10)+o}if(n.width){var s=void 0!==window.screenLeft?window.screenLeft:screen.left,a=screen.width||window.innerWidth||r.clientWidth;n.left=parseInt((a-n.width)/2,10)+s}var c=[];Object.keys(n).forEach(function(e){var t=n[e];c.push(e+(null!==t?"="+t:""))}),-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")&&(e=t+"#oauth_redirect="+encodeURIComponent(encodeURIComponent(e)));var l=window.open(e,"_blank",c.join(","));return l&&l.focus&&l.focus(),l},responseHandler:function(e,t){function n(e,t,n){var i=e.callback,a=e.network;if(s.store(a,e),!("display"in e&&"page"===e.display)){if(n&&i&&i in n){try{delete e.callback}catch(c){}s.store(a,e);var l=JSON.stringify(e);try{r(n,i)(l)}catch(c){}}o()}}function r(e,t){return 0!==t.indexOf("_hellojs_")?function(){throw"Could not execute callback "+t}:e[t]}function o(){if(e.frameElement)t.document.body.removeChild(e.frameElement);else{try{e.close()}catch(n){}e.addEventListener&&e.addEventListener("load",function(){e.close()})}}var i,s=this,a=e.location;if(i=s.param(a.search),i&&i.state&&(i.code||i.oauth_token)){var c=JSON.parse(i.state);i.redirect_uri=c.redirect_uri||a.href.replace(/[\\?\\#].*$/,"");var l=c.oauth_proxy+"?"+s.param(i);return void a.assign(l)}if(i=s.merge(s.param(a.search||""),s.param(a.hash||"")),i&&"state"in i){try{var u=JSON.parse(i.state);s.extend(i,u)}catch(f){console.error("Could not decode state parameter")}if("access_token"in i&&i.access_token&&i.network)i.expires_in&&0!==parseInt(i.expires_in,10)||(i.expires_in=0),i.expires_in=parseInt(i.expires_in,10),i.expires=(new Date).getTime()/1e3+(i.expires_in||31536e3),n(i,e,t);else if("error"in i&&i.error&&i.network)i.error={code:i.error,message:i.error_message||i.error_description},n(i,e,t);else if(i.callback&&i.callback in t){var p="result"in i&&i.result?JSON.parse(i.result):!1;r(t,i.callback)(p),o()}i.page_uri&&a.assign(i.page_uri)}else if("oauth_redirect"in i)return void a.assign(decodeURIComponent(i.oauth_redirect))}}),hello.utils.Event.call(hello),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 r(){var o=(new Date).getTime()/1e3,i=function(t){e.emit("auth."+t,{network:s,authResponse:a})};for(var s in e.services)if(e.services.hasOwnProperty(s)){if(!e.services[s].id)continue;var a=e.utils.store(s)||{},c=e.services[s],l=t[s]||{};if(a&&"callback"in a){var u=a.callback;try{delete a.callback}catch(f){}e.utils.store(s,a);try{window[u](a)}catch(f){}}if(a&&"expires"in a&&a.expires<o){var p=c.refresh||a.refresh_token;!p||s in n&&!(n[s]<o)?p||s in n||(i("expired"),n[s]=!0):(e.emit("notice",s+" has expired trying to resignin"),e.login(s,{display:"none",force:!1}),n[s]=o+600);continue}if(l.access_token===a.access_token&&l.expires===a.expires)continue;!a.access_token&&l.access_token?i("logout"):a.access_token&&!l.access_token?i("login"):a.expires!==l.expires&&i("update"),t[s]=a,s in n&&delete n[s]}setTimeout(r,1e3)}()}(hello),hello.api=function(){function e(e){e=e.replace(/\\@\\{([a-z\\_\\-]+)(\\|.*?)?\\}/gi,function(e,t,n){var s=n?n.replace(/^\\|/,""):"";return t in i.query?(s=i.query[t],delete i.query[t]):i.data&&t in i.data?(s=i.data[t],delete i.data[t]):n||o.reject(r("missing_attribute","The attribute "+t+" is missing from the request")),s}),e.match(/^https?:\\/\\//)||(e=l.base+e),i.url=e,n.request(i,function(e,t){if(!i.formatResponse)return void(("object"==typeof t?t.statusCode>=400:"object"==typeof e&&"error"in e)?o.reject(e):o.fulfill(e));if(e===!0?e={success:!0}:e||(e={}),"delete"===i.method&&(e=!e||n.isEmpty(e)?{success:!0}:e),l.wrap&&(i.path in l.wrap||"default"in l.wrap)){var r=i.path in l.wrap?i.path:"default",s=((new Date).getTime(),l.wrap[r](e,t,i));s&&(e=s)}e&&"paging"in e&&e.paging.next&&("?"===e.paging.next[0]?e.paging.next=i.path+e.paging.next:e.paging.next+="#"+i.path),!e||"error"in e?o.reject(e):o.fulfill(e)})}var t=this,n=t.utils,r=n.error,o=n.Promise(),i=n.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||(n.extend(i.query,i.data),i.data={});var s=i.data=i.data||{};if(o.then(i.callback,i.callback),!i.path)return o.reject(r("invalid_path","Missing the path parameter from the request"));i.path=i.path.replace(/^\\/+/,"");var a=(i.path.split(/[\\/\\:]/,2)||[])[0].toLowerCase();if(a in t.services){i.network=a;var c=new RegExp("^"+a+":?/?");i.path=i.path.replace(c,"")}i.network=t.settings.default_service=i.network||t.settings.default_service;var l=t.services[i.network];if(!l)return o.reject(r("invalid_network","Could not match the service requested: "+i.network));if(i.method in l&&i.path in l[i.method]&&l[i.method][i.path]===!1)return o.reject(r("invalid_path","The provided path is not available on the selected network"));i.oauth_proxy||(i.oauth_proxy=t.settings.oauth_proxy),"proxy"in i||(i.proxy=i.oauth_proxy&&l.oauth&&1===parseInt(l.oauth.version,10)),"timeout"in i||(i.timeout=t.settings.timeout),"formatResponse"in i||(i.formatResponse=!0),i.authResponse=t.getAuthResponse(i.network),i.authResponse&&i.authResponse.access_token&&(i.query.access_token=i.authResponse.access_token);var u,f=i.path;i.options=n.clone(i.query),i.data=n.clone(s);var p=l[{"delete":"del"}[i.method]||i.method]||{};if("get"===i.method){var h=f.split(/[\\?#]/)[1];h&&(n.extend(i.query,n.param(h)),f=f.replace(/\\?.*?(#|$)/,"$1"))}return(u=f.match(/#(.+)/,""))?(f=f.split("#")[0],i.path=u[1]):f in p?(i.path=f,f=p[f]):"default"in p&&(f=p["default"]),i.redirect_uri=t.settings.redirect_uri,i.xhr=l.xhr,i.jsonp=l.jsonp,i.form=l.form,"function"==typeof f?f(i,e):e(f),o.proxy},hello.utils.extend(hello.utils,{request:function(e,t){function n(e,t){var n;e.authResponse&&e.authResponse.oauth&&1===parseInt(e.authResponse.oauth.version,10)&&(n=e.query.access_token,delete e.query.access_token,e.proxy=!0),!e.data||"get"!==e.method&&"delete"!==e.method||(r.extend(e.query,e.data),e.data=null);var o=r.qs(e.url,e.query);e.proxy&&(o=r.qs(e.oauth_proxy,{path:o,access_token:n||"",then:e.proxy_response_type||("get"===e.method.toLowerCase()?"redirect":"proxy"),method:e.method.toLowerCase(),suppress_response_codes:!0})),t(o)}var r=this,o=r.error;r.isEmpty(e.data)||"FileList"in window||!r.hasBinary(e.data)||(e.xhr=!1,e.jsonp=!1);var i=this.request_cors(function(){return void 0===e.xhr||e.xhr&&("function"!=typeof e.xhr||e.xhr(e,e.query))});if(i)return void n(e,function(n){var o=r.xhr(e.method,n,e.headers,e.data,t);o.onprogress=e.onprogress||null,o.upload&&e.onuploadprogress&&(o.upload.onprogress=e.onuploadprogress)});var s=e.query;if(e.query=r.clone(e.query),e.callbackID=r.globalEvent(),e.jsonp!==!1){if(e.query.callback=e.callbackID,"function"==typeof e.jsonp&&e.jsonp(e,e.query),"get"===e.method)return void n(e,function(n){r.jsonp(n,t,e.callbackID,e.timeout)});e.query=s}if(e.form!==!1){e.query.redirect_uri=e.redirect_uri,e.query.state=JSON.stringify({callback:e.callbackID});var a;if("function"==typeof e.form&&(a=e.form(e,e.query)),"post"===e.method&&a!==!1)return void n(e,function(n){r.post(n,e.data,a,t,e.callbackID,e.timeout)})}t(o("invalid_request","There was no mechanism for handling this request"))},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:!1},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,r,o){function i(e){for(var t,n={},r=/([a-z\\-]+):\\s?(.*);?/gi;t=r.exec(e);)n[t[1]]=t[2];return n}var s=new XMLHttpRequest,a=this.error,c=!1;"blob"===e&&(c=e,e="GET"),e=e.toUpperCase(),s.onload=function(t){var n=s.response;try{n=JSON.parse(s.responseText)}catch(r){401===s.status&&(n=a("access_denied",s.statusText))}var c=i(s.getAllResponseHeaders());c.statusCode=s.status,o(n||("GET"===e?a("empty_response","Could not get resource"):{}),c)},s.onerror=function(e){var t=s.responseText;try{t=JSON.parse(s.responseText)}catch(n){}o(t||a("access_denied","Could not get resource"))};var l;if("GET"===e||"DELETE"===e)r=null;else if(r&&"string"!=typeof r&&!(r instanceof FormData)&&!(r instanceof File)&&!(r instanceof Blob)){var u=new FormData;for(l in r)r.hasOwnProperty(l)&&(r[l]instanceof HTMLInputElement?"files"in r[l]&&r[l].files.length>0&&u.append(l,r[l].files[0]):r[l]instanceof Blob?u.append(l,r[l],r.name):u.append(l,r[l]));r=u}if(s.open(e,t,!0),c&&("responseType"in s?s.responseType=c:s.overrideMimeType("text/plain; charset=x-user-defined")),n)for(l in n)s.setRequestHeader(l,n[l]);return s.send(r),s},jsonp:function(e,t,n,r){var o,i=this,s=i.error,a=0,c=document.getElementsByTagName("head")[0],l=s("server_error","server_error"),u=function(){a++||window.setTimeout(function(){t(l),c.removeChild(f)},0)};n=i.globalEvent(function(e){return l=e,!0},n),e=e.replace(new RegExp("=\\\\?(&|$)"),"="+n+"$1");var f=i.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=i.append("script",{text:"document.getElementById(\'"+n+"\').onerror();"}),f.async=!1),r&&window.setTimeout(function(){l=s("timeout","timeout"),u()},r),c.appendChild(f),o&&c.appendChild(o)},post:function(e,t,n,r,o,i){var s,a=this,c=a.error,l=document,u=null,f=[],p=0,h=null,d=0,m=function(e){d++||r(e)};a.globalEvent(m,o);var y;try{y=l.createElement(\'<iframe name="\'+o+\'">\')}catch(v){y=l.createElement("iframe")}if(y.name=o,y.id=o,y.style.display="none",n&&n.callbackonload&&(y.onload=function(){m({response:"posted",message:"Content was posted"})}),i&&setTimeout(function(){m(c("timeout","The post operation timed out"))},i),l.body.appendChild(y),a.domInstance("form",t)){for(u=t.form,p=0;p<u.elements.length;p++)u.elements[p]!==t&&u.elements[p].setAttribute("disabled",!0);t=u}if(a.domInstance("form",t))for(u=t,p=0;p<u.elements.length;p++)u.elements[p].disabled||"file"!==u.elements[p].type||(u.encoding=u.enctype="multipart/form-data",u.elements[p].setAttribute("name","file"));else{for(h in t)t.hasOwnProperty(h)&&a.domInstance("input",t[h])&&"file"===t[h].type&&(u=t[h].form,u.encoding=u.enctype="multipart/form-data");u||(u=l.createElement("form"),l.body.appendChild(u),s=u);var g;for(h in t)if(t.hasOwnProperty(h)){var w=a.domInstance("input",t[h])||a.domInstance("textArea",t[h])||a.domInstance("select",t[h]);if(w&&t[h].form===u)w&&t[h].name!==h&&(t[h].setAttribute("name",h),t[h].name=h);else{var b=u.elements[h];if(g)for(b instanceof NodeList||(b=[b]),p=0;p<b.length;p++)b[p].parentNode.removeChild(b[p]);g=l.createElement("input"),g.setAttribute("type","hidden"),g.setAttribute("name",h),w?g.value=t[h].value:a.domInstance(null,t[h])?g.value=t[h].innerHTML||t[h].innerText:g.value=t[h],u.appendChild(g)}}for(p=0;p<u.elements.length;p++)g=u.elements[p],g.name in t||g.getAttribute("disabled")===!0||(g.setAttribute("disabled",!0),f.push(g))}u.setAttribute("method","POST"),u.setAttribute("target",o),u.target=o,u.setAttribute("action",e),setTimeout(function(){u.submit(),setTimeout(function(){try{s&&s.parentNode.removeChild(s)}catch(e){try{console.error("HelloJS: could not remove iframe")}catch(t){}}for(var n=0;n<f.length;n++)f[n]&&(f[n].setAttribute("disabled",!1),f[n].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 r=atob(e.replace(t,"")),o=[],i=0;i<r.length;i++)o.push(r.charCodeAt(i));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=this,n=window,r=e.data;if(t.domInstance("form",r)?r=t.nodeListToJSON(r.elements):"NodeList"in n&&r instanceof NodeList?r=t.nodeListToJSON(r):t.domInstance("input",r)&&(r=t.nodeListToJSON([r])),("File"in n&&r instanceof n.File||"Blob"in n&&r instanceof n.Blob||"FileList"in n&&r instanceof n.FileList)&&(r={file:r}),!("FormData"in n&&r instanceof n.FormData))for(var o in r)if(r.hasOwnProperty(o))if("FileList"in n&&r[o]instanceof n.FileList)1===r[o].length&&(r[o]=r[o][0]);else{if(t.domInstance("input",r[o])&&"file"===r[o].type)continue;t.domInstance("input",r[o])||t.domInstance("select",r[o])||t.domInstance("textArea",r[o])?r[o]=r[o].value:t.domInstance(null,r[o])&&(r[o]=r[o].innerHTML||r[o].innerText)}return e.data=r,r},nodeListToJSON:function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];!r.disabled&&r.name&&("file"===r.type?t[r.name]=r:t[r.name]=r.value||r.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)}}(hello),hello.utils.responseHandler(window,window.opener||window.parent),"object"==typeof chrome&&"object"==typeof chrome.identity&&chrome.identity.launchWebAuthFlow&&!function(){function e(t,n){var r={closed:!1};return chrome.identity.launchWebAuthFlow({url:t,interactive:n},function(t){if(void 0===t)return void(r.closed=!0);var n=hello.utils.url(t),o={location:{assign:function(t){e(t,!1)},search:n.search,hash:n.hash,href:n.href},close:function(){}};hello.utils.responseHandler(o,window)}),r}hello.utils.popup=function(t){return e(t,!0)},hello.utils.iframe=function(t){e(t,!1)},hello.utils.request_cors=function(e){return e(),!0};var t={};chrome.storage.local.get("hello",function(e){t=e.hello||{}}),hello.utils.store=function(e,n){return 0===arguments.length?t:1===arguments.length?t[e]||null:n?(t[e]=n,chrome.storage.local.set({hello:t}),n):null===n?(delete t[e],chrome.storage.local.set({hello:t}),null):void 0}}(),function(){if(/^file:\\/{3}[^\\/]/.test(window.location.href)&&window.cordova){hello.utils.iframe=function(e,t){hello.utils.popup(e,t,{hidden:"yes"})};var e=hello.utils.popup;hello.utils.popup=function(t,n,r){var o=e.call(this,t,n,r);try{if(o&&o.addEventListener){var i=hello.utils.url(n),s=i.origin||i.protocol+"//"+i.hostname;o.addEventListener("loadstart",function(e){var t=e.url;if(0===t.indexOf(s)){var n=hello.utils.url(t),r={location:{assign:function(e){o.executeScript({code:\'window.location.href = "\'+e+\';"\'})},search:n.search,hash:n.hash,href:n.href},close:function(){if(o.close){o.close();try{o.closed=!0}catch(e){}}}};hello.utils.responseHandler(r,window)}})}}catch(a){}return o}}}(),"function"==typeof define&&define.amd&&define(function(){return hello}),"object"==typeof module&&module.exports&&(module.exports=hello);'},"P+fo":function(e,t){e.exports=function(e){"undefined"!=typeof execScript?execScript(e):eval.call(null,e)}},roYo:function(e,t,n){n("P+fo")(n("DEzS"))}},[3]);