~canonical-sysadmins/wordpress/5.0.1

« back to all changes in this revision

Viewing changes to wp-includes/js/dist/url.js

  • Committer: Barry Price
  • Date: 2018-12-12 05:08:33 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: barry.price@canonical.com-20181212050833-y090hmrbmlxy37aa
Merge WP5.0 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
this["wp"] = this["wp"] || {}; this["wp"]["url"] =
 
2
/******/ (function(modules) { // webpackBootstrap
 
3
/******/        // The module cache
 
4
/******/        var installedModules = {};
 
5
/******/
 
6
/******/        // The require function
 
7
/******/        function __webpack_require__(moduleId) {
 
8
/******/
 
9
/******/                // Check if module is in cache
 
10
/******/                if(installedModules[moduleId]) {
 
11
/******/                        return installedModules[moduleId].exports;
 
12
/******/                }
 
13
/******/                // Create a new module (and put it into the cache)
 
14
/******/                var module = installedModules[moduleId] = {
 
15
/******/                        i: moduleId,
 
16
/******/                        l: false,
 
17
/******/                        exports: {}
 
18
/******/                };
 
19
/******/
 
20
/******/                // Execute the module function
 
21
/******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
 
22
/******/
 
23
/******/                // Flag the module as loaded
 
24
/******/                module.l = true;
 
25
/******/
 
26
/******/                // Return the exports of the module
 
27
/******/                return module.exports;
 
28
/******/        }
 
29
/******/
 
30
/******/
 
31
/******/        // expose the modules object (__webpack_modules__)
 
32
/******/        __webpack_require__.m = modules;
 
33
/******/
 
34
/******/        // expose the module cache
 
35
/******/        __webpack_require__.c = installedModules;
 
36
/******/
 
37
/******/        // define getter function for harmony exports
 
38
/******/        __webpack_require__.d = function(exports, name, getter) {
 
39
/******/                if(!__webpack_require__.o(exports, name)) {
 
40
/******/                        Object.defineProperty(exports, name, { enumerable: true, get: getter });
 
41
/******/                }
 
42
/******/        };
 
43
/******/
 
44
/******/        // define __esModule on exports
 
45
/******/        __webpack_require__.r = function(exports) {
 
46
/******/                if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 
47
/******/                        Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 
48
/******/                }
 
49
/******/                Object.defineProperty(exports, '__esModule', { value: true });
 
50
/******/        };
 
51
/******/
 
52
/******/        // create a fake namespace object
 
53
/******/        // mode & 1: value is a module id, require it
 
54
/******/        // mode & 2: merge all properties of value into the ns
 
55
/******/        // mode & 4: return value when already ns object
 
56
/******/        // mode & 8|1: behave like require
 
57
/******/        __webpack_require__.t = function(value, mode) {
 
58
/******/                if(mode & 1) value = __webpack_require__(value);
 
59
/******/                if(mode & 8) return value;
 
60
/******/                if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
 
61
/******/                var ns = Object.create(null);
 
62
/******/                __webpack_require__.r(ns);
 
63
/******/                Object.defineProperty(ns, 'default', { enumerable: true, value: value });
 
64
/******/                if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
 
65
/******/                return ns;
 
66
/******/        };
 
67
/******/
 
68
/******/        // getDefaultExport function for compatibility with non-harmony modules
 
69
/******/        __webpack_require__.n = function(module) {
 
70
/******/                var getter = module && module.__esModule ?
 
71
/******/                        function getDefault() { return module['default']; } :
 
72
/******/                        function getModuleExports() { return module; };
 
73
/******/                __webpack_require__.d(getter, 'a', getter);
 
74
/******/                return getter;
 
75
/******/        };
 
76
/******/
 
77
/******/        // Object.prototype.hasOwnProperty.call
 
78
/******/        __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
 
79
/******/
 
80
/******/        // __webpack_public_path__
 
81
/******/        __webpack_require__.p = "";
 
82
/******/
 
83
/******/
 
84
/******/        // Load entry module and return exports
 
85
/******/        return __webpack_require__(__webpack_require__.s = 299);
 
86
/******/ })
 
87
/************************************************************************/
 
88
/******/ ({
 
89
 
 
90
/***/ 15:
 
91
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
92
 
 
93
"use strict";
 
94
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 
95
function _defineProperty(obj, key, value) {
 
96
  if (key in obj) {
 
97
    Object.defineProperty(obj, key, {
 
98
      value: value,
 
99
      enumerable: true,
 
100
      configurable: true,
 
101
      writable: true
 
102
    });
 
103
  } else {
 
104
    obj[key] = value;
 
105
  }
 
106
 
 
107
  return obj;
 
108
}
 
109
 
 
110
/***/ }),
 
111
 
 
112
/***/ 179:
 
113
/***/ (function(module, exports, __webpack_require__) {
 
114
 
 
115
"use strict";
 
116
 
 
117
 
 
118
var has = Object.prototype.hasOwnProperty;
 
119
 
 
120
var hexTable = (function () {
 
121
    var array = [];
 
122
    for (var i = 0; i < 256; ++i) {
 
123
        array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
 
124
    }
 
125
 
 
126
    return array;
 
127
}());
 
128
 
 
129
var compactQueue = function compactQueue(queue) {
 
130
    var obj;
 
131
 
 
132
    while (queue.length) {
 
133
        var item = queue.pop();
 
134
        obj = item.obj[item.prop];
 
135
 
 
136
        if (Array.isArray(obj)) {
 
137
            var compacted = [];
 
138
 
 
139
            for (var j = 0; j < obj.length; ++j) {
 
140
                if (typeof obj[j] !== 'undefined') {
 
141
                    compacted.push(obj[j]);
 
142
                }
 
143
            }
 
144
 
 
145
            item.obj[item.prop] = compacted;
 
146
        }
 
147
    }
 
148
 
 
149
    return obj;
 
150
};
 
151
 
 
152
var arrayToObject = function arrayToObject(source, options) {
 
153
    var obj = options && options.plainObjects ? Object.create(null) : {};
 
154
    for (var i = 0; i < source.length; ++i) {
 
155
        if (typeof source[i] !== 'undefined') {
 
156
            obj[i] = source[i];
 
157
        }
 
158
    }
 
159
 
 
160
    return obj;
 
161
};
 
162
 
 
163
var merge = function merge(target, source, options) {
 
164
    if (!source) {
 
165
        return target;
 
166
    }
 
167
 
 
168
    if (typeof source !== 'object') {
 
169
        if (Array.isArray(target)) {
 
170
            target.push(source);
 
171
        } else if (typeof target === 'object') {
 
172
            if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
 
173
                target[source] = true;
 
174
            }
 
175
        } else {
 
176
            return [target, source];
 
177
        }
 
178
 
 
179
        return target;
 
180
    }
 
181
 
 
182
    if (typeof target !== 'object') {
 
183
        return [target].concat(source);
 
184
    }
 
185
 
 
186
    var mergeTarget = target;
 
187
    if (Array.isArray(target) && !Array.isArray(source)) {
 
188
        mergeTarget = arrayToObject(target, options);
 
189
    }
 
190
 
 
191
    if (Array.isArray(target) && Array.isArray(source)) {
 
192
        source.forEach(function (item, i) {
 
193
            if (has.call(target, i)) {
 
194
                if (target[i] && typeof target[i] === 'object') {
 
195
                    target[i] = merge(target[i], item, options);
 
196
                } else {
 
197
                    target.push(item);
 
198
                }
 
199
            } else {
 
200
                target[i] = item;
 
201
            }
 
202
        });
 
203
        return target;
 
204
    }
 
205
 
 
206
    return Object.keys(source).reduce(function (acc, key) {
 
207
        var value = source[key];
 
208
 
 
209
        if (has.call(acc, key)) {
 
210
            acc[key] = merge(acc[key], value, options);
 
211
        } else {
 
212
            acc[key] = value;
 
213
        }
 
214
        return acc;
 
215
    }, mergeTarget);
 
216
};
 
217
 
 
218
var assign = function assignSingleSource(target, source) {
 
219
    return Object.keys(source).reduce(function (acc, key) {
 
220
        acc[key] = source[key];
 
221
        return acc;
 
222
    }, target);
 
223
};
 
224
 
 
225
var decode = function (str) {
 
226
    try {
 
227
        return decodeURIComponent(str.replace(/\+/g, ' '));
 
228
    } catch (e) {
 
229
        return str;
 
230
    }
 
231
};
 
232
 
 
233
var encode = function encode(str) {
 
234
    // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
 
235
    // It has been adapted here for stricter adherence to RFC 3986
 
236
    if (str.length === 0) {
 
237
        return str;
 
238
    }
 
239
 
 
240
    var string = typeof str === 'string' ? str : String(str);
 
241
 
 
242
    var out = '';
 
243
    for (var i = 0; i < string.length; ++i) {
 
244
        var c = string.charCodeAt(i);
 
245
 
 
246
        if (
 
247
            c === 0x2D // -
 
248
            || c === 0x2E // .
 
249
            || c === 0x5F // _
 
250
            || c === 0x7E // ~
 
251
            || (c >= 0x30 && c <= 0x39) // 0-9
 
252
            || (c >= 0x41 && c <= 0x5A) // a-z
 
253
            || (c >= 0x61 && c <= 0x7A) // A-Z
 
254
        ) {
 
255
            out += string.charAt(i);
 
256
            continue;
 
257
        }
 
258
 
 
259
        if (c < 0x80) {
 
260
            out = out + hexTable[c];
 
261
            continue;
 
262
        }
 
263
 
 
264
        if (c < 0x800) {
 
265
            out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
 
266
            continue;
 
267
        }
 
268
 
 
269
        if (c < 0xD800 || c >= 0xE000) {
 
270
            out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
 
271
            continue;
 
272
        }
 
273
 
 
274
        i += 1;
 
275
        c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
 
276
        out += hexTable[0xF0 | (c >> 18)]
 
277
            + hexTable[0x80 | ((c >> 12) & 0x3F)]
 
278
            + hexTable[0x80 | ((c >> 6) & 0x3F)]
 
279
            + hexTable[0x80 | (c & 0x3F)];
 
280
    }
 
281
 
 
282
    return out;
 
283
};
 
284
 
 
285
var compact = function compact(value) {
 
286
    var queue = [{ obj: { o: value }, prop: 'o' }];
 
287
    var refs = [];
 
288
 
 
289
    for (var i = 0; i < queue.length; ++i) {
 
290
        var item = queue[i];
 
291
        var obj = item.obj[item.prop];
 
292
 
 
293
        var keys = Object.keys(obj);
 
294
        for (var j = 0; j < keys.length; ++j) {
 
295
            var key = keys[j];
 
296
            var val = obj[key];
 
297
            if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
 
298
                queue.push({ obj: obj, prop: key });
 
299
                refs.push(val);
 
300
            }
 
301
        }
 
302
    }
 
303
 
 
304
    return compactQueue(queue);
 
305
};
 
306
 
 
307
var isRegExp = function isRegExp(obj) {
 
308
    return Object.prototype.toString.call(obj) === '[object RegExp]';
 
309
};
 
310
 
 
311
var isBuffer = function isBuffer(obj) {
 
312
    if (obj === null || typeof obj === 'undefined') {
 
313
        return false;
 
314
    }
 
315
 
 
316
    return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
 
317
};
 
318
 
 
319
module.exports = {
 
320
    arrayToObject: arrayToObject,
 
321
    assign: assign,
 
322
    compact: compact,
 
323
    decode: decode,
 
324
    encode: encode,
 
325
    isBuffer: isBuffer,
 
326
    isRegExp: isRegExp,
 
327
    merge: merge
 
328
};
 
329
 
 
330
 
 
331
/***/ }),
 
332
 
 
333
/***/ 180:
 
334
/***/ (function(module, exports, __webpack_require__) {
 
335
 
 
336
"use strict";
 
337
 
 
338
 
 
339
var replace = String.prototype.replace;
 
340
var percentTwenties = /%20/g;
 
341
 
 
342
module.exports = {
 
343
    'default': 'RFC3986',
 
344
    formatters: {
 
345
        RFC1738: function (value) {
 
346
            return replace.call(value, percentTwenties, '+');
 
347
        },
 
348
        RFC3986: function (value) {
 
349
            return value;
 
350
        }
 
351
    },
 
352
    RFC1738: 'RFC1738',
 
353
    RFC3986: 'RFC3986'
 
354
};
 
355
 
 
356
 
 
357
/***/ }),
 
358
 
 
359
/***/ 299:
 
360
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
361
 
 
362
"use strict";
 
363
__webpack_require__.r(__webpack_exports__);
 
364
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isURL", function() { return isURL; });
 
365
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProtocol", function() { return getProtocol; });
 
366
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidProtocol", function() { return isValidProtocol; });
 
367
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAuthority", function() { return getAuthority; });
 
368
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidAuthority", function() { return isValidAuthority; });
 
369
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPath", function() { return getPath; });
 
370
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidPath", function() { return isValidPath; });
 
371
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return getQueryString; });
 
372
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidQueryString", function() { return isValidQueryString; });
 
373
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFragment", function() { return getFragment; });
 
374
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidFragment", function() { return isValidFragment; });
 
375
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return addQueryArgs; });
 
376
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getQueryArg", function() { return getQueryArg; });
 
377
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasQueryArg", function() { return hasQueryArg; });
 
378
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeQueryArgs", function() { return removeQueryArgs; });
 
379
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return prependHTTP; });
 
380
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeDecodeURI", function() { return safeDecodeURI; });
 
381
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filterURLForDisplay", function() { return filterURLForDisplay; });
 
382
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
 
383
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76);
 
384
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
 
385
 
 
386
 
 
387
/**
 
388
 * External dependencies
 
389
 */
 
390
 
 
391
var URL_REGEXP = /^(?:https?:)?\/\/\S+$/i;
 
392
var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
 
393
var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
 
394
/**
 
395
 * Determines whether the given string looks like a URL.
 
396
 *
 
397
 * @param {string} url The string to scrutinise.
 
398
 *
 
399
 * @return {boolean} Whether or not it looks like a URL.
 
400
 */
 
401
 
 
402
function isURL(url) {
 
403
  return URL_REGEXP.test(url);
 
404
}
 
405
/**
 
406
 * Returns the protocol part of the URL.
 
407
 *
 
408
 * @param {string} url The full URL.
 
409
 *
 
410
 * @return {?string} The protocol part of the URL.
 
411
 */
 
412
 
 
413
function getProtocol(url) {
 
414
  var matches = /^([^\s:]+:)/.exec(url);
 
415
 
 
416
  if (matches) {
 
417
    return matches[1];
 
418
  }
 
419
}
 
420
/**
 
421
 * Tests if a url protocol is valid.
 
422
 *
 
423
 * @param {string} protocol The url protocol.
 
424
 *
 
425
 * @return {boolean} True if the argument is a valid protocol (e.g. http:, tel:).
 
426
 */
 
427
 
 
428
function isValidProtocol(protocol) {
 
429
  if (!protocol) {
 
430
    return false;
 
431
  }
 
432
 
 
433
  return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol);
 
434
}
 
435
/**
 
436
 * Returns the authority part of the URL.
 
437
 *
 
438
 * @param {string} url The full URL.
 
439
 *
 
440
 * @return {?string} The authority part of the URL.
 
441
 */
 
442
 
 
443
function getAuthority(url) {
 
444
  var matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url);
 
445
 
 
446
  if (matches) {
 
447
    return matches[1];
 
448
  }
 
449
}
 
450
/**
 
451
 * Checks for invalid characters within the provided authority.
 
452
 *
 
453
 * @param {string} authority A string containing the URL authority.
 
454
 *
 
455
 * @return {boolean} True if the argument contains a valid authority.
 
456
 */
 
457
 
 
458
function isValidAuthority(authority) {
 
459
  if (!authority) {
 
460
    return false;
 
461
  }
 
462
 
 
463
  return /^[^\s#?]+$/.test(authority);
 
464
}
 
465
/**
 
466
 * Returns the path part of the URL.
 
467
 *
 
468
 * @param {string} url The full URL.
 
469
 *
 
470
 * @return {?string} The path part of the URL.
 
471
 */
 
472
 
 
473
function getPath(url) {
 
474
  var matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url);
 
475
 
 
476
  if (matches) {
 
477
    return matches[1];
 
478
  }
 
479
}
 
480
/**
 
481
 * Checks for invalid characters within the provided path.
 
482
 *
 
483
 * @param {string} path The URL path.
 
484
 *
 
485
 * @return {boolean} True if the argument contains a valid path
 
486
 */
 
487
 
 
488
function isValidPath(path) {
 
489
  if (!path) {
 
490
    return false;
 
491
  }
 
492
 
 
493
  return /^[^\s#?]+$/.test(path);
 
494
}
 
495
/**
 
496
 * Returns the query string part of the URL.
 
497
 *
 
498
 * @param {string} url The full URL.
 
499
 *
 
500
 * @return {?string} The query string part of the URL.
 
501
 */
 
502
 
 
503
function getQueryString(url) {
 
504
  var matches = /^\S+?\?([^\s#]+)/.exec(url);
 
505
 
 
506
  if (matches) {
 
507
    return matches[1];
 
508
  }
 
509
}
 
510
/**
 
511
 * Checks for invalid characters within the provided query string.
 
512
 *
 
513
 * @param {string} queryString The query string.
 
514
 *
 
515
 * @return {boolean} True if the argument contains a valid query string.
 
516
 */
 
517
 
 
518
function isValidQueryString(queryString) {
 
519
  if (!queryString) {
 
520
    return false;
 
521
  }
 
522
 
 
523
  return /^[^\s#?\/]+$/.test(queryString);
 
524
}
 
525
/**
 
526
 * Returns the fragment part of the URL.
 
527
 *
 
528
 * @param {string} url The full URL
 
529
 *
 
530
 * @return {?string} The fragment part of the URL.
 
531
 */
 
532
 
 
533
function getFragment(url) {
 
534
  var matches = /^\S+?(#[^\s\?]*)/.exec(url);
 
535
 
 
536
  if (matches) {
 
537
    return matches[1];
 
538
  }
 
539
}
 
540
/**
 
541
 * Checks for invalid characters within the provided fragment.
 
542
 *
 
543
 * @param {string} fragment The url fragment.
 
544
 *
 
545
 * @return {boolean} True if the argument contains a valid fragment.
 
546
 */
 
547
 
 
548
function isValidFragment(fragment) {
 
549
  if (!fragment) {
 
550
    return false;
 
551
  }
 
552
 
 
553
  return /^#[^\s#?\/]*$/.test(fragment);
 
554
}
 
555
/**
 
556
 * Appends arguments to the query string of the url
 
557
 *
 
558
 * @param {string} url  URL
 
559
 * @param {Object} args Query Args
 
560
 *
 
561
 * @return {string} Updated URL
 
562
 */
 
563
 
 
564
function addQueryArgs(url, args) {
 
565
  var queryStringIndex = url.indexOf('?');
 
566
  var query = queryStringIndex !== -1 ? Object(qs__WEBPACK_IMPORTED_MODULE_1__["parse"])(url.substr(queryStringIndex + 1)) : {};
 
567
  var baseUrl = queryStringIndex !== -1 ? url.substr(0, queryStringIndex) : url;
 
568
  return baseUrl + '?' + Object(qs__WEBPACK_IMPORTED_MODULE_1__["stringify"])(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, query, args));
 
569
}
 
570
/**
 
571
 * Returns a single query argument of the url
 
572
 *
 
573
 * @param {string} url URL
 
574
 * @param {string} arg Query arg name
 
575
 *
 
576
 * @return {Array|string} Query arg value.
 
577
 */
 
578
 
 
579
function getQueryArg(url, arg) {
 
580
  var queryStringIndex = url.indexOf('?');
 
581
  var query = queryStringIndex !== -1 ? Object(qs__WEBPACK_IMPORTED_MODULE_1__["parse"])(url.substr(queryStringIndex + 1)) : {};
 
582
  return query[arg];
 
583
}
 
584
/**
 
585
 * Determines whether the URL contains a given query arg.
 
586
 *
 
587
 * @param {string} url URL
 
588
 * @param {string} arg Query arg name
 
589
 *
 
590
 * @return {boolean} Whether or not the URL contains the query aeg.
 
591
 */
 
592
 
 
593
function hasQueryArg(url, arg) {
 
594
  return getQueryArg(url, arg) !== undefined;
 
595
}
 
596
/**
 
597
 * Removes arguments from the query string of the url
 
598
 *
 
599
 * @param {string} url  URL
 
600
 * @param {...string} args Query Args
 
601
 *
 
602
 * @return {string} Updated URL
 
603
 */
 
604
 
 
605
function removeQueryArgs(url) {
 
606
  var queryStringIndex = url.indexOf('?');
 
607
  var query = queryStringIndex !== -1 ? Object(qs__WEBPACK_IMPORTED_MODULE_1__["parse"])(url.substr(queryStringIndex + 1)) : {};
 
608
  var baseUrl = queryStringIndex !== -1 ? url.substr(0, queryStringIndex) : url;
 
609
 
 
610
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
 
611
    args[_key - 1] = arguments[_key];
 
612
  }
 
613
 
 
614
  args.forEach(function (arg) {
 
615
    return delete query[arg];
 
616
  });
 
617
  return baseUrl + '?' + Object(qs__WEBPACK_IMPORTED_MODULE_1__["stringify"])(query);
 
618
}
 
619
/**
 
620
 * Prepends "http://" to a url, if it looks like something that is meant to be a TLD.
 
621
 *
 
622
 * @param  {string} url The URL to test
 
623
 *
 
624
 * @return {string}     The updated URL
 
625
 */
 
626
 
 
627
function prependHTTP(url) {
 
628
  if (!USABLE_HREF_REGEXP.test(url) && !EMAIL_REGEXP.test(url)) {
 
629
    return 'http://' + url;
 
630
  }
 
631
 
 
632
  return url;
 
633
}
 
634
/**
 
635
 * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
 
636
 * `decodeURI` throws an error.
 
637
 *
 
638
 * @param {string} uri URI to decode.
 
639
 *
 
640
 * @return {string} Decoded URI if possible.
 
641
 */
 
642
 
 
643
function safeDecodeURI(uri) {
 
644
  try {
 
645
    return decodeURI(uri);
 
646
  } catch (uriError) {
 
647
    return uri;
 
648
  }
 
649
}
 
650
/**
 
651
 * Returns a URL for display.
 
652
 *
 
653
 * @param {string} url Original URL.
 
654
 *
 
655
 * @return {string} Displayed URL.
 
656
 */
 
657
 
 
658
function filterURLForDisplay(url) {
 
659
  // Remove protocol and www prefixes.
 
660
  var filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it.
 
661
 
 
662
  if (filteredURL.match(/^[^\/]+\/$/)) {
 
663
    return filteredURL.replace('/', '');
 
664
  }
 
665
 
 
666
  return filteredURL;
 
667
}
 
668
 
 
669
 
 
670
/***/ }),
 
671
 
 
672
/***/ 300:
 
673
/***/ (function(module, exports, __webpack_require__) {
 
674
 
 
675
"use strict";
 
676
 
 
677
 
 
678
var utils = __webpack_require__(179);
 
679
var formats = __webpack_require__(180);
 
680
 
 
681
var arrayPrefixGenerators = {
 
682
    brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
 
683
        return prefix + '[]';
 
684
    },
 
685
    indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
 
686
        return prefix + '[' + key + ']';
 
687
    },
 
688
    repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
 
689
        return prefix;
 
690
    }
 
691
};
 
692
 
 
693
var toISO = Date.prototype.toISOString;
 
694
 
 
695
var defaults = {
 
696
    delimiter: '&',
 
697
    encode: true,
 
698
    encoder: utils.encode,
 
699
    encodeValuesOnly: false,
 
700
    serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
 
701
        return toISO.call(date);
 
702
    },
 
703
    skipNulls: false,
 
704
    strictNullHandling: false
 
705
};
 
706
 
 
707
var stringify = function stringify( // eslint-disable-line func-name-matching
 
708
    object,
 
709
    prefix,
 
710
    generateArrayPrefix,
 
711
    strictNullHandling,
 
712
    skipNulls,
 
713
    encoder,
 
714
    filter,
 
715
    sort,
 
716
    allowDots,
 
717
    serializeDate,
 
718
    formatter,
 
719
    encodeValuesOnly
 
720
) {
 
721
    var obj = object;
 
722
    if (typeof filter === 'function') {
 
723
        obj = filter(prefix, obj);
 
724
    } else if (obj instanceof Date) {
 
725
        obj = serializeDate(obj);
 
726
    } else if (obj === null) {
 
727
        if (strictNullHandling) {
 
728
            return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;
 
729
        }
 
730
 
 
731
        obj = '';
 
732
    }
 
733
 
 
734
    if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
 
735
        if (encoder) {
 
736
            var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder);
 
737
            return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))];
 
738
        }
 
739
        return [formatter(prefix) + '=' + formatter(String(obj))];
 
740
    }
 
741
 
 
742
    var values = [];
 
743
 
 
744
    if (typeof obj === 'undefined') {
 
745
        return values;
 
746
    }
 
747
 
 
748
    var objKeys;
 
749
    if (Array.isArray(filter)) {
 
750
        objKeys = filter;
 
751
    } else {
 
752
        var keys = Object.keys(obj);
 
753
        objKeys = sort ? keys.sort(sort) : keys;
 
754
    }
 
755
 
 
756
    for (var i = 0; i < objKeys.length; ++i) {
 
757
        var key = objKeys[i];
 
758
 
 
759
        if (skipNulls && obj[key] === null) {
 
760
            continue;
 
761
        }
 
762
 
 
763
        if (Array.isArray(obj)) {
 
764
            values = values.concat(stringify(
 
765
                obj[key],
 
766
                generateArrayPrefix(prefix, key),
 
767
                generateArrayPrefix,
 
768
                strictNullHandling,
 
769
                skipNulls,
 
770
                encoder,
 
771
                filter,
 
772
                sort,
 
773
                allowDots,
 
774
                serializeDate,
 
775
                formatter,
 
776
                encodeValuesOnly
 
777
            ));
 
778
        } else {
 
779
            values = values.concat(stringify(
 
780
                obj[key],
 
781
                prefix + (allowDots ? '.' + key : '[' + key + ']'),
 
782
                generateArrayPrefix,
 
783
                strictNullHandling,
 
784
                skipNulls,
 
785
                encoder,
 
786
                filter,
 
787
                sort,
 
788
                allowDots,
 
789
                serializeDate,
 
790
                formatter,
 
791
                encodeValuesOnly
 
792
            ));
 
793
        }
 
794
    }
 
795
 
 
796
    return values;
 
797
};
 
798
 
 
799
module.exports = function (object, opts) {
 
800
    var obj = object;
 
801
    var options = opts ? utils.assign({}, opts) : {};
 
802
 
 
803
    if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
 
804
        throw new TypeError('Encoder has to be a function.');
 
805
    }
 
806
 
 
807
    var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
 
808
    var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
 
809
    var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
 
810
    var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;
 
811
    var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;
 
812
    var sort = typeof options.sort === 'function' ? options.sort : null;
 
813
    var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
 
814
    var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
 
815
    var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;
 
816
    if (typeof options.format === 'undefined') {
 
817
        options.format = formats['default'];
 
818
    } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
 
819
        throw new TypeError('Unknown format option provided.');
 
820
    }
 
821
    var formatter = formats.formatters[options.format];
 
822
    var objKeys;
 
823
    var filter;
 
824
 
 
825
    if (typeof options.filter === 'function') {
 
826
        filter = options.filter;
 
827
        obj = filter('', obj);
 
828
    } else if (Array.isArray(options.filter)) {
 
829
        filter = options.filter;
 
830
        objKeys = filter;
 
831
    }
 
832
 
 
833
    var keys = [];
 
834
 
 
835
    if (typeof obj !== 'object' || obj === null) {
 
836
        return '';
 
837
    }
 
838
 
 
839
    var arrayFormat;
 
840
    if (options.arrayFormat in arrayPrefixGenerators) {
 
841
        arrayFormat = options.arrayFormat;
 
842
    } else if ('indices' in options) {
 
843
        arrayFormat = options.indices ? 'indices' : 'repeat';
 
844
    } else {
 
845
        arrayFormat = 'indices';
 
846
    }
 
847
 
 
848
    var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
 
849
 
 
850
    if (!objKeys) {
 
851
        objKeys = Object.keys(obj);
 
852
    }
 
853
 
 
854
    if (sort) {
 
855
        objKeys.sort(sort);
 
856
    }
 
857
 
 
858
    for (var i = 0; i < objKeys.length; ++i) {
 
859
        var key = objKeys[i];
 
860
 
 
861
        if (skipNulls && obj[key] === null) {
 
862
            continue;
 
863
        }
 
864
 
 
865
        keys = keys.concat(stringify(
 
866
            obj[key],
 
867
            key,
 
868
            generateArrayPrefix,
 
869
            strictNullHandling,
 
870
            skipNulls,
 
871
            encode ? encoder : null,
 
872
            filter,
 
873
            sort,
 
874
            allowDots,
 
875
            serializeDate,
 
876
            formatter,
 
877
            encodeValuesOnly
 
878
        ));
 
879
    }
 
880
 
 
881
    var joined = keys.join(delimiter);
 
882
    var prefix = options.addQueryPrefix === true ? '?' : '';
 
883
 
 
884
    return joined.length > 0 ? prefix + joined : '';
 
885
};
 
886
 
 
887
 
 
888
/***/ }),
 
889
 
 
890
/***/ 301:
 
891
/***/ (function(module, exports, __webpack_require__) {
 
892
 
 
893
"use strict";
 
894
 
 
895
 
 
896
var utils = __webpack_require__(179);
 
897
 
 
898
var has = Object.prototype.hasOwnProperty;
 
899
 
 
900
var defaults = {
 
901
    allowDots: false,
 
902
    allowPrototypes: false,
 
903
    arrayLimit: 20,
 
904
    decoder: utils.decode,
 
905
    delimiter: '&',
 
906
    depth: 5,
 
907
    parameterLimit: 1000,
 
908
    plainObjects: false,
 
909
    strictNullHandling: false
 
910
};
 
911
 
 
912
var parseValues = function parseQueryStringValues(str, options) {
 
913
    var obj = {};
 
914
    var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
 
915
    var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
 
916
    var parts = cleanStr.split(options.delimiter, limit);
 
917
 
 
918
    for (var i = 0; i < parts.length; ++i) {
 
919
        var part = parts[i];
 
920
 
 
921
        var bracketEqualsPos = part.indexOf(']=');
 
922
        var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
 
923
 
 
924
        var key, val;
 
925
        if (pos === -1) {
 
926
            key = options.decoder(part, defaults.decoder);
 
927
            val = options.strictNullHandling ? null : '';
 
928
        } else {
 
929
            key = options.decoder(part.slice(0, pos), defaults.decoder);
 
930
            val = options.decoder(part.slice(pos + 1), defaults.decoder);
 
931
        }
 
932
        if (has.call(obj, key)) {
 
933
            obj[key] = [].concat(obj[key]).concat(val);
 
934
        } else {
 
935
            obj[key] = val;
 
936
        }
 
937
    }
 
938
 
 
939
    return obj;
 
940
};
 
941
 
 
942
var parseObject = function (chain, val, options) {
 
943
    var leaf = val;
 
944
 
 
945
    for (var i = chain.length - 1; i >= 0; --i) {
 
946
        var obj;
 
947
        var root = chain[i];
 
948
 
 
949
        if (root === '[]') {
 
950
            obj = [];
 
951
            obj = obj.concat(leaf);
 
952
        } else {
 
953
            obj = options.plainObjects ? Object.create(null) : {};
 
954
            var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
 
955
            var index = parseInt(cleanRoot, 10);
 
956
            if (
 
957
                !isNaN(index)
 
958
                && root !== cleanRoot
 
959
                && String(index) === cleanRoot
 
960
                && index >= 0
 
961
                && (options.parseArrays && index <= options.arrayLimit)
 
962
            ) {
 
963
                obj = [];
 
964
                obj[index] = leaf;
 
965
            } else {
 
966
                obj[cleanRoot] = leaf;
 
967
            }
 
968
        }
 
969
 
 
970
        leaf = obj;
 
971
    }
 
972
 
 
973
    return leaf;
 
974
};
 
975
 
 
976
var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
 
977
    if (!givenKey) {
 
978
        return;
 
979
    }
 
980
 
 
981
    // Transform dot notation to bracket notation
 
982
    var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
 
983
 
 
984
    // The regex chunks
 
985
 
 
986
    var brackets = /(\[[^[\]]*])/;
 
987
    var child = /(\[[^[\]]*])/g;
 
988
 
 
989
    // Get the parent
 
990
 
 
991
    var segment = brackets.exec(key);
 
992
    var parent = segment ? key.slice(0, segment.index) : key;
 
993
 
 
994
    // Stash the parent if it exists
 
995
 
 
996
    var keys = [];
 
997
    if (parent) {
 
998
        // If we aren't using plain objects, optionally prefix keys
 
999
        // that would overwrite object prototype properties
 
1000
        if (!options.plainObjects && has.call(Object.prototype, parent)) {
 
1001
            if (!options.allowPrototypes) {
 
1002
                return;
 
1003
            }
 
1004
        }
 
1005
 
 
1006
        keys.push(parent);
 
1007
    }
 
1008
 
 
1009
    // Loop through children appending to the array until we hit depth
 
1010
 
 
1011
    var i = 0;
 
1012
    while ((segment = child.exec(key)) !== null && i < options.depth) {
 
1013
        i += 1;
 
1014
        if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
 
1015
            if (!options.allowPrototypes) {
 
1016
                return;
 
1017
            }
 
1018
        }
 
1019
        keys.push(segment[1]);
 
1020
    }
 
1021
 
 
1022
    // If there's a remainder, just add whatever is left
 
1023
 
 
1024
    if (segment) {
 
1025
        keys.push('[' + key.slice(segment.index) + ']');
 
1026
    }
 
1027
 
 
1028
    return parseObject(keys, val, options);
 
1029
};
 
1030
 
 
1031
module.exports = function (str, opts) {
 
1032
    var options = opts ? utils.assign({}, opts) : {};
 
1033
 
 
1034
    if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {
 
1035
        throw new TypeError('Decoder has to be a function.');
 
1036
    }
 
1037
 
 
1038
    options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;
 
1039
    options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
 
1040
    options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
 
1041
    options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
 
1042
    options.parseArrays = options.parseArrays !== false;
 
1043
    options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;
 
1044
    options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;
 
1045
    options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;
 
1046
    options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;
 
1047
    options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;
 
1048
    options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
 
1049
 
 
1050
    if (str === '' || str === null || typeof str === 'undefined') {
 
1051
        return options.plainObjects ? Object.create(null) : {};
 
1052
    }
 
1053
 
 
1054
    var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
 
1055
    var obj = options.plainObjects ? Object.create(null) : {};
 
1056
 
 
1057
    // Iterate over the keys and setup the new object
 
1058
 
 
1059
    var keys = Object.keys(tempObj);
 
1060
    for (var i = 0; i < keys.length; ++i) {
 
1061
        var key = keys[i];
 
1062
        var newObj = parseKeys(key, tempObj[key], options);
 
1063
        obj = utils.merge(obj, newObj, options);
 
1064
    }
 
1065
 
 
1066
    return utils.compact(obj);
 
1067
};
 
1068
 
 
1069
 
 
1070
/***/ }),
 
1071
 
 
1072
/***/ 76:
 
1073
/***/ (function(module, exports, __webpack_require__) {
 
1074
 
 
1075
"use strict";
 
1076
 
 
1077
 
 
1078
var stringify = __webpack_require__(300);
 
1079
var parse = __webpack_require__(301);
 
1080
var formats = __webpack_require__(180);
 
1081
 
 
1082
module.exports = {
 
1083
    formats: formats,
 
1084
    parse: parse,
 
1085
    stringify: stringify
 
1086
};
 
1087
 
 
1088
 
 
1089
/***/ }),
 
1090
 
 
1091
/***/ 8:
 
1092
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
1093
 
 
1094
"use strict";
 
1095
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
 
1096
/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
 
1097
 
 
1098
function _objectSpread(target) {
 
1099
  for (var i = 1; i < arguments.length; i++) {
 
1100
    var source = arguments[i] != null ? arguments[i] : {};
 
1101
    var ownKeys = Object.keys(source);
 
1102
 
 
1103
    if (typeof Object.getOwnPropertySymbols === 'function') {
 
1104
      ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
 
1105
        return Object.getOwnPropertyDescriptor(source, sym).enumerable;
 
1106
      }));
 
1107
    }
 
1108
 
 
1109
    ownKeys.forEach(function (key) {
 
1110
      Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
 
1111
    });
 
1112
  }
 
1113
 
 
1114
  return target;
 
1115
}
 
1116
 
 
1117
/***/ })
 
1118
 
 
1119
/******/ });
 
 
b'\\ No newline at end of file'