update readme
[dotfiles/.git] / .config / BraveSoftware / Brave-Browser / Default / Extensions / liecbddmkiiihnedobmlmillhodjkdmb / 3.6.22_0 / 3rd / inboxsdk.js
1 /*!
2  * InboxSDK
3  * https://www.inboxsdk.com/
4  *
5  * The use of InboxSDK is governed by the Terms of Services located at
6  * https://www.inboxsdk.com/terms
7
8
9  *  __    __            _     _          _                _                      ___                 _ _ ___
10  * / / /\ \ \__ _ _ __ | |_  | |_ ___   | |__   __ _  ___| | __   ___  _ __     / _ \_ __ ___   __ _(_) / _ \
11  * \ \/  \/ / _` | '_ \| __| | __/ _ \  | '_ \ / _` |/ __| |/ /  / _ \| '_ \   / /_\/ '_ ` _ \ / _` | | \// /
12  *  \  /\  / (_| | | | | |_  | || (_) | | | | | (_| | (__|   <  | (_) | | | | / /_\\| | | | | | (_| | | | \/
13  *   \/  \/ \__,_|_| |_|\__|  \__\___/  |_| |_|\__,_|\___|_|\_\  \___/|_| |_| \____/|_| |_| |_|\__,_|_|_| ()
14  *
15  * Like complex reverse engineering? Want to make Gmail and Inbox a hackable platform?
16  *
17  * Join us at: www.streak.com/careers?source=sdk
18  */
19
20 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
21 module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
22 },{"core-js/library/fn/json/stringify":3}],2:[function(require,module,exports){
23 module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true };
24 },{"core-js/library/fn/object/assign":4}],3:[function(require,module,exports){
25 var core  = require('../../modules/_core')
26   , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});
27 module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
28   return $JSON.stringify.apply($JSON, arguments);
29 };
30 },{"../../modules/_core":9}],4:[function(require,module,exports){
31 require('../../modules/es6.object.assign');
32 module.exports = require('../../modules/_core').Object.assign;
33 },{"../../modules/_core":9,"../../modules/es6.object.assign":39}],5:[function(require,module,exports){
34 module.exports = function(it){
35   if(typeof it != 'function')throw TypeError(it + ' is not a function!');
36   return it;
37 };
38 },{}],6:[function(require,module,exports){
39 var isObject = require('./_is-object');
40 module.exports = function(it){
41   if(!isObject(it))throw TypeError(it + ' is not an object!');
42   return it;
43 };
44 },{"./_is-object":22}],7:[function(require,module,exports){
45 // false -> Array#indexOf
46 // true  -> Array#includes
47 var toIObject = require('./_to-iobject')
48   , toLength  = require('./_to-length')
49   , toIndex   = require('./_to-index');
50 module.exports = function(IS_INCLUDES){
51   return function($this, el, fromIndex){
52     var O      = toIObject($this)
53       , length = toLength(O.length)
54       , index  = toIndex(fromIndex, length)
55       , value;
56     // Array#includes uses SameValueZero equality algorithm
57     if(IS_INCLUDES && el != el)while(length > index){
58       value = O[index++];
59       if(value != value)return true;
60     // Array#toIndex ignores holes, Array#includes - not
61     } else for(;length > index; index++)if(IS_INCLUDES || index in O){
62       if(O[index] === el)return IS_INCLUDES || index || 0;
63     } return !IS_INCLUDES && -1;
64   };
65 };
66 },{"./_to-index":32,"./_to-iobject":34,"./_to-length":35}],8:[function(require,module,exports){
67 var toString = {}.toString;
68
69 module.exports = function(it){
70   return toString.call(it).slice(8, -1);
71 };
72 },{}],9:[function(require,module,exports){
73 var core = module.exports = {version: '2.4.0'};
74 if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
75 },{}],10:[function(require,module,exports){
76 // optional / simple context binding
77 var aFunction = require('./_a-function');
78 module.exports = function(fn, that, length){
79   aFunction(fn);
80   if(that === undefined)return fn;
81   switch(length){
82     case 1: return function(a){
83       return fn.call(that, a);
84     };
85     case 2: return function(a, b){
86       return fn.call(that, a, b);
87     };
88     case 3: return function(a, b, c){
89       return fn.call(that, a, b, c);
90     };
91   }
92   return function(/* ...args */){
93     return fn.apply(that, arguments);
94   };
95 };
96 },{"./_a-function":5}],11:[function(require,module,exports){
97 // 7.2.1 RequireObjectCoercible(argument)
98 module.exports = function(it){
99   if(it == undefined)throw TypeError("Can't call method on  " + it);
100   return it;
101 };
102 },{}],12:[function(require,module,exports){
103 // Thank's IE8 for his funny defineProperty
104 module.exports = !require('./_fails')(function(){
105   return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
106 });
107 },{"./_fails":16}],13:[function(require,module,exports){
108 var isObject = require('./_is-object')
109   , document = require('./_global').document
110   // in old IE typeof document.createElement is 'object'
111   , is = isObject(document) && isObject(document.createElement);
112 module.exports = function(it){
113   return is ? document.createElement(it) : {};
114 };
115 },{"./_global":17,"./_is-object":22}],14:[function(require,module,exports){
116 // IE 8- don't enum bug keys\r
117 module.exports = (\r
118   'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\r
119 ).split(',');
120 },{}],15:[function(require,module,exports){
121 var global    = require('./_global')
122   , core      = require('./_core')
123   , ctx       = require('./_ctx')
124   , hide      = require('./_hide')
125   , PROTOTYPE = 'prototype';
126
127 var $export = function(type, name, source){
128   var IS_FORCED = type & $export.F
129     , IS_GLOBAL = type & $export.G
130     , IS_STATIC = type & $export.S
131     , IS_PROTO  = type & $export.P
132     , IS_BIND   = type & $export.B
133     , IS_WRAP   = type & $export.W
134     , exports   = IS_GLOBAL ? core : core[name] || (core[name] = {})
135     , expProto  = exports[PROTOTYPE]
136     , target    = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
137     , key, own, out;
138   if(IS_GLOBAL)source = name;
139   for(key in source){
140     // contains in native
141     own = !IS_FORCED && target && target[key] !== undefined;
142     if(own && key in exports)continue;
143     // export native or passed
144     out = own ? target[key] : source[key];
145     // prevent global pollution for namespaces
146     exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
147     // bind timers to global for call from export context
148     : IS_BIND && own ? ctx(out, global)
149     // wrap global constructors for prevent change them in library
150     : IS_WRAP && target[key] == out ? (function(C){
151       var F = function(a, b, c){
152         if(this instanceof C){
153           switch(arguments.length){
154             case 0: return new C;
155             case 1: return new C(a);
156             case 2: return new C(a, b);
157           } return new C(a, b, c);
158         } return C.apply(this, arguments);
159       };
160       F[PROTOTYPE] = C[PROTOTYPE];
161       return F;
162     // make static versions for prototype methods
163     })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
164     // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
165     if(IS_PROTO){
166       (exports.virtual || (exports.virtual = {}))[key] = out;
167       // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
168       if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
169     }
170   }
171 };
172 // type bitmap
173 $export.F = 1;   // forced
174 $export.G = 2;   // global
175 $export.S = 4;   // static
176 $export.P = 8;   // proto
177 $export.B = 16;  // bind
178 $export.W = 32;  // wrap
179 $export.U = 64;  // safe
180 $export.R = 128; // real proto method for `library` 
181 module.exports = $export;
182 },{"./_core":9,"./_ctx":10,"./_global":17,"./_hide":19}],16:[function(require,module,exports){
183 module.exports = function(exec){
184   try {
185     return !!exec();
186   } catch(e){
187     return true;
188   }
189 };
190 },{}],17:[function(require,module,exports){
191 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
192 var global = module.exports = typeof window != 'undefined' && window.Math == Math
193   ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
194 if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
195 },{}],18:[function(require,module,exports){
196 var hasOwnProperty = {}.hasOwnProperty;
197 module.exports = function(it, key){
198   return hasOwnProperty.call(it, key);
199 };
200 },{}],19:[function(require,module,exports){
201 var dP         = require('./_object-dp')
202   , createDesc = require('./_property-desc');
203 module.exports = require('./_descriptors') ? function(object, key, value){
204   return dP.f(object, key, createDesc(1, value));
205 } : function(object, key, value){
206   object[key] = value;
207   return object;
208 };
209 },{"./_descriptors":12,"./_object-dp":24,"./_property-desc":29}],20:[function(require,module,exports){
210 module.exports = !require('./_descriptors') && !require('./_fails')(function(){\r
211   return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;\r
212 });
213 },{"./_descriptors":12,"./_dom-create":13,"./_fails":16}],21:[function(require,module,exports){
214 // fallback for non-array-like ES3 and non-enumerable old V8 strings
215 var cof = require('./_cof');
216 module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
217   return cof(it) == 'String' ? it.split('') : Object(it);
218 };
219 },{"./_cof":8}],22:[function(require,module,exports){
220 module.exports = function(it){
221   return typeof it === 'object' ? it !== null : typeof it === 'function';
222 };
223 },{}],23:[function(require,module,exports){
224 'use strict';
225 // 19.1.2.1 Object.assign(target, source, ...)
226 var getKeys  = require('./_object-keys')
227   , gOPS     = require('./_object-gops')
228   , pIE      = require('./_object-pie')
229   , toObject = require('./_to-object')
230   , IObject  = require('./_iobject')
231   , $assign  = Object.assign;
232
233 // should work with symbols and should have deterministic property order (V8 bug)
234 module.exports = !$assign || require('./_fails')(function(){
235   var A = {}
236     , B = {}
237     , S = Symbol()
238     , K = 'abcdefghijklmnopqrst';
239   A[S] = 7;
240   K.split('').forEach(function(k){ B[k] = k; });
241   return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
242 }) ? function assign(target, source){ // eslint-disable-line no-unused-vars
243   var T     = toObject(target)
244     , aLen  = arguments.length
245     , index = 1
246     , getSymbols = gOPS.f
247     , isEnum     = pIE.f;
248   while(aLen > index){
249     var S      = IObject(arguments[index++])
250       , keys   = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
251       , length = keys.length
252       , j      = 0
253       , key;
254     while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
255   } return T;
256 } : $assign;
257 },{"./_fails":16,"./_iobject":21,"./_object-gops":25,"./_object-keys":27,"./_object-pie":28,"./_to-object":36}],24:[function(require,module,exports){
258 var anObject       = require('./_an-object')
259   , IE8_DOM_DEFINE = require('./_ie8-dom-define')
260   , toPrimitive    = require('./_to-primitive')
261   , dP             = Object.defineProperty;
262
263 exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){
264   anObject(O);
265   P = toPrimitive(P, true);
266   anObject(Attributes);
267   if(IE8_DOM_DEFINE)try {
268     return dP(O, P, Attributes);
269   } catch(e){ /* empty */ }
270   if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
271   if('value' in Attributes)O[P] = Attributes.value;
272   return O;
273 };
274 },{"./_an-object":6,"./_descriptors":12,"./_ie8-dom-define":20,"./_to-primitive":37}],25:[function(require,module,exports){
275 exports.f = Object.getOwnPropertySymbols;
276 },{}],26:[function(require,module,exports){
277 var has          = require('./_has')\r
278   , toIObject    = require('./_to-iobject')\r
279   , arrayIndexOf = require('./_array-includes')(false)\r
280   , IE_PROTO     = require('./_shared-key')('IE_PROTO');\r
281 \r
282 module.exports = function(object, names){\r
283   var O      = toIObject(object)\r
284     , i      = 0\r
285     , result = []\r
286     , key;\r
287   for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);\r
288   // Don't enum bug & hidden keys\r
289   while(names.length > i)if(has(O, key = names[i++])){\r
290     ~arrayIndexOf(result, key) || result.push(key);\r
291   }\r
292   return result;\r
293 };
294 },{"./_array-includes":7,"./_has":18,"./_shared-key":30,"./_to-iobject":34}],27:[function(require,module,exports){
295 // 19.1.2.14 / 15.2.3.14 Object.keys(O)\r
296 var $keys       = require('./_object-keys-internal')\r
297   , enumBugKeys = require('./_enum-bug-keys');\r
298 \r
299 module.exports = Object.keys || function keys(O){\r
300   return $keys(O, enumBugKeys);\r
301 };
302 },{"./_enum-bug-keys":14,"./_object-keys-internal":26}],28:[function(require,module,exports){
303 exports.f = {}.propertyIsEnumerable;
304 },{}],29:[function(require,module,exports){
305 module.exports = function(bitmap, value){
306   return {
307     enumerable  : !(bitmap & 1),
308     configurable: !(bitmap & 2),
309     writable    : !(bitmap & 4),
310     value       : value
311   };
312 };
313 },{}],30:[function(require,module,exports){
314 var shared = require('./_shared')('keys')\r
315   , uid    = require('./_uid');\r
316 module.exports = function(key){\r
317   return shared[key] || (shared[key] = uid(key));\r
318 };
319 },{"./_shared":31,"./_uid":38}],31:[function(require,module,exports){
320 var global = require('./_global')
321   , SHARED = '__core-js_shared__'
322   , store  = global[SHARED] || (global[SHARED] = {});
323 module.exports = function(key){
324   return store[key] || (store[key] = {});
325 };
326 },{"./_global":17}],32:[function(require,module,exports){
327 var toInteger = require('./_to-integer')
328   , max       = Math.max
329   , min       = Math.min;
330 module.exports = function(index, length){
331   index = toInteger(index);
332   return index < 0 ? max(index + length, 0) : min(index, length);
333 };
334 },{"./_to-integer":33}],33:[function(require,module,exports){
335 // 7.1.4 ToInteger
336 var ceil  = Math.ceil
337   , floor = Math.floor;
338 module.exports = function(it){
339   return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
340 };
341 },{}],34:[function(require,module,exports){
342 // to indexed object, toObject with fallback for non-array-like ES3 strings
343 var IObject = require('./_iobject')
344   , defined = require('./_defined');
345 module.exports = function(it){
346   return IObject(defined(it));
347 };
348 },{"./_defined":11,"./_iobject":21}],35:[function(require,module,exports){
349 // 7.1.15 ToLength
350 var toInteger = require('./_to-integer')
351   , min       = Math.min;
352 module.exports = function(it){
353   return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
354 };
355 },{"./_to-integer":33}],36:[function(require,module,exports){
356 // 7.1.13 ToObject(argument)
357 var defined = require('./_defined');
358 module.exports = function(it){
359   return Object(defined(it));
360 };
361 },{"./_defined":11}],37:[function(require,module,exports){
362 // 7.1.1 ToPrimitive(input [, PreferredType])
363 var isObject = require('./_is-object');
364 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
365 // and the second argument - flag - preferred type is a string
366 module.exports = function(it, S){
367   if(!isObject(it))return it;
368   var fn, val;
369   if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
370   if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
371   if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
372   throw TypeError("Can't convert object to primitive value");
373 };
374 },{"./_is-object":22}],38:[function(require,module,exports){
375 var id = 0
376   , px = Math.random();
377 module.exports = function(key){
378   return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
379 };
380 },{}],39:[function(require,module,exports){
381 // 19.1.3.1 Object.assign(target, source)
382 var $export = require('./_export');
383
384 $export($export.S + $export.F, 'Object', {assign: require('./_object-assign')});
385 },{"./_export":15,"./_object-assign":23}],40:[function(require,module,exports){
386 var isArray = require('../lang/isArray');
387
388 /**
389  * The inverse of `_.pairs`; this method returns an object composed from arrays
390  * of property names and values. Provide either a single two dimensional array,
391  * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
392  * and one of corresponding values.
393  *
394  * @static
395  * @memberOf _
396  * @alias object
397  * @category Array
398  * @param {Array} props The property names.
399  * @param {Array} [values=[]] The property values.
400  * @returns {Object} Returns the new object.
401  * @example
402  *
403  * _.zipObject([['fred', 30], ['barney', 40]]);
404  * // => { 'fred': 30, 'barney': 40 }
405  *
406  * _.zipObject(['fred', 'barney'], [30, 40]);
407  * // => { 'fred': 30, 'barney': 40 }
408  */
409 function zipObject(props, values) {
410   var index = -1,
411       length = props ? props.length : 0,
412       result = {};
413
414   if (length && !values && !isArray(props[0])) {
415     values = [];
416   }
417   while (++index < length) {
418     var key = props[index];
419     if (values) {
420       result[key] = values[index];
421     } else if (key) {
422       result[key[0]] = key[1];
423     }
424   }
425   return result;
426 }
427
428 module.exports = zipObject;
429
430 },{"../lang/isArray":61}],41:[function(require,module,exports){
431 /** Used as the `TypeError` message for "Functions" methods. */
432 var FUNC_ERROR_TEXT = 'Expected a function';
433
434 /**
435  * Creates a function that invokes `func`, with the `this` binding and arguments
436  * of the created function, while it's called less than `n` times. Subsequent
437  * calls to the created function return the result of the last `func` invocation.
438  *
439  * @static
440  * @memberOf _
441  * @category Function
442  * @param {number} n The number of calls at which `func` is no longer invoked.
443  * @param {Function} func The function to restrict.
444  * @returns {Function} Returns the new restricted function.
445  * @example
446  *
447  * jQuery('#add').on('click', _.before(5, addContactToList));
448  * // => allows adding up to 4 contacts to the list
449  */
450 function before(n, func) {
451   var result;
452   if (typeof func != 'function') {
453     if (typeof n == 'function') {
454       var temp = n;
455       n = func;
456       func = temp;
457     } else {
458       throw new TypeError(FUNC_ERROR_TEXT);
459     }
460   }
461   return function() {
462     if (--n > 0) {
463       result = func.apply(this, arguments);
464     }
465     if (n <= 1) {
466       func = undefined;
467     }
468     return result;
469   };
470 }
471
472 module.exports = before;
473
474 },{}],42:[function(require,module,exports){
475 var baseDelay = require('../internal/baseDelay'),
476     restParam = require('./restParam');
477
478 /**
479  * Defers invoking the `func` until the current call stack has cleared. Any
480  * additional arguments are provided to `func` when it's invoked.
481  *
482  * @static
483  * @memberOf _
484  * @category Function
485  * @param {Function} func The function to defer.
486  * @param {...*} [args] The arguments to invoke the function with.
487  * @returns {number} Returns the timer id.
488  * @example
489  *
490  * _.defer(function(text) {
491  *   console.log(text);
492  * }, 'deferred');
493  * // logs 'deferred' after one or more milliseconds
494  */
495 var defer = restParam(function(func, args) {
496   return baseDelay(func, 1, args);
497 });
498
499 module.exports = defer;
500
501 },{"../internal/baseDelay":45,"./restParam":44}],43:[function(require,module,exports){
502 var before = require('./before');
503
504 /**
505  * Creates a function that is restricted to invoking `func` once. Repeat calls
506  * to the function return the value of the first call. The `func` is invoked
507  * with the `this` binding and arguments of the created function.
508  *
509  * @static
510  * @memberOf _
511  * @category Function
512  * @param {Function} func The function to restrict.
513  * @returns {Function} Returns the new restricted function.
514  * @example
515  *
516  * var initialize = _.once(createApplication);
517  * initialize();
518  * initialize();
519  * // `initialize` invokes `createApplication` once
520  */
521 function once(func) {
522   return before(2, func);
523 }
524
525 module.exports = once;
526
527 },{"./before":41}],44:[function(require,module,exports){
528 /** Used as the `TypeError` message for "Functions" methods. */
529 var FUNC_ERROR_TEXT = 'Expected a function';
530
531 /* Native method references for those with the same name as other `lodash` methods. */
532 var nativeMax = Math.max;
533
534 /**
535  * Creates a function that invokes `func` with the `this` binding of the
536  * created function and arguments from `start` and beyond provided as an array.
537  *
538  * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
539  *
540  * @static
541  * @memberOf _
542  * @category Function
543  * @param {Function} func The function to apply a rest parameter to.
544  * @param {number} [start=func.length-1] The start position of the rest parameter.
545  * @returns {Function} Returns the new function.
546  * @example
547  *
548  * var say = _.restParam(function(what, names) {
549  *   return what + ' ' + _.initial(names).join(', ') +
550  *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
551  * });
552  *
553  * say('hello', 'fred', 'barney', 'pebbles');
554  * // => 'hello fred, barney, & pebbles'
555  */
556 function restParam(func, start) {
557   if (typeof func != 'function') {
558     throw new TypeError(FUNC_ERROR_TEXT);
559   }
560   start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
561   return function() {
562     var args = arguments,
563         index = -1,
564         length = nativeMax(args.length - start, 0),
565         rest = Array(length);
566
567     while (++index < length) {
568       rest[index] = args[start + index];
569     }
570     switch (start) {
571       case 0: return func.call(this, rest);
572       case 1: return func.call(this, args[0], rest);
573       case 2: return func.call(this, args[0], args[1], rest);
574     }
575     var otherArgs = Array(start + 1);
576     index = -1;
577     while (++index < start) {
578       otherArgs[index] = args[index];
579     }
580     otherArgs[start] = rest;
581     return func.apply(this, otherArgs);
582   };
583 }
584
585 module.exports = restParam;
586
587 },{}],45:[function(require,module,exports){
588 /** Used as the `TypeError` message for "Functions" methods. */
589 var FUNC_ERROR_TEXT = 'Expected a function';
590
591 /**
592  * The base implementation of `_.delay` and `_.defer` which accepts an index
593  * of where to slice the arguments to provide to `func`.
594  *
595  * @private
596  * @param {Function} func The function to delay.
597  * @param {number} wait The number of milliseconds to delay invocation.
598  * @param {Object} args The arguments provide to `func`.
599  * @returns {number} Returns the timer id.
600  */
601 function baseDelay(func, wait, args) {
602   if (typeof func != 'function') {
603     throw new TypeError(FUNC_ERROR_TEXT);
604   }
605   return setTimeout(function() { func.apply(undefined, args); }, wait);
606 }
607
608 module.exports = baseDelay;
609
610 },{}],46:[function(require,module,exports){
611 var createBaseFor = require('./createBaseFor');
612
613 /**
614  * The base implementation of `baseForIn` and `baseForOwn` which iterates
615  * over `object` properties returned by `keysFunc` invoking `iteratee` for
616  * each property. Iteratee functions may exit iteration early by explicitly
617  * returning `false`.
618  *
619  * @private
620  * @param {Object} object The object to iterate over.
621  * @param {Function} iteratee The function invoked per iteration.
622  * @param {Function} keysFunc The function to get the keys of `object`.
623  * @returns {Object} Returns `object`.
624  */
625 var baseFor = createBaseFor();
626
627 module.exports = baseFor;
628
629 },{"./createBaseFor":50}],47:[function(require,module,exports){
630 var baseFor = require('./baseFor'),
631     keys = require('../object/keys');
632
633 /**
634  * The base implementation of `_.forOwn` without support for callback
635  * shorthands and `this` binding.
636  *
637  * @private
638  * @param {Object} object The object to iterate over.
639  * @param {Function} iteratee The function invoked per iteration.
640  * @returns {Object} Returns `object`.
641  */
642 function baseForOwn(object, iteratee) {
643   return baseFor(object, iteratee, keys);
644 }
645
646 module.exports = baseForOwn;
647
648 },{"../object/keys":66,"./baseFor":46}],48:[function(require,module,exports){
649 /**
650  * The base implementation of `_.property` without support for deep paths.
651  *
652  * @private
653  * @param {string} key The key of the property to get.
654  * @returns {Function} Returns the new function.
655  */
656 function baseProperty(key) {
657   return function(object) {
658     return object == null ? undefined : object[key];
659   };
660 }
661
662 module.exports = baseProperty;
663
664 },{}],49:[function(require,module,exports){
665 var identity = require('../utility/identity');
666
667 /**
668  * A specialized version of `baseCallback` which only supports `this` binding
669  * and specifying the number of arguments to provide to `func`.
670  *
671  * @private
672  * @param {Function} func The function to bind.
673  * @param {*} thisArg The `this` binding of `func`.
674  * @param {number} [argCount] The number of arguments to provide to `func`.
675  * @returns {Function} Returns the callback.
676  */
677 function bindCallback(func, thisArg, argCount) {
678   if (typeof func != 'function') {
679     return identity;
680   }
681   if (thisArg === undefined) {
682     return func;
683   }
684   switch (argCount) {
685     case 1: return function(value) {
686       return func.call(thisArg, value);
687     };
688     case 3: return function(value, index, collection) {
689       return func.call(thisArg, value, index, collection);
690     };
691     case 4: return function(accumulator, value, index, collection) {
692       return func.call(thisArg, accumulator, value, index, collection);
693     };
694     case 5: return function(value, other, key, object, source) {
695       return func.call(thisArg, value, other, key, object, source);
696     };
697   }
698   return function() {
699     return func.apply(thisArg, arguments);
700   };
701 }
702
703 module.exports = bindCallback;
704
705 },{"../utility/identity":68}],50:[function(require,module,exports){
706 var toObject = require('./toObject');
707
708 /**
709  * Creates a base function for `_.forIn` or `_.forInRight`.
710  *
711  * @private
712  * @param {boolean} [fromRight] Specify iterating from right to left.
713  * @returns {Function} Returns the new base function.
714  */
715 function createBaseFor(fromRight) {
716   return function(object, iteratee, keysFunc) {
717     var iterable = toObject(object),
718         props = keysFunc(object),
719         length = props.length,
720         index = fromRight ? length : -1;
721
722     while ((fromRight ? index-- : ++index < length)) {
723       var key = props[index];
724       if (iteratee(iterable[key], key, iterable) === false) {
725         break;
726       }
727     }
728     return object;
729   };
730 }
731
732 module.exports = createBaseFor;
733
734 },{"./toObject":59}],51:[function(require,module,exports){
735 var bindCallback = require('./bindCallback');
736
737 /**
738  * Creates a function for `_.forOwn` or `_.forOwnRight`.
739  *
740  * @private
741  * @param {Function} objectFunc The function to iterate over an object.
742  * @returns {Function} Returns the new each function.
743  */
744 function createForOwn(objectFunc) {
745   return function(object, iteratee, thisArg) {
746     if (typeof iteratee != 'function' || thisArg !== undefined) {
747       iteratee = bindCallback(iteratee, thisArg, 3);
748     }
749     return objectFunc(object, iteratee);
750   };
751 }
752
753 module.exports = createForOwn;
754
755 },{"./bindCallback":49}],52:[function(require,module,exports){
756 var baseProperty = require('./baseProperty');
757
758 /**
759  * Gets the "length" property value of `object`.
760  *
761  * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
762  * that affects Safari on at least iOS 8.1-8.3 ARM64.
763  *
764  * @private
765  * @param {Object} object The object to query.
766  * @returns {*} Returns the "length" value.
767  */
768 var getLength = baseProperty('length');
769
770 module.exports = getLength;
771
772 },{"./baseProperty":48}],53:[function(require,module,exports){
773 var isNative = require('../lang/isNative');
774
775 /**
776  * Gets the native function at `key` of `object`.
777  *
778  * @private
779  * @param {Object} object The object to query.
780  * @param {string} key The key of the method to get.
781  * @returns {*} Returns the function if it's native, else `undefined`.
782  */
783 function getNative(object, key) {
784   var value = object == null ? undefined : object[key];
785   return isNative(value) ? value : undefined;
786 }
787
788 module.exports = getNative;
789
790 },{"../lang/isNative":63}],54:[function(require,module,exports){
791 var getLength = require('./getLength'),
792     isLength = require('./isLength');
793
794 /**
795  * Checks if `value` is array-like.
796  *
797  * @private
798  * @param {*} value The value to check.
799  * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
800  */
801 function isArrayLike(value) {
802   return value != null && isLength(getLength(value));
803 }
804
805 module.exports = isArrayLike;
806
807 },{"./getLength":52,"./isLength":56}],55:[function(require,module,exports){
808 /** Used to detect unsigned integer values. */
809 var reIsUint = /^\d+$/;
810
811 /**
812  * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
813  * of an array-like value.
814  */
815 var MAX_SAFE_INTEGER = 9007199254740991;
816
817 /**
818  * Checks if `value` is a valid array-like index.
819  *
820  * @private
821  * @param {*} value The value to check.
822  * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
823  * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
824  */
825 function isIndex(value, length) {
826   value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
827   length = length == null ? MAX_SAFE_INTEGER : length;
828   return value > -1 && value % 1 == 0 && value < length;
829 }
830
831 module.exports = isIndex;
832
833 },{}],56:[function(require,module,exports){
834 /**
835  * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
836  * of an array-like value.
837  */
838 var MAX_SAFE_INTEGER = 9007199254740991;
839
840 /**
841  * Checks if `value` is a valid array-like length.
842  *
843  * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
844  *
845  * @private
846  * @param {*} value The value to check.
847  * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
848  */
849 function isLength(value) {
850   return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
851 }
852
853 module.exports = isLength;
854
855 },{}],57:[function(require,module,exports){
856 /**
857  * Checks if `value` is object-like.
858  *
859  * @private
860  * @param {*} value The value to check.
861  * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
862  */
863 function isObjectLike(value) {
864   return !!value && typeof value == 'object';
865 }
866
867 module.exports = isObjectLike;
868
869 },{}],58:[function(require,module,exports){
870 var isArguments = require('../lang/isArguments'),
871     isArray = require('../lang/isArray'),
872     isIndex = require('./isIndex'),
873     isLength = require('./isLength'),
874     keysIn = require('../object/keysIn');
875
876 /** Used for native method references. */
877 var objectProto = Object.prototype;
878
879 /** Used to check objects for own properties. */
880 var hasOwnProperty = objectProto.hasOwnProperty;
881
882 /**
883  * A fallback implementation of `Object.keys` which creates an array of the
884  * own enumerable property names of `object`.
885  *
886  * @private
887  * @param {Object} object The object to query.
888  * @returns {Array} Returns the array of property names.
889  */
890 function shimKeys(object) {
891   var props = keysIn(object),
892       propsLength = props.length,
893       length = propsLength && object.length;
894
895   var allowIndexes = !!length && isLength(length) &&
896     (isArray(object) || isArguments(object));
897
898   var index = -1,
899       result = [];
900
901   while (++index < propsLength) {
902     var key = props[index];
903     if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
904       result.push(key);
905     }
906   }
907   return result;
908 }
909
910 module.exports = shimKeys;
911
912 },{"../lang/isArguments":60,"../lang/isArray":61,"../object/keysIn":67,"./isIndex":55,"./isLength":56}],59:[function(require,module,exports){
913 var isObject = require('../lang/isObject');
914
915 /**
916  * Converts `value` to an object if it's not one.
917  *
918  * @private
919  * @param {*} value The value to process.
920  * @returns {Object} Returns the object.
921  */
922 function toObject(value) {
923   return isObject(value) ? value : Object(value);
924 }
925
926 module.exports = toObject;
927
928 },{"../lang/isObject":64}],60:[function(require,module,exports){
929 var isArrayLike = require('../internal/isArrayLike'),
930     isObjectLike = require('../internal/isObjectLike');
931
932 /** Used for native method references. */
933 var objectProto = Object.prototype;
934
935 /** Used to check objects for own properties. */
936 var hasOwnProperty = objectProto.hasOwnProperty;
937
938 /** Native method references. */
939 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
940
941 /**
942  * Checks if `value` is classified as an `arguments` object.
943  *
944  * @static
945  * @memberOf _
946  * @category Lang
947  * @param {*} value The value to check.
948  * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
949  * @example
950  *
951  * _.isArguments(function() { return arguments; }());
952  * // => true
953  *
954  * _.isArguments([1, 2, 3]);
955  * // => false
956  */
957 function isArguments(value) {
958   return isObjectLike(value) && isArrayLike(value) &&
959     hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
960 }
961
962 module.exports = isArguments;
963
964 },{"../internal/isArrayLike":54,"../internal/isObjectLike":57}],61:[function(require,module,exports){
965 var getNative = require('../internal/getNative'),
966     isLength = require('../internal/isLength'),
967     isObjectLike = require('../internal/isObjectLike');
968
969 /** `Object#toString` result references. */
970 var arrayTag = '[object Array]';
971
972 /** Used for native method references. */
973 var objectProto = Object.prototype;
974
975 /**
976  * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
977  * of values.
978  */
979 var objToString = objectProto.toString;
980
981 /* Native method references for those with the same name as other `lodash` methods. */
982 var nativeIsArray = getNative(Array, 'isArray');
983
984 /**
985  * Checks if `value` is classified as an `Array` object.
986  *
987  * @static
988  * @memberOf _
989  * @category Lang
990  * @param {*} value The value to check.
991  * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
992  * @example
993  *
994  * _.isArray([1, 2, 3]);
995  * // => true
996  *
997  * _.isArray(function() { return arguments; }());
998  * // => false
999  */
1000 var isArray = nativeIsArray || function(value) {
1001   return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
1002 };
1003
1004 module.exports = isArray;
1005
1006 },{"../internal/getNative":53,"../internal/isLength":56,"../internal/isObjectLike":57}],62:[function(require,module,exports){
1007 var isObject = require('./isObject');
1008
1009 /** `Object#toString` result references. */
1010 var funcTag = '[object Function]';
1011
1012 /** Used for native method references. */
1013 var objectProto = Object.prototype;
1014
1015 /**
1016  * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
1017  * of values.
1018  */
1019 var objToString = objectProto.toString;
1020
1021 /**
1022  * Checks if `value` is classified as a `Function` object.
1023  *
1024  * @static
1025  * @memberOf _
1026  * @category Lang
1027  * @param {*} value The value to check.
1028  * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
1029  * @example
1030  *
1031  * _.isFunction(_);
1032  * // => true
1033  *
1034  * _.isFunction(/abc/);
1035  * // => false
1036  */
1037 function isFunction(value) {
1038   // The use of `Object#toString` avoids issues with the `typeof` operator
1039   // in older versions of Chrome and Safari which return 'function' for regexes
1040   // and Safari 8 which returns 'object' for typed array constructors.
1041   return isObject(value) && objToString.call(value) == funcTag;
1042 }
1043
1044 module.exports = isFunction;
1045
1046 },{"./isObject":64}],63:[function(require,module,exports){
1047 var isFunction = require('./isFunction'),
1048     isObjectLike = require('../internal/isObjectLike');
1049
1050 /** Used to detect host constructors (Safari > 5). */
1051 var reIsHostCtor = /^\[object .+?Constructor\]$/;
1052
1053 /** Used for native method references. */
1054 var objectProto = Object.prototype;
1055
1056 /** Used to resolve the decompiled source of functions. */
1057 var fnToString = Function.prototype.toString;
1058
1059 /** Used to check objects for own properties. */
1060 var hasOwnProperty = objectProto.hasOwnProperty;
1061
1062 /** Used to detect if a method is native. */
1063 var reIsNative = RegExp('^' +
1064   fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
1065   .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1066 );
1067
1068 /**
1069  * Checks if `value` is a native function.
1070  *
1071  * @static
1072  * @memberOf _
1073  * @category Lang
1074  * @param {*} value The value to check.
1075  * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
1076  * @example
1077  *
1078  * _.isNative(Array.prototype.push);
1079  * // => true
1080  *
1081  * _.isNative(_);
1082  * // => false
1083  */
1084 function isNative(value) {
1085   if (value == null) {
1086     return false;
1087   }
1088   if (isFunction(value)) {
1089     return reIsNative.test(fnToString.call(value));
1090   }
1091   return isObjectLike(value) && reIsHostCtor.test(value);
1092 }
1093
1094 module.exports = isNative;
1095
1096 },{"../internal/isObjectLike":57,"./isFunction":62}],64:[function(require,module,exports){
1097 /**
1098  * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
1099  * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1100  *
1101  * @static
1102  * @memberOf _
1103  * @category Lang
1104  * @param {*} value The value to check.
1105  * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1106  * @example
1107  *
1108  * _.isObject({});
1109  * // => true
1110  *
1111  * _.isObject([1, 2, 3]);
1112  * // => true
1113  *
1114  * _.isObject(1);
1115  * // => false
1116  */
1117 function isObject(value) {
1118   // Avoid a V8 JIT bug in Chrome 19-20.
1119   // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
1120   var type = typeof value;
1121   return !!value && (type == 'object' || type == 'function');
1122 }
1123
1124 module.exports = isObject;
1125
1126 },{}],65:[function(require,module,exports){
1127 var baseForOwn = require('../internal/baseForOwn'),
1128     createForOwn = require('../internal/createForOwn');
1129
1130 /**
1131  * Iterates over own enumerable properties of an object invoking `iteratee`
1132  * for each property. The `iteratee` is bound to `thisArg` and invoked with
1133  * three arguments: (value, key, object). Iteratee functions may exit iteration
1134  * early by explicitly returning `false`.
1135  *
1136  * @static
1137  * @memberOf _
1138  * @category Object
1139  * @param {Object} object The object to iterate over.
1140  * @param {Function} [iteratee=_.identity] The function invoked per iteration.
1141  * @param {*} [thisArg] The `this` binding of `iteratee`.
1142  * @returns {Object} Returns `object`.
1143  * @example
1144  *
1145  * function Foo() {
1146  *   this.a = 1;
1147  *   this.b = 2;
1148  * }
1149  *
1150  * Foo.prototype.c = 3;
1151  *
1152  * _.forOwn(new Foo, function(value, key) {
1153  *   console.log(key);
1154  * });
1155  * // => logs 'a' and 'b' (iteration order is not guaranteed)
1156  */
1157 var forOwn = createForOwn(baseForOwn);
1158
1159 module.exports = forOwn;
1160
1161 },{"../internal/baseForOwn":47,"../internal/createForOwn":51}],66:[function(require,module,exports){
1162 var getNative = require('../internal/getNative'),
1163     isArrayLike = require('../internal/isArrayLike'),
1164     isObject = require('../lang/isObject'),
1165     shimKeys = require('../internal/shimKeys');
1166
1167 /* Native method references for those with the same name as other `lodash` methods. */
1168 var nativeKeys = getNative(Object, 'keys');
1169
1170 /**
1171  * Creates an array of the own enumerable property names of `object`.
1172  *
1173  * **Note:** Non-object values are coerced to objects. See the
1174  * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
1175  * for more details.
1176  *
1177  * @static
1178  * @memberOf _
1179  * @category Object
1180  * @param {Object} object The object to query.
1181  * @returns {Array} Returns the array of property names.
1182  * @example
1183  *
1184  * function Foo() {
1185  *   this.a = 1;
1186  *   this.b = 2;
1187  * }
1188  *
1189  * Foo.prototype.c = 3;
1190  *
1191  * _.keys(new Foo);
1192  * // => ['a', 'b'] (iteration order is not guaranteed)
1193  *
1194  * _.keys('hi');
1195  * // => ['0', '1']
1196  */
1197 var keys = !nativeKeys ? shimKeys : function(object) {
1198   var Ctor = object == null ? undefined : object.constructor;
1199   if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
1200       (typeof object != 'function' && isArrayLike(object))) {
1201     return shimKeys(object);
1202   }
1203   return isObject(object) ? nativeKeys(object) : [];
1204 };
1205
1206 module.exports = keys;
1207
1208 },{"../internal/getNative":53,"../internal/isArrayLike":54,"../internal/shimKeys":58,"../lang/isObject":64}],67:[function(require,module,exports){
1209 var isArguments = require('../lang/isArguments'),
1210     isArray = require('../lang/isArray'),
1211     isIndex = require('../internal/isIndex'),
1212     isLength = require('../internal/isLength'),
1213     isObject = require('../lang/isObject');
1214
1215 /** Used for native method references. */
1216 var objectProto = Object.prototype;
1217
1218 /** Used to check objects for own properties. */
1219 var hasOwnProperty = objectProto.hasOwnProperty;
1220
1221 /**
1222  * Creates an array of the own and inherited enumerable property names of `object`.
1223  *
1224  * **Note:** Non-object values are coerced to objects.
1225  *
1226  * @static
1227  * @memberOf _
1228  * @category Object
1229  * @param {Object} object The object to query.
1230  * @returns {Array} Returns the array of property names.
1231  * @example
1232  *
1233  * function Foo() {
1234  *   this.a = 1;
1235  *   this.b = 2;
1236  * }
1237  *
1238  * Foo.prototype.c = 3;
1239  *
1240  * _.keysIn(new Foo);
1241  * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
1242  */
1243 function keysIn(object) {
1244   if (object == null) {
1245     return [];
1246   }
1247   if (!isObject(object)) {
1248     object = Object(object);
1249   }
1250   var length = object.length;
1251   length = (length && isLength(length) &&
1252     (isArray(object) || isArguments(object)) && length) || 0;
1253
1254   var Ctor = object.constructor,
1255       index = -1,
1256       isProto = typeof Ctor == 'function' && Ctor.prototype === object,
1257       result = Array(length),
1258       skipIndexes = length > 0;
1259
1260   while (++index < length) {
1261     result[index] = (index + '');
1262   }
1263   for (var key in object) {
1264     if (!(skipIndexes && isIndex(key, length)) &&
1265         !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
1266       result.push(key);
1267     }
1268   }
1269   return result;
1270 }
1271
1272 module.exports = keysIn;
1273
1274 },{"../internal/isIndex":55,"../internal/isLength":56,"../lang/isArguments":60,"../lang/isArray":61,"../lang/isObject":64}],68:[function(require,module,exports){
1275 /**
1276  * This method returns the first argument provided to it.
1277  *
1278  * @static
1279  * @memberOf _
1280  * @category Utility
1281  * @param {*} value Any value.
1282  * @returns {*} Returns `value`.
1283  * @example
1284  *
1285  * var object = { 'user': 'fred' };
1286  *
1287  * _.identity(object) === object;
1288  * // => true
1289  */
1290 function identity(value) {
1291   return value;
1292 }
1293
1294 module.exports = identity;
1295
1296 },{}],69:[function(require,module,exports){
1297 // Copyright Joyent, Inc. and other Node contributors.
1298 //
1299 // Permission is hereby granted, free of charge, to any person obtaining a
1300 // copy of this software and associated documentation files (the
1301 // "Software"), to deal in the Software without restriction, including
1302 // without limitation the rights to use, copy, modify, merge, publish,
1303 // distribute, sublicense, and/or sell copies of the Software, and to permit
1304 // persons to whom the Software is furnished to do so, subject to the
1305 // following conditions:
1306 //
1307 // The above copyright notice and this permission notice shall be included
1308 // in all copies or substantial portions of the Software.
1309 //
1310 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1311 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1312 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1313 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1314 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1315 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1316 // USE OR OTHER DEALINGS IN THE SOFTWARE.
1317
1318 'use strict';
1319
1320 // If obj.hasOwnProperty has been overridden, then calling
1321 // obj.hasOwnProperty(prop) will break.
1322 // See: https://github.com/joyent/node/issues/1707
1323 function hasOwnProperty(obj, prop) {
1324   return Object.prototype.hasOwnProperty.call(obj, prop);
1325 }
1326
1327 module.exports = function(qs, sep, eq, options) {
1328   sep = sep || '&';
1329   eq = eq || '=';
1330   var obj = {};
1331
1332   if (typeof qs !== 'string' || qs.length === 0) {
1333     return obj;
1334   }
1335
1336   var regexp = /\+/g;
1337   qs = qs.split(sep);
1338
1339   var maxKeys = 1000;
1340   if (options && typeof options.maxKeys === 'number') {
1341     maxKeys = options.maxKeys;
1342   }
1343
1344   var len = qs.length;
1345   // maxKeys <= 0 means that we should not limit keys count
1346   if (maxKeys > 0 && len > maxKeys) {
1347     len = maxKeys;
1348   }
1349
1350   for (var i = 0; i < len; ++i) {
1351     var x = qs[i].replace(regexp, '%20'),
1352         idx = x.indexOf(eq),
1353         kstr, vstr, k, v;
1354
1355     if (idx >= 0) {
1356       kstr = x.substr(0, idx);
1357       vstr = x.substr(idx + 1);
1358     } else {
1359       kstr = x;
1360       vstr = '';
1361     }
1362
1363     k = decodeURIComponent(kstr);
1364     v = decodeURIComponent(vstr);
1365
1366     if (!hasOwnProperty(obj, k)) {
1367       obj[k] = v;
1368     } else if (isArray(obj[k])) {
1369       obj[k].push(v);
1370     } else {
1371       obj[k] = [obj[k], v];
1372     }
1373   }
1374
1375   return obj;
1376 };
1377
1378 var isArray = Array.isArray || function (xs) {
1379   return Object.prototype.toString.call(xs) === '[object Array]';
1380 };
1381
1382 },{}],70:[function(require,module,exports){
1383 // Copyright Joyent, Inc. and other Node contributors.
1384 //
1385 // Permission is hereby granted, free of charge, to any person obtaining a
1386 // copy of this software and associated documentation files (the
1387 // "Software"), to deal in the Software without restriction, including
1388 // without limitation the rights to use, copy, modify, merge, publish,
1389 // distribute, sublicense, and/or sell copies of the Software, and to permit
1390 // persons to whom the Software is furnished to do so, subject to the
1391 // following conditions:
1392 //
1393 // The above copyright notice and this permission notice shall be included
1394 // in all copies or substantial portions of the Software.
1395 //
1396 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1397 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1398 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1399 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1400 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1401 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1402 // USE OR OTHER DEALINGS IN THE SOFTWARE.
1403
1404 'use strict';
1405
1406 var stringifyPrimitive = function(v) {
1407   switch (typeof v) {
1408     case 'string':
1409       return v;
1410
1411     case 'boolean':
1412       return v ? 'true' : 'false';
1413
1414     case 'number':
1415       return isFinite(v) ? v : '';
1416
1417     default:
1418       return '';
1419   }
1420 };
1421
1422 module.exports = function(obj, sep, eq, name) {
1423   sep = sep || '&';
1424   eq = eq || '=';
1425   if (obj === null) {
1426     obj = undefined;
1427   }
1428
1429   if (typeof obj === 'object') {
1430     return map(objectKeys(obj), function(k) {
1431       var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
1432       if (isArray(obj[k])) {
1433         return map(obj[k], function(v) {
1434           return ks + encodeURIComponent(stringifyPrimitive(v));
1435         }).join(sep);
1436       } else {
1437         return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
1438       }
1439     }).join(sep);
1440
1441   }
1442
1443   if (!name) return '';
1444   return encodeURIComponent(stringifyPrimitive(name)) + eq +
1445          encodeURIComponent(stringifyPrimitive(obj));
1446 };
1447
1448 var isArray = Array.isArray || function (xs) {
1449   return Object.prototype.toString.call(xs) === '[object Array]';
1450 };
1451
1452 function map (xs, f) {
1453   if (xs.map) return xs.map(f);
1454   var res = [];
1455   for (var i = 0; i < xs.length; i++) {
1456     res.push(f(xs[i], i));
1457   }
1458   return res;
1459 }
1460
1461 var objectKeys = Object.keys || function (obj) {
1462   var res = [];
1463   for (var key in obj) {
1464     if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
1465   }
1466   return res;
1467 };
1468
1469 },{}],71:[function(require,module,exports){
1470 'use strict';
1471
1472 exports.decode = exports.parse = require('./decode');
1473 exports.encode = exports.stringify = require('./encode');
1474
1475 },{"./decode":69,"./encode":70}],72:[function(require,module,exports){
1476 (function (global){
1477 "use strict";
1478
1479 // We only target browsers that natively support Promises, so we replace
1480 // Babel's Promise helper with a reference to the native promise.
1481 module.exports = {
1482   __esModule: true,
1483   default: global.Promise
1484 };
1485
1486 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1487
1488 },{}],73:[function(require,module,exports){
1489 'use strict';
1490
1491 Object.defineProperty(exports, "__esModule", {
1492   value: true
1493 });
1494
1495 var _assign = require('babel-runtime/core-js/object/assign');
1496
1497 var _assign2 = _interopRequireDefault(_assign);
1498
1499 var _promise = require('babel-runtime/core-js/promise');
1500
1501 var _promise2 = _interopRequireDefault(_promise);
1502
1503 exports.default = ajax;
1504
1505 var _querystring = require('querystring');
1506
1507 var _querystring2 = _interopRequireDefault(_querystring);
1508
1509 var _delay = require('./delay');
1510
1511 var _delay2 = _interopRequireDefault(_delay);
1512
1513 var _cachebustUrl = require('./cachebust-url');
1514
1515 var _cachebustUrl2 = _interopRequireDefault(_cachebustUrl);
1516
1517 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1518
1519 //jshint ignore:start
1520
1521 var forOwn = require('lodash/object/forOwn');
1522
1523
1524 var MAX_TIMEOUT = 64 * 1000; //64 seconds
1525 var MAX_RETRIES = 5;
1526 var serversToIgnore = {};
1527
1528 // Simple ajax helper.
1529 // opts:
1530 // * url
1531 // * [method]
1532 // * [cachebust] - boolean
1533 // * [headers] - object
1534 // * [xhrFields] - object
1535 // * [data]
1536 function ajax(opts) {
1537   if (!opts || typeof opts.url !== 'string') {
1538     throw new Error('URL must be given');
1539   }
1540   return new _promise2.default(function (resolve, reject) {
1541     var method = opts.method ? opts.method : "GET";
1542     var url = opts.url;
1543     var stringData = undefined;
1544     if (opts.data) {
1545       stringData = typeof opts.data === "string" ? opts.data : _querystring2.default.stringify(opts.data);
1546       if (method === "GET" || method === "HEAD") {
1547         url += (/\?/.test(url) ? "&" : "?") + stringData;
1548         stringData = null;
1549       }
1550     }
1551
1552     var match = url.match(/(?:(?:[a-z]+:)?\/\/)?([^/]*)\//);
1553     if (!match) {
1554       throw new Error("Failed to match url");
1555     }
1556     var server = match[1];
1557     if (Object.prototype.hasOwnProperty.call(serversToIgnore, server)) {
1558       reject(new Error('Server at ' + url + ' has told us to stop connecting'));
1559       return;
1560     }
1561
1562     if (opts.cachebust) {
1563       url = (0, _cachebustUrl2.default)(url);
1564     }
1565
1566     var xhr = new XMLHttpRequest();
1567     (0, _assign2.default)(xhr, opts.xhrFields);
1568     xhr.onerror = function (event) {
1569       if ((opts.retryNum || 0) < MAX_RETRIES) {
1570         if (xhr.status === 502 || (xhr.status === 0 || xhr.status >= 500) && (method === "GET" || method === "HEAD" || opts.canRetry === true)) {
1571           resolve(_retry(opts));
1572           return;
1573         }
1574       }
1575
1576       var err = (0, _assign2.default)(new Error('Failed to load ' + url), {
1577         event: event, xhr: xhr, status: xhr.status
1578       });
1579
1580       // give a way for a server to tell us to go away for now. Good fallback
1581       // in case a bug ever causes clients to spam a server with requests.
1582       if (xhr.status == 490) {
1583         serversToIgnore[server] = true;
1584       }
1585       reject(err);
1586     };
1587     xhr.onload = function (event) {
1588       if (xhr.status === 200) {
1589         resolve({
1590           xhr: xhr,
1591           text: xhr.responseText
1592         });
1593       } else {
1594         xhr.onerror(event);
1595       }
1596     };
1597     xhr.open(method, url, true);
1598     forOwn(opts.headers, function (value, name) {
1599       xhr.setRequestHeader(name, value);
1600     });
1601     xhr.send(stringData);
1602   });
1603 }
1604
1605 function _retry(opts) {
1606   var retryNum = (opts.retryNum || 0) + 1;
1607
1608   // 2000 4000 8000...
1609   var retryTimeout = Math.min(Math.pow(2, retryNum) * 1000, MAX_TIMEOUT);
1610
1611   return (0, _delay2.default)(retryTimeout).then(function () {
1612     return ajax((0, _assign2.default)({}, opts, { retryNum: retryNum }));
1613   });
1614 }
1615 module.exports = exports['default'];
1616
1617 },{"./cachebust-url":74,"./delay":76,"babel-runtime/core-js/object/assign":2,"babel-runtime/core-js/promise":72,"lodash/object/forOwn":65,"querystring":71}],74:[function(require,module,exports){
1618 "use strict";
1619
1620 Object.defineProperty(exports, "__esModule", {
1621   value: true
1622 });
1623 exports.default = cachebustUrl;
1624
1625 //jshint ignore:start
1626
1627 var r = /([?&])_=[^&]*/;
1628 var nonce = Date.now() + Math.floor(Math.random() * Math.pow(2, 32));
1629
1630 function cachebustUrl(url) {
1631   if (r.test(url)) {
1632     return url.replace(r, "$1_=" + nonce++);
1633   } else {
1634     return url + (/\?/.test(url) ? "&" : "?") + "_=" + nonce++;
1635   }
1636 }
1637 module.exports = exports["default"];
1638
1639 },{}],75:[function(require,module,exports){
1640 'use strict';
1641
1642 Object.defineProperty(exports, "__esModule", {
1643   value: true
1644 });
1645
1646 var _promise = require('babel-runtime/core-js/promise');
1647
1648 var _promise2 = _interopRequireDefault(_promise);
1649
1650 exports.default = connectivityTest;
1651
1652 var _cachebustUrl = require('./cachebust-url');
1653
1654 var _cachebustUrl2 = _interopRequireDefault(_cachebustUrl);
1655
1656 var _zipObject = require('lodash/array/zipObject');
1657
1658 var _zipObject2 = _interopRequireDefault(_zipObject);
1659
1660 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1661
1662 //jshint ignore:start
1663
1664 var URLS = ['https://mailfoogae.appspot.com/build/images/composeOverflowToggle.png', 'https://www.streak.com/build/images/composeOverflowToggle.png', 'https://www.inboxsdk.com/images/logo-red.png'];
1665
1666 function imageTest(url) {
1667   return new _promise2.default(function (resolve, reject) {
1668     var img = document.createElement('img');
1669     img.onload = function () {
1670       resolve(true);
1671     };
1672     img.onloadend = img.onerror = function () {
1673       resolve(false);
1674     };
1675     img.src = (0, _cachebustUrl2.default)(url);
1676   });
1677 }
1678
1679 function connectivityTest() {
1680   return _promise2.default.all(URLS.map(function (url) {
1681     return imageTest(url).then(function (success) {
1682       return [url, success];
1683     });
1684   })).then(function (results) {
1685     return (0, _zipObject2.default)(results);
1686   });
1687 }
1688 module.exports = exports['default'];
1689
1690 },{"./cachebust-url":74,"babel-runtime/core-js/promise":72,"lodash/array/zipObject":40}],76:[function(require,module,exports){
1691 "use strict";
1692
1693 Object.defineProperty(exports, "__esModule", {
1694   value: true
1695 });
1696
1697 var _promise = require("babel-runtime/core-js/promise");
1698
1699 var _promise2 = _interopRequireDefault(_promise);
1700
1701 exports.default = delay;
1702
1703 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1704
1705 //jshint ignore:start
1706
1707 function delay(time, value) {
1708   return new _promise2.default(function (resolve, reject) {
1709     setTimeout(function () {
1710       return resolve(value);
1711     }, time);
1712   });
1713 }
1714 module.exports = exports["default"];
1715
1716 },{"babel-runtime/core-js/promise":72}],77:[function(require,module,exports){
1717 (function (global){
1718 'use strict';
1719
1720 Object.defineProperty(exports, "__esModule", {
1721   value: true
1722 });
1723 exports.default = getExtensionId;
1724
1725 //jshint ignore:start
1726
1727 function getExtensionId() {
1728   if (global.chrome && global.chrome.extension && global.chrome.extension.getURL) {
1729     return global.chrome.extension.getURL('');
1730   }
1731   return null;
1732 }
1733 module.exports = exports['default'];
1734
1735 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1736
1737 },{}],78:[function(require,module,exports){
1738 (function (global){
1739 'use strict';
1740
1741 Object.defineProperty(exports, "__esModule", {
1742   value: true
1743 });
1744 exports.default = getSessionId;
1745
1746 //jshint ignore:start
1747
1748 function getSessionId() {
1749   if (global.document && document.documentElement.hasAttribute('data-inboxsdk-session-id')) {
1750     return document.documentElement.getAttribute('data-inboxsdk-session-id');
1751   } else {
1752     var sessionId = Date.now() + '-' + Math.random();
1753     if (global.document) {
1754       document.documentElement.setAttribute('data-inboxsdk-session-id', sessionId);
1755     }
1756     return sessionId;
1757   }
1758 }
1759 module.exports = exports['default'];
1760
1761 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1762
1763 },{}],79:[function(require,module,exports){
1764 "use strict";
1765
1766 Object.defineProperty(exports, "__esModule", {
1767   value: true
1768 });
1769 exports.default = getStackTrace;
1770
1771 //jshint ignore:start
1772
1773 function getStackTrace() {
1774   var err = new Error("Stack saver");
1775   // Cut the first two lines off. The first line has the error name, and the
1776   // second line is inside this function.
1777   return ("" + err.stack).replace(/^([^\n]*\n){2}/, '');
1778 }
1779 module.exports = exports["default"];
1780
1781 },{}],80:[function(require,module,exports){
1782 (function (global){
1783 'use strict';
1784
1785 Object.defineProperty(exports, "__esModule", {
1786   value: true
1787 });
1788
1789 var _promise = require('babel-runtime/core-js/promise');
1790
1791 var _promise2 = _interopRequireDefault(_promise);
1792
1793 exports.default = loadScript;
1794
1795 var _connectivityTest = require('./connectivity-test');
1796
1797 var _connectivityTest2 = _interopRequireDefault(_connectivityTest);
1798
1799 var _logError = require('./log-error');
1800
1801 var _logError2 = _interopRequireDefault(_logError);
1802
1803 var _ajax = require('./ajax');
1804
1805 var _ajax2 = _interopRequireDefault(_ajax);
1806
1807 var _delay = require('./delay');
1808
1809 var _delay2 = _interopRequireDefault(_delay);
1810
1811 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1812
1813 //jshint ignore:start
1814
1815 var once = require('lodash/function/once');
1816 var defer = require('lodash/function/defer');
1817
1818
1819 var isContentScript = once(function () {
1820   if (global.chrome && global.chrome.extension) return true;
1821   if (global.safari && global.safari.extension) return true;
1822   return false;
1823 });
1824
1825 function addScriptToPage(url, cors) {
1826   var script = document.createElement('script');
1827   script.type = 'text/javascript';
1828   if (cors) {
1829     script.crossOrigin = 'anonymous';
1830   }
1831
1832   var promise = new _promise2.default(function (resolve, reject) {
1833     script.addEventListener('error', function (event) {
1834       reject(event.error || new Error(event.message || "Load failure: " + url, event.filename, event.lineno, event.column));
1835     }, false);
1836     script.addEventListener('load', function () {
1837       // Make sure the script has a moment to execute before this promise
1838       // resolves.
1839       defer(resolve);
1840     }, false);
1841   });
1842
1843   script.src = url;
1844   document.head.appendChild(script);
1845   return promise;
1846 }
1847
1848 function loadScript(url, opts) {
1849   var pr = void 0;
1850   if (isContentScript()) {
1851     (function () {
1852       var attempt = function attempt(retryNum, lastErr) {
1853         if (retryNum > 3) {
1854           throw lastErr || new Error("Ran out of loadScript attempts for unknown reason");
1855         }
1856
1857         return (0, _ajax2.default)({
1858           url: url, cachebust: retryNum > 0
1859         }).then(function (response) {
1860           // jshint evil:true
1861
1862           // Q: Why put the code into a function before executing it instead of
1863           //    evaling it immediately?
1864           // A: Chrome would execute it before applying any remembered
1865           //    breakpoints.
1866           // Q: Why not just use `... = new Function(...)`?
1867           // A: The sourcemaps would be off by one line in Chrome because of
1868           //    https://code.google.com/p/chromium/issues/detail?id=109362
1869           // Q: indirectEval?
1870           // A: Using the eval value rather than the eval keyword causes the
1871           //    code passed to it to be run in the global scope instead of the
1872           //    current scope. (Seriously, it's a javascript thing.)
1873           var originalCode = response.text;
1874           var indirectEval = eval;
1875
1876           var codeParts = [];
1877           if (opts && opts.disableSourceMappingURL) {
1878             // Don't remove a data: URI sourcemap (used in dev)
1879             codeParts.push(originalCode.replace(/\/\/# sourceMappingURL=(?!data:)[^\n]*\n?$/, ''));
1880           } else {
1881             codeParts.push(originalCode);
1882           }
1883
1884           if (!opts || !opts.nowrap) {
1885             codeParts.unshift("(function(){");
1886             codeParts.push("\n});");
1887           }
1888
1889           codeParts.push("\n//# sourceURL=" + url + "\n");
1890
1891           var codeToRun = codeParts.join('');
1892           var program = void 0;
1893           try {
1894             program = indirectEval(codeToRun);
1895           } catch (err) {
1896             if (err && err.name === 'SyntaxError') {
1897               (0, _logError2.default)(err, {
1898                 retryNum: retryNum,
1899                 caughtSyntaxError: true,
1900                 url: url,
1901                 message: 'SyntaxError in loading ' + url + '. Did we not load it fully? Trying again...'
1902               }, {});
1903               return (0, _delay2.default)(5000).then(function () {
1904                 return attempt(retryNum + 1, err);
1905               });
1906             }
1907             // SyntaxErrors are the only errors that can happen during eval that we
1908             // retry because sometimes AppEngine doesn't serve the full javascript.
1909             // No other error is retried because other errors aren't likely to be
1910             // transient.
1911             throw err;
1912           }
1913           if (!opts || !opts.nowrap) {
1914             program();
1915           }
1916         });
1917       };
1918
1919       pr = attempt(0, null);
1920     })();
1921   } else {
1922     // Try to add script as CORS first so we can get error stack data from it.
1923     pr = addScriptToPage(url, true).catch(function () {
1924       // Only show the warning if we successfully load the script on retry.
1925       return addScriptToPage(url, false).then(function () {
1926         console.warn("Script " + url + " included without CORS headers. Error logs might be censored by the browser.");
1927       });
1928     });
1929   }
1930   pr.catch(function (err) {
1931     return (0, _connectivityTest2.default)().then(function (connectivityTestResults) {
1932       (0, _logError2.default)(err, {
1933         url: url,
1934         connectivityTestResults: connectivityTestResults,
1935         status: err && err.status,
1936         response: err && err.xhr ? err.xhr.responseText : null,
1937         message: 'Failed to load script'
1938       }, {});
1939     });
1940   });
1941   return pr;
1942 }
1943 module.exports = exports['default'];
1944
1945 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1946
1947 },{"./ajax":73,"./connectivity-test":75,"./delay":76,"./log-error":81,"babel-runtime/core-js/promise":72,"lodash/function/defer":42,"lodash/function/once":43}],81:[function(require,module,exports){
1948 (function (global){
1949 'use strict';
1950
1951 Object.defineProperty(exports, "__esModule", {
1952   value: true
1953 });
1954
1955 var _stringify = require('babel-runtime/core-js/json/stringify');
1956
1957 var _stringify2 = _interopRequireDefault(_stringify);
1958
1959 exports.default = logError;
1960
1961 var _ajax = require('./ajax');
1962
1963 var _ajax2 = _interopRequireDefault(_ajax);
1964
1965 var _rateLimit = require('./rate-limit');
1966
1967 var _rateLimit2 = _interopRequireDefault(_rateLimit);
1968
1969 var _getStackTrace = require('./get-stack-trace');
1970
1971 var _getStackTrace2 = _interopRequireDefault(_getStackTrace);
1972
1973 var _getExtensionId = require('./get-extension-id');
1974
1975 var _getExtensionId2 = _interopRequireDefault(_getExtensionId);
1976
1977 var _getSessionId = require('./get-session-id');
1978
1979 var _getSessionId2 = _interopRequireDefault(_getSessionId);
1980
1981 var _version = require('./version');
1982
1983 var _isObject = require('lodash/lang/isObject');
1984
1985 var _isObject2 = _interopRequireDefault(_isObject);
1986
1987 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1988
1989 var sessionId = (0, _getSessionId2.default)();
1990
1991 // code inside the platform-implementation should use logger.js instead of
1992 // interacting with this directly!
1993
1994 //jshint ignore:start
1995
1996 function logError(err, details, context) {
1997   if (!global.document) {
1998     // In tests, just throw the error.
1999     throw err;
2000   }
2001
2002   var args = arguments;
2003
2004   // It's important that we can't throw an error or leave a rejected promise
2005   // unheard while logging an error in order to make sure to avoid ever
2006   // getting into an infinite loop of reporting uncaught errors.
2007   try {
2008     if (haveWeSeenThisErrorAlready(err)) {
2009       return;
2010     } else {
2011       markErrorAsSeen(err);
2012     }
2013
2014     if (!(err instanceof Error)) {
2015       console.warn('First parameter to Logger.error was not an error object:', err);
2016       err = new Error("Logger.error called with non-error: " + err);
2017       markErrorAsSeen(err);
2018     }
2019     var appId = context.appId;
2020     var appIds = context.appIds;
2021     var implVersion = context.implVersion;
2022     var userEmailHash = context.userEmailHash;
2023
2024     var _loaderVersion = context.loaderVersion || _version.BUILD_VERSION;
2025     var _sentByApp = !!context.sentByApp;
2026
2027     // Might not have been passed a useful error object with a stack, so get
2028     // our own current stack just in case.
2029     var nowStack = (0, _getStackTrace2.default)();
2030
2031     var stuffToLog = ["Error logged:", err];
2032     if (err && err.stack) {
2033       stuffToLog = stuffToLog.concat(["\n\nOriginal error stack:\n" + err.stack]);
2034     }
2035     stuffToLog = stuffToLog.concat(["\n\nError logged from:\n" + nowStack]);
2036     if (details) {
2037       stuffToLog = stuffToLog.concat(["\n\nError details:", details]);
2038     }
2039     stuffToLog = stuffToLog.concat(["\n\nExtension App Ids:", (0, _stringify2.default)(appIds, null, 2)]);
2040     stuffToLog = stuffToLog.concat(["\nSent by App:", _sentByApp]);
2041     stuffToLog = stuffToLog.concat(["\nSession Id:", sessionId]);
2042     stuffToLog = stuffToLog.concat(["\nExtension Id:", (0, _getExtensionId2.default)()]);
2043     stuffToLog = stuffToLog.concat(["\nInboxSDK Loader Version:", _loaderVersion]);
2044     stuffToLog = stuffToLog.concat(["\nInboxSDK Implementation Version:", implVersion]);
2045
2046     console.error.apply(console, stuffToLog);
2047
2048     var report = {
2049       message: err && err.message || err,
2050       stack: err && err.stack,
2051       loggedFrom: nowStack,
2052       details: details,
2053       appIds: appIds,
2054       sentByApp: _sentByApp,
2055       sessionId: sessionId,
2056       emailHash: userEmailHash,
2057       extensionId: (0, _getExtensionId2.default)(),
2058       loaderVersion: _loaderVersion,
2059       implementationVersion: implVersion,
2060       origin: document.location.origin,
2061       timestamp: Date.now() * 1000
2062     };
2063
2064     sendError(report);
2065   } catch (err2) {
2066     tooManyErrors(err2, args);
2067   }
2068 }
2069
2070 var _extensionSeenErrors = function () {
2071   // Safari <9 doesn't have WeakSet and we don't want to pull in the polyfill,
2072   // so we make one out of a WeakMap.
2073   if (!global.__inboxsdk_extensionSeenErrors && global.WeakMap) {
2074     Object.defineProperty(global, '__inboxsdk_extensionSeenErrors', {
2075       value: new global.WeakMap()
2076     });
2077   }
2078   return {
2079     has: function has(e) {
2080       if (global.__inboxsdk_extensionSeenErrors) {
2081         return global.__inboxsdk_extensionSeenErrors.has(e);
2082       } else {
2083         try {
2084           return !!e.__inboxsdk_extensionHasSeenError;
2085         } catch (err) {
2086           console.error(err);
2087           return false;
2088         }
2089       }
2090     },
2091     add: function add(e) {
2092       if (global.__inboxsdk_extensionSeenErrors && global.__inboxsdk_extensionSeenErrors.set) {
2093         // It's a WeakMap.
2094         global.__inboxsdk_extensionSeenErrors.set(e, true);
2095       } else if (global.__inboxsdk_extensionSeenErrors && global.__inboxsdk_extensionSeenErrors.add) {
2096         // Older versions of inboxsdk.js initialized it as a WeakSet instead,
2097         // so handle that too.
2098         global.__inboxsdk_extensionSeenErrors.add(e);
2099       } else {
2100         try {
2101           Object.defineProperty(e, '__inboxsdk_extensionHasSeenError', {
2102             value: true
2103           });
2104         } catch (err) {
2105           console.error(err);
2106         }
2107       }
2108     }
2109   };
2110 }();
2111
2112 function haveWeSeenThisErrorAlready(error) {
2113   if ((0, _isObject2.default)(error)) {
2114     return _extensionSeenErrors.has(error);
2115   }
2116   return false;
2117 }
2118
2119 function markErrorAsSeen(error) {
2120   if ((0, _isObject2.default)(error)) {
2121     _extensionSeenErrors.add(error);
2122   }
2123 }
2124
2125 // Only let 10 errors be sent per minute.
2126 var sendError = (0, _rateLimit2.default)(function (report) {
2127   var args = arguments;
2128
2129   try {
2130     (0, _ajax2.default)({
2131       url: 'https://www.inboxsdk.com/api/v2/errors',
2132       method: 'POST',
2133       headers: {
2134         'Content-Type': 'application/json'
2135       },
2136       data: (0, _stringify2.default)(report)
2137     }).catch(function (err2) {
2138       tooManyErrors(err2, args);
2139     });
2140   } catch (err2) {
2141     tooManyErrors(err2, args);
2142   }
2143 }, 60 * 1000, 10);
2144
2145 function tooManyErrors(err2, originalArgs) {
2146   console.error("ERROR REPORTING ERROR", err2);
2147   console.error("ORIGINAL ERROR", originalArgs);
2148 }
2149 module.exports = exports['default'];
2150
2151 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2152
2153 },{"./ajax":73,"./get-extension-id":77,"./get-session-id":78,"./get-stack-trace":79,"./rate-limit":82,"./version":83,"babel-runtime/core-js/json/stringify":1,"lodash/lang/isObject":64}],82:[function(require,module,exports){
2154 "use strict";
2155
2156 Object.defineProperty(exports, "__esModule", {
2157   value: true
2158 });
2159 exports.default = rateLimit;
2160
2161 //jshint ignore:start
2162
2163 // Returns a wrapped version of the function which throws an exception if it's
2164 // called more than count times within period amount of time.
2165 function rateLimit(fn, period, count) {
2166   var calls = [];
2167   return function () {
2168     var now = Date.now();
2169     calls = calls.filter(function (time) {
2170       return time > now - period;
2171     });
2172     if (calls.length >= count) {
2173       throw new Error("Function rate limit exceeded");
2174     }
2175     calls.push(now);
2176     return fn.apply(this, arguments);
2177   };
2178 }
2179 module.exports = exports["default"];
2180
2181 },{}],83:[function(require,module,exports){
2182 "use strict";
2183
2184 //jshint ignore:start
2185
2186 // This is in its own file so that updates to the version value don't cause a
2187 // reload of everything.
2188
2189 exports.BUILD_VERSION = "0.7.21-1466467956470-7c17f4be535fde9c";
2190
2191 if (module.hot) {
2192   module.hot.accept();
2193 }
2194
2195 },{}],84:[function(require,module,exports){
2196 (function (global){
2197 "use strict";
2198
2199 function checkRequirements(opts) {
2200   if (!opts.TEMPORARY_INTERNAL_skipWeakMapRequirement && !global.WeakMap) {
2201     throw new Error("Browser does not support WeakMap");
2202   }
2203 }
2204
2205 module.exports = checkRequirements;
2206
2207 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2208
2209 },{}],85:[function(require,module,exports){
2210 'use strict';
2211
2212 Object.defineProperty(exports, "__esModule", {
2213   value: true
2214 });
2215
2216 var _assign = require('babel-runtime/core-js/object/assign');
2217
2218 var _assign2 = _interopRequireDefault(_assign);
2219
2220 var _logError = require('../common/log-error');
2221
2222 var _logError2 = _interopRequireDefault(_logError);
2223
2224 var _platformImplementationLoader = require('./loading/platform-implementation-loader');
2225
2226 var _platformImplementationLoader2 = _interopRequireDefault(_platformImplementationLoader);
2227
2228 var _checkRequirements = require('./check-requirements');
2229
2230 var _checkRequirements2 = _interopRequireDefault(_checkRequirements);
2231
2232 var _version = require('../common/version');
2233
2234 var _loadScript = require('../common/load-script');
2235
2236 var _loadScript2 = _interopRequireDefault(_loadScript);
2237
2238 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2239
2240 var InboxSDK = {
2241   LOADER_VERSION: _version.BUILD_VERSION,
2242   loadScript: _loadScript2.default,
2243   load: function load(version, appId, opts) {
2244     opts = (0, _assign2.default)({
2245       // defaults
2246       globalErrorLogging: true
2247     }, opts, {
2248       // stuff that can't be overridden, such as extra stuff this file passes to
2249       // the implementation script.
2250       VERSION: InboxSDK.LOADER_VERSION,
2251       REQUESTED_API_VERSION: version
2252     });
2253
2254     (0, _checkRequirements2.default)(opts);
2255
2256     return _platformImplementationLoader2.default.load(appId, opts);
2257   }
2258 };
2259
2260 if (['https://mail.google.com', 'https://inbox.google.com'].indexOf(document.location.origin) != -1) {
2261   _platformImplementationLoader2.default.preload();
2262 }
2263
2264 exports.default = InboxSDK;
2265 module.exports = exports['default'];
2266
2267 },{"../common/load-script":80,"../common/log-error":81,"../common/version":83,"./check-requirements":84,"./loading/platform-implementation-loader":86,"babel-runtime/core-js/object/assign":2}],86:[function(require,module,exports){
2268 (function (global){
2269 'use strict';
2270
2271 Object.defineProperty(exports, "__esModule", {
2272   value: true
2273 });
2274
2275 var _promise = require('babel-runtime/core-js/promise');
2276
2277 var _promise2 = _interopRequireDefault(_promise);
2278
2279 var _loadScript = require('../../common/load-script');
2280
2281 var _loadScript2 = _interopRequireDefault(_loadScript);
2282
2283 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2284
2285 //jshint ignore:start
2286
2287 var once = require('lodash/function/once');
2288
2289
2290 var PlatformImplementationLoader = {
2291   load: function load(appId, opts) {
2292     return _promise2.default.resolve().then(function () {
2293       if (!global.__InboxSDKImpLoader) {
2294         return PlatformImplementationLoader._loadScript().then(function () {
2295           if (!global.__InboxSDKImpLoader) {
2296             throw new Error("Implementation file did not load correctly");
2297           }
2298         });
2299       }
2300     }).then(function () {
2301       return global.__InboxSDKImpLoader.load("0.1", appId, opts);
2302     });
2303   },
2304
2305
2306   _loadScript: once(function () {
2307     var disableSourceMappingURL = true;
2308     if (window.localStorage) {
2309       try {
2310         disableSourceMappingURL = localStorage.getItem('inboxsdk__enable_sourcemap') !== 'true';
2311       } catch (err) {
2312         console.error(err);
2313       }
2314     }
2315
2316     return (0, _loadScript2.default)("https://www.inboxsdk.com/build/platform-implementation.js", {
2317       nowrap: true, // platform-implementation has no top-level vars so no need for function wrapping
2318       disableSourceMappingURL: disableSourceMappingURL
2319     });
2320   }),
2321
2322   preload: function preload() {
2323     // Prime the load by calling it and letting the promise be memoized.
2324     this._loadScript();
2325   }
2326 };
2327
2328 exports.default = PlatformImplementationLoader;
2329 module.exports = exports['default'];
2330
2331 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2332
2333 },{"../../common/load-script":80,"babel-runtime/core-js/promise":72,"lodash/function/once":43}],87:[function(require,module,exports){
2334 "use strict";
2335
2336 var oldDefine;
2337 try {
2338   if (typeof define !== "undefined" && define && define.amd) {
2339     // work around amd compatibility issue
2340     // https://groups.google.com/forum/#!msg/inboxsdk/U_bq82Exmwc/I3iIinxxCAAJ
2341     oldDefine = define;
2342     define = null;
2343   }
2344   // exposes main as a global for browsers
2345   window.InboxSDK = require('./inboxsdk');
2346 } finally {
2347   if (oldDefine) {
2348     define = oldDefine;
2349   }
2350 }
2351
2352 },{"./inboxsdk":85}]},{},[87])
2353