[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/js/dist/ -> url.js (source)

   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 = "./node_modules/@wordpress/url/build-module/index.js");
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
  91  /*!*******************************************************************!*\
  92    !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
  93    \*******************************************************************/
  94  /*! exports provided: default */
  95  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  96  
  97  "use strict";
  98  __webpack_require__.r(__webpack_exports__);
  99  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _defineProperty; });
 100  function _defineProperty(obj, key, value) {
 101    if (key in obj) {
 102      Object.defineProperty(obj, key, {
 103        value: value,
 104        enumerable: true,
 105        configurable: true,
 106        writable: true
 107      });
 108    } else {
 109      obj[key] = value;
 110    }
 111  
 112    return obj;
 113  }
 114  
 115  /***/ }),
 116  
 117  /***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js":
 118  /*!*****************************************************************!*\
 119    !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread.js ***!
 120    \*****************************************************************/
 121  /*! exports provided: default */
 122  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 123  
 124  "use strict";
 125  __webpack_require__.r(__webpack_exports__);
 126  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectSpread; });
 127  /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
 128  
 129  function _objectSpread(target) {
 130    for (var i = 1; i < arguments.length; i++) {
 131      var source = arguments[i] != null ? arguments[i] : {};
 132      var ownKeys = Object.keys(source);
 133  
 134      if (typeof Object.getOwnPropertySymbols === 'function') {
 135        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
 136          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
 137        }));
 138      }
 139  
 140      ownKeys.forEach(function (key) {
 141        Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(target, key, source[key]);
 142      });
 143    }
 144  
 145    return target;
 146  }
 147  
 148  /***/ }),
 149  
 150  /***/ "./node_modules/@wordpress/url/build-module/index.js":
 151  /*!***********************************************************!*\
 152    !*** ./node_modules/@wordpress/url/build-module/index.js ***!
 153    \***********************************************************/
 154  /*! exports provided: isURL, addQueryArgs, prependHTTP */
 155  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 156  
 157  "use strict";
 158  __webpack_require__.r(__webpack_exports__);
 159  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isURL", function() { return isURL; });
 160  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return addQueryArgs; });
 161  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return prependHTTP; });
 162  /* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
 163  /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "./node_modules/@wordpress/url/node_modules/qs/lib/index.js");
 164  /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
 165  
 166  
 167  /**
 168   * External dependencies
 169   */
 170  
 171  var URL_REGEXP = /^(?:https?:)?\/\/\S+$/i;
 172  var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
 173  var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
 174  /**
 175   * Determines whether the given string looks like a URL.
 176   *
 177   * @param {string} url The string to scrutinise.
 178   *
 179   * @return {boolean} Whether or not it looks like a URL.
 180   */
 181  
 182  function isURL(url) {
 183    return URL_REGEXP.test(url);
 184  }
 185  /**
 186   * Appends arguments to the query string of the url
 187   *
 188   * @param  {string} url   URL
 189   * @param  {Object} args  Query Args
 190   *
 191   * @return {string}       Updated URL
 192   */
 193  
 194  function addQueryArgs(url, args) {
 195    var queryStringIndex = url.indexOf('?');
 196    var query = queryStringIndex !== -1 ? Object(qs__WEBPACK_IMPORTED_MODULE_1__["parse"])(url.substr(queryStringIndex + 1)) : {};
 197    var baseUrl = queryStringIndex !== -1 ? url.substr(0, queryStringIndex) : url;
 198    return baseUrl + '?' + Object(qs__WEBPACK_IMPORTED_MODULE_1__["stringify"])(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, query, args));
 199  }
 200  /**
 201   * Prepends "http://" to a url, if it looks like something that is meant to be a TLD.
 202   *
 203   * @param  {string} url The URL to test
 204   *
 205   * @return {string}     The updated URL
 206   */
 207  
 208  function prependHTTP(url) {
 209    if (!USABLE_HREF_REGEXP.test(url) && !EMAIL_REGEXP.test(url)) {
 210      return 'http://' + url;
 211    }
 212  
 213    return url;
 214  }
 215  
 216  
 217  /***/ }),
 218  
 219  /***/ "./node_modules/@wordpress/url/node_modules/qs/lib/formats.js":
 220  /*!********************************************************************!*\
 221    !*** ./node_modules/@wordpress/url/node_modules/qs/lib/formats.js ***!
 222    \********************************************************************/
 223  /*! no static exports found */
 224  /***/ (function(module, exports, __webpack_require__) {
 225  
 226  "use strict";
 227  
 228  
 229  var replace = String.prototype.replace;
 230  var percentTwenties = /%20/g;
 231  
 232  module.exports = {
 233      'default': 'RFC3986',
 234      formatters: {
 235          RFC1738: function (value) {
 236              return replace.call(value, percentTwenties, '+');
 237          },
 238          RFC3986: function (value) {
 239              return value;
 240          }
 241      },
 242      RFC1738: 'RFC1738',
 243      RFC3986: 'RFC3986'
 244  };
 245  
 246  
 247  /***/ }),
 248  
 249  /***/ "./node_modules/@wordpress/url/node_modules/qs/lib/index.js":
 250  /*!******************************************************************!*\
 251    !*** ./node_modules/@wordpress/url/node_modules/qs/lib/index.js ***!
 252    \******************************************************************/
 253  /*! no static exports found */
 254  /***/ (function(module, exports, __webpack_require__) {
 255  
 256  "use strict";
 257  
 258  
 259  var stringify = __webpack_require__(/*! ./stringify */ "./node_modules/@wordpress/url/node_modules/qs/lib/stringify.js");
 260  var parse = __webpack_require__(/*! ./parse */ "./node_modules/@wordpress/url/node_modules/qs/lib/parse.js");
 261  var formats = __webpack_require__(/*! ./formats */ "./node_modules/@wordpress/url/node_modules/qs/lib/formats.js");
 262  
 263  module.exports = {
 264      formats: formats,
 265      parse: parse,
 266      stringify: stringify
 267  };
 268  
 269  
 270  /***/ }),
 271  
 272  /***/ "./node_modules/@wordpress/url/node_modules/qs/lib/parse.js":
 273  /*!******************************************************************!*\
 274    !*** ./node_modules/@wordpress/url/node_modules/qs/lib/parse.js ***!
 275    \******************************************************************/
 276  /*! no static exports found */
 277  /***/ (function(module, exports, __webpack_require__) {
 278  
 279  "use strict";
 280  
 281  
 282  var utils = __webpack_require__(/*! ./utils */ "./node_modules/@wordpress/url/node_modules/qs/lib/utils.js");
 283  
 284  var has = Object.prototype.hasOwnProperty;
 285  
 286  var defaults = {
 287      allowDots: false,
 288      allowPrototypes: false,
 289      arrayLimit: 20,
 290      charset: 'utf-8',
 291      charsetSentinel: false,
 292      decoder: utils.decode,
 293      delimiter: '&',
 294      depth: 5,
 295      ignoreQueryPrefix: false,
 296      interpretNumericEntities: false,
 297      parameterLimit: 1000,
 298      parseArrays: true,
 299      plainObjects: false,
 300      strictNullHandling: false
 301  };
 302  
 303  var interpretNumericEntities = function (str) {
 304      return str.replace(/&#(\d+);/g, function ($0, numberStr) {
 305          return String.fromCharCode(parseInt(numberStr, 10));
 306      });
 307  };
 308  
 309  // This is what browsers will submit when the ✓ character occurs in an
 310  // application/x-www-form-urlencoded body and the encoding of the page containing
 311  // the form is iso-8859-1, or when the submitted form has an accept-charset
 312  // attribute of iso-8859-1. Presumably also with other charsets that do not contain
 313  // the ✓ character, such as us-ascii.
 314  var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
 315  
 316  // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
 317  var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
 318  
 319  var parseValues = function parseQueryStringValues(str, options) {
 320      var obj = {};
 321      var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
 322      var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
 323      var parts = cleanStr.split(options.delimiter, limit);
 324      var skipIndex = -1; // Keep track of where the utf8 sentinel was found
 325      var i;
 326  
 327      var charset = options.charset;
 328      if (options.charsetSentinel) {
 329          for (i = 0; i < parts.length; ++i) {
 330              if (parts[i].indexOf('utf8=') === 0) {
 331                  if (parts[i] === charsetSentinel) {
 332                      charset = 'utf-8';
 333                  } else if (parts[i] === isoSentinel) {
 334                      charset = 'iso-8859-1';
 335                  }
 336                  skipIndex = i;
 337                  i = parts.length; // The eslint settings do not allow break;
 338              }
 339          }
 340      }
 341  
 342      for (i = 0; i < parts.length; ++i) {
 343          if (i === skipIndex) {
 344              continue;
 345          }
 346          var part = parts[i];
 347  
 348          var bracketEqualsPos = part.indexOf(']=');
 349          var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
 350  
 351          var key, val;
 352          if (pos === -1) {
 353              key = options.decoder(part, defaults.decoder, charset);
 354              val = options.strictNullHandling ? null : '';
 355          } else {
 356              key = options.decoder(part.slice(0, pos), defaults.decoder, charset);
 357              val = options.decoder(part.slice(pos + 1), defaults.decoder, charset);
 358          }
 359  
 360          if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
 361              val = interpretNumericEntities(val);
 362          }
 363          if (has.call(obj, key)) {
 364              obj[key] = utils.combine(obj[key], val);
 365          } else {
 366              obj[key] = val;
 367          }
 368      }
 369  
 370      return obj;
 371  };
 372  
 373  var parseObject = function (chain, val, options) {
 374      var leaf = val;
 375  
 376      for (var i = chain.length - 1; i >= 0; --i) {
 377          var obj;
 378          var root = chain[i];
 379  
 380          if (root === '[]' && options.parseArrays) {
 381              obj = [].concat(leaf);
 382          } else {
 383              obj = options.plainObjects ? Object.create(null) : {};
 384              var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
 385              var index = parseInt(cleanRoot, 10);
 386              if (!options.parseArrays && cleanRoot === '') {
 387                  obj = { 0: leaf };
 388              } else if (
 389                  !isNaN(index)
 390                  && root !== cleanRoot
 391                  && String(index) === cleanRoot
 392                  && index >= 0
 393                  && (options.parseArrays && index <= options.arrayLimit)
 394              ) {
 395                  obj = [];
 396                  obj[index] = leaf;
 397              } else {
 398                  obj[cleanRoot] = leaf;
 399              }
 400          }
 401  
 402          leaf = obj;
 403      }
 404  
 405      return leaf;
 406  };
 407  
 408  var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
 409      if (!givenKey) {
 410          return;
 411      }
 412  
 413      // Transform dot notation to bracket notation
 414      var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
 415  
 416      // The regex chunks
 417  
 418      var brackets = /(\[[^[\]]*])/;
 419      var child = /(\[[^[\]]*])/g;
 420  
 421      // Get the parent
 422  
 423      var segment = brackets.exec(key);
 424      var parent = segment ? key.slice(0, segment.index) : key;
 425  
 426      // Stash the parent if it exists
 427  
 428      var keys = [];
 429      if (parent) {
 430          // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
 431          if (!options.plainObjects && has.call(Object.prototype, parent)) {
 432              if (!options.allowPrototypes) {
 433                  return;
 434              }
 435          }
 436  
 437          keys.push(parent);
 438      }
 439  
 440      // Loop through children appending to the array until we hit depth
 441  
 442      var i = 0;
 443      while ((segment = child.exec(key)) !== null && i < options.depth) {
 444          i += 1;
 445          if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
 446              if (!options.allowPrototypes) {
 447                  return;
 448              }
 449          }
 450          keys.push(segment[1]);
 451      }
 452  
 453      // If there's a remainder, just add whatever is left
 454  
 455      if (segment) {
 456          keys.push('[' + key.slice(segment.index) + ']');
 457      }
 458  
 459      return parseObject(keys, val, options);
 460  };
 461  
 462  module.exports = function (str, opts) {
 463      var options = opts ? utils.assign({}, opts) : {};
 464  
 465      if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {
 466          throw new TypeError('Decoder has to be a function.');
 467      }
 468  
 469      options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;
 470      options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
 471      options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
 472      options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
 473      options.parseArrays = options.parseArrays !== false;
 474      options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;
 475      options.allowDots = typeof options.allowDots === 'undefined' ? defaults.allowDots : !!options.allowDots;
 476      options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;
 477      options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;
 478      options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;
 479      options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
 480  
 481      if (typeof options.charset !== 'undefined' && options.charset !== 'utf-8' && options.charset !== 'iso-8859-1') {
 482          throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined');
 483      }
 484      if (typeof options.charset === 'undefined') {
 485          options.charset = defaults.charset;
 486      }
 487  
 488      if (str === '' || str === null || typeof str === 'undefined') {
 489          return options.plainObjects ? Object.create(null) : {};
 490      }
 491  
 492      var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
 493      var obj = options.plainObjects ? Object.create(null) : {};
 494  
 495      // Iterate over the keys and setup the new object
 496  
 497      var keys = Object.keys(tempObj);
 498      for (var i = 0; i < keys.length; ++i) {
 499          var key = keys[i];
 500          var newObj = parseKeys(key, tempObj[key], options);
 501          obj = utils.merge(obj, newObj, options);
 502      }
 503  
 504      return utils.compact(obj);
 505  };
 506  
 507  
 508  /***/ }),
 509  
 510  /***/ "./node_modules/@wordpress/url/node_modules/qs/lib/stringify.js":
 511  /*!**********************************************************************!*\
 512    !*** ./node_modules/@wordpress/url/node_modules/qs/lib/stringify.js ***!
 513    \**********************************************************************/
 514  /*! no static exports found */
 515  /***/ (function(module, exports, __webpack_require__) {
 516  
 517  "use strict";
 518  
 519  
 520  var utils = __webpack_require__(/*! ./utils */ "./node_modules/@wordpress/url/node_modules/qs/lib/utils.js");
 521  var formats = __webpack_require__(/*! ./formats */ "./node_modules/@wordpress/url/node_modules/qs/lib/formats.js");
 522  
 523  var arrayPrefixGenerators = {
 524      brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
 525          return prefix + '[]';
 526      },
 527      indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
 528          return prefix + '[' + key + ']';
 529      },
 530      repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
 531          return prefix;
 532      }
 533  };
 534  
 535  var isArray = Array.isArray;
 536  var push = Array.prototype.push;
 537  var pushToArray = function (arr, valueOrArray) {
 538      push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
 539  };
 540  
 541  var toISO = Date.prototype.toISOString;
 542  
 543  var defaults = {
 544      addQueryPrefix: false,
 545      allowDots: false,
 546      charset: 'utf-8',
 547      charsetSentinel: false,
 548      delimiter: '&',
 549      encode: true,
 550      encoder: utils.encode,
 551      encodeValuesOnly: false,
 552      // deprecated
 553      indices: false,
 554      serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
 555          return toISO.call(date);
 556      },
 557      skipNulls: false,
 558      strictNullHandling: false
 559  };
 560  
 561  var stringify = function stringify( // eslint-disable-line func-name-matching
 562      object,
 563      prefix,
 564      generateArrayPrefix,
 565      strictNullHandling,
 566      skipNulls,
 567      encoder,
 568      filter,
 569      sort,
 570      allowDots,
 571      serializeDate,
 572      formatter,
 573      encodeValuesOnly,
 574      charset
 575  ) {
 576      var obj = object;
 577      if (typeof filter === 'function') {
 578          obj = filter(prefix, obj);
 579      } else if (obj instanceof Date) {
 580          obj = serializeDate(obj);
 581      }
 582  
 583      if (obj === null) {
 584          if (strictNullHandling) {
 585              return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset) : prefix;
 586          }
 587  
 588          obj = '';
 589      }
 590  
 591      if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
 592          if (encoder) {
 593              var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset);
 594              return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset))];
 595          }
 596          return [formatter(prefix) + '=' + formatter(String(obj))];
 597      }
 598  
 599      var values = [];
 600  
 601      if (typeof obj === 'undefined') {
 602          return values;
 603      }
 604  
 605      var objKeys;
 606      if (Array.isArray(filter)) {
 607          objKeys = filter;
 608      } else {
 609          var keys = Object.keys(obj);
 610          objKeys = sort ? keys.sort(sort) : keys;
 611      }
 612  
 613      for (var i = 0; i < objKeys.length; ++i) {
 614          var key = objKeys[i];
 615  
 616          if (skipNulls && obj[key] === null) {
 617              continue;
 618          }
 619  
 620          if (Array.isArray(obj)) {
 621              pushToArray(values, stringify(
 622                  obj[key],
 623                  generateArrayPrefix(prefix, key),
 624                  generateArrayPrefix,
 625                  strictNullHandling,
 626                  skipNulls,
 627                  encoder,
 628                  filter,
 629                  sort,
 630                  allowDots,
 631                  serializeDate,
 632                  formatter,
 633                  encodeValuesOnly,
 634                  charset
 635              ));
 636          } else {
 637              pushToArray(values, stringify(
 638                  obj[key],
 639                  prefix + (allowDots ? '.' + key : '[' + key + ']'),
 640                  generateArrayPrefix,
 641                  strictNullHandling,
 642                  skipNulls,
 643                  encoder,
 644                  filter,
 645                  sort,
 646                  allowDots,
 647                  serializeDate,
 648                  formatter,
 649                  encodeValuesOnly,
 650                  charset
 651              ));
 652          }
 653      }
 654  
 655      return values;
 656  };
 657  
 658  module.exports = function (object, opts) {
 659      var obj = object;
 660      var options = opts ? utils.assign({}, opts) : {};
 661  
 662      if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
 663          throw new TypeError('Encoder has to be a function.');
 664      }
 665  
 666      var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
 667      var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
 668      var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
 669      var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;
 670      var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;
 671      var sort = typeof options.sort === 'function' ? options.sort : null;
 672      var allowDots = typeof options.allowDots === 'undefined' ? defaults.allowDots : !!options.allowDots;
 673      var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
 674      var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;
 675      var charset = options.charset || defaults.charset;
 676      if (typeof options.charset !== 'undefined' && options.charset !== 'utf-8' && options.charset !== 'iso-8859-1') {
 677          throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined');
 678      }
 679  
 680      if (typeof options.format === 'undefined') {
 681          options.format = formats['default'];
 682      } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
 683          throw new TypeError('Unknown format option provided.');
 684      }
 685      var formatter = formats.formatters[options.format];
 686      var objKeys;
 687      var filter;
 688  
 689      if (typeof options.filter === 'function') {
 690          filter = options.filter;
 691          obj = filter('', obj);
 692      } else if (Array.isArray(options.filter)) {
 693          filter = options.filter;
 694          objKeys = filter;
 695      }
 696  
 697      var keys = [];
 698  
 699      if (typeof obj !== 'object' || obj === null) {
 700          return '';
 701      }
 702  
 703      var arrayFormat;
 704      if (options.arrayFormat in arrayPrefixGenerators) {
 705          arrayFormat = options.arrayFormat;
 706      } else if ('indices' in options) {
 707          arrayFormat = options.indices ? 'indices' : 'repeat';
 708      } else {
 709          arrayFormat = 'indices';
 710      }
 711  
 712      var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
 713  
 714      if (!objKeys) {
 715          objKeys = Object.keys(obj);
 716      }
 717  
 718      if (sort) {
 719          objKeys.sort(sort);
 720      }
 721  
 722      for (var i = 0; i < objKeys.length; ++i) {
 723          var key = objKeys[i];
 724  
 725          if (skipNulls && obj[key] === null) {
 726              continue;
 727          }
 728          pushToArray(keys, stringify(
 729              obj[key],
 730              key,
 731              generateArrayPrefix,
 732              strictNullHandling,
 733              skipNulls,
 734              encode ? encoder : null,
 735              filter,
 736              sort,
 737              allowDots,
 738              serializeDate,
 739              formatter,
 740              encodeValuesOnly,
 741              charset
 742          ));
 743      }
 744  
 745      var joined = keys.join(delimiter);
 746      var prefix = options.addQueryPrefix === true ? '?' : '';
 747  
 748      if (options.charsetSentinel) {
 749          if (charset === 'iso-8859-1') {
 750              // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
 751              prefix += 'utf8=%26%2310003%3B&';
 752          } else {
 753              // encodeURIComponent('✓')
 754              prefix += 'utf8=%E2%9C%93&';
 755          }
 756      }
 757  
 758      return joined.length > 0 ? prefix + joined : '';
 759  };
 760  
 761  
 762  /***/ }),
 763  
 764  /***/ "./node_modules/@wordpress/url/node_modules/qs/lib/utils.js":
 765  /*!******************************************************************!*\
 766    !*** ./node_modules/@wordpress/url/node_modules/qs/lib/utils.js ***!
 767    \******************************************************************/
 768  /*! no static exports found */
 769  /***/ (function(module, exports, __webpack_require__) {
 770  
 771  "use strict";
 772  
 773  
 774  var has = Object.prototype.hasOwnProperty;
 775  
 776  var hexTable = (function () {
 777      var array = [];
 778      for (var i = 0; i < 256; ++i) {
 779          array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
 780      }
 781  
 782      return array;
 783  }());
 784  
 785  var compactQueue = function compactQueue(queue) {
 786      while (queue.length > 1) {
 787          var item = queue.pop();
 788          var obj = item.obj[item.prop];
 789  
 790          if (Array.isArray(obj)) {
 791              var compacted = [];
 792  
 793              for (var j = 0; j < obj.length; ++j) {
 794                  if (typeof obj[j] !== 'undefined') {
 795                      compacted.push(obj[j]);
 796                  }
 797              }
 798  
 799              item.obj[item.prop] = compacted;
 800          }
 801      }
 802  };
 803  
 804  var arrayToObject = function arrayToObject(source, options) {
 805      var obj = options && options.plainObjects ? Object.create(null) : {};
 806      for (var i = 0; i < source.length; ++i) {
 807          if (typeof source[i] !== 'undefined') {
 808              obj[i] = source[i];
 809          }
 810      }
 811  
 812      return obj;
 813  };
 814  
 815  var merge = function merge(target, source, options) {
 816      if (!source) {
 817          return target;
 818      }
 819  
 820      if (typeof source !== 'object') {
 821          if (Array.isArray(target)) {
 822              target.push(source);
 823          } else if (typeof target === 'object') {
 824              if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
 825                  target[source] = true;
 826              }
 827          } else {
 828              return [target, source];
 829          }
 830  
 831          return target;
 832      }
 833  
 834      if (typeof target !== 'object') {
 835          return [target].concat(source);
 836      }
 837  
 838      var mergeTarget = target;
 839      if (Array.isArray(target) && !Array.isArray(source)) {
 840          mergeTarget = arrayToObject(target, options);
 841      }
 842  
 843      if (Array.isArray(target) && Array.isArray(source)) {
 844          source.forEach(function (item, i) {
 845              if (has.call(target, i)) {
 846                  if (target[i] && typeof target[i] === 'object') {
 847                      target[i] = merge(target[i], item, options);
 848                  } else {
 849                      target.push(item);
 850                  }
 851              } else {
 852                  target[i] = item;
 853              }
 854          });
 855          return target;
 856      }
 857  
 858      return Object.keys(source).reduce(function (acc, key) {
 859          var value = source[key];
 860  
 861          if (has.call(acc, key)) {
 862              acc[key] = merge(acc[key], value, options);
 863          } else {
 864              acc[key] = value;
 865          }
 866          return acc;
 867      }, mergeTarget);
 868  };
 869  
 870  var assign = function assignSingleSource(target, source) {
 871      return Object.keys(source).reduce(function (acc, key) {
 872          acc[key] = source[key];
 873          return acc;
 874      }, target);
 875  };
 876  
 877  var decode = function (str, decoder, charset) {
 878      var strWithoutPlus = str.replace(/\+/g, ' ');
 879      if (charset === 'iso-8859-1') {
 880          // unescape never throws, no try...catch needed:
 881          return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
 882      }
 883      // utf-8
 884      try {
 885          return decodeURIComponent(strWithoutPlus);
 886      } catch (e) {
 887          return strWithoutPlus;
 888      }
 889  };
 890  
 891  var encode = function encode(str, defaultEncoder, charset) {
 892      // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
 893      // It has been adapted here for stricter adherence to RFC 3986
 894      if (str.length === 0) {
 895          return str;
 896      }
 897  
 898      var string = typeof str === 'string' ? str : String(str);
 899  
 900      if (charset === 'iso-8859-1') {
 901          return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
 902              return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
 903          });
 904      }
 905  
 906      var out = '';
 907      for (var i = 0; i < string.length; ++i) {
 908          var c = string.charCodeAt(i);
 909  
 910          if (
 911              c === 0x2D // -
 912              || c === 0x2E // .
 913              || c === 0x5F // _
 914              || c === 0x7E // ~
 915              || (c >= 0x30 && c <= 0x39) // 0-9
 916              || (c >= 0x41 && c <= 0x5A) // a-z
 917              || (c >= 0x61 && c <= 0x7A) // A-Z
 918          ) {
 919              out += string.charAt(i);
 920              continue;
 921          }
 922  
 923          if (c < 0x80) {
 924              out = out + hexTable[c];
 925              continue;
 926          }
 927  
 928          if (c < 0x800) {
 929              out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
 930              continue;
 931          }
 932  
 933          if (c < 0xD800 || c >= 0xE000) {
 934              out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
 935              continue;
 936          }
 937  
 938          i += 1;
 939          c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
 940          out += hexTable[0xF0 | (c >> 18)]
 941              + hexTable[0x80 | ((c >> 12) & 0x3F)]
 942              + hexTable[0x80 | ((c >> 6) & 0x3F)]
 943              + hexTable[0x80 | (c & 0x3F)];
 944      }
 945  
 946      return out;
 947  };
 948  
 949  var compact = function compact(value) {
 950      var queue = [{ obj: { o: value }, prop: 'o' }];
 951      var refs = [];
 952  
 953      for (var i = 0; i < queue.length; ++i) {
 954          var item = queue[i];
 955          var obj = item.obj[item.prop];
 956  
 957          var keys = Object.keys(obj);
 958          for (var j = 0; j < keys.length; ++j) {
 959              var key = keys[j];
 960              var val = obj[key];
 961              if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
 962                  queue.push({ obj: obj, prop: key });
 963                  refs.push(val);
 964              }
 965          }
 966      }
 967  
 968      compactQueue(queue);
 969  
 970      return value;
 971  };
 972  
 973  var isRegExp = function isRegExp(obj) {
 974      return Object.prototype.toString.call(obj) === '[object RegExp]';
 975  };
 976  
 977  var isBuffer = function isBuffer(obj) {
 978      if (obj === null || typeof obj === 'undefined') {
 979          return false;
 980      }
 981  
 982      return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
 983  };
 984  
 985  var combine = function combine(a, b) {
 986      return [].concat(a, b);
 987  };
 988  
 989  module.exports = {
 990      arrayToObject: arrayToObject,
 991      assign: assign,
 992      combine: combine,
 993      compact: compact,
 994      decode: decode,
 995      encode: encode,
 996      isBuffer: isBuffer,
 997      isRegExp: isRegExp,
 998      merge: merge
 999  };
1000  
1001  
1002  /***/ })
1003  
1004  /******/ });
1005  //# sourceMappingURL=url.js.map


Generated: Mon Jan 7 01:00:05 2019 Cross-referenced by PHPXref 0.7.1