PageSourceSearch

https://www.fundacion-granell.gal/wp-includes/js/dist/url.js?ver=52ebb5d46ceac12c583cc27606583f7a

js fundacion-granell.gal collected 2026-10-02 12:44:30 UTC 29,112 bytes, 951 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.