@tryghost/content-api 1.9.6 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/content-api.js +13 -8
- package/es/content-api.js +1268 -91
- package/es/content-api.js.map +1 -1
- package/lib/content-api.js +5 -1
- package/package.json +8 -7
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import url from 'url';
|
|
2
|
-
|
|
3
1
|
function _defineProperty(obj, key, value) {
|
|
4
2
|
if (key in obj) {
|
|
5
3
|
Object.defineProperty(obj, key, {
|
|
@@ -145,7 +143,7 @@ var isCallable = function (argument) {
|
|
|
145
143
|
return typeof argument == 'function';
|
|
146
144
|
};
|
|
147
145
|
|
|
148
|
-
var isObject$
|
|
146
|
+
var isObject$2 = function (it) {
|
|
149
147
|
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
150
148
|
};
|
|
151
149
|
|
|
@@ -247,25 +245,25 @@ var TypeError$f = global_1.TypeError;
|
|
|
247
245
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
248
246
|
var ordinaryToPrimitive = function (input, pref) {
|
|
249
247
|
var fn, val;
|
|
250
|
-
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$
|
|
251
|
-
if (isCallable(fn = input.valueOf) && !isObject$
|
|
252
|
-
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$
|
|
248
|
+
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$2(val = functionCall(fn, input))) return val;
|
|
249
|
+
if (isCallable(fn = input.valueOf) && !isObject$2(val = functionCall(fn, input))) return val;
|
|
250
|
+
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$2(val = functionCall(fn, input))) return val;
|
|
253
251
|
throw TypeError$f("Can't convert object to primitive value");
|
|
254
252
|
};
|
|
255
253
|
|
|
256
254
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
257
|
-
var defineProperty$
|
|
255
|
+
var defineProperty$4 = Object.defineProperty;
|
|
258
256
|
|
|
259
|
-
var
|
|
257
|
+
var defineGlobalProperty = function (key, value) {
|
|
260
258
|
try {
|
|
261
|
-
defineProperty$
|
|
259
|
+
defineProperty$4(global_1, key, { value: value, configurable: true, writable: true });
|
|
262
260
|
} catch (error) {
|
|
263
261
|
global_1[key] = value;
|
|
264
262
|
} return value;
|
|
265
263
|
};
|
|
266
264
|
|
|
267
265
|
var SHARED = '__core-js_shared__';
|
|
268
|
-
var store$1 = global_1[SHARED] ||
|
|
266
|
+
var store$1 = global_1[SHARED] || defineGlobalProperty(SHARED, {});
|
|
269
267
|
|
|
270
268
|
var sharedStore = store$1;
|
|
271
269
|
|
|
@@ -273,10 +271,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
273
271
|
(module.exports = function (key, value) {
|
|
274
272
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
275
273
|
})('versions', []).push({
|
|
276
|
-
version: '3.22.
|
|
274
|
+
version: '3.22.7',
|
|
277
275
|
mode: 'global',
|
|
278
276
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
279
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
277
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.7/LICENSE',
|
|
280
278
|
source: 'https://github.com/zloirock/core-js'
|
|
281
279
|
});
|
|
282
280
|
});
|
|
@@ -289,13 +287,13 @@ var toObject = function (argument) {
|
|
|
289
287
|
return Object$2(requireObjectCoercible(argument));
|
|
290
288
|
};
|
|
291
289
|
|
|
292
|
-
var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
290
|
+
var hasOwnProperty$1 = functionUncurryThis({}.hasOwnProperty);
|
|
293
291
|
|
|
294
292
|
// `HasOwnProperty` abstract operation
|
|
295
293
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
296
294
|
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
297
295
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
298
|
-
return hasOwnProperty(toObject(it), key);
|
|
296
|
+
return hasOwnProperty$1(toObject(it), key);
|
|
299
297
|
};
|
|
300
298
|
|
|
301
299
|
var id = 0;
|
|
@@ -330,13 +328,13 @@ var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
|
330
328
|
// `ToPrimitive` abstract operation
|
|
331
329
|
// https://tc39.es/ecma262/#sec-toprimitive
|
|
332
330
|
var toPrimitive = function (input, pref) {
|
|
333
|
-
if (!isObject$
|
|
331
|
+
if (!isObject$2(input) || isSymbol(input)) return input;
|
|
334
332
|
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
335
333
|
var result;
|
|
336
334
|
if (exoticToPrim) {
|
|
337
335
|
if (pref === undefined) pref = 'default';
|
|
338
336
|
result = functionCall(exoticToPrim, input, pref);
|
|
339
|
-
if (!isObject$
|
|
337
|
+
if (!isObject$2(result) || isSymbol(result)) return result;
|
|
340
338
|
throw TypeError$e("Can't convert object to primitive value");
|
|
341
339
|
}
|
|
342
340
|
if (pref === undefined) pref = 'number';
|
|
@@ -352,7 +350,7 @@ var toPropertyKey = function (argument) {
|
|
|
352
350
|
|
|
353
351
|
var document$3 = global_1.document;
|
|
354
352
|
// typeof document.createElement is 'object' in old IE
|
|
355
|
-
var EXISTS$1 = isObject$
|
|
353
|
+
var EXISTS$1 = isObject$2(document$3) && isObject$2(document$3.createElement);
|
|
356
354
|
|
|
357
355
|
var documentCreateElement = function (it) {
|
|
358
356
|
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
@@ -399,7 +397,7 @@ var TypeError$d = global_1.TypeError;
|
|
|
399
397
|
|
|
400
398
|
// `Assert: Type(argument) is Object`
|
|
401
399
|
var anObject = function (argument) {
|
|
402
|
-
if (isObject$
|
|
400
|
+
if (isObject$2(argument)) return argument;
|
|
403
401
|
throw TypeError$d(String$4(argument) + ' is not an object');
|
|
404
402
|
};
|
|
405
403
|
|
|
@@ -502,7 +500,7 @@ var enforce = function (it) {
|
|
|
502
500
|
var getterFor = function (TYPE) {
|
|
503
501
|
return function (it) {
|
|
504
502
|
var state;
|
|
505
|
-
if (!isObject$
|
|
503
|
+
if (!isObject$2(it) || (state = get(it)).type !== TYPE) {
|
|
506
504
|
throw TypeError$b('Incompatible receiver, ' + TYPE + ' required');
|
|
507
505
|
} return state;
|
|
508
506
|
};
|
|
@@ -551,15 +549,16 @@ var internalState = {
|
|
|
551
549
|
};
|
|
552
550
|
|
|
553
551
|
var makeBuiltIn_1 = createCommonjsModule(function (module) {
|
|
554
|
-
var defineProperty = objectDefineProperty.f;
|
|
555
552
|
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
556
553
|
|
|
557
554
|
|
|
558
555
|
|
|
559
556
|
var enforceInternalState = internalState.enforce;
|
|
560
557
|
var getInternalState = internalState.get;
|
|
558
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
559
|
+
var defineProperty = Object.defineProperty;
|
|
561
560
|
|
|
562
|
-
var CONFIGURABLE_LENGTH = !fails(function () {
|
|
561
|
+
var CONFIGURABLE_LENGTH = descriptors$1 && !fails(function () {
|
|
563
562
|
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
564
563
|
});
|
|
565
564
|
|
|
@@ -577,6 +576,12 @@ var makeBuiltIn = module.exports = function (value, name, options) {
|
|
|
577
576
|
if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
|
|
578
577
|
defineProperty(value, 'length', { value: options.arity });
|
|
579
578
|
}
|
|
579
|
+
try {
|
|
580
|
+
if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) {
|
|
581
|
+
if (descriptors$1) defineProperty(value, 'prototype', { writable: false });
|
|
582
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
583
|
+
} else if (value.prototype) value.prototype = undefined;
|
|
584
|
+
} catch (error) { /* empty */ }
|
|
580
585
|
var state = enforceInternalState(value);
|
|
581
586
|
if (!hasOwnProperty_1(state, 'source')) {
|
|
582
587
|
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
@@ -591,34 +596,38 @@ Function.prototype.toString = makeBuiltIn(function toString() {
|
|
|
591
596
|
});
|
|
592
597
|
|
|
593
598
|
var defineBuiltIn = function (O, key, value, options) {
|
|
594
|
-
|
|
595
|
-
var simple = options
|
|
596
|
-
var
|
|
597
|
-
var name = options && options.name !== undefined ? options.name : key;
|
|
599
|
+
if (!options) options = {};
|
|
600
|
+
var simple = options.enumerable;
|
|
601
|
+
var name = options.name !== undefined ? options.name : key;
|
|
598
602
|
if (isCallable(value)) makeBuiltIn_1(value, name, options);
|
|
599
|
-
if (
|
|
603
|
+
if (options.global) {
|
|
600
604
|
if (simple) O[key] = value;
|
|
601
|
-
else
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
if (simple) O[key] = value;
|
|
609
|
-
else createNonEnumerableProperty(O, key, value);
|
|
610
|
-
return O;
|
|
605
|
+
else defineGlobalProperty(key, value);
|
|
606
|
+
} else {
|
|
607
|
+
if (!options.unsafe) delete O[key];
|
|
608
|
+
else if (O[key]) simple = true;
|
|
609
|
+
if (simple) O[key] = value;
|
|
610
|
+
else createNonEnumerableProperty(O, key, value);
|
|
611
|
+
} return O;
|
|
611
612
|
};
|
|
612
613
|
|
|
613
614
|
var ceil = Math.ceil;
|
|
614
|
-
var floor = Math.floor;
|
|
615
|
+
var floor$1 = Math.floor;
|
|
616
|
+
|
|
617
|
+
// `Math.trunc` method
|
|
618
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
619
|
+
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
620
|
+
var mathTrunc = Math.trunc || function trunc(x) {
|
|
621
|
+
var n = +x;
|
|
622
|
+
return (n > 0 ? floor$1 : ceil)(n);
|
|
623
|
+
};
|
|
615
624
|
|
|
616
625
|
// `ToIntegerOrInfinity` abstract operation
|
|
617
626
|
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
618
627
|
var toIntegerOrInfinity = function (argument) {
|
|
619
628
|
var number = +argument;
|
|
620
|
-
// eslint-disable-next-line no-self-compare --
|
|
621
|
-
return number !== number || number === 0 ? 0 : (number
|
|
629
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
630
|
+
return number !== number || number === 0 ? 0 : mathTrunc(number);
|
|
622
631
|
};
|
|
623
632
|
|
|
624
633
|
var max = Math.max;
|
|
@@ -773,19 +782,19 @@ var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
|
|
|
773
782
|
|
|
774
783
|
|
|
775
784
|
/*
|
|
776
|
-
options.target
|
|
777
|
-
options.global
|
|
778
|
-
options.stat
|
|
779
|
-
options.proto
|
|
780
|
-
options.real
|
|
781
|
-
options.forced
|
|
782
|
-
options.bind
|
|
783
|
-
options.wrap
|
|
784
|
-
options.unsafe
|
|
785
|
-
options.sham
|
|
786
|
-
options.enumerable
|
|
787
|
-
options.
|
|
788
|
-
options.name
|
|
785
|
+
options.target - name of the target object
|
|
786
|
+
options.global - target is the global object
|
|
787
|
+
options.stat - export as static methods of target
|
|
788
|
+
options.proto - export as prototype methods of target
|
|
789
|
+
options.real - real prototype method for the `pure` version
|
|
790
|
+
options.forced - export even if the native feature is available
|
|
791
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
792
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
793
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
794
|
+
options.sham - add a flag to not completely full polyfills
|
|
795
|
+
options.enumerable - export as enumerable property
|
|
796
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
797
|
+
options.name - the .name of the function if it does not match the key
|
|
789
798
|
*/
|
|
790
799
|
var _export = function (options, source) {
|
|
791
800
|
var TARGET = options.target;
|
|
@@ -795,13 +804,13 @@ var _export = function (options, source) {
|
|
|
795
804
|
if (GLOBAL) {
|
|
796
805
|
target = global_1;
|
|
797
806
|
} else if (STATIC) {
|
|
798
|
-
target = global_1[TARGET] ||
|
|
807
|
+
target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
|
|
799
808
|
} else {
|
|
800
809
|
target = (global_1[TARGET] || {}).prototype;
|
|
801
810
|
}
|
|
802
811
|
if (target) for (key in source) {
|
|
803
812
|
sourceProperty = source[key];
|
|
804
|
-
if (options.
|
|
813
|
+
if (options.dontCallGetSet) {
|
|
805
814
|
descriptor = getOwnPropertyDescriptor$3(target, key);
|
|
806
815
|
targetProperty = descriptor && descriptor.value;
|
|
807
816
|
} else targetProperty = target[key];
|
|
@@ -904,7 +913,7 @@ var regexpStickyHelpers = {
|
|
|
904
913
|
// `Object.keys` method
|
|
905
914
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
906
915
|
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
907
|
-
var objectKeys = Object.keys || function keys(O) {
|
|
916
|
+
var objectKeys$1 = Object.keys || function keys(O) {
|
|
908
917
|
return objectKeysInternal(O, enumBugKeys);
|
|
909
918
|
};
|
|
910
919
|
|
|
@@ -914,7 +923,7 @@ var objectKeys = Object.keys || function keys(O) {
|
|
|
914
923
|
var f$1 = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
915
924
|
anObject(O);
|
|
916
925
|
var props = toIndexedObject(Properties);
|
|
917
|
-
var keys = objectKeys(Properties);
|
|
926
|
+
var keys = objectKeys$1(Properties);
|
|
918
927
|
var length = keys.length;
|
|
919
928
|
var index = 0;
|
|
920
929
|
var key;
|
|
@@ -1351,20 +1360,20 @@ if (!toStringTagSupport) {
|
|
|
1351
1360
|
defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
1352
1361
|
}
|
|
1353
1362
|
|
|
1354
|
-
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
1363
|
+
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys$1(1); });
|
|
1355
1364
|
|
|
1356
1365
|
// `Object.keys` method
|
|
1357
1366
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
1358
1367
|
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
1359
1368
|
keys: function keys(it) {
|
|
1360
|
-
return objectKeys(toObject(it));
|
|
1369
|
+
return objectKeys$1(toObject(it));
|
|
1361
1370
|
}
|
|
1362
1371
|
});
|
|
1363
1372
|
|
|
1364
1373
|
// `IsArray` abstract operation
|
|
1365
1374
|
// https://tc39.es/ecma262/#sec-isarray
|
|
1366
1375
|
// eslint-disable-next-line es-x/no-array-isarray -- safe
|
|
1367
|
-
var isArray$
|
|
1376
|
+
var isArray$2 = Array.isArray || function isArray(argument) {
|
|
1368
1377
|
return classofRaw(argument) == 'Array';
|
|
1369
1378
|
};
|
|
1370
1379
|
|
|
@@ -1427,11 +1436,11 @@ var Array$1 = global_1.Array;
|
|
|
1427
1436
|
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1428
1437
|
var arraySpeciesConstructor = function (originalArray) {
|
|
1429
1438
|
var C;
|
|
1430
|
-
if (isArray$
|
|
1439
|
+
if (isArray$2(originalArray)) {
|
|
1431
1440
|
C = originalArray.constructor;
|
|
1432
1441
|
// cross-realm fallback
|
|
1433
|
-
if (isConstructor(C) && (C === Array$1 || isArray$
|
|
1434
|
-
else if (isObject$
|
|
1442
|
+
if (isConstructor(C) && (C === Array$1 || isArray$2(C.prototype))) C = undefined;
|
|
1443
|
+
else if (isObject$2(C)) {
|
|
1435
1444
|
C = C[SPECIES$4];
|
|
1436
1445
|
if (C === null) C = undefined;
|
|
1437
1446
|
}
|
|
@@ -1477,9 +1486,9 @@ var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
|
1477
1486
|
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
1478
1487
|
|
|
1479
1488
|
var isConcatSpreadable = function (O) {
|
|
1480
|
-
if (!isObject$
|
|
1489
|
+
if (!isObject$2(O)) return false;
|
|
1481
1490
|
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
1482
|
-
return spreadable !== undefined ? !!spreadable : isArray$
|
|
1491
|
+
return spreadable !== undefined ? !!spreadable : isArray$2(O);
|
|
1483
1492
|
};
|
|
1484
1493
|
|
|
1485
1494
|
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
@@ -1510,13 +1519,15 @@ _export({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
|
1510
1519
|
}
|
|
1511
1520
|
});
|
|
1512
1521
|
|
|
1522
|
+
var defineProperty$3 = objectDefineProperty.f;
|
|
1523
|
+
|
|
1513
1524
|
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
1514
1525
|
var ArrayPrototype$1 = Array.prototype;
|
|
1515
1526
|
|
|
1516
1527
|
// Array.prototype[@@unscopables]
|
|
1517
1528
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1518
1529
|
if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
|
|
1519
|
-
|
|
1530
|
+
defineProperty$3(ArrayPrototype$1, UNSCOPABLES, {
|
|
1520
1531
|
configurable: true,
|
|
1521
1532
|
value: objectCreate(null)
|
|
1522
1533
|
});
|
|
@@ -1553,7 +1564,7 @@ var MATCH$1 = wellKnownSymbol('match');
|
|
|
1553
1564
|
// https://tc39.es/ecma262/#sec-isregexp
|
|
1554
1565
|
var isRegexp = function (it) {
|
|
1555
1566
|
var isRegExp;
|
|
1556
|
-
return isObject$
|
|
1567
|
+
return isObject$2(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
1557
1568
|
};
|
|
1558
1569
|
|
|
1559
1570
|
var TypeError$8 = global_1.TypeError;
|
|
@@ -2098,7 +2109,7 @@ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
|
2098
2109
|
// helpers
|
|
2099
2110
|
var isThenable = function (it) {
|
|
2100
2111
|
var then;
|
|
2101
|
-
return isObject$
|
|
2112
|
+
return isObject$2(it) && isCallable(then = it.then) ? then : false;
|
|
2102
2113
|
};
|
|
2103
2114
|
|
|
2104
2115
|
var callReaction = function (reaction, state) {
|
|
@@ -2326,7 +2337,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
2326
2337
|
}
|
|
2327
2338
|
}
|
|
2328
2339
|
|
|
2329
|
-
_export({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2340
|
+
_export({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2330
2341
|
Promise: PromiseConstructor
|
|
2331
2342
|
});
|
|
2332
2343
|
|
|
@@ -2564,7 +2575,7 @@ _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 },
|
|
|
2564
2575
|
|
|
2565
2576
|
var promiseResolve = function (C, x) {
|
|
2566
2577
|
anObject(C);
|
|
2567
|
-
if (isObject$
|
|
2578
|
+
if (isObject$2(x) && x.constructor === C) return x;
|
|
2568
2579
|
var promiseCapability = newPromiseCapability$1.f(C);
|
|
2569
2580
|
var resolve = promiseCapability.resolve;
|
|
2570
2581
|
resolve(x);
|
|
@@ -2611,7 +2622,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2611
2622
|
var alphabet = 'abcdefghijklmnopqrst';
|
|
2612
2623
|
A[symbol] = 7;
|
|
2613
2624
|
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
|
2614
|
-
return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
|
|
2625
|
+
return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet;
|
|
2615
2626
|
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
|
|
2616
2627
|
var T = toObject(target);
|
|
2617
2628
|
var argumentsLength = arguments.length;
|
|
@@ -2620,7 +2631,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2620
2631
|
var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
|
2621
2632
|
while (argumentsLength > index) {
|
|
2622
2633
|
var S = indexedObject(arguments[index++]);
|
|
2623
|
-
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
|
|
2634
|
+
var keys = getOwnPropertySymbols ? concat(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S);
|
|
2624
2635
|
var length = keys.length;
|
|
2625
2636
|
var j = 0;
|
|
2626
2637
|
var key;
|
|
@@ -2855,7 +2866,7 @@ function getProtocol(protocol) {
|
|
|
2855
2866
|
* @param {Object} val The value to test
|
|
2856
2867
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
2857
2868
|
*/
|
|
2858
|
-
function isArray(val) {
|
|
2869
|
+
function isArray$1(val) {
|
|
2859
2870
|
return Array.isArray(val);
|
|
2860
2871
|
}
|
|
2861
2872
|
|
|
@@ -2912,7 +2923,7 @@ function isArrayBufferView(val) {
|
|
|
2912
2923
|
* @param {Object} val The value to test
|
|
2913
2924
|
* @returns {boolean} True if value is a String, otherwise false
|
|
2914
2925
|
*/
|
|
2915
|
-
function isString(val) {
|
|
2926
|
+
function isString$1(val) {
|
|
2916
2927
|
return typeof val === 'string';
|
|
2917
2928
|
}
|
|
2918
2929
|
|
|
@@ -2932,7 +2943,7 @@ function isNumber(val) {
|
|
|
2932
2943
|
* @param {Object} val The value to test
|
|
2933
2944
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
2934
2945
|
*/
|
|
2935
|
-
function isObject(val) {
|
|
2946
|
+
function isObject$1(val) {
|
|
2936
2947
|
return val !== null && typeof val === 'object';
|
|
2937
2948
|
}
|
|
2938
2949
|
|
|
@@ -3004,7 +3015,7 @@ function isFunction(val) {
|
|
|
3004
3015
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
3005
3016
|
*/
|
|
3006
3017
|
function isStream(val) {
|
|
3007
|
-
return isObject(val) && isFunction(val.pipe);
|
|
3018
|
+
return isObject$1(val) && isFunction(val.pipe);
|
|
3008
3019
|
}
|
|
3009
3020
|
|
|
3010
3021
|
/**
|
|
@@ -3091,7 +3102,7 @@ function forEach(obj, fn) {
|
|
|
3091
3102
|
obj = [obj];
|
|
3092
3103
|
}
|
|
3093
3104
|
|
|
3094
|
-
if (isArray(obj)) {
|
|
3105
|
+
if (isArray$1(obj)) {
|
|
3095
3106
|
// Iterate over array values
|
|
3096
3107
|
for (var i = 0, l = obj.length; i < l; i++) {
|
|
3097
3108
|
fn.call(null, obj[i], i, obj);
|
|
@@ -3130,7 +3141,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
3130
3141
|
result[key] = merge(result[key], val);
|
|
3131
3142
|
} else if (isPlainObject(val)) {
|
|
3132
3143
|
result[key] = merge({}, val);
|
|
3133
|
-
} else if (isArray(val)) {
|
|
3144
|
+
} else if (isArray$1(val)) {
|
|
3134
3145
|
result[key] = val.slice();
|
|
3135
3146
|
} else {
|
|
3136
3147
|
result[key] = val;
|
|
@@ -3266,14 +3277,14 @@ var isTypedArray = (function(TypedArray) {
|
|
|
3266
3277
|
var utils = {
|
|
3267
3278
|
supportedProtocols: supportedProtocols,
|
|
3268
3279
|
getProtocol: getProtocol,
|
|
3269
|
-
isArray: isArray,
|
|
3280
|
+
isArray: isArray$1,
|
|
3270
3281
|
isArrayBuffer: isArrayBuffer,
|
|
3271
3282
|
isBuffer: isBuffer,
|
|
3272
3283
|
isFormData: isFormData,
|
|
3273
3284
|
isArrayBufferView: isArrayBufferView,
|
|
3274
|
-
isString: isString,
|
|
3285
|
+
isString: isString$1,
|
|
3275
3286
|
isNumber: isNumber,
|
|
3276
|
-
isObject: isObject,
|
|
3287
|
+
isObject: isObject$1,
|
|
3277
3288
|
isPlainObject: isPlainObject,
|
|
3278
3289
|
isUndefined: isUndefined,
|
|
3279
3290
|
isDate: isDate,
|
|
@@ -3298,7 +3309,7 @@ var utils = {
|
|
|
3298
3309
|
isFileList: isFileList
|
|
3299
3310
|
};
|
|
3300
3311
|
|
|
3301
|
-
function encode(val) {
|
|
3312
|
+
function encode$1(val) {
|
|
3302
3313
|
return encodeURIComponent(val).
|
|
3303
3314
|
replace(/%3A/gi, ':').
|
|
3304
3315
|
replace(/%24/g, '$').
|
|
@@ -3346,7 +3357,7 @@ var buildURL = function buildURL(url, params, paramsSerializer) {
|
|
|
3346
3357
|
} else if (utils.isObject(v)) {
|
|
3347
3358
|
v = JSON.stringify(v);
|
|
3348
3359
|
}
|
|
3349
|
-
parts.push(encode(key) + '=' + encode(v));
|
|
3360
|
+
parts.push(encode$1(key) + '=' + encode$1(v));
|
|
3350
3361
|
});
|
|
3351
3362
|
});
|
|
3352
3363
|
|
|
@@ -3815,6 +3826,1167 @@ var isURLSameOrigin = (
|
|
|
3815
3826
|
})()
|
|
3816
3827
|
);
|
|
3817
3828
|
|
|
3829
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
3830
|
+
|
|
3831
|
+
|
|
3832
|
+
/** Highest positive signed 32-bit float value */
|
|
3833
|
+
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
|
3834
|
+
|
|
3835
|
+
/** Bootstring parameters */
|
|
3836
|
+
var base = 36;
|
|
3837
|
+
var tMin = 1;
|
|
3838
|
+
var tMax = 26;
|
|
3839
|
+
var skew = 38;
|
|
3840
|
+
var damp = 700;
|
|
3841
|
+
var initialBias = 72;
|
|
3842
|
+
var initialN = 128; // 0x80
|
|
3843
|
+
var delimiter = '-'; // '\x2D'
|
|
3844
|
+
var regexNonASCII = /[^\x20-\x7E]/; // unprintable ASCII chars + non-ASCII chars
|
|
3845
|
+
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
3846
|
+
|
|
3847
|
+
/** Error messages */
|
|
3848
|
+
var errors = {
|
|
3849
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
3850
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
3851
|
+
'invalid-input': 'Invalid input'
|
|
3852
|
+
};
|
|
3853
|
+
|
|
3854
|
+
/** Convenience shortcuts */
|
|
3855
|
+
var baseMinusTMin = base - tMin;
|
|
3856
|
+
var floor = Math.floor;
|
|
3857
|
+
var stringFromCharCode = String.fromCharCode;
|
|
3858
|
+
|
|
3859
|
+
/*--------------------------------------------------------------------------*/
|
|
3860
|
+
|
|
3861
|
+
/**
|
|
3862
|
+
* A generic error utility function.
|
|
3863
|
+
* @private
|
|
3864
|
+
* @param {String} type The error type.
|
|
3865
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
3866
|
+
*/
|
|
3867
|
+
function error(type) {
|
|
3868
|
+
throw new RangeError(errors[type]);
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
/**
|
|
3872
|
+
* A generic `Array#map` utility function.
|
|
3873
|
+
* @private
|
|
3874
|
+
* @param {Array} array The array to iterate over.
|
|
3875
|
+
* @param {Function} callback The function that gets called for every array
|
|
3876
|
+
* item.
|
|
3877
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
3878
|
+
*/
|
|
3879
|
+
function map$1(array, fn) {
|
|
3880
|
+
var length = array.length;
|
|
3881
|
+
var result = [];
|
|
3882
|
+
while (length--) {
|
|
3883
|
+
result[length] = fn(array[length]);
|
|
3884
|
+
}
|
|
3885
|
+
return result;
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
/**
|
|
3889
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
3890
|
+
* addresses.
|
|
3891
|
+
* @private
|
|
3892
|
+
* @param {String} domain The domain name or email address.
|
|
3893
|
+
* @param {Function} callback The function that gets called for every
|
|
3894
|
+
* character.
|
|
3895
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
3896
|
+
* function.
|
|
3897
|
+
*/
|
|
3898
|
+
function mapDomain(string, fn) {
|
|
3899
|
+
var parts = string.split('@');
|
|
3900
|
+
var result = '';
|
|
3901
|
+
if (parts.length > 1) {
|
|
3902
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
3903
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
3904
|
+
result = parts[0] + '@';
|
|
3905
|
+
string = parts[1];
|
|
3906
|
+
}
|
|
3907
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
3908
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
3909
|
+
var labels = string.split('.');
|
|
3910
|
+
var encoded = map$1(labels, fn).join('.');
|
|
3911
|
+
return result + encoded;
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3914
|
+
/**
|
|
3915
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
3916
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
3917
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
3918
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
3919
|
+
* matching UTF-16.
|
|
3920
|
+
* @see `punycode.ucs2.encode`
|
|
3921
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
3922
|
+
* @memberOf punycode.ucs2
|
|
3923
|
+
* @name decode
|
|
3924
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
3925
|
+
* @returns {Array} The new array of code points.
|
|
3926
|
+
*/
|
|
3927
|
+
function ucs2decode(string) {
|
|
3928
|
+
var output = [],
|
|
3929
|
+
counter = 0,
|
|
3930
|
+
length = string.length,
|
|
3931
|
+
value,
|
|
3932
|
+
extra;
|
|
3933
|
+
while (counter < length) {
|
|
3934
|
+
value = string.charCodeAt(counter++);
|
|
3935
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
3936
|
+
// high surrogate, and there is a next character
|
|
3937
|
+
extra = string.charCodeAt(counter++);
|
|
3938
|
+
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
|
3939
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
3940
|
+
} else {
|
|
3941
|
+
// unmatched surrogate; only append this code unit, in case the next
|
|
3942
|
+
// code unit is the high surrogate of a surrogate pair
|
|
3943
|
+
output.push(value);
|
|
3944
|
+
counter--;
|
|
3945
|
+
}
|
|
3946
|
+
} else {
|
|
3947
|
+
output.push(value);
|
|
3948
|
+
}
|
|
3949
|
+
}
|
|
3950
|
+
return output;
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3953
|
+
/**
|
|
3954
|
+
* Converts a digit/integer into a basic code point.
|
|
3955
|
+
* @see `basicToDigit()`
|
|
3956
|
+
* @private
|
|
3957
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
3958
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
3959
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
3960
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
3961
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
3962
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
3963
|
+
*/
|
|
3964
|
+
function digitToBasic(digit, flag) {
|
|
3965
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
3966
|
+
// 26..35 map to ASCII 0..9
|
|
3967
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
/**
|
|
3971
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
3972
|
+
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
3973
|
+
* @private
|
|
3974
|
+
*/
|
|
3975
|
+
function adapt(delta, numPoints, firstTime) {
|
|
3976
|
+
var k = 0;
|
|
3977
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
3978
|
+
delta += floor(delta / numPoints);
|
|
3979
|
+
for ( /* no initialization */ ; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
3980
|
+
delta = floor(delta / baseMinusTMin);
|
|
3981
|
+
}
|
|
3982
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
/**
|
|
3986
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
3987
|
+
* Punycode string of ASCII-only symbols.
|
|
3988
|
+
* @memberOf punycode
|
|
3989
|
+
* @param {String} input The string of Unicode symbols.
|
|
3990
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
3991
|
+
*/
|
|
3992
|
+
function encode(input) {
|
|
3993
|
+
var n,
|
|
3994
|
+
delta,
|
|
3995
|
+
handledCPCount,
|
|
3996
|
+
basicLength,
|
|
3997
|
+
bias,
|
|
3998
|
+
j,
|
|
3999
|
+
m,
|
|
4000
|
+
q,
|
|
4001
|
+
k,
|
|
4002
|
+
t,
|
|
4003
|
+
currentValue,
|
|
4004
|
+
output = [],
|
|
4005
|
+
/** `inputLength` will hold the number of code points in `input`. */
|
|
4006
|
+
inputLength,
|
|
4007
|
+
/** Cached calculation results */
|
|
4008
|
+
handledCPCountPlusOne,
|
|
4009
|
+
baseMinusT,
|
|
4010
|
+
qMinusT;
|
|
4011
|
+
|
|
4012
|
+
// Convert the input in UCS-2 to Unicode
|
|
4013
|
+
input = ucs2decode(input);
|
|
4014
|
+
|
|
4015
|
+
// Cache the length
|
|
4016
|
+
inputLength = input.length;
|
|
4017
|
+
|
|
4018
|
+
// Initialize the state
|
|
4019
|
+
n = initialN;
|
|
4020
|
+
delta = 0;
|
|
4021
|
+
bias = initialBias;
|
|
4022
|
+
|
|
4023
|
+
// Handle the basic code points
|
|
4024
|
+
for (j = 0; j < inputLength; ++j) {
|
|
4025
|
+
currentValue = input[j];
|
|
4026
|
+
if (currentValue < 0x80) {
|
|
4027
|
+
output.push(stringFromCharCode(currentValue));
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
handledCPCount = basicLength = output.length;
|
|
4032
|
+
|
|
4033
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
4034
|
+
// `basicLength` is the number of basic code points.
|
|
4035
|
+
|
|
4036
|
+
// Finish the basic string - if it is not empty - with a delimiter
|
|
4037
|
+
if (basicLength) {
|
|
4038
|
+
output.push(delimiter);
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
// Main encoding loop:
|
|
4042
|
+
while (handledCPCount < inputLength) {
|
|
4043
|
+
|
|
4044
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
4045
|
+
// larger one:
|
|
4046
|
+
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
|
4047
|
+
currentValue = input[j];
|
|
4048
|
+
if (currentValue >= n && currentValue < m) {
|
|
4049
|
+
m = currentValue;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
4054
|
+
// but guard against overflow
|
|
4055
|
+
handledCPCountPlusOne = handledCPCount + 1;
|
|
4056
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
4057
|
+
error('overflow');
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
4061
|
+
n = m;
|
|
4062
|
+
|
|
4063
|
+
for (j = 0; j < inputLength; ++j) {
|
|
4064
|
+
currentValue = input[j];
|
|
4065
|
+
|
|
4066
|
+
if (currentValue < n && ++delta > maxInt) {
|
|
4067
|
+
error('overflow');
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
if (currentValue == n) {
|
|
4071
|
+
// Represent delta as a generalized variable-length integer
|
|
4072
|
+
for (q = delta, k = base; /* no condition */ ; k += base) {
|
|
4073
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
4074
|
+
if (q < t) {
|
|
4075
|
+
break;
|
|
4076
|
+
}
|
|
4077
|
+
qMinusT = q - t;
|
|
4078
|
+
baseMinusT = base - t;
|
|
4079
|
+
output.push(
|
|
4080
|
+
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
4081
|
+
);
|
|
4082
|
+
q = floor(qMinusT / baseMinusT);
|
|
4083
|
+
}
|
|
4084
|
+
|
|
4085
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
4086
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
4087
|
+
delta = 0;
|
|
4088
|
+
++handledCPCount;
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
++delta;
|
|
4093
|
+
++n;
|
|
4094
|
+
|
|
4095
|
+
}
|
|
4096
|
+
return output.join('');
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
/**
|
|
4100
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
4101
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
4102
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
4103
|
+
* ASCII.
|
|
4104
|
+
* @memberOf punycode
|
|
4105
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
4106
|
+
* Unicode string.
|
|
4107
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
4108
|
+
* email address.
|
|
4109
|
+
*/
|
|
4110
|
+
function toASCII(input) {
|
|
4111
|
+
return mapDomain(input, function(string) {
|
|
4112
|
+
return regexNonASCII.test(string) ?
|
|
4113
|
+
'xn--' + encode(string) :
|
|
4114
|
+
string;
|
|
4115
|
+
});
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4118
|
+
function isNull(arg) {
|
|
4119
|
+
return arg === null;
|
|
4120
|
+
}
|
|
4121
|
+
|
|
4122
|
+
function isNullOrUndefined(arg) {
|
|
4123
|
+
return arg == null;
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
function isString(arg) {
|
|
4127
|
+
return typeof arg === 'string';
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
function isObject(arg) {
|
|
4131
|
+
return typeof arg === 'object' && arg !== null;
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
4135
|
+
//
|
|
4136
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4137
|
+
// copy of this software and associated documentation files (the
|
|
4138
|
+
// "Software"), to deal in the Software without restriction, including
|
|
4139
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
4140
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
4141
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
4142
|
+
// following conditions:
|
|
4143
|
+
//
|
|
4144
|
+
// The above copyright notice and this permission notice shall be included
|
|
4145
|
+
// in all copies or substantial portions of the Software.
|
|
4146
|
+
//
|
|
4147
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
4148
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
4149
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
4150
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
4151
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
4152
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
4153
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
4154
|
+
|
|
4155
|
+
|
|
4156
|
+
// If obj.hasOwnProperty has been overridden, then calling
|
|
4157
|
+
// obj.hasOwnProperty(prop) will break.
|
|
4158
|
+
// See: https://github.com/joyent/node/issues/1707
|
|
4159
|
+
function hasOwnProperty(obj, prop) {
|
|
4160
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
4161
|
+
}
|
|
4162
|
+
var isArray = Array.isArray || function (xs) {
|
|
4163
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
4164
|
+
};
|
|
4165
|
+
function stringifyPrimitive(v) {
|
|
4166
|
+
switch (typeof v) {
|
|
4167
|
+
case 'string':
|
|
4168
|
+
return v;
|
|
4169
|
+
|
|
4170
|
+
case 'boolean':
|
|
4171
|
+
return v ? 'true' : 'false';
|
|
4172
|
+
|
|
4173
|
+
case 'number':
|
|
4174
|
+
return isFinite(v) ? v : '';
|
|
4175
|
+
|
|
4176
|
+
default:
|
|
4177
|
+
return '';
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
|
|
4181
|
+
function stringify (obj, sep, eq, name) {
|
|
4182
|
+
sep = sep || '&';
|
|
4183
|
+
eq = eq || '=';
|
|
4184
|
+
if (obj === null) {
|
|
4185
|
+
obj = undefined;
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
if (typeof obj === 'object') {
|
|
4189
|
+
return map(objectKeys(obj), function(k) {
|
|
4190
|
+
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
|
4191
|
+
if (isArray(obj[k])) {
|
|
4192
|
+
return map(obj[k], function(v) {
|
|
4193
|
+
return ks + encodeURIComponent(stringifyPrimitive(v));
|
|
4194
|
+
}).join(sep);
|
|
4195
|
+
} else {
|
|
4196
|
+
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
|
4197
|
+
}
|
|
4198
|
+
}).join(sep);
|
|
4199
|
+
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4202
|
+
if (!name) return '';
|
|
4203
|
+
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
|
4204
|
+
encodeURIComponent(stringifyPrimitive(obj));
|
|
4205
|
+
}
|
|
4206
|
+
function map (xs, f) {
|
|
4207
|
+
if (xs.map) return xs.map(f);
|
|
4208
|
+
var res = [];
|
|
4209
|
+
for (var i = 0; i < xs.length; i++) {
|
|
4210
|
+
res.push(f(xs[i], i));
|
|
4211
|
+
}
|
|
4212
|
+
return res;
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
var objectKeys = Object.keys || function (obj) {
|
|
4216
|
+
var res = [];
|
|
4217
|
+
for (var key in obj) {
|
|
4218
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
|
4219
|
+
}
|
|
4220
|
+
return res;
|
|
4221
|
+
};
|
|
4222
|
+
|
|
4223
|
+
function parse$1(qs, sep, eq, options) {
|
|
4224
|
+
sep = sep || '&';
|
|
4225
|
+
eq = eq || '=';
|
|
4226
|
+
var obj = {};
|
|
4227
|
+
|
|
4228
|
+
if (typeof qs !== 'string' || qs.length === 0) {
|
|
4229
|
+
return obj;
|
|
4230
|
+
}
|
|
4231
|
+
|
|
4232
|
+
var regexp = /\+/g;
|
|
4233
|
+
qs = qs.split(sep);
|
|
4234
|
+
|
|
4235
|
+
var maxKeys = 1000;
|
|
4236
|
+
if (options && typeof options.maxKeys === 'number') {
|
|
4237
|
+
maxKeys = options.maxKeys;
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4240
|
+
var len = qs.length;
|
|
4241
|
+
// maxKeys <= 0 means that we should not limit keys count
|
|
4242
|
+
if (maxKeys > 0 && len > maxKeys) {
|
|
4243
|
+
len = maxKeys;
|
|
4244
|
+
}
|
|
4245
|
+
|
|
4246
|
+
for (var i = 0; i < len; ++i) {
|
|
4247
|
+
var x = qs[i].replace(regexp, '%20'),
|
|
4248
|
+
idx = x.indexOf(eq),
|
|
4249
|
+
kstr, vstr, k, v;
|
|
4250
|
+
|
|
4251
|
+
if (idx >= 0) {
|
|
4252
|
+
kstr = x.substr(0, idx);
|
|
4253
|
+
vstr = x.substr(idx + 1);
|
|
4254
|
+
} else {
|
|
4255
|
+
kstr = x;
|
|
4256
|
+
vstr = '';
|
|
4257
|
+
}
|
|
4258
|
+
|
|
4259
|
+
k = decodeURIComponent(kstr);
|
|
4260
|
+
v = decodeURIComponent(vstr);
|
|
4261
|
+
|
|
4262
|
+
if (!hasOwnProperty(obj, k)) {
|
|
4263
|
+
obj[k] = v;
|
|
4264
|
+
} else if (isArray(obj[k])) {
|
|
4265
|
+
obj[k].push(v);
|
|
4266
|
+
} else {
|
|
4267
|
+
obj[k] = [obj[k], v];
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
|
|
4271
|
+
return obj;
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
4275
|
+
var url = {
|
|
4276
|
+
parse: urlParse,
|
|
4277
|
+
resolve: urlResolve,
|
|
4278
|
+
resolveObject: urlResolveObject,
|
|
4279
|
+
format: urlFormat,
|
|
4280
|
+
Url: Url
|
|
4281
|
+
};
|
|
4282
|
+
function Url() {
|
|
4283
|
+
this.protocol = null;
|
|
4284
|
+
this.slashes = null;
|
|
4285
|
+
this.auth = null;
|
|
4286
|
+
this.host = null;
|
|
4287
|
+
this.port = null;
|
|
4288
|
+
this.hostname = null;
|
|
4289
|
+
this.hash = null;
|
|
4290
|
+
this.search = null;
|
|
4291
|
+
this.query = null;
|
|
4292
|
+
this.pathname = null;
|
|
4293
|
+
this.path = null;
|
|
4294
|
+
this.href = null;
|
|
4295
|
+
}
|
|
4296
|
+
|
|
4297
|
+
// Reference: RFC 3986, RFC 1808, RFC 2396
|
|
4298
|
+
|
|
4299
|
+
// define these here so at least they only have to be
|
|
4300
|
+
// compiled once on the first module load.
|
|
4301
|
+
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
|
4302
|
+
portPattern = /:[0-9]*$/,
|
|
4303
|
+
|
|
4304
|
+
// Special case for a simple path URL
|
|
4305
|
+
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
|
4306
|
+
|
|
4307
|
+
// RFC 2396: characters reserved for delimiting URLs.
|
|
4308
|
+
// We actually just auto-escape these.
|
|
4309
|
+
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
|
4310
|
+
|
|
4311
|
+
// RFC 2396: characters not allowed for various reasons.
|
|
4312
|
+
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
|
4313
|
+
|
|
4314
|
+
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
|
4315
|
+
autoEscape = ['\''].concat(unwise),
|
|
4316
|
+
// Characters that are never ever allowed in a hostname.
|
|
4317
|
+
// Note that any invalid chars are also handled, but these
|
|
4318
|
+
// are the ones that are *expected* to be seen, so we fast-path
|
|
4319
|
+
// them.
|
|
4320
|
+
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
|
4321
|
+
hostEndingChars = ['/', '?', '#'],
|
|
4322
|
+
hostnameMaxLen = 255,
|
|
4323
|
+
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
|
4324
|
+
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
|
4325
|
+
// protocols that can allow "unsafe" and "unwise" chars.
|
|
4326
|
+
unsafeProtocol = {
|
|
4327
|
+
'javascript': true,
|
|
4328
|
+
'javascript:': true
|
|
4329
|
+
},
|
|
4330
|
+
// protocols that never have a hostname.
|
|
4331
|
+
hostlessProtocol = {
|
|
4332
|
+
'javascript': true,
|
|
4333
|
+
'javascript:': true
|
|
4334
|
+
},
|
|
4335
|
+
// protocols that always contain a // bit.
|
|
4336
|
+
slashedProtocol = {
|
|
4337
|
+
'http': true,
|
|
4338
|
+
'https': true,
|
|
4339
|
+
'ftp': true,
|
|
4340
|
+
'gopher': true,
|
|
4341
|
+
'file': true,
|
|
4342
|
+
'http:': true,
|
|
4343
|
+
'https:': true,
|
|
4344
|
+
'ftp:': true,
|
|
4345
|
+
'gopher:': true,
|
|
4346
|
+
'file:': true
|
|
4347
|
+
};
|
|
4348
|
+
|
|
4349
|
+
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|
4350
|
+
if (url && isObject(url) && url instanceof Url) return url;
|
|
4351
|
+
|
|
4352
|
+
var u = new Url;
|
|
4353
|
+
u.parse(url, parseQueryString, slashesDenoteHost);
|
|
4354
|
+
return u;
|
|
4355
|
+
}
|
|
4356
|
+
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
|
4357
|
+
return parse(this, url, parseQueryString, slashesDenoteHost);
|
|
4358
|
+
};
|
|
4359
|
+
|
|
4360
|
+
function parse(self, url, parseQueryString, slashesDenoteHost) {
|
|
4361
|
+
if (!isString(url)) {
|
|
4362
|
+
throw new TypeError('Parameter \'url\' must be a string, not ' + typeof url);
|
|
4363
|
+
}
|
|
4364
|
+
|
|
4365
|
+
// Copy chrome, IE, opera backslash-handling behavior.
|
|
4366
|
+
// Back slashes before the query string get converted to forward slashes
|
|
4367
|
+
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
|
4368
|
+
var queryIndex = url.indexOf('?'),
|
|
4369
|
+
splitter =
|
|
4370
|
+
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
|
4371
|
+
uSplit = url.split(splitter),
|
|
4372
|
+
slashRegex = /\\/g;
|
|
4373
|
+
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
|
4374
|
+
url = uSplit.join(splitter);
|
|
4375
|
+
|
|
4376
|
+
var rest = url;
|
|
4377
|
+
|
|
4378
|
+
// trim before proceeding.
|
|
4379
|
+
// This is to support parse stuff like " http://foo.com \n"
|
|
4380
|
+
rest = rest.trim();
|
|
4381
|
+
|
|
4382
|
+
if (!slashesDenoteHost && url.split('#').length === 1) {
|
|
4383
|
+
// Try fast path regexp
|
|
4384
|
+
var simplePath = simplePathPattern.exec(rest);
|
|
4385
|
+
if (simplePath) {
|
|
4386
|
+
self.path = rest;
|
|
4387
|
+
self.href = rest;
|
|
4388
|
+
self.pathname = simplePath[1];
|
|
4389
|
+
if (simplePath[2]) {
|
|
4390
|
+
self.search = simplePath[2];
|
|
4391
|
+
if (parseQueryString) {
|
|
4392
|
+
self.query = parse$1(self.search.substr(1));
|
|
4393
|
+
} else {
|
|
4394
|
+
self.query = self.search.substr(1);
|
|
4395
|
+
}
|
|
4396
|
+
} else if (parseQueryString) {
|
|
4397
|
+
self.search = '';
|
|
4398
|
+
self.query = {};
|
|
4399
|
+
}
|
|
4400
|
+
return self;
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4404
|
+
var proto = protocolPattern.exec(rest);
|
|
4405
|
+
if (proto) {
|
|
4406
|
+
proto = proto[0];
|
|
4407
|
+
var lowerProto = proto.toLowerCase();
|
|
4408
|
+
self.protocol = lowerProto;
|
|
4409
|
+
rest = rest.substr(proto.length);
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
// figure out if it's got a host
|
|
4413
|
+
// user@server is *always* interpreted as a hostname, and url
|
|
4414
|
+
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
|
4415
|
+
// how the browser resolves relative URLs.
|
|
4416
|
+
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
|
4417
|
+
var slashes = rest.substr(0, 2) === '//';
|
|
4418
|
+
if (slashes && !(proto && hostlessProtocol[proto])) {
|
|
4419
|
+
rest = rest.substr(2);
|
|
4420
|
+
self.slashes = true;
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
var i, hec, l, p;
|
|
4424
|
+
if (!hostlessProtocol[proto] &&
|
|
4425
|
+
(slashes || (proto && !slashedProtocol[proto]))) {
|
|
4426
|
+
|
|
4427
|
+
// there's a hostname.
|
|
4428
|
+
// the first instance of /, ?, ;, or # ends the host.
|
|
4429
|
+
//
|
|
4430
|
+
// If there is an @ in the hostname, then non-host chars *are* allowed
|
|
4431
|
+
// to the left of the last @ sign, unless some host-ending character
|
|
4432
|
+
// comes *before* the @-sign.
|
|
4433
|
+
// URLs are obnoxious.
|
|
4434
|
+
//
|
|
4435
|
+
// ex:
|
|
4436
|
+
// http://a@b@c/ => user:a@b host:c
|
|
4437
|
+
// http://a@b?@c => user:a host:c path:/?@c
|
|
4438
|
+
|
|
4439
|
+
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
|
4440
|
+
// Review our test case against browsers more comprehensively.
|
|
4441
|
+
|
|
4442
|
+
// find the first instance of any hostEndingChars
|
|
4443
|
+
var hostEnd = -1;
|
|
4444
|
+
for (i = 0; i < hostEndingChars.length; i++) {
|
|
4445
|
+
hec = rest.indexOf(hostEndingChars[i]);
|
|
4446
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
4447
|
+
hostEnd = hec;
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
// at this point, either we have an explicit point where the
|
|
4451
|
+
// auth portion cannot go past, or the last @ char is the decider.
|
|
4452
|
+
var auth, atSign;
|
|
4453
|
+
if (hostEnd === -1) {
|
|
4454
|
+
// atSign can be anywhere.
|
|
4455
|
+
atSign = rest.lastIndexOf('@');
|
|
4456
|
+
} else {
|
|
4457
|
+
// atSign must be in auth portion.
|
|
4458
|
+
// http://a@b/c@d => host:b auth:a path:/c@d
|
|
4459
|
+
atSign = rest.lastIndexOf('@', hostEnd);
|
|
4460
|
+
}
|
|
4461
|
+
|
|
4462
|
+
// Now we have a portion which is definitely the auth.
|
|
4463
|
+
// Pull that off.
|
|
4464
|
+
if (atSign !== -1) {
|
|
4465
|
+
auth = rest.slice(0, atSign);
|
|
4466
|
+
rest = rest.slice(atSign + 1);
|
|
4467
|
+
self.auth = decodeURIComponent(auth);
|
|
4468
|
+
}
|
|
4469
|
+
|
|
4470
|
+
// the host is the remaining to the left of the first non-host char
|
|
4471
|
+
hostEnd = -1;
|
|
4472
|
+
for (i = 0; i < nonHostChars.length; i++) {
|
|
4473
|
+
hec = rest.indexOf(nonHostChars[i]);
|
|
4474
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
4475
|
+
hostEnd = hec;
|
|
4476
|
+
}
|
|
4477
|
+
// if we still have not hit it, then the entire thing is a host.
|
|
4478
|
+
if (hostEnd === -1)
|
|
4479
|
+
hostEnd = rest.length;
|
|
4480
|
+
|
|
4481
|
+
self.host = rest.slice(0, hostEnd);
|
|
4482
|
+
rest = rest.slice(hostEnd);
|
|
4483
|
+
|
|
4484
|
+
// pull out port.
|
|
4485
|
+
parseHost(self);
|
|
4486
|
+
|
|
4487
|
+
// we've indicated that there is a hostname,
|
|
4488
|
+
// so even if it's empty, it has to be present.
|
|
4489
|
+
self.hostname = self.hostname || '';
|
|
4490
|
+
|
|
4491
|
+
// if hostname begins with [ and ends with ]
|
|
4492
|
+
// assume that it's an IPv6 address.
|
|
4493
|
+
var ipv6Hostname = self.hostname[0] === '[' &&
|
|
4494
|
+
self.hostname[self.hostname.length - 1] === ']';
|
|
4495
|
+
|
|
4496
|
+
// validate a little.
|
|
4497
|
+
if (!ipv6Hostname) {
|
|
4498
|
+
var hostparts = self.hostname.split(/\./);
|
|
4499
|
+
for (i = 0, l = hostparts.length; i < l; i++) {
|
|
4500
|
+
var part = hostparts[i];
|
|
4501
|
+
if (!part) continue;
|
|
4502
|
+
if (!part.match(hostnamePartPattern)) {
|
|
4503
|
+
var newpart = '';
|
|
4504
|
+
for (var j = 0, k = part.length; j < k; j++) {
|
|
4505
|
+
if (part.charCodeAt(j) > 127) {
|
|
4506
|
+
// we replace non-ASCII char with a temporary placeholder
|
|
4507
|
+
// we need this to make sure size of hostname is not
|
|
4508
|
+
// broken by replacing non-ASCII by nothing
|
|
4509
|
+
newpart += 'x';
|
|
4510
|
+
} else {
|
|
4511
|
+
newpart += part[j];
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
// we test again with ASCII char only
|
|
4515
|
+
if (!newpart.match(hostnamePartPattern)) {
|
|
4516
|
+
var validParts = hostparts.slice(0, i);
|
|
4517
|
+
var notHost = hostparts.slice(i + 1);
|
|
4518
|
+
var bit = part.match(hostnamePartStart);
|
|
4519
|
+
if (bit) {
|
|
4520
|
+
validParts.push(bit[1]);
|
|
4521
|
+
notHost.unshift(bit[2]);
|
|
4522
|
+
}
|
|
4523
|
+
if (notHost.length) {
|
|
4524
|
+
rest = '/' + notHost.join('.') + rest;
|
|
4525
|
+
}
|
|
4526
|
+
self.hostname = validParts.join('.');
|
|
4527
|
+
break;
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4533
|
+
if (self.hostname.length > hostnameMaxLen) {
|
|
4534
|
+
self.hostname = '';
|
|
4535
|
+
} else {
|
|
4536
|
+
// hostnames are always lower case.
|
|
4537
|
+
self.hostname = self.hostname.toLowerCase();
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4540
|
+
if (!ipv6Hostname) {
|
|
4541
|
+
// IDNA Support: Returns a punycoded representation of "domain".
|
|
4542
|
+
// It only converts parts of the domain name that
|
|
4543
|
+
// have non-ASCII characters, i.e. it doesn't matter if
|
|
4544
|
+
// you call it with a domain that already is ASCII-only.
|
|
4545
|
+
self.hostname = toASCII(self.hostname);
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
p = self.port ? ':' + self.port : '';
|
|
4549
|
+
var h = self.hostname || '';
|
|
4550
|
+
self.host = h + p;
|
|
4551
|
+
self.href += self.host;
|
|
4552
|
+
|
|
4553
|
+
// strip [ and ] from the hostname
|
|
4554
|
+
// the host field still retains them, though
|
|
4555
|
+
if (ipv6Hostname) {
|
|
4556
|
+
self.hostname = self.hostname.substr(1, self.hostname.length - 2);
|
|
4557
|
+
if (rest[0] !== '/') {
|
|
4558
|
+
rest = '/' + rest;
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4563
|
+
// now rest is set to the post-host stuff.
|
|
4564
|
+
// chop off any delim chars.
|
|
4565
|
+
if (!unsafeProtocol[lowerProto]) {
|
|
4566
|
+
|
|
4567
|
+
// First, make 100% sure that any "autoEscape" chars get
|
|
4568
|
+
// escaped, even if encodeURIComponent doesn't think they
|
|
4569
|
+
// need to be.
|
|
4570
|
+
for (i = 0, l = autoEscape.length; i < l; i++) {
|
|
4571
|
+
var ae = autoEscape[i];
|
|
4572
|
+
if (rest.indexOf(ae) === -1)
|
|
4573
|
+
continue;
|
|
4574
|
+
var esc = encodeURIComponent(ae);
|
|
4575
|
+
if (esc === ae) {
|
|
4576
|
+
esc = escape(ae);
|
|
4577
|
+
}
|
|
4578
|
+
rest = rest.split(ae).join(esc);
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4582
|
+
|
|
4583
|
+
// chop off from the tail first.
|
|
4584
|
+
var hash = rest.indexOf('#');
|
|
4585
|
+
if (hash !== -1) {
|
|
4586
|
+
// got a fragment string.
|
|
4587
|
+
self.hash = rest.substr(hash);
|
|
4588
|
+
rest = rest.slice(0, hash);
|
|
4589
|
+
}
|
|
4590
|
+
var qm = rest.indexOf('?');
|
|
4591
|
+
if (qm !== -1) {
|
|
4592
|
+
self.search = rest.substr(qm);
|
|
4593
|
+
self.query = rest.substr(qm + 1);
|
|
4594
|
+
if (parseQueryString) {
|
|
4595
|
+
self.query = parse$1(self.query);
|
|
4596
|
+
}
|
|
4597
|
+
rest = rest.slice(0, qm);
|
|
4598
|
+
} else if (parseQueryString) {
|
|
4599
|
+
// no query string, but parseQueryString still requested
|
|
4600
|
+
self.search = '';
|
|
4601
|
+
self.query = {};
|
|
4602
|
+
}
|
|
4603
|
+
if (rest) self.pathname = rest;
|
|
4604
|
+
if (slashedProtocol[lowerProto] &&
|
|
4605
|
+
self.hostname && !self.pathname) {
|
|
4606
|
+
self.pathname = '/';
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4609
|
+
//to support http.request
|
|
4610
|
+
if (self.pathname || self.search) {
|
|
4611
|
+
p = self.pathname || '';
|
|
4612
|
+
var s = self.search || '';
|
|
4613
|
+
self.path = p + s;
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4616
|
+
// finally, reconstruct the href based on what has been validated.
|
|
4617
|
+
self.href = format(self);
|
|
4618
|
+
return self;
|
|
4619
|
+
}
|
|
4620
|
+
|
|
4621
|
+
// format a parsed object into a url string
|
|
4622
|
+
function urlFormat(obj) {
|
|
4623
|
+
// ensure it's an object, and not a string url.
|
|
4624
|
+
// If it's an obj, this is a no-op.
|
|
4625
|
+
// this way, you can call url_format() on strings
|
|
4626
|
+
// to clean up potentially wonky urls.
|
|
4627
|
+
if (isString(obj)) obj = parse({}, obj);
|
|
4628
|
+
return format(obj);
|
|
4629
|
+
}
|
|
4630
|
+
|
|
4631
|
+
function format(self) {
|
|
4632
|
+
var auth = self.auth || '';
|
|
4633
|
+
if (auth) {
|
|
4634
|
+
auth = encodeURIComponent(auth);
|
|
4635
|
+
auth = auth.replace(/%3A/i, ':');
|
|
4636
|
+
auth += '@';
|
|
4637
|
+
}
|
|
4638
|
+
|
|
4639
|
+
var protocol = self.protocol || '',
|
|
4640
|
+
pathname = self.pathname || '',
|
|
4641
|
+
hash = self.hash || '',
|
|
4642
|
+
host = false,
|
|
4643
|
+
query = '';
|
|
4644
|
+
|
|
4645
|
+
if (self.host) {
|
|
4646
|
+
host = auth + self.host;
|
|
4647
|
+
} else if (self.hostname) {
|
|
4648
|
+
host = auth + (self.hostname.indexOf(':') === -1 ?
|
|
4649
|
+
self.hostname :
|
|
4650
|
+
'[' + this.hostname + ']');
|
|
4651
|
+
if (self.port) {
|
|
4652
|
+
host += ':' + self.port;
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
if (self.query &&
|
|
4657
|
+
isObject(self.query) &&
|
|
4658
|
+
Object.keys(self.query).length) {
|
|
4659
|
+
query = stringify(self.query);
|
|
4660
|
+
}
|
|
4661
|
+
|
|
4662
|
+
var search = self.search || (query && ('?' + query)) || '';
|
|
4663
|
+
|
|
4664
|
+
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
|
4665
|
+
|
|
4666
|
+
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
|
4667
|
+
// unless they had them to begin with.
|
|
4668
|
+
if (self.slashes ||
|
|
4669
|
+
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
|
4670
|
+
host = '//' + (host || '');
|
|
4671
|
+
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
|
4672
|
+
} else if (!host) {
|
|
4673
|
+
host = '';
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4676
|
+
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
|
4677
|
+
if (search && search.charAt(0) !== '?') search = '?' + search;
|
|
4678
|
+
|
|
4679
|
+
pathname = pathname.replace(/[?#]/g, function(match) {
|
|
4680
|
+
return encodeURIComponent(match);
|
|
4681
|
+
});
|
|
4682
|
+
search = search.replace('#', '%23');
|
|
4683
|
+
|
|
4684
|
+
return protocol + host + pathname + search + hash;
|
|
4685
|
+
}
|
|
4686
|
+
|
|
4687
|
+
Url.prototype.format = function() {
|
|
4688
|
+
return format(this);
|
|
4689
|
+
};
|
|
4690
|
+
|
|
4691
|
+
function urlResolve(source, relative) {
|
|
4692
|
+
return urlParse(source, false, true).resolve(relative);
|
|
4693
|
+
}
|
|
4694
|
+
|
|
4695
|
+
Url.prototype.resolve = function(relative) {
|
|
4696
|
+
return this.resolveObject(urlParse(relative, false, true)).format();
|
|
4697
|
+
};
|
|
4698
|
+
|
|
4699
|
+
function urlResolveObject(source, relative) {
|
|
4700
|
+
if (!source) return relative;
|
|
4701
|
+
return urlParse(source, false, true).resolveObject(relative);
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4704
|
+
Url.prototype.resolveObject = function(relative) {
|
|
4705
|
+
if (isString(relative)) {
|
|
4706
|
+
var rel = new Url();
|
|
4707
|
+
rel.parse(relative, false, true);
|
|
4708
|
+
relative = rel;
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
var result = new Url();
|
|
4712
|
+
var tkeys = Object.keys(this);
|
|
4713
|
+
for (var tk = 0; tk < tkeys.length; tk++) {
|
|
4714
|
+
var tkey = tkeys[tk];
|
|
4715
|
+
result[tkey] = this[tkey];
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
// hash is always overridden, no matter what.
|
|
4719
|
+
// even href="" will remove it.
|
|
4720
|
+
result.hash = relative.hash;
|
|
4721
|
+
|
|
4722
|
+
// if the relative url is empty, then there's nothing left to do here.
|
|
4723
|
+
if (relative.href === '') {
|
|
4724
|
+
result.href = result.format();
|
|
4725
|
+
return result;
|
|
4726
|
+
}
|
|
4727
|
+
|
|
4728
|
+
// hrefs like //foo/bar always cut to the protocol.
|
|
4729
|
+
if (relative.slashes && !relative.protocol) {
|
|
4730
|
+
// take everything except the protocol from relative
|
|
4731
|
+
var rkeys = Object.keys(relative);
|
|
4732
|
+
for (var rk = 0; rk < rkeys.length; rk++) {
|
|
4733
|
+
var rkey = rkeys[rk];
|
|
4734
|
+
if (rkey !== 'protocol')
|
|
4735
|
+
result[rkey] = relative[rkey];
|
|
4736
|
+
}
|
|
4737
|
+
|
|
4738
|
+
//urlParse appends trailing / to urls like http://www.example.com
|
|
4739
|
+
if (slashedProtocol[result.protocol] &&
|
|
4740
|
+
result.hostname && !result.pathname) {
|
|
4741
|
+
result.path = result.pathname = '/';
|
|
4742
|
+
}
|
|
4743
|
+
|
|
4744
|
+
result.href = result.format();
|
|
4745
|
+
return result;
|
|
4746
|
+
}
|
|
4747
|
+
var relPath;
|
|
4748
|
+
if (relative.protocol && relative.protocol !== result.protocol) {
|
|
4749
|
+
// if it's a known url protocol, then changing
|
|
4750
|
+
// the protocol does weird things
|
|
4751
|
+
// first, if it's not file:, then we MUST have a host,
|
|
4752
|
+
// and if there was a path
|
|
4753
|
+
// to begin with, then we MUST have a path.
|
|
4754
|
+
// if it is file:, then the host is dropped,
|
|
4755
|
+
// because that's known to be hostless.
|
|
4756
|
+
// anything else is assumed to be absolute.
|
|
4757
|
+
if (!slashedProtocol[relative.protocol]) {
|
|
4758
|
+
var keys = Object.keys(relative);
|
|
4759
|
+
for (var v = 0; v < keys.length; v++) {
|
|
4760
|
+
var k = keys[v];
|
|
4761
|
+
result[k] = relative[k];
|
|
4762
|
+
}
|
|
4763
|
+
result.href = result.format();
|
|
4764
|
+
return result;
|
|
4765
|
+
}
|
|
4766
|
+
|
|
4767
|
+
result.protocol = relative.protocol;
|
|
4768
|
+
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
|
4769
|
+
relPath = (relative.pathname || '').split('/');
|
|
4770
|
+
while (relPath.length && !(relative.host = relPath.shift()));
|
|
4771
|
+
if (!relative.host) relative.host = '';
|
|
4772
|
+
if (!relative.hostname) relative.hostname = '';
|
|
4773
|
+
if (relPath[0] !== '') relPath.unshift('');
|
|
4774
|
+
if (relPath.length < 2) relPath.unshift('');
|
|
4775
|
+
result.pathname = relPath.join('/');
|
|
4776
|
+
} else {
|
|
4777
|
+
result.pathname = relative.pathname;
|
|
4778
|
+
}
|
|
4779
|
+
result.search = relative.search;
|
|
4780
|
+
result.query = relative.query;
|
|
4781
|
+
result.host = relative.host || '';
|
|
4782
|
+
result.auth = relative.auth;
|
|
4783
|
+
result.hostname = relative.hostname || relative.host;
|
|
4784
|
+
result.port = relative.port;
|
|
4785
|
+
// to support http.request
|
|
4786
|
+
if (result.pathname || result.search) {
|
|
4787
|
+
var p = result.pathname || '';
|
|
4788
|
+
var s = result.search || '';
|
|
4789
|
+
result.path = p + s;
|
|
4790
|
+
}
|
|
4791
|
+
result.slashes = result.slashes || relative.slashes;
|
|
4792
|
+
result.href = result.format();
|
|
4793
|
+
return result;
|
|
4794
|
+
}
|
|
4795
|
+
|
|
4796
|
+
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
|
4797
|
+
isRelAbs = (
|
|
4798
|
+
relative.host ||
|
|
4799
|
+
relative.pathname && relative.pathname.charAt(0) === '/'
|
|
4800
|
+
),
|
|
4801
|
+
mustEndAbs = (isRelAbs || isSourceAbs ||
|
|
4802
|
+
(result.host && relative.pathname)),
|
|
4803
|
+
removeAllDots = mustEndAbs,
|
|
4804
|
+
srcPath = result.pathname && result.pathname.split('/') || [],
|
|
4805
|
+
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
|
4806
|
+
relPath = relative.pathname && relative.pathname.split('/') || [];
|
|
4807
|
+
// if the url is a non-slashed url, then relative
|
|
4808
|
+
// links like ../.. should be able
|
|
4809
|
+
// to crawl up to the hostname, as well. This is strange.
|
|
4810
|
+
// result.protocol has already been set by now.
|
|
4811
|
+
// Later on, put the first path part into the host field.
|
|
4812
|
+
if (psychotic) {
|
|
4813
|
+
result.hostname = '';
|
|
4814
|
+
result.port = null;
|
|
4815
|
+
if (result.host) {
|
|
4816
|
+
if (srcPath[0] === '') srcPath[0] = result.host;
|
|
4817
|
+
else srcPath.unshift(result.host);
|
|
4818
|
+
}
|
|
4819
|
+
result.host = '';
|
|
4820
|
+
if (relative.protocol) {
|
|
4821
|
+
relative.hostname = null;
|
|
4822
|
+
relative.port = null;
|
|
4823
|
+
if (relative.host) {
|
|
4824
|
+
if (relPath[0] === '') relPath[0] = relative.host;
|
|
4825
|
+
else relPath.unshift(relative.host);
|
|
4826
|
+
}
|
|
4827
|
+
relative.host = null;
|
|
4828
|
+
}
|
|
4829
|
+
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
|
4830
|
+
}
|
|
4831
|
+
var authInHost;
|
|
4832
|
+
if (isRelAbs) {
|
|
4833
|
+
// it's absolute.
|
|
4834
|
+
result.host = (relative.host || relative.host === '') ?
|
|
4835
|
+
relative.host : result.host;
|
|
4836
|
+
result.hostname = (relative.hostname || relative.hostname === '') ?
|
|
4837
|
+
relative.hostname : result.hostname;
|
|
4838
|
+
result.search = relative.search;
|
|
4839
|
+
result.query = relative.query;
|
|
4840
|
+
srcPath = relPath;
|
|
4841
|
+
// fall through to the dot-handling below.
|
|
4842
|
+
} else if (relPath.length) {
|
|
4843
|
+
// it's relative
|
|
4844
|
+
// throw away the existing file, and take the new path instead.
|
|
4845
|
+
if (!srcPath) srcPath = [];
|
|
4846
|
+
srcPath.pop();
|
|
4847
|
+
srcPath = srcPath.concat(relPath);
|
|
4848
|
+
result.search = relative.search;
|
|
4849
|
+
result.query = relative.query;
|
|
4850
|
+
} else if (!isNullOrUndefined(relative.search)) {
|
|
4851
|
+
// just pull out the search.
|
|
4852
|
+
// like href='?foo'.
|
|
4853
|
+
// Put this after the other two cases because it simplifies the booleans
|
|
4854
|
+
if (psychotic) {
|
|
4855
|
+
result.hostname = result.host = srcPath.shift();
|
|
4856
|
+
//occationaly the auth can get stuck only in host
|
|
4857
|
+
//this especially happens in cases like
|
|
4858
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
4859
|
+
authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
4860
|
+
result.host.split('@') : false;
|
|
4861
|
+
if (authInHost) {
|
|
4862
|
+
result.auth = authInHost.shift();
|
|
4863
|
+
result.host = result.hostname = authInHost.shift();
|
|
4864
|
+
}
|
|
4865
|
+
}
|
|
4866
|
+
result.search = relative.search;
|
|
4867
|
+
result.query = relative.query;
|
|
4868
|
+
//to support http.request
|
|
4869
|
+
if (!isNull(result.pathname) || !isNull(result.search)) {
|
|
4870
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
4871
|
+
(result.search ? result.search : '');
|
|
4872
|
+
}
|
|
4873
|
+
result.href = result.format();
|
|
4874
|
+
return result;
|
|
4875
|
+
}
|
|
4876
|
+
|
|
4877
|
+
if (!srcPath.length) {
|
|
4878
|
+
// no path at all. easy.
|
|
4879
|
+
// we've already handled the other stuff above.
|
|
4880
|
+
result.pathname = null;
|
|
4881
|
+
//to support http.request
|
|
4882
|
+
if (result.search) {
|
|
4883
|
+
result.path = '/' + result.search;
|
|
4884
|
+
} else {
|
|
4885
|
+
result.path = null;
|
|
4886
|
+
}
|
|
4887
|
+
result.href = result.format();
|
|
4888
|
+
return result;
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
// if a url ENDs in . or .., then it must get a trailing slash.
|
|
4892
|
+
// however, if it ends in anything else non-slashy,
|
|
4893
|
+
// then it must NOT get a trailing slash.
|
|
4894
|
+
var last = srcPath.slice(-1)[0];
|
|
4895
|
+
var hasTrailingSlash = (
|
|
4896
|
+
(result.host || relative.host || srcPath.length > 1) &&
|
|
4897
|
+
(last === '.' || last === '..') || last === '');
|
|
4898
|
+
|
|
4899
|
+
// strip single dots, resolve double dots to parent dir
|
|
4900
|
+
// if the path tries to go above the root, `up` ends up > 0
|
|
4901
|
+
var up = 0;
|
|
4902
|
+
for (var i = srcPath.length; i >= 0; i--) {
|
|
4903
|
+
last = srcPath[i];
|
|
4904
|
+
if (last === '.') {
|
|
4905
|
+
srcPath.splice(i, 1);
|
|
4906
|
+
} else if (last === '..') {
|
|
4907
|
+
srcPath.splice(i, 1);
|
|
4908
|
+
up++;
|
|
4909
|
+
} else if (up) {
|
|
4910
|
+
srcPath.splice(i, 1);
|
|
4911
|
+
up--;
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
// if the path is allowed to go above the root, restore leading ..s
|
|
4916
|
+
if (!mustEndAbs && !removeAllDots) {
|
|
4917
|
+
for (; up--; up) {
|
|
4918
|
+
srcPath.unshift('..');
|
|
4919
|
+
}
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
if (mustEndAbs && srcPath[0] !== '' &&
|
|
4923
|
+
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
|
4924
|
+
srcPath.unshift('');
|
|
4925
|
+
}
|
|
4926
|
+
|
|
4927
|
+
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
|
4928
|
+
srcPath.push('');
|
|
4929
|
+
}
|
|
4930
|
+
|
|
4931
|
+
var isAbsolute = srcPath[0] === '' ||
|
|
4932
|
+
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
|
4933
|
+
|
|
4934
|
+
// put the host back
|
|
4935
|
+
if (psychotic) {
|
|
4936
|
+
result.hostname = result.host = isAbsolute ? '' :
|
|
4937
|
+
srcPath.length ? srcPath.shift() : '';
|
|
4938
|
+
//occationaly the auth can get stuck only in host
|
|
4939
|
+
//this especially happens in cases like
|
|
4940
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
4941
|
+
authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
4942
|
+
result.host.split('@') : false;
|
|
4943
|
+
if (authInHost) {
|
|
4944
|
+
result.auth = authInHost.shift();
|
|
4945
|
+
result.host = result.hostname = authInHost.shift();
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4948
|
+
|
|
4949
|
+
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
|
4950
|
+
|
|
4951
|
+
if (mustEndAbs && !isAbsolute) {
|
|
4952
|
+
srcPath.unshift('');
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
if (!srcPath.length) {
|
|
4956
|
+
result.pathname = null;
|
|
4957
|
+
result.path = null;
|
|
4958
|
+
} else {
|
|
4959
|
+
result.pathname = srcPath.join('/');
|
|
4960
|
+
}
|
|
4961
|
+
|
|
4962
|
+
//to support request.http
|
|
4963
|
+
if (!isNull(result.pathname) || !isNull(result.search)) {
|
|
4964
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
4965
|
+
(result.search ? result.search : '');
|
|
4966
|
+
}
|
|
4967
|
+
result.auth = relative.auth || result.auth;
|
|
4968
|
+
result.slashes = result.slashes || relative.slashes;
|
|
4969
|
+
result.href = result.format();
|
|
4970
|
+
return result;
|
|
4971
|
+
};
|
|
4972
|
+
|
|
4973
|
+
Url.prototype.parseHost = function() {
|
|
4974
|
+
return parseHost(this);
|
|
4975
|
+
};
|
|
4976
|
+
|
|
4977
|
+
function parseHost(self) {
|
|
4978
|
+
var host = self.host;
|
|
4979
|
+
var port = portPattern.exec(host);
|
|
4980
|
+
if (port) {
|
|
4981
|
+
port = port[0];
|
|
4982
|
+
if (port !== ':') {
|
|
4983
|
+
self.port = port.substr(1);
|
|
4984
|
+
}
|
|
4985
|
+
host = host.substr(0, host.length - port.length);
|
|
4986
|
+
}
|
|
4987
|
+
if (host) self.hostname = host;
|
|
4988
|
+
}
|
|
4989
|
+
|
|
3818
4990
|
/**
|
|
3819
4991
|
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
3820
4992
|
*
|
|
@@ -4836,7 +6008,7 @@ axios_1.default = default_1;
|
|
|
4836
6008
|
var axios = axios_1;
|
|
4837
6009
|
|
|
4838
6010
|
var name$1 = "@tryghost/content-api";
|
|
4839
|
-
var version = "1.
|
|
6011
|
+
var version = "1.10.0";
|
|
4840
6012
|
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
4841
6013
|
var author = "Ghost Foundation";
|
|
4842
6014
|
var license = "MIT";
|
|
@@ -4865,18 +6037,19 @@ var publishConfig = {
|
|
|
4865
6037
|
access: "public"
|
|
4866
6038
|
};
|
|
4867
6039
|
var devDependencies = {
|
|
4868
|
-
"@babel/core": "7.
|
|
6040
|
+
"@babel/core": "7.18.2",
|
|
4869
6041
|
"@babel/polyfill": "7.12.1",
|
|
4870
|
-
"@babel/preset-env": "7.
|
|
6042
|
+
"@babel/preset-env": "7.18.2",
|
|
4871
6043
|
"@rollup/plugin-json": "4.1.0",
|
|
4872
|
-
c8: "7.11.
|
|
4873
|
-
"core-js": "3.22.
|
|
6044
|
+
c8: "7.11.3",
|
|
6045
|
+
"core-js": "3.22.7",
|
|
4874
6046
|
"eslint-plugin-ghost": "2.14.0",
|
|
4875
6047
|
mocha: "10.0.0",
|
|
4876
|
-
rollup: "2.
|
|
6048
|
+
rollup: "2.74.1",
|
|
4877
6049
|
"rollup-plugin-babel": "4.4.0",
|
|
4878
6050
|
"rollup-plugin-commonjs": "10.1.0",
|
|
4879
6051
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
6052
|
+
"rollup-plugin-polyfill-node": "^0.9.0",
|
|
4880
6053
|
"rollup-plugin-replace": "2.2.0",
|
|
4881
6054
|
"rollup-plugin-terser": "7.0.2",
|
|
4882
6055
|
should: "13.2.3",
|
|
@@ -4885,7 +6058,7 @@ var devDependencies = {
|
|
|
4885
6058
|
var dependencies = {
|
|
4886
6059
|
axios: "^0.27.0"
|
|
4887
6060
|
};
|
|
4888
|
-
var gitHead = "
|
|
6061
|
+
var gitHead = "f5a8a2c81a4afc3640f922ef221ea1b6ddfa216a";
|
|
4889
6062
|
var packageInfo = {
|
|
4890
6063
|
name: name$1,
|
|
4891
6064
|
version: version,
|
|
@@ -5042,7 +6215,7 @@ function GhostContentAPI(_ref2) {
|
|
|
5042
6215
|
throw new Error("".concat(name, " Config Invalid: 'key' ").concat(key, " must have 26 hex characters"));
|
|
5043
6216
|
}
|
|
5044
6217
|
|
|
5045
|
-
var api = ['posts', 'authors', 'tags', 'pages', 'settings'].reduce(function (apiObject, resourceType) {
|
|
6218
|
+
var api = ['posts', 'authors', 'tags', 'pages', 'settings', 'tiers', 'newsletters', 'offers'].reduce(function (apiObject, resourceType) {
|
|
5046
6219
|
function browse() {
|
|
5047
6220
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5048
6221
|
var memberToken = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -5065,8 +6238,12 @@ function GhostContentAPI(_ref2) {
|
|
|
5065
6238
|
read: read,
|
|
5066
6239
|
browse: browse
|
|
5067
6240
|
}));
|
|
5068
|
-
}, {});
|
|
6241
|
+
}, {}); // Settings, tiers & newsletters only have browse methods, offers only has read
|
|
6242
|
+
|
|
5069
6243
|
delete api.settings.read;
|
|
6244
|
+
delete api.tiers.read;
|
|
6245
|
+
delete api.newsletters.read;
|
|
6246
|
+
delete api.offers.browse;
|
|
5070
6247
|
return api;
|
|
5071
6248
|
|
|
5072
6249
|
function makeApiRequest(resourceType, params, id) {
|