@wordpress/url 4.32.0 → 4.32.1-next.47f435fc9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/build/add-query-args.js +35 -40
  2. package/build/add-query-args.js.map +7 -1
  3. package/build/build-query-string.js +30 -43
  4. package/build/build-query-string.js.map +7 -1
  5. package/build/clean-for-slug.js +39 -43
  6. package/build/clean-for-slug.js.map +7 -1
  7. package/build/filter-url-for-display.js +39 -39
  8. package/build/filter-url-for-display.js.map +7 -1
  9. package/build/get-authority.js +29 -19
  10. package/build/get-authority.js.map +7 -1
  11. package/build/get-filename.js +29 -21
  12. package/build/get-filename.js.map +7 -1
  13. package/build/get-fragment.js +26 -18
  14. package/build/get-fragment.js.map +7 -1
  15. package/build/get-path-and-query-string.js +30 -26
  16. package/build/get-path-and-query-string.js.map +7 -1
  17. package/build/get-path.js +26 -18
  18. package/build/get-path.js.map +7 -1
  19. package/build/get-protocol.js +26 -18
  20. package/build/get-protocol.js.map +7 -1
  21. package/build/get-query-arg.js +28 -24
  22. package/build/get-query-arg.js.map +7 -1
  23. package/build/get-query-args.js +42 -65
  24. package/build/get-query-args.js.map +7 -1
  25. package/build/get-query-string.js +29 -20
  26. package/build/get-query-string.js.map +7 -1
  27. package/build/has-query-arg.js +28 -24
  28. package/build/has-query-arg.js.map +7 -1
  29. package/build/index.js +109 -201
  30. package/build/index.js.map +7 -1
  31. package/build/is-email.js +26 -18
  32. package/build/is-email.js.map +7 -1
  33. package/build/is-phone-number.js +27 -20
  34. package/build/is-phone-number.js.map +7 -1
  35. package/build/is-url.js +26 -23
  36. package/build/is-url.js.map +7 -1
  37. package/build/is-valid-authority.js +26 -18
  38. package/build/is-valid-authority.js.map +7 -1
  39. package/build/is-valid-fragment.js +26 -18
  40. package/build/is-valid-fragment.js.map +7 -1
  41. package/build/is-valid-path.js +26 -18
  42. package/build/is-valid-path.js.map +7 -1
  43. package/build/is-valid-protocol.js +26 -18
  44. package/build/is-valid-protocol.js.map +7 -1
  45. package/build/is-valid-query-string.js +26 -18
  46. package/build/is-valid-query-string.js.map +7 -1
  47. package/build/normalize-path.js +28 -32
  48. package/build/normalize-path.js.map +7 -1
  49. package/build/prepend-http.js +29 -25
  50. package/build/prepend-http.js.map +7 -1
  51. package/build/prepend-https.js +30 -29
  52. package/build/prepend-https.js.map +7 -1
  53. package/build/remove-query-args.js +35 -31
  54. package/build/remove-query-args.js.map +7 -1
  55. package/build/safe-decode-uri-component.js +26 -13
  56. package/build/safe-decode-uri-component.js.map +7 -1
  57. package/build/safe-decode-uri.js +26 -18
  58. package/build/safe-decode-uri.js.map +7 -1
  59. package/build-module/add-query-args.js +12 -35
  60. package/build-module/add-query-args.js.map +7 -1
  61. package/build-module/build-query-string.js +9 -40
  62. package/build-module/build-query-string.js.map +7 -1
  63. package/build-module/clean-for-slug.js +8 -39
  64. package/build-module/clean-for-slug.js.map +7 -1
  65. package/build-module/filter-url-for-display.js +18 -36
  66. package/build-module/filter-url-for-display.js.map +7 -1
  67. package/build-module/get-authority.js +8 -16
  68. package/build-module/get-authority.js.map +7 -1
  69. package/build-module/get-filename.js +8 -18
  70. package/build-module/get-filename.js.map +7 -1
  71. package/build-module/get-fragment.js +5 -15
  72. package/build-module/get-fragment.js.map +7 -1
  73. package/build-module/get-path-and-query-string.js +7 -21
  74. package/build-module/get-path-and-query-string.js.map +7 -1
  75. package/build-module/get-path.js +5 -15
  76. package/build-module/get-path.js.map +7 -1
  77. package/build-module/get-protocol.js +5 -15
  78. package/build-module/get-protocol.js.map +7 -1
  79. package/build-module/get-query-arg.js +6 -19
  80. package/build-module/get-query-arg.js.map +7 -1
  81. package/build-module/get-query-args.js +21 -61
  82. package/build-module/get-query-args.js.map +7 -1
  83. package/build-module/get-query-string.js +8 -17
  84. package/build-module/get-query-string.js.map +7 -1
  85. package/build-module/has-query-arg.js +7 -21
  86. package/build-module/has-query-arg.js.map +7 -1
  87. package/build-module/index.js +59 -29
  88. package/build-module/index.js.map +7 -1
  89. package/build-module/is-email.js +5 -15
  90. package/build-module/is-email.js.map +7 -1
  91. package/build-module/is-phone-number.js +6 -17
  92. package/build-module/is-phone-number.js.map +7 -1
  93. package/build-module/is-url.js +5 -20
  94. package/build-module/is-url.js.map +7 -1
  95. package/build-module/is-valid-authority.js +5 -15
  96. package/build-module/is-valid-authority.js.map +7 -1
  97. package/build-module/is-valid-fragment.js +5 -15
  98. package/build-module/is-valid-fragment.js.map +7 -1
  99. package/build-module/is-valid-path.js +5 -15
  100. package/build-module/is-valid-path.js.map +7 -1
  101. package/build-module/is-valid-protocol.js +5 -15
  102. package/build-module/is-valid-protocol.js.map +7 -1
  103. package/build-module/is-valid-query-string.js +5 -15
  104. package/build-module/is-valid-query-string.js.map +7 -1
  105. package/build-module/normalize-path.js +7 -29
  106. package/build-module/normalize-path.js.map +7 -1
  107. package/build-module/prepend-http.js +7 -20
  108. package/build-module/prepend-http.js.map +7 -1
  109. package/build-module/prepend-https.js +8 -25
  110. package/build-module/prepend-https.js.map +7 -1
  111. package/build-module/remove-query-args.js +12 -26
  112. package/build-module/remove-query-args.js.map +7 -1
  113. package/build-module/safe-decode-uri-component.js +5 -10
  114. package/build-module/safe-decode-uri-component.js.map +7 -1
  115. package/build-module/safe-decode-uri.js +5 -15
  116. package/build-module/safe-decode-uri.js.map +7 -1
  117. package/package.json +10 -3
@@ -1 +1,7 @@
1
- {"version":3,"names":["getFragment","url","matches","exec"],"sources":["@wordpress/url/src/get-fragment.ts"],"sourcesContent":["/**\n * Returns the fragment part of the URL.\n *\n * @param url The full URL\n *\n * @example\n * ```js\n * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'\n * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'\n * ```\n *\n * @return The fragment part of the URL.\n */\nexport function getFragment( url: string ): string | void {\n\tconst matches = /^\\S+?(#[^\\s\\?]*)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,MAAMC,OAAO,GAAG,kBAAkB,CAACC,IAAI,CAAEF,GAAI,CAAC;EAC9C,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-fragment.ts"],
4
+ "sourcesContent": ["/**\n * Returns the fragment part of the URL.\n *\n * @param url The full URL\n *\n * @example\n * ```js\n * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'\n * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'\n * ```\n *\n * @return The fragment part of the URL.\n */\nexport function getFragment( url: string ): string | void {\n\tconst matches = /^\\S+?(#[^\\s\\?]*)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,YAAa,KAA6B;AACzD,QAAM,UAAU,mBAAmB,KAAM,GAAI;AAC7C,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
+ "names": []
7
+ }
@@ -1,31 +1,31 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_path_and_query_string_exports = {};
20
+ __export(get_path_and_query_string_exports, {
21
+ getPathAndQueryString: () => getPathAndQueryString
5
22
  });
6
- exports.getPathAndQueryString = getPathAndQueryString;
7
- var _ = require(".");
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- /**
13
- * Returns the path part and query string part of the URL.
14
- *
15
- * @param url The full URL.
16
- *
17
- * @example
18
- * ```js
19
- * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'
20
- * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'
21
- * ```
22
- *
23
- * @return The path part and query string part of the URL.
24
- */
23
+ module.exports = __toCommonJS(get_path_and_query_string_exports);
24
+ var import__ = require(".");
25
25
  function getPathAndQueryString(url) {
26
- const path = (0, _.getPath)(url);
27
- const queryString = (0, _.getQueryString)(url);
28
- let value = '/';
26
+ const path = (0, import__.getPath)(url);
27
+ const queryString = (0, import__.getQueryString)(url);
28
+ let value = "/";
29
29
  if (path) {
30
30
  value += path;
31
31
  }
@@ -34,4 +34,8 @@ function getPathAndQueryString(url) {
34
34
  }
35
35
  return value;
36
36
  }
37
- //# sourceMappingURL=get-path-and-query-string.js.map
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ getPathAndQueryString
40
+ });
41
+ //# sourceMappingURL=get-path-and-query-string.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_","require","getPathAndQueryString","url","path","getPath","queryString","getQueryString","value"],"sources":["@wordpress/url/src/get-path-and-query-string.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPath, getQueryString } from '.';\n\n/**\n * Returns the path part and query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'\n * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'\n * ```\n *\n * @return The path part and query string part of the URL.\n */\nexport function getPathAndQueryString( url: string ): string {\n\tconst path = getPath( url );\n\tconst queryString = getQueryString( url );\n\tlet value = '/';\n\tif ( path ) {\n\t\tvalue += path;\n\t}\n\tif ( queryString ) {\n\t\tvalue += `?${ queryString }`;\n\t}\n\treturn value;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAEC,GAAW,EAAW;EAC5D,MAAMC,IAAI,GAAG,IAAAC,SAAO,EAAEF,GAAI,CAAC;EAC3B,MAAMG,WAAW,GAAG,IAAAC,gBAAc,EAAEJ,GAAI,CAAC;EACzC,IAAIK,KAAK,GAAG,GAAG;EACf,IAAKJ,IAAI,EAAG;IACXI,KAAK,IAAIJ,IAAI;EACd;EACA,IAAKE,WAAW,EAAG;IAClBE,KAAK,IAAI,IAAKF,WAAW,EAAG;EAC7B;EACA,OAAOE,KAAK;AACb","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-path-and-query-string.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getPath, getQueryString } from '.';\n\n/**\n * Returns the path part and query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'\n * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'\n * ```\n *\n * @return The path part and query string part of the URL.\n */\nexport function getPathAndQueryString( url: string ): string {\n\tconst path = getPath( url );\n\tconst queryString = getQueryString( url );\n\tlet value = '/';\n\tif ( path ) {\n\t\tvalue += path;\n\t}\n\tif ( queryString ) {\n\t\tvalue += `?${ queryString }`;\n\t}\n\treturn value;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,eAAwC;AAejC,SAAS,sBAAuB,KAAsB;AAC5D,QAAM,WAAO,kBAAS,GAAI;AAC1B,QAAM,kBAAc,yBAAgB,GAAI;AACxC,MAAI,QAAQ;AACZ,MAAK,MAAO;AACX,aAAS;AAAA,EACV;AACA,MAAK,aAAc;AAClB,aAAS,IAAK,WAAY;AAAA,EAC3B;AACA,SAAO;AACR;",
6
+ "names": []
7
+ }
package/build/get-path.js CHANGED
@@ -1,26 +1,34 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_path_exports = {};
20
+ __export(get_path_exports, {
21
+ getPath: () => getPath
5
22
  });
6
- exports.getPath = getPath;
7
- /**
8
- * Returns the path part of the URL.
9
- *
10
- * @param url The full URL.
11
- *
12
- * @example
13
- * ```js
14
- * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test'
15
- * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'
16
- * ```
17
- *
18
- * @return The path part of the URL.
19
- */
23
+ module.exports = __toCommonJS(get_path_exports);
20
24
  function getPath(url) {
21
25
  const matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url);
22
26
  if (matches) {
23
27
  return matches[1];
24
28
  }
25
29
  }
26
- //# sourceMappingURL=get-path.js.map
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ getPath
33
+ });
34
+ //# sourceMappingURL=get-path.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getPath","url","matches","exec"],"sources":["@wordpress/url/src/get-path.ts"],"sourcesContent":["/**\n * Returns the path part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test'\n * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'\n * ```\n *\n * @return The path part of the URL.\n */\nexport function getPath( url: string ): string | void {\n\tconst matches =\n\t\t/^[^\\/\\s:]+:(?:\\/\\/)?[^\\/\\s#?]+[\\/]([^\\s#?]+)[#?]{0,1}\\S*$/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAEC,GAAW,EAAkB;EACrD,MAAMC,OAAO,GACZ,2DAA2D,CAACC,IAAI,CAAEF,GAAI,CAAC;EACxE,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-path.ts"],
4
+ "sourcesContent": ["/**\n * Returns the path part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test'\n * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'\n * ```\n *\n * @return The path part of the URL.\n */\nexport function getPath( url: string ): string | void {\n\tconst matches =\n\t\t/^[^\\/\\s:]+:(?:\\/\\/)?[^\\/\\s#?]+[\\/]([^\\s#?]+)[#?]{0,1}\\S*$/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,QAAS,KAA6B;AACrD,QAAM,UACL,4DAA4D,KAAM,GAAI;AACvE,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
+ "names": []
7
+ }
@@ -1,26 +1,34 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_protocol_exports = {};
20
+ __export(get_protocol_exports, {
21
+ getProtocol: () => getProtocol
5
22
  });
6
- exports.getProtocol = getProtocol;
7
- /**
8
- * Returns the protocol part of the URL.
9
- *
10
- * @param url The full URL.
11
- *
12
- * @example
13
- * ```js
14
- * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'
15
- * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'
16
- * ```
17
- *
18
- * @return The protocol part of the URL.
19
- */
23
+ module.exports = __toCommonJS(get_protocol_exports);
20
24
  function getProtocol(url) {
21
25
  const matches = /^([^\s:]+:)/.exec(url);
22
26
  if (matches) {
23
27
  return matches[1];
24
28
  }
25
29
  }
26
- //# sourceMappingURL=get-protocol.js.map
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ getProtocol
33
+ });
34
+ //# sourceMappingURL=get-protocol.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getProtocol","url","matches","exec"],"sources":["@wordpress/url/src/get-protocol.ts"],"sourcesContent":["/**\n * Returns the protocol part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'\n * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'\n * ```\n *\n * @return The protocol part of the URL.\n */\nexport function getProtocol( url: string ): string | void {\n\tconst matches = /^([^\\s:]+:)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,MAAMC,OAAO,GAAG,aAAa,CAACC,IAAI,CAAEF,GAAI,CAAC;EACzC,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-protocol.ts"],
4
+ "sourcesContent": ["/**\n * Returns the protocol part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'\n * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'\n * ```\n *\n * @return The protocol part of the URL.\n */\nexport function getProtocol( url: string ): string | void {\n\tconst matches = /^([^\\s:]+:)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,YAAa,KAA6B;AACzD,QAAM,UAAU,cAAc,KAAM,GAAI;AACxC,MAAK,SAAU;AACd,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;",
6
+ "names": []
7
+ }
@@ -1,28 +1,32 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_query_arg_exports = {};
20
+ __export(get_query_arg_exports, {
21
+ getQueryArg: () => getQueryArg
5
22
  });
6
- exports.getQueryArg = getQueryArg;
7
- var _getQueryArgs = require("./get-query-args");
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- /**
13
- * Returns a single query argument of the url
14
- *
15
- * @param url URL.
16
- * @param arg Query arg name.
17
- *
18
- * @example
19
- * ```js
20
- * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar
21
- * ```
22
- *
23
- * @return Query arg value.
24
- */
23
+ module.exports = __toCommonJS(get_query_arg_exports);
24
+ var import_get_query_args = require("./get-query-args");
25
25
  function getQueryArg(url, arg) {
26
- return (0, _getQueryArgs.getQueryArgs)(url)[arg];
26
+ return (0, import_get_query_args.getQueryArgs)(url)[arg];
27
27
  }
28
- //# sourceMappingURL=get-query-arg.js.map
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ getQueryArg
31
+ });
32
+ //# sourceMappingURL=get-query-arg.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_getQueryArgs","require","getQueryArg","url","arg","getQueryArgs"],"sources":["@wordpress/url/src/get-query-arg.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\n\nexport interface QueryArgObject {\n\t[ key: string ]: QueryArgParsed;\n}\n\nexport type QueryArgParsed = string | string[] | QueryArgObject;\n\n/**\n * Returns a single query argument of the url\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar\n * ```\n *\n * @return Query arg value.\n */\nexport function getQueryArg(\n\turl: string,\n\targ: string\n): QueryArgParsed | undefined {\n\treturn getQueryArgs( url )[ arg ];\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAC1BC,GAAW,EACXC,GAAW,EACkB;EAC7B,OAAO,IAAAC,0BAAY,EAAEF,GAAI,CAAC,CAAEC,GAAG,CAAE;AAClC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-query-arg.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\n\nexport interface QueryArgObject {\n\t[ key: string ]: QueryArgParsed;\n}\n\nexport type QueryArgParsed = string | string[] | QueryArgObject;\n\n/**\n * Returns a single query argument of the url\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar\n * ```\n *\n * @return Query arg value.\n */\nexport function getQueryArg(\n\turl: string,\n\targ: string\n): QueryArgParsed | undefined {\n\treturn getQueryArgs( url )[ arg ];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA6B;AAqBtB,SAAS,YACf,KACA,KAC6B;AAC7B,aAAO,oCAAc,GAAI,EAAG,GAAI;AACjC;",
6
+ "names": []
7
+ }
@@ -1,87 +1,64 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_query_args_exports = {};
20
+ __export(get_query_args_exports, {
21
+ getQueryArgs: () => getQueryArgs
5
22
  });
6
- exports.getQueryArgs = getQueryArgs;
7
- var _safeDecodeUriComponent = require("./safe-decode-uri-component");
8
- var _getQueryString = require("./get-query-string");
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- /**
14
- * Sets a value in object deeply by a given array of path segments. Mutates the
15
- * object reference.
16
- *
17
- * @param object Object in which to assign.
18
- * @param path Path segment at which to set value.
19
- * @param value Value to set.
20
- */
23
+ module.exports = __toCommonJS(get_query_args_exports);
24
+ var import_safe_decode_uri_component = require("./safe-decode-uri-component");
25
+ var import_get_query_string = require("./get-query-string");
21
26
  function setPath(object, path, value) {
22
27
  const length = path.length;
23
28
  const lastIndex = length - 1;
24
29
  for (let i = 0; i < length; i++) {
25
30
  let key = path[i];
26
31
  if (!key && Array.isArray(object)) {
27
- // If key is empty string and next value is array, derive key from
28
- // the current length of the array.
29
32
  key = object.length.toString();
30
33
  }
31
- key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key;
32
-
33
- // If the next key in the path is numeric (or empty string), it will be
34
- // created as an array. Otherwise, it will be created as an object.
34
+ key = ["__proto__", "constructor", "prototype"].includes(key) ? key.toUpperCase() : key;
35
35
  const isNextKeyArrayIndex = !isNaN(Number(path[i + 1]));
36
- object[key] = i === lastIndex ?
37
- // If at end of path, assign the intended value.
38
- value :
39
- // Otherwise, advance to the next object in the path, creating
40
- // it if it does not yet exist.
41
- object[key] || (isNextKeyArrayIndex ? [] : {});
36
+ object[key] = i === lastIndex ? (
37
+ // If at end of path, assign the intended value.
38
+ value
39
+ ) : (
40
+ // Otherwise, advance to the next object in the path, creating
41
+ // it if it does not yet exist.
42
+ object[key] || (isNextKeyArrayIndex ? [] : {})
43
+ );
42
44
  if (Array.isArray(object[key]) && !isNextKeyArrayIndex) {
43
- // If we current key is non-numeric, but the next value is an
44
- // array, coerce the value to an object.
45
- object[key] = {
46
- ...object[key]
47
- };
45
+ object[key] = { ...object[key] };
48
46
  }
49
-
50
- // Update working reference object to the next in the path.
51
47
  object = object[key];
52
48
  }
53
49
  }
54
-
55
- /**
56
- * Returns an object of query arguments of the given URL. If the given URL is
57
- * invalid or has no querystring, an empty object is returned.
58
- *
59
- * @param url URL.
60
- *
61
- * @example
62
- * ```js
63
- * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );
64
- * // { "foo": "bar", "bar": "baz" }
65
- * ```
66
- *
67
- * @return Query args object.
68
- */
69
50
  function getQueryArgs(url) {
70
- return ((0, _getQueryString.getQueryString)(url) || ''
71
- // Normalize space encoding, accounting for PHP URL encoding
72
- // corresponding to `application/x-www-form-urlencoded`.
73
- //
74
- // See: https://tools.ietf.org/html/rfc1866#section-8.2.1
75
- ).replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => {
76
- const [key, value = ''] = keyValue.split('=')
77
- // Filtering avoids decoding as `undefined` for value, where
78
- // default is restored in destructuring assignment.
79
- .filter(Boolean).map(_safeDecodeUriComponent.safeDecodeURIComponent);
51
+ return ((0, import_get_query_string.getQueryString)(url) || "").replace(/\+/g, "%20").split("&").reduce((accumulator, keyValue) => {
52
+ const [key, value = ""] = keyValue.split("=").filter(Boolean).map(import_safe_decode_uri_component.safeDecodeURIComponent);
80
53
  if (key) {
81
- const segments = key.replace(/\]/g, '').split('[');
54
+ const segments = key.replace(/\]/g, "").split("[");
82
55
  setPath(accumulator, segments, value);
83
56
  }
84
57
  return accumulator;
85
- }, Object.create(null));
58
+ }, /* @__PURE__ */ Object.create(null));
86
59
  }
87
- //# sourceMappingURL=get-query-args.js.map
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ getQueryArgs
63
+ });
64
+ //# sourceMappingURL=get-query-args.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_safeDecodeUriComponent","require","_getQueryString","setPath","object","path","value","length","lastIndex","i","key","Array","isArray","toString","includes","toUpperCase","isNextKeyArrayIndex","isNaN","Number","getQueryArgs","url","getQueryString","replace","split","reduce","accumulator","keyValue","filter","Boolean","map","safeDecodeURIComponent","segments","Object","create"],"sources":["@wordpress/url/src/get-query-args.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { safeDecodeURIComponent } from './safe-decode-uri-component';\nimport { getQueryString } from './get-query-string';\nimport type { QueryArgParsed } from './get-query-arg';\n\ntype QueryArgs = Record< string, QueryArgParsed >;\n\n/**\n * Sets a value in object deeply by a given array of path segments. Mutates the\n * object reference.\n *\n * @param object Object in which to assign.\n * @param path Path segment at which to set value.\n * @param value Value to set.\n */\nfunction setPath( object: Record< string, any >, path: string[], value: any ) {\n\tconst length = path.length;\n\tconst lastIndex = length - 1;\n\tfor ( let i = 0; i < length; i++ ) {\n\t\tlet key = path[ i ];\n\n\t\tif ( ! key && Array.isArray( object ) ) {\n\t\t\t// If key is empty string and next value is array, derive key from\n\t\t\t// the current length of the array.\n\t\t\tkey = object.length.toString();\n\t\t}\n\n\t\tkey = [ '__proto__', 'constructor', 'prototype' ].includes( key )\n\t\t\t? key.toUpperCase()\n\t\t\t: key;\n\n\t\t// If the next key in the path is numeric (or empty string), it will be\n\t\t// created as an array. Otherwise, it will be created as an object.\n\t\tconst isNextKeyArrayIndex = ! isNaN( Number( path[ i + 1 ] ) );\n\n\t\tobject[ key ] =\n\t\t\ti === lastIndex\n\t\t\t\t? // If at end of path, assign the intended value.\n\t\t\t\t value\n\t\t\t\t: // Otherwise, advance to the next object in the path, creating\n\t\t\t\t // it if it does not yet exist.\n\t\t\t\t object[ key ] || ( isNextKeyArrayIndex ? [] : {} );\n\n\t\tif ( Array.isArray( object[ key ] ) && ! isNextKeyArrayIndex ) {\n\t\t\t// If we current key is non-numeric, but the next value is an\n\t\t\t// array, coerce the value to an object.\n\t\t\tobject[ key ] = { ...object[ key ] };\n\t\t}\n\n\t\t// Update working reference object to the next in the path.\n\t\tobject = object[ key ];\n\t}\n}\n\n/**\n * Returns an object of query arguments of the given URL. If the given URL is\n * invalid or has no querystring, an empty object is returned.\n *\n * @param url URL.\n *\n * @example\n * ```js\n * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );\n * // { \"foo\": \"bar\", \"bar\": \"baz\" }\n * ```\n *\n * @return Query args object.\n */\nexport function getQueryArgs( url: string ): QueryArgs {\n\treturn (\n\t\t( getQueryString( url ) || '' )\n\t\t\t// Normalize space encoding, accounting for PHP URL encoding\n\t\t\t// corresponding to `application/x-www-form-urlencoded`.\n\t\t\t//\n\t\t\t// See: https://tools.ietf.org/html/rfc1866#section-8.2.1\n\t\t\t.replace( /\\+/g, '%20' )\n\t\t\t.split( '&' )\n\t\t\t.reduce( ( accumulator, keyValue ) => {\n\t\t\t\tconst [ key, value = '' ] = keyValue\n\t\t\t\t\t.split( '=' )\n\t\t\t\t\t// Filtering avoids decoding as `undefined` for value, where\n\t\t\t\t\t// default is restored in destructuring assignment.\n\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t.map( safeDecodeURIComponent );\n\n\t\t\t\tif ( key ) {\n\t\t\t\t\tconst segments = key.replace( /\\]/g, '' ).split( '[' );\n\t\t\t\t\tsetPath( accumulator, segments, value );\n\t\t\t\t}\n\n\t\t\t\treturn accumulator;\n\t\t\t}, Object.create( null ) )\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,OAAOA,CAAEC,MAA6B,EAAEC,IAAc,EAAEC,KAAU,EAAG;EAC7E,MAAMC,MAAM,GAAGF,IAAI,CAACE,MAAM;EAC1B,MAAMC,SAAS,GAAGD,MAAM,GAAG,CAAC;EAC5B,KAAM,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,EAAEE,CAAC,EAAE,EAAG;IAClC,IAAIC,GAAG,GAAGL,IAAI,CAAEI,CAAC,CAAE;IAEnB,IAAK,CAAEC,GAAG,IAAIC,KAAK,CAACC,OAAO,CAAER,MAAO,CAAC,EAAG;MACvC;MACA;MACAM,GAAG,GAAGN,MAAM,CAACG,MAAM,CAACM,QAAQ,CAAC,CAAC;IAC/B;IAEAH,GAAG,GAAG,CAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAE,CAACI,QAAQ,CAAEJ,GAAI,CAAC,GAC9DA,GAAG,CAACK,WAAW,CAAC,CAAC,GACjBL,GAAG;;IAEN;IACA;IACA,MAAMM,mBAAmB,GAAG,CAAEC,KAAK,CAAEC,MAAM,CAAEb,IAAI,CAAEI,CAAC,GAAG,CAAC,CAAG,CAAE,CAAC;IAE9DL,MAAM,CAAEM,GAAG,CAAE,GACZD,CAAC,KAAKD,SAAS;IACZ;IACAF,KAAK;IACL;IACA;IACAF,MAAM,CAAEM,GAAG,CAAE,KAAMM,mBAAmB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAE;IAEtD,IAAKL,KAAK,CAACC,OAAO,CAAER,MAAM,CAAEM,GAAG,CAAG,CAAC,IAAI,CAAEM,mBAAmB,EAAG;MAC9D;MACA;MACAZ,MAAM,CAAEM,GAAG,CAAE,GAAG;QAAE,GAAGN,MAAM,CAAEM,GAAG;MAAG,CAAC;IACrC;;IAEA;IACAN,MAAM,GAAGA,MAAM,CAAEM,GAAG,CAAE;EACvB;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASS,YAAYA,CAAEC,GAAW,EAAc;EACtD,OACC,CAAE,IAAAC,8BAAc,EAAED,GAAI,CAAC,IAAI;EAC1B;EACA;EACA;EACA;EAAA,EACCE,OAAO,CAAE,KAAK,EAAE,KAAM,CAAC,CACvBC,KAAK,CAAE,GAAI,CAAC,CACZC,MAAM,CAAE,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IACrC,MAAM,CAAEhB,GAAG,EAAEJ,KAAK,GAAG,EAAE,CAAE,GAAGoB,QAAQ,CAClCH,KAAK,CAAE,GAAI;IACZ;IACA;IAAA,CACCI,MAAM,CAAEC,OAAQ,CAAC,CACjBC,GAAG,CAAEC,8CAAuB,CAAC;IAE/B,IAAKpB,GAAG,EAAG;MACV,MAAMqB,QAAQ,GAAGrB,GAAG,CAACY,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC,CAACC,KAAK,CAAE,GAAI,CAAC;MACtDpB,OAAO,CAAEsB,WAAW,EAAEM,QAAQ,EAAEzB,KAAM,CAAC;IACxC;IAEA,OAAOmB,WAAW;EACnB,CAAC,EAAEO,MAAM,CAACC,MAAM,CAAE,IAAK,CAAE,CAAC;AAE7B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-query-args.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { safeDecodeURIComponent } from './safe-decode-uri-component';\nimport { getQueryString } from './get-query-string';\nimport type { QueryArgParsed } from './get-query-arg';\n\ntype QueryArgs = Record< string, QueryArgParsed >;\n\n/**\n * Sets a value in object deeply by a given array of path segments. Mutates the\n * object reference.\n *\n * @param object Object in which to assign.\n * @param path Path segment at which to set value.\n * @param value Value to set.\n */\nfunction setPath( object: Record< string, any >, path: string[], value: any ) {\n\tconst length = path.length;\n\tconst lastIndex = length - 1;\n\tfor ( let i = 0; i < length; i++ ) {\n\t\tlet key = path[ i ];\n\n\t\tif ( ! key && Array.isArray( object ) ) {\n\t\t\t// If key is empty string and next value is array, derive key from\n\t\t\t// the current length of the array.\n\t\t\tkey = object.length.toString();\n\t\t}\n\n\t\tkey = [ '__proto__', 'constructor', 'prototype' ].includes( key )\n\t\t\t? key.toUpperCase()\n\t\t\t: key;\n\n\t\t// If the next key in the path is numeric (or empty string), it will be\n\t\t// created as an array. Otherwise, it will be created as an object.\n\t\tconst isNextKeyArrayIndex = ! isNaN( Number( path[ i + 1 ] ) );\n\n\t\tobject[ key ] =\n\t\t\ti === lastIndex\n\t\t\t\t? // If at end of path, assign the intended value.\n\t\t\t\t value\n\t\t\t\t: // Otherwise, advance to the next object in the path, creating\n\t\t\t\t // it if it does not yet exist.\n\t\t\t\t object[ key ] || ( isNextKeyArrayIndex ? [] : {} );\n\n\t\tif ( Array.isArray( object[ key ] ) && ! isNextKeyArrayIndex ) {\n\t\t\t// If we current key is non-numeric, but the next value is an\n\t\t\t// array, coerce the value to an object.\n\t\t\tobject[ key ] = { ...object[ key ] };\n\t\t}\n\n\t\t// Update working reference object to the next in the path.\n\t\tobject = object[ key ];\n\t}\n}\n\n/**\n * Returns an object of query arguments of the given URL. If the given URL is\n * invalid or has no querystring, an empty object is returned.\n *\n * @param url URL.\n *\n * @example\n * ```js\n * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );\n * // { \"foo\": \"bar\", \"bar\": \"baz\" }\n * ```\n *\n * @return Query args object.\n */\nexport function getQueryArgs( url: string ): QueryArgs {\n\treturn (\n\t\t( getQueryString( url ) || '' )\n\t\t\t// Normalize space encoding, accounting for PHP URL encoding\n\t\t\t// corresponding to `application/x-www-form-urlencoded`.\n\t\t\t//\n\t\t\t// See: https://tools.ietf.org/html/rfc1866#section-8.2.1\n\t\t\t.replace( /\\+/g, '%20' )\n\t\t\t.split( '&' )\n\t\t\t.reduce( ( accumulator, keyValue ) => {\n\t\t\t\tconst [ key, value = '' ] = keyValue\n\t\t\t\t\t.split( '=' )\n\t\t\t\t\t// Filtering avoids decoding as `undefined` for value, where\n\t\t\t\t\t// default is restored in destructuring assignment.\n\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t.map( safeDecodeURIComponent );\n\n\t\t\t\tif ( key ) {\n\t\t\t\t\tconst segments = key.replace( /\\]/g, '' ).split( '[' );\n\t\t\t\t\tsetPath( accumulator, segments, value );\n\t\t\t\t}\n\n\t\t\t\treturn accumulator;\n\t\t\t}, Object.create( null ) )\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uCAAuC;AACvC,8BAA+B;AAa/B,SAAS,QAAS,QAA+B,MAAgB,OAAa;AAC7E,QAAM,SAAS,KAAK;AACpB,QAAM,YAAY,SAAS;AAC3B,WAAU,IAAI,GAAG,IAAI,QAAQ,KAAM;AAClC,QAAI,MAAM,KAAM,CAAE;AAElB,QAAK,CAAE,OAAO,MAAM,QAAS,MAAO,GAAI;AAGvC,YAAM,OAAO,OAAO,SAAS;AAAA,IAC9B;AAEA,UAAM,CAAE,aAAa,eAAe,WAAY,EAAE,SAAU,GAAI,IAC7D,IAAI,YAAY,IAChB;AAIH,UAAM,sBAAsB,CAAE,MAAO,OAAQ,KAAM,IAAI,CAAE,CAAE,CAAE;AAE7D,WAAQ,GAAI,IACX,MAAM;AAAA;AAAA,MAEH;AAAA;AAAA;AAAA;AAAA,MAGA,OAAQ,GAAI,MAAO,sBAAsB,CAAC,IAAI,CAAC;AAAA;AAEnD,QAAK,MAAM,QAAS,OAAQ,GAAI,CAAE,KAAK,CAAE,qBAAsB;AAG9D,aAAQ,GAAI,IAAI,EAAE,GAAG,OAAQ,GAAI,EAAE;AAAA,IACpC;AAGA,aAAS,OAAQ,GAAI;AAAA,EACtB;AACD;AAgBO,SAAS,aAAc,KAAyB;AACtD,cACG,wCAAgB,GAAI,KAAK,IAKzB,QAAS,OAAO,KAAM,EACtB,MAAO,GAAI,EACX,OAAQ,CAAE,aAAa,aAAc;AACrC,UAAM,CAAE,KAAK,QAAQ,EAAG,IAAI,SAC1B,MAAO,GAAI,EAGX,OAAQ,OAAQ,EAChB,IAAK,uDAAuB;AAE9B,QAAK,KAAM;AACV,YAAM,WAAW,IAAI,QAAS,OAAO,EAAG,EAAE,MAAO,GAAI;AACrD,cAAS,aAAa,UAAU,KAAM;AAAA,IACvC;AAEA,WAAO;AAAA,EACR,GAAG,uBAAO,OAAQ,IAAK,CAAE;AAE5B;",
6
+ "names": []
7
+ }
@@ -1,29 +1,38 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
-
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_query_string_exports = {};
20
+ __export(get_query_string_exports, {
21
+ getQueryString: () => getQueryString
6
22
  });
7
- exports.getQueryString = getQueryString;
8
- /**
9
- * Returns the query string part of the URL.
10
- *
11
- * @param url The full URL.
12
- *
13
- * @example
14
- * ```js
15
- * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'
16
- * ```
17
- *
18
- * @return The query string part of the URL.
19
- */
23
+ module.exports = __toCommonJS(get_query_string_exports);
20
24
  function getQueryString(url) {
21
25
  let query;
22
26
  try {
23
- query = new URL(url, 'http://example.com').search.substring(1);
24
- } catch (error) {}
27
+ query = new URL(url, "http://example.com").search.substring(1);
28
+ } catch (error) {
29
+ }
25
30
  if (query) {
26
31
  return query;
27
32
  }
28
33
  }
29
- //# sourceMappingURL=get-query-string.js.map
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ getQueryString
37
+ });
38
+ //# sourceMappingURL=get-query-string.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getQueryString","url","query","URL","search","substring","error"],"sources":["@wordpress/url/src/get-query-string.ts"],"sourcesContent":["/**\n * Returns the query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'\n * ```\n *\n * @return The query string part of the URL.\n */\nexport function getQueryString( url: string ): string | void {\n\tlet query;\n\ttry {\n\t\tquery = new URL( url, 'http://example.com' ).search.substring( 1 );\n\t} catch ( error ) {}\n\n\tif ( query ) {\n\t\treturn query;\n\t}\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAAEC,GAAW,EAAkB;EAC5D,IAAIC,KAAK;EACT,IAAI;IACHA,KAAK,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,MAAM,CAACC,SAAS,CAAE,CAAE,CAAC;EACnE,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKJ,KAAK,EAAG;IACZ,OAAOA,KAAK;EACb;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-query-string.ts"],
4
+ "sourcesContent": ["/**\n * Returns the query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'\n * ```\n *\n * @return The query string part of the URL.\n */\nexport function getQueryString( url: string ): string | void {\n\tlet query;\n\ttry {\n\t\tquery = new URL( url, 'http://example.com' ).search.substring( 1 );\n\t} catch ( error ) {}\n\n\tif ( query ) {\n\t\treturn query;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,eAAgB,KAA6B;AAC5D,MAAI;AACJ,MAAI;AACH,YAAQ,IAAI,IAAK,KAAK,oBAAqB,EAAE,OAAO,UAAW,CAAE;AAAA,EAClE,SAAU,OAAQ;AAAA,EAAC;AAEnB,MAAK,OAAQ;AACZ,WAAO;AAAA,EACR;AACD;",
6
+ "names": []
7
+ }
@@ -1,28 +1,32 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var has_query_arg_exports = {};
20
+ __export(has_query_arg_exports, {
21
+ hasQueryArg: () => hasQueryArg
5
22
  });
6
- exports.hasQueryArg = hasQueryArg;
7
- var _getQueryArg = require("./get-query-arg");
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- /**
13
- * Determines whether the URL contains a given query arg.
14
- *
15
- * @param url URL.
16
- * @param arg Query arg name.
17
- *
18
- * @example
19
- * ```js
20
- * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true
21
- * ```
22
- *
23
- * @return Whether or not the URL contains the query arg.
24
- */
23
+ module.exports = __toCommonJS(has_query_arg_exports);
24
+ var import_get_query_arg = require("./get-query-arg");
25
25
  function hasQueryArg(url, arg) {
26
- return (0, _getQueryArg.getQueryArg)(url, arg) !== undefined;
26
+ return (0, import_get_query_arg.getQueryArg)(url, arg) !== void 0;
27
27
  }
28
- //# sourceMappingURL=has-query-arg.js.map
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ hasQueryArg
31
+ });
32
+ //# sourceMappingURL=has-query-arg.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_getQueryArg","require","hasQueryArg","url","arg","getQueryArg","undefined"],"sources":["@wordpress/url/src/has-query-arg.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArg } from './get-query-arg';\n\n/**\n * Determines whether the URL contains a given query arg.\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true\n * ```\n *\n * @return Whether or not the URL contains the query arg.\n */\nexport function hasQueryArg( url: string, arg: string ): boolean {\n\treturn getQueryArg( url, arg ) !== undefined;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAW,EAAEC,GAAW,EAAY;EAChE,OAAO,IAAAC,wBAAW,EAAEF,GAAG,EAAEC,GAAI,CAAC,KAAKE,SAAS;AAC7C","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/has-query-arg.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArg } from './get-query-arg';\n\n/**\n * Determines whether the URL contains a given query arg.\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true\n * ```\n *\n * @return Whether or not the URL contains the query arg.\n */\nexport function hasQueryArg( url: string, arg: string ): boolean {\n\treturn getQueryArg( url, arg ) !== undefined;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAA4B;AAerB,SAAS,YAAa,KAAa,KAAuB;AAChE,aAAO,kCAAa,KAAK,GAAI,MAAM;AACpC;",
6
+ "names": []
7
+ }