PageSourceSearch

https://m.youth.cn/images/youth-videojs-ie8.js

js youth.cn collected 2026-09-24 15:34:30 UTC 99,207 bytes, 2,600 lines download raw bytes

vendor: 99,207 bytes, lines 1-2600
1/**
2 * HTML5 Element Shim for IE8
3 *
4 * **THIS CODE MUST BE LOADED IN THE <HEAD> OF THE DOCUMENT**
5 *
6 * Video.js uses the video tag as an embed code, even in IE8 which
7 * doesn't have support for HTML5 video. The following code is needed
8 * to make it possible to use the video tag. Otherwise IE8 ignores everything
9 * inside the video tag.
10 */
11if (typeof window.HTMLVideoElement === 'undefined') {
12  document.createElement('video');
13  document.createElement('audio');
14  document.createElement('track');
15}
16
17/*!
18 * https://github.com/es-shims/es5-shim
19 * @license es5-shim Copyright 2009-2015 by contributors, MIT License
20 * see https://github.com/es-shims/es5-shim/blob/master/LICENSE
21 */
22
23// vim: ts=4 sts=4 sw=4 expandtab
24
25// Add semicolon to prevent IIFE from being passed as argument to concatenated code.
26;
27
28// UMD (Universal Module Definition)
29// see https://github.com/umdjs/umd/blob/master/templates/returnExports.js
30(function (root, factory) {
31    'use strict';
32
33    /* global define, exports, module */
34    if (typeof define === 'function' && define.amd) {
35        // AMD. Register as an anonymous module.
36        define(factory);
37    } else if (typeof exports === 'object') {
38        // Node. Does not work with strict CommonJS, but
39        // only CommonJS-like enviroments that support module.exports,
40        // like Node.
41        module.exports = factory();
42    } else {
43        // Browser globals (root is window)
44        root.returnExports = factory();
45    }
46}(this, function () {
47
48/**
49 * Brings an environment as close to ECMAScript 5 compliance
50 * as is possible with the facilities of erstwhile engines.
51 *
52 * Annotated ES5: http://es5.github.com/ (specific links below)
53 * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
54 * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
55 */
56
57// Shortcut to an often accessed properties, in order to avoid multiple
58// dereference that costs universally. This also holds a reference to known-good
59// functions.
60var $Array = Array;
61var ArrayPrototype = $Array.prototype;
62var $Object = Object;
63var ObjectPrototype = $Object.prototype;
64var FunctionPrototype = Function.prototype;
65var $String = String;
66var StringPrototype = $String.prototype;
67var $Number = Number;
68var NumberPrototype = $Number.prototype;
69var array_slice = ArrayPrototype.slice;
70var array_splice = ArrayPrototype.splice;
71var array_push = ArrayPrototype.push;
72var array_unshift = ArrayPrototype.unshift;
73var array_concat = ArrayPrototype.concat;
74var call = FunctionPrototype.call;
75var apply = FunctionPrototype.apply;
76var max = Math.max;
77var min = Math.min;
78
79// Having a toString local variable name breaks in Opera so use to_string.
80var to_string = ObjectPrototype.toString;
81
82var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
83var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; };
84var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; };
85var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; };
86
87/* inlined from http://npmjs.com/define-properties */
88var supportsDescriptors = $Object.defineProperty && (function () {
89    try {
90        var obj = {};
91        $Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
92        for (var _ in obj) { return false; }
93        return obj.x === obj;
94    } catch (e) { /* this is ES3 */
95        return false;
96    }
97}());
98var defineProperties = (function (has) {
99  // Define configurable, writable, and non-enumerable props
100  // if they don't exist.
101  var defineProperty;
102  if (supportsDescriptors) {
103      defineProperty = function (object, name, method, forceAssign) {
104          if (!forceAssign && (name in object)) { return; }
105          $Object.defineProperty(object, name, {
106              configurable: true,
107              enumerable: false,
108              writable: true,
109              value: method
110          });
111      };
112  } else {
113      defineProperty = function (object, name, method, forceAssign) {
114          if (!forceAssign && (name in object)) { return; }
115          object[name] = method;
116      };
117  }
118  return function defineProperties(object, map, forceAssign) {
119      for (var name in map) {
120          if (has.call(map, name)) {
121            defineProperty(object, name, map[name], forceAssign);
122          }
123      }
124  };
125}(ObjectPrototype.hasOwnProperty));
126
127//
128// Util
129// ======
130//
131
132/* replaceable with https://npmjs.com/package/es-abstract /helpers/isPrimitive */
133var isPrimitive = function isPrimitive(input) {
134    var type = typeof input;
135    return input === null || (type !== 'object' && type !== 'function');
136};
137
138var isActualNaN = $Number.isNaN || function (x) { return x !== x; };
139
140var ES = {
141    // ES5 9.4
142    // http://es5.github.com/#x9.4
143    // http://jsperf.com/to-integer
144    /* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */
145    ToInteger: function ToInteger(num) {
146        var n = +num;
147        if (isActualNaN(n)) {
148            n = 0;
149        } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
150            n = (n > 0 || -1) * Math.floor(Math.abs(n));
151        }
152        return n;
153    },
154
155    /* replaceable with https://npmjs.com/package/es-abstract ES5.ToPrimitive */
156    ToPrimitive: function ToPrimitive(input) {
157        var val, valueOf, toStr;
158        if (isPrimitive(input)) {
159            return input;
160        }
161        valueOf = input.valueOf;
162        if (isCallable(valueOf)) {
163            val = valueOf.call(input);
164            if (isPrimitive(val)) {
165                return val;
166            }
167        }
168        toStr = input.toString;
169        if (isCallable(toStr)) {
170            val = toStr.call(input);
171            if (isPrimitive(val)) {
172                return val;
173            }
174        }
175        throw new TypeError();
176    },
177
178    // ES5 9.9
179    // http://es5.github.com/#x9.9
180    /* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */
181    ToObject: function (o) {
182        if (o == null) { // this matches both null and undefined
183            throw new TypeError("can't convert " + o + ' to object');
184        }
185        return $Object(o);
186    },
187
188    /* replaceable with https://npmjs.com/package/es-abstract ES5.ToUint32 */
189    ToUint32: function ToUint32(x) {
190        return x >>> 0;
191    }
192};
193
194//
195// Function
196// ========
197//
198
199// ES-5 15.3.4.5
200// http://es5.github.com/#x15.3.4.5
201
202var Empty = function Empty() {};
203
204defineProperties(FunctionPrototype, {
205    bind: function bind(that) { // .length is 1
206        // 1. Let Target be the this value.
207        var target = this;
208        // 2. If IsCallable(Target) is false, throw a TypeError exception.
209        if (!isCallable(target)) {
210            throw new TypeError('Function.prototype.bind called on incompatible ' + target);
211        }
212        // 3. Let A be a new (possibly empty) internal list of all of the
213        //   argument values provided after thisArg (arg1, arg2 etc), in order.
214        // XXX slicedArgs will stand in for "A" if used
215        var args = array_slice.call(arguments, 1); // for normal call
216        // 4. Let F be a new native ECMAScript object.
217        // 11. Set the [[Prototype]] internal property of F to the standard
218        //   built-in Function prototype object as specified in 15.3.3.1.
219        // 12. Set the [[Call]] internal property of F as described in
220        //   15.3.4.5.1.
221        // 13. Set the [[Construct]] internal property of F as described in
222        //   15.3.4.5.2.
223        // 14. Set the [[HasInstance]] internal property of F as described in
224        //   15.3.4.5.3.
225        var bound;
226        var binder = function () {
227
228            if (this instanceof bound) {
229                // 15.3.4.5.2 [[Construct]]
230                // When the [[Construct]] internal method of a function object,
231                // F that was created using the bind function is called with a
232                // list of arguments ExtraArgs, the following steps are taken:
233                // 1. Let target be the value of F's [[TargetFunction]]
234                //   internal property.
235                // 2. If target has no [[Construct]] internal method, a
236                //   TypeError exception is thrown.
237                // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
238                //   property.
239                // 4. Let args be a new list containing the same values as the
240                //   list boundArgs in the same order followed by the same
241                //   values as the list ExtraArgs in the same order.
242                // 5. Return the result of calling the [[Construct]] internal
243                //   method of target providing args as the arguments.
244
245                var result = target.apply(
246                    this,
247                    array_concat.call(args, array_slice.call(arguments))
248                );
249                if ($Object(result) === result) {
250                    return result;
251                }
252                return this;
253
254            } else {
255                // 15.3.4.5.1 [[Call]]
256                // When the [[Call]] internal method of a function object, F,
257                // which was created using the bind function is called with a
258                // this value and a list of arguments ExtraArgs, the following
259                // steps are taken:
260                // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
261                //   property.
262                // 2. Let boundThis be the value of F's [[BoundThis]] internal
263                //   property.
264                // 3. Let target be the value of F's [[TargetFunction]] internal
265                //   property.
266                // 4. Let args be a new list containing the same values as the
267                //   list boundArgs in the same order followed by the same
268                //   values as the list ExtraArgs in the same order.
269                // 5. Return the result of calling the [[Call]] internal method
270                //   of target providing boundThis as the this value and
271                //   providing args as the arguments.
272
273                // equiv: target.call(this, ...boundArgs, ...args)
274                return target.apply(
275                    that,
276                    array_concat.call(args, array_slice.call(arguments))
277                );
278
279            }
280
281        };
282
283        // 15. If the [[Class]] internal property of Target is "Function", then
284        //     a. Let L be the length property of Target minus the length of A.
285        //     b. Set the length own property of F to either 0 or L, whichever is
286        //       larger.
287        // 16. Else set the length own property of F to 0.
288
289        var boundLength = max(0, target.length - args.length);
290
291        // 17. Set the attributes of the length own property of F to the values
292        //   specified in 15.3.5.1.
293        var boundArgs = [];
294        for (var i = 0; i < boundLength; i++) {
295            array_push.call(boundArgs, '$' + i);
296        }
297
298        // XXX Build a dynamic function with desired amount of arguments is the only
299        // way to set the length property of a function.
300        // In environments where Content Security Policies enabled (Chrome extensions,
301        // for ex.) all use of eval or Function costructor throws an exception.
302        // However in all of these environments Function.prototype.bind exists
303        // and so this code will never be executed.
304        bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
305
306        if (target.prototype) {
307            Empty.prototype = target.prototype;
308            bound.prototype = new Empty();
309            // Clean up dangling references.
310            Empty.prototype = null;
311        }
312
313        // TODO
314        // 18. Set the [[Extensible]] internal property of F to true.
315
316        // TODO
317        // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
318        // 20. Call the [[DefineOwnProperty]] internal method of F with
319        //   arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
320        //   thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
321        //   false.
322        // 21. Call the [[DefineOwnProperty]] internal method of F with
323        //   arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
324        //   [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
325        //   and false.
326
327        // TODO
328        // NOTE Function objects created using Function.prototype.bind do not
329        // have a prototype property or the [[Code]], [[FormalParameters]], and
330        // [[Scope]] internal properties.
331        // XXX can't delete prototype in pure-js.
332
333        // 22. Return F.
334        return bound;
335    }
336});
337
338// _Please note: Shortcuts are defined after `Function.prototype.bind` as we
339// use it in defining shortcuts.
340var owns = call.bind(ObjectPrototype.hasOwnProperty);
341var toStr = call.bind(ObjectPrototype.toString);
342var arraySlice = call.bind(array_slice);
343var arraySliceApply = apply.bind(array_slice);
344var strSlice = call.bind(StringPrototype.slice);
345var strSplit = call.bind(StringPrototype.split);
346var strIndexOf = call.bind(StringPrototype.indexOf);
347var pushCall = call.bind(array_push);
348var isEnum = call.bind(ObjectPrototype.propertyIsEnumerable);
349var arraySort = call.bind(ArrayPrototype.sort);
350
351//
352// Array
353// =====
354//
355
356var isArray = $Array.isArray || function isArray(obj) {
357    return toStr(obj) === '[object Array]';
358};
359
360// ES5 15.4.4.12
361// http://es5.github.com/#x15.4.4.13
362// Return len+argCount.
363// [bugfix, ielt8]
364// IE < 8 bug: [].unshift(0) === undefined but should be "1"
365var hasUnshiftReturnValueBug = [].unshift(0) !== 1;
366defineProperties(ArrayPrototype, {
367    unshift: function () {
368        array_unshift.apply(this, arguments);
369        return this.length;
370    }
371}, hasUnshiftReturnValueBug);
372
373// ES5 15.4.3.2
374// http://es5.github.com/#x15.4.3.2
375// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
376defineProperties($Array, { isArray: isArray });
377
378// The IsCallable() check in the Array functions
379// has been replaced with a strict check on the
380// internal class of the object to trap cases where
381// the provided function was actually a regular
382// expression literal, which in V8 and
383// JavaScriptCore is a typeof "function".  Only in
384// V8 are regular expression literals permitted as
385// reduce parameters, so it is desirable in the
386// general case for the shim to match the more
387// strict and common behavior of rejecting regular
388// expressions.
389
390// ES5 15.4.4.18
391// http://es5.github.com/#x15.4.4.18
392// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
393
394// Check failure of by-index access of string characters (IE < 9)
395// and failure of `0 in boxedString` (Rhino)
396var boxedString = $Object('a');
397var splitString = boxedString[0] !== 'a' || !(0 in boxedString);
398
399var properlyBoxesContext = function properlyBoxed(method) {
400    // Check node 0.6.21 bug where third parameter is not boxed
401    var properlyBoxesNonStrict = true;
402    var properlyBoxesStrict = true;
403    var threwException = false;
404    if (method) {
405        try {
406            method.call('foo', function (_, __, context) {
407                if (typeof context !== 'object') { properlyBoxesNonStrict = false; }
408            });
409
410            method.call([1], function () {
411                'use strict';
412
413                properlyBoxesStrict = typeof this === 'string';
414            }, 'x');
415        } catch (e) {
416            threwException = true;
417        }
418    }
419    return !!method && !threwException && properlyBoxesNonStrict && properlyBoxesStrict;
420};
421
422defineProperties(ArrayPrototype, {
423    forEach: function forEach(callbackfn/*, thisArg*/) {
424        var object = ES.ToObject(this);
425        var self = splitString && isString(this) ? strSplit(this, '') : object;
426        var i = -1;
427        var length = ES.ToUint32(self.length);
428        var T;
429        if (arguments.length > 1) {
430          T = arguments[1];
431        }
432
433        // If no callback function or if callback is not a callable function
434        if (!isCallable(callbackfn)) {
435            throw new TypeError('Array.prototype.forEach callback must be a function');
436        }
437
438        while (++i < length) {
439            if (i in self) {
440                // Invoke the callback function with call, passing arguments:
441                // context, property value, property key, thisArg object
442                if (typeof T === 'undefined') {
443                    callbackfn(self[i], i, object);
444                } else {
445                    callbackfn.call(T, self[i], i, object);
446                }
447            }
448        }
449    }
450}, !properlyBoxesContext(ArrayPrototype.forEach));
451
452// ES5 15.4.4.19
453// http://es5.github.com/#x15.4.4.19
454// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
455defineProperties(ArrayPrototype, {
456    map: function map(callbackfn/*, thisArg*/) {
457        var object = ES.ToObject(this);
458        var self = splitString && isString(this) ? strSplit(this, '') : object;
459        var length = ES.ToUint32(self.length);
460        var result = $Array(length);
461        var T;
462        if (arguments.length > 1) {
463            T = arguments[1];
464        }
465
466        // If no callback function or if callback is not a callable function
467        if (!isCallable(callbackfn)) {
468            throw new TypeError('Array.prototype.map callback must be a function');
469        }
470
471        for (var i = 0; i < length; i++) {
472            if (i in self) {
473                if (typeof T === 'undefined') {
474                    result[i] = callbackfn(self[i], i, object);
475                } else {
476                    result[i] = callbackfn.call(T, self[i], i, object);
477                }
478            }
479        }
480        return result;
481    }
482}, !properlyBoxesContext(ArrayPrototype.map));
483
484// ES5 15.4.4.20
485// http://es5.github.com/#x15.4.4.20
486// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
487defineProperties(ArrayPrototype, {
488    filter: function filter(callbackfn/*, thisArg*/) {
489        var object = ES.ToObject(this);
490        var self = splitString && isString(this) ? strSplit(this, '') : object;
491        var length = ES.ToUint32(self.length);
492        var result = [];
493        var value;
494        var T;
495        if (arguments.length > 1) {
496            T = arguments[1];
497        }
498
499        // If no callback function or if callback is not a callable function
500        if (!isCallable(callbackfn)) {
501            throw new TypeError('Array.prototype.filter callback must be a function');
502        }
503
504        for (var i = 0; i < length; i++) {
505            if (i in self) {
506                value = self[i];
507                if (typeof T === 'undefined' ? callbackfn(value, i, object) : callbackfn.call(T, value, i, object)) {
508                    pushCall(result, value);
509                }
510            }
511        }
512        return result;
513    }
514}, !properlyBoxesContext(ArrayPrototype.filter));
515
516// ES5 15.4.4.16
517// http://es5.github.com/#x15.4.4.16
518// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
519defineProperties(ArrayPrototype, {
520    every: function every(callbackfn/*, thisArg*/) {
521        var object = ES.ToObject(this);
522        var self = splitString && isString(this) ? strSplit(this, '') : object;
523        var length = ES.ToUint32(self.length);
524        var T;
525        if (arguments.length > 1) {
526            T = arguments[1];
527        }
528
529        // If no callback function or if callback is not a callable function
530        if (!isCallable(callbackfn)) {
531            throw new TypeError('Array.prototype.every callback must be a function');
532        }
533
534        for (var i = 0; i < length; i++) {
535            if (i in self && !(typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) {
536                return false;
537            }
538        }
539        return true;
540    }
541}, !properlyBoxesContext(ArrayPrototype.every));
542
543// ES5 15.4.4.17
544// http://es5.github.com/#x15.4.4.17
545// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
546defineProperties(ArrayPrototype, {
547    some: function some(callbackfn/*, thisArg */) {
548        var object = ES.ToObject(this);
549        var self = splitString && isString(this) ? strSplit(this, '') : object;
550        var length = ES.ToUint32(self.length);
551        var T;
552        if (arguments.length > 1) {
553            T = arguments[1];
554        }
555
556        // If no callback function or if callback is not a callable function
557        if (!isCallable(callbackfn)) {
558            throw new TypeError('Array.prototype.some callback must be a function');
559        }
560
561        for (var i = 0; i < length; i++) {
562            if (i in self && (typeof T === 'undefined' ? callbackfn(self[i], i, object) : callbackfn.call(T, self[i], i, object))) {
563                return true;
564            }
565        }
566        return false;
567    }
568}, !properlyBoxesContext(ArrayPrototype.some));
569
570// ES5 15.4.4.21
571// http://es5.github.com/#x15.4.4.21
572// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
573var reduceCoercesToObject = false;
574if (ArrayPrototype.reduce) {
575    reduceCoercesToObject = typeof ArrayPrototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object';
576}
577defineProperties(ArrayPrototype, {
578    reduce: function reduce(callbackfn/*, initialValue*/) {
579        var object = ES.ToObject(this);
580        var self = splitString && isString(this) ? strSplit(this, '') : object;
581        var length = ES.ToUint32(self.length);
582
583        // If no callback function or if callback is not a callable function
584        if (!isCallable(callbackfn)) {
585            throw new TypeError('Array.prototype.reduce callback must be a function');
586        }
587
588        // no value to return if no initial value and an empty array
589        if (length === 0 && arguments.length === 1) {
590            throw new TypeError('reduce of empty array with no initial value');
591        }
592
593        var i = 0;
594        var result;
595        if (arguments.length >= 2) {
596            result = arguments[1];
597        } else {
598            do {
599                if (i in self) {
600                    result = self[i++];
601                    break;
602                }
603
604                // if array contains no values, no initial value to return
605                if (++i >= length) {
606                    throw new TypeError('reduce of empty array with no initial value');
607                }
608            } while (true);
609        }
610
611        for (; i < length; i++) {
612            if (i in self) {
613                result = callbackfn(result, self[i], i, object);
614            }
615        }
616
617        return result;
618    }
619}, !reduceCoercesToObject);
620
621// ES5 15.4.4.22
622// http://es5.github.com/#x15.4.4.22
623// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
624var reduceRightCoercesToObject = false;
625if (ArrayPrototype.reduceRight) {
626    reduceRightCoercesToObject = typeof ArrayPrototype.reduceRight.call('es5', function (_, __, ___, list) { return list; }) === 'object';
627}
628defineProperties(ArrayPrototype, {
629    reduceRight: function reduceRight(callbackfn/*, initial*/) {
630        var object = ES.ToObject(this);
631        var self = splitString && isString(this) ? strSplit(this, '') : object;
632        var length = ES.ToUint32(self.length);
633
634        // If no callback function or if callback is not a callable function
635        if (!isCallable(callbackfn)) {
636            throw new TypeError('Array.prototype.reduceRight callback must be a function');
637        }
638
639        // no value to return if no initial value, empty array
640        if (length === 0 && arguments.length === 1) {
641            throw new TypeError('reduceRight of empty array with no initial value');
642        }
643
644        var result;
645        var i = length - 1;
646        if (arguments.length >= 2) {
647            result = arguments[1];
648        } else {
649            do {
650                if (i in self) {
651                    result = self[i--];
652                    break;
653                }
654
655                // if array contains no values, no initial value to return
656                if (--i < 0) {
657                    throw new TypeError('reduceRight of empty array with no initial value');
658                }
659            } while (true);
660        }
661
662        if (i < 0) {
663            return result;
664        }
665
666        do {
667            if (i in self) {
668                result = callbackfn(result, self[i], i, object);
669            }
670        } while (i--);
671
672        return result;
673    }
674}, !reduceRightCoercesToObject);
675
676// ES5 15.4.4.14
677// http://es5.github.com/#x15.4.4.14
678// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
679var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1;
680defineProperties(ArrayPrototype, {
681    indexOf: function indexOf(searchElement/*, fromIndex */) {
682        var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this);
683        var length = ES.ToUint32(self.length);
684
685        if (length === 0) {
686            return -1;
687        }
688
689        var i = 0;
690        if (arguments.length > 1) {
691            i = ES.ToInteger(arguments[1]);
692        }
693
694        // handle negative indices
695        i = i >= 0 ? i : max(0, length + i);
696        for (; i < length; i++) {
697            if (i in self && self[i] === searchElement) {
698                return i;
699            }
700        }
701        return -1;
702    }
703}, hasFirefox2IndexOfBug);
704
705// ES5 15.4.4.15
706// http://es5.github.com/#x15.4.4.15
707// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
708var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1;
709defineProperties(ArrayPrototype, {
710    lastIndexOf: function lastIndexOf(searchElement/*, fromIndex */) {
711        var self = splitString && isString(this) ? strSplit(this, '') : ES.ToObject(this);
712        var length = ES.ToUint32(self.length);
713
714        if (length === 0) {
715            return -1;
716        }
717        var i = length - 1;
718        if (arguments.length > 1) {
719            i = min(i, ES.ToInteger(arguments[1]));
720        }
721        // handle negative indices
722        i = i >= 0 ? i : length - Math.abs(i);
723        for (; i >= 0; i--) {
724            if (i in self && searchElement === self[i]) {
725                return i;
726            }
727        }
728        return -1;
729    }
730}, hasFirefox2LastIndexOfBug);
731
732// ES5 15.4.4.12
733// http://es5.github.com/#x15.4.4.12
734var spliceNoopReturnsEmptyArray = (function () {
735    var a = [1, 2];
736    var result = a.splice();
737    return a.length === 2 && isArray(result) && result.length === 0;
738}());
739defineProperties(ArrayPrototype, {
740    // Safari 5.0 bug where .splice() returns undefined
741    splice: function splice(start, deleteCount) {
742        if (arguments.length === 0) {
743            return [];
744        } else {
745            return array_splice.apply(this, arguments);
746        }
747    }
748}, !spliceNoopReturnsEmptyArray);
749
750var spliceWorksWithEmptyObject = (function () {
751    var obj = {};
752    ArrayPrototype.splice.call(obj, 0, 0, 1);
753    return obj.length === 1;
754}());
755defineProperties(ArrayPrototype, {
756    splice: function splice(start, deleteCount) {
757        if (arguments.length === 0) { return []; }
758        var args = arguments;
759        this.length = max(ES.ToInteger(this.length), 0);
760        if (arguments.length > 0 && typeof deleteCount !== 'number') {
761            args = arraySlice(arguments);
762            if (args.length < 2) {
763                pushCall(args, this.length - start);
764            } else {
765                args[1] = ES.ToInteger(deleteCount);
766            }
767        }
768        return array_splice.apply(this, args);
769    }
770}, !spliceWorksWithEmptyObject);
771var spliceWorksWithLargeSparseArrays = (function () {
772    // Per https://github.com/es-shims/es5-shim/issues/295
773    // Safari 7/8 breaks with sparse arrays of size 1e5 or greater
774    var arr = new $Array(1e5);
775    // note: the index MUST be 8 or larger or the test will false pass
776    arr[8] = 'x';
777    arr.splice(1, 1);
778    // note: this test must be defined *after* the indexOf shim
779    // per https://github.com/es-shims/es5-shim/issues/313
780    return arr.indexOf('x') === 7;
781}());
782var spliceWorksWithSmallSparseArrays = (function () {
783    // Per https://github.com/es-shims/es5-shim/issues/295
784    // Opera 12.15 breaks on this, no idea why.
785    var n = 256;
786    var arr = [];
787    arr[n] = 'a';
788    arr.splice(n + 1, 0, 'b');
789    return arr[n] === 'a';
790}());
791defineProperties(ArrayPrototype, {
792    splice: function splice(start, deleteCount) {
793        var O = ES.ToObject(this);
794        var A = [];
795        var len = ES.ToUint32(O.length);
796        var relativeStart = ES.ToInteger(start);
797        var actualStart = relativeStart < 0 ? max((len + relativeStart), 0) : min(relativeStart, len);
798        var actualDeleteCount = min(max(ES.ToInteger(deleteCount), 0), len - actualStart);
799
800        var k = 0;
801        var from;
802        while (k < actualDeleteCount) {
803            from = $String(actualStart + k);
804            if (owns(O, from)) {
805                A[k] = O[from];
806            }
807            k += 1;
808        }
809
810        var items = arraySlice(arguments, 2);
811        var itemCount = items.length;
812        var to;
813        if (itemCount < actualDeleteCount) {
814            k = actualStart;
815            while (k < (len - actualDeleteCount)) {
816                from = $String(k + actualDeleteCount);
817                to = $String(k + itemCount);
818                if (owns(O, from)) {
819                    O[to] = O[from];
820                } else {
821                    delete O[to];
822                }
823                k += 1;
824            }
825            k = len;
826            while (k > (len - actualDeleteCount + itemCount)) {
827                delete O[k - 1];
828                k -= 1;
829            }
830        } else if (itemCount > actualDeleteCount) {
831            k = len - actualDeleteCount;
832            while (k > actualStart) {
833                from = $String(k + actualDeleteCount - 1);
834                to = $String(k + itemCount - 1);
835                if (owns(O, from)) {
836                    O[to] = O[from];
837                } else {
838                    delete O[to];
839                }
840                k -= 1;
841            }
842        }
843        k = actualStart;
844        for (var i = 0; i < items.length; ++i) {
845            O[k] = items[i];
846            k += 1;
847        }
848        O.length = len - actualDeleteCount + itemCount;
849
850        return A;
851    }
852}, !spliceWorksWithLargeSparseArrays || !spliceWorksWithSmallSparseArrays);
853
854var originalJoin = ArrayPrototype.join;
855var hasStringJoinBug;
856try {
857    hasStringJoinBug = Array.prototype.join.call('123', ',') !== '1,2,3';
858} catch (e) {
859    hasStringJoinBug = true;
860}
861if (hasStringJoinBug) {
862    defineProperties(ArrayPrototype, {
863        join: function join(separator) {
864            var sep = typeof separator === 'undefined' ? ',' : separator;
865            return originalJoin.call(isString(this) ? strSplit(this, '') : this, sep);
866        }
867    }, hasStringJoinBug);
868}
869
870var hasJoinUndefinedBug = [1, 2].join(undefined) !== '1,2';
871if (hasJoinUndefinedBug) {
872    defineProperties(ArrayPrototype, {
873        join: function join(separator) {
874            var sep = typeof separator === 'undefined' ? ',' : separator;
875            return originalJoin.call(this, sep);
876        }
877    }, hasJoinUndefinedBug);
878}
879
880var pushShim = function push(item) {
881    var O = ES.ToObject(this);
882    var n = ES.ToUint32(O.length);
883    var i = 0;
884    while (i < arguments.length) {
885        O[n + i] = arguments[i];
886        i += 1;
887    }
888    O.length = n + i;
889    return n + i;
890};
891
892var pushIsNotGeneric = (function () {
893    var obj = {};
894    var result = Array.prototype.push.call(obj, undefined);
895    return result !== 1 || obj.length !== 1 || typeof obj[0] !== 'undefined' || !owns(obj, 0);
896}());
897defineProperties(ArrayPrototype, {
898    push: function push(item) {
899        if (isArray(this)) {
900            return array_push.apply(this, arguments);
901        }
902        return pushShim.apply(this, arguments);
903    }
904}, pushIsNotGeneric);
905
906// This fixes a very weird bug in Opera 10.6 when pushing `undefined
907var pushUndefinedIsWeird = (function () {
908    var arr = [];
909    var result = arr.push(undefined);
910    return result !== 1 || arr.length !== 1 || typeof arr[0] !== 'undefined' || !owns(arr, 0);
911}());
912defineProperties(ArrayPrototype, { push: pushShim }, pushUndefinedIsWeird);
913
914// ES5 15.2.3.14
915// http://es5.github.io/#x15.4.4.10
916// Fix boxed string bug
917defineProperties(ArrayPrototype, {
918    slice: function (start, end) {
919        var arr = isString(this) ? strSplit(this, '') : this;
920        return arraySliceApply(arr, arguments);
921    }
922}, splitString);
923
924var sortIgnoresNonFunctions = (function () {
925    try {
926        [1, 2].sort(null);
927        [1, 2].sort({});
928        return true;
929    } catch (e) { /**/ }
930    return false;
931}());
932var sortThrowsOnRegex = (function () {
933    // this is a problem in Firefox 4, in which `typeof /a/ === 'function'`
934    try {
935        [1, 2].sort(/a/);
936        return false;
937    } catch (e) { /**/ }
938    return true;
939}());
940var sortIgnoresUndefined = (function () {
941    // applies in IE 8, for one.
942    try {
943        [1, 2].sort(undefined);
944        return true;
945    } catch (e) { /**/ }
946    return false;
947}());
948defineProperties(ArrayPrototype, {
949    sort: function sort(compareFn) {
950        if (typeof compareFn === 'undefined') {
951            return arraySort(this);
952        }
953        if (!isCallable(compareFn)) {
954            throw new TypeError('Array.prototype.sort callback must be a function');
955        }
956        return arraySort(this, compareFn);
957    }
958}, sortIgnoresNonFunctions || !sortIgnoresUndefined || !sortThrowsOnRegex);
959
960//
961// Object
962// ======
963//
964
965// ES5 15.2.3.14
966// http://es5.github.com/#x15.2.3.14
967
968// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
969var hasDontEnumBug = !({ 'toString': null }).propertyIsEnumerable('toString');
970var hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype');
971var hasStringEnumBug = !owns('x', '0');
972var equalsConstructorPrototype = function (o) {
973    var ctor = o.constructor;
974    return ctor && ctor.prototype === o;
975};
976var blacklistedKeys = {
977    $window: true,
978    $console: true,
979    $parent: true,
980    $self: true,
981    $frame: true,
982    $frames: true,
983    $frameElement: true,
984    $webkitIndexedDB: true,
985    $webkitStorageInfo: true,
986    $external: true
987};
988var hasAutomationEqualityBug = (function () {
989    /* globals window */
990    if (typeof window === 'undefined') { return false; }
991    for (var k in window) {
992        try {
993            if (!blacklistedKeys['$' + k] && owns(window, k) && window[k] !== null && typeof window[k] === 'object') {
994                equalsConstructorPrototype(window[k]);
995            }
996        } catch (e) {
997            return true;
998        }
999    }
1000    return false;
1001}());
1002var equalsConstructorPrototypeIfNotBuggy = function (object) {
1003    if (typeof window === 'undefined' || !hasAutomationEqualityBug) { return equalsConstructorPrototype(object); }
1004    try {
1005        return equalsConstructorPrototype(object);
1006    } catch (e) {
1007        return false;
1008    }
1009};
1010var dontEnums = [
1011    'toString',
1012    'toLocaleString',
1013    'valueOf',
1014    'hasOwnProperty',
1015    'isPrototypeOf',
1016    'propertyIsEnumerable',
1017    'constructor'
1018];
1019var dontEnumsLength = dontEnums.length;
1020
1021// taken directly from https://github.com/ljharb/is-arguments/blob/master/index.js
1022// can be replaced with require('is-arguments') if we ever use a build process instead
1023var isStandardArguments = function isArguments(value) {
1024    return toStr(value) === '[object Arguments]';
1025};
1026var isLegacyArguments = function isArguments(value) {
1027    return value !== null &&
1028        typeof value === 'object' &&
1029        typeof value.length === 'number' &&
1030        value.length >= 0 &&
1031        !isArray(value) &&
1032        isCallable(value.callee);
1033};
1034var isArguments = isStandardArguments(arguments) ? isStandardArguments : isLegacyArguments;
1035
1036defineProperties($Object, {
1037    keys: function keys(object) {
1038        var isFn = isCallable(object);
1039        var isArgs = isArguments(object);
1040        var isObject = object !== null && typeof object === 'object';
1041        var isStr = isObject && isString(object);
1042
1043        if (!isObject && !isFn && !isArgs) {
1044            throw new TypeError('Object.keys called on a non-object');
1045        }
1046
1047        var theKeys = [];
1048        var skipProto = hasProtoEnumBug && isFn;
1049        if ((isStr && hasStringEnumBug) || isArgs) {
1050            for (var i = 0; i < object.length; ++i) {
1051                pushCall(theKeys, $String(i));
1052            }
1053        }
1054
1055        if (!isArgs) {
1056            for (var name in object) {
1057                if (!(skipProto && name === 'prototype') && owns(object, name)) {
1058                    pushCall(theKeys, $String(name));
1059                }
1060            }
1061        }
1062
1063        if (hasDontEnumBug) {
1064            var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
1065            for (var j = 0; j < dontEnumsLength; j++) {
1066                var dontEnum = dontEnums[j];
1067                if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) {
1068                    pushCall(theKeys, dontEnum);
1069                }
1070            }
1071        }
1072        return theKeys;
1073    }
1074});
1075
1076var keysWorksWithArguments = $Object.keys && (function () {
1077    // Safari 5.0 bug
1078    return $Object.keys(arguments).length === 2;
1079}(1, 2));
1080var keysHasArgumentsLengthBug = $Object.keys && (function () {
1081    var argKeys = $Object.keys(arguments);
1082    return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1;
1083}(1));
1084var originalKeys = $Object.keys;
1085defineProperties($Object, {
1086    keys: function keys(object) {
1087        if (isArguments(object)) {
1088            return originalKeys(arraySlice(object));
1089        } else {
1090            return originalKeys(object);
1091        }
1092    }
1093}, !keysWorksWithArguments || keysHasArgumentsLengthBug);
1094
1095//
1096// Date
1097// ====
1098//
1099
1100var hasNegativeMonthYearBug = new Date(-3509827329600292).getUTCMonth() !== 0;
1101var aNegativeTestDate = new Date(-1509842289600292);
1102var aPositiveTestDate = new Date(1449662400000);
1103var hasToUTCStringFormatBug = aNegativeTestDate.toUTCString() !== 'Mon, 01 Jan -45875 11:59:59 GMT';
1104var hasToDateStringFormatBug;
1105var hasToStringFormatBug;
1106var timeZoneOffset = aNegativeTestDate.getTimezoneOffset();
1107if (timeZoneOffset < -720) {
1108    hasToDateStringFormatBug = aNegativeTestDate.toDateString() !== 'Tue Jan 02 -45875';
1109    hasToStringFormatBug = !(/^Thu Dec 10 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/).test(aPositiveTestDate.toString());
1110} else {
1111    hasToDateStringFormatBug = aNegativeTestDate.toDateString() !== 'Mon Jan 01 -45875';
1112    hasToStringFormatBug = !(/^Wed Dec 09 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/).test(aPositiveTestDate.toString());
1113}
1114
1115var originalGetFullYear = call.bind(Date.prototype.getFullYear);
1116var originalGetMonth = call.bind(Date.prototype.getMonth);
1117var originalGetDate = call.bind(Date.prototype.getDate);
1118var originalGetUTCFullYear = call.bind(Date.prototype.getUTCFullYear);
1119var originalGetUTCMonth = call.bind(Date.prototype.getUTCMonth);
1120var originalGetUTCDate = call.bind(Date.prototype.getUTCDate);
1121var originalGetUTCDay = call.bind(Date.prototype.getUTCDay);
1122var originalGetUTCHours = call.bind(Date.prototype.getUTCHours);
1123var originalGetUTCMinutes = call.bind(Date.prototype.getUTCMinutes);
1124var originalGetUTCSeconds = call.bind(Date.prototype.getUTCSeconds);
1125var originalGetUTCMilliseconds = call.bind(Date.prototype.getUTCMilliseconds);
1126var dayName = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
1127var monthName = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
1128var daysInMonth = function daysInMonth(month, year) {
1129    return originalGetDate(new Date(year, month, 0));
1130};
1131
1132defineProperties(Date.prototype, {
1133    getFullYear: function getFullYear() {
1134        if (!this || !(this instanceof Date)) {
1135            throw new TypeError('this is not a Date object.');
1136        }
1137        var year = originalGetFullYear(this);
1138        if (year < 0 && originalGetMonth(this) > 11) {
1139            return year + 1;
1140        }
1141        return year;
1142    },
1143    getMonth: function getMonth() {
1144        if (!this || !(this instanceof Date)) {
1145            throw new TypeError('this is not a Date object.');
1146        }
1147        var year = originalGetFullYear(this);
1148        var month = originalGetMonth(this);
1149        if (year < 0 && month > 11) {
1150            return 0;
1151        }
1152        return month;
1153    },
1154    getDate: function getDate() {
1155        if (!this || !(this instanceof Date)) {
1156            throw new TypeError('this is not a Date object.');
1157        }
1158        var year = originalGetFullYear(this);
1159        var month = originalGetMonth(this);
1160        var date = originalGetDate(this);
1161        if (year < 0 && month > 11) {
1162            if (month === 12) {
1163                return date;
1164            }
1165            var days = daysInMonth(0, year + 1);
1166            return (days - date) + 1;
1167        }
1168        return date;
1169    },
1170    getUTCFullYear: function getUTCFullYear() {
1171        if (!this || !(this instanceof Date)) {
1172            throw new TypeError('this is not a Date object.');
1173        }
1174        var year = originalGetUTCFullYear(this);
1175        if (year < 0 && originalGetUTCMonth(this) > 11) {
1176            return year + 1;
1177        }
1178        return year;
1179    },
1180    getUTCMonth: function getUTCMonth() {
1181        if (!this || !(this instanceof Date)) {
1182            throw new TypeError('this is not a Date object.');
1183        }
1184        var year = originalGetUTCFullYear(this);
1185        var month = originalGetUTCMonth(this);
1186        if (year < 0 && month > 11) {
1187            return 0;
1188        }
1189        return month;
1190    },
1191    getUTCDate: function getUTCDate() {
1192        if (!this || !(this instanceof Date)) {
1193            throw new TypeError('this is not a Date object.');
1194        }
1195        var year = originalGetUTCFullYear(this);
1196        var month = originalGetUTCMonth(this);
1197        var date = originalGetUTCDate(this);
1198        if (year < 0 && month > 11) {
1199            if (month === 12) {
1200                return date;
1201            }
1202            var days = daysInMonth(0, year + 1);
1203            return (days - date) + 1;
1204        }
1205        return date;
1206    }
1207}, hasNegativeMonthYearBug);
1208
1209defineProperties(Date.prototype, {
1210    toUTCString: function toUTCString() {
1211        if (!this || !(this instanceof Date)) {
1212            throw new TypeError('this is not a Date object.');
1213        }
1214        var day = originalGetUTCDay(this);
1215        var date = originalGetUTCDate(this);
1216        var month = originalGetUTCMonth(this);
1217        var year = originalGetUTCFullYear(this);
1218        var hour = originalGetUTCHours(this);
1219        var minute = originalGetUTCMinutes(this);
1220        var second = originalGetUTCSeconds(this);
1221        return dayName[day] + ', ' +
1222            (date < 10 ? '0' + date : date) + ' ' +
1223            monthName[month] + ' ' +
1224            year + ' ' +
1225            (hour < 10 ? '0' + hour : hour) + ':' +
1226            (minute < 10 ? '0' + minute : minute) + ':' +
1227            (second < 10 ? '0' + second : second) + ' GMT';
1228    }
1229}, hasNegativeMonthYearBug || hasToUTCStringFormatBug);
1230
1231// Opera 12 has `,`
1232defineProperties(Date.prototype, {
1233    toDateString: function toDateString() {
1234        if (!this || !(this instanceof Date)) {
1235            throw new TypeError('this is not a Date object.');
1236        }
1237        var day = this.getDay();
1238        var date = this.getDate();
1239        var month = this.getMonth();
1240        var year = this.getFullYear();
1241        return dayName[day] + ' ' +
1242            monthName[month] + ' ' +
1243            (date < 10 ? '0' + date : date) + ' ' +
1244            year;
1245    }
1246}, hasNegativeMonthYearBug || hasToDateStringFormatBug);
1247
1248// can't use defineProperties here because of toString enumeration issue in IE <= 8
1249if (hasNegativeMonthYearBug || hasToStringFormatBug) {
1250    Date.prototype.toString = function toString() {
1251        if (!this || !(this instanceof Date)) {
1252            throw new TypeError('this is not a Date object.');
1253        }
1254        var day = this.getDay();
1255        var date = this.getDate();
1256        var month = this.getMonth();
1257        var year = this.getFullYear();
1258        var hour = this.getHours();
1259        var minute = this.getMinutes();
1260        var second = this.getSeconds();
1261        var timezoneOffset = this.getTimezoneOffset();
1262        var hoursOffset = Math.floor(Math.abs(timezoneOffset) / 60);
1263        var minutesOffset = Math.floor(Math.abs(timezoneOffset) % 60);
1264        return dayName[day] + ' ' +
1265            monthName[month] + ' ' +
1266            (date < 10 ? '0' + date : date) + ' ' +
1267            year + ' ' +
1268            (hour < 10 ? '0' + hour : hour) + ':' +
1269            (minute < 10 ? '0' + minute : minute) + ':' +
1270            (second < 10 ? '0' + second : second) + ' GMT' +
1271            (timezoneOffset > 0 ? '-' : '+') +
1272            (hoursOffset < 10 ? '0' + hoursOffset : hoursOffset) +
1273            (minutesOffset < 10 ? '0' + minutesOffset : minutesOffset);
1274    };
1275    if (supportsDescriptors) {
1276        $Object.defineProperty(Date.prototype, 'toString', {
1277            configurable: true,
1278            enumerable: false,
1279            writable: true
1280        });
1281    }
1282}
1283
1284// ES5 15.9.5.43
1285// http://es5.github.com/#x15.9.5.43
1286// This function returns a String value represent the instance in time
1287// represented by this Date object. The format of the String is the Date Time
1288// string format defined in 15.9.1.15. All fields are present in the String.
1289// The time zone is always UTC, denoted by the suffix Z. If the time value of
1290// this object is not a finite Number a RangeError exception is thrown.
1291var negativeDate = -62198755200000;
1292var negativeYearString = '-000001';
1293var hasNegativeDateBug = Date.prototype.toISOString && new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1;
1294var hasSafari51DateBug = Date.prototype.toISOString && new Date(-1).toISOString() !== '1969-12-31T23:59:59.999Z';
1295
1296defineProperties(Date.prototype, {
1297    toISOString: function toISOString() {
1298        if (!isFinite(this)) {
1299            throw new RangeError('Date.prototype.toISOString called on non-finite value.');
1300        }
1301
1302        var year = originalGetUTCFullYear(this);
1303
1304        var month = originalGetUTCMonth(this);
1305        // see https://github.com/es-shims/es5-shim/issues/111
1306        year += Math.floor(month / 12);
1307        month = (month % 12 + 12) % 12;
1308
1309        // the date time string format is specified in 15.9.1.15.
1310        var result = [month + 1, originalGetUTCDate(this), originalGetUTCHours(this), originalGetUTCMinutes(this), originalGetUTCSeconds(this)];
1311        year = (
1312            (year < 0 ? '-' : (year > 9999 ? '+' : '')) +
1313            strSlice('00000' + Math.abs(year), (0 <= year && year <= 9999) ? -4 : -6)
1314        );
1315
1316        for (var i = 0; i < result.length; ++i) {
1317          // pad months, days, hours, minutes, and seconds to have two digits.
1318          result[i] = strSlice('00' + result[i], -2);
1319        }
1320        // pad milliseconds to have three digits.
1321        return (
1322            year + '-' + arraySlice(result, 0, 2).join('-') +
1323            'T' + arraySlice(result, 2).join(':') + '.' +
1324            strSlice('000' + originalGetUTCMilliseconds(this), -3) + 'Z'
1325        );
1326    }
1327}, hasNegativeDateBug || hasSafari51DateBug);
1328
1329// ES5 15.9.5.44
1330// http://es5.github.com/#x15.9.5.44
1331// This function provides a String representation of a Date object for use by
1332// JSON.stringify (15.12.3).
1333var dateToJSONIsSupported = (function () {
1334    try {
1335        return Date.prototype.toJSON &&
1336            new Date(NaN).toJSON() === null &&
1337            new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 &&
1338            Date.prototype.toJSON.call({ // generic
1339                toISOString: function () { return true; }
1340            });
1341    } catch (e) {
1342        return false;
1343    }
1344}());
1345if (!dateToJSONIsSupported) {
1346    Date.prototype.toJSON = function toJSON(key) {
1347        // When the toJSON method is called with argument key, the following
1348        // steps are taken:
1349
1350        // 1.  Let O be the result of calling ToObject, giving it the this
1351        // value as its argument.
1352        // 2. Let tv be ES.ToPrimitive(O, hint Number).
1353        var O = $Object(this);
1354        var tv = ES.ToPrimitive(O);
1355        // 3. If tv is a Number and is not finite, return null.
1356        if (typeof tv === 'number' && !isFinite(tv)) {
1357            return null;
1358        }
1359        // 4. Let toISO be the result of calling the [[Get]] internal method of
1360        // O with argument "toISOString".
1361        var toISO = O.toISOString;
1362        // 5. If IsCallable(toISO) is false, throw a TypeError exception.
1363        if (!isCallable(toISO)) {
1364            throw new TypeError('toISOString property is not callable');
1365        }
1366        // 6. Return the result of calling the [[Call]] internal method of
1367        //  toISO with O as the this value and an empty argument list.
1368        return toISO.call(O);
1369
1370        // NOTE 1 The argument is ignored.
1371
1372        // NOTE 2 The toJSON function is intentionally generic; it does not
1373        // require that its this value be a Date object. Therefore, it can be
1374        // transferred to other kinds of objects for use as a method. However,
1375        // it does require that any such object have a toISOString method. An
1376        // object is free to use the argument key to filter its
1377        // stringification.
1378    };
1379}
1380
1381// ES5 15.9.4.2
1382// http://es5.github.com/#x15.9.4.2
1383// based on work shared by Daniel Friesen (dantman)
1384// http://gist.github.com/303249
1385var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15;
1386var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z'));
1387var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z'));
1388if (doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) {
1389    // XXX global assignment won't work in embeddings that use
1390    // an alternate object for the context.
1391    /* global Date: true */
1392    /* eslint-disable no-undef */
1393    var maxSafeUnsigned32Bit = Math.pow(2, 31) - 1;
1394    var hasSafariSignedIntBug = isActualNaN(new Date(1970, 0, 1, 0, 0, 0, maxSafeUnsigned32Bit + 1).getTime());
1395    Date = (function (NativeDate) {
1396    /* eslint-enable no-undef */
1397        // Date.length === 7
1398        var DateShim = function Date(Y, M, D, h, m, s, ms) {
1399            var length = arguments.length;
1400            var date;
1401            if (this instanceof NativeDate) {
1402                var seconds = s;
1403                var millis = ms;
1404                if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) {
1405                    // work around a Safari 8/9 bug where it treats the seconds as signed
1406                    var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
1407                    var sToShift = Math.floor(msToShift / 1e3);
1408                    seconds += sToShift;
1409                    millis -= sToShift * 1e3;
1410                }
1411                date = length === 1 && $String(Y) === Y ? // isString(Y)
1412                    // We explicitly pass it through parse:
1413                    new NativeDate(DateShim.parse(Y)) :
1414                    // We have to manually make calls depending on argument
1415                    // length here
1416                    length >= 7 ? new NativeDate(Y, M, D, h, m, seconds, millis) :
1417                    length >= 6 ? new NativeDate(Y, M, D, h, m, seconds) :
1418                    length >= 5 ? new NativeDate(Y, M, D, h, m) :
1419                    length >= 4 ? new NativeDate(Y, M, D, h) :
1420                    length >= 3 ? new NativeDate(Y, M, D) :
1421                    length >= 2 ? new NativeDate(Y, M) :
1422                    length >= 1 ? new NativeDate(Y) :
1423                                  new NativeDate();
1424            } else {
1425                date = NativeDate.apply(this, arguments);
1426            }
1427            if (!isPrimitive(date)) {
1428              // Prevent mixups with unfixed Date object
1429              defineProperties(date, { constructor: DateShim }, true);
1430            }
1431            return date;
1432        };
1433
1434        // 15.9.1.15 Date Time String Format.
1435        var isoDateExpression = new RegExp('^' +
1436            '(\\d{4}|[+-]\\d{6})' + // four-digit year capture or sign +
1437                                      // 6-digit extended year
1438            '(?:-(\\d{2})' + // optional month capture
1439            '(?:-(\\d{2})' + // optional day capture
1440            '(?:' + // capture hours:minutes:seconds.milliseconds
1441                'T(\\d{2})' + // hours capture
1442                ':(\\d{2})' + // minutes capture
1443                '(?:' + // optional :seconds.milliseconds
1444                    ':(\\d{2})' + // seconds capture
1445                    '(?:(\\.\\d{1,}))?' + // milliseconds capture
1446                ')?' +
1447            '(' + // capture UTC offset component
1448                'Z|' + // UTC capture
1449                '(?:' + // offset specifier +/-hours:minutes
1450                    '([-+])' + // sign capture
1451                    '(\\d{2})' + // hours offset capture
1452                    ':(\\d{2})' + // minutes offset capture
1453                ')' +
1454            ')?)?)?)?' +
1455        '$');
1456
1457        var months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];
1458
1459        var dayFromMonth = function dayFromMonth(year, month) {
1460            var t = month > 1 ? 1 : 0;
1461            return (
1462                months[month] +
1463                Math.floor((year - 1969 + t) / 4) -
1464                Math.floor((year - 1901 + t) / 100) +
1465                Math.floor((year - 1601 + t) / 400) +
1466                365 * (year - 1970)
1467            );
1468        };
1469
1470        var toUTC = function toUTC(t) {
1471            var s = 0;
1472            var ms = t;
1473            if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) {
1474                // work around a Safari 8/9 bug where it treats the seconds as signed
1475                var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
1476                var sToShift = Math.floor(msToShift / 1e3);
1477                s += sToShift;
1478                ms -= sToShift * 1e3;
1479            }
1480            return $Number(new NativeDate(1970, 0, 1, 0, 0, s, ms));
1481        };
1482
1483        // Copy any custom methods a 3rd party library may have added
1484        for (var key in NativeDate) {
1485            if (owns(NativeDate, key)) {
1486                DateShim[key] = NativeDate[key];
1487            }
1488        }
1489
1490        // Copy "native" methods explicitly; they may be non-enumerable
1491        defineProperties(DateShim, {
1492            now: NativeDate.now,
1493            UTC: NativeDate.UTC
1494        }, true);
1495        DateShim.prototype = NativeDate.prototype;
1496        defineProperties(DateShim.prototype, {
1497            constructor: DateShim
1498        }, true);
1499
1500        // Upgrade Date.parse to handle simplified ISO 8601 strings
1501        var parseShim = function parse(string) {
1502            var match = isoDateExpression.exec(string);
1503            if (match) {
1504                // parse months, days, hours, minutes, seconds, and milliseconds
1505                // provide default values if necessary
1506                // parse the UTC offset component
1507                var year = $Number(match[1]),
1508                    month = $Number(match[2] || 1) - 1,
1509                    day = $Number(match[3] || 1) - 1,
1510                    hour = $Number(match[4] || 0),
1511                    minute = $Number(match[5] || 0),
1512                    second = $Number(match[6] || 0),
1513                    millisecond = Math.floor($Number(match[7] || 0) * 1000),
1514                    // When time zone is missed, local offset should be used
1515                    // (ES 5.1 bug)
1516                    // see https://bugs.ecmascript.org/show_bug.cgi?id=112
1517                    isLocalTime = Boolean(match[4] && !match[8]),
1518                    signOffset = match[9] === '-' ? 1 : -1,
1519                    hourOffset = $Number(match[10] || 0),
1520                    minuteOffset = $Number(match[11] || 0),
1521                    result;
1522                var hasMinutesOrSecondsOrMilliseconds = minute > 0 || second > 0 || millisecond > 0;
1523                if (
1524                    hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) &&
1525                    minute < 60 && second < 60 && millisecond < 1000 &&
1526                    month > -1 && month < 12 && hourOffset < 24 &&
1527                    minuteOffset < 60 && // detect invalid offsets
1528                    day > -1 &&
1529                    day < (dayFromMonth(year, month + 1) - dayFromMonth(year, month))
1530                ) {
1531                    result = (
1532                        (dayFromMonth(year, month) + day) * 24 +
1533                        hour +
1534                        hourOffset * signOffset
1535                    ) * 60;
1536                    result = (
1537                        (result + minute + minuteOffset * signOffset) * 60 +
1538                        second
1539                    ) * 1000 + millisecond;
1540                    if (isLocalTime) {
1541                        result = toUTC(result);
1542                    }
1543                    if (-8.64e15 <= result && result <= 8.64e15) {
1544                        return result;
1545                    }
1546                }
1547                return NaN;
1548            }
1549            return NativeDate.parse.apply(this, arguments);
1550        };
1551        defineProperties(DateShim, { parse: parseShim });
1552
1553        return DateShim;
1554    }(Date));
1555    /* global Date: false */
1556}
1557
1558// ES5 15.9.4.4
1559// http://es5.github.com/#x15.9.4.4
1560if (!Date.now) {
1561    Date.now = function now() {
1562        return new Date().getTime();
1563    };
1564}
1565
1566//
1567// Number
1568// ======
1569//
1570
1571// ES5.1 15.7.4.5
1572// http://es5.github.com/#x15.7.4.5
1573var hasToFixedBugs = NumberPrototype.toFixed && (
1574  (0.00008).toFixed(3) !== '0.000' ||
1575  (0.9).toFixed(0) !== '1' ||
1576  (1.255).toFixed(2) !== '1.25' ||
1577  (1000000000000000128).toFixed(0) !== '1000000000000000128'
1578);
1579
1580var toFixedHelpers = {
1581  base: 1e7,
1582  size: 6,
1583  data: [0, 0, 0, 0, 0, 0],
1584  multiply: function multiply(n, c) {
1585      var i = -1;
1586      var c2 = c;
1587      while (++i < toFixedHelpers.size) {
1588          c2 += n * toFixedHelpers.data[i];
1589          toFixedHelpers.data[i] = c2 % toFixedHelpers.base;
1590          c2 = Math.floor(c2 / toFixedHelpers.base);
1591      }
1592  },
1593  divide: function divide(n) {
1594      var i = toFixedHelpers.size, c = 0;
1595      while (--i >= 0) {
1596          c += toFixedHelpers.data[i];
1597          toFixedHelpers.data[i] = Math.floor(c / n);
1598          c = (c % n) * toFixedHelpers.base;
1599      }
1600  },
1601  numToString: function numToString() {
1602      var i = toFixedHelpers.size;
1603      var s = '';
1604      while (--i >= 0) {
1605          if (s !== '' || i === 0 || toFixedHelpers.data[i] !== 0) {
1606              var t = $String(toFixedHelpers.data[i]);
1607              if (s === '') {
1608                  s = t;
1609              } else {
1610                  s += strSlice('0000000', 0, 7 - t.length) + t;
1611              }
1612          }
1613      }
1614      return s;
1615  },
1616  pow: function pow(x, n, acc) {
1617      return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc)));
1618  },
1619  log: function log(x) {
1620      var n = 0;
1621      var x2 = x;
1622      while (x2 >= 4096) {
1623          n += 12;
1624          x2 /= 4096;
1625      }
1626      while (x2 >= 2) {
1627          n += 1;
1628          x2 /= 2;
1629      }
1630      return n;
1631  }
1632};
1633
1634var toFixedShim = function toFixed(fractionDigits) {
1635    var f, x, s, m, e, z, j, k;
1636
1637    // Test for NaN and round fractionDigits down
1638    f = $Number(fractionDigits);
1639    f = isActualNaN(f) ? 0 : Math.floor(f);
1640
1641    if (f < 0 || f > 20) {
1642        throw new RangeError('Number.toFixed called with invalid number of decimals');
1643    }
1644
1645    x = $Number(this);
1646
1647    if (isActualNaN(x)) {
1648        return 'NaN';
1649    }
1650
1651    // If it is too big or small, return the string value of the number
1652    if (x <= -1e21 || x >= 1e21) {
1653        return $String(x);
1654    }
1655
1656    s = '';
1657
1658    if (x < 0) {
1659        s = '-';
1660        x = -x;
1661    }
1662
1663    m = '0';
1664
1665    if (x > 1e-21) {
1666        // 1e-21 < x < 1e21
1667        // -70 < log2(x) < 70
1668        e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69;
1669        z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1));
1670        z *= 0x10000000000000; // Math.pow(2, 52);
1671        e = 52 - e;
1672
1673        // -18 < e < 122
1674        // x = z / 2 ^ e
1675        if (e > 0) {
1676            toFixedHelpers.multiply(0, z);
1677            j = f;
1678
1679            while (j >= 7) {
1680                toFixedHelpers.multiply(1e7, 0);
1681                j -= 7;
1682            }
1683
1684            toFixedHelpers.multiply(toFixedHelpers.pow(10, j, 1), 0);
1685            j = e - 1;
1686
1687            while (j >= 23) {
1688                toFixedHelpers.divide(1 << 23);
1689                j -= 23;
1690            }
1691
1692            toFixedHelpers.divide(1 << j);
1693            toFixedHelpers.multiply(1, 1);
1694            toFixedHelpers.divide(2);
1695            m = toFixedHelpers.numToString();
1696        } else {
1697            toFixedHelpers.multiply(0, z);
1698            toFixedHelpers.multiply(1 << (-e), 0);
1699            m = toFixedHelpers.numToString() + strSlice('0.00000000000000000000', 2, 2 + f);
1700        }
1701    }
1702
1703    if (f > 0) {
1704        k = m.length;
1705
1706        if (k <= f) {
1707            m = s + strSlice('0.0000000000000000000', 0, f - k + 2) + m;
1708        } else {
1709            m = s + strSlice(m, 0, k - f) + '.' + strSlice(m, k - f);
1710        }
1711    } else {
1712        m = s + m;
1713    }
1714
1715    return m;
1716};
1717defineProperties(NumberPrototype, { toFixed: toFixedShim }, hasToFixedBugs);
1718
1719var hasToPrecisionUndefinedBug = (function () {
1720    try {
1721        return 1.0.toPrecision(undefined) === '1';
1722    } catch (e) {
1723        return true;
1724    }
1725}());
1726var originalToPrecision = NumberPrototype.toPrecision;
1727defineProperties(NumberPrototype, {
1728    toPrecision: function toPrecision(precision) {
1729        return typeof precision === 'undefined' ? originalToPrecision.call(this) : originalToPrecision.call(this, precision);
1730    }
1731}, hasToPrecisionUndefinedBug);
1732
1733//
1734// String
1735// ======
1736//
1737
1738// ES5 15.5.4.14
1739// http://es5.github.com/#x15.5.4.14
1740
1741// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
1742// Many browsers do not split properly with regular expressions or they
1743// do not perform the split correctly under obscure conditions.
1744// See http://blog.stevenlevithan.com/archives/cross-browser-split
1745// I've tested in many browsers and this seems to cover the deviant ones:
1746//    'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
1747//    '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
1748//    'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
1749//       [undefined, "t", undefined, "e", ...]
1750//    ''.split(/.?/) should be [], not [""]
1751//    '.'.split(/()()/) should be ["."], not ["", "", "."]
1752
1753if (
1754    'ab'.split(/(?:ab)*/).length !== 2 ||
1755    '.'.split(/(.?)(.?)/).length !== 4 ||
1756    'tesst'.split(/(s)*/)[1] === 't' ||
1757    'test'.split(/(?:)/, -1).length !== 4 ||
1758    ''.split(/.?/).length ||
1759    '.'.split(/()()/).length > 1
1760) {
1761    (function () {
1762        var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group
1763        var maxSafe32BitInt = Math.pow(2, 32) - 1;
1764
1765        StringPrototype.split = function (separator, limit) {
1766            var string = String(this);
1767            if (typeof separator === 'undefined' && limit === 0) {
1768                return [];
1769            }
1770
1771            // If `separator` is not a regex, use native split
1772            if (!isRegex(separator)) {
1773                return strSplit(this, separator, limit);
1774            }
1775
1776            var output = [];
1777            var flags = (separator.ignoreCase ? 'i' : '') +
1778                        (separator.multiline ? 'm' : '') +
1779                        (separator.unicode ? 'u' : '') + // in ES6
1780                        (separator.sticky ? 'y' : ''), // Firefox 3+ and ES6
1781                lastLastIndex = 0,
1782                // Make `global` and avoid `lastIndex` issues by working with a copy
1783                separator2, match, lastIndex, lastLength;
1784            var separatorCopy = new RegExp(separator.source, flags + 'g');
1785            if (!compliantExecNpcg) {
1786                // Doesn't need flags gy, but they don't hurt
1787                separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags);
1788            }
1789            /* Values for `limit`, per the spec:
1790             * If undefined: 4294967295 // maxSafe32BitInt
1791             * If 0, Infinity, or NaN: 0
1792             * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
1793             * If negative number: 4294967296 - Math.floor(Math.abs(limit))
1794             * If other: Type-convert, then use the above rules
1795             */
1796            var splitLimit = typeof limit === 'undefined' ? maxSafe32BitInt : ES.ToUint32(limit);
1797            match = separatorCopy.exec(string);
1798            while (match) {
1799                // `separatorCopy.lastIndex` is not reliable cross-browser
1800                lastIndex = match.index + match[0].length;
1801                if (lastIndex > lastLastIndex) {
1802                    pushCall(output, strSlice(string, lastLastIndex, match.index));
1803                    // Fix browsers whose `exec` methods don't consistently return `undefined` for
1804                    // nonparticipating capturing groups
1805                    if (!compliantExecNpcg && match.length > 1) {
1806                        /* eslint-disable no-loop-func */
1807                        match[0].replace(separator2, function () {
1808                            for (var i = 1; i < arguments.length - 2; i++) {
1809                                if (typeof arguments[i] === 'undefined') {
1810                                    match[i] = void 0;
1811                                }
1812                            }
1813                        });
1814                        /* eslint-enable no-loop-func */
1815                    }
1816                    if (match.length > 1 && match.index < string.length) {
1817                        array_push.apply(output, arraySlice(match, 1));
1818                    }
1819                    lastLength = match[0].length;
1820                    lastLastIndex = lastIndex;
1821                    if (output.length >= splitLimit) {
1822                        break;
1823                    }
1824                }
1825                if (separatorCopy.lastIndex === match.index) {
1826                    separatorCopy.lastIndex++; // Avoid an infinite loop
1827                }
1828                match = separatorCopy.exec(string);
1829            }
1830            if (lastLastIndex === string.length) {
1831                if (lastLength || !separatorCopy.test('')) {
1832                    pushCall(output, '');
1833                }
1834            } else {
1835                pushCall(output, strSlice(string, lastLastIndex));
1836            }
1837            return output.length > splitLimit ? strSlice(output, 0, splitLimit) : output;
1838        };
1839    }());
1840
1841// [bugfix, chrome]
1842// If separator is undefined, then the result array contains just one String,
1843// which is the this value (converted to a String). If limit is not undefined,
1844// then the output array is truncated so that it contains no more than limit
1845// elements.
1846// "0".split(undefined, 0) -> []
1847} else if ('0'.split(void 0, 0).length) {
1848    StringPrototype.split = function split(separator, limit) {
1849        if (typeof separator === 'undefined' && limit === 0) { return []; }
1850        return strSplit(this, separator, limit);
1851    };
1852}
1853
1854var str_replace = StringPrototype.replace;
1855var replaceReportsGroupsCorrectly = (function () {
1856    var groups = [];
1857    'x'.replace(/x(.)?/g, function (match, group) {
1858        pushCall(groups, group);
1859    });
1860    return groups.length === 1 && typeof groups[0] === 'undefined';
1861}());
1862
1863if (!replaceReportsGroupsCorrectly) {
1864    StringPrototype.replace = function replace(searchValue, replaceValue) {
1865        var isFn = isCallable(replaceValue);
1866        var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source);
1867        if (!isFn || !hasCapturingGroups) {
1868            return str_replace.call(this, searchValue, replaceValue);
1869        } else {
1870            var wrappedReplaceValue = function (match) {
1871                var length = arguments.length;
1872                var originalLastIndex = searchValue.lastIndex;
1873                searchValue.lastIndex = 0;
1874                var args = searchValue.exec(match) || [];
1875                searchValue.lastIndex = originalLastIndex;
1876                pushCall(args, arguments[length - 2], arguments[length - 1]);
1877                return replaceValue.apply(this, args);
1878            };
1879            return str_replace.call(this, searchValue, wrappedReplaceValue);
1880        }
1881    };
1882}
1883
1884// ECMA-262, 3rd B.2.3
1885// Not an ECMAScript standard, although ECMAScript 3rd Edition has a
1886// non-normative section suggesting uniform semantics and it should be
1887// normalized across all browsers
1888// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
1889var string_substr = StringPrototype.substr;
1890var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b';
1891defineProperties(StringPrototype, {
1892    substr: function substr(start, length) {
1893        var normalizedStart = start;
1894        if (start < 0) {
1895            normalizedStart = max(this.length + start, 0);
1896        }
1897        return string_substr.call(this, normalizedStart, length);
1898    }
1899}, hasNegativeSubstrBug);
1900
1901// ES5 15.5.4.20
1902// whitespace from: http://es5.github.io/#x15.5.4.20
1903var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
1904    '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' +
1905    '\u2029\uFEFF';
1906var zeroWidth = '\u200b';
1907var wsRegexChars = '[' + ws + ']';
1908var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*');
1909var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$');
1910var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim());
1911defineProperties(StringPrototype, {
1912    // http://blog.stevenlevithan.com/archives/faster-trim-javascript
1913    // http://perfectionkills.com/whitespace-deviations/
1914    trim: function trim() {
1915        if (typeof this === 'undefined' || this === null) {
1916            throw new TypeError("can't convert " + this + ' to object');
1917        }
1918        return $String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
1919    }
1920}, hasTrimWhitespaceBug);
1921var trim = call.bind(String.prototype.trim);
1922
1923var hasLastIndexBug = StringPrototype.lastIndexOf && 'abcあい'.lastIndexOf('あい', 2) !== -1;
1924defineProperties(StringPrototype, {
1925    lastIndexOf: function lastIndexOf(searchString) {
1926        if (typeof this === 'undefined' || this === null) {
1927            throw new TypeError("can't convert " + this + ' to object');
1928        }
1929        var S = $String(this);
1930        var searchStr = $String(searchString);
1931        var numPos = arguments.length > 1 ? $Number(arguments[1]) : NaN;
1932        var pos = isActualNaN(numPos) ? Infinity : ES.ToInteger(numPos);
1933        var start = min(max(pos, 0), S.length);
1934        var searchLen = searchStr.length;
1935        var k = start + searchLen;
1936        while (k > 0) {
1937            k = max(0, k - searchLen);
1938            var index = strIndexOf(strSlice(S, k, start + searchLen), searchStr);
1939            if (index !== -1) {
1940                return k + index;
1941            }
1942        }
1943        return -1;
1944    }
1945}, hasLastIndexBug);
1946
1947var originalLastIndexOf = StringPrototype.lastIndexOf;
1948defineProperties(StringPrototype, {
1949    lastIndexOf: function lastIndexOf(searchString) {
1950        return originalLastIndexOf.apply(this, arguments);
1951    }
1952}, StringPrototype.lastIndexOf.length !== 1);
1953
1954// ES-5 15.1.2.2
1955/* eslint-disable radix */
1956if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) {
1957/* eslint-enable radix */
1958    /* global parseInt: true */
1959    parseInt = (function (origParseInt) {
1960        var hexRegex = /^[\-+]?0[xX]/;
1961        return function parseInt(str, radix) {
1962            var string = trim(str);
1963            var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10);
1964            return origParseInt(string, defaultedRadix);
1965        };
1966    }(parseInt));
1967}
1968
1969// https://es5.github.io/#x15.1.2.3
1970if (1 / parseFloat('-0') !== -Infinity) {
1971    /* global parseFloat: true */
1972    parseFloat = (function (origParseFloat) {
1973        return function parseFloat(string) {
1974            var inputString = trim(string);
1975            var result = origParseFloat(inputString);
1976            return result === 0 && strSlice(inputString, 0, 1) === '-' ? -0 : result;
1977        };
1978    }(parseFloat));
1979}
1980
1981if (String(new RangeError('test')) !== 'RangeError: test') {
1982    var errorToStringShim = function toString() {
1983        if (typeof this === 'undefined' || this === null) {
1984            throw new TypeError("can't convert " + this + ' to object');
1985        }
1986        var name = this.name;
1987        if (typeof name === 'undefined') {
1988            name = 'Error';
1989        } else if (typeof name !== 'string') {
1990            name = $String(name);
1991        }
1992        var msg = this.message;
1993        if (typeof msg === 'undefined') {
1994            msg = '';
1995        } else if (typeof msg !== 'string') {
1996            msg = $String(msg);
1997        }
1998        if (!name) {
1999            return msg;
2000        }
2001        if (!msg) {
2002            return name;
2003        }
2004        return name + ': ' + msg;
2005    };
2006    // can't use defineProperties here because of toString enumeration issue in IE <= 8
2007    Error.prototype.toString = errorToStringShim;
2008}
2009
2010if (supportsDescriptors) {
2011    var ensureNonEnumerable = function (obj, prop) {
2012        if (isEnum(obj, prop)) {
2013            var desc = Object.getOwnPropertyDescriptor(obj, prop);
2014            desc.enumerable = false;
2015            Object.defineProperty(obj, prop, desc);
2016        }
2017    };
2018    ensureNonEnumerable(Error.prototype, 'message');
2019    if (Error.prototype.message !== '') {
2020      Error.prototype.message = '';
2021    }
2022    ensureNonEnumerable(Error.prototype, 'name');
2023}
2024
2025if (String(/a/mig) !== '/a/gim') {
2026    var regexToString = function toString() {
2027        var str = '/' + this.source + '/';
2028        if (this.global) {
2029            str += 'g';
2030        }
2031        if (this.ignoreCase) {
2032            str += 'i';
2033        }
2034        if (this.multiline) {
2035            str += 'm';
2036        }
2037        return str;
2038    };
2039    // can't use defineProperties here because of toString enumeration issue in IE <= 8
2040    RegExp.prototype.toString = regexToString;
2041}
2042
2043}));
2044
2045/*!
2046 * https://github.com/es-shims/es5-shim
2047 * @license es5-shim Copyright 2009-2015 by contributors, MIT License
2048 * see https://github.com/es-shims/es5-shim/blob/master/LICENSE
2049 */
2050
2051// vim: ts=4 sts=4 sw=4 expandtab
2052
2053// Add semicolon to prevent IIFE from being passed as argument to concatenated code.
2054;
2055
2056// UMD (Universal Module Definition)
2057// see https://github.com/umdjs/umd/blob/master/templates/returnExports.js
2058(function (root, factory) {
2059    'use strict';
2060
2061    /* global define, exports, module */
2062    if (typeof define === 'function' && define.amd) {
2063        // AMD. Register as an anonymous module.
2064        define(factory);
2065    } else if (typeof exports === 'object') {
2066        // Node. Does not work with strict CommonJS, but
2067        // only CommonJS-like enviroments that support module.exports,
2068        // like Node.
2069        module.exports = factory();
2070    } else {
2071        // Browser globals (root is window)
2072        root.returnExports = factory();
2073  }
2074}(this, function () {
2075
2076var call = Function.call;
2077var prototypeOfObject = Object.prototype;
2078var owns = call.bind(prototypeOfObject.hasOwnProperty);
2079var isEnumerable = call.bind(prototypeOfObject.propertyIsEnumerable);
2080var toStr = call.bind(prototypeOfObject.toString);
2081
2082// If JS engine supports accessors creating shortcuts.
2083var defineGetter;
2084var defineSetter;
2085var lookupGetter;
2086var lookupSetter;
2087var supportsAccessors = owns(prototypeOfObject, '__defineGetter__');
2088if (supportsAccessors) {
2089    /* eslint-disable no-underscore-dangle */
2090    defineGetter = call.bind(prototypeOfObject.__defineGetter__);
2091    defineSetter = call.bind(prototypeOfObject.__defineSetter__);
2092    lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
2093    lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
2094    /* eslint-enable no-underscore-dangle */
2095}
2096
2097// ES5 15.2.3.2
2098// http://es5.github.com/#x15.2.3.2
2099if (!Object.getPrototypeOf) {
2100    // https://github.com/es-shims/es5-shim/issues#issue/2
2101    // http://ejohn.org/blog/objectgetprototypeof/
2102    // recommended by fschaefer on github
2103    //
2104    // sure, and webreflection says ^_^
2105    // ... this will nerever possibly return null
2106    // ... Opera Mini breaks here with infinite loops
2107    Object.getPrototypeOf = function getPrototypeOf(object) {
2108        /* eslint-disable no-proto */
2109        var proto = object.__proto__;
2110        /* eslint-enable no-proto */
2111        if (proto || proto === null) {
2112            return proto;
2113        } else if (toStr(object.constructor) === '[object Function]') {
2114            return object.constructor.prototype;
2115        } else if (object instanceof Object) {
2116          return prototypeOfObject;
2117        } else {
2118          // Correctly return null for Objects created with `Object.create(null)`
2119          // (shammed or native) or `{ __proto__: null}`.  Also returns null for
2120          // cross-realm objects on browsers that lack `__proto__` support (like
2121          // IE <11), but that's the best we can do.
2122          return null;
2123        }
2124    };
2125}
2126
2127// ES5 15.2.3.3
2128// http://es5.github.com/#x15.2.3.3
2129
2130var doesGetOwnPropertyDescriptorWork = function doesGetOwnPropertyDescriptorWork(object) {
2131    try {
2132        object.sentinel = 0;
2133        return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0;
2134    } catch (exception) {
2135        return false;
2136    }
2137};
2138
2139// check whether getOwnPropertyDescriptor works if it's given. Otherwise, shim partially.
2140if (Object.defineProperty) {
2141    var getOwnPropertyDescriptorWorksOnObject = doesGetOwnPropertyDescriptorWork({});
2142    var getOwnPropertyDescriptorWorksOnDom = typeof document === 'undefined' ||
2143    doesGetOwnPropertyDescriptorWork(document.createElement('div'));
2144    if (!getOwnPropertyDescriptorWorksOnDom || !getOwnPropertyDescriptorWorksOnObject) {
2145        var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor;
2146    }
2147}
2148
2149if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
2150    var ERR_NON_OBJECT = 'Object.getOwnPropertyDescriptor called on a non-object: ';
2151
2152    /* eslint-disable no-proto */
2153    Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
2154        if ((typeof object !== 'object' && typeof object !== 'function') || object === null) {
2155            throw new TypeError(ERR_NON_OBJECT + object);
2156        }
2157
2158        // make a valiant attempt to use the real getOwnPropertyDescriptor
2159        // for I8's DOM elements.
2160        if (getOwnPropertyDescriptorFallback) {
2161            try {
2162                return getOwnPropertyDescriptorFallback.call(Object, object, property);
2163            } catch (exception) {
2164                // try the shim if the real one doesn't work
2165            }
2166        }
2167
2168        var descriptor;
2169
2170        // If object does not owns property return undefined immediately.
2171        if (!owns(object, property)) {
2172            return descriptor;
2173        }
2174
2175        // If object has a property then it's for sure `configurable`, and
2176        // probably `enumerable`. Detect enumerability though.
2177        descriptor = {
2178            enumerable: isEnumerable(object, property),
2179            configurable: true
2180        };
2181
2182        // If JS engine supports accessor properties then property may be a
2183        // getter or setter.
2184        if (supportsAccessors) {
2185            // Unfortunately `__lookupGetter__` will return a getter even
2186            // if object has own non getter property along with a same named
2187            // inherited getter. To avoid misbehavior we temporary remove
2188            // `__proto__` so that `__lookupGetter__` will return getter only
2189            // if it's owned by an object.
2190            var prototype = object.__proto__;
2191            var notPrototypeOfObject = object !== prototypeOfObject;
2192            // avoid recursion problem, breaking in Opera Mini when
2193            // Object.getOwnPropertyDescriptor(Object.prototype, 'toString')
2194            // or any other Object.prototype accessor
2195            if (notPrototypeOfObject) {
2196                object.__proto__ = prototypeOfObject;
2197            }
2198
2199            var getter = lookupGetter(object, property);
2200            var setter = lookupSetter(object, property);
2201
2202            if (notPrototypeOfObject) {
2203                // Once we have getter and setter we can put values back.
2204                object.__proto__ = prototype;
2205            }
2206
2207            if (getter || setter) {
2208                if (getter) {
2209                    descriptor.get = getter;
2210                }
2211                if (setter) {
2212                    descriptor.set = setter;
2213                }
2214                // If it was accessor property we're done and return here
2215                // in order to avoid adding `value` to the descriptor.
2216                return descriptor;
2217            }
2218        }
2219
2220        // If we got this far we know that object has an own property that is
2221        // not an accessor so we set it as a value and return descriptor.
2222        descriptor.value = object[property];
2223        descriptor.writable = true;
2224        return descriptor;
2225    };
2226    /* eslint-enable no-proto */
2227}
2228
2229// ES5 15.2.3.4
2230// http://es5.github.com/#x15.2.3.4
2231if (!Object.getOwnPropertyNames) {
2232    Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
2233        return Object.keys(object);
2234    };
2235}
2236
2237// ES5 15.2.3.5
2238// http://es5.github.com/#x15.2.3.5
2239if (!Object.create) {
2240
2241    // Contributed by Brandon Benvie, October, 2012
2242    var createEmpty;
2243    var supportsProto = !({ __proto__: null } instanceof Object);
2244                        // the following produces false positives
2245                        // in Opera Mini => not a reliable check
2246                        // Object.prototype.__proto__ === null
2247
2248    // Check for document.domain and active x support
2249    // No need to use active x approach when document.domain is not set
2250    // see https://github.com/es-shims/es5-shim/issues/150
2251    // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2252    /* global ActiveXObject */
2253    var shouldUseActiveX = function shouldUseActiveX() {
2254        // return early if document.domain not set
2255        if (!document.domain) {
2256            return false;
2257        }
2258
2259        try {
2260            return !!new ActiveXObject('htmlfile');
2261        } catch (exception) {
2262            return false;
2263        }
2264    };
2265
2266    // This supports IE8 when document.domain is used
2267    // see https://github.com/es-shims/es5-shim/issues/150
2268    // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2269    var getEmptyViaActiveX = function getEmptyViaActiveX() {
2270        var empty;
2271        var xDoc;
2272
2273        xDoc = new ActiveXObject('htmlfile');
2274
2275        xDoc.write('<script><\/script>');
2276        xDoc.close();
2277
2278        empty = xDoc.parentWindow.Object.prototype;
2279        xDoc = null;
2280
2281        return empty;
2282    };
2283
2284    // The original implementation using an iframe
2285    // before the activex approach was added
2286    // see https://github.com/es-shims/es5-shim/issues/150
2287    var getEmptyViaIFrame = function getEmptyViaIFrame() {
2288        var iframe = document.createElement('iframe');
2289        var parent = document.body || document.documentElement;
2290        var empty;
2291
2292        iframe.style.display = 'none';
2293        parent.appendChild(iframe);
2294        /* eslint-disable no-script-url */
2295        iframe.src = 'javascript:';
2296        /* eslint-enable no-script-url */
2297
2298        empty = iframe.contentWindow.Object.prototype;
2299        parent.removeChild(iframe);
2300        iframe = null;
2301
2302        return empty;
2303    };
2304
2305    /* global document */
2306    if (supportsProto || typeof document === 'undefined') {
2307        createEmpty = function () {
2308            return { __proto__: null };
2309        };
2310    } else {
2311        // In old IE __proto__ can't be used to manually set `null`, nor does
2312        // any other method exist to make an object that inherits from nothing,
2313        // aside from Object.prototype itself. Instead, create a new global
2314        // object and *steal* its Object.prototype and strip it bare. This is
2315        // used as the prototype to create nullary objects.
2316        createEmpty = function () {
2317            // Determine which approach to use
2318            // see https://github.com/es-shims/es5-shim/issues/150
2319            var empty = shouldUseActiveX() ? getEmptyViaActiveX() : getEmptyViaIFrame();
2320
2321            delete empty.constructor;
2322            delete empty.hasOwnProperty;
2323            delete empty.propertyIsEnumerable;
2324            delete empty.isPrototypeOf;
2325            delete empty.toLocaleString;
2326            delete empty.toString;
2327            delete empty.valueOf;
2328
2329            var Empty = function Empty() {};
2330            Empty.prototype = empty;
2331            // short-circuit future calls
2332            createEmpty = function () {
2333                return new Empty();
2334            };
2335            return new Empty();
2336        };
2337    }
2338
2339    Object.create = function create(prototype, properties) {
2340
2341        var object;
2342        var Type = function Type() {}; // An empty constructor.
2343
2344        if (prototype === null) {
2345            object = createEmpty();
2346        } else {
2347            if (typeof prototype !== 'object' && typeof prototype !== 'function') {
2348                // In the native implementation `parent` can be `null`
2349                // OR *any* `instanceof Object`  (Object|Function|Array|RegExp|etc)
2350                // Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object`
2351                // like they are in modern browsers. Using `Object.create` on DOM elements
2352                // is...err...probably inappropriate, but the native version allows for it.
2353                throw new TypeError('Object prototype may only be an Object or null'); // same msg as Chrome
2354            }
2355            Type.prototype = prototype;
2356            object = new Type();
2357            // IE has no built-in implementation of `Object.getPrototypeOf`
2358            // neither `__proto__`, but this manually setting `__proto__` will
2359            // guarantee that `Object.getPrototypeOf` will work as expected with
2360            // objects created using `Object.create`
2361            /* eslint-disable no-proto */
2362            object.__proto__ = prototype;
2363            /* eslint-enable no-proto */
2364        }
2365
2366        if (properties !== void 0) {
2367            Object.defineProperties(object, properties);
2368        }
2369
2370        return object;
2371    };
2372}
2373
2374// ES5 15.2.3.6
2375// http://es5.github.com/#x15.2.3.6
2376
2377// Patch for WebKit and IE8 standard mode
2378// Designed by hax <hax.github.com>
2379// related issue: https://github.com/es-shims/es5-shim/issues#issue/5
2380// IE8 Reference:
2381//     http://msdn.microsoft.com/en-us/library/dd282900.aspx
2382//     http://msdn.microsoft.com/en-us/library/dd229916.aspx
2383// WebKit Bugs:
2384//     https://bugs.webkit.org/show_bug.cgi?id=36423
2385
2386var doesDefinePropertyWork = function doesDefinePropertyWork(object) {
2387    try {
2388        Object.defineProperty(object, 'sentinel', {});
2389        return 'sentinel' in object;
2390    } catch (exception) {
2391        return false;
2392    }
2393};
2394
2395// check whether defineProperty works if it's given. Otherwise,
2396// shim partially.
2397if (Object.defineProperty) {
2398    var definePropertyWorksOnObject = doesDefinePropertyWork({});
2399    var definePropertyWorksOnDom = typeof document === 'undefined' ||
2400        doesDefinePropertyWork(document.createElement('div'));
2401    if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
2402        var definePropertyFallback = Object.defineProperty,
2403            definePropertiesFallback = Object.defineProperties;
2404    }
2405}
2406
2407if (!Object.defineProperty || definePropertyFallback) {
2408    var ERR_NON_OBJECT_DESCRIPTOR = 'Property description must be an object: ';
2409    var ERR_NON_OBJECT_TARGET = 'Object.defineProperty called on non-object: ';
2410    var ERR_ACCESSORS_NOT_SUPPORTED = 'getters & setters can not be defined on this javascript engine';
2411
2412    Object.defineProperty = function defineProperty(object, property, descriptor) {
2413        if ((typeof object !== 'object' && typeof object !== 'function') || object === null) {
2414            throw new TypeError(ERR_NON_OBJECT_TARGET + object);
2415        }
2416        if ((typeof descriptor !== 'object' && typeof descriptor !== 'function') || descriptor === null) {
2417            throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
2418        }
2419        // make a valiant attempt to use the real defineProperty
2420        // for I8's DOM elements.
2421        if (definePropertyFallback) {
2422            try {
2423                return definePropertyFallback.call(Object, object, property, descriptor);
2424            } catch (exception) {
2425                // try the shim if the real one doesn't work
2426            }
2427        }
2428
2429        // If it's a data property.
2430        if ('value' in descriptor) {
2431            // fail silently if 'writable', 'enumerable', or 'configurable'
2432            // are requested but not supported
2433            /*
2434            // alternate approach:
2435            if ( // can't implement these features; allow false but not true
2436                ('writable' in descriptor && !descriptor.writable) ||
2437                ('enumerable' in descriptor && !descriptor.enumerable) ||
2438                ('configurable' in descriptor && !descriptor.configurable)
2439            ))
2440                throw new RangeError(
2441                    'This implementation of Object.defineProperty does not support configurable, enumerable, or writable.'
2442                );
2443            */
2444
2445            if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) {
2446                // As accessors are supported only on engines implementing
2447                // `__proto__` we can safely override `__proto__` while defining
2448                // a property to make sure that we don't hit an inherited
2449                // accessor.
2450                /* eslint-disable no-proto */
2451                var prototype = object.__proto__;
2452                object.__proto__ = prototypeOfObject;
2453                // Deleting a property anyway since getter / setter may be
2454                // defined on object itself.
2455                delete object[property];
2456                object[property] = descriptor.value;
2457                // Setting original `__proto__` back now.
2458                object.__proto__ = prototype;
2459                /* eslint-enable no-proto */
2460            } else {
2461                object[property] = descriptor.value;
2462            }
2463        } else {
2464            if (!supportsAccessors && (('get' in descriptor) || ('set' in descriptor))) {
2465                throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
2466            }
2467            // If we got that far then getters and setters can be defined !!
2468            if ('get' in descriptor) {
2469                defineGetter(object, property, descriptor.get);
2470            }
2471            if ('set' in descriptor) {
2472                defineSetter(object, property, descriptor.set);
2473            }
2474        }
2475        return object;
2476    };
2477}
2478
2479// ES5 15.2.3.7
2480// http://es5.github.com/#x15.2.3.7
2481if (!Object.defineProperties || definePropertiesFallback) {
2482    Object.defineProperties = function defineProperties(object, properties) {
2483        // make a valiant attempt to use the real defineProperties
2484        if (definePropertiesFallback) {
2485            try {
2486                return definePropertiesFallback.call(Object, object, properties);
2487            } catch (exception) {
2488                // try the shim if the real one doesn't work
2489            }
2490        }
2491
2492        Object.keys(properties).forEach(function (property) {
2493            if (property !== '__proto__') {
2494                Object.defineProperty(object, property, properties[property]);
2495            }
2496        });
2497        return object;
2498    };
2499}
2500
2501// ES5 15.2.3.8
2502// http://es5.github.com/#x15.2.3.8
2503if (!Object.seal) {
2504    Object.seal = function seal(object) {
2505        if (Object(object) !== object) {
2506            throw new TypeError('Object.seal can only be called on Objects.');
2507        }
2508        // this is misleading and breaks feature-detection, but
2509        // allows "securable" code to "gracefully" degrade to working
2510        // but insecure code.
2511        return object;
2512    };
2513}
2514
2515// ES5 15.2.3.9
2516// http://es5.github.com/#x15.2.3.9
2517if (!Object.freeze) {
2518    Object.freeze = function freeze(object) {
2519        if (Object(object) !== object) {
2520            throw new TypeError('Object.freeze can only be called on Objects.');
2521        }
2522        // this is misleading and breaks feature-detection, but
2523        // allows "securable" code to "gracefully" degrade to working
2524        // but insecure code.
2525        return object;
2526    };
2527}
2528
2529// detect a Rhino bug and patch it
2530try {
2531    Object.freeze(function () {});
2532} catch (exception) {
2533    Object.freeze = (function (freezeObject) {
2534        return function freeze(object) {
2535            if (typeof object === 'function') {
2536                return object;
2537            } else {
2538                return freezeObject(object);
2539            }
2540        };
2541    }(Object.freeze));
2542}
2543
2544// ES5 15.2.3.10
2545// http://es5.github.com/#x15.2.3.10
2546if (!Object.preventExtensions) {
2547    Object.preventExtensions = function preventExtensions(object) {
2548        if (Object(object) !== object) {
2549            throw new TypeError('Object.preventExtensions can only be called on Objects.');
2550        }
2551        // this is misleading and breaks feature-detection, but
2552        // allows "securable" code to "gracefully" degrade to working
2553        // but insecure code.
2554        return object;
2555    };
2556}
2557
2558// ES5 15.2.3.11
2559// http://es5.github.com/#x15.2.3.11
2560if (!Object.isSealed) {
2561    Object.isSealed = function isSealed(object) {
2562        if (Object(object) !== object) {
2563            throw new TypeError('Object.isSealed can only be called on Objects.');
2564        }
2565        return false;
2566    };
2567}
2568
2569// ES5 15.2.3.12
2570// http://es5.github.com/#x15.2.3.12
2571if (!Object.isFrozen) {
2572    Object.isFrozen = function isFrozen(object) {
2573        if (Object(object) !== object) {
2574            throw new TypeError('Object.isFrozen can only be called on Objects.');
2575        }
2576        return false;
2577    };
2578}
2579
2580// ES5 15.2.3.13
2581// http://es5.github.com/#x15.2.3.13
2582if (!Object.isExtensible) {
2583    Object.isExtensible = function isExtensible(object) {
2584        // 1. If Type(O) is not Object throw a TypeError exception.
2585        if (Object(object) !== object) {
2586            throw new TypeError('Object.isExtensible can only be called on Objects.');
2587        }
2588        // 2. Return the Boolean value of the [[Extensible]] internal property of O.
2589        var name = '';
2590        while (owns(object, name)) {
2591            name += '?';
2592        }
2593        object[name] = true;
2594        var returnValue = owns(object, name);
2595        delete object[name];
2596        return returnValue;
2597    };
2598}
2599
2600}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.