text: !function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(8),a=function(t){function n(){return r(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this))}return i(n,t),u(n,[{key:"loadThreadListView",value:function(t){e.log("hello-go-sift: loadThreadListView: ",t)}}]),n}(s.EmailClientController);t.default=a,(0,s.registerEmailClientController)(new a)}).call(t,n(1))},function(e,t,n){(function(t){function r(){}function o(){p.log.apply(p,arguments)}function i(){p.log.apply(p,arguments)}function u(){p.warn.apply(p,arguments)}function s(e){v[e]=y()}function a(e){var t=v[e];if(!t)throw new Error("No such label: "+e);var n=y()-t;p.log(e+": "+n+"ms")}function c(){var e=new Error;e.name="Trace",e.message=d.format.apply(null,arguments),p.error(e.stack)}function f(e){p.log(d.inspect(e)+"\n")}function l(e){if(!e){var t=g.call(arguments,1);h.ok(!1,d.format.apply(null,t))}}var p,d=n(2),h=n(6),y=n(7),g=Array.prototype.slice,v={};p="undefined"!=typeof t&&t.console?t.console:"undefined"!=typeof window&&window.console?window.console:{};for(var m=[[r,"log"],[o,"info"],[i,"warn"],[u,"error"],[s,"time"],[a,"timeEnd"],[c,"trace"],[f,"dir"],[l,"assert"]],b=0;b<m.length;b++){var w=m[b],_=w[0],x=w[1];p[x]||(p[x]=_)}e.exports=p}).call(t,function(){return this}())},function(e,t,n){(function(e,r,o){function i(e,n){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(n)?r.showHidden=n:n&&t._extend(r,n),x(r.showHidden)&&(r.showHidden=!1),x(r.depth)&&(r.depth=2),x(r.colors)&&(r.colors=!1),x(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function s(e,t){return e}function a(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function c(e,n,r){if(e.customInspect&&n&&O(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return w(o)||(o=c(e,o,r)),o}var i=f(e,n);if(i)return i;var u=Object.keys(n),s=a(u);if(e.showHidden&&(u=Object.getOwnPropertyNames(n)),j(n)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return l(n);if(0===u.length){if(O(n)){var g=n.name?": "+n.name:"";return e.stylize("[Function"+g+"]","special")}if(k(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(j(n))return l(n)}var v="",m=!1,b=["{","}"];if(y(n)&&(m=!0,b=["[","]"]),O(n)){var _=n.name?": "+n.name:"";v=" [Function"+_+"]"}if(k(n)&&(v=" "+RegExp.prototype.toString.call(n)),E(n)&&(v=" "+Date.prototype.toUTCString.call(n)),j(n)&&(v=" "+l(n)),0===u.length&&(!m||0==n.length))return b[0]+v+b[1];if(r<0)return k(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var x;return x=m?p(e,n,r,s,u):u.map(function(t){return d(e,n,r,s,t,m)}),e.seen.pop(),h(x,v,b)}function f(e,t){if(x(t))return e.stylize("undefined","undefined");if(w(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,n,r,o){for(var i=[],u=0,s=t.length;u<s;++u)P(t,String(u))?i.push(d(e,t,n,r,String(u),!0)):i.push("");return o.forEach(function(o){o.match(/^\d+$/)||i.push(d(e,t,n,r,o,!0))}),i}function d(e,t,n,r,o,i){var u,s,a;if(a=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},a.get?s=a.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):a.set&&(s=e.stylize("[Setter]","special")),P(r,o)||(u="["+o+"]"),s||(e.seen.indexOf(a.value)<0?(s=v(n)?c(e,a.value,null):c(e,a.value,n-1),s.indexOf("\n")>-1&&(s=i?s.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return"   "+e}).join("\n"))):s=e.stylize("[Circular]","special")),x(u)){if(i&&o.match(/^\d+$/))return s;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+s}function h(e,t,n){var r=0,o=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function y(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function v(e){return null===e}function m(e){return null==e}function b(e){return"number"==typeof e}function w(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function x(e){return void 0===e}function k(e){return S(e)&&"[object RegExp]"===T(e)}function S(e){return"object"==typeof e&&null!==e}function E(e){return S(e)&&"[object Date]"===T(e)}function j(e){return S(e)&&("[object Error]"===T(e)||e instanceof Error)}function O(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function T(e){return Object.prototype.toString.call(e)}function C(e){return e<10?"0"+e.toString(10):e.toString(10)}function A(){var e=new Date,t=[C(e.getHours()),C(e.getMinutes()),C(e.getSeconds())].join(":");return[e.getDate(),L[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var D=/%[sdj%]/g;t.format=function(e){if(!w(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,o=r.length,u=String(e).replace(D,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n<o;s=r[++n])u+=v(s)||!S(s)?" "+s:" "+i(s);return u},t.deprecate=function(n,i){function u(){if(!s){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?o.trace(i):o.error(i),s=!0}return n.apply(this,arguments)}if(x(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var s=!1;return u};var q,G={};t.debuglog=function(e){if(x(q)&&(q=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!G[e])if(new RegExp("\\b"+e+"\\b","i").test(q)){var n=r.pid;G[e]=function(){var r=t.format.apply(t,arguments);o.error("%s %d: %s",e,n,r)}}else G[e]=function(){};return G[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=g,t.isNull=v,t.isNullOrUndefined=m,t.isNumber=b,t.isString=w,t.isSymbol=_,t.isUndefined=x,t.isRegExp=k,t.isObject=S,t.isDate=E,t.isError=j,t.isFunction=O,t.isPrimitive=I,t.isBuffer=n(4);var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){o.log("%s - %s",A(),t.format.apply(t,arguments))},t.inherits=n(5),t._extend=function(e,t){if(!t||!S(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(3),n(1))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function u(){y&&d&&(y=!1,d.length?h=d.concat(h):g=-1,h.length&&s())}function s(){if(!y){var e=o(u);y=!0;for(var t=h.length;t;){for(d=h,h=[];++g<t;)d&&d[g].run();g=-1,t=h.length}d=null,y=!1,i(e)}}function a(e,t){this.fun=e,this.array=t}function c(){}var f,l,p=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var d,h=[],y=!1,g=-1;p.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];h.push(new a(e,t)),1!==h.length||y||o(s)},a.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){(function(t){"use strict";/*!
  	 * The buffer module from node.js, for the browser.
  	 *
  	 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  	 * @license  MIT
  	 */
  function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0}function o(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}function i(e){return Object.prototype.toString.call(e)}function u(e){return!o(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function s(e){if(w.isFunction(e)){if(k)return e.name;var t=e.toString(),n=t.match(E);return n&&n[1]}}function a(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function c(e){if(k||!w.isFunction(e))return w.inspect(e);var t=s(e),n=t?": "+t:"";return"[Function"+n+"]"}function f(e){return a(c(e.actual),128)+" "+e.operator+" "+a(c(e.expected),128)}function l(e,t,n,r,o){throw new S.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:o})}function p(e,t){e||l(e,!0,t,"==",S.ok)}function d(e,t,n,s){if(e===t)return!0;if(o(e)&&o(t))return 0===r(e,t);if(w.isDate(e)&&w.isDate(t))return e.getTime()===t.getTime();if(w.isRegExp(e)&&w.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(u(e)&&u(t)&&i(e)===i(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===r(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;s=s||{actual:[],expected:[]};var a=s.actual.indexOf(e);return a!==-1&&a===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),y(e,t,n,s))}return n?e===t:e==t}function h(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function y(e,t,n,r){if(null===e||void 0===e||null===t||void 0===t)return!1;if(w.isPrimitive(e)||w.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var o=h(e),i=h(t);if(o&&!i||!o&&i)return!1;if(o)return e=x.call(e),t=x.call(t),d(e,t,n);var u,s,a=j(e),c=j(t);if(a.length!==c.length)return!1;for(a.sort(),c.sort(),s=a.length-1;s>=0;s--)if(a[s]!==c[s])return!1;for(s=a.length-1;s>=0;s--)if(u=a[s],!d(e[u],t[u],n,r))return!1;return!0}function g(e,t,n){d(e,t,!0)&&l(e,t,n,"notDeepStrictEqual",g)}function v(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&t.call({},e)===!0}function m(e){var t;try{e()}catch(e){t=e}return t}function b(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=m(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&l(o,n,"Missing expected exception"+r);var i="string"==typeof r,u=!e&&w.isError(o),s=!e&&o&&!n;if((u&&i&&v(o,n)||s)&&l(o,n,"Got unwanted exception"+r),e&&o&&n&&!v(o,n)||!e&&o)throw o}var w=n(2),_=Object.prototype.hasOwnProperty,x=Array.prototype.slice,k=function(){return"foo"===function(){}.name}(),S=e.exports=p,E=/\s*function\s+([^\(\s]*)\s*/;S.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=f(this),this.generatedMessage=!0);var t=e.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,o=s(t),i=r.indexOf("\n"+o);if(i>=0){var u=r.indexOf("\n",i+1);r=r.substring(u+1)}this.stack=r}}},w.inherits(S.AssertionError,Error),S.fail=l,S.ok=p,S.equal=function(e,t,n){e!=t&&l(e,t,n,"==",S.equal)},S.notEqual=function(e,t,n){e==t&&l(e,t,n,"!=",S.notEqual)},S.deepEqual=function(e,t,n){d(e,t,!1)||l(e,t,n,"deepEqual",S.deepEqual)},S.deepStrictEqual=function(e,t,n){d(e,t,!0)||l(e,t,n,"deepStrictEqual",S.deepStrictEqual)},S.notDeepEqual=function(e,t,n){d(e,t,!1)&&l(e,t,n,"notDeepEqual",S.notDeepEqual)},S.notDeepStrictEqual=g,S.strictEqual=function(e,t,n){e!==t&&l(e,t,n,"===",S.strictEqual)},S.notStrictEqual=function(e,t,n){e===t&&l(e,t,n,"!==",S.notStrictEqual)},S.throws=function(e,t,n){b(!0,e,t,n)},S.doesNotThrow=function(e,t,n){b(!1,e,t,n)},S.ifError=function(e){if(e)throw e};var j=Object.keys||function(e){var t=[];for(var n in e)_.call(e,n)&&t.push(n);return t}}).call(t,function(){return this}())},function(e,t){function n(){return(new Date).getTime()}e.exports=n},function(e,t,n){var r,o;(function(e,i){!function(e,n){n(t)}(this,function(t){function u(e,t){return t={exports:{}},e(t,t.exports),t.exports}function s(e){Q.trace("[opCreateDb]: ",e);var t={};switch(e.type){case"MSG":t.msg=Z("rs_msg_db-"+e.accountGuid,v(ee));break;case"SIFT":if(!e.siftGuid)throw new Error("[opCreateDb]: dbInfo.siftGuid undefined");Q.trace("[opCreateDb]: creating SIFT db");var n=g(e.schema,!0);n=n.addStore("_user.default").addStore("_redsift"),t.db=Z(e.siftGuid+"-"+e.accountGuid,n),t.msg=Z("rs_msg_db-"+e.accountGuid,v(ee));break;case"SYNC":Q.trace("[opCreateDb]: creating SYNC db"),t.db=Z("rs_sync_log-"+e.accountGuid,g(te));break;case"CLIENT":t.db=Z("rs_client_db-"+e.clientName,g(ne));break;default:throw new Error("[opCreateDb]: unsupported db type: "+e.type)}return t}function a(e,t,n){if(Q.trace("[opDel]: ",t,n),!t.bucket)return Promise.reject("[opDel]: params.bucket undefined");if(!t.keys||0===t.keys.length)return Q.trace("[opDel]: params.keys undefined"),Promise.resolve();if(X.indexOf(t.bucket)!==-1){var r=t.keys.map(function(e){return n+"/"+e});return m(e.msg,{bucket:t.bucket,keys:r})}return m(e.db,t)}function c(e,t,n){if(Q.trace("[opGet]: ",t),!t.bucket)return Promise.reject("[opGet]: params.bucket undefined");if(!t.keys||0===t.keys.length)return Promise.reject("[opGet]: param.keys undefined");if(X.indexOf(t.bucket)!==-1){var r=t.keys.map(function(e){return n+"/"+e});return _(e.msg,{bucket:t.bucket,keys:r}).then(function(e){return e.map(function(e){return{key:e.key.split("/")[1],value:e.value}})})}return _(e.db,t)}function f(e,t,n){return Q.trace("[opGetAll]: ",t,n),t.bucket?X.indexOf(t.bucket)!==-1?x(e.msg,{bucket:t.bucket,index:"sift.guid",range:n},!0).then(function(e){return e.map(function(e){return{key:e.key.split("/")[1],value:e.value}})}):x(e.db,t,!0):Promise.reject("[opGetAll]: params.bucket undefined")}function l(e,t,n){return Q.trace("[opGetAllKeys]: ",t,n),t.bucket?X.indexOf(t.bucket)!==-1?x(e.msg,{bucket:t.bucket,index:"sift.guid",range:n},!1).then(function(e){return e.map(function(e){return e.key.split("/")[1]})}):x(e.db,t,!1):Promise.reject("[opGetAllKeys]: params.bucket undefined")}function p(e,t,n){return Q.trace("[opGetIndex]: ",t,n),t.bucket?X.indexOf(t.bucket)!==-1?x(e.msg,{bucket:t.bucket,index:"sift.guid",range:n},!0).then(function(e){return e.map(function(e){return{key:e.key.split("/")[1],value:e.value}})}):t.index?x(e.db,t,!0):Promise.reject("[opGetIndex]:params.index undefined"):Promise.reject("[opGetIndex]:params.bucket undefined")}function d(e,t,n){return Q.trace("[opGetIndexKeys]: ",t,n),t.bucket?X.indexOf(t.bucket)!==-1?x(e.msg,{bucket:t.bucket,index:"sift.guid",range:n},!1).then(function(e){return e.map(function(e){return{key:e.key.split("/")[1],value:e.value}})}):t.index?x(e.db,t,!1):Promise.reject("[opGetIndexKeys]: params.index undefined"):Promise.reject("[opGetIndexKeys]: params.bucket undefined")}function h(e,t,n){if(Q.trace("[opGetWithIndex]: ",t,n),!t.bucket)return Promise.reject("[opGetWithIndex]:params.bucket undefined");if(!t.keys)return Promise.reject("[opGetWithIndex]:params.keys undefined");if(X.indexOf(t.bucket)!==-1){var r=t.keys.map(function(e){return n+"/"+e});return w(e.msg,{bucket:t.bucket,keys:r,index:"sift.guid",range:n}).then(function(e){return e.map(function(e){return{key:e.key.split("/")[1],value:e.value}})})}return t.index?t.range?w(e.db,t):Promise.reject("[opGetWithIndex]:params.range undefined"):Promise.reject("[opGetWithIndex]:params.index undefined")}function y(e,t,n,r){Q.trace("[opPut]: ",t,n,r);var o=e.db;if(!t.bucket)return Promise.reject("[opPut]: params.bucket undefined");if(!t.kvs||0===t.kvs.length)return Q.warn("[opPut]: params.kvs undefined"),Promise.resolve();var i=t.kvs;if(n||(i=i.map(function(e){return{key:e.key,value:{value:e.value}}})),X.indexOf(t.bucket)!==-1){o=e.msg;var i=i.map(function(e){return{key:r+"/"+e.key,value:e.value}})}return b(o,{bucket:t.bucket,kvs:i},n)}function g(e,t){Q.trace("[_getTreoSchema]: ",e,t);var n=Z.schema().version(1);return e.forEach(function(e){t&&X.indexOf(e.name)!==-1||(n=e.keypath?n.addStore(e.name,{key:e.keypath}):n.addStore(e.name),e.indexes&&e.indexes.forEach(function(e){n=n.addIndex(e,e,{unique:!1})}))}),n}function v(e,t){Q.trace("[_getVersionedTreoSchema]: ",e,t);var n=Z.schema();return e.forEach(function(e,r){n=n.version(r+1),e.forEach(function(e){t&&X.indexOf(e.name)!==-1||(e.drop?(Q.trace("[_getVersionedTreoSchema]: dropping store: ",e.name),n=n.dropStore(e.name)):n=e.keypath?n.addStore(e.name,{key:e.keypath}):n.addStore(e.name),e.indexes&&e.indexes.forEach(function(t){e.drop?(Q.trace("[_getVersionedTreoSchema]: dropping store/index: "+e.name+"/"+t),n=n.dropIndex(t)):n=n.addIndex(t,t,{unique:!1})}))})}),n}function m(e,t){return Q.trace("[_batchDelete]: ",t),new Promise(function(n,r){e.transaction("readwrite",[t.bucket],function(e,o){if(e)return r(e);var i=o.objectStore(t.bucket),u=0,s=function(){if(!(u>=t.keys.length)){var e,n=t.keys[u];e=i.delete(n),e.onerror=r,e.onsuccess=s,u+=1}};o.onerror=o.onabort=r,o.oncomplete=function(){n()},s()})})}function b(e,t){return Q.trace("[_batchPut]: ",t),new Promise(function(n,r){var o=t.kvs.length;e.transaction("readwrite",[t.bucket],function(e,i){if(e)return r(e);var u=i.objectStore(t.bucket),s=0,a=function(){if(!(s>=o)){Q.trace("[_batchPut: put: ",t.kvs[s]);var e;e=u.put(t.kvs[s].value,t.kvs[s].key),e.onerror=r,e.onsuccess=a,s+=1}};i.onerror=i.onabort=r,i.oncomplete=function(){n()},a()})})}function w(e,t){return Q.trace("[_getWithIndexRange]: ",t),new Promise(function(n,r){var o=e.store(t.bucket),i=[],u=0,s=function(e){var n=t.keys.indexOf(e.primaryKey);return n!==-1&&(Q.trace("[found key: ",e.primaryKey),i[n].value=e.value.value,u++),u===t.keys.length?a():void e.continue()},a=function(e){Q.trace("[_getWithIndexRange: result: ",i),e?r(e):n(i)};t.keys.forEach(function(e){i.push({key:e,value:void 0})}),o.cursor({index:t.index,range:t.range,iterator:s},a)})}function _(e,t){return Q.trace("[_findIn]: ",t),new Promise(function(n,r){var o=e.store(t.bucket),i=[],u=0,s=function(e){if(Q.trace("[_findIn]: iterator: ",e),e.key>c[u]){for(Q.trace("[_findIn]: cursor ahead: ",e.key,c[u]);e.key>c[u]&&u<c.length;)u+=1,Q.trace("[_findIn]: moving to next key: ",e.key,c[u]);if(u>c.length)return Q.trace("[_findIn]: exhausted keys. done."),a()}e.key===c[u]?(Q.trace("[_findIn]: found key: ",e.key,e.value),i[t.keys.indexOf(c[u])]={key:e.key,value:e.value.value},u+=1,u<c.length?e.continue(c[u]):a()):(Q.trace("[_findIn]: continuing to next key: ",c[u]),e.continue(c[u]))},a=function(e){Q.trace("[findIn]: result: ",i),e?r(e):n(i)},c=t.keys.slice();c=c.sort(Z.cmp),Q.trace("[findIn: sorted keys: ",c),t.keys.forEach(function(e){i.push({key:e,value:void 0})}),o.cursor({iterator:s},a)})}function x(e,t,n){return Q.trace("[_getAll]: ",t,n),new Promise(function(r,o){var i=[],u=[],s=e.store(t.bucket),a=function(e){var r={key:e.primaryKey};Q.trace("[_getAll]: cursor",e),n&&(r.value=e.value.value),t.index&&(r.index=e.key),i.push(r),u.push(e.primaryKey),e.continue()},c={iterator:a};t.index&&(c.index=t.index),t.range&&(c.range=t.range),s.cursor(c,function(e){e?o(e):t.index||t.range||n?(Q.trace("[_getAll]: resolving: ",i),r(i)):(Q.trace("[_getAll]: resolving: ",u),r(u))})})}function k(t){e.log("[Redsift::registerSiftView]: registered")}function S(e){return T(P,e)}function E(e){return T(ue,e)}function j(t){e.log("[Redsift::registerSiftController]: registered")}function O(e){return T(C,e)}function I(t){e.log("[Redsift::registerEmailClientController]: registered")}function T(e,t){var n=function(){e.call(this),this.init&&"function"==typeof this.init&&this.init()};return n.prototype=Object.create(e.prototype),n.constructor=n,Object.keys(t).forEach(function(e){n.prototype[e]=t[e]}),new n}var C=function(){this._proxy=self,this._registerMessageListeners()};C.prototype._registerMessageListeners=function(){var e=this;this._proxy&&(this._proxy.onmessage=function(t){var n=t.data.method;e["_"+n]&&e["_"+n](t.data.params)})},C.prototype._emailStats=function(e){this.onstats&&this.onstats(e.name,e.value)},C.prototype._getThreadRowDisplayInfo=function(e){var t=this,n={};e.tris.forEach(function(r){void 0!==r.value&&void 0!==r.value.list&&t.loadThreadListView&&(n[r.key]=t.loadThreadListView(r.value.list,e.supportedTemplates))}),this._proxy.postMessage({method:"getThreadRowDisplayInfoCallback",params:n})};var A=function(){this._observers=[]};A.prototype.subscribe=function(e,t){this._op("_sub",e,t)},A.prototype.unsubscribe=function(e,t){this._op("_unsub",e,t)},A.prototype.unsubscribeAll=function(e){this._observers[e]&&delete this._observers[e]},A.prototype.publish=function(e,t){this._op("_pub",e,t)},A.prototype._op=function(e,t,n){var r=this;Array.isArray(t)?t.forEach(function(t){r[e](t,n)}):this[e](t,n)},A.prototype._sub=function(e,t){this._observers[e]||(this._observers[e]=[]),t&&this._observers[e].indexOf(t)===-1&&this._observers[e].push(t)},A.prototype._unsub=function(e,t){if(this._observers[e]){var n=this._observers[e].indexOf(t);~n&&this._observers[e].splice(n,1)}},A.prototype._pub=function(e,t){var n=this;if(this._observers[e])for(var r=this._observers[e].length-1;r>=0;r--)n._observers[e][r](t)};var P=function(){this._resizeHandler=null,this._proxy=parent,this.controller=new A,this._registerMessageListeners()};P.prototype.publish=function(e,t){this._proxy.postMessage({method:"notifyController",params:{topic:e,value:t}},"*")},P.prototype._registerMessageListeners=function(){var t=this;window.addEventListener("message",function(n){var r=n.data.method,o=n.data.params;"notifyView"===r?t.controller.publish(o.topic,o.value):t[r]?t[r](o):e.warn("[SiftView]: method not implemented: ",r)},!1)};var D=function(e){function t(t){e.call(this),this._proxy=t}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.goto=function(e){this._postMessage("goto",e)},t.prototype.close=function(){this._postMessage("close")},t.prototype._postMessage=function(e,t){this._proxy.postMessage({method:"notifyClient",params:{topic:e,value:t}})},t}(A),q=function(e){function t(){e.call(this),this._storage=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.init=function(e){this._storage=e},t.prototype.get=function(e){return this._storage.get(e)},t.prototype.getIndexKeys=function(e){return this._storage.getIndexKeys(e)},t.prototype.getIndex=function(e){return this._storage.getIndex(e)},t.prototype.getWithIndex=function(e){return this._storage.getWithIndex(e)},t.prototype.getAllKeys=function(e){return this._storage.getAllKeys(e)},t.prototype.getAll=function(e){return this._storage.getAll(e)},t.prototype.getUser=function(e){return this._storage.getUser(e)},t.prototype.putUser=function(e){return this._storage.putUser(e)},t.prototype.delUser=function(e){return this._storage.delUser(e)},t}(A),G="undefined"!=typeof window?window:"undefined"!=typeof i?i:"undefined"!=typeof self?self:{},L=u(function(i){!function(e,u){"use strict";r=u,o="function"==typeof r?r.call(t,n,t,i):r,!(void 0!==o&&(i.exports=o))}(G,function(){"use strict";function t(t){return typeof e!==a&&(void 0!==e[t]?n(e,t):void 0!==e.log?n(e,"log"):s)}function n(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function r(t,n,r){return function(){typeof e!==a&&(o.call(this,n,r),this[t].apply(this,arguments))}}function o(e,t){for(var n=this,r=0;r<c.length;r++){var o=c[r];n[o]=r<e?s:n.methodFactory(o,e,t)}}function i(e,n,o){return t(e)||r.apply(this,arguments)}function u(t,n,r){function u(e){var t=(c[e]||"silent").toUpperCase();try{return void(window.localStorage[p]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(p)+"="+t+";"}catch(e){}}function s(){var e;try{e=window.localStorage[p]}catch(e){}if(typeof e===a)try{var t=window.document.cookie,n=t.indexOf(encodeURIComponent(p)+"=");n&&(e=/^([^;]+)/.exec(t.slice(n))[1])}catch(e){}return void 0===l.levels[e]&&(e=void 0),e}var f,l=this,p="loglevel";t&&(p+=":"+t),l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=r||i,l.getLevel=function(){return f},l.setLevel=function(n,r){if("string"==typeof n&&void 0!==l.levels[n.toUpperCase()]&&(n=l.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=l.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(f=n,r!==!1&&u(n),o.call(l,n,t),typeof e===a&&n<l.levels.SILENT)return"No console available for logging"},l.setDefaultLevel=function(e){s()||l.setLevel(e,!1)},l.enableAll=function(e){l.setLevel(l.levels.TRACE,e)},l.disableAll=function(e){l.setLevel(l.levels.SILENT,e)};var d=s();null==d&&(d=null==n?"WARN":n),l.setLevel(d,!1)}var s=function(){},a="undefined",c=["trace","debug","info","warn","error"],f=new u,l={};f.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=l[e];return t||(t=l[e]=new u(e,f.getLevel(),f.methodFactory)),t};var p=typeof window!==a?window.log:void 0;return f.noConflict=function(){return typeof window!==a&&window.log===f&&(window.log=p),f},f})}),V=L&&"object"==typeof L&&"default"in L?L.default:L,R=u(function(e){"use strict";var t=Object.prototype.toString;e.exports=function(e){var n;return"[object Object]"===t.call(e)&&(n=Object.getPrototypeOf(e),null===n||n===Object.getPrototypeOf({}))}}),M=R&&"object"==typeof R&&"default"in R?R.default:R,U=u(function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=G.IDBKeyRange||G.webkitIDBKeyRange;if(e instanceof t)return e;if("undefined"==typeof e||null===e)return null;if(!(0,i.default)(e))return t.only(e);var n=Object.keys(e).sort();if(1===n.length){var r=n[0],o=e[r];switch(r){case"eq":return t.only(o);case"gt":return t.lowerBound(o,!0);case"lt":return t.upperBound(o,!0);case"gte":return t.lowerBound(o);case"lte":return t.upperBound(o);default:throw new TypeError('"'+r+'" is not valid key')}}else{var u=e[n[0]],s=e[n[1]],a=n.join("-");switch(a){case"gt-lt":return t.bound(u,s,!0,!0);case"gt-lte":return t.bound(u,s,!0,!1);case"gte-lt":return t.bound(u,s,!1,!0);case"gte-lte":return t.bound(u,s,!1,!1);default:throw new TypeError('"'+a+'" are conflicted keys')}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=M,i=n(o);e.exports=t.default}),z=U&&"object"==typeof U&&"default"in U?U.default:U,B=u(function(e){function t(e,t,n,r){this.store=e,this.name=t,this.field=n,this.opts=r,this.multi=r.multi||r.multiEntry||!1,this.unique=r.unique||!1}var n=z;e.exports=t,t.prototype.get=function(e,t){function n(e){r.push(e.value),e.continue()}var r=[],o=this.unique,i={range:e,iterator:n};this.cursor(i,function(e){return e?t(e):void(o?t(null,r[0]):t(null,r))})},t.prototype.count=function(e,t){var r=this.store.name,o=this.name;this.store.db.transaction("readonly",[r],function(i,u){if(i)return t(i);var s=u.objectStore(r).index(o),a=s.count(n(e));a.onerror=t,a.onsuccess=function(e){t(null,e.target.result)}})},t.prototype.cursor=function(e,t){e.index=this.name,this.store.cursor(e,t)}}),N=B&&"object"==typeof B&&"default"in B?B.default:B,F=u(function(e){var t=Object.prototype.toString;e.exports=function(e){switch(t.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e),typeof e)}}),K=F&&"object"==typeof F&&"default"in F?F.default:F,W=u(function(e){function t(e,t){this.db=null,this.name=e,this.indexes={},this.opts=t,this.key=t.key||t.keyPath||void 0,this.increment=t.increment||t.autoIncretement||void 0}var n=K,r=z;e.exports=t,t.prototype.index=function(e){return this.indexes[e]},t.prototype.put=function(e,t,r){var o=this.name,i=this.key;i&&("object"==n(e)?(r=t,t=e,e=null):t[i]=e),this.db.transaction("readwrite",[o],function(n,u){if(n)return r(n);var s=u.objectStore(o),a=i?s.put(t):s.put(t,e);u.onerror=u.onabort=a.onerror=r,u.oncomplete=function(){r(null,a.result)}})},t.prototype.get=function(e,t){var n=this.name;this.db.transaction("readonly",[n],function(r,o){if(r)return t(r);var i=o.objectStore(n),u=i.get(e);u.onerror=t,u.onsuccess=function(e){t(null,e.target.result)}})},t.prototype.del=function(e,t){var n=this.name;this.db.transaction("readwrite",[n],function(r,o){if(r)return t(r);var i=o.objectStore(n),u=i.delete(e);o.onerror=o.onabort=u.onerror=t,o.oncomplete=function(){t()}})},t.prototype.count=function(e){var t=this.name;this.db.transaction("readonly",[t],function(n,r){if(n)return e(n);var o=r.objectStore(t),i=o.count();i.onerror=e,i.onsuccess=function(t){e(null,t.target.result)}})},t.prototype.clear=function(e){var t=this.name;this.db.transaction("readwrite",[t],function(n,r){if(n)return e(n);var o=r.objectStore(t),i=o.clear();r.onerror=r.onabort=i.onerror=e,r.oncomplete=function(){e()}})},t.prototype.batch=function(e,t){var n=this.name,r=this.key,o=Object.keys(e);this.db.transaction("readwrite",[n],function(i,u){function s(){if(!(c>=o.length)){var n,i=o[c],u=e[i];null===u?n=a.delete(i):r?(u[r]||(u[r]=i),n=a.put(u)):n=a.put(u,i),n.onerror=t,n.onsuccess=s,c+=1}}if(i)return t(i);var a=u.objectStore(n),c=0;u.onerror=u.onabort=t,u.oncomplete=function(){t()},s()})},t.prototype.all=function(e){function t(e){n.push(e.value),e.continue()}var n=[];this.cursor({iterator:t},function(t){t?e(t):e(null,n)})},t.prototype.cursor=function(e,t){var n=this.name;this.db.transaction("readonly",[n],function(o,i){if(o)return t(o);var u=e.index?i.objectStore(n).index(e.index):i.objectStore(n),s=u.openCursor(r(e.range));s.onerror=t,s.onsuccess=function(n){var r=n.target.result;r?e.iterator(r):t()}})}}),H=W&&"object"==typeof W&&"default"in W?W.default:W,J=u(function(e){function t(){return this instanceof t?(this._stores={},this._current={},void(this._versions={})):new t}var n=K,r=H,o=N;e.exports=t,t.prototype.version=function(e){if("number"!=n(e)||e<1||e<this.getVersion())throw new TypeError("not valid version");return this._current={version:e,store:null},this._versions[e]={stores:[],dropStores:[],indexes:[],dropIndexes:[],version:e},this},t.prototype.addStore=function(e,t){if("string"!=n(e))throw new TypeError("`name` is required");if(this._stores[e])throw new TypeError("store is already defined");var o=new r(e,t||{});return this._stores[e]=o,this._versions[this.getVersion()].stores.push(o),this._current.store=o,this},t.prototype.dropStore=function(e){if("string"!=n(e))throw new TypeError("`name` is required");var t=this._stores[e];if(!t)throw new TypeError("store is not defined");return delete this._stores[e],this._versions[this.getVersion()].dropStores.push(t),this},t.prototype.addIndex=function(e,t,r){if("string"!=n(e))throw new TypeError("`name` is required");if("string"!=n(t)&&"array"!=n(t))throw new TypeError("`field` is required");var i=this._current.store;if(i.indexes[e])throw new TypeError("index is already defined");var u=new o(i,e,t,r||{});return i.indexes[e]=u,this._versions[this.getVersion()].indexes.push(u),this},t.prototype.dropIndex=function(e){if("string"!=n(e))throw new TypeError("`name` is required");var t=this._current.store.indexes[e];if(!t)throw new TypeError("index is not defined");return delete this._current.store.indexes[e],this._versions[this.getVersion()].dropIndexes.push(t),this},t.prototype.getStore=function(e){if("string"!=n(e))throw new TypeError("`name` is required");if(!this._stores[e])throw new TypeError("store is not defined");return this._current.store=this._stores[e],this},t.prototype.getVersion=function(){return this._current.version},t.prototype.callback=function(){var e=Object.keys(this._versions).map(function(e){return this._versions[e]},this).sort(function(e,t){return e.version-t.version});return function(t){var n=t.target.result,r=t.target.transaction;e.forEach(function(e){t.oldVersion>=e.version||(e.stores.forEach(function(e){var t={};"undefined"!=typeof e.key&&(t.keyPath=e.key),"undefined"!=typeof e.increment&&(t.autoIncrement=e.increment),n.createObjectStore(e.name,t)}),e.dropStores.forEach(function(e){n.deleteObjectStore(e.name)}),e.indexes.forEach(function(e){var t=r.objectStore(e.store.name);t.createIndex(e.name,e.field,{unique:e.unique,multiEntry:e.multi})}),e.dropIndexes.forEach(function(e){var t=r.objectStore(e.store.name);t.deleteIndex(e.name)}))})}}}),$=J&&"object"==typeof J&&"default"in J?J.default:J,Y=u(function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);if("string"!=i(e))throw new TypeError("`name` required");if(!(t instanceof u))throw new TypeError("not valid schema");this.name=e,this.status="close",this.origin=null,this.stores=t._stores,this.version=t.getVersion(),this.onupgradeneeded=t.callback(),Object.keys(this.stores).forEach(function(e){this.stores[e].db=this},this)}function r(){return o().cmp.apply(o(),arguments)}function o(){return G._indexedDB||G.indexedDB||G.msIndexedDB||G.mozIndexedDB||G.webkitIndexedDB}var i=K,u=$,s=H,a=N;t=e.exports=n,t.schema=u,t.cmp=r,t.Treo=n,t.Schema=u,t.Store=s,t.Index=a,n.prototype.use=function(e){return e(this,t),this},n.prototype.drop=function(e){var t=this.name;this.close(function(n){if(n)return e(n);var r=o().deleteDatabase(t);r.onerror=e,r.onsuccess=function(){e()}})},n.prototype.close=function(e){return"close"==this.status?e():void this.getInstance(function(t,n){return t?e(t):(n.origin=null,n.status="close",n.close(),void e())})},n.prototype.store=function(e){return this.stores[e]},n.prototype.getInstance=function(e){if("open"==this.status)return e(null,this.origin);if("opening"==this.status)return this.queue.push(e);this.status="opening",this.queue=[e];var t=this,n=o().open(this.name,this.version);n.onupgradeneeded=this.onupgradeneeded,n.onerror=n.onblocked=function(e){t.status="error",t.queue.forEach(function(t){t(e)}),delete t.queue},n.onsuccess=function(e){t.origin=e.target.result,t.status="open",t.origin.onversionchange=function(){t.close(function(){})},t.queue.forEach(function(e){e(null,t.origin)}),delete t.queue}},n.prototype.transaction=function(e,t,n){this.getInstance(function(r,o){r?n(r):n(null,o.transaction(t,e))})}}),Z=Y&&"object"==typeof Y&&"default"in Y?Y.default:Y,Q=V.getLogger("RSStorage:operations");Q.setLevel("warn");var X=["_email.id","_email.tid"],ee=[[{name:"_id.list",indexes:["sift.guid"]},{name:"_tid.list",indexes:["sift.guid"]}],[{name:"_email.id",indexes:["sift.guid"]},{name:"_email.tid",indexes:["sift.guid"]},{name:"_id.list",drop:!0},{name:"_tid.list",drop:!0}]],te=[{name:"events",indexes:["value.sift.guid"]},{name:"admin"}],ne=[{name:"tour"},{name:"spm"},{name:"auth"}],re=new WeakMap,oe=new WeakMap,ie=function(e,t){if(this._logger=V.getLogger("RSStorage"),this._logger.setLevel(t||"warn"),!e.accountGuid)throw new Error("[Storage]: dbInfo.accountGuid undefined");re.set(this,e.siftGuid),oe.set(this,s(e))};ie.prototype.get=function(e){return this._logger.trace("[Storage::get]: ",e),c(oe.get(this),e,re.get(this))},ie.prototype.getAll=function(e){return this._logger.trace("[Storage::getAll]: ",e),f(oe.get(this),e,re.get(this))},ie.prototype.getAllKeys=function(e){return this._logger.trace("[Storage::getAllKeys]: ",e),l(oe.get(this),e,re.get(this))},ie.prototype.getIndex=function(e){return this._logger.trace("[Storage::getIndex]: ",e),p(oe.get(this),e,re.get(this))},ie.prototype.getIndexKeys=function(e){return this._logger.trace("[Storage::getIndexKeys]: ",e),d(oe.get(this),e,re.get(this))},ie.prototype.getWithIndex=function(e){return this._logger.trace("[Storage::getWithIndex]: ",e),h(oe.get(this),e,re.get(this))},ie.prototype.delUser=function(e){return e.bucket="_user.default",this._logger.trace("[Storage::delUser]: ",e),a(oe.get(this),e,re.get(this))},ie.prototype.getUser=function(e){return e.bucket="_user.default",this._logger.trace("[Storage::getUser]: ",e),c(oe.get(this),e,re.get(this))},ie.prototype.putUser=function(e){return e.bucket="_user.default",this._logger.trace("[Storage::putUser]: ",e),e.kvs&&0!==e.kvs.length?y(oe.get(this),e,!1,re.get(this)):Promise.reject("[Storage::putUser]: params.kvs undefined")};var ue=function(){this._proxy=self,this.view=new A,this.emailclient=new D(self),this._registerMessageListeners()};ue.prototype.publish=function(e,t){this._proxy.postMessage({method:"notifyView",params:{topic:e,value:t}})},ue.prototype._registerMessageListeners=function(){var e=this;this._proxy&&(this._proxy.onmessage=function(t){var n=t.data.method;e["_"+n]&&e["_"+n](t.data.params)})},ue.prototype._init=function(e){this.storage=new q,this.storage.init(new ie({type:"SIFT",siftGuid:e.siftGuid,accountGuid:e.accountGuid,schema:e.dbSchema})),this._guid=e.siftGuid,this._account=e.accountGuid,this._proxy.postMessage({method:"initCallback",result:e})},ue.prototype._terminate=function(){this._proxy&&this._proxy.close()},ue.prototype._postCallback=function(e,t){this._proxy.postMessage({method:"loadViewCallback",params:{user:{guid:this._account},sift:{guid:this._guid},type:e.type,sizeClass:e.sizeClass,result:t}})},ue.prototype._loadView=function(t){var n=this;if(!this.loadView)return void e.error("[SiftController::_loadView]: Sift controller must implement the loadView method");var r=this.loadView({sizeClass:t.sizeClass,type:t.type,params:t.data});r.data&&"function"==typeof r.data.then?(r.html&&this._postCallback(t,{html:r.html}),r.data.then(function(e){n._postCallback(t,{html:r.html,data:e})}).catch(function(t){e.error("[SiftController::loadView]: promise rejected: ",t)})):this._postCallback(t,r)},ue.prototype._storageUpdated=function(e){var t=this;this.storage.publish("*",e),e.forEach(function(e){t.storage.publish(e,[e])})},ue.prototype._notifyController=function(e){this.view.publish(e.topic,e.value)},ue.prototype._emailComposer=function(e){this.emailclient.publish(e.topic,e.value)},t.EmailClientController=C,t.SiftController=ue,t.SiftStorage=q,t.SiftView=P,t.registerSiftView=k,t.createSiftView=S,t.createSiftController=E,t.registerSiftController=j,t.createEmailClientController=O,t.registerEmailClientController=I,Object.defineProperty(t,"__esModule",{value:!0})})}).call(t,n(1),function(){return this}())}]);
  //# sourceMappingURL=email-client-controller.umd-es2015.min.js.map