oxe-cli
Version:
Oxe command line interface program for Oxe applications.
1,377 lines (1,173 loc) • 51.3 kB
JavaScript
/* Polyfill service v3.27.0
* For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
*
* Features requested: fetch
*
* - Object.defineProperty, License: CC0 (required by "_ESAbstract.CreateMethodProperty", "Array.prototype.forEach", "fetch", "Object.getOwnPropertyNames", "Event", "XMLHttpRequest")
* - _ESAbstract.CreateMethodProperty, License: CC0 (required by "Array.prototype.forEach", "fetch", "Object.getOwnPropertyNames")
* - _ESAbstract.ToObject, License: CC0 (required by "Array.prototype.forEach", "fetch", "_ESAbstract.GetV", "_ESAbstract.GetMethod", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString")
* - _ESAbstract.ToInteger, License: CC0 (required by "_ESAbstract.ToLength", "Array.prototype.forEach", "fetch")
* - _ESAbstract.ToLength, License: CC0 (required by "Array.prototype.forEach", "fetch")
* - _ESAbstract.Get, License: CC0 (required by "Array.prototype.forEach", "fetch", "_ESAbstract.OrdinaryToPrimitive", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString")
* - _ESAbstract.IsCallable, License: CC0 (required by "Array.prototype.forEach", "fetch", "_ESAbstract.GetMethod", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "_ESAbstract.OrdinaryToPrimitive")
* - _ESAbstract.HasProperty, License: CC0 (required by "Array.prototype.forEach", "fetch")
* - _ESAbstract.Call, License: CC0 (required by "Array.prototype.forEach", "fetch", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "_ESAbstract.OrdinaryToPrimitive")
* - _ESAbstract.GetV, License: CC0 (required by "_ESAbstract.GetMethod", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.forEach", "fetch")
* - _ESAbstract.GetMethod, License: CC0 (required by "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.forEach", "fetch")
* - _ESAbstract.Type, License: CC0 (required by "_ESAbstract.ToString", "Array.prototype.forEach", "fetch", "_ESAbstract.ToPrimitive", "_ESAbstract.OrdinaryToPrimitive")
* - _ESAbstract.OrdinaryToPrimitive, License: CC0 (required by "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.forEach", "fetch")
* - _ESAbstract.ToPrimitive, License: CC0 (required by "_ESAbstract.ToString", "Array.prototype.forEach", "fetch")
* - _ESAbstract.ToString, License: CC0 (required by "Array.prototype.forEach", "fetch")
* - Array.prototype.forEach, License: CC0 (required by "fetch")
* - Object.getOwnPropertyNames, License: CC0 (required by "fetch")
* - Promise, License: MIT (required by "fetch")
* - Window, License: CC0 (required by "Event", "XMLHttpRequest", "fetch")
* - Document, License: CC0 (required by "Event", "XMLHttpRequest", "fetch", "Element")
* - Element, License: CC0 (required by "Event", "XMLHttpRequest", "fetch")
* - Event, License: CC0 (required by "XMLHttpRequest", "fetch")
* - XMLHttpRequest, License: CC0 (required by "fetch")
* - fetch, License: MIT */
(function(undefined) {
if (!(// In IE8, defineProperty could only act on DOM elements, so full support
// for the feature requires the ability to set a property on an arbitrary object
'defineProperty' in Object && (function() {
try {
var a = {};
Object.defineProperty(a, 'test', {value:42});
return true;
} catch(e) {
return false
}
}()))) {
// Object.defineProperty
(function (nativeDefineProperty) {
var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
// Polyfill.io - This does not use CreateMethodProperty because our CreateMethodProperty function uses Object.defineProperty.
Object['defineProperty'] = function defineProperty(object, property, descriptor) {
// Where native support exists, assume it
if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
return nativeDefineProperty(object, property, descriptor);
}
if (object === null || !(object instanceof Object || typeof object === 'object')) {
throw new TypeError('Object.defineProperty called on non-object');
}
if (!(descriptor instanceof Object)) {
throw new TypeError('Property description must be an object');
}
var propertyString = String(property);
var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
var getterType = 'get' in descriptor && typeof descriptor.get;
var setterType = 'set' in descriptor && typeof descriptor.set;
// handle descriptor.get
if (getterType) {
if (getterType !== 'function') {
throw new TypeError('Getter must be a function');
}
if (!supportsAccessors) {
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
}
if (hasValueOrWritable) {
throw new TypeError(ERR_VALUE_ACCESSORS);
}
Object.__defineGetter__.call(object, propertyString, descriptor.get);
} else {
object[propertyString] = descriptor.value;
}
// handle descriptor.set
if (setterType) {
if (setterType !== 'function') {
throw new TypeError('Setter must be a function');
}
if (!supportsAccessors) {
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
}
if (hasValueOrWritable) {
throw new TypeError(ERR_VALUE_ACCESSORS);
}
Object.__defineSetter__.call(object, propertyString, descriptor.set);
}
// OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
if ('value' in descriptor) {
object[propertyString] = descriptor.value;
}
return object;
};
}(Object.defineProperty));
}
// _ESAbstract.CreateMethodProperty
// 7.3.5. CreateMethodProperty ( O, P, V )
function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars
// 1. Assert: Type(O) is Object.
// 2. Assert: IsPropertyKey(P) is true.
// 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}.
var newDesc = {
value: V,
writable: true,
enumerable: false,
configurable: true
};
// 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
Object.defineProperty(O, P, newDesc);
}
// _ESAbstract.ToObject
// 7.1.13 ToObject ( argument )
// The abstract operation ToObject converts argument to a value of type Object according to Table 12:
// Table 12: ToObject Conversions
/*
|----------------------------------------------------------------------------------------------------------------------------------------------------|
| Argument Type | Result |
|----------------------------------------------------------------------------------------------------------------------------------------------------|
| Undefined | Throw a TypeError exception. |
| Null | Throw a TypeError exception. |
| Boolean | Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 19.3 for a description of Boolean objects. |
| Number | Return a new Number object whose [[NumberData]] internal slot is set to argument. See 20.1 for a description of Number objects. |
| String | Return a new String object whose [[StringData]] internal slot is set to argument. See 21.1 for a description of String objects. |
| Symbol | Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 19.4 for a description of Symbol objects. |
| Object | Return argument. |
|----------------------------------------------------------------------------------------------------------------------------------------------------|
*/
function ToObject(argument) { // eslint-disable-line no-unused-vars
if (argument === null || argument === undefined) {
throw TypeError();
}
return Object(argument);
}
// _ESAbstract.ToInteger
// 7.1.4. ToInteger ( argument )
function ToInteger(argument) { // eslint-disable-line no-unused-vars
// 1. Let number be ? ToNumber(argument).
var number = Number(argument);
// 2. If number is NaN, return +0.
if (isNaN(number)) {
return 0;
}
// 3. If number is +0, -0, +∞, or -∞, return number.
if (1/number === Infinity || 1/number === -Infinity || number === Infinity || number === -Infinity) {
return number;
}
// 4. Return the number value that is the same sign as number and whose magnitude is floor(abs(number)).
return ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number));
}
// _ESAbstract.ToLength
/* global ToInteger */
// 7.1.15. ToLength ( argument )
function ToLength(argument) { // eslint-disable-line no-unused-vars
// 1. Let len be ? ToInteger(argument).
var len = ToInteger(argument);
// 2. If len ≤ +0, return +0.
if (len <= 0) {
return 0;
}
// 3. Return min(len, 253-1).
return Math.min(len, Math.pow(2, 53) -1);
}
// _ESAbstract.Get
// 7.3.1. Get ( O, P )
function Get(O, P) { // eslint-disable-line no-unused-vars
// 1. Assert: Type(O) is Object.
// 2. Assert: IsPropertyKey(P) is true.
// 3. Return ? O.[[Get]](P, O).
return O[P];
}
// _ESAbstract.IsCallable
// 7.2.3. IsCallable ( argument )
function IsCallable(argument) { // eslint-disable-line no-unused-vars
// 1. If Type(argument) is not Object, return false.
// 2. If argument has a [[Call]] internal method, return true.
// 3. Return false.
// Polyfill.io - Only function objects have a [[Call]] internal method. This means we can simplify this function to check that the argument has a type of function.
return typeof argument === 'function';
}
// _ESAbstract.HasProperty
// 7.3.10. HasProperty ( O, P )
function HasProperty(O, P) { // eslint-disable-line no-unused-vars
// Assert: Type(O) is Object.
// Assert: IsPropertyKey(P) is true.
// Return ? O.[[HasProperty]](P).
return P in O;
}
// _ESAbstract.Call
/* global IsCallable */
// 7.3.12. Call ( F, V [ , argumentsList ] )
function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-vars
// 1. If argumentsList is not present, set argumentsList to a new empty List.
var argumentsList = arguments.length > 2 ? arguments[2] : [];
// 2. If IsCallable(F) is false, throw a TypeError exception.
if (IsCallable(F) === false) {
throw new TypeError(Object.prototype.toString.call(F) + 'is not a function.');
}
// 3. Return ? F.[[Call]](V, argumentsList).
return F.apply(V, argumentsList);
}
// _ESAbstract.GetV
/* global ToObject */
// 7.3.2 GetV (V, P)
function GetV(v, p) { // eslint-disable-line no-unused-vars
// 1. Assert: IsPropertyKey(P) is true.
// 2. Let O be ? ToObject(V).
var o = ToObject(v);
// 3. Return ? O.[[Get]](P, V).
return o[p];
}
// _ESAbstract.GetMethod
/* global GetV, IsCallable */
// 7.3.9. GetMethod ( V, P )
function GetMethod(V, P) { // eslint-disable-line no-unused-vars
// 1. Assert: IsPropertyKey(P) is true.
// 2. Let func be ? GetV(V, P).
var func = GetV(V, P);
// 3. If func is either undefined or null, return undefined.
if (func === null || func === undefined) {
return undefined;
}
// 4. If IsCallable(func) is false, throw a TypeError exception.
if (IsCallable(func) === false) {
throw new TypeError('Method not callable: ' + P);
}
// 5. Return func.
return func;
}
// _ESAbstract.Type
// "Type(x)" is used as shorthand for "the type of x"...
function Type(x) { // eslint-disable-line no-unused-vars
switch (typeof x) {
case 'undefined':
return 'undefined';
case 'boolean':
return 'boolean';
case 'number':
return 'number';
case 'string':
return 'string';
case 'symbol':
return 'symbol';
default:
// typeof null is 'object'
if (x === null) return 'null';
// Polyfill.io - This is here because a Symbol polyfill will have a typeof `object`.
if ('Symbol' in this && x instanceof this.Symbol) return 'symbol';
return 'object';
}
}
// _ESAbstract.OrdinaryToPrimitive
/* global Get, IsCallable, Call, Type */
// 7.1.1.1. OrdinaryToPrimitive ( O, hint )
function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars
// 1. Assert: Type(O) is Object.
// 2. Assert: Type(hint) is String and its value is either "string" or "number".
// 3. If hint is "string", then
if (hint === 'string') {
// a. Let methodNames be « "toString", "valueOf" ».
var methodNames = ['toString', 'valueOf'];
// 4. Else,
} else {
// a. Let methodNames be « "valueOf", "toString" ».
methodNames = ['valueOf', 'toString'];
}
// 5. For each name in methodNames in List order, do
for (var i = 0; i < methodNames.length; ++i) {
var name = methodNames[i];
// a. Let method be ? Get(O, name).
var method = Get(O, name);
// b. If IsCallable(method) is true, then
if (IsCallable(method)) {
// i. Let result be ? Call(method, O).
var result = Call(method, O);
// ii. If Type(result) is not Object, return result.
if (Type(result) !== 'object') {
return result;
}
}
}
// 6. Throw a TypeError exception.
throw new TypeError('Cannot convert to primitive.');
}
// _ESAbstract.ToPrimitive
/* global Type, GetMethod, Call, OrdinaryToPrimitive */
// 7.1.1. ToPrimitive ( input [ , PreferredType ] )
function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no-unused-vars
var PreferredType = arguments.length > 1 ? arguments[1] : undefined;
// 1. Assert: input is an ECMAScript language value.
// 2. If Type(input) is Object, then
if (Type(input) === 'object') {
// a. If PreferredType is not present, let hint be "default".
if (arguments.length < 2) {
var hint = 'default';
// b. Else if PreferredType is hint String, let hint be "string".
} else if (PreferredType === String) {
hint = 'string';
// c. Else PreferredType is hint Number, let hint be "number".
} else if (PreferredType === Number) {
hint = 'number';
}
// d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
var exoticToPrim = typeof this.Symbol === 'function' && typeof this.Symbol.toPrimitive === 'symbol' ? GetMethod(input, this.Symbol.toPrimitive) : undefined;
// e. If exoticToPrim is not undefined, then
if (exoticToPrim !== undefined) {
// i. Let result be ? Call(exoticToPrim, input, « hint »).
var result = Call(exoticToPrim, input, [hint]);
// ii. If Type(result) is not Object, return result.
if (Type(result) !== 'object') {
return result;
}
// iii. Throw a TypeError exception.
throw new TypeError('Cannot convert exotic object to primitive.');
}
// f. If hint is "default", set hint to "number".
if (hint === 'default') {
hint = 'number';
}
// g. Return ? OrdinaryToPrimitive(input, hint).
return OrdinaryToPrimitive(input, hint);
}
// 3. Return input
return input;
}
// _ESAbstract.ToString
/* global Type, ToPrimitive */
// 7.1.12. ToString ( argument )
// The abstract operation ToString converts argument to a value of type String according to Table 11:
// Table 11: ToString Conversions
/*
|---------------|--------------------------------------------------------|
| Argument Type | Result |
|---------------|--------------------------------------------------------|
| Undefined | Return "undefined". |
|---------------|--------------------------------------------------------|
| Null | Return "null". |
|---------------|--------------------------------------------------------|
| Boolean | If argument is true, return "true". |
| | If argument is false, return "false". |
|---------------|--------------------------------------------------------|
| Number | Return NumberToString(argument). |
|---------------|--------------------------------------------------------|
| String | Return argument. |
|---------------|--------------------------------------------------------|
| Symbol | Throw a TypeError exception. |
|---------------|--------------------------------------------------------|
| Object | Apply the following steps: |
| | Let primValue be ? ToPrimitive(argument, hint String). |
| | Return ? ToString(primValue). |
|---------------|--------------------------------------------------------|
*/
function ToString(argument) { // eslint-disable-line no-unused-vars
switch(Type(argument)) {
case 'symbol':
throw new TypeError('Cannot convert a Symbol value to a string');
break;
case 'object':
var primValue = ToPrimitive(argument, 'string');
return ToString(primValue);
default:
return String(argument);
}
}
if (!('forEach' in Array.prototype)) {
// Array.prototype.forEach
/* global Call, CreateMethodProperty, Get, HasProperty, IsCallable, ToLength, ToObject, ToString */
// 22.1.3.10. Array.prototype.forEach ( callbackfn [ , thisArg ] )
CreateMethodProperty(Array.prototype, 'forEach', function forEach(callbackfn /* [ , thisArg ] */) {
// 1. Let O be ? ToObject(this value).
var O = ToObject(this);
// Polyfill.io - If O is a String object, split it into an array in order to iterate correctly.
// We will use arrayLike in place of O when we are iterating through the list.
var arraylike = O instanceof String ? O.split('') : O;
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = ToLength(Get(O, "length"));
// 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
if (IsCallable(callbackfn) === false) {
throw new TypeError(callbackfn + ' is not a function');
}
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
var T = arguments.length > 1 ? arguments[1] : undefined;
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
var Pk = ToString(k);
// b. Let kPresent be ? HasProperty(O, Pk).
var kPresent = HasProperty(arraylike, Pk);
// c. If kPresent is true, then
if (kPresent) {
// i. Let kValue be ? Get(O, Pk).
var kValue = Get(arraylike, Pk);
// ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
Call(callbackfn, T, [kValue, k, O]);
}
// d. Increase k by 1.
k = k + 1;
}
// 7. Return undefined.
return undefined;
});
}
if (!('getOwnPropertyNames' in Object)) {
// Object.getOwnPropertyNames
/* global CreateMethodProperty */
var toString = ({}).toString;
var split = ''.split;
CreateMethodProperty(Object, 'getOwnPropertyNames', function getOwnPropertyNames(object) {
var buffer = [];
var key;
// Non-enumerable properties cannot be discovered but can be checked for by name.
// Define those used internally by JS to allow an incomplete solution
var commonProps = ['length', "name", "arguments", "caller", "prototype", "observe", "unobserve"];
if (typeof object === 'undefined' || object === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
// Polyfill.io fallback for non-array-like strings which exist in some ES3 user-agents (IE 8)
object = toString.call(object) == '[object String]' ? split.call(object, '') : Object(object);
// Enumerable properties only
for (key in object) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
buffer.push(key);
}
}
// Check for and add the common non-enumerable properties
for (var i=0, s=commonProps.length; i<s; i++) {
if (commonProps[i] in object) buffer.push(commonProps[i]);
}
return buffer;
});
}
if (!('Promise' in this)) {
// Promise
!function(n){function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e={};t.m=n,t.c=e,t.i=function(n){return n},t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var e=n&&n.__esModule?function(){return n["default"]}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=100)}({100:/*!***********************!*\
!*** ./src/global.js ***!
\***********************/
function(n,t,e){(function(n){var t=e(/*! ./yaku */5);try{n.Promise=t,window.Promise=t}catch(r){}}).call(t,e(/*! ./../~/webpack/buildin/global.js */2))},2:/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
function(n,t){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(r){"object"==typeof window&&(e=window)}n.exports=e},5:/*!*********************!*\
!*** ./src/yaku.js ***!
\*********************/
function(n,t,e){(function(t){!function(){"use strict";function e(){return rn[q][B]||D}function r(n){return n&&"object"==typeof n}function o(n){return"function"==typeof n}function i(n,t){return n instanceof t}function u(n){return i(n,M)}function c(n,t,e){if(!t(n))throw h(e)}function f(){try{return R.apply(S,arguments)}catch(n){return nn.e=n,nn}}function s(n,t){return R=n,S=t,f}function a(n,t){function e(){for(var e=0;e<o;)t(r[e],r[e+1]),r[e++]=P,r[e++]=P;o=0,r.length>n&&(r.length=n)}var r=A(n),o=0;return function(n,t){r[o++]=n,r[o++]=t,2===o&&rn.nextTick(e)}}function l(n,t){var e,r,u,c,f=0;if(!n)throw h(Q);var a=n[rn[q][z]];if(o(a))r=a.call(n);else{if(!o(n.next)){if(i(n,A)){for(e=n.length;f<e;)t(n[f],f++);return f}throw h(Q)}r=n}for(;!(u=r.next()).done;)if((c=s(t)(u.value,f++))===nn)throw o(r[G])&&r[G](),c.e;return f}function h(n){return new TypeError(n)}function v(n){return(n?"":V)+(new M).stack}function _(n,t){var e="on"+n.toLowerCase(),r=O[e];H&&H.listeners(n).length?n===Z?H.emit(n,t._v,t):H.emit(n,t):r?r({reason:t._v,promise:t}):rn[n](t._v,t)}function p(n){return n&&n._s}function d(n){if(p(n))return new n(tn);var t,e,r;return t=new n(function(n,o){if(t)throw h();e=n,r=o}),c(e,o),c(r,o),t}function w(n,t){var e=!1;return function(r){e||(e=!0,L&&(n[N]=v(!0)),t===Y?k(n,r):x(n,t,r))}}function y(n,t,e,r){return o(e)&&(t._onFulfilled=e),o(r)&&(n[J]&&_(X,n),t._onRejected=r),L&&(t._p=n),n[n._c++]=t,n._s!==$&&on(n,t),t}function m(n){if(n._umark)return!0;n._umark=!0;for(var t,e=0,r=n._c;e<r;)if(t=n[e++],t._onRejected||m(t))return!0}function j(n,t){function e(n){return r.push(n.replace(/^\s+|\s+$/g,""))}var r=[];return L&&(t[N]&&e(t[N]),function o(n){n&&K in n&&(o(n._next),e(n[K]+""),o(n._p))}(t)),(n&&n.stack?n.stack:n)+("\n"+r.join("\n")).replace(en,"")}function g(n,t){return n(t)}function x(n,t,e){var r=0,o=n._c;if(n._s===$)for(n._s=t,n._v=e,t===U&&(L&&u(e)&&(e.longStack=j(e,n)),un(n));r<o;)on(n,n[r++]);return n}function k(n,t){if(t===n&&t)return x(n,U,h(W)),n;if(t!==C&&(o(t)||r(t))){var e=s(b)(t);if(e===nn)return x(n,U,e.e),n;o(e)?(L&&p(t)&&(n._next=t),p(t)?T(n,t,e):rn.nextTick(function(){T(n,t,e)})):x(n,Y,t)}else x(n,Y,t);return n}function b(n){return n.then}function T(n,t,e){var r=s(e,t)(function(e){t&&(t=C,k(n,e))},function(e){t&&(t=C,x(n,U,e))});r===nn&&t&&(x(n,U,r.e),t=C)}var P,R,S,C=null,F="object"==typeof self,O=F?self:t,E=O.Promise,H=O.process,I=O.console,L=!1,A=Array,M=Error,U=1,Y=2,$=3,q="Symbol",z="iterator",B="species",D=q+"("+B+")",G="return",J="_uh",K="_pt",N="_st",Q="Invalid argument",V="\nFrom previous ",W="Chaining cycle detected for promise",X="rejectionHandled",Z="unhandledRejection",nn={e:C},tn=function(){},en=/^.+\/node_modules\/yaku\/.+\n?/gm,rn=function(n){var t,e=this;if(!r(e)||e._s!==P)throw h("Invalid this");if(e._s=$,L&&(e[K]=v()),n!==tn){if(!o(n))throw h(Q);t=s(n)(w(e,Y),w(e,U)),t===nn&&x(e,U,t.e)}};rn["default"]=rn,function(n,t){for(var e in t)n[e]=t[e]}(rn.prototype,{then:function(n,t){if(this._s===undefined)throw h();return y(this,d(rn.speciesConstructor(this,rn)),n,t)},"catch":function(n){return this.then(P,n)},"finally":function(n){return this.then(function(t){return rn.resolve(n()).then(function(){return t})},function(t){return rn.resolve(n()).then(function(){throw t})})},_c:0,_p:C}),rn.resolve=function(n){return p(n)?n:k(d(this),n)},rn.reject=function(n){return x(d(this),U,n)},rn.race=function(n){var t=this,e=d(t),r=function(n){x(e,Y,n)},o=function(n){x(e,U,n)},i=s(l)(n,function(n){t.resolve(n).then(r,o)});return i===nn?t.reject(i.e):e},rn.all=function(n){function t(n){x(o,U,n)}var e,r=this,o=d(r),i=[];return(e=s(l)(n,function(n,u){r.resolve(n).then(function(n){i[u]=n,--e||x(o,Y,i)},t)}))===nn?r.reject(e.e):(e||x(o,Y,[]),o)},rn.Symbol=O[q]||{},s(function(){Object.defineProperty(rn,e(),{get:function(){return this}})})(),rn.speciesConstructor=function(n,t){var r=n.constructor;return r?r[e()]||t:t},rn.unhandledRejection=function(n,t){I&&I.error("Uncaught (in promise)",L?t.longStack:j(n,t))},rn.rejectionHandled=tn,rn.enableLongStackTrace=function(){L=!0},rn.nextTick=F?function(n){E?new E(function(n){n()}).then(n):setTimeout(n)}:H.nextTick,rn._s=1;var on=a(999,function(n,t){var e,r;return(r=n._s!==U?t._onFulfilled:t._onRejected)===P?void x(t,n._s,n._v):(e=s(g)(r,n._v))===nn?void x(t,U,e.e):void k(t,e)}),un=a(9,function(n){m(n)||(n[J]=1,_(Z,n))});try{n.exports=rn}catch(cn){O.Yaku=rn}}()}).call(t,e(/*! ./../~/webpack/buildin/global.js */2))}});
}
if (!('Window' in this)) {
// Window
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
(function (global) {
if (global.constructor) {
global.Window = global.constructor;
} else {
(global.Window = global.constructor = new Function('return function Window() {}')()).prototype = this;
}
}(this));
}
}
if (!("Document" in this)) {
// Document
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
if (this.HTMLDocument) { // IE8
// HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
this.Document = this.HTMLDocument;
} else {
// Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.
this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
this.Document.prototype = document;
}
}
}
if (!('Element' in this && 'HTMLElement' in this)) {
// Element
(function () {
// IE8
if (window.Element && !window.HTMLElement) {
window.HTMLElement = window.Element;
return;
}
// create Element constructor
window.Element = window.HTMLElement = new Function('return function Element() {}')();
// generate sandboxed iframe
var vbody = document.appendChild(document.createElement('body'));
var frame = vbody.appendChild(document.createElement('iframe'));
// use sandboxed iframe to replicate Element functionality
var frameDocument = frame.contentWindow.document;
var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
var cache = {};
// polyfill Element.prototype on an element
var shiv = function (element, deep) {
var
childNodes = element.childNodes || [],
index = -1,
key, value, childNode;
if (element.nodeType === 1 && element.constructor !== Element) {
element.constructor = Element;
for (key in cache) {
value = cache[key];
element[key] = value;
}
}
while (childNode = deep && childNodes[++index]) {
shiv(childNode, deep);
}
return element;
};
var elements = document.getElementsByTagName('*');
var nativeCreateElement = document.createElement;
var interval;
var loopLimit = 100;
prototype.attachEvent('onpropertychange', function (event) {
var
propertyName = event.propertyName,
nonValue = !cache.hasOwnProperty(propertyName),
newValue = prototype[propertyName],
oldValue = cache[propertyName],
index = -1,
element;
while (element = elements[++index]) {
if (element.nodeType === 1) {
if (nonValue || element[propertyName] === oldValue) {
element[propertyName] = newValue;
}
}
}
cache[propertyName] = newValue;
});
prototype.constructor = Element;
if (!prototype.hasAttribute) {
// <Element>.hasAttribute
prototype.hasAttribute = function hasAttribute(name) {
return this.getAttribute(name) !== null;
};
}
// Apply Element prototype to the pre-existing DOM as soon as the body element appears.
function bodyCheck() {
if (!(loopLimit--)) clearTimeout(interval);
if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
shiv(document, true);
if (interval && document.body.prototype) clearTimeout(interval);
return (!!document.body.prototype);
}
return false;
}
if (!bodyCheck()) {
document.onreadystatechange = bodyCheck;
interval = setInterval(bodyCheck, 25);
}
// Apply to any new elements created after load
document.createElement = function createElement(nodeName) {
var element = nativeCreateElement(String(nodeName).toLowerCase());
return shiv(element);
};
// remove sandboxed iframe
document.removeChild(vbody);
}());
}
if (!((function(global) {
if (!('Event' in global)) return false;
if (typeof global.Event === 'function') return true;
try {
// In IE 9-11, the Event object exists but cannot be instantiated
new Event('click');
return true;
} catch(e) {
return false;
}
}(this)))) {
// Event
(function () {
var unlistenableWindowEvents = {
click: 1,
dblclick: 1,
keyup: 1,
keypress: 1,
keydown: 1,
mousedown: 1,
mouseup: 1,
mousemove: 1,
mouseover: 1,
mouseenter: 1,
mouseleave: 1,
mouseout: 1,
storage: 1,
storagecommit: 1,
textinput: 1
};
// This polyfill depends on availability of `document` so will not run in a worker
// However, we asssume there are no browsers with worker support that lack proper
// support for `Event` within the worker
if (typeof document === 'undefined' || typeof window === 'undefined') return;
function indexOf(array, element) {
var
index = -1,
length = array.length;
while (++index < length) {
if (index in array && array[index] === element) {
return index;
}
}
return -1;
}
var existingProto = (window.Event && window.Event.prototype) || null;
function Event(type, eventInitDict) {
if (!type) {
throw new Error('Not enough arguments');
}
var event;
// Shortcut if browser supports createEvent
if ('createEvent' in document) {
event = document.createEvent('Event');
var bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false;
var cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false;
event.initEvent(type, bubbles, cancelable);
return event;
}
event = document.createEventObject();
event.type = type;
event.bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false;
event.cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false;
return event;
};
Event.NONE = 0;
Event.CAPTURING_PHASE = 1;
Event.AT_TARGET = 2;
Event.BUBBLING_PHASE = 3;
window.Event = Window.prototype.Event = Event;
if (existingProto) {
Object.defineProperty(window.Event, 'prototype', {
configurable: false,
enumerable: false,
writable: true,
value: existingProto
});
}
if (!('createEvent' in document)) {
window.addEventListener = Window.prototype.addEventListener = Document.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener() {
var
element = this,
type = arguments[0],
listener = arguments[1];
if (element === window && type in unlistenableWindowEvents) {
throw new Error('In IE8 the event: ' + type + ' is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.');
}
if (!element._events) {
element._events = {};
}
if (!element._events[type]) {
element._events[type] = function (event) {
var
list = element._events[event.type].list,
events = list.slice(),
index = -1,
length = events.length,
eventElement;
event.preventDefault = function preventDefault() {
if (event.cancelable !== false) {
event.returnValue = false;
}
};
event.stopPropagation = function stopPropagation() {
event.cancelBubble = true;
};
event.stopImmediatePropagation = function stopImmediatePropagation() {
event.cancelBubble = true;
event.cancelImmediate = true;
};
event.currentTarget = element;
event.relatedTarget = event.fromElement || null;
event.target = event.target || event.srcElement || element;
event.timeStamp = new Date().getTime();
if (event.clientX) {
event.pageX = event.clientX + document.documentElement.scrollLeft;
event.pageY = event.clientY + document.documentElement.scrollTop;
}
while (++index < length && !event.cancelImmediate) {
if (index in events) {
eventElement = events[index];
if (indexOf(list, eventElement) !== -1 && typeof eventElement === 'function') {
eventElement.call(element, event);
}
}
}
};
element._events[type].list = [];
if (element.attachEvent) {
element.attachEvent('on' + type, element._events[type]);
}
}
element._events[type].list.push(listener);
};
window.removeEventListener = Window.prototype.removeEventListener = Document.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener() {
var
element = this,
type = arguments[0],
listener = arguments[1],
index;
if (element._events && element._events[type] && element._events[type].list) {
index = indexOf(element._events[type].list, listener);
if (index !== -1) {
element._events[type].list.splice(index, 1);
if (!element._events[type].list.length) {
if (element.detachEvent) {
element.detachEvent('on' + type, element._events[type]);
}
delete element._events[type];
}
}
}
};
window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) {
if (!arguments.length) {
throw new Error('Not enough arguments');
}
if (!event || typeof event.type !== 'string') {
throw new Error('DOM Events Exception 0');
}
var element = this, type = event.type;
try {
if (!event.bubbles) {
event.cancelBubble = true;
var cancelBubbleEvent = function (event) {
event.cancelBubble = true;
(element || window).detachEvent('on' + type, cancelBubbleEvent);
};
this.attachEvent('on' + type, cancelBubbleEvent);
}
this.fireEvent('on' + type, event);
} catch (error) {
event.target = element;
do {
event.currentTarget = element;
if ('_events' in element && typeof element._events[type] === 'function') {
element._events[type].call(element, event);
}
if (typeof element['on' + type] === 'function') {
element['on' + type].call(element, event);
}
element = element.nodeType === 9 ? element.parentWindow : element.parentNode;
} while (element && !event.cancelBubble);
}
return true;
};
// Add the DOMContentLoaded Event
document.attachEvent('onreadystatechange', function() {
if (document.readyState === 'complete') {
document.dispatchEvent(new Event('DOMContentLoaded', {
bubbles: true
}));
}
});
}
}());
}
if (!('XMLHttpRequest' in this && 'prototype' in this.XMLHttpRequest && 'addEventListener' in this.XMLHttpRequest.prototype)) {
// XMLHttpRequest
(function (global, NativeXMLHttpRequest) {
// <Global>.XMLHttpRequest
global.XMLHttpRequest = function XMLHttpRequest() {
var request = this, nativeRequest = request._request = NativeXMLHttpRequest ? new NativeXMLHttpRequest() : new ActiveXObject('MSXML2.XMLHTTP.3.0');
nativeRequest.onreadystatechange = function () {
request.readyState = nativeRequest.readyState;
var readyState = request.readyState === 4;
request.response = request.responseText = readyState ? nativeRequest.responseText : null;
request.status = readyState ? nativeRequest.status : null;
request.statusText = readyState ? nativeRequest.statusText : null;
request.dispatchEvent(new Event('readystatechange'));
if (readyState) {
request.dispatchEvent(new Event('load'));
}
};
if ('onerror' in nativeRequest) {
nativeRequest.onerror = function () {
request.dispatchEvent(new Event('error'));
};
}
};
global.XMLHttpRequest.UNSENT = 0;
global.XMLHttpRequest.OPENED = 1;
global.XMLHttpRequest.HEADERS_RECEIVED = 2;
global.XMLHttpRequest.LOADING = 3;
global.XMLHttpRequest.DONE = 4;
var XMLHttpRequestPrototype = global.XMLHttpRequest.prototype;
XMLHttpRequestPrototype.addEventListener = global.addEventListener;
XMLHttpRequestPrototype.removeEventListener = global.removeEventListener;
XMLHttpRequestPrototype.dispatchEvent = global.dispatchEvent;
XMLHttpRequestPrototype.abort = function abort() {
return this._request();
};
XMLHttpRequestPrototype.getAllResponseHeaders = function getAllResponseHeaders() {
return this._request.getAllResponseHeaders();
};
XMLHttpRequestPrototype.getResponseHeader = function getResponseHeader(header) {
return this._request.getResponseHeader(header);
};
XMLHttpRequestPrototype.open = function open(method, url) {
// method, url, async, username, password
this._request.open(method, url, arguments[2], arguments[3], arguments[4]);
};
XMLHttpRequestPrototype.overrideMimeType = function overrideMimeType(mimetype) {
this._request.overrideMimeType(mimetype);
};
XMLHttpRequestPrototype.send = function send() {
this._request.send(0 in arguments ? arguments[0] : null);
};
XMLHttpRequestPrototype.setRequestHeader = function setRequestHeader(header, value) {
this._request.setRequestHeader(header, value);
};
}(this, this.XMLHttpRequest));
}
if (!('fetch' in this)) {
// fetch
(function(self) {
'use strict';
var support = {
searchParams: 'URLSearchParams' in self,
iterable: 'Symbol' in self && 'iterator' in Symbol,
blob: 'FileReader' in self && 'Blob' in self && (function() {
try {
new Blob()
return true
} catch(e) {
return false
}
})(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self
}
if (support.arrayBuffer) {
var viewClasses = [
'[object Int8Array]',
'[object Uint8Array]',
'[object Uint8ClampedArray]',
'[object Int16Array]',
'[object Uint16Array]',
'[object Int32Array]',
'[object Uint32Array]',
'[object Float32Array]',
'[object Float64Array]'
]
var isDataView = function(obj) {
return obj && DataView.prototype.isPrototypeOf(obj)
}
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
}
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name)
}
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field name')
}
return name.toLowerCase()
}
function normalizeValue(value) {
if (typeof value !== 'string') {
value = String(value)
}
return value
}
// Build a destructive iterator for the value list
function iteratorFor(items) {
var iterator = {
next: function() {
var value = items.shift()
return {done: value === undefined, value: value}
}
}
if (support.iterable) {
iterator[Symbol.iterator] = function() {
return iterator
}
}
return iterator
}
function Headers(headers) {
this.map = {}
if (headers instanceof Headers) {
headers.forEach(function(value, name) {
this.append(name, value)
}, this)
} else if (Array.isArray(headers)) {
headers.forEach(function(header) {
this.append(header[0], header[1])
}, this)
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function(name) {
this.append(name, headers[name])
}, this)
}
}
Headers.prototype.append = function(name, value) {
name = normalizeName(name)
value = normalizeValue(value)
var oldValue = this.map[name]
this.map[name] = oldValue ? oldValue+','+value : value
}
Headers.prototype['delete'] = function(name) {
delete this.map[normalizeName(name)]
}
Headers.prototype.get = function(name) {
name = normalizeName(name)
return this.has(name) ? this.map[name] : null
}
Headers.prototype.has = function(name) {
return this.map.hasOwnProperty(normalizeName(name))
}
Headers.prototype.set = function(name, value) {
this.map[normalizeName(name)] = normalizeValue(value)
}
Headers.prototype.forEach = function(callback, thisArg) {
for (var name in this.map) {
if (this.map.hasOwnProperty(name)) {
callback.call(thisArg, this.map[name], name, this)
}
}
}
Headers.prototype.keys = function() {
var items = []
this.forEach(function(value, name) { items.push(name) })
return iteratorFor(items)
}
Headers.prototype.values = function() {
var items = []
this.forEach(function(value) { items.push(value) })
return iteratorFor(items)
}
Headers.prototype.entries = function() {
var items = []
this.forEach(function(value, name) { items.push([name, value]) })
return iteratorFor(items)
}
if (support.iterable) {
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed = true
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result)
}
reader.onerror = function() {
reject(reader.error)
}
})
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsArrayBuffer(blob)
return promise
}
function readBlobAsText(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsText(blob)
return promise
}
function readArrayBufferAsText(buf) {
var view = new Uint8Array(buf)
var chars = new Array(view.length)
for (var i = 0; i < view.length; i++) {
chars[i] = String.fromCharCode(view[i])
}
return chars.join('')
}
function bufferClone(buf) {
if (buf.slice) {
return buf.slice(0)
} else {
var view = new Uint8Array(buf.byteLength)
view.set(new Uint8Array(buf))
return view.buffer
}
}
function Body() {
this.bodyUsed = false
this._initBody = function(body) {
this._bodyInit = body
if (!body) {
this._bodyText = ''
} else if (typeof body === 'string') {
this._bodyText = body
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this._bodyText = body.toString()
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
this._bodyArrayBuffer = bufferClone(body.buffer)
// IE 10-11 can't handle a DataView body.
this._bodyInit = new Blob([this._bodyArrayBuffer])
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
this._bodyArrayBuffer = bufferClone(body)
} else {
throw new Error('unsupported BodyInit type')
}
if (!this.headers.get('content-type')) {
if (typeof body === 'string') {
this.headers.set('content-type', 'text/plain;charset=UTF-8')
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set('content-type', this._bodyBlob.type)
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
}
}
}
if (support.blob) {
this.blob = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
return Promise.resolve(new Blob([this._bodyText]))
}
}
this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
} else {
return this.blob().then(readBlobAsArrayBuffer)
}
}
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
}
if (support.formData) {
this.formData = function() {
return this.text().then(decode)
}
}
this.json = function() {
return this.text().then(JSON.parse)
}
return this
}
// HTTP methods whose capitalization should be normalized
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
function normalizeMethod(method) {
var upcased = method.toUpperCase()
return (methods.indexOf(upcased) > -1) ? upcased : method
}
function Request(input, options) {
options = options || {}
var body = options.body
if (input instanceof Request) {
if (input.bodyUsed) {
throw new TypeError('Already read')
}
this.url = input.url
this.credentials = input.credentials
if (!options.headers) {
this.headers = new Headers(input.headers)
}
this.method = input.method
this.mode = input.mode
if (!body && input._bodyInit != null) {
body = input._bodyInit
input.bodyUsed = true
}
} else {
this.url = String(input)
}
this.credentials = options.credentials || this.credentials || 'omit'
if (options.headers || !this.headers) {
this.headers = new Headers(options.headers)
}
this.method = normalizeMethod(options.method || this.method || 'GET')
this.mode = options.mode || this.mode || null
this.referrer = null
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
throw new TypeError('Body not allowed for GET or HEAD requests')
}
this._initBody(body)
}
Request.prototype.clone = function() {
return new Request(this, { body: this._bodyInit })
}
function decode(body) {
var form = new FormData()
body.trim().split('&').forEach(function(bytes) {
if (bytes) {
var split = bytes.split('=')
var name = split.shift().replace(/\+/g, ' ')
var value = split.join('=').replace(/\+/g, ' ')
form.append(decodeURIComponent(name), decodeURIComponent(value))
}
})
return form
}
function parseHeaders(rawHeaders) {
var headers = new Headers()
rawHeaders.split(/\r?\n/).forEach(function(line) {
var parts = line.split(':')
var key = parts.shift().trim()
if (key) {
var value = parts.join(':').trim()
headers.append(key, value)
}
})
return headers
}
Body.call(Request.prototype)
function Response(bodyInit, options) {
if (!options) {
options = {}
}
this.type = 'default'
this.status = 'status' in options ? options.status : 200
this.ok = this.status >= 200 && this.status < 300
this.statusText = 'statusText' in options ? options.statusText : 'OK'
this.headers = new Headers(options.headers)
this.url = options.url || ''
this._initBody(bodyInit)
}
Body.call(Response.prototype)
Response.prototype.clone = function() {
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
})
}
Response.error = function() {
var response = new Response(null, {status: 0, statusText: ''})
response.type = 'error'
return response
}
var redirectStatuses = [301, 302, 303, 307, 308]
Response.redirect = function(url, status) {
if (redirectStatuses.indexOf(status) === -1) {
throw new RangeError('Invalid status code')
}
return new Response(null, {status: status, headers: {location: url}})
}
self.Headers = Headers
self.Request = Request
self.Response = Response
self.fetch = function(input, init) {
return new Promise(function(resolve, reject) {
var request = new Request(input, init)
var xhr = new