[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
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 = 465); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ({ 89 90 /***/ 11: 91 /***/ (function(module, __webpack_exports__, __webpack_require__) { 92 93 "use strict"; 94 95 // EXPORTS 96 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); 97 98 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js 99 var arrayWithHoles = __webpack_require__(38); 100 101 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js 102 function _iterableToArrayLimit(arr, i) { 103 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 104 var _arr = []; 105 var _n = true; 106 var _d = false; 107 var _e = undefined; 108 109 try { 110 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 111 _arr.push(_s.value); 112 113 if (i && _arr.length === i) break; 114 } 115 } catch (err) { 116 _d = true; 117 _e = err; 118 } finally { 119 try { 120 if (!_n && _i["return"] != null) _i["return"](); 121 } finally { 122 if (_d) throw _e; 123 } 124 } 125 126 return _arr; 127 } 128 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js 129 var unsupportedIterableToArray = __webpack_require__(31); 130 131 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js 132 var nonIterableRest = __webpack_require__(39); 133 134 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js 135 136 137 138 139 function _slicedToArray(arr, i) { 140 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); 141 } 142 143 /***/ }), 144 145 /***/ 2: 146 /***/ (function(module, exports) { 147 148 (function() { module.exports = window["lodash"]; }()); 149 150 /***/ }), 151 152 /***/ 24: 153 /***/ (function(module, __webpack_exports__, __webpack_require__) { 154 155 "use strict"; 156 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); 157 function _arrayLikeToArray(arr, len) { 158 if (len == null || len > arr.length) len = arr.length; 159 160 for (var i = 0, arr2 = new Array(len); i < len; i++) { 161 arr2[i] = arr[i]; 162 } 163 164 return arr2; 165 } 166 167 /***/ }), 168 169 /***/ 31: 170 /***/ (function(module, __webpack_exports__, __webpack_require__) { 171 172 "use strict"; 173 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); 174 /* harmony import */ var _babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24); 175 176 function _unsupportedIterableToArray(o, minLen) { 177 if (!o) return; 178 if (typeof o === "string") return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); 179 var n = Object.prototype.toString.call(o).slice(8, -1); 180 if (n === "Object" && o.constructor) n = o.constructor.name; 181 if (n === "Map" || n === "Set") return Array.from(o); 182 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); 183 } 184 185 /***/ }), 186 187 /***/ 38: 188 /***/ (function(module, __webpack_exports__, __webpack_require__) { 189 190 "use strict"; 191 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); 192 function _arrayWithHoles(arr) { 193 if (Array.isArray(arr)) return arr; 194 } 195 196 /***/ }), 197 198 /***/ 39: 199 /***/ (function(module, __webpack_exports__, __webpack_require__) { 200 201 "use strict"; 202 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); 203 function _nonIterableRest() { 204 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 205 } 206 207 /***/ }), 208 209 /***/ 465: 210 /***/ (function(module, __webpack_exports__, __webpack_require__) { 211 212 "use strict"; 213 // ESM COMPAT FLAG 214 __webpack_require__.r(__webpack_exports__); 215 216 // EXPORTS 217 __webpack_require__.d(__webpack_exports__, "isURL", function() { return /* reexport */ isURL; }); 218 __webpack_require__.d(__webpack_exports__, "isEmail", function() { return /* reexport */ isEmail; }); 219 __webpack_require__.d(__webpack_exports__, "getProtocol", function() { return /* reexport */ getProtocol; }); 220 __webpack_require__.d(__webpack_exports__, "isValidProtocol", function() { return /* reexport */ isValidProtocol; }); 221 __webpack_require__.d(__webpack_exports__, "getAuthority", function() { return /* reexport */ getAuthority; }); 222 __webpack_require__.d(__webpack_exports__, "isValidAuthority", function() { return /* reexport */ isValidAuthority; }); 223 __webpack_require__.d(__webpack_exports__, "getPath", function() { return /* reexport */ getPath; }); 224 __webpack_require__.d(__webpack_exports__, "isValidPath", function() { return /* reexport */ isValidPath; }); 225 __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return /* reexport */ getQueryString; }); 226 __webpack_require__.d(__webpack_exports__, "buildQueryString", function() { return /* reexport */ buildQueryString; }); 227 __webpack_require__.d(__webpack_exports__, "isValidQueryString", function() { return /* reexport */ isValidQueryString; }); 228 __webpack_require__.d(__webpack_exports__, "getPathAndQueryString", function() { return /* reexport */ getPathAndQueryString; }); 229 __webpack_require__.d(__webpack_exports__, "getFragment", function() { return /* reexport */ getFragment; }); 230 __webpack_require__.d(__webpack_exports__, "isValidFragment", function() { return /* reexport */ isValidFragment; }); 231 __webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return /* reexport */ addQueryArgs; }); 232 __webpack_require__.d(__webpack_exports__, "getQueryArg", function() { return /* reexport */ getQueryArg; }); 233 __webpack_require__.d(__webpack_exports__, "getQueryArgs", function() { return /* reexport */ getQueryArgs; }); 234 __webpack_require__.d(__webpack_exports__, "hasQueryArg", function() { return /* reexport */ hasQueryArg; }); 235 __webpack_require__.d(__webpack_exports__, "removeQueryArgs", function() { return /* reexport */ removeQueryArgs; }); 236 __webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return /* reexport */ prependHTTP; }); 237 __webpack_require__.d(__webpack_exports__, "safeDecodeURI", function() { return /* reexport */ safeDecodeURI; }); 238 __webpack_require__.d(__webpack_exports__, "safeDecodeURIComponent", function() { return /* reexport */ safeDecodeURIComponent; }); 239 __webpack_require__.d(__webpack_exports__, "filterURLForDisplay", function() { return /* reexport */ filterURLForDisplay; }); 240 __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; }); 241 242 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-url.js 243 /** 244 * Determines whether the given string looks like a URL. 245 * 246 * @param {string} url The string to scrutinise. 247 * 248 * @example 249 * ```js 250 * const isURL = isURL( 'https://wordpress.org' ); // true 251 * ``` 252 * 253 * @see https://url.spec.whatwg.org/ 254 * @see https://url.spec.whatwg.org/#valid-url-string 255 * 256 * @return {boolean} Whether or not it looks like a URL. 257 */ 258 function isURL(url) { 259 // A URL can be considered value if the `URL` constructor is able to parse 260 // it. The constructor throws an error for an invalid URL. 261 try { 262 new URL(url); 263 return true; 264 } catch (_unused) { 265 return false; 266 } 267 } 268 269 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js 270 var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; 271 /** 272 * Determines whether the given string looks like an email. 273 * 274 * @param {string} email The string to scrutinise. 275 * 276 * @example 277 * ```js 278 * const isEmail = isEmail( 'hello@wordpress.org' ); // true 279 * ``` 280 * 281 * @return {boolean} Whether or not it looks like an email. 282 */ 283 284 function isEmail(email) { 285 return EMAIL_REGEXP.test(email); 286 } 287 288 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-protocol.js 289 /** 290 * Returns the protocol part of the URL. 291 * 292 * @param {string} url The full URL. 293 * 294 * @example 295 * ```js 296 * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:' 297 * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:' 298 * ``` 299 * 300 * @return {string|void} The protocol part of the URL. 301 */ 302 function getProtocol(url) { 303 var matches = /^([^\s:]+:)/.exec(url); 304 305 if (matches) { 306 return matches[1]; 307 } 308 } 309 310 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-protocol.js 311 /** 312 * Tests if a url protocol is valid. 313 * 314 * @param {string} protocol The url protocol. 315 * 316 * @example 317 * ```js 318 * const isValid = isValidProtocol( 'https:' ); // true 319 * const isNotValid = isValidProtocol( 'https :' ); // false 320 * ``` 321 * 322 * @return {boolean} True if the argument is a valid protocol (e.g. http:, tel:). 323 */ 324 function isValidProtocol(protocol) { 325 if (!protocol) { 326 return false; 327 } 328 329 return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol); 330 } 331 332 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-authority.js 333 /** 334 * Returns the authority part of the URL. 335 * 336 * @param {string} url The full URL. 337 * 338 * @example 339 * ```js 340 * const authority1 = getAuthority( 'https://wordpress.org/help/' ); // 'wordpress.org' 341 * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080' 342 * ``` 343 * 344 * @return {string|void} The authority part of the URL. 345 */ 346 function getAuthority(url) { 347 var matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url); 348 349 if (matches) { 350 return matches[1]; 351 } 352 } 353 354 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-authority.js 355 /** 356 * Checks for invalid characters within the provided authority. 357 * 358 * @param {string} authority A string containing the URL authority. 359 * 360 * @example 361 * ```js 362 * const isValid = isValidAuthority( 'wordpress.org' ); // true 363 * const isNotValid = isValidAuthority( 'wordpress#org' ); // false 364 * ``` 365 * 366 * @return {boolean} True if the argument contains a valid authority. 367 */ 368 function isValidAuthority(authority) { 369 if (!authority) { 370 return false; 371 } 372 373 return /^[^\s#?]+$/.test(authority); 374 } 375 376 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path.js 377 /** 378 * Returns the path part of the URL. 379 * 380 * @param {string} url The full URL. 381 * 382 * @example 383 * ```js 384 * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test' 385 * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq' 386 * ``` 387 * 388 * @return {string|void} The path part of the URL. 389 */ 390 function getPath(url) { 391 var matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url); 392 393 if (matches) { 394 return matches[1]; 395 } 396 } 397 398 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-path.js 399 /** 400 * Checks for invalid characters within the provided path. 401 * 402 * @param {string} path The URL path. 403 * 404 * @example 405 * ```js 406 * const isValid = isValidPath( 'test/path/' ); // true 407 * const isNotValid = isValidPath( '/invalid?test/path/' ); // false 408 * ``` 409 * 410 * @return {boolean} True if the argument contains a valid path 411 */ 412 function isValidPath(path) { 413 if (!path) { 414 return false; 415 } 416 417 return /^[^\s#?]+$/.test(path); 418 } 419 420 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-string.js 421 /** 422 * Returns the query string part of the URL. 423 * 424 * @param {string} url The full URL. 425 * 426 * @example 427 * ```js 428 * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true' 429 * ``` 430 * 431 * @return {string|void} The query string part of the URL. 432 */ 433 function getQueryString(url) { 434 var query; 435 436 try { 437 query = new URL(url, 'http://example.com').search.substring(1); 438 } catch (error) {} 439 440 if (query) { 441 return query; 442 } 443 } 444 445 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules 446 var slicedToArray = __webpack_require__(11); 447 448 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/build-query-string.js 449 450 451 function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 452 453 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 454 455 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 456 457 /** 458 * Generates URL-encoded query string using input query data. 459 * 460 * It is intended to behave equivalent as PHP's `http_build_query`, configured 461 * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`). 462 * 463 * @example 464 * ```js 465 * const queryString = buildQueryString( { 466 * simple: 'is ok', 467 * arrays: [ 'are', 'fine', 'too' ], 468 * objects: { 469 * evenNested: { 470 * ok: 'yes', 471 * }, 472 * }, 473 * } ); 474 * // "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes" 475 * ``` 476 * 477 * @param {Record<string,*>} data Data to encode. 478 * 479 * @return {string} Query string. 480 */ 481 function buildQueryString(data) { 482 var string = ''; 483 var stack = Object.entries(data); 484 var pair; 485 486 while (pair = stack.shift()) { 487 var _pair = pair, 488 _pair2 = Object(slicedToArray["a" /* default */])(_pair, 2), 489 key = _pair2[0], 490 value = _pair2[1]; // Support building deeply nested data, from array or object values. 491 492 493 var hasNestedData = Array.isArray(value) || value && value.constructor === Object; 494 495 if (hasNestedData) { 496 // Push array or object values onto the stack as composed of their 497 // original key and nested index or key, retaining order by a 498 // combination of Array#reverse and Array#unshift onto the stack. 499 var valuePairs = Object.entries(value).reverse(); 500 501 var _iterator = _createForOfIteratorHelper(valuePairs), 502 _step; 503 504 try { 505 for (_iterator.s(); !(_step = _iterator.n()).done;) { 506 var _step$value = Object(slicedToArray["a" /* default */])(_step.value, 2), 507 member = _step$value[0], 508 memberValue = _step$value[1]; 509 510 stack.unshift(["".concat(key, "[").concat(member, "]"), memberValue]); 511 } 512 } catch (err) { 513 _iterator.e(err); 514 } finally { 515 _iterator.f(); 516 } 517 } else if (value !== undefined) { 518 // Null is treated as special case, equivalent to empty string. 519 if (value === null) { 520 value = ''; 521 } 522 523 string += '&' + [key, value].map(encodeURIComponent).join('='); 524 } 525 } // Loop will concatenate with leading `&`, but it's only expected for all 526 // but the first query parameter. This strips the leading `&`, while still 527 // accounting for the case that the string may in-fact be empty. 528 529 530 return string.substr(1); 531 } 532 533 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js 534 /** 535 * Checks for invalid characters within the provided query string. 536 * 537 * @param {string} queryString The query string. 538 * 539 * @example 540 * ```js 541 * const isValid = isValidQueryString( 'query=true&another=false' ); // true 542 * const isNotValid = isValidQueryString( 'query=true?another=false' ); // false 543 * ``` 544 * 545 * @return {boolean} True if the argument contains a valid query string. 546 */ 547 function isValidQueryString(queryString) { 548 if (!queryString) { 549 return false; 550 } 551 552 return /^[^\s#?\/]+$/.test(queryString); 553 } 554 555 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js 556 /** 557 * Internal dependencies 558 */ 559 560 /** 561 * Returns the path part and query string part of the URL. 562 * 563 * @param {string} url The full URL. 564 * 565 * @example 566 * ```js 567 * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true' 568 * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq' 569 * ``` 570 * 571 * @return {string} The path part and query string part of the URL. 572 */ 573 574 function getPathAndQueryString(url) { 575 var path = getPath(url); 576 var queryString = getQueryString(url); 577 var value = '/'; 578 if (path) value += path; 579 if (queryString) value += "?".concat(queryString); 580 return value; 581 } 582 583 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js 584 /** 585 * Returns the fragment part of the URL. 586 * 587 * @param {string} url The full URL 588 * 589 * @example 590 * ```js 591 * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment' 592 * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment' 593 * ``` 594 * 595 * @return {string|void} The fragment part of the URL. 596 */ 597 function getFragment(url) { 598 var matches = /^\S+?(#[^\s\?]*)/.exec(url); 599 600 if (matches) { 601 return matches[1]; 602 } 603 } 604 605 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-fragment.js 606 /** 607 * Checks for invalid characters within the provided fragment. 608 * 609 * @param {string} fragment The url fragment. 610 * 611 * @example 612 * ```js 613 * const isValid = isValidFragment( '#valid-fragment' ); // true 614 * const isNotValid = isValidFragment( '#invalid-#fragment' ); // false 615 * ``` 616 * 617 * @return {boolean} True if the argument contains a valid fragment. 618 */ 619 function isValidFragment(fragment) { 620 if (!fragment) { 621 return false; 622 } 623 624 return /^#[^\s#?\/]*$/.test(fragment); 625 } 626 627 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js 628 var defineProperty = __webpack_require__(5); 629 630 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js 631 632 633 634 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 635 636 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 637 638 /** 639 * Internal dependencies 640 */ 641 642 /** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */ 643 644 /** 645 * @typedef {Record<string,QueryArgParsed>} QueryArgs 646 */ 647 648 /** 649 * Sets a value in object deeply by a given array of path segments. Mutates the 650 * object reference. 651 * 652 * @param {Record<string,*>} object Object in which to assign. 653 * @param {string[]} path Path segment at which to set value. 654 * @param {*} value Value to set. 655 */ 656 657 function setPath(object, path, value) { 658 var length = path.length; 659 var lastIndex = length - 1; 660 661 for (var i = 0; i < length; i++) { 662 var key = path[i]; 663 664 if (!key && Array.isArray(object)) { 665 // If key is empty string and next value is array, derive key from 666 // the current length of the array. 667 key = object.length.toString(); 668 } // If the next key in the path is numeric (or empty string), it will be 669 // created as an array. Otherwise, it will be created as an object. 670 671 672 var isNextKeyArrayIndex = !isNaN(Number(path[i + 1])); 673 object[key] = i === lastIndex ? // If at end of path, assign the intended value. 674 value : // Otherwise, advance to the next object in the path, creating 675 // it if it does not yet exist. 676 object[key] || (isNextKeyArrayIndex ? [] : {}); 677 678 if (Array.isArray(object[key]) && !isNextKeyArrayIndex) { 679 // If we current key is non-numeric, but the next value is an 680 // array, coerce the value to an object. 681 object[key] = _objectSpread({}, object[key]); 682 } // Update working reference object to the next in the path. 683 684 685 object = object[key]; 686 } 687 } 688 /** 689 * Returns an object of query arguments of the given URL. If the given URL is 690 * invalid or has no querystring, an empty object is returned. 691 * 692 * @param {string} url URL. 693 * 694 * @example 695 * ```js 696 * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' ); 697 * // { "foo": "bar", "bar": "baz" } 698 * ``` 699 * 700 * @return {QueryArgs} Query args object. 701 */ 702 703 704 function getQueryArgs(url) { 705 return (getQueryString(url) || ''). // Normalize space encoding, accounting for PHP URL encoding 706 // corresponding to `application/x-www-form-urlencoded`. 707 // 708 // See: https://tools.ietf.org/html/rfc1866#section-8.2.1 709 replace(/\+/g, '%20').split('&').reduce(function (accumulator, keyValue) { 710 var _keyValue$split$filte = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where 711 // default is restored in destructuring assignment. 712 .filter(Boolean).map(decodeURIComponent), 713 _keyValue$split$filte2 = Object(slicedToArray["a" /* default */])(_keyValue$split$filte, 2), 714 key = _keyValue$split$filte2[0], 715 _keyValue$split$filte3 = _keyValue$split$filte2[1], 716 value = _keyValue$split$filte3 === void 0 ? '' : _keyValue$split$filte3; 717 718 if (key) { 719 var segments = key.replace(/\]/g, '').split('['); 720 setPath(accumulator, segments, value); 721 } 722 723 return accumulator; 724 }, {}); 725 } 726 727 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js 728 /** 729 * Internal dependencies 730 */ 731 732 733 /** 734 * Appends arguments as querystring to the provided URL. If the URL already 735 * includes query arguments, the arguments are merged with (and take precedent 736 * over) the existing set. 737 * 738 * @param {string} [url=''] URL to which arguments should be appended. If omitted, 739 * only the resulting querystring is returned. 740 * @param {Object} [args] Query arguments to apply to URL. 741 * 742 * @example 743 * ```js 744 * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test 745 * ``` 746 * 747 * @return {string} URL with arguments applied. 748 */ 749 750 function addQueryArgs() { 751 var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 752 var args = arguments.length > 1 ? arguments[1] : undefined; 753 754 // If no arguments are to be appended, return original URL. 755 if (!args || !Object.keys(args).length) { 756 return url; 757 } 758 759 var baseUrl = url; // Determine whether URL already had query arguments. 760 761 var queryStringIndex = url.indexOf('?'); 762 763 if (queryStringIndex !== -1) { 764 // Merge into existing query arguments. 765 args = Object.assign(getQueryArgs(url), args); // Change working base URL to omit previous query arguments. 766 767 baseUrl = baseUrl.substr(0, queryStringIndex); 768 } 769 770 return baseUrl + '?' + buildQueryString(args); 771 } 772 773 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js 774 /** 775 * Internal dependencies 776 */ 777 778 /* eslint-disable jsdoc/valid-types */ 779 780 /** 781 * @typedef {{[key: string]: QueryArgParsed}} QueryArgObject 782 */ 783 784 /* eslint-enable */ 785 786 /** 787 * @typedef {string|string[]|QueryArgObject} QueryArgParsed 788 */ 789 790 /** 791 * Returns a single query argument of the url 792 * 793 * @param {string} url URL. 794 * @param {string} arg Query arg name. 795 * 796 * @example 797 * ```js 798 * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar 799 * ``` 800 * 801 * @return {QueryArgParsed|void} Query arg value. 802 */ 803 804 function getQueryArg(url, arg) { 805 return getQueryArgs(url)[arg]; 806 } 807 808 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js 809 /** 810 * Internal dependencies 811 */ 812 813 /** 814 * Determines whether the URL contains a given query arg. 815 * 816 * @param {string} url URL. 817 * @param {string} arg Query arg name. 818 * 819 * @example 820 * ```js 821 * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true 822 * ``` 823 * 824 * @return {boolean} Whether or not the URL contains the query arg. 825 */ 826 827 function hasQueryArg(url, arg) { 828 return getQueryArg(url, arg) !== undefined; 829 } 830 831 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js 832 /** 833 * Internal dependencies 834 */ 835 836 837 /** 838 * Removes arguments from the query string of the url 839 * 840 * @param {string} url URL. 841 * @param {...string} args Query Args. 842 * 843 * @example 844 * ```js 845 * const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar 846 * ``` 847 * 848 * @return {string} Updated URL. 849 */ 850 851 function removeQueryArgs(url) { 852 var queryStringIndex = url.indexOf('?'); 853 854 if (queryStringIndex === -1) { 855 return url; 856 } 857 858 var query = getQueryArgs(url); 859 var baseURL = url.substr(0, queryStringIndex); 860 861 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 862 args[_key - 1] = arguments[_key]; 863 } 864 865 args.forEach(function (arg) { 866 return delete query[arg]; 867 }); 868 var queryString = buildQueryString(query); 869 return queryString ? baseURL + '?' + queryString : baseURL; 870 } 871 872 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js 873 /** 874 * Internal dependencies 875 */ 876 877 var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i; 878 /** 879 * Prepends "http://" to a url, if it looks like something that is meant to be a TLD. 880 * 881 * @param {string} url The URL to test. 882 * 883 * @example 884 * ```js 885 * const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org 886 * ``` 887 * 888 * @return {string} The updated URL. 889 */ 890 891 function prependHTTP(url) { 892 if (!url) { 893 return url; 894 } 895 896 url = url.trim(); 897 898 if (!USABLE_HREF_REGEXP.test(url) && !isEmail(url)) { 899 return 'http://' + url; 900 } 901 902 return url; 903 } 904 905 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri.js 906 /** 907 * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if 908 * `decodeURI` throws an error. 909 * 910 * @param {string} uri URI to decode. 911 * 912 * @example 913 * ```js 914 * const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z' 915 * ``` 916 * 917 * @return {string} Decoded URI if possible. 918 */ 919 function safeDecodeURI(uri) { 920 try { 921 return decodeURI(uri); 922 } catch (uriError) { 923 return uri; 924 } 925 } 926 927 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js 928 /** 929 * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if 930 * `decodeURIComponent` throws an error. 931 * 932 * @param {string} uriComponent URI component to decode. 933 * 934 * @return {string} Decoded URI component if possible. 935 */ 936 function safeDecodeURIComponent(uriComponent) { 937 try { 938 return decodeURIComponent(uriComponent); 939 } catch (uriComponentError) { 940 return uriComponent; 941 } 942 } 943 944 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js 945 /** 946 * Returns a URL for display. 947 * 948 * @param {string} url Original URL. 949 * @param {number|null} maxLength URL length. 950 * 951 * @example 952 * ```js 953 * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg 954 * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png 955 * ``` 956 * 957 * @return {string} Displayed URL. 958 */ 959 function filterURLForDisplay(url) { 960 var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 961 // Remove protocol and www prefixes. 962 var filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it. 963 964 if (filteredURL.match(/^[^\/]+\/$/)) { 965 filteredURL = filteredURL.replace('/', ''); 966 } 967 968 var mediaRegexp = /([\w|:])*\.(?:jpg|jpeg|gif|png|svg)/; 969 970 if (!maxLength || filteredURL.length <= maxLength || !filteredURL.match(mediaRegexp)) { 971 return filteredURL; 972 } // If the file is not greater than max length, return last portion of URL. 973 974 975 filteredURL = filteredURL.split('?')[0]; 976 var urlPieces = filteredURL.split('/'); 977 var file = urlPieces[urlPieces.length - 1]; 978 979 if (file.length <= maxLength) { 980 return '…' + filteredURL.slice(-maxLength); 981 } // If the file is greater than max length, truncate the file. 982 983 984 var index = file.lastIndexOf('.'); 985 var _ref = [file.slice(0, index), file.slice(index + 1)], 986 fileName = _ref[0], 987 extension = _ref[1]; 988 var truncatedFile = fileName.slice(-3) + '.' + extension; 989 return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile; 990 } 991 992 // EXTERNAL MODULE: external "lodash" 993 var external_lodash_ = __webpack_require__(2); 994 995 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js 996 /** 997 * External dependencies 998 */ 999 1000 /** 1001 * Performs some basic cleanup of a string for use as a post slug. 1002 * 1003 * This replicates some of what `sanitize_title()` does in WordPress core, but 1004 * is only designed to approximate what the slug will be. 1005 * 1006 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin 1007 * letters. Removes combining diacritical marks. Converts whitespace, periods, 1008 * and forward slashes to hyphens. Removes any remaining non-word characters 1009 * except hyphens. Converts remaining string to lowercase. It does not account 1010 * for octets, HTML entities, or other encoded characters. 1011 * 1012 * @param {string} string Title or slug to be processed. 1013 * 1014 * @return {string} Processed string. 1015 */ 1016 1017 function cleanForSlug(string) { 1018 if (!string) { 1019 return ''; 1020 } 1021 1022 return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-'); 1023 } 1024 1025 // CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 /***/ }), 1053 1054 /***/ 5: 1055 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1056 1057 "use strict"; 1058 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); 1059 function _defineProperty(obj, key, value) { 1060 if (key in obj) { 1061 Object.defineProperty(obj, key, { 1062 value: value, 1063 enumerable: true, 1064 configurable: true, 1065 writable: true 1066 }); 1067 } else { 1068 obj[key] = value; 1069 } 1070 1071 return obj; 1072 } 1073 1074 /***/ }) 1075 1076 /******/ });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Mar 6 01:00:04 2021 | Cross-referenced by PHPXref 0.7.1 |